@dra2020/baseclient 1.0.39 → 1.0.40
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/baseclient.js +23 -1
- package/dist/baseclient.js.map +1 -1
- package/dist/poly/poly.d.ts +1 -0
- package/lib/poly/poly.ts +25 -0
- package/package.json +1 -1
package/dist/poly/poly.d.ts
CHANGED
|
@@ -50,3 +50,4 @@ export declare function npoints(poly: any): number;
|
|
|
50
50
|
export declare function polyTransform(poly: any, transformFn: any): any;
|
|
51
51
|
export declare function featureRewind(poly: any): any;
|
|
52
52
|
export declare function polyRewindRings(pp: any, bLog?: boolean): any;
|
|
53
|
+
export declare function polyBadCoordinates(f: any): boolean;
|
package/lib/poly/poly.ts
CHANGED
|
@@ -766,3 +766,28 @@ function twoTimesArea(x2: number, x1: number, y2: number, y1: number): number
|
|
|
766
766
|
return (x2 - x1) * (y2 + y1);
|
|
767
767
|
}
|
|
768
768
|
|
|
769
|
+
function badCoord(c: number): boolean
|
|
770
|
+
{
|
|
771
|
+
return isNaN(c) || c > 360 || c < -360;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
export function polyBadCoordinates(f: any): boolean
|
|
775
|
+
{
|
|
776
|
+
if (f.type === 'FeatureCollection' && f.features)
|
|
777
|
+
{
|
|
778
|
+
for (let i = 0; i < f.features.length; i++)
|
|
779
|
+
if (polyBadCoordinates(f.features[i])) return true;
|
|
780
|
+
return false;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
let pp = polyNormalize(f);
|
|
784
|
+
let bad = false;
|
|
785
|
+
if (pp)
|
|
786
|
+
{
|
|
787
|
+
PP.polyPackEachPoint(pp, (b: Float64Array, iPoly: number, iRing: number, iOffset: number) => {
|
|
788
|
+
if (bad) return;
|
|
789
|
+
bad = badCoord(b[iOffset]) || badCoord(b[iOffset+1]);
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
return bad;
|
|
793
|
+
}
|