mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
refactor getCoordinates functions
This commit is contained in:
parent
165d8e48be
commit
762ec2c841
4 changed files with 19 additions and 13 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue