refactor getCoordinates functions

This commit is contained in:
Azgaar 2021-11-10 20:57:28 +03:00
parent 165d8e48be
commit 762ec2c841
4 changed files with 19 additions and 13 deletions

View file

@ -450,7 +450,7 @@ function saveGeoJSON_Rivers() {
function saveGeoJSON_Markers() {
const features = pack.markers.map(marker => {
const {i, type, icon, x, y, size, fill, stroke} = marker;
const coordinates = getQGIScoordinates(x, y);
const coordinates = getCoordinates(x, y, 4);
const id = `marker${i}`;
const note = notes.find(note => note.id === id);
const properties = {id, type, icon, ...note, size, fill, stroke};
@ -465,7 +465,7 @@ function saveGeoJSON_Markers() {
function getCellCoordinates(vertices) {
const p = pack.vertices.p;
const coordinates = vertices.map(n => getQGIScoordinates(p[n][0], p[n][1]));
const coordinates = vertices.map(n => getCoordinates(p[n][0], p[n][1], 2));
return [coordinates.concat([coordinates[0]])];
}
@ -475,7 +475,7 @@ function getRoutePoints(node) {
const increment = l / Math.ceil(l / 2);
for (let i = 0; i <= l; i += increment) {
const p = node.getPointAtLength(i);
points.push(getQGIScoordinates(p.x, p.y));
points.push(getCoordinates(p.x, p.y, 4));
}
return points;
}
@ -487,7 +487,7 @@ function getRiverPoints(node) {
for (let i = l, c = i; i >= 0; i -= increment, c += increment) {
const p1 = node.getPointAtLength(i);
const p2 = node.getPointAtLength(c);
const [x, y] = getQGIScoordinates((p1.x + p2.x) / 2, (p1.y + p2.y) / 2);
const [x, y] = getCoordinates((p1.x + p2.x) / 2, (p1.y + p2.y) / 2, 4);
points.push([x, y]);
}
return points;