geojs 1.12.4 → 1.12.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/geo.js +823 -856
- package/geo.lean.js +823 -856
- package/geo.lean.min.js +3 -3
- package/geo.min.js +4 -4
- package/package.json +1 -1
- package/src/annotation/annotation.js +17 -18
- package/src/annotation/circleAnnotation.js +3 -3
- package/src/annotation/ellipseAnnotation.js +4 -4
- package/src/annotation/lineAnnotation.js +3 -3
- package/src/annotation/pointAnnotation.js +3 -4
- package/src/annotation/polygonAnnotation.js +2 -3
- package/src/annotation/rectangleAnnotation.js +8 -8
- package/src/annotation/squareAnnotation.js +3 -3
- package/src/annotationLayer.js +4 -4
- package/src/choroplethFeature.js +2 -3
- package/src/contourFeature.js +2 -3
- package/src/feature.js +2 -2
- package/src/graphFeature.js +3 -3
- package/src/gridFeature.js +2 -3
- package/src/heatmapFeature.js +1 -2
- package/src/index.js +1 -1
- package/src/isolineFeature.js +3 -4
- package/src/layer.js +1 -1
- package/src/lineFeature.js +1 -3
- package/src/map.js +11 -11
- package/src/mapInteractor.js +13 -14
- package/src/markerFeature.js +2 -4
- package/src/meshFeature.js +2 -3
- package/src/osmLayer.js +4 -5
- package/src/pathFeature.js +1 -2
- package/src/pixelmapFeature.js +1 -1
- package/src/pixelmapLayer.js +3 -4
- package/src/pointFeature.js +2 -4
- package/src/polygonFeature.js +1 -2
- package/src/quadFeature.js +1 -1
- package/src/registry.js +29 -28
- package/src/svg/pathFeature.js +1 -2
- package/src/textFeature.js +1 -3
- package/src/tileLayer.js +5 -4
- package/src/trackFeature.js +7 -14
- package/src/ui/scaleWidget.js +3 -3
- package/src/ui/widget.js +1 -2
- package/src/util/clustering.js +1 -1
- package/src/util/common.js +38 -1
- package/src/util/mesh.js +3 -4
- package/src/util/mockVGL.js +1 -2
- package/src/vectorFeature.js +1 -3
package/geo.lean.js
CHANGED
|
@@ -42,7 +42,6 @@ module.exports = geo_action;
|
|
|
42
42
|
/***/ 6978:
|
|
43
43
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
44
44
|
|
|
45
|
-
var $ = __webpack_require__(5616);
|
|
46
45
|
var geo_event = __webpack_require__(6409);
|
|
47
46
|
var geo_action = __webpack_require__(8695);
|
|
48
47
|
var transform = __webpack_require__(5325);
|
|
@@ -158,7 +157,7 @@ var _annotation = function annotation(type, args) {
|
|
|
158
157
|
return new _annotation(type, args);
|
|
159
158
|
}
|
|
160
159
|
var m_this = this,
|
|
161
|
-
m_options =
|
|
160
|
+
m_options = util.deepMerge({}, this.constructor.defaults, args || {}),
|
|
162
161
|
m_id = m_options.annotationId;
|
|
163
162
|
delete m_options.annotationId;
|
|
164
163
|
if (m_id === undefined || m_options.layer && m_options.layer.annotationById(m_id)) {
|
|
@@ -588,12 +587,12 @@ var _annotation = function annotation(type, args) {
|
|
|
588
587
|
var coordinatesSet;
|
|
589
588
|
if (arg2 === undefined) {
|
|
590
589
|
coordinatesSet = arg1[m_this._coordinateOption] !== undefined;
|
|
591
|
-
m_options =
|
|
590
|
+
m_options = util.deepMerge(m_options, arg1);
|
|
592
591
|
/* For style objects, re-extend them without recursion. This allows
|
|
593
592
|
* setting colors without an opacity field, for instance. */
|
|
594
593
|
['style', 'createStyle', 'editStyle', 'editHandleStyle', 'labelStyle', 'highlightStyle', 'cursorStyle'].forEach(function (key) {
|
|
595
594
|
if (arg1[key] !== undefined) {
|
|
596
|
-
|
|
595
|
+
Object.assign(m_options[key], arg1[key]);
|
|
597
596
|
}
|
|
598
597
|
});
|
|
599
598
|
} else {
|
|
@@ -656,7 +655,7 @@ var _annotation = function annotation(type, args) {
|
|
|
656
655
|
m_options[styleType] = {};
|
|
657
656
|
}
|
|
658
657
|
if (arg2 === undefined) {
|
|
659
|
-
m_options[styleType] =
|
|
658
|
+
m_options[styleType] = util.deepMerge(m_options[styleType], arg1);
|
|
660
659
|
} else {
|
|
661
660
|
m_options[styleType][arg1] = arg2;
|
|
662
661
|
}
|
|
@@ -718,13 +717,13 @@ var _annotation = function annotation(type, args) {
|
|
|
718
717
|
/* for some states, fall back to the general style if they don't specify a
|
|
719
718
|
* value explicitly. */
|
|
720
719
|
if (state === annotationState.edit || state === annotationState.highlight) {
|
|
721
|
-
return
|
|
720
|
+
return Object.assign({}, m_options.style, m_options[state + 'Style']);
|
|
722
721
|
}
|
|
723
722
|
if (state === annotationState.create) {
|
|
724
|
-
return
|
|
723
|
+
return Object.assign({}, m_options.style, m_options.editStyle, m_options[state + 'Style']);
|
|
725
724
|
}
|
|
726
725
|
if (state === annotationState.cursor) {
|
|
727
|
-
return
|
|
726
|
+
return Object.assign({}, m_options.style, m_options.editStyle, m_options.createStyle, m_options[state + 'Style']);
|
|
728
727
|
}
|
|
729
728
|
return m_options[state + 'Style'] || m_options.style || {};
|
|
730
729
|
};
|
|
@@ -978,12 +977,12 @@ var _annotation = function annotation(type, args) {
|
|
|
978
977
|
*/
|
|
979
978
|
this._addEditHandles = function (features, vertices, opts, isOpen) {
|
|
980
979
|
var editPoints,
|
|
981
|
-
style =
|
|
980
|
+
style = Object.assign({}, defaultEditHandleStyle, m_this.editHandleStyle()),
|
|
982
981
|
handles = util.ensureFunction(style.handles)() || {},
|
|
983
982
|
selected = m_this._editHandle && m_this._editHandle.handle && m_this._editHandle.handle.selected ? m_this._editHandle.handle : undefined;
|
|
984
983
|
/* opts specify which handles are allowed. They must be allowed by the
|
|
985
984
|
* original opts object and by the editHandleStyle.handle object. */
|
|
986
|
-
opts =
|
|
985
|
+
opts = Object.assign({}, opts);
|
|
987
986
|
Object.keys(handles).forEach(function (key) {
|
|
988
987
|
if (handles[key] === false) {
|
|
989
988
|
opts[key] = false;
|
|
@@ -999,7 +998,7 @@ var _annotation = function annotation(type, args) {
|
|
|
999
998
|
vertexList.forEach(function (vert, vidx) {
|
|
1000
999
|
vert.forEach(function (pt, idx) {
|
|
1001
1000
|
if (opts.vertex !== false) {
|
|
1002
|
-
editPoints.push(
|
|
1001
|
+
editPoints.push(Object.assign({}, pt, {
|
|
1003
1002
|
type: 'vertex',
|
|
1004
1003
|
index: idx,
|
|
1005
1004
|
vindex: vidx,
|
|
@@ -1008,7 +1007,7 @@ var _annotation = function annotation(type, args) {
|
|
|
1008
1007
|
}));
|
|
1009
1008
|
}
|
|
1010
1009
|
if (opts.edge !== false && idx !== vert.length - 1 && (pt.x !== vert[idx + 1].x || pt.y !== vert[idx + 1].y)) {
|
|
1011
|
-
editPoints.push(
|
|
1010
|
+
editPoints.push(Object.assign({
|
|
1012
1011
|
x: (pt.x + vert[idx + 1].x) / 2,
|
|
1013
1012
|
y: (pt.y + vert[idx + 1].y) / 2
|
|
1014
1013
|
}, {
|
|
@@ -1020,7 +1019,7 @@ var _annotation = function annotation(type, args) {
|
|
|
1020
1019
|
}));
|
|
1021
1020
|
}
|
|
1022
1021
|
if (opts.edge !== false && !isOpen && idx === vert.length - 1 && (pt.x !== vert[0].x || pt.y !== vert[0].y)) {
|
|
1023
|
-
editPoints.push(
|
|
1022
|
+
editPoints.push(Object.assign({
|
|
1024
1023
|
x: (pt.x + vert[0].x) / 2,
|
|
1025
1024
|
y: (pt.y + vert[0].y) / 2
|
|
1026
1025
|
}, {
|
|
@@ -1034,14 +1033,14 @@ var _annotation = function annotation(type, args) {
|
|
|
1034
1033
|
});
|
|
1035
1034
|
});
|
|
1036
1035
|
if (opts.center !== false) {
|
|
1037
|
-
editPoints.push(
|
|
1036
|
+
editPoints.push(Object.assign({}, util.centerFromPerimeter(m_this._coordinates()), {
|
|
1038
1037
|
type: 'center',
|
|
1039
1038
|
style: style,
|
|
1040
1039
|
editHandle: true
|
|
1041
1040
|
}));
|
|
1042
1041
|
}
|
|
1043
1042
|
if (opts.rotate !== false) {
|
|
1044
|
-
editPoints.push(
|
|
1043
|
+
editPoints.push(Object.assign(m_this._rotateHandlePosition(style.rotateHandleOffset, style.rotateHandleRotation + (selected && selected.type === 'rotate' ? m_this._editHandle.amountRotated : 0)), {
|
|
1045
1044
|
type: 'rotate',
|
|
1046
1045
|
style: style,
|
|
1047
1046
|
editHandle: true
|
|
@@ -1051,7 +1050,7 @@ var _annotation = function annotation(type, args) {
|
|
|
1051
1050
|
}
|
|
1052
1051
|
}
|
|
1053
1052
|
if (opts.resize !== false) {
|
|
1054
|
-
editPoints.push(
|
|
1053
|
+
editPoints.push(Object.assign(m_this._rotateHandlePosition(style.resizeHandleOffset, style.resizeHandleRotation), {
|
|
1055
1054
|
type: 'resize',
|
|
1056
1055
|
style: style,
|
|
1057
1056
|
editHandle: true
|
|
@@ -1599,10 +1598,10 @@ module.exports = {
|
|
|
1599
1598
|
/***/ 9894:
|
|
1600
1599
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1601
1600
|
|
|
1602
|
-
var $ = __webpack_require__(5616);
|
|
1603
1601
|
var inherit = __webpack_require__(4626);
|
|
1604
1602
|
var registerAnnotation = (__webpack_require__(1098).registerAnnotation);
|
|
1605
1603
|
var markerFeature = __webpack_require__(2225);
|
|
1604
|
+
var util = __webpack_require__(642);
|
|
1606
1605
|
var ellipseAnnotation = __webpack_require__(3656);
|
|
1607
1606
|
|
|
1608
1607
|
/**
|
|
@@ -1623,7 +1622,7 @@ var _circleAnnotation = function circleAnnotation(args, annotationName) {
|
|
|
1623
1622
|
if (!(this instanceof _circleAnnotation)) {
|
|
1624
1623
|
return new _circleAnnotation(args, annotationName);
|
|
1625
1624
|
}
|
|
1626
|
-
args =
|
|
1625
|
+
args = util.deepMerge({}, this.constructor.defaults, args, {
|
|
1627
1626
|
constraint: 1
|
|
1628
1627
|
});
|
|
1629
1628
|
ellipseAnnotation.call(this, args, annotationName || 'circle');
|
|
@@ -1633,7 +1632,7 @@ inherit(_circleAnnotation, ellipseAnnotation);
|
|
|
1633
1632
|
/**
|
|
1634
1633
|
* This object contains the default options to initialize the class.
|
|
1635
1634
|
*/
|
|
1636
|
-
_circleAnnotation.defaults =
|
|
1635
|
+
_circleAnnotation.defaults = Object.assign({}, ellipseAnnotation.defaults, {});
|
|
1637
1636
|
var circleRequiredFeatures = {};
|
|
1638
1637
|
circleRequiredFeatures[markerFeature.capabilities.feature] = true;
|
|
1639
1638
|
registerAnnotation('circle', _circleAnnotation, circleRequiredFeatures);
|
|
@@ -1644,10 +1643,10 @@ module.exports = _circleAnnotation;
|
|
|
1644
1643
|
/***/ 3656:
|
|
1645
1644
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1646
1645
|
|
|
1647
|
-
var $ = __webpack_require__(5616);
|
|
1648
1646
|
var inherit = __webpack_require__(4626);
|
|
1649
1647
|
var registerAnnotation = (__webpack_require__(1098).registerAnnotation);
|
|
1650
1648
|
var markerFeature = __webpack_require__(2225);
|
|
1649
|
+
var util = __webpack_require__(642);
|
|
1651
1650
|
var annotationState = (__webpack_require__(6978).state);
|
|
1652
1651
|
var rectangleAnnotation = __webpack_require__(4019);
|
|
1653
1652
|
|
|
@@ -1669,7 +1668,7 @@ var _ellipseAnnotation = function ellipseAnnotation(args, annotationName) {
|
|
|
1669
1668
|
if (!(this instanceof _ellipseAnnotation)) {
|
|
1670
1669
|
return new _ellipseAnnotation(args, annotationName);
|
|
1671
1670
|
}
|
|
1672
|
-
args =
|
|
1671
|
+
args = util.deepMerge({}, this.constructor.defaults, args);
|
|
1673
1672
|
rectangleAnnotation.call(this, args, annotationName || 'ellipse');
|
|
1674
1673
|
var m_this = this;
|
|
1675
1674
|
|
|
@@ -1694,7 +1693,7 @@ var _ellipseAnnotation = function ellipseAnnotation(args, annotationName) {
|
|
|
1694
1693
|
marker: {
|
|
1695
1694
|
x: (opt.corners[0].x + opt.corners[1].x + opt.corners[2].x + opt.corners[3].x) / 4,
|
|
1696
1695
|
y: (opt.corners[0].y + opt.corners[1].y + opt.corners[2].y + opt.corners[3].y) / 4,
|
|
1697
|
-
style:
|
|
1696
|
+
style: Object.assign({}, style, {
|
|
1698
1697
|
radius: radius,
|
|
1699
1698
|
symbolValue: aspect,
|
|
1700
1699
|
rotation: rotation,
|
|
@@ -1765,7 +1764,7 @@ inherit(_ellipseAnnotation, rectangleAnnotation);
|
|
|
1765
1764
|
/**
|
|
1766
1765
|
* This object contains the default options to initialize the class.
|
|
1767
1766
|
*/
|
|
1768
|
-
_ellipseAnnotation.defaults =
|
|
1767
|
+
_ellipseAnnotation.defaults = Object.assign({}, rectangleAnnotation.defaults, {});
|
|
1769
1768
|
var ellipseRequiredFeatures = {};
|
|
1770
1769
|
ellipseRequiredFeatures[markerFeature.capabilities.feature] = true;
|
|
1771
1770
|
registerAnnotation('ellipse', _ellipseAnnotation, ellipseRequiredFeatures);
|
|
@@ -1803,10 +1802,10 @@ module.exports = {
|
|
|
1803
1802
|
/***/ 2612:
|
|
1804
1803
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1805
1804
|
|
|
1806
|
-
var $ = __webpack_require__(5616);
|
|
1807
1805
|
var inherit = __webpack_require__(4626);
|
|
1808
1806
|
var registerAnnotation = (__webpack_require__(1098).registerAnnotation);
|
|
1809
1807
|
var lineFeature = __webpack_require__(9281);
|
|
1808
|
+
var util = __webpack_require__(642);
|
|
1810
1809
|
var annotation = (__webpack_require__(6978).annotation);
|
|
1811
1810
|
var annotationState = (__webpack_require__(6978).state);
|
|
1812
1811
|
var continuousVerticesActions = (__webpack_require__(6978).continuousVerticesActions);
|
|
@@ -1842,7 +1841,7 @@ var _lineAnnotation = function lineAnnotation(args) {
|
|
|
1842
1841
|
if (!(this instanceof _lineAnnotation)) {
|
|
1843
1842
|
return new _lineAnnotation(args);
|
|
1844
1843
|
}
|
|
1845
|
-
args =
|
|
1844
|
+
args = util.deepMerge({}, this.constructor.defaults, {
|
|
1846
1845
|
style: {
|
|
1847
1846
|
line: function line(d) {
|
|
1848
1847
|
/* Return an array that has the same number of items as we have
|
|
@@ -2123,7 +2122,7 @@ inherit(_lineAnnotation, annotation);
|
|
|
2123
2122
|
/**
|
|
2124
2123
|
* This object contains the default options to initialize the class.
|
|
2125
2124
|
*/
|
|
2126
|
-
_lineAnnotation.defaults =
|
|
2125
|
+
_lineAnnotation.defaults = Object.assign({}, annotation.defaults, {
|
|
2127
2126
|
style: {
|
|
2128
2127
|
strokeColor: {
|
|
2129
2128
|
r: 0,
|
|
@@ -2162,7 +2161,6 @@ module.exports = _lineAnnotation;
|
|
|
2162
2161
|
/***/ 400:
|
|
2163
2162
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
2164
2163
|
|
|
2165
|
-
var $ = __webpack_require__(5616);
|
|
2166
2164
|
var inherit = __webpack_require__(4626);
|
|
2167
2165
|
var util = __webpack_require__(642);
|
|
2168
2166
|
var registerAnnotation = (__webpack_require__(1098).registerAnnotation);
|
|
@@ -2203,7 +2201,7 @@ var _pointAnnotation = function pointAnnotation(args) {
|
|
|
2203
2201
|
if (!(this instanceof _pointAnnotation)) {
|
|
2204
2202
|
return new _pointAnnotation(args);
|
|
2205
2203
|
}
|
|
2206
|
-
args =
|
|
2204
|
+
args = util.deepMerge({}, this.constructor.defaults, args);
|
|
2207
2205
|
args.position = args.position || (args.coordinates ? args.coordinates[0] : undefined);
|
|
2208
2206
|
delete args.coordinates;
|
|
2209
2207
|
annotation.call(this, 'point', args);
|
|
@@ -2230,7 +2228,7 @@ var _pointAnnotation = function pointAnnotation(args) {
|
|
|
2230
2228
|
if (opt.style.scaled === true) {
|
|
2231
2229
|
opt.style.scaled = m_this.layer().map().zoom();
|
|
2232
2230
|
}
|
|
2233
|
-
style =
|
|
2231
|
+
style = Object.assign({}, style, {
|
|
2234
2232
|
radius: function radius() {
|
|
2235
2233
|
var radius = opt.style.radius,
|
|
2236
2234
|
zoom = m_this.layer().map().zoom();
|
|
@@ -2346,7 +2344,7 @@ inherit(_pointAnnotation, annotation);
|
|
|
2346
2344
|
/**
|
|
2347
2345
|
* This object contains the default options to initialize the class.
|
|
2348
2346
|
*/
|
|
2349
|
-
_pointAnnotation.defaults =
|
|
2347
|
+
_pointAnnotation.defaults = Object.assign({}, annotation.defaults, {
|
|
2350
2348
|
style: {
|
|
2351
2349
|
fill: true,
|
|
2352
2350
|
fillColor: {
|
|
@@ -2399,7 +2397,6 @@ module.exports = _pointAnnotation;
|
|
|
2399
2397
|
/***/ 1920:
|
|
2400
2398
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
2401
2399
|
|
|
2402
|
-
var $ = __webpack_require__(5616);
|
|
2403
2400
|
var inherit = __webpack_require__(4626);
|
|
2404
2401
|
var registerAnnotation = (__webpack_require__(1098).registerAnnotation);
|
|
2405
2402
|
var lineFeature = __webpack_require__(9281);
|
|
@@ -2444,7 +2441,7 @@ var _polygonAnnotation = function polygonAnnotation(args) {
|
|
|
2444
2441
|
if (!(this instanceof _polygonAnnotation)) {
|
|
2445
2442
|
return new _polygonAnnotation(args);
|
|
2446
2443
|
}
|
|
2447
|
-
args =
|
|
2444
|
+
args = util.deepMerge({}, this.constructor.defaults, {
|
|
2448
2445
|
style: {
|
|
2449
2446
|
polygon: function polygon(d) {
|
|
2450
2447
|
return d.polygon;
|
|
@@ -2766,7 +2763,7 @@ inherit(_polygonAnnotation, annotation);
|
|
|
2766
2763
|
/**
|
|
2767
2764
|
* This object contains the default options to initialize the class.
|
|
2768
2765
|
*/
|
|
2769
|
-
_polygonAnnotation.defaults =
|
|
2766
|
+
_polygonAnnotation.defaults = Object.assign({}, annotation.defaults, {
|
|
2770
2767
|
style: {
|
|
2771
2768
|
fill: true,
|
|
2772
2769
|
fillColor: {
|
|
@@ -2837,12 +2834,12 @@ module.exports = _polygonAnnotation;
|
|
|
2837
2834
|
/***/ 4019:
|
|
2838
2835
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
2839
2836
|
|
|
2840
|
-
var $ = __webpack_require__(5616);
|
|
2841
2837
|
var inherit = __webpack_require__(4626);
|
|
2842
2838
|
var geo_event = __webpack_require__(6409);
|
|
2843
2839
|
var geo_action = __webpack_require__(8695);
|
|
2844
2840
|
var registerAnnotation = (__webpack_require__(1098).registerAnnotation);
|
|
2845
2841
|
var polygonFeature = __webpack_require__(6645);
|
|
2842
|
+
var util = __webpack_require__(642);
|
|
2846
2843
|
var annotation = (__webpack_require__(6978).annotation);
|
|
2847
2844
|
var annotationState = (__webpack_require__(6978).state);
|
|
2848
2845
|
var annotationActionOwner = (__webpack_require__(6978).annotationActionOwner);
|
|
@@ -2886,7 +2883,7 @@ var _rectangleAnnotation = function rectangleAnnotation(args, annotationName) {
|
|
|
2886
2883
|
if (!(this instanceof _rectangleAnnotation)) {
|
|
2887
2884
|
return new _rectangleAnnotation(args, annotationName);
|
|
2888
2885
|
}
|
|
2889
|
-
args =
|
|
2886
|
+
args = util.deepMerge({}, this.constructor.defaults, args);
|
|
2890
2887
|
args.corners = args.corners || args.coordinates || [];
|
|
2891
2888
|
delete args.coordinates;
|
|
2892
2889
|
annotation.call(this, annotationName || 'rectangle', args);
|
|
@@ -3079,7 +3076,7 @@ var _rectangleAnnotation = function rectangleAnnotation(args, annotationName) {
|
|
|
3079
3076
|
x: c0.x,
|
|
3080
3077
|
y: c2.y
|
|
3081
3078
|
};
|
|
3082
|
-
corners[2] =
|
|
3079
|
+
corners[2] = Object.assign({}, evt.mapgcs);
|
|
3083
3080
|
corners[1] = map.displayToGcs(c1, null);
|
|
3084
3081
|
corners[3] = map.displayToGcs(c3, null);
|
|
3085
3082
|
if (this._selectionConstraint) {
|
|
@@ -3138,10 +3135,10 @@ var _rectangleAnnotation = function rectangleAnnotation(args, annotationName) {
|
|
|
3138
3135
|
return 'done';
|
|
3139
3136
|
}
|
|
3140
3137
|
if (evt.buttonsDown.left) {
|
|
3141
|
-
corners.push(
|
|
3142
|
-
corners.push(
|
|
3143
|
-
corners.push(
|
|
3144
|
-
corners.push(
|
|
3138
|
+
corners.push(Object.assign({}, evt.mapgcs));
|
|
3139
|
+
corners.push(Object.assign({}, evt.mapgcs));
|
|
3140
|
+
corners.push(Object.assign({}, evt.mapgcs));
|
|
3141
|
+
corners.push(Object.assign({}, evt.mapgcs));
|
|
3145
3142
|
return true;
|
|
3146
3143
|
}
|
|
3147
3144
|
};
|
|
@@ -3241,7 +3238,7 @@ inherit(_rectangleAnnotation, annotation);
|
|
|
3241
3238
|
/**
|
|
3242
3239
|
* This object contains the default options to initialize the class.
|
|
3243
3240
|
*/
|
|
3244
|
-
_rectangleAnnotation.defaults =
|
|
3241
|
+
_rectangleAnnotation.defaults = Object.assign({}, annotation.defaults, {
|
|
3245
3242
|
style: {
|
|
3246
3243
|
fill: true,
|
|
3247
3244
|
fillColor: {
|
|
@@ -3297,10 +3294,10 @@ module.exports = _rectangleAnnotation;
|
|
|
3297
3294
|
/***/ 5229:
|
|
3298
3295
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
3299
3296
|
|
|
3300
|
-
var $ = __webpack_require__(5616);
|
|
3301
3297
|
var inherit = __webpack_require__(4626);
|
|
3302
3298
|
var registerAnnotation = (__webpack_require__(1098).registerAnnotation);
|
|
3303
3299
|
var polygonFeature = __webpack_require__(6645);
|
|
3300
|
+
var util = __webpack_require__(642);
|
|
3304
3301
|
var rectangleAnnotation = __webpack_require__(4019);
|
|
3305
3302
|
|
|
3306
3303
|
/**
|
|
@@ -3321,7 +3318,7 @@ var _squareAnnotation = function squareAnnotation(args, annotationName) {
|
|
|
3321
3318
|
if (!(this instanceof _squareAnnotation)) {
|
|
3322
3319
|
return new _squareAnnotation(args, annotationName);
|
|
3323
3320
|
}
|
|
3324
|
-
args =
|
|
3321
|
+
args = util.deepMerge({}, this.constructor.defaults, args, {
|
|
3325
3322
|
constraint: 1
|
|
3326
3323
|
});
|
|
3327
3324
|
rectangleAnnotation.call(this, args, annotationName || 'square');
|
|
@@ -3331,7 +3328,7 @@ inherit(_squareAnnotation, rectangleAnnotation);
|
|
|
3331
3328
|
/**
|
|
3332
3329
|
* This object contains the default options to initialize the class.
|
|
3333
3330
|
*/
|
|
3334
|
-
_squareAnnotation.defaults =
|
|
3331
|
+
_squareAnnotation.defaults = Object.assign({}, rectangleAnnotation.defaults, {});
|
|
3335
3332
|
var squareRequiredFeatures = {};
|
|
3336
3333
|
squareRequiredFeatures[polygonFeature.capabilities.feature] = true;
|
|
3337
3334
|
registerAnnotation('square', _squareAnnotation, squareRequiredFeatures);
|
|
@@ -3522,7 +3519,7 @@ var _annotationLayer = function annotationLayer(arg) {
|
|
|
3522
3519
|
keys: [key, 'label' + key.charAt(0).toUpperCase() + key.slice(1), key.replace(/([A-Z])/g, '-$1').toLowerCase(), 'label-' + key.replace(/([A-Z])/g, '-$1').toLowerCase()]
|
|
3523
3520
|
};
|
|
3524
3521
|
});
|
|
3525
|
-
m_options =
|
|
3522
|
+
m_options = util.deepMerge({}, {
|
|
3526
3523
|
dblClickTime: 300,
|
|
3527
3524
|
adjacentPointProximity: 5,
|
|
3528
3525
|
// in pixels, 0 is exact
|
|
@@ -3830,7 +3827,7 @@ var _annotationLayer = function annotationLayer(arg) {
|
|
|
3830
3827
|
return m_options[arg1];
|
|
3831
3828
|
}
|
|
3832
3829
|
if (arg2 === undefined) {
|
|
3833
|
-
m_options =
|
|
3830
|
+
m_options = util.deepMerge(m_options, arg1);
|
|
3834
3831
|
} else {
|
|
3835
3832
|
m_options[arg1] = arg2;
|
|
3836
3833
|
}
|
|
@@ -4081,7 +4078,7 @@ var _annotationLayer = function annotationLayer(arg) {
|
|
|
4081
4078
|
}
|
|
4082
4079
|
m_this.map().interactor().removeAction(undefined, undefined, geo_annotation.actionOwner);
|
|
4083
4080
|
if (createAnnotation) {
|
|
4084
|
-
options =
|
|
4081
|
+
options = Object.assign({}, options || {}, {
|
|
4085
4082
|
state: geo_annotation.state.create,
|
|
4086
4083
|
layer: m_this
|
|
4087
4084
|
});
|
|
@@ -4197,7 +4194,7 @@ var _annotationLayer = function annotationLayer(arg) {
|
|
|
4197
4194
|
gcs = gcs === null ? map.gcs() : gcs === undefined ? map.ingcs() : gcs;
|
|
4198
4195
|
$.each(dataList, function (data_idx, data) {
|
|
4199
4196
|
var type = (data.properties || {}).annotationType || feature.featureType,
|
|
4200
|
-
options =
|
|
4197
|
+
options = Object.assign({}, data.properties || {}),
|
|
4201
4198
|
position,
|
|
4202
4199
|
datagcs,
|
|
4203
4200
|
i,
|
|
@@ -7616,7 +7613,6 @@ var _choroplethFeature = function choroplethFeature(arg) {
|
|
|
7616
7613
|
}
|
|
7617
7614
|
arg = arg || {};
|
|
7618
7615
|
feature.call(this, arg);
|
|
7619
|
-
var $ = __webpack_require__(5616);
|
|
7620
7616
|
var ensureFunction = (__webpack_require__(642).ensureFunction);
|
|
7621
7617
|
delete arg.layer;
|
|
7622
7618
|
delete arg.renderer;
|
|
@@ -7626,7 +7622,7 @@ var _choroplethFeature = function choroplethFeature(arg) {
|
|
|
7626
7622
|
var d3 = (__webpack_require__(2493).d3),
|
|
7627
7623
|
m_this = this,
|
|
7628
7624
|
s_init = this._init,
|
|
7629
|
-
m_choropleth =
|
|
7625
|
+
m_choropleth = Object.assign({}, {
|
|
7630
7626
|
colorRange: [{
|
|
7631
7627
|
r: 0.07514311,
|
|
7632
7628
|
g: 0.468049805,
|
|
@@ -7737,7 +7733,7 @@ var _choroplethFeature = function choroplethFeature(arg) {
|
|
|
7737
7733
|
return m_choropleth[arg1];
|
|
7738
7734
|
}
|
|
7739
7735
|
if (arg2 === undefined) {
|
|
7740
|
-
choropleth =
|
|
7736
|
+
choropleth = Object.assign({}, m_choropleth, arg1);
|
|
7741
7737
|
m_choropleth = choropleth;
|
|
7742
7738
|
} else {
|
|
7743
7739
|
m_choropleth[arg1] = arg2; //if you pass in accessor for prop
|
|
@@ -7969,7 +7965,6 @@ var _contourFeature = function contourFeature(arg) {
|
|
|
7969
7965
|
if (!(this instanceof _contourFeature)) {
|
|
7970
7966
|
return new _contourFeature(arg);
|
|
7971
7967
|
}
|
|
7972
|
-
var $ = __webpack_require__(5616);
|
|
7973
7968
|
var util = __webpack_require__(642);
|
|
7974
7969
|
var meshUtil = __webpack_require__(5905);
|
|
7975
7970
|
arg = arg || {};
|
|
@@ -8001,7 +7996,7 @@ var _contourFeature = function contourFeature(arg) {
|
|
|
8001
7996
|
*/
|
|
8002
7997
|
this._init = function (arg) {
|
|
8003
7998
|
s_init.call(m_this, arg);
|
|
8004
|
-
var defaultStyle =
|
|
7999
|
+
var defaultStyle = Object.assign({}, {
|
|
8005
8000
|
opacity: 1.0,
|
|
8006
8001
|
value: function value(d, i) {
|
|
8007
8002
|
return util.isNonNullFinite(d) ? d : m_this.position()(d, i).z;
|
|
@@ -8017,7 +8012,7 @@ var _contourFeature = function contourFeature(arg) {
|
|
|
8017
8012
|
}
|
|
8018
8013
|
}, arg.style === undefined ? {} : arg.style);
|
|
8019
8014
|
m_this.style(defaultStyle);
|
|
8020
|
-
m_this.contour(
|
|
8015
|
+
m_this.contour(Object.assign({}, {
|
|
8021
8016
|
minColor: 'black',
|
|
8022
8017
|
minOpacity: 0,
|
|
8023
8018
|
maxColor: 'black',
|
|
@@ -9526,7 +9521,7 @@ var _feature = function feature(arg) {
|
|
|
9526
9521
|
} else if (typeof arg1 === 'string' && arg2 === undefined) {
|
|
9527
9522
|
return m_style[arg1];
|
|
9528
9523
|
} else if (arg2 === undefined) {
|
|
9529
|
-
m_style =
|
|
9524
|
+
m_style = Object.assign({}, m_style, arg1);
|
|
9530
9525
|
m_this.modified();
|
|
9531
9526
|
return m_this;
|
|
9532
9527
|
} else {
|
|
@@ -9925,7 +9920,7 @@ var _feature = function feature(arg) {
|
|
|
9925
9920
|
if (!m_layer) {
|
|
9926
9921
|
throw new Error('Feature requires a valid layer');
|
|
9927
9922
|
}
|
|
9928
|
-
m_style =
|
|
9923
|
+
m_style = Object.assign({}, {
|
|
9929
9924
|
opacity: 1.0
|
|
9930
9925
|
}, arg.style === undefined ? {} : arg.style);
|
|
9931
9926
|
m_this._bindMouseHandlers();
|
|
@@ -11359,7 +11354,6 @@ var _graphFeature = function graphFeature(arg) {
|
|
|
11359
11354
|
}
|
|
11360
11355
|
arg = arg || {};
|
|
11361
11356
|
feature.call(this, arg);
|
|
11362
|
-
var $ = __webpack_require__(5616);
|
|
11363
11357
|
var util = __webpack_require__(642);
|
|
11364
11358
|
var registry = __webpack_require__(1098);
|
|
11365
11359
|
var m_this = this,
|
|
@@ -11383,7 +11377,7 @@ var _graphFeature = function graphFeature(arg) {
|
|
|
11383
11377
|
*/
|
|
11384
11378
|
this._init = function (arg) {
|
|
11385
11379
|
s_init.call(m_this, arg);
|
|
11386
|
-
var defaultStyle =
|
|
11380
|
+
var defaultStyle = util.deepMerge({}, {
|
|
11387
11381
|
nodes: {
|
|
11388
11382
|
radius: 5.0,
|
|
11389
11383
|
fill: true,
|
|
@@ -11683,7 +11677,6 @@ var _gridFeature = function gridFeature(arg) {
|
|
|
11683
11677
|
if (!(this instanceof _gridFeature)) {
|
|
11684
11678
|
return new _gridFeature(arg);
|
|
11685
11679
|
}
|
|
11686
|
-
var $ = __webpack_require__(5616);
|
|
11687
11680
|
var util = __webpack_require__(642);
|
|
11688
11681
|
var meshUtil = __webpack_require__(5905);
|
|
11689
11682
|
arg = arg || {};
|
|
@@ -11715,7 +11708,7 @@ var _gridFeature = function gridFeature(arg) {
|
|
|
11715
11708
|
*/
|
|
11716
11709
|
this._init = function (arg) {
|
|
11717
11710
|
s_init.call(m_this, arg);
|
|
11718
|
-
var defaultStyle =
|
|
11711
|
+
var defaultStyle = Object.assign({}, {
|
|
11719
11712
|
opacity: 1.0,
|
|
11720
11713
|
value: function value(d, i) {
|
|
11721
11714
|
return util.isNonNullFinite(d) ? d : m_this.position()(d, i).z;
|
|
@@ -11731,7 +11724,7 @@ var _gridFeature = function gridFeature(arg) {
|
|
|
11731
11724
|
}
|
|
11732
11725
|
}, arg.style === undefined ? {} : arg.style);
|
|
11733
11726
|
m_this.style(defaultStyle);
|
|
11734
|
-
m_this.grid(
|
|
11727
|
+
m_this.grid(Object.assign({}, {
|
|
11735
11728
|
minColor: 'black',
|
|
11736
11729
|
minOpacity: 0,
|
|
11737
11730
|
maxColor: 'black',
|
|
@@ -11790,7 +11783,6 @@ module.exports = _gridFeature;
|
|
|
11790
11783
|
/***/ 9163:
|
|
11791
11784
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
11792
11785
|
|
|
11793
|
-
var $ = __webpack_require__(5616);
|
|
11794
11786
|
var inherit = __webpack_require__(4626);
|
|
11795
11787
|
var feature = __webpack_require__(1275);
|
|
11796
11788
|
var transform = __webpack_require__(5325);
|
|
@@ -12025,7 +12017,7 @@ var _heatmapFeature = function heatmapFeature(arg) {
|
|
|
12025
12017
|
*/
|
|
12026
12018
|
this._init = function (arg) {
|
|
12027
12019
|
s_init.call(m_this, arg);
|
|
12028
|
-
var defaultStyle =
|
|
12020
|
+
var defaultStyle = Object.assign({}, {
|
|
12029
12021
|
radius: 10,
|
|
12030
12022
|
blurRadius: 10,
|
|
12031
12023
|
gaussian: true,
|
|
@@ -12273,7 +12265,7 @@ $.htmlPrefilter = function (html) {
|
|
|
12273
12265
|
return html.replace(rxhtmlTag, '<$1></$2>');
|
|
12274
12266
|
};
|
|
12275
12267
|
__webpack_require__(7605);
|
|
12276
|
-
module.exports =
|
|
12268
|
+
module.exports = Object.assign({
|
|
12277
12269
|
annotationLayer: __webpack_require__(2075),
|
|
12278
12270
|
camera: __webpack_require__(3578),
|
|
12279
12271
|
choroplethFeature: __webpack_require__(3561),
|
|
@@ -12673,7 +12665,6 @@ var _isolineFeature = function isolineFeature(arg) {
|
|
|
12673
12665
|
if (!(this instanceof _isolineFeature)) {
|
|
12674
12666
|
return new _isolineFeature(arg);
|
|
12675
12667
|
}
|
|
12676
|
-
var $ = __webpack_require__(5616);
|
|
12677
12668
|
var transform = __webpack_require__(5325);
|
|
12678
12669
|
var geo_event = __webpack_require__(6409);
|
|
12679
12670
|
var textFeature = __webpack_require__(6546);
|
|
@@ -13148,7 +13139,7 @@ var _isolineFeature = function isolineFeature(arg) {
|
|
|
13148
13139
|
* properties if there are no labels.
|
|
13149
13140
|
*/
|
|
13150
13141
|
this.lastLabelPositions = function () {
|
|
13151
|
-
return
|
|
13142
|
+
return Object.assign({}, m_lastLabelPositions);
|
|
13152
13143
|
};
|
|
13153
13144
|
|
|
13154
13145
|
/**
|
|
@@ -13317,7 +13308,7 @@ var _isolineFeature = function isolineFeature(arg) {
|
|
|
13317
13308
|
this._init = function (arg) {
|
|
13318
13309
|
arg = arg || {};
|
|
13319
13310
|
s_init.call(m_this, arg);
|
|
13320
|
-
var defaultStyle =
|
|
13311
|
+
var defaultStyle = Object.assign({}, {
|
|
13321
13312
|
opacity: 1.0,
|
|
13322
13313
|
value: function value(d, i) {
|
|
13323
13314
|
return m_this.position()(d, i).z;
|
|
@@ -13342,7 +13333,7 @@ var _isolineFeature = function isolineFeature(arg) {
|
|
|
13342
13333
|
fontSize: '12px'
|
|
13343
13334
|
}, arg.style === undefined ? {} : arg.style);
|
|
13344
13335
|
m_this.style(defaultStyle);
|
|
13345
|
-
m_this.isoline(
|
|
13336
|
+
m_this.isoline(Object.assign({}, {
|
|
13346
13337
|
count: 15,
|
|
13347
13338
|
autofit: true,
|
|
13348
13339
|
levels: [5, 5],
|
|
@@ -13924,7 +13915,7 @@ var _layer = function layer(arg) {
|
|
|
13924
13915
|
m_map.node().append(m_node);
|
|
13925
13916
|
|
|
13926
13917
|
/* Pass along the arguments, but not the map reference */
|
|
13927
|
-
var options =
|
|
13918
|
+
var options = Object.assign({}, arg);
|
|
13928
13919
|
delete options.map;
|
|
13929
13920
|
if (m_renderer) {
|
|
13930
13921
|
m_this._canvas(m_renderer.canvas());
|
|
@@ -14206,7 +14197,6 @@ var _lineFeature = function lineFeature(arg) {
|
|
|
14206
14197
|
if (!(this instanceof _lineFeature)) {
|
|
14207
14198
|
return new _lineFeature(arg);
|
|
14208
14199
|
}
|
|
14209
|
-
var $ = __webpack_require__(5616);
|
|
14210
14200
|
arg = arg || {};
|
|
14211
14201
|
feature.call(this, arg);
|
|
14212
14202
|
|
|
@@ -14670,7 +14660,7 @@ var _lineFeature = function lineFeature(arg) {
|
|
|
14670
14660
|
this._init = function (arg) {
|
|
14671
14661
|
arg = arg || {};
|
|
14672
14662
|
s_init.call(m_this, arg);
|
|
14673
|
-
var defaultStyle =
|
|
14663
|
+
var defaultStyle = Object.assign({}, {
|
|
14674
14664
|
strokeWidth: 1.0,
|
|
14675
14665
|
// Default to gold color for lines
|
|
14676
14666
|
strokeColor: {
|
|
@@ -15084,7 +15074,7 @@ var _map2 = function map(arg) {
|
|
|
15084
15074
|
* @returns {geo.geoPosition}
|
|
15085
15075
|
*/
|
|
15086
15076
|
this.origin = function () {
|
|
15087
|
-
return
|
|
15077
|
+
return Object.assign({}, m_origin);
|
|
15088
15078
|
};
|
|
15089
15079
|
|
|
15090
15080
|
/**
|
|
@@ -15344,7 +15334,7 @@ var _map2 = function map(arg) {
|
|
|
15344
15334
|
this.center = function (coordinates, gcs, ignoreDiscreteZoom, ignoreClampBounds) {
|
|
15345
15335
|
var center;
|
|
15346
15336
|
if (coordinates === undefined) {
|
|
15347
|
-
center =
|
|
15337
|
+
center = Object.assign({}, m_this.worldToGcs(m_center, gcs));
|
|
15348
15338
|
return center;
|
|
15349
15339
|
}
|
|
15350
15340
|
|
|
@@ -15658,7 +15648,7 @@ var _map2 = function map(arg) {
|
|
|
15658
15648
|
if (typeof readerOrName === 'string') {
|
|
15659
15649
|
opts = opts || {};
|
|
15660
15650
|
if (!opts.layer) {
|
|
15661
|
-
opts.layer = m_this.createLayer('feature',
|
|
15651
|
+
opts.layer = m_this.createLayer('feature', Object.assign({}, opts));
|
|
15662
15652
|
}
|
|
15663
15653
|
opts.renderer = opts.layer.renderer().api();
|
|
15664
15654
|
m_fileReader = registry.createFileReader(readerOrName, opts);
|
|
@@ -15816,7 +15806,7 @@ var _map2 = function map(arg) {
|
|
|
15816
15806
|
*/
|
|
15817
15807
|
this.zoomRange = function (arg, noRefresh) {
|
|
15818
15808
|
if (arg === undefined) {
|
|
15819
|
-
return
|
|
15809
|
+
return Object.assign({}, m_validZoomRange);
|
|
15820
15810
|
}
|
|
15821
15811
|
if (arg.max !== undefined) {
|
|
15822
15812
|
m_validZoomRange.max = arg.max;
|
|
@@ -15884,11 +15874,11 @@ var _map2 = function map(arg) {
|
|
|
15884
15874
|
/* The queued transition needs to combine the current transition's
|
|
15885
15875
|
* endpoint, any other queued transition, and the new transition to be
|
|
15886
15876
|
* complete. */
|
|
15887
|
-
var transitionEnd =
|
|
15877
|
+
var transitionEnd = util.deepMerge({}, m_transition.end);
|
|
15888
15878
|
if (transitionEnd.center && m_gcs !== m_ingcs) {
|
|
15889
15879
|
transitionEnd.center = transform.transformCoordinates(m_gcs, m_ingcs, transitionEnd.center);
|
|
15890
15880
|
}
|
|
15891
|
-
m_queuedTransition =
|
|
15881
|
+
m_queuedTransition = Object.assign({}, transitionEnd || {}, m_queuedTransition || {}, opts);
|
|
15892
15882
|
return m_this;
|
|
15893
15883
|
}
|
|
15894
15884
|
|
|
@@ -15937,13 +15927,13 @@ var _map2 = function map(arg) {
|
|
|
15937
15927
|
};
|
|
15938
15928
|
if (opts.center) {
|
|
15939
15929
|
gcs = gcs === null ? m_gcs : gcs === undefined ? m_ingcs : gcs;
|
|
15940
|
-
opts =
|
|
15930
|
+
opts = util.deepMerge({}, opts);
|
|
15941
15931
|
opts.center = util.normalizeCoordinates(opts.center);
|
|
15942
15932
|
if (gcs !== m_gcs) {
|
|
15943
15933
|
opts.center = transform.transformCoordinates(gcs, m_gcs, opts.center);
|
|
15944
15934
|
}
|
|
15945
15935
|
}
|
|
15946
|
-
opts =
|
|
15936
|
+
opts = util.deepMerge({}, defaultOpts, opts);
|
|
15947
15937
|
m_transition = {
|
|
15948
15938
|
start: {
|
|
15949
15939
|
center: m_this.center(undefined, null),
|
|
@@ -16510,7 +16500,7 @@ var _map2 = function map(arg) {
|
|
|
16510
16500
|
/* if asked to wait, return a Deferred that will do so, calling the
|
|
16511
16501
|
* screenshot function without waiting once it is done. */
|
|
16512
16502
|
if (opts.wait) {
|
|
16513
|
-
var optsWithoutWait =
|
|
16503
|
+
var optsWithoutWait = Object.assign({}, opts, {
|
|
16514
16504
|
wait: false
|
|
16515
16505
|
});
|
|
16516
16506
|
defer = $.Deferred();
|
|
@@ -16978,7 +16968,7 @@ var _map2 = function map(arg) {
|
|
|
16978
16968
|
dy,
|
|
16979
16969
|
maxBounds = m_maxBounds;
|
|
16980
16970
|
if (rotation) {
|
|
16981
|
-
maxBounds =
|
|
16971
|
+
maxBounds = Object.assign({}, m_maxBounds);
|
|
16982
16972
|
/* When rotated, expand the maximum bounds so that they will allow the
|
|
16983
16973
|
* corners to be visible. We know the rotated bounding box, plus the
|
|
16984
16974
|
* original maximum bounds. To fit the corners of the maximum bounds, we
|
|
@@ -17172,7 +17162,7 @@ var _map2 = function map(arg) {
|
|
|
17172
17162
|
m_zoom = this._fix_zoom(m_zoom);
|
|
17173
17163
|
m_rotation = fix_rotation(m_rotation);
|
|
17174
17164
|
// Now update to the correct center and zoom level
|
|
17175
|
-
this.center(
|
|
17165
|
+
this.center(Object.assign({}, arg.center || m_center), undefined);
|
|
17176
17166
|
if (arg.interactor !== null) {
|
|
17177
17167
|
this.interactor(arg.interactor || mapInteractor({
|
|
17178
17168
|
discreteZoom: m_discreteZoom
|
|
@@ -17399,7 +17389,7 @@ var _mapInteractor = function mapInteractor(args) {
|
|
|
17399
17389
|
}
|
|
17400
17390
|
|
|
17401
17391
|
// copy the options object with defaults
|
|
17402
|
-
m_options =
|
|
17392
|
+
m_options = util.deepMerge({}, {
|
|
17403
17393
|
throttle: 30,
|
|
17404
17394
|
discreteZoom: false,
|
|
17405
17395
|
/* There should only be one action with any specific combination of event
|
|
@@ -17648,13 +17638,13 @@ var _mapInteractor = function mapInteractor(args) {
|
|
|
17648
17638
|
/* We don't want to merge the original arrays with arrays passed in the args,
|
|
17649
17639
|
* so override that as necessary for actions. */
|
|
17650
17640
|
if (args && args.actions) {
|
|
17651
|
-
m_options.actions =
|
|
17641
|
+
m_options.actions = util.deepMerge([], args.actions);
|
|
17652
17642
|
}
|
|
17653
17643
|
if (args && args.momentum && args.momentum.actions) {
|
|
17654
|
-
m_options.momentum.actions =
|
|
17644
|
+
m_options.momentum.actions = util.deepMerge([], args.momentum.actions);
|
|
17655
17645
|
}
|
|
17656
17646
|
if (args && args.keyboard && args.keyboard.actions !== undefined) {
|
|
17657
|
-
m_options.keyboard.actions =
|
|
17647
|
+
m_options.keyboard.actions = util.deepMerge({}, args.keyboard.actions);
|
|
17658
17648
|
}
|
|
17659
17649
|
|
|
17660
17650
|
// default mouse object
|
|
@@ -18167,9 +18157,9 @@ var _mapInteractor = function mapInteractor(args) {
|
|
|
18167
18157
|
*/
|
|
18168
18158
|
this.options = function (opts) {
|
|
18169
18159
|
if (opts === undefined) {
|
|
18170
|
-
return
|
|
18160
|
+
return Object.assign({}, m_options);
|
|
18171
18161
|
}
|
|
18172
|
-
|
|
18162
|
+
Object.assign(m_options, opts);
|
|
18173
18163
|
|
|
18174
18164
|
// reset event handlers for new options
|
|
18175
18165
|
m_this._connectEvents();
|
|
@@ -18326,7 +18316,7 @@ var _mapInteractor = function mapInteractor(args) {
|
|
|
18326
18316
|
display: display,
|
|
18327
18317
|
gcs: gcs,
|
|
18328
18318
|
mouse: mouse,
|
|
18329
|
-
origin:
|
|
18319
|
+
origin: Object.assign({}, m_state.origin)
|
|
18330
18320
|
};
|
|
18331
18321
|
};
|
|
18332
18322
|
|
|
@@ -18398,7 +18388,7 @@ var _mapInteractor = function mapInteractor(args) {
|
|
|
18398
18388
|
m_this._setClickMaybe({
|
|
18399
18389
|
x: m_mouse.page.x,
|
|
18400
18390
|
y: m_mouse.page.y,
|
|
18401
|
-
buttons:
|
|
18391
|
+
buttons: Object.assign({}, m_mouse.buttons)
|
|
18402
18392
|
});
|
|
18403
18393
|
if (m_options.click.duration > 0) {
|
|
18404
18394
|
m_clickMaybeTimeout = window.setTimeout(function () {
|
|
@@ -18428,7 +18418,7 @@ var _mapInteractor = function mapInteractor(args) {
|
|
|
18428
18418
|
m_state = {
|
|
18429
18419
|
action: action,
|
|
18430
18420
|
actionRecord: actionRecord,
|
|
18431
|
-
origin:
|
|
18421
|
+
origin: util.deepMerge({}, m_mouse),
|
|
18432
18422
|
initialZoom: map.zoom(),
|
|
18433
18423
|
initialRotation: map.rotation(),
|
|
18434
18424
|
initialEventRotation: evt.rotation,
|
|
@@ -18961,7 +18951,7 @@ var _mapInteractor = function mapInteractor(args) {
|
|
|
18961
18951
|
function accum(dz, org) {
|
|
18962
18952
|
var map = m_this.map(),
|
|
18963
18953
|
zoom;
|
|
18964
|
-
origin =
|
|
18954
|
+
origin = util.deepMerge({}, org);
|
|
18965
18955
|
deltaZ += dz;
|
|
18966
18956
|
if (targetZoom === undefined) {
|
|
18967
18957
|
startZoom = targetZoom = map.zoom();
|
|
@@ -19255,7 +19245,7 @@ var _mapInteractor = function mapInteractor(args) {
|
|
|
19255
19245
|
* @returns {object} The current mouse state.
|
|
19256
19246
|
*/
|
|
19257
19247
|
this.mouse = function () {
|
|
19258
|
-
return
|
|
19248
|
+
return util.deepMerge({}, m_mouse);
|
|
19259
19249
|
};
|
|
19260
19250
|
|
|
19261
19251
|
/**
|
|
@@ -19268,7 +19258,7 @@ var _mapInteractor = function mapInteractor(args) {
|
|
|
19268
19258
|
*/
|
|
19269
19259
|
this.keyboard = function (newValue) {
|
|
19270
19260
|
if (newValue === undefined) {
|
|
19271
|
-
return
|
|
19261
|
+
return util.deepMerge({}, m_options.keyboard || {});
|
|
19272
19262
|
}
|
|
19273
19263
|
return m_this.options({
|
|
19274
19264
|
keyboard: newValue
|
|
@@ -19281,7 +19271,7 @@ var _mapInteractor = function mapInteractor(args) {
|
|
|
19281
19271
|
* @returns {geo.interactorState}
|
|
19282
19272
|
*/
|
|
19283
19273
|
this.state = function () {
|
|
19284
|
-
return
|
|
19274
|
+
return util.deepMerge({}, m_state);
|
|
19285
19275
|
};
|
|
19286
19276
|
|
|
19287
19277
|
/**
|
|
@@ -19578,7 +19568,6 @@ var _markerFeature = function markerFeature(arg) {
|
|
|
19578
19568
|
}
|
|
19579
19569
|
arg = arg || {};
|
|
19580
19570
|
pointFeature.call(this, arg);
|
|
19581
|
-
var $ = __webpack_require__(5616);
|
|
19582
19571
|
var timestamp = __webpack_require__(77);
|
|
19583
19572
|
var util = __webpack_require__(642);
|
|
19584
19573
|
var KDBush = __webpack_require__(4279);
|
|
@@ -19965,8 +19954,8 @@ var _markerFeature = function markerFeature(arg) {
|
|
|
19965
19954
|
* @returns {this}
|
|
19966
19955
|
*/
|
|
19967
19956
|
this._init = function (arg) {
|
|
19968
|
-
arg =
|
|
19969
|
-
style:
|
|
19957
|
+
arg = util.deepMerge({}, {
|
|
19958
|
+
style: Object.assign({}, {
|
|
19970
19959
|
radius: 6.25,
|
|
19971
19960
|
radiusIncludesStroke: true,
|
|
19972
19961
|
strokeColor: {
|
|
@@ -20206,7 +20195,6 @@ var _meshFeature = function meshFeature(arg) {
|
|
|
20206
20195
|
if (!(this instanceof _meshFeature)) {
|
|
20207
20196
|
return new _meshFeature(arg);
|
|
20208
20197
|
}
|
|
20209
|
-
var $ = __webpack_require__(5616);
|
|
20210
20198
|
var util = __webpack_require__(642);
|
|
20211
20199
|
arg = arg || {};
|
|
20212
20200
|
feature.call(this, arg);
|
|
@@ -20236,7 +20224,7 @@ var _meshFeature = function meshFeature(arg) {
|
|
|
20236
20224
|
return m_mesh[specOrProperty];
|
|
20237
20225
|
}
|
|
20238
20226
|
if (value === undefined) {
|
|
20239
|
-
var mesh =
|
|
20227
|
+
var mesh = Object.assign({}, {
|
|
20240
20228
|
gridWidth: function gridWidth() {
|
|
20241
20229
|
if (specOrProperty.gridHeight) {
|
|
20242
20230
|
return Math.floor(m_this.data().length / specOrProperty.gridHeight);
|
|
@@ -20662,7 +20650,7 @@ var _meshFeature = function meshFeature(arg) {
|
|
|
20662
20650
|
|
|
20663
20651
|
/* Initialize from arguments */
|
|
20664
20652
|
arg = arg || {};
|
|
20665
|
-
var style =
|
|
20653
|
+
var style = Object.assign({}, {
|
|
20666
20654
|
position: function position(d) {
|
|
20667
20655
|
return Array.isArray(d) ? {
|
|
20668
20656
|
x: d[0],
|
|
@@ -20979,11 +20967,11 @@ module.exports = _object;
|
|
|
20979
20967
|
/***/ 4880:
|
|
20980
20968
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
20981
20969
|
|
|
20982
|
-
var $ = __webpack_require__(5616);
|
|
20983
20970
|
var inherit = __webpack_require__(4626);
|
|
20984
20971
|
var tileLayer = __webpack_require__(9264);
|
|
20985
20972
|
var registry = __webpack_require__(1098);
|
|
20986
20973
|
var quadFeature = __webpack_require__(3842);
|
|
20974
|
+
var util = __webpack_require__(642);
|
|
20987
20975
|
|
|
20988
20976
|
/**
|
|
20989
20977
|
* Object specification for an OSM layer.
|
|
@@ -21016,10 +21004,10 @@ var _osmLayer = function osmLayer(arg) {
|
|
|
21016
21004
|
}
|
|
21017
21005
|
arg = arg || {};
|
|
21018
21006
|
if (arg.mapOpacity !== undefined && arg.opacity === undefined) {
|
|
21019
|
-
arg =
|
|
21007
|
+
arg = Object.assign({}, arg);
|
|
21020
21008
|
arg.opacity = arg.mapOpacity;
|
|
21021
21009
|
}
|
|
21022
|
-
arg =
|
|
21010
|
+
arg = util.deepMerge({}, this.constructor.defaults, _osmLayer.tileSources[this.constructor.defaults.source] || {}, _osmLayer.tileSources[arg.source] || {},
|
|
21023
21011
|
// don't name the layer based on the source
|
|
21024
21012
|
{
|
|
21025
21013
|
name: ''
|
|
@@ -21093,7 +21081,7 @@ var _osmLayer = function osmLayer(arg) {
|
|
|
21093
21081
|
/**
|
|
21094
21082
|
* This object contains the default options used to initialize the osmLayer.
|
|
21095
21083
|
*/
|
|
21096
|
-
_osmLayer.defaults =
|
|
21084
|
+
_osmLayer.defaults = Object.assign({}, tileLayer.defaults, {
|
|
21097
21085
|
tileOffset: function tileOffset(level) {
|
|
21098
21086
|
var s = Math.pow(2, level - 1) * 256;
|
|
21099
21087
|
return {
|
|
@@ -21244,7 +21232,6 @@ module.exports = _osmLayer;
|
|
|
21244
21232
|
/***/ 2266:
|
|
21245
21233
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
21246
21234
|
|
|
21247
|
-
var $ = __webpack_require__(5616);
|
|
21248
21235
|
var inherit = __webpack_require__(4626);
|
|
21249
21236
|
var feature = __webpack_require__(1275);
|
|
21250
21237
|
|
|
@@ -21323,7 +21310,7 @@ var _pathFeature = function pathFeature(arg) {
|
|
|
21323
21310
|
*/
|
|
21324
21311
|
this._init = function (arg) {
|
|
21325
21312
|
s_init.call(m_this, arg);
|
|
21326
|
-
var defaultStyle =
|
|
21313
|
+
var defaultStyle = Object.assign({}, {
|
|
21327
21314
|
strokeWidth: 1,
|
|
21328
21315
|
strokeColor: {
|
|
21329
21316
|
r: 1.0,
|
|
@@ -21632,7 +21619,7 @@ var _pixelmapFeature = function pixelmapFeature(arg) {
|
|
|
21632
21619
|
this._init = function (arg) {
|
|
21633
21620
|
arg = arg || {};
|
|
21634
21621
|
s_init.call(m_this, arg);
|
|
21635
|
-
var style =
|
|
21622
|
+
var style = Object.assign({}, {
|
|
21636
21623
|
color: function color(d, idx) {
|
|
21637
21624
|
return {
|
|
21638
21625
|
r: (idx & 0xFF) / 255,
|
|
@@ -21692,12 +21679,12 @@ module.exports = _pixelmapFeature;
|
|
|
21692
21679
|
/***/ 534:
|
|
21693
21680
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
21694
21681
|
|
|
21695
|
-
var $ = __webpack_require__(5616);
|
|
21696
21682
|
var inherit = __webpack_require__(4626);
|
|
21697
21683
|
var tileLayer = __webpack_require__(9264);
|
|
21698
21684
|
var registry = __webpack_require__(1098);
|
|
21699
21685
|
var quadFeature = __webpack_require__(3842);
|
|
21700
21686
|
var pixelmapFeature = __webpack_require__(7761);
|
|
21687
|
+
var util = __webpack_require__(642);
|
|
21701
21688
|
|
|
21702
21689
|
/**
|
|
21703
21690
|
* Object specification for a pixelmap layer.
|
|
@@ -21739,7 +21726,7 @@ var _pixelmapLayer = function pixelmapLayer(arg) {
|
|
|
21739
21726
|
argdata = arg.data;
|
|
21740
21727
|
delete arg.data;
|
|
21741
21728
|
}
|
|
21742
|
-
arg =
|
|
21729
|
+
arg = util.deepMerge({}, this.constructor.defaults, arg);
|
|
21743
21730
|
tileLayer.call(this, arg);
|
|
21744
21731
|
var s_init = this._init,
|
|
21745
21732
|
m_pixelmapFeature,
|
|
@@ -21824,7 +21811,7 @@ var _pixelmapLayer = function pixelmapLayer(arg) {
|
|
|
21824
21811
|
* This object contains the default options used to initialize the
|
|
21825
21812
|
* pixelmapLayer.
|
|
21826
21813
|
*/
|
|
21827
|
-
_pixelmapLayer.defaults =
|
|
21814
|
+
_pixelmapLayer.defaults = Object.assign({}, tileLayer.defaults, {
|
|
21828
21815
|
features: [quadFeature.capabilities.image, pixelmapFeature.capabilities.lookup],
|
|
21829
21816
|
tileOffset: function tileOffset(level) {
|
|
21830
21817
|
var s = Math.pow(2, level - 1) * 256;
|
|
@@ -21932,7 +21919,6 @@ var _pointFeature = function pointFeature(arg) {
|
|
|
21932
21919
|
}
|
|
21933
21920
|
arg = arg || {};
|
|
21934
21921
|
feature.call(this, arg);
|
|
21935
|
-
var $ = __webpack_require__(5616);
|
|
21936
21922
|
var timestamp = __webpack_require__(77);
|
|
21937
21923
|
var ClusterGroup = __webpack_require__(5966);
|
|
21938
21924
|
var geo_event = __webpack_require__(6409);
|
|
@@ -22010,7 +21996,7 @@ var _pointFeature = function pointFeature(arg) {
|
|
|
22010
21996
|
radiusInGcsAtZoom = Math.pow(Math.pow(offset.y - center.y, 2) + Math.pow(offset.x - center.x, 2), 0.5),
|
|
22011
21997
|
zoom = map.zoom(),
|
|
22012
21998
|
radiusInGcsAtZoom0 = radiusInGcsAtZoom * Math.pow(2, zoom);
|
|
22013
|
-
opts =
|
|
21999
|
+
opts = Object.assign({}, opts, {
|
|
22014
22000
|
radius: radiusInGcsAtZoom0
|
|
22015
22001
|
});
|
|
22016
22002
|
m_clusterTree = new ClusterGroup(opts);
|
|
@@ -22414,7 +22400,7 @@ var _pointFeature = function pointFeature(arg) {
|
|
|
22414
22400
|
this._init = function (arg) {
|
|
22415
22401
|
arg = arg || {};
|
|
22416
22402
|
s_init.call(m_this, arg);
|
|
22417
|
-
var defaultStyle =
|
|
22403
|
+
var defaultStyle = util.deepMerge({}, {
|
|
22418
22404
|
radius: 5.0,
|
|
22419
22405
|
stroke: true,
|
|
22420
22406
|
strokeColor: {
|
|
@@ -22499,7 +22485,6 @@ module.exports = _pointFeature;
|
|
|
22499
22485
|
/***/ 6645:
|
|
22500
22486
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
22501
22487
|
|
|
22502
|
-
var $ = __webpack_require__(5616);
|
|
22503
22488
|
var inherit = __webpack_require__(4626);
|
|
22504
22489
|
var feature = __webpack_require__(1275);
|
|
22505
22490
|
var transform = __webpack_require__(5325);
|
|
@@ -23335,7 +23320,7 @@ var _polygonFeature = function polygonFeature(arg) {
|
|
|
23335
23320
|
this._init = function (arg) {
|
|
23336
23321
|
arg = arg || {};
|
|
23337
23322
|
s_init.call(m_this, arg);
|
|
23338
|
-
var style =
|
|
23323
|
+
var style = Object.assign({}, {
|
|
23339
23324
|
// default style
|
|
23340
23325
|
fill: true,
|
|
23341
23326
|
fillColor: {
|
|
@@ -24132,7 +24117,7 @@ var _quadFeature = function quadFeature(arg) {
|
|
|
24132
24117
|
arg = arg || {};
|
|
24133
24118
|
s_init.call(m_this, arg);
|
|
24134
24119
|
m_cacheQuads = arg.cacheQuads !== false;
|
|
24135
|
-
var style =
|
|
24120
|
+
var style = Object.assign({}, {
|
|
24136
24121
|
color: {
|
|
24137
24122
|
r: 1.0,
|
|
24138
24123
|
g: 1,
|
|
@@ -24201,6 +24186,7 @@ module.exports = _quadFeature;
|
|
|
24201
24186
|
|
|
24202
24187
|
var $ = __webpack_require__(5616);
|
|
24203
24188
|
var geo_action = __webpack_require__(8695);
|
|
24189
|
+
var util = __webpack_require__(1949);
|
|
24204
24190
|
var widgets = {
|
|
24205
24191
|
dom: {}
|
|
24206
24192
|
};
|
|
@@ -24212,7 +24198,7 @@ var featureCapabilities = {};
|
|
|
24212
24198
|
var fileReaders = {};
|
|
24213
24199
|
var rendererLayerAdjustments = {};
|
|
24214
24200
|
var annotations = {};
|
|
24215
|
-
var
|
|
24201
|
+
var registry = {};
|
|
24216
24202
|
|
|
24217
24203
|
/**
|
|
24218
24204
|
* Register a new file reader type.
|
|
@@ -24222,7 +24208,7 @@ var util = {};
|
|
|
24222
24208
|
* exists, the class creation function is replaced.
|
|
24223
24209
|
* @param {function} func Class creation function.
|
|
24224
24210
|
*/
|
|
24225
|
-
|
|
24211
|
+
registry.registerFileReader = function (name, func) {
|
|
24226
24212
|
fileReaders[name] = func;
|
|
24227
24213
|
};
|
|
24228
24214
|
|
|
@@ -24235,7 +24221,7 @@ util.registerFileReader = function (name, func) {
|
|
|
24235
24221
|
* @returns {geo.fileReader|null} The new reader or null if no such name is
|
|
24236
24222
|
* registered.
|
|
24237
24223
|
*/
|
|
24238
|
-
|
|
24224
|
+
registry.createFileReader = function (name, opts) {
|
|
24239
24225
|
if (fileReaders.hasOwnProperty(name)) {
|
|
24240
24226
|
return fileReaders[name](opts);
|
|
24241
24227
|
}
|
|
@@ -24250,7 +24236,7 @@ util.createFileReader = function (name, opts) {
|
|
|
24250
24236
|
* exists, the class creation function is replaced.
|
|
24251
24237
|
* @param {function} func Class creation function.
|
|
24252
24238
|
*/
|
|
24253
|
-
|
|
24239
|
+
registry.registerRenderer = function (name, func) {
|
|
24254
24240
|
renderers[name] = func;
|
|
24255
24241
|
};
|
|
24256
24242
|
|
|
@@ -24266,7 +24252,7 @@ util.registerRenderer = function (name, func) {
|
|
|
24266
24252
|
* @returns {geo.renderer|null} The new renderer or null if no such name is
|
|
24267
24253
|
* registered.
|
|
24268
24254
|
*/
|
|
24269
|
-
|
|
24255
|
+
registry.createRenderer = function (name, layer, canvas, options) {
|
|
24270
24256
|
if (renderers.hasOwnProperty(name)) {
|
|
24271
24257
|
var ren = renderers[name]({
|
|
24272
24258
|
layer: layer,
|
|
@@ -24291,7 +24277,7 @@ util.createRenderer = function (name, layer, canvas, options) {
|
|
|
24291
24277
|
* @returns {string|null|false} The name of the renderer that should be used
|
|
24292
24278
|
* or false if no valid renderer can be determined.
|
|
24293
24279
|
*/
|
|
24294
|
-
|
|
24280
|
+
registry.checkRenderer = function (name, noFallback) {
|
|
24295
24281
|
if (name === null) {
|
|
24296
24282
|
return name;
|
|
24297
24283
|
}
|
|
@@ -24303,7 +24289,7 @@ util.checkRenderer = function (name, noFallback) {
|
|
|
24303
24289
|
if (!ren.fallback || noFallback) {
|
|
24304
24290
|
return false;
|
|
24305
24291
|
}
|
|
24306
|
-
var fallback =
|
|
24292
|
+
var fallback = registry.checkRenderer(ren.fallback(), true);
|
|
24307
24293
|
if (fallback !== false) {
|
|
24308
24294
|
console.warn(name + ' renderer is unavailable, using ' + fallback + ' renderer instead');
|
|
24309
24295
|
}
|
|
@@ -24330,12 +24316,12 @@ util.checkRenderer = function (name, noFallback) {
|
|
|
24330
24316
|
* @returns {string|null|false} The name of the renderer that should be used
|
|
24331
24317
|
* or false if no valid renderer can be determined.
|
|
24332
24318
|
*/
|
|
24333
|
-
|
|
24319
|
+
registry.rendererForFeatures = function (featureList) {
|
|
24334
24320
|
var preferredRenderers = ['webgl', 'canvas', 'svg', 'vtkjs', null];
|
|
24335
24321
|
var renderer, ridx, feature, fidx, capability, available;
|
|
24336
24322
|
for (ridx = 0; ridx < preferredRenderers.length; ridx += 1) {
|
|
24337
24323
|
renderer = preferredRenderers[ridx];
|
|
24338
|
-
if (
|
|
24324
|
+
if (registry.checkRenderer(renderer, true) === false) {
|
|
24339
24325
|
continue;
|
|
24340
24326
|
}
|
|
24341
24327
|
if (!featureList) {
|
|
@@ -24387,7 +24373,7 @@ util.rendererForFeatures = function (featureList) {
|
|
|
24387
24373
|
* @returns {object} if this feature replaces an existing one, this was the
|
|
24388
24374
|
* feature that was replaced. In this case, a warning is issued.
|
|
24389
24375
|
*/
|
|
24390
|
-
|
|
24376
|
+
registry.registerFeature = function (category, name, func, capabilities) {
|
|
24391
24377
|
if (!(category in features)) {
|
|
24392
24378
|
features[category] = {};
|
|
24393
24379
|
featureCapabilities[category] = {};
|
|
@@ -24413,7 +24399,7 @@ util.registerFeature = function (category, name, func, capabilities) {
|
|
|
24413
24399
|
* @returns {geo.feature|null} The new feature or null if no such name is
|
|
24414
24400
|
* registered.
|
|
24415
24401
|
*/
|
|
24416
|
-
|
|
24402
|
+
registry.createFeature = function (name, layer, renderer, arg) {
|
|
24417
24403
|
var category = renderer.api(),
|
|
24418
24404
|
options = {
|
|
24419
24405
|
layer: layer,
|
|
@@ -24421,7 +24407,7 @@ util.createFeature = function (name, layer, renderer, arg) {
|
|
|
24421
24407
|
};
|
|
24422
24408
|
if (category in features && name in features[category]) {
|
|
24423
24409
|
if (arg !== undefined) {
|
|
24424
|
-
|
|
24410
|
+
util.deepMerge(options, arg);
|
|
24425
24411
|
}
|
|
24426
24412
|
var feature = features[category][name](options);
|
|
24427
24413
|
if (layer.gcs === undefined) {
|
|
@@ -24448,7 +24434,7 @@ util.createFeature = function (name, layer, renderer, arg) {
|
|
|
24448
24434
|
* @returns {object} if this layer adjustment replaces an existing one, this
|
|
24449
24435
|
* was the value that was replaced. In this case, a warning is issued.
|
|
24450
24436
|
*/
|
|
24451
|
-
|
|
24437
|
+
registry.registerLayerAdjustment = function (category, name, func) {
|
|
24452
24438
|
if (!(category in rendererLayerAdjustments)) {
|
|
24453
24439
|
rendererLayerAdjustments[category] = {};
|
|
24454
24440
|
}
|
|
@@ -24468,7 +24454,7 @@ util.registerLayerAdjustment = function (category, name, func) {
|
|
|
24468
24454
|
* @param {string} name Name of the layer or adjustment.
|
|
24469
24455
|
* @param {object} layer Instantiated layer object.
|
|
24470
24456
|
*/
|
|
24471
|
-
|
|
24457
|
+
registry.adjustLayerForRenderer = function (name, layer) {
|
|
24472
24458
|
var rendererName = layer.rendererName();
|
|
24473
24459
|
if (rendererName) {
|
|
24474
24460
|
if (rendererLayerAdjustments && rendererLayerAdjustments[rendererName] && rendererLayerAdjustments[rendererName][name]) {
|
|
@@ -24487,7 +24473,7 @@ util.adjustLayerForRenderer = function (name, layer) {
|
|
|
24487
24473
|
* @param {string[]} [defaultFeatures] An optional list of feature capabilities
|
|
24488
24474
|
* that are required to use this layer.
|
|
24489
24475
|
*/
|
|
24490
|
-
|
|
24476
|
+
registry.registerLayer = function (name, func, defaultFeatures) {
|
|
24491
24477
|
layers[name] = func;
|
|
24492
24478
|
layerDefaultFeatures[name] = defaultFeatures;
|
|
24493
24479
|
};
|
|
@@ -24502,7 +24488,7 @@ util.registerLayer = function (name, func, defaultFeatures) {
|
|
|
24502
24488
|
* @returns {geo.layer|null} The new layer or null if no such name is
|
|
24503
24489
|
* registered.
|
|
24504
24490
|
*/
|
|
24505
|
-
|
|
24491
|
+
registry.createLayer = function (name, map, arg) {
|
|
24506
24492
|
// Default renderer is webgl
|
|
24507
24493
|
var options = {
|
|
24508
24494
|
map: map
|
|
@@ -24515,7 +24501,7 @@ util.createLayer = function (name, map, arg) {
|
|
|
24515
24501
|
if (arg !== undefined) {
|
|
24516
24502
|
var argdata = arg.data;
|
|
24517
24503
|
delete arg.data;
|
|
24518
|
-
|
|
24504
|
+
util.deepMerge(options, arg);
|
|
24519
24505
|
if (argdata) {
|
|
24520
24506
|
options.data = argdata;
|
|
24521
24507
|
}
|
|
@@ -24540,7 +24526,7 @@ util.createLayer = function (name, map, arg) {
|
|
|
24540
24526
|
* @returns {object} If this widget replaces an existing one, this was the
|
|
24541
24527
|
* value that was replaced. In this case, a warning is issued.
|
|
24542
24528
|
*/
|
|
24543
|
-
|
|
24529
|
+
registry.registerWidget = function (category, name, func) {
|
|
24544
24530
|
if (!(category in widgets)) {
|
|
24545
24531
|
widgets[category] = {};
|
|
24546
24532
|
}
|
|
@@ -24561,13 +24547,13 @@ util.registerWidget = function (category, name, func) {
|
|
|
24561
24547
|
* @param {object} arg Options for the new widget.
|
|
24562
24548
|
* @returns {geo.widget} The new widget.
|
|
24563
24549
|
*/
|
|
24564
|
-
|
|
24550
|
+
registry.createWidget = function (name, layer, arg) {
|
|
24565
24551
|
var options = {
|
|
24566
24552
|
layer: layer
|
|
24567
24553
|
};
|
|
24568
24554
|
if (name in widgets.dom) {
|
|
24569
24555
|
if (arg !== undefined) {
|
|
24570
|
-
|
|
24556
|
+
util.deepMerge(options, arg);
|
|
24571
24557
|
}
|
|
24572
24558
|
return widgets.dom[name](options);
|
|
24573
24559
|
}
|
|
@@ -24588,7 +24574,7 @@ util.createWidget = function (name, layer, arg) {
|
|
|
24588
24574
|
* @returns {object} if this annotation replaces an existing one, this was the
|
|
24589
24575
|
* value that was replaced. In this case, a warning is issued.
|
|
24590
24576
|
*/
|
|
24591
|
-
|
|
24577
|
+
registry.registerAnnotation = function (name, func, features) {
|
|
24592
24578
|
var old = annotations[name];
|
|
24593
24579
|
if (old) {
|
|
24594
24580
|
console.warn('The ' + name + ' annotation is already registered');
|
|
@@ -24609,7 +24595,7 @@ util.registerAnnotation = function (name, func, features) {
|
|
|
24609
24595
|
* @param {object} options The options for the annotation.
|
|
24610
24596
|
* @returns {object} the new annotation.
|
|
24611
24597
|
*/
|
|
24612
|
-
|
|
24598
|
+
registry.createAnnotation = function (name, options) {
|
|
24613
24599
|
if (!annotations[name]) {
|
|
24614
24600
|
console.warn('The ' + name + ' annotation is not registered');
|
|
24615
24601
|
return;
|
|
@@ -24624,7 +24610,7 @@ util.createAnnotation = function (name, options) {
|
|
|
24624
24610
|
* @alias geo.listAnnotations
|
|
24625
24611
|
* @returns {string[]} A list of registered annotations.
|
|
24626
24612
|
*/
|
|
24627
|
-
|
|
24613
|
+
registry.listAnnotations = function () {
|
|
24628
24614
|
return Object.keys(annotations);
|
|
24629
24615
|
};
|
|
24630
24616
|
|
|
@@ -24642,7 +24628,7 @@ util.listAnnotations = function () {
|
|
|
24642
24628
|
* @returns {string[]} a list of features needed for the specified annotations.
|
|
24643
24629
|
* There may be duplicates in the list.
|
|
24644
24630
|
*/
|
|
24645
|
-
|
|
24631
|
+
registry.featuresForAnnotations = function (annotationList) {
|
|
24646
24632
|
var features = [];
|
|
24647
24633
|
var annList = Array.isArray(annotationList) ? annotationList : Object.keys(annotationList);
|
|
24648
24634
|
annList.forEach(function (ann) {
|
|
@@ -24678,8 +24664,8 @@ util.featuresForAnnotations = function (annotationList) {
|
|
|
24678
24664
|
* @returns {string|null|false} the name of the renderer that should be used or
|
|
24679
24665
|
* false if no valid renderer can be determined.
|
|
24680
24666
|
*/
|
|
24681
|
-
|
|
24682
|
-
return
|
|
24667
|
+
registry.rendererForAnnotations = function (annotationList) {
|
|
24668
|
+
return registry.rendererForFeatures(registry.featuresForAnnotations(annotationList));
|
|
24683
24669
|
};
|
|
24684
24670
|
|
|
24685
24671
|
/**
|
|
@@ -24688,7 +24674,7 @@ util.rendererForAnnotations = function (annotationList) {
|
|
|
24688
24674
|
*
|
|
24689
24675
|
* @namespace geo.registries
|
|
24690
24676
|
*/
|
|
24691
|
-
|
|
24677
|
+
registry.registries = {
|
|
24692
24678
|
annotations: annotations,
|
|
24693
24679
|
features: features,
|
|
24694
24680
|
featureCapabilities: featureCapabilities,
|
|
@@ -24697,7 +24683,7 @@ util.registries = {
|
|
|
24697
24683
|
renderers: renderers,
|
|
24698
24684
|
widgets: widgets
|
|
24699
24685
|
};
|
|
24700
|
-
module.exports =
|
|
24686
|
+
module.exports = registry;
|
|
24701
24687
|
|
|
24702
24688
|
/***/ }),
|
|
24703
24689
|
|
|
@@ -25073,7 +25059,7 @@ module.exports = _sceneObject;
|
|
|
25073
25059
|
* @constant
|
|
25074
25060
|
* @type {string}
|
|
25075
25061
|
*/
|
|
25076
|
-
module.exports = "
|
|
25062
|
+
module.exports = "689846cc4aaa81643bd60b9d9afd9c8dd08bd8ff";
|
|
25077
25063
|
|
|
25078
25064
|
/***/ }),
|
|
25079
25065
|
|
|
@@ -25387,7 +25373,6 @@ var _svg_pathFeature = function svg_pathFeature(arg) {
|
|
|
25387
25373
|
if (!(this instanceof _svg_pathFeature)) {
|
|
25388
25374
|
return new _svg_pathFeature(arg);
|
|
25389
25375
|
}
|
|
25390
|
-
var $ = __webpack_require__(5616);
|
|
25391
25376
|
var object = __webpack_require__(5005);
|
|
25392
25377
|
var timestamp = __webpack_require__(77);
|
|
25393
25378
|
arg = arg || {};
|
|
@@ -25435,7 +25420,7 @@ var _svg_pathFeature = function svg_pathFeature(arg) {
|
|
|
25435
25420
|
m_style.id = m_this._svgid();
|
|
25436
25421
|
m_style.append = 'path';
|
|
25437
25422
|
m_style.classes = ['svgPathFeature'];
|
|
25438
|
-
m_style.style =
|
|
25423
|
+
m_style.style = Object.assign({
|
|
25439
25424
|
fill: function fill() {
|
|
25440
25425
|
return false;
|
|
25441
25426
|
},
|
|
@@ -27077,7 +27062,6 @@ var _textFeature = function textFeature(arg) {
|
|
|
27077
27062
|
}
|
|
27078
27063
|
arg = arg || {};
|
|
27079
27064
|
feature.call(this, arg);
|
|
27080
|
-
var $ = __webpack_require__(5616);
|
|
27081
27065
|
|
|
27082
27066
|
/**
|
|
27083
27067
|
* @private
|
|
@@ -27130,7 +27114,7 @@ var _textFeature = function textFeature(arg) {
|
|
|
27130
27114
|
this._init = function (arg) {
|
|
27131
27115
|
arg = arg || {};
|
|
27132
27116
|
s_init.call(m_this, arg);
|
|
27133
|
-
var style =
|
|
27117
|
+
var style = Object.assign({}, {
|
|
27134
27118
|
font: 'bold 16px sans-serif',
|
|
27135
27119
|
textAlign: 'center',
|
|
27136
27120
|
textBaseline: 'middle',
|
|
@@ -27616,6 +27600,7 @@ module.exports = _tileCache;
|
|
|
27616
27600
|
|
|
27617
27601
|
var inherit = __webpack_require__(4626);
|
|
27618
27602
|
var featureLayer = __webpack_require__(6498);
|
|
27603
|
+
var util = __webpack_require__(642);
|
|
27619
27604
|
|
|
27620
27605
|
/**
|
|
27621
27606
|
* Object specification for a tile layer.
|
|
@@ -27800,7 +27785,7 @@ var _tileLayer = function tileLayer(arg) {
|
|
|
27800
27785
|
var fetchQueue = __webpack_require__(5938);
|
|
27801
27786
|
var adjustLayerForRenderer = (__webpack_require__(1098).adjustLayerForRenderer);
|
|
27802
27787
|
var Tile = __webpack_require__(5289);
|
|
27803
|
-
arg =
|
|
27788
|
+
arg = util.deepMerge({}, this.constructor.defaults, arg || {});
|
|
27804
27789
|
if (!arg.cacheSize) {
|
|
27805
27790
|
// this size should be sufficient for a 4k display
|
|
27806
27791
|
// where display size is (w, h), minimum tile dimension is ts, and total
|
|
@@ -27841,7 +27826,7 @@ var _tileLayer = function tileLayer(arg) {
|
|
|
27841
27826
|
m_this = this;
|
|
27842
27827
|
|
|
27843
27828
|
// copy the options into a private variable
|
|
27844
|
-
this._options =
|
|
27829
|
+
this._options = util.deepMerge({}, arg);
|
|
27845
27830
|
|
|
27846
27831
|
// set the layer attribution text
|
|
27847
27832
|
this.attribution(arg.attribution);
|
|
@@ -27891,7 +27876,7 @@ var _tileLayer = function tileLayer(arg) {
|
|
|
27891
27876
|
*/
|
|
27892
27877
|
Object.defineProperty(this, 'options', {
|
|
27893
27878
|
get: function get() {
|
|
27894
|
-
return
|
|
27879
|
+
return Object.assign({}, m_this._options);
|
|
27895
27880
|
}
|
|
27896
27881
|
});
|
|
27897
27882
|
|
|
@@ -27916,7 +27901,7 @@ var _tileLayer = function tileLayer(arg) {
|
|
|
27916
27901
|
*/
|
|
27917
27902
|
Object.defineProperty(this, 'activeTiles', {
|
|
27918
27903
|
get: function get() {
|
|
27919
|
-
return
|
|
27904
|
+
return Object.assign({}, m_this._activeTiles); // copy on output
|
|
27920
27905
|
}
|
|
27921
27906
|
});
|
|
27922
27907
|
|
|
@@ -29589,7 +29574,6 @@ var _trackFeature = function trackFeature(arg) {
|
|
|
29589
29574
|
if (!(this instanceof _trackFeature)) {
|
|
29590
29575
|
return new _trackFeature(arg);
|
|
29591
29576
|
}
|
|
29592
|
-
var $ = __webpack_require__(5616);
|
|
29593
29577
|
var transform = __webpack_require__(5325);
|
|
29594
29578
|
arg = arg || {};
|
|
29595
29579
|
feature.call(this, arg);
|
|
@@ -30022,7 +30006,7 @@ var _trackFeature = function trackFeature(arg) {
|
|
|
30022
30006
|
m_styles[styleType] = {};
|
|
30023
30007
|
}
|
|
30024
30008
|
if (arg2 === undefined) {
|
|
30025
|
-
m_styles[styleType] =
|
|
30009
|
+
m_styles[styleType] = util.deepMerge(m_styles[styleType], arg1);
|
|
30026
30010
|
} else {
|
|
30027
30011
|
m_styles[styleType][arg1] = arg2;
|
|
30028
30012
|
}
|
|
@@ -30369,7 +30353,7 @@ var _trackFeature = function trackFeature(arg) {
|
|
|
30369
30353
|
this._init = function (arg) {
|
|
30370
30354
|
arg = arg || {};
|
|
30371
30355
|
s_init.call(m_this, arg);
|
|
30372
|
-
var style =
|
|
30356
|
+
var style = util.deepMerge({}, {
|
|
30373
30357
|
track: util.identityFunction,
|
|
30374
30358
|
position: util.identityFunction,
|
|
30375
30359
|
time: function time(d, i) {
|
|
@@ -30378,25 +30362,25 @@ var _trackFeature = function trackFeature(arg) {
|
|
|
30378
30362
|
uniformLine: 'drop',
|
|
30379
30363
|
closed: false
|
|
30380
30364
|
}, arg.style === undefined ? {} : arg.style);
|
|
30381
|
-
var markerStyle =
|
|
30365
|
+
var markerStyle = util.deepMerge({}, {
|
|
30382
30366
|
rotateWithMap: true,
|
|
30383
30367
|
rotation: function rotation(d, i) {
|
|
30384
30368
|
return -m_tracks.endPosition[i].angle || 0;
|
|
30385
30369
|
}
|
|
30386
30370
|
}, arg.markerStyle === undefined ? {} : arg.markerStyle);
|
|
30387
|
-
var textStyle =
|
|
30371
|
+
var textStyle = util.deepMerge({}, {
|
|
30388
30372
|
rotateWithMap: true,
|
|
30389
30373
|
rotation: function rotation(d, i) {
|
|
30390
30374
|
return m_tracks.endPosition[i].angle !== undefined ? -m_tracks.endPosition[i].angle + Math.PI / 2 : 0;
|
|
30391
30375
|
}
|
|
30392
30376
|
}, arg.textStyle === undefined ? {} : arg.textStyle);
|
|
30393
|
-
var pastStyle =
|
|
30377
|
+
var pastStyle = util.deepMerge({}, {
|
|
30394
30378
|
strokeOpacity: 0.25
|
|
30395
30379
|
}, arg.pastStyle === undefined ? {} : arg.pastStyle);
|
|
30396
|
-
var currentStyle =
|
|
30380
|
+
var currentStyle = util.deepMerge({}, {
|
|
30397
30381
|
// defaults go here
|
|
30398
30382
|
}, arg.currentStyle === undefined ? {} : arg.currentStyle);
|
|
30399
|
-
var futureStyle =
|
|
30383
|
+
var futureStyle = util.deepMerge({}, {
|
|
30400
30384
|
strokeOpacity: 0.25
|
|
30401
30385
|
}, arg.futureStyle === undefined ? {} : arg.futureStyle);
|
|
30402
30386
|
['track', 'position', 'time'].forEach(function (key) {
|
|
@@ -32320,7 +32304,7 @@ var _scaleWidget = function scaleWidget(arg) {
|
|
|
32320
32304
|
var d3 = (__webpack_require__(2493).d3);
|
|
32321
32305
|
var m_this = this,
|
|
32322
32306
|
s_exit = this._exit,
|
|
32323
|
-
m_options =
|
|
32307
|
+
m_options = Object.assign({}, {
|
|
32324
32308
|
scale: 1,
|
|
32325
32309
|
maxWidth: 200,
|
|
32326
32310
|
maxHeight: arg.orientation === 'left' || arg.orientation === 'right' ? 200 : 20,
|
|
@@ -32530,7 +32514,7 @@ var _scaleWidget = function scaleWidget(arg) {
|
|
|
32530
32514
|
*/
|
|
32531
32515
|
this.options = function (arg1, arg2) {
|
|
32532
32516
|
if (arg1 === undefined) {
|
|
32533
|
-
var result =
|
|
32517
|
+
var result = Object.assign({}, m_options);
|
|
32534
32518
|
result.position = m_this.position(undefined, true);
|
|
32535
32519
|
return result;
|
|
32536
32520
|
}
|
|
@@ -32538,7 +32522,7 @@ var _scaleWidget = function scaleWidget(arg) {
|
|
|
32538
32522
|
return arg1 === 'position' ? m_this.position(undefined, true) : m_options[arg1];
|
|
32539
32523
|
}
|
|
32540
32524
|
if (arg2 === undefined) {
|
|
32541
|
-
m_options =
|
|
32525
|
+
m_options = util.deepMerge(m_options, arg1);
|
|
32542
32526
|
} else {
|
|
32543
32527
|
m_options[arg1] = arg2;
|
|
32544
32528
|
}
|
|
@@ -33189,7 +33173,6 @@ module.exports = _uiLayer;
|
|
|
33189
33173
|
|
|
33190
33174
|
var inherit = __webpack_require__(4626);
|
|
33191
33175
|
var sceneObject = __webpack_require__(5402);
|
|
33192
|
-
var $ = __webpack_require__(5616);
|
|
33193
33176
|
|
|
33194
33177
|
/**
|
|
33195
33178
|
* @typedef {object} geo.gui.widget.position
|
|
@@ -33353,7 +33336,7 @@ var _widget = function widget(arg) {
|
|
|
33353
33336
|
if (m_position.hasOwnProperty('x') && m_position.hasOwnProperty('y')) {
|
|
33354
33337
|
m_this.layer().geoOn(geo_event.pan, m_this.repositionEvent);
|
|
33355
33338
|
}
|
|
33356
|
-
m_this.reposition(
|
|
33339
|
+
m_this.reposition(Object.assign(clearPosition, m_this.position()));
|
|
33357
33340
|
return m_this;
|
|
33358
33341
|
}
|
|
33359
33342
|
if (m_position.hasOwnProperty('x') && m_position.hasOwnProperty('y') && !actualValue) {
|
|
@@ -33576,7 +33559,7 @@ function C(opts) {
|
|
|
33576
33559
|
var DistanceGrid = __webpack_require__(7235);
|
|
33577
33560
|
|
|
33578
33561
|
// store the options
|
|
33579
|
-
this._opts =
|
|
33562
|
+
this._opts = Object.assign({
|
|
33580
33563
|
maxZoom: 18,
|
|
33581
33564
|
radius: 5
|
|
33582
33565
|
}, opts);
|
|
@@ -34506,7 +34489,7 @@ var util = {
|
|
|
34506
34489
|
* @example <caption>The returned objects can be modified or
|
|
34507
34490
|
* extended.</caption>
|
|
34508
34491
|
* var results = pixelCoordinateParams('#map', 10000, 9000);
|
|
34509
|
-
* var map = geo.map(
|
|
34492
|
+
* var map = geo.map(Object.assign(results.map, {clampZoom: false}));
|
|
34510
34493
|
* map.createLayer('osm', results.layer);
|
|
34511
34494
|
*
|
|
34512
34495
|
* @param {string?} node DOM selector for the map container.
|
|
@@ -34977,6 +34960,46 @@ var util = {
|
|
|
34977
34960
|
return '&#' + code.toString(10) + ';';
|
|
34978
34961
|
});
|
|
34979
34962
|
},
|
|
34963
|
+
/**
|
|
34964
|
+
* Recursively merge two objects. This is intended to replace
|
|
34965
|
+
* util.deepMerge(target, ...sources).
|
|
34966
|
+
*
|
|
34967
|
+
* @param {object} target target object to modify.
|
|
34968
|
+
* @param {object} sources object(s) to merge into the target.
|
|
34969
|
+
* @returns {object} The merged object.
|
|
34970
|
+
* @member geo.util
|
|
34971
|
+
*/
|
|
34972
|
+
deepMerge: function deepMerge(target) {
|
|
34973
|
+
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
34974
|
+
sources[_key - 1] = arguments[_key];
|
|
34975
|
+
}
|
|
34976
|
+
for (var _i = 0, _sources = sources; _i < _sources.length; _i++) {
|
|
34977
|
+
var source = _sources[_i];
|
|
34978
|
+
if (source === null || source === undefined) {
|
|
34979
|
+
continue;
|
|
34980
|
+
}
|
|
34981
|
+
for (var key in source) {
|
|
34982
|
+
if (key === '__proto__' || target === source[key]) {
|
|
34983
|
+
continue;
|
|
34984
|
+
}
|
|
34985
|
+
var copy = source[key];
|
|
34986
|
+
if (copy && _typeof(copy) === 'object' && copy && (copy.constructor === undefined || copy.constructor === Object || Array.isArray(copy))) {
|
|
34987
|
+
var src = target[key];
|
|
34988
|
+
if (!Array.isArray(copy)) {
|
|
34989
|
+
if (_typeof(src) !== 'object' || Array.isArray(src)) {
|
|
34990
|
+
src = {};
|
|
34991
|
+
}
|
|
34992
|
+
} else if (!Array.isArray(src)) {
|
|
34993
|
+
src = [];
|
|
34994
|
+
}
|
|
34995
|
+
target[key] = util.deepMerge(src, copy);
|
|
34996
|
+
} else if (copy !== undefined) {
|
|
34997
|
+
target[key] = copy;
|
|
34998
|
+
}
|
|
34999
|
+
}
|
|
35000
|
+
}
|
|
35001
|
+
return target;
|
|
35002
|
+
},
|
|
34980
35003
|
/**
|
|
34981
35004
|
* Check svg image and html img tags. If the source is set, load images
|
|
34982
35005
|
* explicitly and convert them to local data:image references.
|
|
@@ -35691,7 +35714,6 @@ __webpack_require__(5637), __webpack_require__(208), __webpack_require__(269), /
|
|
|
35691
35714
|
* information.
|
|
35692
35715
|
*/
|
|
35693
35716
|
function createColoredMesh(feature, elementValues) {
|
|
35694
|
-
var $ = __webpack_require__(5616);
|
|
35695
35717
|
var util = __webpack_require__(642);
|
|
35696
35718
|
var mesh = feature.mesh,
|
|
35697
35719
|
valueFunc = feature.style.get('value'),
|
|
@@ -35719,14 +35741,14 @@ function createColoredMesh(feature, elementValues) {
|
|
|
35719
35741
|
result.stepped = stepped === undefined || stepped ? true : false;
|
|
35720
35742
|
/* Create the min/max colors and the color array */
|
|
35721
35743
|
result.colorMap = [];
|
|
35722
|
-
result.minColor =
|
|
35744
|
+
result.minColor = Object.assign({
|
|
35723
35745
|
a: mesh.get('minOpacity')(result) || 0
|
|
35724
35746
|
}, util.convertColor(mesh.get('minColor')(result)));
|
|
35725
|
-
result.maxColor =
|
|
35747
|
+
result.maxColor = Object.assign({
|
|
35726
35748
|
a: mesh.get('maxOpacity')(result) || 0
|
|
35727
35749
|
}, util.convertColor(mesh.get('maxColor')(result)));
|
|
35728
35750
|
mesh.get('colorRange')(result).forEach(function (clr, idx) {
|
|
35729
|
-
result.colorMap.push(
|
|
35751
|
+
result.colorMap.push(Object.assign({
|
|
35730
35752
|
a: opacityRange && opacityRange[idx] !== undefined ? opacityRange[idx] : 1
|
|
35731
35753
|
}, util.convertColor(clr)));
|
|
35732
35754
|
});
|
|
@@ -35785,7 +35807,6 @@ module.exports = {
|
|
|
35785
35807
|
|
|
35786
35808
|
/* eslint-disable camelcase */
|
|
35787
35809
|
|
|
35788
|
-
var $ = __webpack_require__(5616);
|
|
35789
35810
|
var webglRenderer = __webpack_require__(7945);
|
|
35790
35811
|
var _renderWindow, _supported;
|
|
35791
35812
|
module.exports = {};
|
|
@@ -35934,7 +35955,7 @@ module.exports.mockWebglRenderer = function mockWebglRenderer(supported) {
|
|
|
35934
35955
|
renderers = m_this.renderers(),
|
|
35935
35956
|
wsize = m_this.windowSize(),
|
|
35936
35957
|
wpos = m_this.windowPosition();
|
|
35937
|
-
m_context =
|
|
35958
|
+
m_context = Object.assign({}, vgl.GL, default_context);
|
|
35938
35959
|
for (i = 0; i < renderers.length; i += 1) {
|
|
35939
35960
|
if (renderers[i].width() > wsize[0] || renderers[i].width() === 0 || renderers[i].height() > wsize[1] || renderers[i].height() === 0) {
|
|
35940
35961
|
renderers[i].resize(wpos[0], wpos[1], wsize[0], wsize[1]);
|
|
@@ -36816,7 +36837,6 @@ var _vectorFeature = function vectorFeature(arg) {
|
|
|
36816
36837
|
if (!(this instanceof _vectorFeature)) {
|
|
36817
36838
|
return new _vectorFeature(arg);
|
|
36818
36839
|
}
|
|
36819
|
-
var $ = __webpack_require__(5616);
|
|
36820
36840
|
arg = arg || {};
|
|
36821
36841
|
feature.call(this, arg);
|
|
36822
36842
|
|
|
@@ -36873,7 +36893,7 @@ var _vectorFeature = function vectorFeature(arg) {
|
|
|
36873
36893
|
*/
|
|
36874
36894
|
this._init = function (arg) {
|
|
36875
36895
|
s_init.call(m_this, arg);
|
|
36876
|
-
var defaultStyle =
|
|
36896
|
+
var defaultStyle = Object.assign({}, {
|
|
36877
36897
|
strokeColor: 'black',
|
|
36878
36898
|
strokeWidth: 2.0,
|
|
36879
36899
|
strokeOpacity: 1.0,
|
|
@@ -36912,7 +36932,7 @@ module.exports = _vectorFeature;
|
|
|
36912
36932
|
* @constant
|
|
36913
36933
|
* @type {string}
|
|
36914
36934
|
*/
|
|
36915
|
-
module.exports = "1.12.
|
|
36935
|
+
module.exports = "1.12.6";
|
|
36916
36936
|
|
|
36917
36937
|
/***/ }),
|
|
36918
36938
|
|
|
@@ -44665,7 +44685,7 @@ var _webgl_polygonFeature = function webgl_polygonFeature(arg) {
|
|
|
44665
44685
|
arg = arg || {};
|
|
44666
44686
|
polygonFeature.call(this, arg);
|
|
44667
44687
|
var vgl = __webpack_require__(1611);
|
|
44668
|
-
var earcut = __webpack_require__(
|
|
44688
|
+
var earcut = __webpack_require__(9747);
|
|
44669
44689
|
earcut = earcut.__esModule ? earcut.default : earcut;
|
|
44670
44690
|
var transform = __webpack_require__(5325);
|
|
44671
44691
|
var util = __webpack_require__(642);
|
|
@@ -73403,6 +73423,630 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__7606__;
|
|
|
73403
73423
|
|
|
73404
73424
|
/***/ }),
|
|
73405
73425
|
|
|
73426
|
+
/***/ 9747:
|
|
73427
|
+
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
73428
|
+
|
|
73429
|
+
"use strict";
|
|
73430
|
+
__webpack_require__.r(__webpack_exports__);
|
|
73431
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
73432
|
+
/* harmony export */ "default": function() { return /* binding */ earcut; },
|
|
73433
|
+
/* harmony export */ deviation: function() { return /* binding */ deviation; },
|
|
73434
|
+
/* harmony export */ flatten: function() { return /* binding */ flatten; }
|
|
73435
|
+
/* harmony export */ });
|
|
73436
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
73437
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
73438
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
73439
|
+
function earcut(data, holeIndices) {
|
|
73440
|
+
var dim = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
|
|
73441
|
+
var hasHoles = holeIndices && holeIndices.length;
|
|
73442
|
+
var outerLen = hasHoles ? holeIndices[0] * dim : data.length;
|
|
73443
|
+
var outerNode = linkedList(data, 0, outerLen, dim, true);
|
|
73444
|
+
var triangles = [];
|
|
73445
|
+
if (!outerNode || outerNode.next === outerNode.prev) return triangles;
|
|
73446
|
+
var minX, minY, invSize;
|
|
73447
|
+
if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
|
|
73448
|
+
|
|
73449
|
+
// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
|
|
73450
|
+
if (data.length > 80 * dim) {
|
|
73451
|
+
minX = Infinity;
|
|
73452
|
+
minY = Infinity;
|
|
73453
|
+
var maxX = -Infinity;
|
|
73454
|
+
var maxY = -Infinity;
|
|
73455
|
+
for (var i = dim; i < outerLen; i += dim) {
|
|
73456
|
+
var x = data[i];
|
|
73457
|
+
var y = data[i + 1];
|
|
73458
|
+
if (x < minX) minX = x;
|
|
73459
|
+
if (y < minY) minY = y;
|
|
73460
|
+
if (x > maxX) maxX = x;
|
|
73461
|
+
if (y > maxY) maxY = y;
|
|
73462
|
+
}
|
|
73463
|
+
|
|
73464
|
+
// minX, minY and invSize are later used to transform coords into integers for z-order calculation
|
|
73465
|
+
invSize = Math.max(maxX - minX, maxY - minY);
|
|
73466
|
+
invSize = invSize !== 0 ? 32767 / invSize : 0;
|
|
73467
|
+
}
|
|
73468
|
+
earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
|
|
73469
|
+
return triangles;
|
|
73470
|
+
}
|
|
73471
|
+
|
|
73472
|
+
// create a circular doubly linked list from polygon points in the specified winding order
|
|
73473
|
+
function linkedList(data, start, end, dim, clockwise) {
|
|
73474
|
+
var last;
|
|
73475
|
+
if (clockwise === signedArea(data, start, end, dim) > 0) {
|
|
73476
|
+
for (var i = start; i < end; i += dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
|
|
73477
|
+
} else {
|
|
73478
|
+
for (var _i = end - dim; _i >= start; _i -= dim) last = insertNode(_i / dim | 0, data[_i], data[_i + 1], last);
|
|
73479
|
+
}
|
|
73480
|
+
if (last && equals(last, last.next)) {
|
|
73481
|
+
removeNode(last);
|
|
73482
|
+
last = last.next;
|
|
73483
|
+
}
|
|
73484
|
+
return last;
|
|
73485
|
+
}
|
|
73486
|
+
|
|
73487
|
+
// eliminate colinear or duplicate points
|
|
73488
|
+
function filterPoints(start, end) {
|
|
73489
|
+
if (!start) return start;
|
|
73490
|
+
if (!end) end = start;
|
|
73491
|
+
var p = start,
|
|
73492
|
+
again;
|
|
73493
|
+
do {
|
|
73494
|
+
again = false;
|
|
73495
|
+
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
|
|
73496
|
+
removeNode(p);
|
|
73497
|
+
p = end = p.prev;
|
|
73498
|
+
if (p === p.next) break;
|
|
73499
|
+
again = true;
|
|
73500
|
+
} else {
|
|
73501
|
+
p = p.next;
|
|
73502
|
+
}
|
|
73503
|
+
} while (again || p !== end);
|
|
73504
|
+
return end;
|
|
73505
|
+
}
|
|
73506
|
+
|
|
73507
|
+
// main ear slicing loop which triangulates a polygon (given as a linked list)
|
|
73508
|
+
function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
|
|
73509
|
+
if (!ear) return;
|
|
73510
|
+
|
|
73511
|
+
// interlink polygon nodes in z-order
|
|
73512
|
+
if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
|
|
73513
|
+
var stop = ear;
|
|
73514
|
+
|
|
73515
|
+
// iterate through ears, slicing them one by one
|
|
73516
|
+
while (ear.prev !== ear.next) {
|
|
73517
|
+
var prev = ear.prev;
|
|
73518
|
+
var next = ear.next;
|
|
73519
|
+
if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
|
|
73520
|
+
triangles.push(prev.i, ear.i, next.i); // cut off the triangle
|
|
73521
|
+
|
|
73522
|
+
removeNode(ear);
|
|
73523
|
+
|
|
73524
|
+
// skipping the next vertex leads to less sliver triangles
|
|
73525
|
+
ear = next.next;
|
|
73526
|
+
stop = next.next;
|
|
73527
|
+
continue;
|
|
73528
|
+
}
|
|
73529
|
+
ear = next;
|
|
73530
|
+
|
|
73531
|
+
// if we looped through the whole remaining polygon and can't find any more ears
|
|
73532
|
+
if (ear === stop) {
|
|
73533
|
+
// try filtering points and slicing again
|
|
73534
|
+
if (!pass) {
|
|
73535
|
+
earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
|
|
73536
|
+
|
|
73537
|
+
// if this didn't work, try curing all small self-intersections locally
|
|
73538
|
+
} else if (pass === 1) {
|
|
73539
|
+
ear = cureLocalIntersections(filterPoints(ear), triangles);
|
|
73540
|
+
earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
|
|
73541
|
+
|
|
73542
|
+
// as a last resort, try splitting the remaining polygon into two
|
|
73543
|
+
} else if (pass === 2) {
|
|
73544
|
+
splitEarcut(ear, triangles, dim, minX, minY, invSize);
|
|
73545
|
+
}
|
|
73546
|
+
break;
|
|
73547
|
+
}
|
|
73548
|
+
}
|
|
73549
|
+
}
|
|
73550
|
+
|
|
73551
|
+
// check whether a polygon node forms a valid ear with adjacent nodes
|
|
73552
|
+
function isEar(ear) {
|
|
73553
|
+
var a = ear.prev,
|
|
73554
|
+
b = ear,
|
|
73555
|
+
c = ear.next;
|
|
73556
|
+
if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
|
|
73557
|
+
|
|
73558
|
+
// now make sure we don't have other points inside the potential ear
|
|
73559
|
+
var ax = a.x,
|
|
73560
|
+
bx = b.x,
|
|
73561
|
+
cx = c.x,
|
|
73562
|
+
ay = a.y,
|
|
73563
|
+
by = b.y,
|
|
73564
|
+
cy = c.y;
|
|
73565
|
+
|
|
73566
|
+
// triangle bbox; min & max are calculated like this for speed
|
|
73567
|
+
var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,
|
|
73568
|
+
y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,
|
|
73569
|
+
x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,
|
|
73570
|
+
y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
|
|
73571
|
+
var p = c.next;
|
|
73572
|
+
while (p !== a) {
|
|
73573
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
73574
|
+
p = p.next;
|
|
73575
|
+
}
|
|
73576
|
+
return true;
|
|
73577
|
+
}
|
|
73578
|
+
function isEarHashed(ear, minX, minY, invSize) {
|
|
73579
|
+
var a = ear.prev,
|
|
73580
|
+
b = ear,
|
|
73581
|
+
c = ear.next;
|
|
73582
|
+
if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
|
|
73583
|
+
|
|
73584
|
+
var ax = a.x,
|
|
73585
|
+
bx = b.x,
|
|
73586
|
+
cx = c.x,
|
|
73587
|
+
ay = a.y,
|
|
73588
|
+
by = b.y,
|
|
73589
|
+
cy = c.y;
|
|
73590
|
+
|
|
73591
|
+
// triangle bbox; min & max are calculated like this for speed
|
|
73592
|
+
var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,
|
|
73593
|
+
y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,
|
|
73594
|
+
x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,
|
|
73595
|
+
y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
|
|
73596
|
+
|
|
73597
|
+
// z-order range for the current triangle bbox;
|
|
73598
|
+
var minZ = zOrder(x0, y0, minX, minY, invSize),
|
|
73599
|
+
maxZ = zOrder(x1, y1, minX, minY, invSize);
|
|
73600
|
+
var p = ear.prevZ,
|
|
73601
|
+
n = ear.nextZ;
|
|
73602
|
+
|
|
73603
|
+
// look for points inside the triangle in both directions
|
|
73604
|
+
while (p && p.z >= minZ && n && n.z <= maxZ) {
|
|
73605
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
73606
|
+
p = p.prevZ;
|
|
73607
|
+
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
|
|
73608
|
+
n = n.nextZ;
|
|
73609
|
+
}
|
|
73610
|
+
|
|
73611
|
+
// look for remaining points in decreasing z-order
|
|
73612
|
+
while (p && p.z >= minZ) {
|
|
73613
|
+
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
73614
|
+
p = p.prevZ;
|
|
73615
|
+
}
|
|
73616
|
+
|
|
73617
|
+
// look for remaining points in increasing z-order
|
|
73618
|
+
while (n && n.z <= maxZ) {
|
|
73619
|
+
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
|
|
73620
|
+
n = n.nextZ;
|
|
73621
|
+
}
|
|
73622
|
+
return true;
|
|
73623
|
+
}
|
|
73624
|
+
|
|
73625
|
+
// go through all polygon nodes and cure small local self-intersections
|
|
73626
|
+
function cureLocalIntersections(start, triangles) {
|
|
73627
|
+
var p = start;
|
|
73628
|
+
do {
|
|
73629
|
+
var a = p.prev,
|
|
73630
|
+
b = p.next.next;
|
|
73631
|
+
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
|
|
73632
|
+
triangles.push(a.i, p.i, b.i);
|
|
73633
|
+
|
|
73634
|
+
// remove two nodes involved
|
|
73635
|
+
removeNode(p);
|
|
73636
|
+
removeNode(p.next);
|
|
73637
|
+
p = start = b;
|
|
73638
|
+
}
|
|
73639
|
+
p = p.next;
|
|
73640
|
+
} while (p !== start);
|
|
73641
|
+
return filterPoints(p);
|
|
73642
|
+
}
|
|
73643
|
+
|
|
73644
|
+
// try splitting polygon into two and triangulate them independently
|
|
73645
|
+
function splitEarcut(start, triangles, dim, minX, minY, invSize) {
|
|
73646
|
+
// look for a valid diagonal that divides the polygon into two
|
|
73647
|
+
var a = start;
|
|
73648
|
+
do {
|
|
73649
|
+
var b = a.next.next;
|
|
73650
|
+
while (b !== a.prev) {
|
|
73651
|
+
if (a.i !== b.i && isValidDiagonal(a, b)) {
|
|
73652
|
+
// split the polygon in two by the diagonal
|
|
73653
|
+
var c = splitPolygon(a, b);
|
|
73654
|
+
|
|
73655
|
+
// filter colinear points around the cuts
|
|
73656
|
+
a = filterPoints(a, a.next);
|
|
73657
|
+
c = filterPoints(c, c.next);
|
|
73658
|
+
|
|
73659
|
+
// run earcut on each half
|
|
73660
|
+
earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
|
|
73661
|
+
earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
|
|
73662
|
+
return;
|
|
73663
|
+
}
|
|
73664
|
+
b = b.next;
|
|
73665
|
+
}
|
|
73666
|
+
a = a.next;
|
|
73667
|
+
} while (a !== start);
|
|
73668
|
+
}
|
|
73669
|
+
|
|
73670
|
+
// link every hole into the outer loop, producing a single-ring polygon without holes
|
|
73671
|
+
function eliminateHoles(data, holeIndices, outerNode, dim) {
|
|
73672
|
+
var queue = [];
|
|
73673
|
+
for (var i = 0, len = holeIndices.length; i < len; i++) {
|
|
73674
|
+
var start = holeIndices[i] * dim;
|
|
73675
|
+
var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
|
|
73676
|
+
var list = linkedList(data, start, end, dim, false);
|
|
73677
|
+
if (list === list.next) list.steiner = true;
|
|
73678
|
+
queue.push(getLeftmost(list));
|
|
73679
|
+
}
|
|
73680
|
+
queue.sort(compareX);
|
|
73681
|
+
|
|
73682
|
+
// process holes from left to right
|
|
73683
|
+
for (var _i2 = 0; _i2 < queue.length; _i2++) {
|
|
73684
|
+
outerNode = eliminateHole(queue[_i2], outerNode);
|
|
73685
|
+
}
|
|
73686
|
+
return outerNode;
|
|
73687
|
+
}
|
|
73688
|
+
function compareX(a, b) {
|
|
73689
|
+
return a.x - b.x;
|
|
73690
|
+
}
|
|
73691
|
+
|
|
73692
|
+
// find a bridge between vertices that connects hole with an outer ring and and link it
|
|
73693
|
+
function eliminateHole(hole, outerNode) {
|
|
73694
|
+
var bridge = findHoleBridge(hole, outerNode);
|
|
73695
|
+
if (!bridge) {
|
|
73696
|
+
return outerNode;
|
|
73697
|
+
}
|
|
73698
|
+
var bridgeReverse = splitPolygon(bridge, hole);
|
|
73699
|
+
|
|
73700
|
+
// filter collinear points around the cuts
|
|
73701
|
+
filterPoints(bridgeReverse, bridgeReverse.next);
|
|
73702
|
+
return filterPoints(bridge, bridge.next);
|
|
73703
|
+
}
|
|
73704
|
+
|
|
73705
|
+
// David Eberly's algorithm for finding a bridge between hole and outer polygon
|
|
73706
|
+
function findHoleBridge(hole, outerNode) {
|
|
73707
|
+
var p = outerNode;
|
|
73708
|
+
var hx = hole.x;
|
|
73709
|
+
var hy = hole.y;
|
|
73710
|
+
var qx = -Infinity;
|
|
73711
|
+
var m;
|
|
73712
|
+
|
|
73713
|
+
// find a segment intersected by a ray from the hole's leftmost point to the left;
|
|
73714
|
+
// segment's endpoint with lesser x will be potential connection point
|
|
73715
|
+
do {
|
|
73716
|
+
if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
|
|
73717
|
+
var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
|
|
73718
|
+
if (x <= hx && x > qx) {
|
|
73719
|
+
qx = x;
|
|
73720
|
+
m = p.x < p.next.x ? p : p.next;
|
|
73721
|
+
if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint
|
|
73722
|
+
}
|
|
73723
|
+
}
|
|
73724
|
+
p = p.next;
|
|
73725
|
+
} while (p !== outerNode);
|
|
73726
|
+
if (!m) return null;
|
|
73727
|
+
|
|
73728
|
+
// look for points inside the triangle of hole point, segment intersection and endpoint;
|
|
73729
|
+
// if there are no points found, we have a valid connection;
|
|
73730
|
+
// otherwise choose the point of the minimum angle with the ray as connection point
|
|
73731
|
+
|
|
73732
|
+
var stop = m;
|
|
73733
|
+
var mx = m.x;
|
|
73734
|
+
var my = m.y;
|
|
73735
|
+
var tanMin = Infinity;
|
|
73736
|
+
p = m;
|
|
73737
|
+
do {
|
|
73738
|
+
if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
|
|
73739
|
+
var tan = Math.abs(hy - p.y) / (hx - p.x); // tangential
|
|
73740
|
+
|
|
73741
|
+
if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
|
|
73742
|
+
m = p;
|
|
73743
|
+
tanMin = tan;
|
|
73744
|
+
}
|
|
73745
|
+
}
|
|
73746
|
+
p = p.next;
|
|
73747
|
+
} while (p !== stop);
|
|
73748
|
+
return m;
|
|
73749
|
+
}
|
|
73750
|
+
|
|
73751
|
+
// whether sector in vertex m contains sector in vertex p in the same coordinates
|
|
73752
|
+
function sectorContainsSector(m, p) {
|
|
73753
|
+
return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
|
|
73754
|
+
}
|
|
73755
|
+
|
|
73756
|
+
// interlink polygon nodes in z-order
|
|
73757
|
+
function indexCurve(start, minX, minY, invSize) {
|
|
73758
|
+
var p = start;
|
|
73759
|
+
do {
|
|
73760
|
+
if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
|
|
73761
|
+
p.prevZ = p.prev;
|
|
73762
|
+
p.nextZ = p.next;
|
|
73763
|
+
p = p.next;
|
|
73764
|
+
} while (p !== start);
|
|
73765
|
+
p.prevZ.nextZ = null;
|
|
73766
|
+
p.prevZ = null;
|
|
73767
|
+
sortLinked(p);
|
|
73768
|
+
}
|
|
73769
|
+
|
|
73770
|
+
// Simon Tatham's linked list merge sort algorithm
|
|
73771
|
+
// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
|
|
73772
|
+
function sortLinked(list) {
|
|
73773
|
+
var numMerges;
|
|
73774
|
+
var inSize = 1;
|
|
73775
|
+
do {
|
|
73776
|
+
var p = list;
|
|
73777
|
+
var e = void 0;
|
|
73778
|
+
list = null;
|
|
73779
|
+
var tail = null;
|
|
73780
|
+
numMerges = 0;
|
|
73781
|
+
while (p) {
|
|
73782
|
+
numMerges++;
|
|
73783
|
+
var q = p;
|
|
73784
|
+
var pSize = 0;
|
|
73785
|
+
for (var i = 0; i < inSize; i++) {
|
|
73786
|
+
pSize++;
|
|
73787
|
+
q = q.nextZ;
|
|
73788
|
+
if (!q) break;
|
|
73789
|
+
}
|
|
73790
|
+
var qSize = inSize;
|
|
73791
|
+
while (pSize > 0 || qSize > 0 && q) {
|
|
73792
|
+
if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
|
|
73793
|
+
e = p;
|
|
73794
|
+
p = p.nextZ;
|
|
73795
|
+
pSize--;
|
|
73796
|
+
} else {
|
|
73797
|
+
e = q;
|
|
73798
|
+
q = q.nextZ;
|
|
73799
|
+
qSize--;
|
|
73800
|
+
}
|
|
73801
|
+
if (tail) tail.nextZ = e;else list = e;
|
|
73802
|
+
e.prevZ = tail;
|
|
73803
|
+
tail = e;
|
|
73804
|
+
}
|
|
73805
|
+
p = q;
|
|
73806
|
+
}
|
|
73807
|
+
tail.nextZ = null;
|
|
73808
|
+
inSize *= 2;
|
|
73809
|
+
} while (numMerges > 1);
|
|
73810
|
+
return list;
|
|
73811
|
+
}
|
|
73812
|
+
|
|
73813
|
+
// z-order of a point given coords and inverse of the longer side of data bbox
|
|
73814
|
+
function zOrder(x, y, minX, minY, invSize) {
|
|
73815
|
+
// coords are transformed into non-negative 15-bit integer range
|
|
73816
|
+
x = (x - minX) * invSize | 0;
|
|
73817
|
+
y = (y - minY) * invSize | 0;
|
|
73818
|
+
x = (x | x << 8) & 0x00FF00FF;
|
|
73819
|
+
x = (x | x << 4) & 0x0F0F0F0F;
|
|
73820
|
+
x = (x | x << 2) & 0x33333333;
|
|
73821
|
+
x = (x | x << 1) & 0x55555555;
|
|
73822
|
+
y = (y | y << 8) & 0x00FF00FF;
|
|
73823
|
+
y = (y | y << 4) & 0x0F0F0F0F;
|
|
73824
|
+
y = (y | y << 2) & 0x33333333;
|
|
73825
|
+
y = (y | y << 1) & 0x55555555;
|
|
73826
|
+
return x | y << 1;
|
|
73827
|
+
}
|
|
73828
|
+
|
|
73829
|
+
// find the leftmost node of a polygon ring
|
|
73830
|
+
function getLeftmost(start) {
|
|
73831
|
+
var p = start,
|
|
73832
|
+
leftmost = start;
|
|
73833
|
+
do {
|
|
73834
|
+
if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;
|
|
73835
|
+
p = p.next;
|
|
73836
|
+
} while (p !== start);
|
|
73837
|
+
return leftmost;
|
|
73838
|
+
}
|
|
73839
|
+
|
|
73840
|
+
// check if a point lies within a convex triangle
|
|
73841
|
+
function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
|
|
73842
|
+
return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
|
|
73843
|
+
}
|
|
73844
|
+
|
|
73845
|
+
// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
|
|
73846
|
+
function isValidDiagonal(a, b) {
|
|
73847
|
+
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (
|
|
73848
|
+
// dones't intersect other edges
|
|
73849
|
+
locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (
|
|
73850
|
+
// locally visible
|
|
73851
|
+
area(a.prev, a, b.prev) || area(a, b.prev, b)) ||
|
|
73852
|
+
// does not create opposite-facing sectors
|
|
73853
|
+
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
|
|
73854
|
+
}
|
|
73855
|
+
|
|
73856
|
+
// signed area of a triangle
|
|
73857
|
+
function area(p, q, r) {
|
|
73858
|
+
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
|
|
73859
|
+
}
|
|
73860
|
+
|
|
73861
|
+
// check if two points are equal
|
|
73862
|
+
function equals(p1, p2) {
|
|
73863
|
+
return p1.x === p2.x && p1.y === p2.y;
|
|
73864
|
+
}
|
|
73865
|
+
|
|
73866
|
+
// check if two segments intersect
|
|
73867
|
+
function intersects(p1, q1, p2, q2) {
|
|
73868
|
+
var o1 = sign(area(p1, q1, p2));
|
|
73869
|
+
var o2 = sign(area(p1, q1, q2));
|
|
73870
|
+
var o3 = sign(area(p2, q2, p1));
|
|
73871
|
+
var o4 = sign(area(p2, q2, q1));
|
|
73872
|
+
if (o1 !== o2 && o3 !== o4) return true; // general case
|
|
73873
|
+
|
|
73874
|
+
if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1
|
|
73875
|
+
if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1
|
|
73876
|
+
if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2
|
|
73877
|
+
if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2
|
|
73878
|
+
|
|
73879
|
+
return false;
|
|
73880
|
+
}
|
|
73881
|
+
|
|
73882
|
+
// for collinear points p, q, r, check if point q lies on segment pr
|
|
73883
|
+
function onSegment(p, q, r) {
|
|
73884
|
+
return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
|
|
73885
|
+
}
|
|
73886
|
+
function sign(num) {
|
|
73887
|
+
return num > 0 ? 1 : num < 0 ? -1 : 0;
|
|
73888
|
+
}
|
|
73889
|
+
|
|
73890
|
+
// check if a polygon diagonal intersects any polygon segments
|
|
73891
|
+
function intersectsPolygon(a, b) {
|
|
73892
|
+
var p = a;
|
|
73893
|
+
do {
|
|
73894
|
+
if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true;
|
|
73895
|
+
p = p.next;
|
|
73896
|
+
} while (p !== a);
|
|
73897
|
+
return false;
|
|
73898
|
+
}
|
|
73899
|
+
|
|
73900
|
+
// check if a polygon diagonal is locally inside the polygon
|
|
73901
|
+
function locallyInside(a, b) {
|
|
73902
|
+
return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
|
|
73903
|
+
}
|
|
73904
|
+
|
|
73905
|
+
// check if the middle point of a polygon diagonal is inside the polygon
|
|
73906
|
+
function middleInside(a, b) {
|
|
73907
|
+
var p = a;
|
|
73908
|
+
var inside = false;
|
|
73909
|
+
var px = (a.x + b.x) / 2;
|
|
73910
|
+
var py = (a.y + b.y) / 2;
|
|
73911
|
+
do {
|
|
73912
|
+
if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x) inside = !inside;
|
|
73913
|
+
p = p.next;
|
|
73914
|
+
} while (p !== a);
|
|
73915
|
+
return inside;
|
|
73916
|
+
}
|
|
73917
|
+
|
|
73918
|
+
// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
|
|
73919
|
+
// if one belongs to the outer ring and another to a hole, it merges it into a single ring
|
|
73920
|
+
function splitPolygon(a, b) {
|
|
73921
|
+
var a2 = createNode(a.i, a.x, a.y),
|
|
73922
|
+
b2 = createNode(b.i, b.x, b.y),
|
|
73923
|
+
an = a.next,
|
|
73924
|
+
bp = b.prev;
|
|
73925
|
+
a.next = b;
|
|
73926
|
+
b.prev = a;
|
|
73927
|
+
a2.next = an;
|
|
73928
|
+
an.prev = a2;
|
|
73929
|
+
b2.next = a2;
|
|
73930
|
+
a2.prev = b2;
|
|
73931
|
+
bp.next = b2;
|
|
73932
|
+
b2.prev = bp;
|
|
73933
|
+
return b2;
|
|
73934
|
+
}
|
|
73935
|
+
|
|
73936
|
+
// create a node and optionally link it with previous one (in a circular doubly linked list)
|
|
73937
|
+
function insertNode(i, x, y, last) {
|
|
73938
|
+
var p = createNode(i, x, y);
|
|
73939
|
+
if (!last) {
|
|
73940
|
+
p.prev = p;
|
|
73941
|
+
p.next = p;
|
|
73942
|
+
} else {
|
|
73943
|
+
p.next = last.next;
|
|
73944
|
+
p.prev = last;
|
|
73945
|
+
last.next.prev = p;
|
|
73946
|
+
last.next = p;
|
|
73947
|
+
}
|
|
73948
|
+
return p;
|
|
73949
|
+
}
|
|
73950
|
+
function removeNode(p) {
|
|
73951
|
+
p.next.prev = p.prev;
|
|
73952
|
+
p.prev.next = p.next;
|
|
73953
|
+
if (p.prevZ) p.prevZ.nextZ = p.nextZ;
|
|
73954
|
+
if (p.nextZ) p.nextZ.prevZ = p.prevZ;
|
|
73955
|
+
}
|
|
73956
|
+
function createNode(i, x, y) {
|
|
73957
|
+
return {
|
|
73958
|
+
i: i,
|
|
73959
|
+
// vertex index in coordinates array
|
|
73960
|
+
x: x,
|
|
73961
|
+
y: y,
|
|
73962
|
+
// vertex coordinates
|
|
73963
|
+
prev: null,
|
|
73964
|
+
// previous and next vertex nodes in a polygon ring
|
|
73965
|
+
next: null,
|
|
73966
|
+
z: 0,
|
|
73967
|
+
// z-order curve value
|
|
73968
|
+
prevZ: null,
|
|
73969
|
+
// previous and next nodes in z-order
|
|
73970
|
+
nextZ: null,
|
|
73971
|
+
steiner: false // indicates whether this is a steiner point
|
|
73972
|
+
};
|
|
73973
|
+
}
|
|
73974
|
+
|
|
73975
|
+
// return a percentage difference between the polygon area and its triangulation area;
|
|
73976
|
+
// used to verify correctness of triangulation
|
|
73977
|
+
function deviation(data, holeIndices, dim, triangles) {
|
|
73978
|
+
var hasHoles = holeIndices && holeIndices.length;
|
|
73979
|
+
var outerLen = hasHoles ? holeIndices[0] * dim : data.length;
|
|
73980
|
+
var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
|
|
73981
|
+
if (hasHoles) {
|
|
73982
|
+
for (var i = 0, len = holeIndices.length; i < len; i++) {
|
|
73983
|
+
var start = holeIndices[i] * dim;
|
|
73984
|
+
var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
|
|
73985
|
+
polygonArea -= Math.abs(signedArea(data, start, end, dim));
|
|
73986
|
+
}
|
|
73987
|
+
}
|
|
73988
|
+
var trianglesArea = 0;
|
|
73989
|
+
for (var _i3 = 0; _i3 < triangles.length; _i3 += 3) {
|
|
73990
|
+
var a = triangles[_i3] * dim;
|
|
73991
|
+
var b = triangles[_i3 + 1] * dim;
|
|
73992
|
+
var c = triangles[_i3 + 2] * dim;
|
|
73993
|
+
trianglesArea += Math.abs((data[a] - data[c]) * (data[b + 1] - data[a + 1]) - (data[a] - data[b]) * (data[c + 1] - data[a + 1]));
|
|
73994
|
+
}
|
|
73995
|
+
return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea);
|
|
73996
|
+
}
|
|
73997
|
+
function signedArea(data, start, end, dim) {
|
|
73998
|
+
var sum = 0;
|
|
73999
|
+
for (var i = start, j = end - dim; i < end; i += dim) {
|
|
74000
|
+
sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
|
|
74001
|
+
j = i;
|
|
74002
|
+
}
|
|
74003
|
+
return sum;
|
|
74004
|
+
}
|
|
74005
|
+
|
|
74006
|
+
// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
|
|
74007
|
+
function flatten(data) {
|
|
74008
|
+
var vertices = [];
|
|
74009
|
+
var holes = [];
|
|
74010
|
+
var dimensions = data[0][0].length;
|
|
74011
|
+
var holeIndex = 0;
|
|
74012
|
+
var prevLen = 0;
|
|
74013
|
+
var _iterator = _createForOfIteratorHelper(data),
|
|
74014
|
+
_step;
|
|
74015
|
+
try {
|
|
74016
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
74017
|
+
var ring = _step.value;
|
|
74018
|
+
var _iterator2 = _createForOfIteratorHelper(ring),
|
|
74019
|
+
_step2;
|
|
74020
|
+
try {
|
|
74021
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
74022
|
+
var p = _step2.value;
|
|
74023
|
+
for (var d = 0; d < dimensions; d++) vertices.push(p[d]);
|
|
74024
|
+
}
|
|
74025
|
+
} catch (err) {
|
|
74026
|
+
_iterator2.e(err);
|
|
74027
|
+
} finally {
|
|
74028
|
+
_iterator2.f();
|
|
74029
|
+
}
|
|
74030
|
+
if (prevLen) {
|
|
74031
|
+
holeIndex += prevLen;
|
|
74032
|
+
holes.push(holeIndex);
|
|
74033
|
+
}
|
|
74034
|
+
prevLen = ring.length;
|
|
74035
|
+
}
|
|
74036
|
+
} catch (err) {
|
|
74037
|
+
_iterator.e(err);
|
|
74038
|
+
} finally {
|
|
74039
|
+
_iterator.f();
|
|
74040
|
+
}
|
|
74041
|
+
return {
|
|
74042
|
+
vertices: vertices,
|
|
74043
|
+
holes: holes,
|
|
74044
|
+
dimensions: dimensions
|
|
74045
|
+
};
|
|
74046
|
+
}
|
|
74047
|
+
|
|
74048
|
+
/***/ }),
|
|
74049
|
+
|
|
73406
74050
|
/***/ 4279:
|
|
73407
74051
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
73408
74052
|
|
|
@@ -73914,683 +74558,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
73914
74558
|
});
|
|
73915
74559
|
|
|
73916
74560
|
|
|
73917
|
-
/***/ }),
|
|
73918
|
-
|
|
73919
|
-
/***/ 2087:
|
|
73920
|
-
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
73921
|
-
|
|
73922
|
-
"use strict";
|
|
73923
|
-
__webpack_require__.r(__webpack_exports__);
|
|
73924
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
73925
|
-
/* harmony export */ "default": function() { return /* binding */ earcut; },
|
|
73926
|
-
/* harmony export */ deviation: function() { return /* binding */ deviation; },
|
|
73927
|
-
/* harmony export */ flatten: function() { return /* binding */ flatten; }
|
|
73928
|
-
/* harmony export */ });
|
|
73929
|
-
|
|
73930
|
-
function earcut(data, holeIndices, dim = 2) {
|
|
73931
|
-
|
|
73932
|
-
const hasHoles = holeIndices && holeIndices.length;
|
|
73933
|
-
const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
|
|
73934
|
-
let outerNode = linkedList(data, 0, outerLen, dim, true);
|
|
73935
|
-
const triangles = [];
|
|
73936
|
-
|
|
73937
|
-
if (!outerNode || outerNode.next === outerNode.prev) return triangles;
|
|
73938
|
-
|
|
73939
|
-
let minX, minY, invSize;
|
|
73940
|
-
|
|
73941
|
-
if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
|
|
73942
|
-
|
|
73943
|
-
// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
|
|
73944
|
-
if (data.length > 80 * dim) {
|
|
73945
|
-
minX = Infinity;
|
|
73946
|
-
minY = Infinity;
|
|
73947
|
-
let maxX = -Infinity;
|
|
73948
|
-
let maxY = -Infinity;
|
|
73949
|
-
|
|
73950
|
-
for (let i = dim; i < outerLen; i += dim) {
|
|
73951
|
-
const x = data[i];
|
|
73952
|
-
const y = data[i + 1];
|
|
73953
|
-
if (x < minX) minX = x;
|
|
73954
|
-
if (y < minY) minY = y;
|
|
73955
|
-
if (x > maxX) maxX = x;
|
|
73956
|
-
if (y > maxY) maxY = y;
|
|
73957
|
-
}
|
|
73958
|
-
|
|
73959
|
-
// minX, minY and invSize are later used to transform coords into integers for z-order calculation
|
|
73960
|
-
invSize = Math.max(maxX - minX, maxY - minY);
|
|
73961
|
-
invSize = invSize !== 0 ? 32767 / invSize : 0;
|
|
73962
|
-
}
|
|
73963
|
-
|
|
73964
|
-
earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
|
|
73965
|
-
|
|
73966
|
-
return triangles;
|
|
73967
|
-
}
|
|
73968
|
-
|
|
73969
|
-
// create a circular doubly linked list from polygon points in the specified winding order
|
|
73970
|
-
function linkedList(data, start, end, dim, clockwise) {
|
|
73971
|
-
let last;
|
|
73972
|
-
|
|
73973
|
-
if (clockwise === (signedArea(data, start, end, dim) > 0)) {
|
|
73974
|
-
for (let i = start; i < end; i += dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
|
|
73975
|
-
} else {
|
|
73976
|
-
for (let i = end - dim; i >= start; i -= dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
|
|
73977
|
-
}
|
|
73978
|
-
|
|
73979
|
-
if (last && equals(last, last.next)) {
|
|
73980
|
-
removeNode(last);
|
|
73981
|
-
last = last.next;
|
|
73982
|
-
}
|
|
73983
|
-
|
|
73984
|
-
return last;
|
|
73985
|
-
}
|
|
73986
|
-
|
|
73987
|
-
// eliminate colinear or duplicate points
|
|
73988
|
-
function filterPoints(start, end) {
|
|
73989
|
-
if (!start) return start;
|
|
73990
|
-
if (!end) end = start;
|
|
73991
|
-
|
|
73992
|
-
let p = start,
|
|
73993
|
-
again;
|
|
73994
|
-
do {
|
|
73995
|
-
again = false;
|
|
73996
|
-
|
|
73997
|
-
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
|
|
73998
|
-
removeNode(p);
|
|
73999
|
-
p = end = p.prev;
|
|
74000
|
-
if (p === p.next) break;
|
|
74001
|
-
again = true;
|
|
74002
|
-
|
|
74003
|
-
} else {
|
|
74004
|
-
p = p.next;
|
|
74005
|
-
}
|
|
74006
|
-
} while (again || p !== end);
|
|
74007
|
-
|
|
74008
|
-
return end;
|
|
74009
|
-
}
|
|
74010
|
-
|
|
74011
|
-
// main ear slicing loop which triangulates a polygon (given as a linked list)
|
|
74012
|
-
function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
|
|
74013
|
-
if (!ear) return;
|
|
74014
|
-
|
|
74015
|
-
// interlink polygon nodes in z-order
|
|
74016
|
-
if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
|
|
74017
|
-
|
|
74018
|
-
let stop = ear;
|
|
74019
|
-
|
|
74020
|
-
// iterate through ears, slicing them one by one
|
|
74021
|
-
while (ear.prev !== ear.next) {
|
|
74022
|
-
const prev = ear.prev;
|
|
74023
|
-
const next = ear.next;
|
|
74024
|
-
|
|
74025
|
-
if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
|
|
74026
|
-
triangles.push(prev.i, ear.i, next.i); // cut off the triangle
|
|
74027
|
-
|
|
74028
|
-
removeNode(ear);
|
|
74029
|
-
|
|
74030
|
-
// skipping the next vertex leads to less sliver triangles
|
|
74031
|
-
ear = next.next;
|
|
74032
|
-
stop = next.next;
|
|
74033
|
-
|
|
74034
|
-
continue;
|
|
74035
|
-
}
|
|
74036
|
-
|
|
74037
|
-
ear = next;
|
|
74038
|
-
|
|
74039
|
-
// if we looped through the whole remaining polygon and can't find any more ears
|
|
74040
|
-
if (ear === stop) {
|
|
74041
|
-
// try filtering points and slicing again
|
|
74042
|
-
if (!pass) {
|
|
74043
|
-
earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
|
|
74044
|
-
|
|
74045
|
-
// if this didn't work, try curing all small self-intersections locally
|
|
74046
|
-
} else if (pass === 1) {
|
|
74047
|
-
ear = cureLocalIntersections(filterPoints(ear), triangles);
|
|
74048
|
-
earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
|
|
74049
|
-
|
|
74050
|
-
// as a last resort, try splitting the remaining polygon into two
|
|
74051
|
-
} else if (pass === 2) {
|
|
74052
|
-
splitEarcut(ear, triangles, dim, minX, minY, invSize);
|
|
74053
|
-
}
|
|
74054
|
-
|
|
74055
|
-
break;
|
|
74056
|
-
}
|
|
74057
|
-
}
|
|
74058
|
-
}
|
|
74059
|
-
|
|
74060
|
-
// check whether a polygon node forms a valid ear with adjacent nodes
|
|
74061
|
-
function isEar(ear) {
|
|
74062
|
-
const a = ear.prev,
|
|
74063
|
-
b = ear,
|
|
74064
|
-
c = ear.next;
|
|
74065
|
-
|
|
74066
|
-
if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
|
|
74067
|
-
|
|
74068
|
-
// now make sure we don't have other points inside the potential ear
|
|
74069
|
-
const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
|
|
74070
|
-
|
|
74071
|
-
// triangle bbox; min & max are calculated like this for speed
|
|
74072
|
-
const x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),
|
|
74073
|
-
y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),
|
|
74074
|
-
x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),
|
|
74075
|
-
y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);
|
|
74076
|
-
|
|
74077
|
-
let p = c.next;
|
|
74078
|
-
while (p !== a) {
|
|
74079
|
-
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&
|
|
74080
|
-
pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) &&
|
|
74081
|
-
area(p.prev, p, p.next) >= 0) return false;
|
|
74082
|
-
p = p.next;
|
|
74083
|
-
}
|
|
74084
|
-
|
|
74085
|
-
return true;
|
|
74086
|
-
}
|
|
74087
|
-
|
|
74088
|
-
function isEarHashed(ear, minX, minY, invSize) {
|
|
74089
|
-
const a = ear.prev,
|
|
74090
|
-
b = ear,
|
|
74091
|
-
c = ear.next;
|
|
74092
|
-
|
|
74093
|
-
if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
|
|
74094
|
-
|
|
74095
|
-
const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
|
|
74096
|
-
|
|
74097
|
-
// triangle bbox; min & max are calculated like this for speed
|
|
74098
|
-
const x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),
|
|
74099
|
-
y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),
|
|
74100
|
-
x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),
|
|
74101
|
-
y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);
|
|
74102
|
-
|
|
74103
|
-
// z-order range for the current triangle bbox;
|
|
74104
|
-
const minZ = zOrder(x0, y0, minX, minY, invSize),
|
|
74105
|
-
maxZ = zOrder(x1, y1, minX, minY, invSize);
|
|
74106
|
-
|
|
74107
|
-
let p = ear.prevZ,
|
|
74108
|
-
n = ear.nextZ;
|
|
74109
|
-
|
|
74110
|
-
// look for points inside the triangle in both directions
|
|
74111
|
-
while (p && p.z >= minZ && n && n.z <= maxZ) {
|
|
74112
|
-
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&
|
|
74113
|
-
pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
74114
|
-
p = p.prevZ;
|
|
74115
|
-
|
|
74116
|
-
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&
|
|
74117
|
-
pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
|
|
74118
|
-
n = n.nextZ;
|
|
74119
|
-
}
|
|
74120
|
-
|
|
74121
|
-
// look for remaining points in decreasing z-order
|
|
74122
|
-
while (p && p.z >= minZ) {
|
|
74123
|
-
if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&
|
|
74124
|
-
pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
|
|
74125
|
-
p = p.prevZ;
|
|
74126
|
-
}
|
|
74127
|
-
|
|
74128
|
-
// look for remaining points in increasing z-order
|
|
74129
|
-
while (n && n.z <= maxZ) {
|
|
74130
|
-
if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&
|
|
74131
|
-
pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
|
|
74132
|
-
n = n.nextZ;
|
|
74133
|
-
}
|
|
74134
|
-
|
|
74135
|
-
return true;
|
|
74136
|
-
}
|
|
74137
|
-
|
|
74138
|
-
// go through all polygon nodes and cure small local self-intersections
|
|
74139
|
-
function cureLocalIntersections(start, triangles) {
|
|
74140
|
-
let p = start;
|
|
74141
|
-
do {
|
|
74142
|
-
const a = p.prev,
|
|
74143
|
-
b = p.next.next;
|
|
74144
|
-
|
|
74145
|
-
if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
|
|
74146
|
-
|
|
74147
|
-
triangles.push(a.i, p.i, b.i);
|
|
74148
|
-
|
|
74149
|
-
// remove two nodes involved
|
|
74150
|
-
removeNode(p);
|
|
74151
|
-
removeNode(p.next);
|
|
74152
|
-
|
|
74153
|
-
p = start = b;
|
|
74154
|
-
}
|
|
74155
|
-
p = p.next;
|
|
74156
|
-
} while (p !== start);
|
|
74157
|
-
|
|
74158
|
-
return filterPoints(p);
|
|
74159
|
-
}
|
|
74160
|
-
|
|
74161
|
-
// try splitting polygon into two and triangulate them independently
|
|
74162
|
-
function splitEarcut(start, triangles, dim, minX, minY, invSize) {
|
|
74163
|
-
// look for a valid diagonal that divides the polygon into two
|
|
74164
|
-
let a = start;
|
|
74165
|
-
do {
|
|
74166
|
-
let b = a.next.next;
|
|
74167
|
-
while (b !== a.prev) {
|
|
74168
|
-
if (a.i !== b.i && isValidDiagonal(a, b)) {
|
|
74169
|
-
// split the polygon in two by the diagonal
|
|
74170
|
-
let c = splitPolygon(a, b);
|
|
74171
|
-
|
|
74172
|
-
// filter colinear points around the cuts
|
|
74173
|
-
a = filterPoints(a, a.next);
|
|
74174
|
-
c = filterPoints(c, c.next);
|
|
74175
|
-
|
|
74176
|
-
// run earcut on each half
|
|
74177
|
-
earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
|
|
74178
|
-
earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
|
|
74179
|
-
return;
|
|
74180
|
-
}
|
|
74181
|
-
b = b.next;
|
|
74182
|
-
}
|
|
74183
|
-
a = a.next;
|
|
74184
|
-
} while (a !== start);
|
|
74185
|
-
}
|
|
74186
|
-
|
|
74187
|
-
// link every hole into the outer loop, producing a single-ring polygon without holes
|
|
74188
|
-
function eliminateHoles(data, holeIndices, outerNode, dim) {
|
|
74189
|
-
const queue = [];
|
|
74190
|
-
|
|
74191
|
-
for (let i = 0, len = holeIndices.length; i < len; i++) {
|
|
74192
|
-
const start = holeIndices[i] * dim;
|
|
74193
|
-
const end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
|
|
74194
|
-
const list = linkedList(data, start, end, dim, false);
|
|
74195
|
-
if (list === list.next) list.steiner = true;
|
|
74196
|
-
queue.push(getLeftmost(list));
|
|
74197
|
-
}
|
|
74198
|
-
|
|
74199
|
-
queue.sort(compareX);
|
|
74200
|
-
|
|
74201
|
-
// process holes from left to right
|
|
74202
|
-
for (let i = 0; i < queue.length; i++) {
|
|
74203
|
-
outerNode = eliminateHole(queue[i], outerNode);
|
|
74204
|
-
}
|
|
74205
|
-
|
|
74206
|
-
return outerNode;
|
|
74207
|
-
}
|
|
74208
|
-
|
|
74209
|
-
function compareX(a, b) {
|
|
74210
|
-
return a.x - b.x;
|
|
74211
|
-
}
|
|
74212
|
-
|
|
74213
|
-
// find a bridge between vertices that connects hole with an outer ring and and link it
|
|
74214
|
-
function eliminateHole(hole, outerNode) {
|
|
74215
|
-
const bridge = findHoleBridge(hole, outerNode);
|
|
74216
|
-
if (!bridge) {
|
|
74217
|
-
return outerNode;
|
|
74218
|
-
}
|
|
74219
|
-
|
|
74220
|
-
const bridgeReverse = splitPolygon(bridge, hole);
|
|
74221
|
-
|
|
74222
|
-
// filter collinear points around the cuts
|
|
74223
|
-
filterPoints(bridgeReverse, bridgeReverse.next);
|
|
74224
|
-
return filterPoints(bridge, bridge.next);
|
|
74225
|
-
}
|
|
74226
|
-
|
|
74227
|
-
// David Eberly's algorithm for finding a bridge between hole and outer polygon
|
|
74228
|
-
function findHoleBridge(hole, outerNode) {
|
|
74229
|
-
let p = outerNode;
|
|
74230
|
-
const hx = hole.x;
|
|
74231
|
-
const hy = hole.y;
|
|
74232
|
-
let qx = -Infinity;
|
|
74233
|
-
let m;
|
|
74234
|
-
|
|
74235
|
-
// find a segment intersected by a ray from the hole's leftmost point to the left;
|
|
74236
|
-
// segment's endpoint with lesser x will be potential connection point
|
|
74237
|
-
do {
|
|
74238
|
-
if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
|
|
74239
|
-
const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
|
|
74240
|
-
if (x <= hx && x > qx) {
|
|
74241
|
-
qx = x;
|
|
74242
|
-
m = p.x < p.next.x ? p : p.next;
|
|
74243
|
-
if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint
|
|
74244
|
-
}
|
|
74245
|
-
}
|
|
74246
|
-
p = p.next;
|
|
74247
|
-
} while (p !== outerNode);
|
|
74248
|
-
|
|
74249
|
-
if (!m) return null;
|
|
74250
|
-
|
|
74251
|
-
// look for points inside the triangle of hole point, segment intersection and endpoint;
|
|
74252
|
-
// if there are no points found, we have a valid connection;
|
|
74253
|
-
// otherwise choose the point of the minimum angle with the ray as connection point
|
|
74254
|
-
|
|
74255
|
-
const stop = m;
|
|
74256
|
-
const mx = m.x;
|
|
74257
|
-
const my = m.y;
|
|
74258
|
-
let tanMin = Infinity;
|
|
74259
|
-
|
|
74260
|
-
p = m;
|
|
74261
|
-
|
|
74262
|
-
do {
|
|
74263
|
-
if (hx >= p.x && p.x >= mx && hx !== p.x &&
|
|
74264
|
-
pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
|
|
74265
|
-
|
|
74266
|
-
const tan = Math.abs(hy - p.y) / (hx - p.x); // tangential
|
|
74267
|
-
|
|
74268
|
-
if (locallyInside(p, hole) &&
|
|
74269
|
-
(tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {
|
|
74270
|
-
m = p;
|
|
74271
|
-
tanMin = tan;
|
|
74272
|
-
}
|
|
74273
|
-
}
|
|
74274
|
-
|
|
74275
|
-
p = p.next;
|
|
74276
|
-
} while (p !== stop);
|
|
74277
|
-
|
|
74278
|
-
return m;
|
|
74279
|
-
}
|
|
74280
|
-
|
|
74281
|
-
// whether sector in vertex m contains sector in vertex p in the same coordinates
|
|
74282
|
-
function sectorContainsSector(m, p) {
|
|
74283
|
-
return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
|
|
74284
|
-
}
|
|
74285
|
-
|
|
74286
|
-
// interlink polygon nodes in z-order
|
|
74287
|
-
function indexCurve(start, minX, minY, invSize) {
|
|
74288
|
-
let p = start;
|
|
74289
|
-
do {
|
|
74290
|
-
if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
|
|
74291
|
-
p.prevZ = p.prev;
|
|
74292
|
-
p.nextZ = p.next;
|
|
74293
|
-
p = p.next;
|
|
74294
|
-
} while (p !== start);
|
|
74295
|
-
|
|
74296
|
-
p.prevZ.nextZ = null;
|
|
74297
|
-
p.prevZ = null;
|
|
74298
|
-
|
|
74299
|
-
sortLinked(p);
|
|
74300
|
-
}
|
|
74301
|
-
|
|
74302
|
-
// Simon Tatham's linked list merge sort algorithm
|
|
74303
|
-
// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
|
|
74304
|
-
function sortLinked(list) {
|
|
74305
|
-
let numMerges;
|
|
74306
|
-
let inSize = 1;
|
|
74307
|
-
|
|
74308
|
-
do {
|
|
74309
|
-
let p = list;
|
|
74310
|
-
let e;
|
|
74311
|
-
list = null;
|
|
74312
|
-
let tail = null;
|
|
74313
|
-
numMerges = 0;
|
|
74314
|
-
|
|
74315
|
-
while (p) {
|
|
74316
|
-
numMerges++;
|
|
74317
|
-
let q = p;
|
|
74318
|
-
let pSize = 0;
|
|
74319
|
-
for (let i = 0; i < inSize; i++) {
|
|
74320
|
-
pSize++;
|
|
74321
|
-
q = q.nextZ;
|
|
74322
|
-
if (!q) break;
|
|
74323
|
-
}
|
|
74324
|
-
let qSize = inSize;
|
|
74325
|
-
|
|
74326
|
-
while (pSize > 0 || (qSize > 0 && q)) {
|
|
74327
|
-
|
|
74328
|
-
if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
|
|
74329
|
-
e = p;
|
|
74330
|
-
p = p.nextZ;
|
|
74331
|
-
pSize--;
|
|
74332
|
-
} else {
|
|
74333
|
-
e = q;
|
|
74334
|
-
q = q.nextZ;
|
|
74335
|
-
qSize--;
|
|
74336
|
-
}
|
|
74337
|
-
|
|
74338
|
-
if (tail) tail.nextZ = e;
|
|
74339
|
-
else list = e;
|
|
74340
|
-
|
|
74341
|
-
e.prevZ = tail;
|
|
74342
|
-
tail = e;
|
|
74343
|
-
}
|
|
74344
|
-
|
|
74345
|
-
p = q;
|
|
74346
|
-
}
|
|
74347
|
-
|
|
74348
|
-
tail.nextZ = null;
|
|
74349
|
-
inSize *= 2;
|
|
74350
|
-
|
|
74351
|
-
} while (numMerges > 1);
|
|
74352
|
-
|
|
74353
|
-
return list;
|
|
74354
|
-
}
|
|
74355
|
-
|
|
74356
|
-
// z-order of a point given coords and inverse of the longer side of data bbox
|
|
74357
|
-
function zOrder(x, y, minX, minY, invSize) {
|
|
74358
|
-
// coords are transformed into non-negative 15-bit integer range
|
|
74359
|
-
x = (x - minX) * invSize | 0;
|
|
74360
|
-
y = (y - minY) * invSize | 0;
|
|
74361
|
-
|
|
74362
|
-
x = (x | (x << 8)) & 0x00FF00FF;
|
|
74363
|
-
x = (x | (x << 4)) & 0x0F0F0F0F;
|
|
74364
|
-
x = (x | (x << 2)) & 0x33333333;
|
|
74365
|
-
x = (x | (x << 1)) & 0x55555555;
|
|
74366
|
-
|
|
74367
|
-
y = (y | (y << 8)) & 0x00FF00FF;
|
|
74368
|
-
y = (y | (y << 4)) & 0x0F0F0F0F;
|
|
74369
|
-
y = (y | (y << 2)) & 0x33333333;
|
|
74370
|
-
y = (y | (y << 1)) & 0x55555555;
|
|
74371
|
-
|
|
74372
|
-
return x | (y << 1);
|
|
74373
|
-
}
|
|
74374
|
-
|
|
74375
|
-
// find the leftmost node of a polygon ring
|
|
74376
|
-
function getLeftmost(start) {
|
|
74377
|
-
let p = start,
|
|
74378
|
-
leftmost = start;
|
|
74379
|
-
do {
|
|
74380
|
-
if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;
|
|
74381
|
-
p = p.next;
|
|
74382
|
-
} while (p !== start);
|
|
74383
|
-
|
|
74384
|
-
return leftmost;
|
|
74385
|
-
}
|
|
74386
|
-
|
|
74387
|
-
// check if a point lies within a convex triangle
|
|
74388
|
-
function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
|
|
74389
|
-
return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&
|
|
74390
|
-
(ax - px) * (by - py) >= (bx - px) * (ay - py) &&
|
|
74391
|
-
(bx - px) * (cy - py) >= (cx - px) * (by - py);
|
|
74392
|
-
}
|
|
74393
|
-
|
|
74394
|
-
// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
|
|
74395
|
-
function isValidDiagonal(a, b) {
|
|
74396
|
-
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
|
|
74397
|
-
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
|
|
74398
|
-
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
|
|
74399
|
-
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
|
|
74400
|
-
}
|
|
74401
|
-
|
|
74402
|
-
// signed area of a triangle
|
|
74403
|
-
function area(p, q, r) {
|
|
74404
|
-
return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
|
|
74405
|
-
}
|
|
74406
|
-
|
|
74407
|
-
// check if two points are equal
|
|
74408
|
-
function equals(p1, p2) {
|
|
74409
|
-
return p1.x === p2.x && p1.y === p2.y;
|
|
74410
|
-
}
|
|
74411
|
-
|
|
74412
|
-
// check if two segments intersect
|
|
74413
|
-
function intersects(p1, q1, p2, q2) {
|
|
74414
|
-
const o1 = sign(area(p1, q1, p2));
|
|
74415
|
-
const o2 = sign(area(p1, q1, q2));
|
|
74416
|
-
const o3 = sign(area(p2, q2, p1));
|
|
74417
|
-
const o4 = sign(area(p2, q2, q1));
|
|
74418
|
-
|
|
74419
|
-
if (o1 !== o2 && o3 !== o4) return true; // general case
|
|
74420
|
-
|
|
74421
|
-
if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1
|
|
74422
|
-
if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1
|
|
74423
|
-
if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2
|
|
74424
|
-
if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2
|
|
74425
|
-
|
|
74426
|
-
return false;
|
|
74427
|
-
}
|
|
74428
|
-
|
|
74429
|
-
// for collinear points p, q, r, check if point q lies on segment pr
|
|
74430
|
-
function onSegment(p, q, r) {
|
|
74431
|
-
return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
|
|
74432
|
-
}
|
|
74433
|
-
|
|
74434
|
-
function sign(num) {
|
|
74435
|
-
return num > 0 ? 1 : num < 0 ? -1 : 0;
|
|
74436
|
-
}
|
|
74437
|
-
|
|
74438
|
-
// check if a polygon diagonal intersects any polygon segments
|
|
74439
|
-
function intersectsPolygon(a, b) {
|
|
74440
|
-
let p = a;
|
|
74441
|
-
do {
|
|
74442
|
-
if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&
|
|
74443
|
-
intersects(p, p.next, a, b)) return true;
|
|
74444
|
-
p = p.next;
|
|
74445
|
-
} while (p !== a);
|
|
74446
|
-
|
|
74447
|
-
return false;
|
|
74448
|
-
}
|
|
74449
|
-
|
|
74450
|
-
// check if a polygon diagonal is locally inside the polygon
|
|
74451
|
-
function locallyInside(a, b) {
|
|
74452
|
-
return area(a.prev, a, a.next) < 0 ?
|
|
74453
|
-
area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :
|
|
74454
|
-
area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
|
|
74455
|
-
}
|
|
74456
|
-
|
|
74457
|
-
// check if the middle point of a polygon diagonal is inside the polygon
|
|
74458
|
-
function middleInside(a, b) {
|
|
74459
|
-
let p = a;
|
|
74460
|
-
let inside = false;
|
|
74461
|
-
const px = (a.x + b.x) / 2;
|
|
74462
|
-
const py = (a.y + b.y) / 2;
|
|
74463
|
-
do {
|
|
74464
|
-
if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&
|
|
74465
|
-
(px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))
|
|
74466
|
-
inside = !inside;
|
|
74467
|
-
p = p.next;
|
|
74468
|
-
} while (p !== a);
|
|
74469
|
-
|
|
74470
|
-
return inside;
|
|
74471
|
-
}
|
|
74472
|
-
|
|
74473
|
-
// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
|
|
74474
|
-
// if one belongs to the outer ring and another to a hole, it merges it into a single ring
|
|
74475
|
-
function splitPolygon(a, b) {
|
|
74476
|
-
const a2 = createNode(a.i, a.x, a.y),
|
|
74477
|
-
b2 = createNode(b.i, b.x, b.y),
|
|
74478
|
-
an = a.next,
|
|
74479
|
-
bp = b.prev;
|
|
74480
|
-
|
|
74481
|
-
a.next = b;
|
|
74482
|
-
b.prev = a;
|
|
74483
|
-
|
|
74484
|
-
a2.next = an;
|
|
74485
|
-
an.prev = a2;
|
|
74486
|
-
|
|
74487
|
-
b2.next = a2;
|
|
74488
|
-
a2.prev = b2;
|
|
74489
|
-
|
|
74490
|
-
bp.next = b2;
|
|
74491
|
-
b2.prev = bp;
|
|
74492
|
-
|
|
74493
|
-
return b2;
|
|
74494
|
-
}
|
|
74495
|
-
|
|
74496
|
-
// create a node and optionally link it with previous one (in a circular doubly linked list)
|
|
74497
|
-
function insertNode(i, x, y, last) {
|
|
74498
|
-
const p = createNode(i, x, y);
|
|
74499
|
-
|
|
74500
|
-
if (!last) {
|
|
74501
|
-
p.prev = p;
|
|
74502
|
-
p.next = p;
|
|
74503
|
-
|
|
74504
|
-
} else {
|
|
74505
|
-
p.next = last.next;
|
|
74506
|
-
p.prev = last;
|
|
74507
|
-
last.next.prev = p;
|
|
74508
|
-
last.next = p;
|
|
74509
|
-
}
|
|
74510
|
-
return p;
|
|
74511
|
-
}
|
|
74512
|
-
|
|
74513
|
-
function removeNode(p) {
|
|
74514
|
-
p.next.prev = p.prev;
|
|
74515
|
-
p.prev.next = p.next;
|
|
74516
|
-
|
|
74517
|
-
if (p.prevZ) p.prevZ.nextZ = p.nextZ;
|
|
74518
|
-
if (p.nextZ) p.nextZ.prevZ = p.prevZ;
|
|
74519
|
-
}
|
|
74520
|
-
|
|
74521
|
-
function createNode(i, x, y) {
|
|
74522
|
-
return {
|
|
74523
|
-
i, // vertex index in coordinates array
|
|
74524
|
-
x, y, // vertex coordinates
|
|
74525
|
-
prev: null, // previous and next vertex nodes in a polygon ring
|
|
74526
|
-
next: null,
|
|
74527
|
-
z: 0, // z-order curve value
|
|
74528
|
-
prevZ: null, // previous and next nodes in z-order
|
|
74529
|
-
nextZ: null,
|
|
74530
|
-
steiner: false // indicates whether this is a steiner point
|
|
74531
|
-
};
|
|
74532
|
-
}
|
|
74533
|
-
|
|
74534
|
-
// return a percentage difference between the polygon area and its triangulation area;
|
|
74535
|
-
// used to verify correctness of triangulation
|
|
74536
|
-
function deviation(data, holeIndices, dim, triangles) {
|
|
74537
|
-
const hasHoles = holeIndices && holeIndices.length;
|
|
74538
|
-
const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
|
|
74539
|
-
|
|
74540
|
-
let polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
|
|
74541
|
-
if (hasHoles) {
|
|
74542
|
-
for (let i = 0, len = holeIndices.length; i < len; i++) {
|
|
74543
|
-
const start = holeIndices[i] * dim;
|
|
74544
|
-
const end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
|
|
74545
|
-
polygonArea -= Math.abs(signedArea(data, start, end, dim));
|
|
74546
|
-
}
|
|
74547
|
-
}
|
|
74548
|
-
|
|
74549
|
-
let trianglesArea = 0;
|
|
74550
|
-
for (let i = 0; i < triangles.length; i += 3) {
|
|
74551
|
-
const a = triangles[i] * dim;
|
|
74552
|
-
const b = triangles[i + 1] * dim;
|
|
74553
|
-
const c = triangles[i + 2] * dim;
|
|
74554
|
-
trianglesArea += Math.abs(
|
|
74555
|
-
(data[a] - data[c]) * (data[b + 1] - data[a + 1]) -
|
|
74556
|
-
(data[a] - data[b]) * (data[c + 1] - data[a + 1]));
|
|
74557
|
-
}
|
|
74558
|
-
|
|
74559
|
-
return polygonArea === 0 && trianglesArea === 0 ? 0 :
|
|
74560
|
-
Math.abs((trianglesArea - polygonArea) / polygonArea);
|
|
74561
|
-
}
|
|
74562
|
-
|
|
74563
|
-
function signedArea(data, start, end, dim) {
|
|
74564
|
-
let sum = 0;
|
|
74565
|
-
for (let i = start, j = end - dim; i < end; i += dim) {
|
|
74566
|
-
sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
|
|
74567
|
-
j = i;
|
|
74568
|
-
}
|
|
74569
|
-
return sum;
|
|
74570
|
-
}
|
|
74571
|
-
|
|
74572
|
-
// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
|
|
74573
|
-
function flatten(data) {
|
|
74574
|
-
const vertices = [];
|
|
74575
|
-
const holes = [];
|
|
74576
|
-
const dimensions = data[0][0].length;
|
|
74577
|
-
let holeIndex = 0;
|
|
74578
|
-
let prevLen = 0;
|
|
74579
|
-
|
|
74580
|
-
for (const ring of data) {
|
|
74581
|
-
for (const p of ring) {
|
|
74582
|
-
for (let d = 0; d < dimensions; d++) vertices.push(p[d]);
|
|
74583
|
-
}
|
|
74584
|
-
if (prevLen) {
|
|
74585
|
-
holeIndex += prevLen;
|
|
74586
|
-
holes.push(holeIndex);
|
|
74587
|
-
}
|
|
74588
|
-
prevLen = ring.length;
|
|
74589
|
-
}
|
|
74590
|
-
return {vertices, holes, dimensions};
|
|
74591
|
-
}
|
|
74592
|
-
|
|
74593
|
-
|
|
74594
74561
|
/***/ })
|
|
74595
74562
|
|
|
74596
74563
|
/******/ });
|