@dra2020/baseclient 1.0.39 → 1.0.42

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.
@@ -5973,7 +5973,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
5973
5973
  return result;
5974
5974
  };
5975
5975
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5976
- exports.polyRewindRings = exports.featureRewind = exports.polyTransform = exports.npoints = exports.polyDescribe = exports.polyCompactness = exports.makeConvexHullMonotoneChain2D = exports.polyConvexHull = exports.polyToExteriorPoints = exports.polyFromCircle = exports.polyToPolsbyPopperCircle = exports.polyToCircle = exports.Circle = exports.polyPerimeter = exports.polyDiameter = exports.polyArea = exports.polyNull = exports.polyNormalize = exports.polySimpleArea = exports.DefaultOptions = exports.EARTH_RADIUS = exports.DefaultTickOptions = void 0;
5976
+ exports.polyBadCoordinates = exports.polyRewindRings = exports.featureRewind = exports.polyTransform = exports.npoints = exports.polyDescribe = exports.polyCompactness = exports.makeConvexHullMonotoneChain2D = exports.polyConvexHull = exports.polyToExteriorPoints = exports.polyFromCircle = exports.polyToPolsbyPopperCircle = exports.polyToCircle = exports.Circle = exports.polyPerimeter = exports.polyDiameter = exports.polyArea = exports.polyNull = exports.polyNormalize = exports.polySimpleArea = exports.DefaultOptions = exports.EARTH_RADIUS = exports.DefaultTickOptions = void 0;
5977
5977
  const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
5978
5978
  const PP = __importStar(__webpack_require__(/*! ./polypack */ "./lib/poly/polypack.ts"));
5979
5979
  const graham_scan_1 = __webpack_require__(/*! ./graham-scan */ "./lib/poly/graham-scan.ts");
@@ -6578,6 +6578,28 @@ exports.polyRewindRings = polyRewindRings;
6578
6578
  function twoTimesArea(x2, x1, y2, y1) {
6579
6579
  return (x2 - x1) * (y2 + y1);
6580
6580
  }
6581
+ function badCoord(c) {
6582
+ return isNaN(c) || c > 360 || c < -360;
6583
+ }
6584
+ function polyBadCoordinates(f) {
6585
+ if (f.type === 'FeatureCollection' && f.features) {
6586
+ for (let i = 0; i < f.features.length; i++)
6587
+ if (polyBadCoordinates(f.features[i]))
6588
+ return true;
6589
+ return false;
6590
+ }
6591
+ let pp = polyNormalize(f);
6592
+ let bad = false;
6593
+ if (pp) {
6594
+ PP.polyPackEachPoint(pp, (b, iPoly, iRing, iOffset) => {
6595
+ if (bad)
6596
+ return;
6597
+ bad = badCoord(b[iOffset]) || badCoord(b[iOffset + 1]);
6598
+ });
6599
+ }
6600
+ return bad;
6601
+ }
6602
+ exports.polyBadCoordinates = polyBadCoordinates;
6581
6603
 
6582
6604
 
6583
6605
  /***/ }),
@@ -8287,6 +8309,7 @@ const P = __importStar(__webpack_require__(/*! ./poly */ "./lib/poly/poly.ts"));
8287
8309
  const PP = __importStar(__webpack_require__(/*! ./polypack */ "./lib/poly/polypack.ts"));
8288
8310
  const PL = __importStar(__webpack_require__(/*! ./polylabel */ "./lib/poly/polylabel.ts"));
8289
8311
  const shamos_1 = __webpack_require__(/*! ./shamos */ "./lib/poly/shamos.ts");
8312
+ const pointinpoly_1 = __webpack_require__(/*! ./pointinpoly */ "./lib/poly/pointinpoly.ts");
8290
8313
  function getGEOID(f) {
8291
8314
  if (f.features && f.features.length)
8292
8315
  f = f.features[0];
@@ -8442,6 +8465,20 @@ function bigTimeString(ms) {
8442
8465
  seconds -= minutes * 60;
8443
8466
  return `${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
8444
8467
  }
8468
+ function intpt(f) {
8469
+ let x = 0, y = 0;
8470
+ for (let p of ['INTPTLON20', 'INTPTLON10', 'INTPTLON', 'labelx'])
8471
+ if (f.properties[p] && !isNaN(Number(f.properties[p]))) {
8472
+ x = Number(f.properties[p]);
8473
+ break;
8474
+ }
8475
+ for (let p of ['INTPTLAT20', 'INTPTLAT10', 'INTPTLAT', 'labely'])
8476
+ if (f.properties[p] && !isNaN(Number(f.properties[p]))) {
8477
+ y = Number(f.properties[p]);
8478
+ break;
8479
+ }
8480
+ return { x: x, y: y };
8481
+ }
8445
8482
  const DefaultSimplifyOptions = { minArea: 500 };
8446
8483
  function log(s) {
8447
8484
  //console.log(s);
@@ -8523,7 +8560,8 @@ function topoSimplifyCollection(col, options) {
8523
8560
  }
8524
8561
  if (!bDecided) {
8525
8562
  let pp = PP.polyPackTopoArcs(testtopo, arcs);
8526
- if (shamos_1.selfIntersectFast(pp)) {
8563
+ let { x, y } = intpt(f);
8564
+ if (shamos_1.selfIntersectFast(pp) || (x && y && !pointinpoly_1.polyContainsPoint(pp, x, y))) {
8527
8565
  keepArcs(topo, oOld.arcs, keepweight);
8528
8566
  nBad++;
8529
8567
  }