geojs 1.10.6 → 1.10.9

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.
@@ -0,0 +1,11 @@
1
+ name: Lint Commit Messages
2
+ on: [pull_request, push]
3
+
4
+ jobs:
5
+ commitlint:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v3
9
+ with:
10
+ fetch-depth: 0
11
+ - uses: wagoid/commitlint-github-action@v5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # GeoJS Change Log
2
2
 
3
+ ## Version 1.10.6
4
+
5
+ ### Improvements
6
+
7
+ - Uncross polygon annotations ([#1236](../../pull/1236))
8
+
9
+ ## Version 1.10.5
10
+
11
+ ### Improvements
12
+
13
+ - Allow using the rdp functions on non-feature polygons ([#1234](../../pull/1234))
14
+ - Allow annotations to be created regardless of metakeys ([#1235](../../pull/1235))
15
+
16
+ ## Version 1.10.5
17
+
18
+ ### Bug Fixes
19
+
20
+ - Guard texture update calls ([#1233](../../pull/1233))
21
+
3
22
  ## Version 1.10.5
4
23
 
5
24
  ### Bug Fixes
@@ -0,0 +1,24 @@
1
+ module.exports = {
2
+ extends: ['@commitlint/config-conventional'],
3
+ rules: {
4
+ 'subject-case': [0],
5
+ // These are the standard values, but are listed here for easier reference
6
+ 'type-enum': [
7
+ 2,
8
+ 'always',
9
+ [
10
+ 'build',
11
+ 'chore',
12
+ 'ci',
13
+ 'docs',
14
+ 'feat',
15
+ 'fix',
16
+ 'perf',
17
+ 'refactor',
18
+ 'revert',
19
+ 'style',
20
+ 'test'
21
+ ]
22
+ ]
23
+ }
24
+ };
package/geo.js CHANGED
@@ -1540,11 +1540,7 @@ function continuousVerticesActions(m_this, s_actions, state, name, originalArgs)
1540
1540
  action: geo_action['annotation_' + name],
1541
1541
  name: name + ' create',
1542
1542
  owner: annotationActionOwner,
1543
- input: 'left',
1544
- modifiers: {
1545
- shift: false,
1546
- ctrl: false
1547
- }
1543
+ input: 'left'
1548
1544
  }, {
1549
1545
  action: geo_action['annotation_' + name],
1550
1546
  name: name + ' create',
@@ -2821,7 +2817,8 @@ var polygonAnnotation = function polygonAnnotation(args) {
2821
2817
  delete args.coordinates;
2822
2818
  annotation.call(this, 'polygon', args);
2823
2819
  var m_this = this,
2824
- s_actions = this.actions;
2820
+ s_actions = this.actions,
2821
+ s_state = this.state;
2825
2822
  /**
2826
2823
  * Get a list of renderable features for this annotation. When the polygon
2827
2824
  * is done, this is just a single polygon. During creation this can be a
@@ -3029,6 +3026,56 @@ var polygonAnnotation = function polygonAnnotation(args) {
3029
3026
  this.actions = function (state) {
3030
3027
  return continuousVerticesActions(m_this, s_actions, state, 'polygon', arguments);
3031
3028
  };
3029
+ /**
3030
+ * Get or set the state of this annotation.
3031
+ *
3032
+ * @param {string|undefined} [arg] If `undefined`, return the state,
3033
+ * otherwise change it. This should be one of the
3034
+ * {@link geo.annotation.state} values.
3035
+ * @returns {this|string} The current state or this annotation.
3036
+ * @fires geo.event.annotation.state
3037
+ */
3038
+
3039
+
3040
+ this.state = function (arg) {
3041
+ var oldState = s_state();
3042
+
3043
+ if (arg && arg !== oldState && (oldState === annotationState.create || oldState === annotationState.edit) && arg === annotationState.done) {
3044
+ /* Uncross polygons when they are complete. */
3045
+ var opts = {
3046
+ style: 'object-listlist-outer-list'
3047
+ };
3048
+ var polys = util.polyops.union(m_this.options('vertices'), [], opts);
3049
+ var merged = true;
3050
+
3051
+ while (polys.length > 1 && merged) {
3052
+ merged = false;
3053
+
3054
+ for (var i = 0; !merged && i < polys[0].outer.length; i += 1) {
3055
+ var pt1 = polys[0].outer[i];
3056
+
3057
+ for (var p = 1; !merged && p < polys.length; p += 1) {
3058
+ for (var j = 0; !merged && j < polys[p].outer.length; j += 1) {
3059
+ var pt2 = polys[p].outer[j];
3060
+
3061
+ if (pt1.x === pt2.x && pt1.y === pt2.y) {
3062
+ polys[0].inner = polys[0].inner.concat(polys[p].inner);
3063
+ polys[0].outer = polys[0].outer.slice(0, i).concat(polys[p].outer.slice(j)).concat(polys[p].outer.slice(0, j)).concat(polys[0].outer.slice(i));
3064
+ polys.splice(p, 1);
3065
+ merged = true;
3066
+ }
3067
+ }
3068
+ }
3069
+ }
3070
+ }
3071
+
3072
+ if (polys.length === 1) {
3073
+ m_this.options('vertices', polys[0].inner.length ? polys[0] : polys[0].outer);
3074
+ }
3075
+ }
3076
+
3077
+ return s_state(arg);
3078
+ };
3032
3079
  /**
3033
3080
  * Process any actions for this annotation.
3034
3081
  *
@@ -3268,10 +3315,6 @@ var rectangleAnnotation = function rectangleAnnotation(args, annotationName) {
3268
3315
  name: 'rectangle create',
3269
3316
  owner: annotationActionOwner,
3270
3317
  input: 'left',
3271
- modifiers: {
3272
- shift: false,
3273
- ctrl: false
3274
- },
3275
3318
  selectionRectangle: true,
3276
3319
  selectionConstraint: this._selectionConstraint
3277
3320
  }];
@@ -9331,7 +9374,7 @@ module.exports = domRenderer;
9331
9374
  *
9332
9375
  * @namespace
9333
9376
  * @alias geo.event
9334
- * @type {geo.event.base}
9377
+ * @type {object}
9335
9378
  *
9336
9379
  * @example
9337
9380
  * map.geoOn(geo.event.layerAdd, function (event) {
@@ -13707,6 +13750,15 @@ if (window && !window.jQuery) {
13707
13750
  window.jQuery = $;
13708
13751
  }
13709
13752
 
13753
+ if (window && !window.geojsMap) {
13754
+ window.geojsMap = function () {
13755
+ var maps = $('.geojs-map').map(function (idx, m) {
13756
+ return $(m).data('data-geojs-map');
13757
+ });
13758
+ return maps.length === 0 ? undefined : maps.length === 1 ? maps[0] : maps;
13759
+ };
13760
+ }
13761
+
13710
13762
  /***/ }),
13711
13763
 
13712
13764
  /***/ 5699:
@@ -18656,6 +18708,9 @@ var map = function map(arg) {
18656
18708
 
18657
18709
 
18658
18710
  this._version = __webpack_require__(2978);
18711
+ /* Link to the main library */
18712
+
18713
+ this._geo = __webpack_require__(6062);
18659
18714
  /**
18660
18715
  * Draw a layer image to a canvas context. The layer's opacity and transform
18661
18716
  * are applied. This is used as part of making a screenshot.
@@ -19317,6 +19372,28 @@ var Mousetrap = __webpack_require__(3345);
19317
19372
  * The default is `(2 - t) * t`.
19318
19373
  */
19319
19374
 
19375
+ /**
19376
+ * The state of the mouse.
19377
+ *
19378
+ * @typedef {object} geo.mouseState
19379
+ * @property {geo.screenPosition} page Mouse position relative to the page.
19380
+ * @property {geo.geoPosition} map Mouse position relative to the map.
19381
+ * @property {geo.geoPosition} geo Mouse position in map interface gcs.
19382
+ * @property {geo.geoPosition} mapgcs Mouse position in map gcs
19383
+ * @property {object} buttons Which mouse buttons are down.
19384
+ * @property {boolean} buttons.left State of the left mouse button.
19385
+ * @property {boolean} buttons.right State of the right mouse button.
19386
+ * @property {boolean} buttons.middle State of the middle mouse button.
19387
+ * @property {object} modifiers Which modifier keys are down.
19388
+ * @property {boolean} modifiers.alt State of the alt key.
19389
+ * @property {boolean} modifiers.ctrl State of the ctrl key.
19390
+ * @property {boolean} modifiers.shift State of the shift key.
19391
+ * @property {boolean} modifiers.meta State of the meta key.
19392
+ * @property {number} time Time (epoch ms) the event was captured.
19393
+ * @property {number} deltaTime Time elapsed (ms) since the last mouse event.
19394
+ * @property {geo.screenPosition} velocity Mouse speed in pixels/ms.
19395
+ */
19396
+
19320
19397
  /**
19321
19398
  * The mapInteractor class is responsible for handling raw events from the
19322
19399
  * browser and interpreting them as map navigation interactions. This class
@@ -25699,11 +25776,13 @@ var polygonFeature = function polygonFeature(arg) {
25699
25776
  * get the position of each vertex.
25700
25777
  * @param {function} [polyFunc=this.style.get('polygon')] The function to
25701
25778
  * get each polygon.
25702
- * @returns {this}
25779
+ * @param {boolean} [returnData=false] If truthy, return the new data array
25780
+ * rather than modifying the feature.
25781
+ * @returns {this|array}
25703
25782
  */
25704
25783
 
25705
25784
 
25706
- this.rdpSimplifyData = function (data, tolerance, posFunc, polyFunc) {
25785
+ this.rdpSimplifyData = function (data, tolerance, posFunc, polyFunc, returnData) {
25707
25786
  var map = m_this.layer().map(),
25708
25787
  mapgcs = map.gcs(),
25709
25788
  featuregcs = m_this.gcs(),
@@ -25767,8 +25846,13 @@ var polygonFeature = function polygonFeature(arg) {
25767
25846
 
25768
25847
  return elem;
25769
25848
  });
25849
+
25850
+ if (returnData) {
25851
+ return data;
25852
+ }
25770
25853
  /* Set the reduced polgons as the data and use simple accessors. */
25771
25854
 
25855
+
25772
25856
  m_this.style('position', util.identityFunction);
25773
25857
  m_this.style('polygon', util.identityFunction);
25774
25858
  m_this.data(data);
@@ -27887,7 +27971,7 @@ module.exports = sceneObject;
27887
27971
  * @constant
27888
27972
  * @type {string}
27889
27973
  */
27890
- module.exports = "52900ff9b31db04903654e968c3bf6e7bcc3bffb";
27974
+ module.exports = "66ce1a660f334ca97248cb10af94935e6f8b204b";
27891
27975
 
27892
27976
  /***/ }),
27893
27977
 
@@ -40100,6 +40184,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
40100
40184
  var PolyBool = __webpack_require__(3291);
40101
40185
 
40102
40186
  var geo_map = __webpack_require__(2804);
40187
+
40188
+ var util = __webpack_require__(8340);
40103
40189
  /**
40104
40190
  * A list of flat polygon lists.
40105
40191
  *
@@ -40179,29 +40265,95 @@ var AlternateOpNames = {
40179
40265
  * Convert a segment list to a polygon list.
40180
40266
  *
40181
40267
  * @param {object[]} seglist A PolyBool segment list.
40182
- * @returns {geo.polygonList} A polygon list.
40268
+ * @returns {geo.polygonList|undefined} A polygon list.
40183
40269
  */
40184
40270
 
40185
40271
  function seglistToPolygonList(seglist) {
40186
40272
  // This single line doesn't arrange holes correctly
40187
40273
  // return seglist.map((s) => PolyBool.polygon(s).regions);
40188
- var polys = [];
40189
- seglist.forEach(function (s) {
40190
- var geojson = PolyBool.polygonToGeoJSON(PolyBool.polygon(s));
40191
40274
 
40275
+ /* This uses PolyBools' operations (mostly), but is much slower than needed
40276
+ * since it goes through geojson.
40277
+ const polys = [];
40278
+ seglist.forEach((s) => {
40279
+ const geojson = PolyBool.polygonToGeoJSON(PolyBool.polygon(s));
40192
40280
  if (geojson.type === 'MultiPolygon') {
40193
- geojson.coordinates.forEach(function (p) {
40194
- polys.push(p.map(function (h) {
40195
- return h.slice(0, h.length - 1);
40196
- }));
40281
+ geojson.coordinates.forEach((p) => {
40282
+ polys.push(p.map((h) => h.slice(0, h.length - 1)));
40197
40283
  });
40198
40284
  } else if (geojson.type === 'Polygon') {
40199
- polys.push(geojson.coordinates.map(function (h) {
40200
- return h.slice(0, h.length - 1);
40201
- }));
40285
+ polys.push(geojson.coordinates.map((h) => h.slice(0, h.length - 1)));
40202
40286
  }
40203
40287
  });
40204
40288
  return polys;
40289
+ */
40290
+ var polys = []; // end result
40291
+
40292
+ var borders = []; // polygons in format needed for util.pointInPolygon
40293
+
40294
+ var regions = []; // polygons in end result format
40295
+
40296
+ var parents = []; // list of parents of each polygon
40297
+
40298
+ seglist.forEach(function (s) {
40299
+ return PolyBool.polygon(s).regions.forEach(function (r) {
40300
+ var border = r.map(function (pt) {
40301
+ return {
40302
+ x: pt[0],
40303
+ y: pt[1]
40304
+ };
40305
+ });
40306
+
40307
+ if (border.length < 3) {
40308
+ return;
40309
+ }
40310
+
40311
+ parents.push([]);
40312
+ borders.forEach(function (b, i) {
40313
+ if (util.pointInPolygon(border[0], b)) {
40314
+ parents[borders.length].push(i);
40315
+ } else if (util.pointInPolygon(b[0], border)) {
40316
+ parents[i].push(borders.length);
40317
+ }
40318
+ });
40319
+ regions.push(r);
40320
+ borders.push(border);
40321
+ });
40322
+ });
40323
+ /* find nested polygons */
40324
+
40325
+ var dest = Array(regions.length);
40326
+ var used = 0;
40327
+
40328
+ while (used < regions.length) {
40329
+ for (var i = 0; i < regions.length; i += 1) {
40330
+ if (dest[i] === undefined && !parents[i].length) {
40331
+ dest[i] = polys.length;
40332
+ /* reverse the outer polygons for consistency with how PolyBool
40333
+ * generates geojson */
40334
+
40335
+ polys.push([regions[i].reverse()]);
40336
+ used += 1;
40337
+ }
40338
+ }
40339
+
40340
+ for (var _i = 0; _i < regions.length; _i += 1) {
40341
+ if (dest[_i] === undefined && parents[_i].length === 1 && dest[parents[_i][0]] !== undefined) {
40342
+ polys[dest[parents[_i][0]]].push(regions[_i]);
40343
+
40344
+ dest[_i] = dest[parents[_i][0]];
40345
+ used += 1;
40346
+ }
40347
+ }
40348
+
40349
+ for (var _i2 = 0; _i2 < regions.length; _i2 += 1) {
40350
+ parents[_i2] = parents[_i2].filter(function (d) {
40351
+ return dest[d] === undefined;
40352
+ });
40353
+ }
40354
+ }
40355
+
40356
+ return polys.length ? polys : [[]];
40205
40357
  }
40206
40358
  /**
40207
40359
  * Perform an boolean operation on a seglist from polygons.
@@ -41047,7 +41199,7 @@ module.exports = vectorFeature;
41047
41199
  * @constant
41048
41200
  * @type {string}
41049
41201
  */
41050
- module.exports = "1.10.6";
41202
+ module.exports = "1.10.9";
41051
41203
 
41052
41204
  /***/ }),
41053
41205
 
package/geo.lean.js CHANGED
@@ -1540,11 +1540,7 @@ function continuousVerticesActions(m_this, s_actions, state, name, originalArgs)
1540
1540
  action: geo_action['annotation_' + name],
1541
1541
  name: name + ' create',
1542
1542
  owner: annotationActionOwner,
1543
- input: 'left',
1544
- modifiers: {
1545
- shift: false,
1546
- ctrl: false
1547
- }
1543
+ input: 'left'
1548
1544
  }, {
1549
1545
  action: geo_action['annotation_' + name],
1550
1546
  name: name + ' create',
@@ -2821,7 +2817,8 @@ var polygonAnnotation = function polygonAnnotation(args) {
2821
2817
  delete args.coordinates;
2822
2818
  annotation.call(this, 'polygon', args);
2823
2819
  var m_this = this,
2824
- s_actions = this.actions;
2820
+ s_actions = this.actions,
2821
+ s_state = this.state;
2825
2822
  /**
2826
2823
  * Get a list of renderable features for this annotation. When the polygon
2827
2824
  * is done, this is just a single polygon. During creation this can be a
@@ -3029,6 +3026,56 @@ var polygonAnnotation = function polygonAnnotation(args) {
3029
3026
  this.actions = function (state) {
3030
3027
  return continuousVerticesActions(m_this, s_actions, state, 'polygon', arguments);
3031
3028
  };
3029
+ /**
3030
+ * Get or set the state of this annotation.
3031
+ *
3032
+ * @param {string|undefined} [arg] If `undefined`, return the state,
3033
+ * otherwise change it. This should be one of the
3034
+ * {@link geo.annotation.state} values.
3035
+ * @returns {this|string} The current state or this annotation.
3036
+ * @fires geo.event.annotation.state
3037
+ */
3038
+
3039
+
3040
+ this.state = function (arg) {
3041
+ var oldState = s_state();
3042
+
3043
+ if (arg && arg !== oldState && (oldState === annotationState.create || oldState === annotationState.edit) && arg === annotationState.done) {
3044
+ /* Uncross polygons when they are complete. */
3045
+ var opts = {
3046
+ style: 'object-listlist-outer-list'
3047
+ };
3048
+ var polys = util.polyops.union(m_this.options('vertices'), [], opts);
3049
+ var merged = true;
3050
+
3051
+ while (polys.length > 1 && merged) {
3052
+ merged = false;
3053
+
3054
+ for (var i = 0; !merged && i < polys[0].outer.length; i += 1) {
3055
+ var pt1 = polys[0].outer[i];
3056
+
3057
+ for (var p = 1; !merged && p < polys.length; p += 1) {
3058
+ for (var j = 0; !merged && j < polys[p].outer.length; j += 1) {
3059
+ var pt2 = polys[p].outer[j];
3060
+
3061
+ if (pt1.x === pt2.x && pt1.y === pt2.y) {
3062
+ polys[0].inner = polys[0].inner.concat(polys[p].inner);
3063
+ polys[0].outer = polys[0].outer.slice(0, i).concat(polys[p].outer.slice(j)).concat(polys[p].outer.slice(0, j)).concat(polys[0].outer.slice(i));
3064
+ polys.splice(p, 1);
3065
+ merged = true;
3066
+ }
3067
+ }
3068
+ }
3069
+ }
3070
+ }
3071
+
3072
+ if (polys.length === 1) {
3073
+ m_this.options('vertices', polys[0].inner.length ? polys[0] : polys[0].outer);
3074
+ }
3075
+ }
3076
+
3077
+ return s_state(arg);
3078
+ };
3032
3079
  /**
3033
3080
  * Process any actions for this annotation.
3034
3081
  *
@@ -3268,10 +3315,6 @@ var rectangleAnnotation = function rectangleAnnotation(args, annotationName) {
3268
3315
  name: 'rectangle create',
3269
3316
  owner: annotationActionOwner,
3270
3317
  input: 'left',
3271
- modifiers: {
3272
- shift: false,
3273
- ctrl: false
3274
- },
3275
3318
  selectionRectangle: true,
3276
3319
  selectionConstraint: this._selectionConstraint
3277
3320
  }];
@@ -9331,7 +9374,7 @@ module.exports = domRenderer;
9331
9374
  *
9332
9375
  * @namespace
9333
9376
  * @alias geo.event
9334
- * @type {geo.event.base}
9377
+ * @type {object}
9335
9378
  *
9336
9379
  * @example
9337
9380
  * map.geoOn(geo.event.layerAdd, function (event) {
@@ -13707,6 +13750,15 @@ if (window && !window.jQuery) {
13707
13750
  window.jQuery = $;
13708
13751
  }
13709
13752
 
13753
+ if (window && !window.geojsMap) {
13754
+ window.geojsMap = function () {
13755
+ var maps = $('.geojs-map').map(function (idx, m) {
13756
+ return $(m).data('data-geojs-map');
13757
+ });
13758
+ return maps.length === 0 ? undefined : maps.length === 1 ? maps[0] : maps;
13759
+ };
13760
+ }
13761
+
13710
13762
  /***/ }),
13711
13763
 
13712
13764
  /***/ 5699:
@@ -18656,6 +18708,9 @@ var map = function map(arg) {
18656
18708
 
18657
18709
 
18658
18710
  this._version = __webpack_require__(2978);
18711
+ /* Link to the main library */
18712
+
18713
+ this._geo = __webpack_require__(6062);
18659
18714
  /**
18660
18715
  * Draw a layer image to a canvas context. The layer's opacity and transform
18661
18716
  * are applied. This is used as part of making a screenshot.
@@ -19317,6 +19372,28 @@ var Mousetrap = __webpack_require__(3345);
19317
19372
  * The default is `(2 - t) * t`.
19318
19373
  */
19319
19374
 
19375
+ /**
19376
+ * The state of the mouse.
19377
+ *
19378
+ * @typedef {object} geo.mouseState
19379
+ * @property {geo.screenPosition} page Mouse position relative to the page.
19380
+ * @property {geo.geoPosition} map Mouse position relative to the map.
19381
+ * @property {geo.geoPosition} geo Mouse position in map interface gcs.
19382
+ * @property {geo.geoPosition} mapgcs Mouse position in map gcs
19383
+ * @property {object} buttons Which mouse buttons are down.
19384
+ * @property {boolean} buttons.left State of the left mouse button.
19385
+ * @property {boolean} buttons.right State of the right mouse button.
19386
+ * @property {boolean} buttons.middle State of the middle mouse button.
19387
+ * @property {object} modifiers Which modifier keys are down.
19388
+ * @property {boolean} modifiers.alt State of the alt key.
19389
+ * @property {boolean} modifiers.ctrl State of the ctrl key.
19390
+ * @property {boolean} modifiers.shift State of the shift key.
19391
+ * @property {boolean} modifiers.meta State of the meta key.
19392
+ * @property {number} time Time (epoch ms) the event was captured.
19393
+ * @property {number} deltaTime Time elapsed (ms) since the last mouse event.
19394
+ * @property {geo.screenPosition} velocity Mouse speed in pixels/ms.
19395
+ */
19396
+
19320
19397
  /**
19321
19398
  * The mapInteractor class is responsible for handling raw events from the
19322
19399
  * browser and interpreting them as map navigation interactions. This class
@@ -25699,11 +25776,13 @@ var polygonFeature = function polygonFeature(arg) {
25699
25776
  * get the position of each vertex.
25700
25777
  * @param {function} [polyFunc=this.style.get('polygon')] The function to
25701
25778
  * get each polygon.
25702
- * @returns {this}
25779
+ * @param {boolean} [returnData=false] If truthy, return the new data array
25780
+ * rather than modifying the feature.
25781
+ * @returns {this|array}
25703
25782
  */
25704
25783
 
25705
25784
 
25706
- this.rdpSimplifyData = function (data, tolerance, posFunc, polyFunc) {
25785
+ this.rdpSimplifyData = function (data, tolerance, posFunc, polyFunc, returnData) {
25707
25786
  var map = m_this.layer().map(),
25708
25787
  mapgcs = map.gcs(),
25709
25788
  featuregcs = m_this.gcs(),
@@ -25767,8 +25846,13 @@ var polygonFeature = function polygonFeature(arg) {
25767
25846
 
25768
25847
  return elem;
25769
25848
  });
25849
+
25850
+ if (returnData) {
25851
+ return data;
25852
+ }
25770
25853
  /* Set the reduced polgons as the data and use simple accessors. */
25771
25854
 
25855
+
25772
25856
  m_this.style('position', util.identityFunction);
25773
25857
  m_this.style('polygon', util.identityFunction);
25774
25858
  m_this.data(data);
@@ -27887,7 +27971,7 @@ module.exports = sceneObject;
27887
27971
  * @constant
27888
27972
  * @type {string}
27889
27973
  */
27890
- module.exports = "52900ff9b31db04903654e968c3bf6e7bcc3bffb";
27974
+ module.exports = "66ce1a660f334ca97248cb10af94935e6f8b204b";
27891
27975
 
27892
27976
  /***/ }),
27893
27977
 
@@ -40100,6 +40184,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
40100
40184
  var PolyBool = __webpack_require__(3291);
40101
40185
 
40102
40186
  var geo_map = __webpack_require__(2804);
40187
+
40188
+ var util = __webpack_require__(8340);
40103
40189
  /**
40104
40190
  * A list of flat polygon lists.
40105
40191
  *
@@ -40179,29 +40265,95 @@ var AlternateOpNames = {
40179
40265
  * Convert a segment list to a polygon list.
40180
40266
  *
40181
40267
  * @param {object[]} seglist A PolyBool segment list.
40182
- * @returns {geo.polygonList} A polygon list.
40268
+ * @returns {geo.polygonList|undefined} A polygon list.
40183
40269
  */
40184
40270
 
40185
40271
  function seglistToPolygonList(seglist) {
40186
40272
  // This single line doesn't arrange holes correctly
40187
40273
  // return seglist.map((s) => PolyBool.polygon(s).regions);
40188
- var polys = [];
40189
- seglist.forEach(function (s) {
40190
- var geojson = PolyBool.polygonToGeoJSON(PolyBool.polygon(s));
40191
40274
 
40275
+ /* This uses PolyBools' operations (mostly), but is much slower than needed
40276
+ * since it goes through geojson.
40277
+ const polys = [];
40278
+ seglist.forEach((s) => {
40279
+ const geojson = PolyBool.polygonToGeoJSON(PolyBool.polygon(s));
40192
40280
  if (geojson.type === 'MultiPolygon') {
40193
- geojson.coordinates.forEach(function (p) {
40194
- polys.push(p.map(function (h) {
40195
- return h.slice(0, h.length - 1);
40196
- }));
40281
+ geojson.coordinates.forEach((p) => {
40282
+ polys.push(p.map((h) => h.slice(0, h.length - 1)));
40197
40283
  });
40198
40284
  } else if (geojson.type === 'Polygon') {
40199
- polys.push(geojson.coordinates.map(function (h) {
40200
- return h.slice(0, h.length - 1);
40201
- }));
40285
+ polys.push(geojson.coordinates.map((h) => h.slice(0, h.length - 1)));
40202
40286
  }
40203
40287
  });
40204
40288
  return polys;
40289
+ */
40290
+ var polys = []; // end result
40291
+
40292
+ var borders = []; // polygons in format needed for util.pointInPolygon
40293
+
40294
+ var regions = []; // polygons in end result format
40295
+
40296
+ var parents = []; // list of parents of each polygon
40297
+
40298
+ seglist.forEach(function (s) {
40299
+ return PolyBool.polygon(s).regions.forEach(function (r) {
40300
+ var border = r.map(function (pt) {
40301
+ return {
40302
+ x: pt[0],
40303
+ y: pt[1]
40304
+ };
40305
+ });
40306
+
40307
+ if (border.length < 3) {
40308
+ return;
40309
+ }
40310
+
40311
+ parents.push([]);
40312
+ borders.forEach(function (b, i) {
40313
+ if (util.pointInPolygon(border[0], b)) {
40314
+ parents[borders.length].push(i);
40315
+ } else if (util.pointInPolygon(b[0], border)) {
40316
+ parents[i].push(borders.length);
40317
+ }
40318
+ });
40319
+ regions.push(r);
40320
+ borders.push(border);
40321
+ });
40322
+ });
40323
+ /* find nested polygons */
40324
+
40325
+ var dest = Array(regions.length);
40326
+ var used = 0;
40327
+
40328
+ while (used < regions.length) {
40329
+ for (var i = 0; i < regions.length; i += 1) {
40330
+ if (dest[i] === undefined && !parents[i].length) {
40331
+ dest[i] = polys.length;
40332
+ /* reverse the outer polygons for consistency with how PolyBool
40333
+ * generates geojson */
40334
+
40335
+ polys.push([regions[i].reverse()]);
40336
+ used += 1;
40337
+ }
40338
+ }
40339
+
40340
+ for (var _i = 0; _i < regions.length; _i += 1) {
40341
+ if (dest[_i] === undefined && parents[_i].length === 1 && dest[parents[_i][0]] !== undefined) {
40342
+ polys[dest[parents[_i][0]]].push(regions[_i]);
40343
+
40344
+ dest[_i] = dest[parents[_i][0]];
40345
+ used += 1;
40346
+ }
40347
+ }
40348
+
40349
+ for (var _i2 = 0; _i2 < regions.length; _i2 += 1) {
40350
+ parents[_i2] = parents[_i2].filter(function (d) {
40351
+ return dest[d] === undefined;
40352
+ });
40353
+ }
40354
+ }
40355
+
40356
+ return polys.length ? polys : [[]];
40205
40357
  }
40206
40358
  /**
40207
40359
  * Perform an boolean operation on a seglist from polygons.
@@ -41047,7 +41199,7 @@ module.exports = vectorFeature;
41047
41199
  * @constant
41048
41200
  * @type {string}
41049
41201
  */
41050
- module.exports = "1.10.6";
41202
+ module.exports = "1.10.9";
41051
41203
 
41052
41204
  /***/ }),
41053
41205