@dra2020/baseclient 1.0.5 → 1.0.6
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 +8 -5
- package/dist/baseclient.js.map +1 -1
- package/lib/poly/topo.ts +10 -5
- package/package.json +1 -1
package/lib/poly/topo.ts
CHANGED
|
@@ -184,6 +184,11 @@ export interface SimplifyOptions
|
|
|
184
184
|
|
|
185
185
|
const DefaultSimplifyOptions: SimplifyOptions = { minArea: 500 };
|
|
186
186
|
|
|
187
|
+
function log(s: string): void
|
|
188
|
+
{
|
|
189
|
+
//console.log(s);
|
|
190
|
+
}
|
|
191
|
+
|
|
187
192
|
//
|
|
188
193
|
// topoSimplifyCollection:
|
|
189
194
|
// This implements our simplification strategy for block/precinct level shapes. The basic idea is to
|
|
@@ -208,10 +213,10 @@ export function topoSimplifyCollection(col: any, options?: SimplifyOptions): any
|
|
|
208
213
|
let elapsedTotal = new Util.Elapsed();
|
|
209
214
|
let elapsed = new Util.Elapsed();
|
|
210
215
|
let topo = topoFromCollection(col);
|
|
211
|
-
|
|
216
|
+
log(`topoSimplifyCollection: fromCollection: ${Math.round(elapsed.ms())}ms`);
|
|
212
217
|
elapsed.start();
|
|
213
218
|
topo = TopoSimplify.presimplify(topo, TopoSimplify['sphericalTriangleArea']);
|
|
214
|
-
|
|
219
|
+
log(`topoSimplifyCollection: presimplify: ${Math.round(elapsed.ms())}ms`);
|
|
215
220
|
elapsed.start();
|
|
216
221
|
|
|
217
222
|
// Keep iterating on removing simplification from degenerate shapes
|
|
@@ -276,13 +281,13 @@ export function topoSimplifyCollection(col: any, options?: SimplifyOptions): any
|
|
|
276
281
|
}
|
|
277
282
|
}
|
|
278
283
|
});
|
|
279
|
-
|
|
284
|
+
log(`topoSimplifyCollection: pass ${nTries}: ${nBad} (${nTiny} tiny) of ${col.features.length} features are degenerate`);
|
|
280
285
|
|
|
281
286
|
// If not making progress, keep more points
|
|
282
287
|
if (nBad >= nBadLast)
|
|
283
288
|
{
|
|
284
289
|
keepweight /= 10;
|
|
285
|
-
|
|
290
|
+
log(`topoSimplifyCollection: pass ${nTries}: reducing weight limit to ${keepweight}`);
|
|
286
291
|
}
|
|
287
292
|
nBadLast = nBad;
|
|
288
293
|
|
|
@@ -298,7 +303,7 @@ export function topoSimplifyCollection(col: any, options?: SimplifyOptions): any
|
|
|
298
303
|
nTries++;
|
|
299
304
|
}
|
|
300
305
|
|
|
301
|
-
|
|
306
|
+
log(`topoSimplifyCollection: total elapsed time: ${bigTimeString(elapsedTotal.ms())}`);
|
|
302
307
|
|
|
303
308
|
return col;
|
|
304
309
|
}
|