geojs 1.10.8 → 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.
- package/.github/workflows/commitlint.yml +11 -0
- package/commitlint.config.js +24 -0
- package/geo.js +116 -14
- package/geo.lean.js +116 -14
- package/geo.lean.min.js +5 -5
- package/geo.min.js +1 -1
- package/package.json +1 -1
- package/src/event.js +1 -1
- package/src/index.js +6 -0
- package/src/map.js +2 -0
- package/src/mapInteractor.js +22 -0
- package/src/util/polyops.js +50 -1
|
@@ -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
|
@@ -9374,7 +9374,7 @@ module.exports = domRenderer;
|
|
|
9374
9374
|
*
|
|
9375
9375
|
* @namespace
|
|
9376
9376
|
* @alias geo.event
|
|
9377
|
-
* @type {
|
|
9377
|
+
* @type {object}
|
|
9378
9378
|
*
|
|
9379
9379
|
* @example
|
|
9380
9380
|
* map.geoOn(geo.event.layerAdd, function (event) {
|
|
@@ -13750,6 +13750,15 @@ if (window && !window.jQuery) {
|
|
|
13750
13750
|
window.jQuery = $;
|
|
13751
13751
|
}
|
|
13752
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
|
+
|
|
13753
13762
|
/***/ }),
|
|
13754
13763
|
|
|
13755
13764
|
/***/ 5699:
|
|
@@ -18699,6 +18708,9 @@ var map = function map(arg) {
|
|
|
18699
18708
|
|
|
18700
18709
|
|
|
18701
18710
|
this._version = __webpack_require__(2978);
|
|
18711
|
+
/* Link to the main library */
|
|
18712
|
+
|
|
18713
|
+
this._geo = __webpack_require__(6062);
|
|
18702
18714
|
/**
|
|
18703
18715
|
* Draw a layer image to a canvas context. The layer's opacity and transform
|
|
18704
18716
|
* are applied. This is used as part of making a screenshot.
|
|
@@ -19360,6 +19372,28 @@ var Mousetrap = __webpack_require__(3345);
|
|
|
19360
19372
|
* The default is `(2 - t) * t`.
|
|
19361
19373
|
*/
|
|
19362
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
|
+
|
|
19363
19397
|
/**
|
|
19364
19398
|
* The mapInteractor class is responsible for handling raw events from the
|
|
19365
19399
|
* browser and interpreting them as map navigation interactions. This class
|
|
@@ -27937,7 +27971,7 @@ module.exports = sceneObject;
|
|
|
27937
27971
|
* @constant
|
|
27938
27972
|
* @type {string}
|
|
27939
27973
|
*/
|
|
27940
|
-
module.exports = "
|
|
27974
|
+
module.exports = "66ce1a660f334ca97248cb10af94935e6f8b204b";
|
|
27941
27975
|
|
|
27942
27976
|
/***/ }),
|
|
27943
27977
|
|
|
@@ -40150,6 +40184,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
40150
40184
|
var PolyBool = __webpack_require__(3291);
|
|
40151
40185
|
|
|
40152
40186
|
var geo_map = __webpack_require__(2804);
|
|
40187
|
+
|
|
40188
|
+
var util = __webpack_require__(8340);
|
|
40153
40189
|
/**
|
|
40154
40190
|
* A list of flat polygon lists.
|
|
40155
40191
|
*
|
|
@@ -40229,29 +40265,95 @@ var AlternateOpNames = {
|
|
|
40229
40265
|
* Convert a segment list to a polygon list.
|
|
40230
40266
|
*
|
|
40231
40267
|
* @param {object[]} seglist A PolyBool segment list.
|
|
40232
|
-
* @returns {geo.polygonList} A polygon list.
|
|
40268
|
+
* @returns {geo.polygonList|undefined} A polygon list.
|
|
40233
40269
|
*/
|
|
40234
40270
|
|
|
40235
40271
|
function seglistToPolygonList(seglist) {
|
|
40236
40272
|
// This single line doesn't arrange holes correctly
|
|
40237
40273
|
// return seglist.map((s) => PolyBool.polygon(s).regions);
|
|
40238
|
-
var polys = [];
|
|
40239
|
-
seglist.forEach(function (s) {
|
|
40240
|
-
var geojson = PolyBool.polygonToGeoJSON(PolyBool.polygon(s));
|
|
40241
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));
|
|
40242
40280
|
if (geojson.type === 'MultiPolygon') {
|
|
40243
|
-
geojson.coordinates.forEach(
|
|
40244
|
-
polys.push(p.map(
|
|
40245
|
-
return h.slice(0, h.length - 1);
|
|
40246
|
-
}));
|
|
40281
|
+
geojson.coordinates.forEach((p) => {
|
|
40282
|
+
polys.push(p.map((h) => h.slice(0, h.length - 1)));
|
|
40247
40283
|
});
|
|
40248
40284
|
} else if (geojson.type === 'Polygon') {
|
|
40249
|
-
polys.push(geojson.coordinates.map(
|
|
40250
|
-
return h.slice(0, h.length - 1);
|
|
40251
|
-
}));
|
|
40285
|
+
polys.push(geojson.coordinates.map((h) => h.slice(0, h.length - 1)));
|
|
40252
40286
|
}
|
|
40253
40287
|
});
|
|
40254
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 : [[]];
|
|
40255
40357
|
}
|
|
40256
40358
|
/**
|
|
40257
40359
|
* Perform an boolean operation on a seglist from polygons.
|
|
@@ -41097,7 +41199,7 @@ module.exports = vectorFeature;
|
|
|
41097
41199
|
* @constant
|
|
41098
41200
|
* @type {string}
|
|
41099
41201
|
*/
|
|
41100
|
-
module.exports = "1.10.
|
|
41202
|
+
module.exports = "1.10.9";
|
|
41101
41203
|
|
|
41102
41204
|
/***/ }),
|
|
41103
41205
|
|
package/geo.lean.js
CHANGED
|
@@ -9374,7 +9374,7 @@ module.exports = domRenderer;
|
|
|
9374
9374
|
*
|
|
9375
9375
|
* @namespace
|
|
9376
9376
|
* @alias geo.event
|
|
9377
|
-
* @type {
|
|
9377
|
+
* @type {object}
|
|
9378
9378
|
*
|
|
9379
9379
|
* @example
|
|
9380
9380
|
* map.geoOn(geo.event.layerAdd, function (event) {
|
|
@@ -13750,6 +13750,15 @@ if (window && !window.jQuery) {
|
|
|
13750
13750
|
window.jQuery = $;
|
|
13751
13751
|
}
|
|
13752
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
|
+
|
|
13753
13762
|
/***/ }),
|
|
13754
13763
|
|
|
13755
13764
|
/***/ 5699:
|
|
@@ -18699,6 +18708,9 @@ var map = function map(arg) {
|
|
|
18699
18708
|
|
|
18700
18709
|
|
|
18701
18710
|
this._version = __webpack_require__(2978);
|
|
18711
|
+
/* Link to the main library */
|
|
18712
|
+
|
|
18713
|
+
this._geo = __webpack_require__(6062);
|
|
18702
18714
|
/**
|
|
18703
18715
|
* Draw a layer image to a canvas context. The layer's opacity and transform
|
|
18704
18716
|
* are applied. This is used as part of making a screenshot.
|
|
@@ -19360,6 +19372,28 @@ var Mousetrap = __webpack_require__(3345);
|
|
|
19360
19372
|
* The default is `(2 - t) * t`.
|
|
19361
19373
|
*/
|
|
19362
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
|
+
|
|
19363
19397
|
/**
|
|
19364
19398
|
* The mapInteractor class is responsible for handling raw events from the
|
|
19365
19399
|
* browser and interpreting them as map navigation interactions. This class
|
|
@@ -27937,7 +27971,7 @@ module.exports = sceneObject;
|
|
|
27937
27971
|
* @constant
|
|
27938
27972
|
* @type {string}
|
|
27939
27973
|
*/
|
|
27940
|
-
module.exports = "
|
|
27974
|
+
module.exports = "66ce1a660f334ca97248cb10af94935e6f8b204b";
|
|
27941
27975
|
|
|
27942
27976
|
/***/ }),
|
|
27943
27977
|
|
|
@@ -40150,6 +40184,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
40150
40184
|
var PolyBool = __webpack_require__(3291);
|
|
40151
40185
|
|
|
40152
40186
|
var geo_map = __webpack_require__(2804);
|
|
40187
|
+
|
|
40188
|
+
var util = __webpack_require__(8340);
|
|
40153
40189
|
/**
|
|
40154
40190
|
* A list of flat polygon lists.
|
|
40155
40191
|
*
|
|
@@ -40229,29 +40265,95 @@ var AlternateOpNames = {
|
|
|
40229
40265
|
* Convert a segment list to a polygon list.
|
|
40230
40266
|
*
|
|
40231
40267
|
* @param {object[]} seglist A PolyBool segment list.
|
|
40232
|
-
* @returns {geo.polygonList} A polygon list.
|
|
40268
|
+
* @returns {geo.polygonList|undefined} A polygon list.
|
|
40233
40269
|
*/
|
|
40234
40270
|
|
|
40235
40271
|
function seglistToPolygonList(seglist) {
|
|
40236
40272
|
// This single line doesn't arrange holes correctly
|
|
40237
40273
|
// return seglist.map((s) => PolyBool.polygon(s).regions);
|
|
40238
|
-
var polys = [];
|
|
40239
|
-
seglist.forEach(function (s) {
|
|
40240
|
-
var geojson = PolyBool.polygonToGeoJSON(PolyBool.polygon(s));
|
|
40241
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));
|
|
40242
40280
|
if (geojson.type === 'MultiPolygon') {
|
|
40243
|
-
geojson.coordinates.forEach(
|
|
40244
|
-
polys.push(p.map(
|
|
40245
|
-
return h.slice(0, h.length - 1);
|
|
40246
|
-
}));
|
|
40281
|
+
geojson.coordinates.forEach((p) => {
|
|
40282
|
+
polys.push(p.map((h) => h.slice(0, h.length - 1)));
|
|
40247
40283
|
});
|
|
40248
40284
|
} else if (geojson.type === 'Polygon') {
|
|
40249
|
-
polys.push(geojson.coordinates.map(
|
|
40250
|
-
return h.slice(0, h.length - 1);
|
|
40251
|
-
}));
|
|
40285
|
+
polys.push(geojson.coordinates.map((h) => h.slice(0, h.length - 1)));
|
|
40252
40286
|
}
|
|
40253
40287
|
});
|
|
40254
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 : [[]];
|
|
40255
40357
|
}
|
|
40256
40358
|
/**
|
|
40257
40359
|
* Perform an boolean operation on a seglist from polygons.
|
|
@@ -41097,7 +41199,7 @@ module.exports = vectorFeature;
|
|
|
41097
41199
|
* @constant
|
|
41098
41200
|
* @type {string}
|
|
41099
41201
|
*/
|
|
41100
|
-
module.exports = "1.10.
|
|
41202
|
+
module.exports = "1.10.9";
|
|
41101
41203
|
|
|
41102
41204
|
/***/ }),
|
|
41103
41205
|
|