dgeoutils 2.2.17 → 2.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DPoint.d.ts +1 -1
- package/dist/DPoint.js +9 -11
- package/dist/DPolygon.d.ts +1 -0
- package/dist/DPolygon.js +4 -0
- package/package.json +1 -1
package/dist/DPoint.d.ts
CHANGED
package/dist/DPoint.js
CHANGED
|
@@ -462,17 +462,15 @@ class DPoint {
|
|
|
462
462
|
return new DPoint(x, y).radiansToDegrees();
|
|
463
463
|
}));
|
|
464
464
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
return res;
|
|
465
|
+
sortByDistance(p) {
|
|
466
|
+
return p
|
|
467
|
+
.clone()
|
|
468
|
+
.map((d, index) => {
|
|
469
|
+
d.properties.distance = d.distance(this);
|
|
470
|
+
d.properties.index = index;
|
|
471
|
+
return d;
|
|
472
|
+
})
|
|
473
|
+
.sort((a, b) => a.properties.distance - b.properties.distance);
|
|
476
474
|
}
|
|
477
475
|
}
|
|
478
476
|
exports.DPoint = DPoint;
|
package/dist/DPolygon.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export declare class DPolygon {
|
|
|
58
58
|
filter(f: (p: DPoint) => boolean): DPolygon;
|
|
59
59
|
map(f: (r: DPoint) => DPoint): DPolygon;
|
|
60
60
|
map(f: (r: DPoint, index: number) => DPoint): DPolygon;
|
|
61
|
+
sort(f: (a: DPoint, b: DPoint) => number): DPolygon;
|
|
61
62
|
at(index: number): DPoint;
|
|
62
63
|
pop(): DPoint;
|
|
63
64
|
push(...args: DPoint[]): number;
|
package/dist/DPolygon.js
CHANGED
|
@@ -349,6 +349,10 @@ class DPolygon {
|
|
|
349
349
|
this.holes = this.holes.map((h) => h.map(f));
|
|
350
350
|
return this;
|
|
351
351
|
}
|
|
352
|
+
sort(f) {
|
|
353
|
+
this.points.sort(f);
|
|
354
|
+
return this;
|
|
355
|
+
}
|
|
352
356
|
at(index) {
|
|
353
357
|
const { length } = this;
|
|
354
358
|
return this.points[(index % length + length) % length];
|