@dra2020/baseclient 1.0.64 → 1.0.65
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 +19 -13
- package/dist/baseclient.js.map +1 -1
- package/lib/poly/poly.ts +20 -11
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -6814,24 +6814,30 @@ function featureRewind(f, options) {
|
|
|
6814
6814
|
// Only applies to multi-polygons with no holes
|
|
6815
6815
|
let d = Util.depthof(f.geometry.coordinates);
|
|
6816
6816
|
let windings = polyRingWindings(f);
|
|
6817
|
-
if (options.validateHoles && d === 5 && windings.length) {
|
|
6818
|
-
//
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
nHoles
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6817
|
+
if (options.validateHoles && d === 5 && windings.length > 1) {
|
|
6818
|
+
// First winding needs to be correct so we have a poly to add holes to
|
|
6819
|
+
if (!misWound(windings[0])) {
|
|
6820
|
+
// Flatten everything out and then rebuild hole structure based on windings
|
|
6821
|
+
let nHoles = 0;
|
|
6822
|
+
windings.forEach(w => { nHoles += w.iRing ? 1 : 0; });
|
|
6823
|
+
if (nHoles) {
|
|
6824
|
+
let c = [];
|
|
6825
|
+
f.geometry.coordinates.forEach((poly) => {
|
|
6826
|
+
poly.forEach((ring) => {
|
|
6827
|
+
c.push([ring]);
|
|
6828
|
+
});
|
|
6829
|
+
});
|
|
6830
|
+
f.geometry.coordinates = c;
|
|
6831
|
+
windings = polyRingWindings(f);
|
|
6832
|
+
}
|
|
6826
6833
|
let polys = f.geometry.coordinates;
|
|
6827
|
-
let iPoly;
|
|
6828
|
-
for (; iWinding < windings.length; iWinding++) {
|
|
6834
|
+
let iPoly = 0;
|
|
6835
|
+
for (let iWinding = 0; iWinding < windings.length; iWinding++) {
|
|
6829
6836
|
let good = !misWound(windings[iWinding]);
|
|
6830
|
-
if (!good && iWinding == 0) // First is miswound - no good
|
|
6831
|
-
break;
|
|
6832
6837
|
if (good)
|
|
6833
6838
|
iPoly = iWinding;
|
|
6834
6839
|
else {
|
|
6840
|
+
// If hole, add to previous poly
|
|
6835
6841
|
polys[iPoly].push(polys[iWinding][0]);
|
|
6836
6842
|
polys[iWinding] = null;
|
|
6837
6843
|
}
|