@dra2020/baseclient 1.0.40 → 1.0.43
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 +25 -1
- package/dist/baseclient.js.map +1 -1
- package/lib/poly/topo.ts +31 -1
- package/package.json +1 -1
package/lib/poly/topo.ts
CHANGED
|
@@ -14,6 +14,7 @@ import * as Q from './quad';
|
|
|
14
14
|
import * as PP from './polypack';
|
|
15
15
|
import * as PL from './polylabel';
|
|
16
16
|
import { selfIntersectFast } from './shamos';
|
|
17
|
+
import { polyContainsPoint } from './pointinpoly';
|
|
17
18
|
|
|
18
19
|
export type Topo = any;
|
|
19
20
|
|
|
@@ -193,6 +194,24 @@ function bigTimeString(ms: number): string
|
|
|
193
194
|
return `${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
|
|
194
195
|
}
|
|
195
196
|
|
|
197
|
+
function intpt(f: any): { x: number, y: number }
|
|
198
|
+
{
|
|
199
|
+
let x = 0, y = 0;
|
|
200
|
+
for (let p of ['INTPTLON20','INTPTLON10','INTPTLON','labelx'])
|
|
201
|
+
if (f.properties[p] && !isNaN(Number(f.properties[p])))
|
|
202
|
+
{
|
|
203
|
+
x = Number(f.properties[p]);
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
for (let p of ['INTPTLAT20','INTPTLAT10','INTPTLAT','labely'])
|
|
207
|
+
if (f.properties[p] && !isNaN(Number(f.properties[p])))
|
|
208
|
+
{
|
|
209
|
+
y = Number(f.properties[p]);
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
return {x: x, y: y};
|
|
213
|
+
}
|
|
214
|
+
|
|
196
215
|
export interface SimplifyOptions
|
|
197
216
|
{
|
|
198
217
|
minArea?: number,
|
|
@@ -202,7 +221,7 @@ const DefaultSimplifyOptions: SimplifyOptions = { minArea: 500 };
|
|
|
202
221
|
|
|
203
222
|
function log(s: string): void
|
|
204
223
|
{
|
|
205
|
-
|
|
224
|
+
console.log(s);
|
|
206
225
|
}
|
|
207
226
|
|
|
208
227
|
//
|
|
@@ -299,6 +318,17 @@ export function topoSimplifyCollection(col: any, options?: SimplifyOptions): any
|
|
|
299
318
|
keepArcs(topo, oOld.arcs, keepweight);
|
|
300
319
|
nBad++;
|
|
301
320
|
}
|
|
321
|
+
else
|
|
322
|
+
{
|
|
323
|
+
let {x,y} = intpt(f);
|
|
324
|
+
if (x && y && !polyContainsPoint(pp, x, y))
|
|
325
|
+
{
|
|
326
|
+
keepTiny.set(f, f);
|
|
327
|
+
keepArcs(topo, oOld.arcs, 0); // keeps all points to avoid reprocessing these tiny shapes
|
|
328
|
+
nBad++, nTiny++;
|
|
329
|
+
log(`topoSimplifyCollection: ${f.properties.id}: preserving full feature because of intpt problem`);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
302
332
|
}
|
|
303
333
|
}
|
|
304
334
|
});
|