@evergis/react 2.0.145 → 2.0.147
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/LICENSE +20 -20
- package/README.md +31 -31
- package/dist/components/MapLegend/index.d.ts +1 -1
- package/dist/hooks/useFeatureLayer.d.ts +1 -1
- package/dist/react.cjs.development.js +1647 -1651
- package/dist/react.cjs.development.js.map +1 -1
- package/dist/react.cjs.production.min.js +1 -1
- package/dist/react.cjs.production.min.js.map +1 -1
- package/dist/react.esm.js +1647 -1653
- package/dist/react.esm.js.map +1 -1
- package/package.json +5 -5
|
@@ -27,10 +27,6 @@ var PolylineSymbol = require('@evergis/sgis/es/symbols/PolylineSymbol');
|
|
|
27
27
|
var Poly = require('@evergis/sgis/es/renders/Poly');
|
|
28
28
|
var geotools = require('@evergis/sgis/es/geotools');
|
|
29
29
|
var math = require('@evergis/sgis/es/utils/math');
|
|
30
|
-
var PolylineControl = require('@evergis/sgis/es/controls/PolylineControl');
|
|
31
|
-
var Label = require('@evergis/sgis/es/features/Label');
|
|
32
|
-
var Control = require('@evergis/sgis/es/controls/Control');
|
|
33
|
-
var PolyEditor = require('@evergis/sgis/es/controls/PolyEditor');
|
|
34
30
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
35
31
|
var _Symbol = require('@evergis/sgis/es/symbols/Symbol');
|
|
36
32
|
var Poly$1 = require('@evergis/sgis/es/features/Poly');
|
|
@@ -45,6 +41,7 @@ var H3Symbol = require('@evergis/sgis/es/symbols/H3Symbol');
|
|
|
45
41
|
var H3Feature = require('@evergis/sgis/es/features/H3Feature');
|
|
46
42
|
var Canvas = require('@evergis/sgis/es/painters/DomPainter/Canvas');
|
|
47
43
|
var commonEvents = require('@evergis/sgis/es/commonEvents');
|
|
44
|
+
var Label = require('@evergis/sgis/es/features/Label');
|
|
48
45
|
var ClusterLayer$1 = require('@evergis/sgis/es/layers/ClusterLayer');
|
|
49
46
|
var GridClusterProvider = require('@evergis/sgis/es/layers/clusterProviders/GridClusterProvider');
|
|
50
47
|
var PointEditor = require('@evergis/sgis/es/controls/PointEditor');
|
|
@@ -53,6 +50,9 @@ var styled = require('styled-components');
|
|
|
53
50
|
var styled__default = _interopDefault(styled);
|
|
54
51
|
var punycode = _interopDefault(require('punycode'));
|
|
55
52
|
var TileLayer$1 = require('@evergis/sgis/es/layers/TileLayer');
|
|
53
|
+
var PolylineControl = require('@evergis/sgis/es/controls/PolylineControl');
|
|
54
|
+
var Control = require('@evergis/sgis/es/controls/Control');
|
|
55
|
+
var PolyEditor = require('@evergis/sgis/es/controls/PolyEditor');
|
|
56
56
|
|
|
57
57
|
function _classCallCheck(instance, Constructor) {
|
|
58
58
|
if (!(instance instanceof Constructor)) {
|
|
@@ -73,9 +73,6 @@ function _defineProperties(target, props) {
|
|
|
73
73
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
74
74
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
75
75
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
76
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
77
|
-
writable: false
|
|
78
|
-
});
|
|
79
76
|
return Constructor;
|
|
80
77
|
}
|
|
81
78
|
|
|
@@ -109,9 +106,6 @@ function _inherits(subClass, superClass) {
|
|
|
109
106
|
configurable: true
|
|
110
107
|
}
|
|
111
108
|
});
|
|
112
|
-
Object.defineProperty(subClass, "prototype", {
|
|
113
|
-
writable: false
|
|
114
|
-
});
|
|
115
109
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
116
110
|
}
|
|
117
111
|
|
|
@@ -170,8 +164,6 @@ function _assertThisInitialized(self) {
|
|
|
170
164
|
function _possibleConstructorReturn(self, call) {
|
|
171
165
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
172
166
|
return call;
|
|
173
|
-
} else if (call !== void 0) {
|
|
174
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
175
167
|
}
|
|
176
168
|
|
|
177
169
|
return _assertThisInitialized(self);
|
|
@@ -205,7 +197,7 @@ function _superPropBase(object, property) {
|
|
|
205
197
|
return object;
|
|
206
198
|
}
|
|
207
199
|
|
|
208
|
-
function _get() {
|
|
200
|
+
function _get(target, property, receiver) {
|
|
209
201
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
210
202
|
_get = Reflect.get;
|
|
211
203
|
} else {
|
|
@@ -216,14 +208,14 @@ function _get() {
|
|
|
216
208
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
217
209
|
|
|
218
210
|
if (desc.get) {
|
|
219
|
-
return desc.get.call(
|
|
211
|
+
return desc.get.call(receiver);
|
|
220
212
|
}
|
|
221
213
|
|
|
222
214
|
return desc.value;
|
|
223
215
|
};
|
|
224
216
|
}
|
|
225
217
|
|
|
226
|
-
return _get
|
|
218
|
+
return _get(target, property, receiver || target);
|
|
227
219
|
}
|
|
228
220
|
|
|
229
221
|
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
@@ -252,7 +244,7 @@ const defaultApi = /*#__PURE__*/new api.Api({
|
|
|
252
244
|
url: BASE_URL
|
|
253
245
|
});
|
|
254
246
|
const evergisContext = /*#__PURE__*/React.createContext(defaultApi);
|
|
255
|
-
const EvergisProvider = _ref => {
|
|
247
|
+
const EvergisProvider = (_ref) => {
|
|
256
248
|
let {
|
|
257
249
|
api,
|
|
258
250
|
children
|
|
@@ -270,7 +262,7 @@ const mapContext = /*#__PURE__*/React.createContext({
|
|
|
270
262
|
map: defaultMap,
|
|
271
263
|
painter: defaultPainter
|
|
272
264
|
});
|
|
273
|
-
const MapProvider = _ref => {
|
|
265
|
+
const MapProvider = (_ref) => {
|
|
274
266
|
let {
|
|
275
267
|
map,
|
|
276
268
|
painter,
|
|
@@ -292,7 +284,7 @@ const tooltipContext = /*#__PURE__*/React.createContext({
|
|
|
292
284
|
layer: defaultLayer,
|
|
293
285
|
popupLayer: defaultPopupLayer
|
|
294
286
|
});
|
|
295
|
-
const TooltipProvider = _ref => {
|
|
287
|
+
const TooltipProvider = (_ref) => {
|
|
296
288
|
let {
|
|
297
289
|
layer,
|
|
298
290
|
popupLayer,
|
|
@@ -309,7 +301,7 @@ const TooltipProvider = _ref => {
|
|
|
309
301
|
const useTooltipContext = () => React.useContext(tooltipContext);
|
|
310
302
|
|
|
311
303
|
const LegendContext = /*#__PURE__*/React.createContext(null);
|
|
312
|
-
const LegendProvider = _ref => {
|
|
304
|
+
const LegendProvider = (_ref) => {
|
|
313
305
|
let {
|
|
314
306
|
symbol,
|
|
315
307
|
children
|
|
@@ -321,7 +313,7 @@ const LegendProvider = _ref => {
|
|
|
321
313
|
const useLegendContext = () => React.useContext(LegendContext);
|
|
322
314
|
|
|
323
315
|
const evergisSelectContext = /*#__PURE__*/React.createContext([]);
|
|
324
|
-
const EvergisSelectProvider = _ref => {
|
|
316
|
+
const EvergisSelectProvider = (_ref) => {
|
|
325
317
|
let {
|
|
326
318
|
layers,
|
|
327
319
|
children
|
|
@@ -366,7 +358,7 @@ function useMapViewActions() {
|
|
|
366
358
|
}, [map]);
|
|
367
359
|
const zoomIn = React.useCallback(() => zoomTo(1), [zoomTo]);
|
|
368
360
|
const zoomOut = React.useCallback(() => zoomTo(-1), [zoomTo]);
|
|
369
|
-
const animateTo = React.useCallback(_ref => {
|
|
361
|
+
const animateTo = React.useCallback((_ref) => {
|
|
370
362
|
let {
|
|
371
363
|
position,
|
|
372
364
|
resolution,
|
|
@@ -396,7 +388,7 @@ function useMapViewActions() {
|
|
|
396
388
|
const {
|
|
397
389
|
tileScheme
|
|
398
390
|
} = map;
|
|
399
|
-
let tileLevel = tileScheme.levels.find(_ref2 => {
|
|
391
|
+
let tileLevel = tileScheme.levels.find((_ref2) => {
|
|
400
392
|
let {
|
|
401
393
|
zIndex
|
|
402
394
|
} = _ref2;
|
|
@@ -572,7 +564,7 @@ const formatStringAttribute = value => {
|
|
|
572
564
|
|
|
573
565
|
const attributeValues = value.split(/[\s|]/).map(convertStringAttribute);
|
|
574
566
|
|
|
575
|
-
if (attributeValues.every(_ref => {
|
|
567
|
+
if (attributeValues.every((_ref) => {
|
|
576
568
|
let {
|
|
577
569
|
type
|
|
578
570
|
} = _ref;
|
|
@@ -580,7 +572,7 @@ const formatStringAttribute = value => {
|
|
|
580
572
|
}
|
|
581
573
|
/* String */
|
|
582
574
|
)) {
|
|
583
|
-
return [stringAttribute(attributeValues.map(_ref2 => {
|
|
575
|
+
return [stringAttribute(attributeValues.map((_ref2) => {
|
|
584
576
|
let {
|
|
585
577
|
value
|
|
586
578
|
} = _ref2;
|
|
@@ -1057,7 +1049,7 @@ const getFeatureAttributeType = attributeValue => {
|
|
|
1057
1049
|
};
|
|
1058
1050
|
const getLayerAttributes = layerDefinition => {
|
|
1059
1051
|
const attributes = layerDefinition && layerDefinition.attributes || {};
|
|
1060
|
-
return Object.entries(attributes).map(_ref => {
|
|
1052
|
+
return Object.entries(attributes).map((_ref) => {
|
|
1061
1053
|
let [name, definition] = _ref;
|
|
1062
1054
|
return _extends({
|
|
1063
1055
|
name
|
|
@@ -1065,7 +1057,7 @@ const getLayerAttributes = layerDefinition => {
|
|
|
1065
1057
|
});
|
|
1066
1058
|
};
|
|
1067
1059
|
const getFeatureAttributes = attributes => {
|
|
1068
|
-
return attributes ? Object.entries(attributes).map(_ref2 => {
|
|
1060
|
+
return attributes ? Object.entries(attributes).map((_ref2) => {
|
|
1069
1061
|
let [name, value] = _ref2;
|
|
1070
1062
|
return {
|
|
1071
1063
|
name,
|
|
@@ -1083,7 +1075,7 @@ const getClassificationAttribute = (attributeName, attributes) => {
|
|
|
1083
1075
|
return attribute ? _extends({}, attrNamePart, attribute) : attrNamePart;
|
|
1084
1076
|
};
|
|
1085
1077
|
const mergeAttributes = (attributes1, attributes2) => {
|
|
1086
|
-
return attributes1.map(attribute => _extends({}, attribute, attributes2.find(_ref3 => {
|
|
1078
|
+
return attributes1.map(attribute => _extends({}, attribute, attributes2.find((_ref3) => {
|
|
1087
1079
|
let {
|
|
1088
1080
|
name
|
|
1089
1081
|
} = _ref3;
|
|
@@ -1498,7 +1490,7 @@ let SGisPolygonSymbol = /*#__PURE__*/function (_sPolygonSymbol) {
|
|
|
1498
1490
|
const adaptMiterRings = (rings, resolution, fromCrs, toCrs) => {
|
|
1499
1491
|
const projected = geotools.projectRings(rings, fromCrs, toCrs);
|
|
1500
1492
|
return math.simplifyCoordinates(projected.map(ring => // @ts-ignore
|
|
1501
|
-
ring.map(_ref => {
|
|
1493
|
+
ring.map((_ref) => {
|
|
1502
1494
|
let [x, y] = _ref;
|
|
1503
1495
|
return [x / resolution, y / -resolution];
|
|
1504
1496
|
})), 1);
|
|
@@ -1590,1675 +1582,1333 @@ let ArrowLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
|
1590
1582
|
return ArrowLineMiterRender;
|
|
1591
1583
|
}(LineMiterRender);
|
|
1592
1584
|
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
length: formatLength
|
|
1596
|
-
};
|
|
1597
|
-
|
|
1598
|
-
const COORD_FRACTION = 6;
|
|
1599
|
-
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
1600
|
-
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
1601
|
-
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
1602
|
-
|
|
1603
|
-
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
1585
|
+
let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1586
|
+
_inherits(CircleLineMiterRender, _LineMiterRender);
|
|
1604
1587
|
|
|
1605
|
-
|
|
1606
|
-
var _this;
|
|
1588
|
+
var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
|
|
1607
1589
|
|
|
1608
|
-
|
|
1590
|
+
function CircleLineMiterRender() {
|
|
1591
|
+
_classCallCheck(this, CircleLineMiterRender);
|
|
1609
1592
|
|
|
1610
|
-
|
|
1593
|
+
return _super.apply(this, arguments);
|
|
1594
|
+
}
|
|
1611
1595
|
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1596
|
+
_createClass(CircleLineMiterRender, [{
|
|
1597
|
+
key: "usageSize",
|
|
1598
|
+
get: function get() {
|
|
1599
|
+
return this.miterSize + this.strokeWidth * 3;
|
|
1600
|
+
}
|
|
1601
|
+
}, {
|
|
1602
|
+
key: "createRings",
|
|
1603
|
+
value: function createRings(_ref, xMultiplier) {
|
|
1604
|
+
let [x, y] = _ref;
|
|
1605
|
+
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1606
|
+
}
|
|
1607
|
+
}, {
|
|
1608
|
+
key: "createRender",
|
|
1609
|
+
value: function createRender(miterRings) {
|
|
1610
|
+
const isFilled = this.kind === exports.LineMiterKind.FilledCircle;
|
|
1611
|
+
return new Poly.PolyRender(polygonCircleFromPoint(miterRings[0][0], this.miterSize), {
|
|
1612
|
+
fillColor: isFilled ? this.color : 'transparent',
|
|
1613
|
+
strokeColor: this.color,
|
|
1614
|
+
strokeWidth: this.strokeWidth,
|
|
1615
|
+
enclosed: true
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
}]);
|
|
1615
1619
|
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1619
|
-
_this.areaSymbol = params.areaSymbol;
|
|
1620
|
+
return CircleLineMiterRender;
|
|
1621
|
+
}(LineMiterRender);
|
|
1620
1622
|
|
|
1621
|
-
|
|
1623
|
+
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1624
|
+
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1622
1625
|
|
|
1626
|
+
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1623
1627
|
|
|
1624
|
-
|
|
1628
|
+
function SquareLineMiterRender() {
|
|
1629
|
+
_classCallCheck(this, SquareLineMiterRender);
|
|
1625
1630
|
|
|
1626
|
-
return
|
|
1631
|
+
return _super.apply(this, arguments);
|
|
1627
1632
|
}
|
|
1628
1633
|
|
|
1629
|
-
_createClass(
|
|
1630
|
-
key: "
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
this.drawPointOnMouseMove(event);
|
|
1634
|
+
_createClass(SquareLineMiterRender, [{
|
|
1635
|
+
key: "usageSize",
|
|
1636
|
+
get: function get() {
|
|
1637
|
+
return this.miterSize + this.strokeWidth;
|
|
1635
1638
|
}
|
|
1636
1639
|
}, {
|
|
1637
|
-
key: "
|
|
1638
|
-
value: function
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
this.addTempLabel();
|
|
1642
|
-
this.setCursor('pointer');
|
|
1640
|
+
key: "createRings",
|
|
1641
|
+
value: function createRings(_ref, xMultiplier) {
|
|
1642
|
+
let [x, y] = _ref;
|
|
1643
|
+
return [[[x, y + this.miterSize / 2], [x, y - this.miterSize / 2], [x + this.miterSize * xMultiplier, y - this.miterSize / 2], [x + this.miterSize * xMultiplier, y + this.miterSize / 2]]];
|
|
1643
1644
|
}
|
|
1644
1645
|
}, {
|
|
1645
|
-
key: "
|
|
1646
|
-
value: function
|
|
1647
|
-
|
|
1646
|
+
key: "createRender",
|
|
1647
|
+
value: function createRender(miterRings) {
|
|
1648
|
+
const isFilled = this.kind === exports.LineMiterKind.FilledSquare;
|
|
1649
|
+
return new Poly.PolyRender(miterRings, {
|
|
1650
|
+
enclosed: true,
|
|
1651
|
+
fillColor: isFilled ? this.color : void 0,
|
|
1652
|
+
fillStyle: isFilled ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
1653
|
+
lineCap: 'square',
|
|
1654
|
+
lineJoin: 'miter',
|
|
1655
|
+
strokeColor: this.color,
|
|
1656
|
+
strokeWidth: this.strokeWidth
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
}]);
|
|
1648
1660
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1661
|
+
return SquareLineMiterRender;
|
|
1662
|
+
}(LineMiterRender);
|
|
1663
|
+
|
|
1664
|
+
const getLineMiterRender = options => {
|
|
1665
|
+
switch (options.kind) {
|
|
1666
|
+
case exports.LineMiterKind.Arrow:
|
|
1667
|
+
case exports.LineMiterKind.FilledArrow:
|
|
1668
|
+
return new ArrowLineMiterRender(options);
|
|
1669
|
+
|
|
1670
|
+
case exports.LineMiterKind.Square:
|
|
1671
|
+
case exports.LineMiterKind.FilledSquare:
|
|
1672
|
+
return new SquareLineMiterRender(options);
|
|
1673
|
+
|
|
1674
|
+
case exports.LineMiterKind.Circle:
|
|
1675
|
+
case exports.LineMiterKind.FilledCircle:
|
|
1676
|
+
return new CircleLineMiterRender(options);
|
|
1677
|
+
|
|
1678
|
+
default:
|
|
1679
|
+
return null;
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
1682
|
+
|
|
1683
|
+
const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
|
|
1684
|
+
const reversedRing = ring.slice().reverse();
|
|
1685
|
+
|
|
1686
|
+
for (let i = 0; i < reversedRing.length; i++) {
|
|
1687
|
+
const coordinates = reversedRing[i];
|
|
1688
|
+
|
|
1689
|
+
if (isLastRing && i === 0) {
|
|
1690
|
+
reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
|
|
1654
1691
|
}
|
|
1655
|
-
}, {
|
|
1656
|
-
key: "handlePointAdd",
|
|
1657
|
-
value: function handlePointAdd() {
|
|
1658
|
-
const feature = this.activeFeature;
|
|
1659
|
-
if (!feature) return;
|
|
1660
|
-
const {
|
|
1661
|
-
rings,
|
|
1662
|
-
crs
|
|
1663
|
-
} = feature;
|
|
1664
1692
|
|
|
1665
|
-
|
|
1666
|
-
this.finishDrawing();
|
|
1667
|
-
this.fire(new Control.DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
1668
|
-
return;
|
|
1669
|
-
}
|
|
1693
|
+
const nextCoordinates = reversedRing[i - 1];
|
|
1670
1694
|
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
const point = rings[0][0];
|
|
1674
|
-
if (!projection) return;
|
|
1675
|
-
const [lat, long] = projection(point);
|
|
1676
|
-
this.removeTempLabel();
|
|
1677
|
-
this.addMeasureResultLabel();
|
|
1678
|
-
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
1679
|
-
} else {
|
|
1680
|
-
this.removeCoordLabel();
|
|
1681
|
-
}
|
|
1695
|
+
if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
|
|
1696
|
+
reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
|
|
1682
1697
|
}
|
|
1683
|
-
}
|
|
1684
|
-
key: "polygonPreview",
|
|
1685
|
-
value: function polygonPreview() {
|
|
1686
|
-
if (this.tempPolygon) {
|
|
1687
|
-
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
1688
|
-
}
|
|
1698
|
+
}
|
|
1689
1699
|
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
1702
|
-
this.activeFeature && this.activeFeature.hide();
|
|
1703
|
-
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
1700
|
+
return reversedRing.reverse();
|
|
1701
|
+
};
|
|
1702
|
+
|
|
1703
|
+
const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
|
|
1704
|
+
const newRing = ring.slice();
|
|
1705
|
+
|
|
1706
|
+
for (let i = 0; i < newRing.length; i++) {
|
|
1707
|
+
const coordinates = newRing[i];
|
|
1708
|
+
|
|
1709
|
+
if (i === 0 && isFirstRing) {
|
|
1710
|
+
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
1704
1711
|
}
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
delete this.tempPolygon;
|
|
1711
|
-
}
|
|
1712
|
+
|
|
1713
|
+
const prevCoordinates = newRing[i - 1];
|
|
1714
|
+
|
|
1715
|
+
if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
|
|
1716
|
+
newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
|
|
1712
1717
|
}
|
|
1713
|
-
}
|
|
1714
|
-
key: "updateDistance",
|
|
1715
|
-
value: function updateDistance(event) {
|
|
1716
|
-
const feature = this.activeFeature;
|
|
1717
|
-
const {
|
|
1718
|
-
ringIndex,
|
|
1719
|
-
pointIndex
|
|
1720
|
-
} = event;
|
|
1721
|
-
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
1722
|
-
const {
|
|
1723
|
-
rings,
|
|
1724
|
-
crs
|
|
1725
|
-
} = feature;
|
|
1726
|
-
const position = rings[ringIndex][pointIndex];
|
|
1727
|
-
const length = geotools.length(rings, crs);
|
|
1728
|
-
let content = this.formatters.length(length);
|
|
1718
|
+
}
|
|
1729
1719
|
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
const area = geotools.area(rings, crs);
|
|
1733
|
-
content = this.formatters.polygon(area, length);
|
|
1734
|
-
} else if (this.tempPolygon) {
|
|
1735
|
-
feature.show();
|
|
1736
|
-
this.removeTempPolygon();
|
|
1737
|
-
}
|
|
1720
|
+
return newRing;
|
|
1721
|
+
};
|
|
1738
1722
|
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1723
|
+
const updateRingsForMiter = (rings, position, miterSize) => {
|
|
1724
|
+
return rings.map((ring, ringIndex) => {
|
|
1725
|
+
switch (position) {
|
|
1726
|
+
case 'right':
|
|
1727
|
+
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
1728
|
+
|
|
1729
|
+
default:
|
|
1730
|
+
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
1743
1731
|
}
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1732
|
+
});
|
|
1733
|
+
};
|
|
1734
|
+
|
|
1735
|
+
const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
|
|
1736
|
+
let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
|
|
1737
|
+
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
1738
|
+
|
|
1739
|
+
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
1740
|
+
|
|
1741
|
+
function SGisPolylineSymbol(originalSymbol) {
|
|
1742
|
+
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
1743
|
+
|
|
1744
|
+
var _this;
|
|
1745
|
+
|
|
1746
|
+
_classCallCheck(this, SGisPolylineSymbol);
|
|
1747
|
+
|
|
1748
|
+
_this = _super.call(this, {
|
|
1749
|
+
// @ts-ignore
|
|
1750
|
+
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
1751
|
+
strokeWidth: clamp( // @ts-ignore
|
|
1752
|
+
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
1753
|
+
// @ts-ignore
|
|
1754
|
+
lineDash: getLineDash(originalSymbol.stroke),
|
|
1755
|
+
// @ts-ignore
|
|
1756
|
+
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
1757
|
+
});
|
|
1758
|
+
_this.originalSymbol = originalSymbol;
|
|
1759
|
+
return _this;
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
_createClass(SGisPolylineSymbol, [{
|
|
1763
|
+
key: "renderFunction",
|
|
1764
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
1765
|
+
if (!isSimplePolylineSymbol(this.originalSymbol)) return _get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, feature, resolution, crs);
|
|
1766
|
+
const {
|
|
1767
|
+
ending,
|
|
1768
|
+
beginningSize,
|
|
1769
|
+
beginning,
|
|
1770
|
+
endingSize
|
|
1771
|
+
} = this.originalSymbol;
|
|
1772
|
+
const renders = [];
|
|
1773
|
+
const featureCopy = feature.clone();
|
|
1774
|
+
const beginningMiterRender = getLineMiterRender({
|
|
1775
|
+
color: this.strokeColor,
|
|
1776
|
+
// @ts-ignore
|
|
1777
|
+
kind: beginning,
|
|
1778
|
+
position: 'left',
|
|
1779
|
+
// @ts-ignore
|
|
1780
|
+
size: beginningSize,
|
|
1781
|
+
strokeWidth: this.strokeWidth
|
|
1766
1782
|
});
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
renderLabel: this.renderLabelSymbol
|
|
1776
|
-
})
|
|
1783
|
+
const endingMiterRender = getLineMiterRender({
|
|
1784
|
+
color: this.strokeColor,
|
|
1785
|
+
// @ts-ignore
|
|
1786
|
+
kind: ending,
|
|
1787
|
+
position: 'right',
|
|
1788
|
+
// @ts-ignore
|
|
1789
|
+
size: endingSize,
|
|
1790
|
+
strokeWidth: this.strokeWidth
|
|
1777
1791
|
});
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
1785
|
-
delete this.tempLabel;
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
}, {
|
|
1789
|
-
key: "removeCoordLabel",
|
|
1790
|
-
value: function removeCoordLabel() {
|
|
1791
|
-
if (this.coordLabel) {
|
|
1792
|
-
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
1793
|
-
delete this.coordLabel;
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
}, {
|
|
1797
|
-
key: "removeMeasureLabel",
|
|
1798
|
-
value: function removeMeasureLabel() {
|
|
1799
|
-
if (this.measureResultLabel) {
|
|
1800
|
-
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
1801
|
-
delete this.measureResultLabel;
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
}, {
|
|
1805
|
-
key: "drawPointOnMouseMove",
|
|
1806
|
-
value: function drawPointOnMouseMove(event) {
|
|
1807
|
-
if (this.tempLabel) {
|
|
1808
|
-
this.tempLabel.position = event.point.position;
|
|
1792
|
+
|
|
1793
|
+
if (beginningMiterRender) {
|
|
1794
|
+
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
1795
|
+
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
1796
|
+
featureCopy.rings = updatedRings;
|
|
1797
|
+
renders.push(render);
|
|
1809
1798
|
}
|
|
1799
|
+
|
|
1800
|
+
if (endingMiterRender) {
|
|
1801
|
+
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
1802
|
+
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
1803
|
+
featureCopy.rings = updatedRings;
|
|
1804
|
+
renders.push(render);
|
|
1805
|
+
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
1809
|
+
return renders;
|
|
1810
1810
|
}
|
|
1811
1811
|
}, {
|
|
1812
|
-
key: "
|
|
1813
|
-
value: function
|
|
1814
|
-
|
|
1815
|
-
wrapper
|
|
1816
|
-
} = this.painter;
|
|
1817
|
-
|
|
1818
|
-
if (wrapper && typeof wrapper !== 'string') {
|
|
1819
|
-
wrapper.style.cursor = cursor;
|
|
1820
|
-
}
|
|
1812
|
+
key: "clone",
|
|
1813
|
+
value: function clone() {
|
|
1814
|
+
return new SGisPolylineSymbol(this.originalSymbol);
|
|
1821
1815
|
}
|
|
1822
1816
|
}]);
|
|
1823
1817
|
|
|
1824
|
-
return
|
|
1825
|
-
}(
|
|
1818
|
+
return SGisPolylineSymbol;
|
|
1819
|
+
}(PolylineSymbol.PolylineSymbol);
|
|
1826
1820
|
|
|
1827
|
-
let
|
|
1828
|
-
_inherits(
|
|
1821
|
+
let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
|
|
1822
|
+
_inherits(LabelSymbol, _DynamicPointSymbol);
|
|
1829
1823
|
|
|
1830
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
1824
|
+
var _super = /*#__PURE__*/_createSuper(LabelSymbol);
|
|
1831
1825
|
|
|
1832
|
-
function
|
|
1826
|
+
function LabelSymbol(_temp) {
|
|
1833
1827
|
var _this;
|
|
1834
1828
|
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
_this.measureResult = () => {
|
|
1840
|
-
const feature = _this.activeFeature;
|
|
1841
|
-
if (!feature) return null;
|
|
1842
|
-
const {
|
|
1843
|
-
rings,
|
|
1844
|
-
isEnclosed,
|
|
1845
|
-
crs
|
|
1846
|
-
} = feature;
|
|
1847
|
-
const pointsCount = rings[0].length;
|
|
1848
|
-
const position = rings[0][pointsCount - 1];
|
|
1849
|
-
const area = geotools.area(rings, crs);
|
|
1850
|
-
const length = geotools.length(rings, crs, isEnclosed);
|
|
1851
|
-
const content = isEnclosed ? _this.formatters.polygon(area, length) : _this.formatters.length(length);
|
|
1852
|
-
return {
|
|
1853
|
-
content,
|
|
1854
|
-
position
|
|
1855
|
-
};
|
|
1856
|
-
};
|
|
1857
|
-
|
|
1858
|
-
_this.removeFeature = () => {
|
|
1859
|
-
_this.fire('remove');
|
|
1860
|
-
};
|
|
1861
|
-
|
|
1862
|
-
_this.painter = painter;
|
|
1863
|
-
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
1864
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1865
|
-
|
|
1866
|
-
_this.on('change', _this.updateMeasureResult);
|
|
1829
|
+
let {
|
|
1830
|
+
component,
|
|
1831
|
+
offset
|
|
1832
|
+
} = _temp === void 0 ? {} : _temp;
|
|
1867
1833
|
|
|
1868
|
-
|
|
1834
|
+
_classCallCheck(this, LabelSymbol);
|
|
1869
1835
|
|
|
1836
|
+
_this = _super.call(this, {
|
|
1837
|
+
offset
|
|
1838
|
+
});
|
|
1839
|
+
_this.component = component;
|
|
1870
1840
|
return _this;
|
|
1871
1841
|
}
|
|
1872
1842
|
|
|
1873
|
-
_createClass(
|
|
1874
|
-
key: "
|
|
1875
|
-
value: function
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1843
|
+
_createClass(LabelSymbol, [{
|
|
1844
|
+
key: "_getFeatureNode",
|
|
1845
|
+
value: function _getFeatureNode(feature) {
|
|
1846
|
+
const node = document.createElement('div');
|
|
1847
|
+
this.renderDom(feature.content, node);
|
|
1848
|
+
return node;
|
|
1879
1849
|
}
|
|
1880
1850
|
}, {
|
|
1881
|
-
key: "
|
|
1882
|
-
value: function
|
|
1883
|
-
|
|
1884
|
-
if (measureResult === null) return;
|
|
1885
|
-
const {
|
|
1886
|
-
content,
|
|
1887
|
-
position
|
|
1888
|
-
} = measureResult;
|
|
1889
|
-
this.measureResultLabel = new Label.LabelFeature(position, {
|
|
1890
|
-
content,
|
|
1891
|
-
crs: this.map.crs,
|
|
1892
|
-
symbol: createLabelSymbol({
|
|
1893
|
-
onClose: this.removeFeature,
|
|
1894
|
-
renderLabel: this.renderLabelSymbol
|
|
1895
|
-
})
|
|
1896
|
-
});
|
|
1897
|
-
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
1851
|
+
key: "_updateFeatureNode",
|
|
1852
|
+
value: function _updateFeatureNode(feature) {
|
|
1853
|
+
this.renderDom(feature.content, this.getNode(feature));
|
|
1898
1854
|
}
|
|
1899
1855
|
}, {
|
|
1900
|
-
key: "
|
|
1901
|
-
value: function
|
|
1902
|
-
if (
|
|
1903
|
-
|
|
1904
|
-
if (measureResult === null) return;
|
|
1905
|
-
const {
|
|
1906
|
-
content,
|
|
1907
|
-
position
|
|
1908
|
-
} = measureResult;
|
|
1909
|
-
this.measureResultLabel.content = content;
|
|
1910
|
-
this.measureResultLabel.position = position;
|
|
1856
|
+
key: "renderDom",
|
|
1857
|
+
value: function renderDom(content, node) {
|
|
1858
|
+
if (!node) {
|
|
1859
|
+
return;
|
|
1911
1860
|
}
|
|
1912
|
-
}
|
|
1913
|
-
}]);
|
|
1914
1861
|
|
|
1915
|
-
|
|
1916
|
-
}(PolyEditor.PolyEditor);
|
|
1862
|
+
const Component = this.component;
|
|
1917
1863
|
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
|
|
1928
|
-
const widthDistance = geotools.distance(zeroPoint, maxWidthPoint);
|
|
1929
|
-
const pxK = width / (widthDistance || 1);
|
|
1930
|
-
return Math.round(meters * pxK);
|
|
1931
|
-
};
|
|
1932
|
-
|
|
1933
|
-
const polygonCircleFromPoint = (center, diameter) => {
|
|
1934
|
-
const coordinates = [];
|
|
1935
|
-
const radius = diameter / 2;
|
|
1936
|
-
const endAngle = Math.PI * 2;
|
|
1937
|
-
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
1938
|
-
let start = 0;
|
|
1939
|
-
let end = endAngle;
|
|
1864
|
+
if (Component) {
|
|
1865
|
+
ReactDOM.render(React__default.createElement(Component, {
|
|
1866
|
+
content: content
|
|
1867
|
+
}), node);
|
|
1868
|
+
} else {
|
|
1869
|
+
node.innerText = content;
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
}]);
|
|
1940
1873
|
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
}
|
|
1874
|
+
return LabelSymbol;
|
|
1875
|
+
}(_Symbol.DynamicPointSymbol);
|
|
1944
1876
|
|
|
1945
|
-
|
|
1877
|
+
const defaultOffset = [8, -16];
|
|
1878
|
+
const createLabelSymbol = props => {
|
|
1879
|
+
const {
|
|
1880
|
+
offset = defaultOffset,
|
|
1881
|
+
renderLabel = (_ref) => {
|
|
1882
|
+
let {
|
|
1883
|
+
content
|
|
1884
|
+
} = _ref;
|
|
1885
|
+
return React__default.createElement("div", null, content);
|
|
1886
|
+
},
|
|
1887
|
+
onClose = undefined
|
|
1888
|
+
} = props || {};
|
|
1889
|
+
return new LabelSymbol({
|
|
1890
|
+
offset,
|
|
1891
|
+
component: (_ref2) => {
|
|
1892
|
+
let {
|
|
1893
|
+
content
|
|
1894
|
+
} = _ref2;
|
|
1895
|
+
return renderLabel({
|
|
1896
|
+
content,
|
|
1897
|
+
onClose
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
});
|
|
1946
1901
|
};
|
|
1947
1902
|
|
|
1948
|
-
|
|
1903
|
+
function createShadowRender(position, _ref) {
|
|
1904
|
+
let {
|
|
1905
|
+
strokeWidth = 2,
|
|
1906
|
+
shadowColor,
|
|
1907
|
+
shadowSize,
|
|
1908
|
+
size = 6
|
|
1909
|
+
} = _ref;
|
|
1910
|
+
const shadowDiameter = size + strokeWidth + shadowSize;
|
|
1911
|
+
return new Poly.PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
|
|
1912
|
+
fillColor: 'transparent',
|
|
1913
|
+
strokeColor: shadowColor,
|
|
1914
|
+
strokeWidth: shadowSize,
|
|
1915
|
+
enclosed: true
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
function getEditorPointRenderer(position, _ref2) {
|
|
1919
|
+
let {
|
|
1920
|
+
strokeColor,
|
|
1921
|
+
strokeWidth,
|
|
1922
|
+
shadowColor,
|
|
1923
|
+
fillColor,
|
|
1924
|
+
shadowSize,
|
|
1925
|
+
size = 0
|
|
1926
|
+
} = _ref2;
|
|
1927
|
+
return [createShadowRender(position, {
|
|
1928
|
+
strokeWidth,
|
|
1929
|
+
strokeColor,
|
|
1930
|
+
shadowSize,
|
|
1931
|
+
shadowColor,
|
|
1932
|
+
size
|
|
1933
|
+
}), new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
1934
|
+
fillColor,
|
|
1935
|
+
strokeColor,
|
|
1936
|
+
strokeWidth,
|
|
1937
|
+
enclosed: true
|
|
1938
|
+
})];
|
|
1939
|
+
}
|
|
1949
1940
|
|
|
1950
|
-
let
|
|
1951
|
-
_inherits(
|
|
1941
|
+
let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
|
|
1942
|
+
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
1952
1943
|
|
|
1953
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
1944
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
|
|
1954
1945
|
|
|
1955
|
-
|
|
1956
|
-
|
|
1946
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
1947
|
+
function ShadowedPointSymbol(options) {
|
|
1948
|
+
_classCallCheck(this, ShadowedPointSymbol);
|
|
1957
1949
|
|
|
1958
|
-
return _super.
|
|
1950
|
+
return _super.call(this, options);
|
|
1959
1951
|
}
|
|
1960
1952
|
|
|
1961
|
-
_createClass(
|
|
1962
|
-
key: "
|
|
1963
|
-
|
|
1964
|
-
|
|
1953
|
+
_createClass(ShadowedPointSymbol, [{
|
|
1954
|
+
key: "renderFunction",
|
|
1955
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
1956
|
+
if (!(feature instanceof PointFeature.PointFeature)) return [];
|
|
1957
|
+
const {
|
|
1958
|
+
position
|
|
1959
|
+
} = feature.projectTo(crs);
|
|
1960
|
+
const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
|
|
1961
|
+
const shadowRender = this.getShadow(pxPosition, feature);
|
|
1962
|
+
const pointArc = this.getPoint(pxPosition, feature);
|
|
1963
|
+
return shadowRender ? [shadowRender, pointArc] : [pointArc];
|
|
1965
1964
|
}
|
|
1966
1965
|
}, {
|
|
1967
|
-
key: "
|
|
1968
|
-
value: function
|
|
1969
|
-
|
|
1970
|
-
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1966
|
+
key: "getShadow",
|
|
1967
|
+
value: function getShadow(position, _feature) {
|
|
1968
|
+
return ShadowedPointSymbol.getShadowArc(position, this);
|
|
1971
1969
|
}
|
|
1972
1970
|
}, {
|
|
1973
|
-
key: "
|
|
1974
|
-
value: function
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1971
|
+
key: "getPoint",
|
|
1972
|
+
value: function getPoint(position, _feature) {
|
|
1973
|
+
return ShadowedPointSymbol.getPointArc(position, this);
|
|
1974
|
+
}
|
|
1975
|
+
}], [{
|
|
1976
|
+
key: "getShadowArc",
|
|
1977
|
+
value: function getShadowArc(position, _ref) {
|
|
1978
|
+
let {
|
|
1979
|
+
strokeWidth = 2,
|
|
1980
|
+
shadowColor,
|
|
1981
|
+
shadowSize,
|
|
1982
|
+
size = 6
|
|
1983
|
+
} = _ref;
|
|
1984
|
+
return new Poly.PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
|
|
1985
|
+
fillColor: 'transparent',
|
|
1986
|
+
strokeColor: shadowColor,
|
|
1987
|
+
strokeWidth: shadowSize,
|
|
1980
1988
|
enclosed: true
|
|
1981
1989
|
});
|
|
1982
1990
|
}
|
|
1983
|
-
}]);
|
|
1984
|
-
|
|
1985
|
-
return CircleLineMiterRender;
|
|
1986
|
-
}(LineMiterRender);
|
|
1987
|
-
|
|
1988
|
-
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1989
|
-
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1990
|
-
|
|
1991
|
-
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1992
|
-
|
|
1993
|
-
function SquareLineMiterRender() {
|
|
1994
|
-
_classCallCheck(this, SquareLineMiterRender);
|
|
1995
|
-
|
|
1996
|
-
return _super.apply(this, arguments);
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
|
-
_createClass(SquareLineMiterRender, [{
|
|
2000
|
-
key: "usageSize",
|
|
2001
|
-
get: function get() {
|
|
2002
|
-
return this.miterSize + this.strokeWidth;
|
|
2003
|
-
}
|
|
2004
1991
|
}, {
|
|
2005
|
-
key: "
|
|
2006
|
-
value: function
|
|
2007
|
-
let
|
|
2008
|
-
|
|
1992
|
+
key: "getPointArc",
|
|
1993
|
+
value: function getPointArc(position, _ref2) {
|
|
1994
|
+
let {
|
|
1995
|
+
strokeWidth,
|
|
1996
|
+
fillColor,
|
|
1997
|
+
strokeColor,
|
|
1998
|
+
size = 6
|
|
1999
|
+
} = _ref2;
|
|
2000
|
+
return new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
2001
|
+
fillColor,
|
|
2002
|
+
strokeColor,
|
|
2003
|
+
strokeWidth,
|
|
2004
|
+
enclosed: true
|
|
2005
|
+
});
|
|
2009
2006
|
}
|
|
2010
2007
|
}, {
|
|
2011
|
-
key: "
|
|
2012
|
-
value: function
|
|
2013
|
-
const
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
fillColor: isFilled ? this.color : void 0,
|
|
2017
|
-
fillStyle: isFilled ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
2018
|
-
lineCap: 'square',
|
|
2019
|
-
lineJoin: 'miter',
|
|
2020
|
-
strokeColor: this.color,
|
|
2021
|
-
strokeWidth: this.strokeWidth
|
|
2022
|
-
});
|
|
2008
|
+
key: "getArcs",
|
|
2009
|
+
value: function getArcs(position, params) {
|
|
2010
|
+
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2011
|
+
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2012
|
+
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2023
2013
|
}
|
|
2024
2014
|
}]);
|
|
2025
2015
|
|
|
2026
|
-
return
|
|
2027
|
-
}(
|
|
2016
|
+
return ShadowedPointSymbol;
|
|
2017
|
+
}(Point.PointSymbol);
|
|
2028
2018
|
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
case exports.LineMiterKind.Arrow:
|
|
2032
|
-
case exports.LineMiterKind.FilledArrow:
|
|
2033
|
-
return new ArrowLineMiterRender(options);
|
|
2019
|
+
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2020
|
+
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2034
2021
|
|
|
2035
|
-
|
|
2036
|
-
case exports.LineMiterKind.FilledSquare:
|
|
2037
|
-
return new SquareLineMiterRender(options);
|
|
2022
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2038
2023
|
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2024
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2025
|
+
function ShadowedPolySymbol(options) {
|
|
2026
|
+
_classCallCheck(this, ShadowedPolySymbol);
|
|
2042
2027
|
|
|
2043
|
-
|
|
2044
|
-
return null;
|
|
2028
|
+
return _super.call(this, options);
|
|
2045
2029
|
}
|
|
2046
|
-
};
|
|
2047
|
-
|
|
2048
|
-
const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
|
|
2049
|
-
const reversedRing = ring.slice().reverse();
|
|
2050
2030
|
|
|
2051
|
-
|
|
2052
|
-
|
|
2031
|
+
_createClass(ShadowedPolySymbol, [{
|
|
2032
|
+
key: "renderFunction",
|
|
2033
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
2034
|
+
if (!(feature instanceof Poly$1.Poly)) return [];
|
|
2053
2035
|
|
|
2054
|
-
|
|
2055
|
-
reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
|
|
2056
|
-
}
|
|
2036
|
+
const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
|
|
2057
2037
|
|
|
2058
|
-
|
|
2038
|
+
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2039
|
+
const shadowRender = this.getShadow(coordinates, feature);
|
|
2040
|
+
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2041
|
+
let renders = [polyRender];
|
|
2059
2042
|
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
return reversedRing.reverse();
|
|
2066
|
-
};
|
|
2067
|
-
|
|
2068
|
-
const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
|
|
2069
|
-
const newRing = ring.slice();
|
|
2043
|
+
if (shadowRender) {
|
|
2044
|
+
renders = [shadowRender, polyRender];
|
|
2045
|
+
}
|
|
2070
2046
|
|
|
2071
|
-
|
|
2072
|
-
|
|
2047
|
+
if (vertexRenders) {
|
|
2048
|
+
renders = renders.concat(vertexRenders);
|
|
2049
|
+
}
|
|
2073
2050
|
|
|
2074
|
-
|
|
2075
|
-
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
2051
|
+
return renders;
|
|
2076
2052
|
}
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2053
|
+
}, {
|
|
2054
|
+
key: "getShadow",
|
|
2055
|
+
value: function getShadow(coordinates, _feature) {
|
|
2056
|
+
return new Poly.PolyRender(coordinates, {
|
|
2057
|
+
fillStyle: Poly.FillStyle.None,
|
|
2058
|
+
enclosed: this.enclose,
|
|
2059
|
+
strokeColor: this.shadowColor,
|
|
2060
|
+
strokeWidth: this.shadowSize,
|
|
2061
|
+
lineDash: this.lineDash
|
|
2062
|
+
});
|
|
2082
2063
|
}
|
|
2083
|
-
}
|
|
2064
|
+
}, {
|
|
2065
|
+
key: "getPolyRender",
|
|
2066
|
+
value: function getPolyRender(coordinates, _feature) {
|
|
2067
|
+
return new Poly.PolyRender(coordinates, {
|
|
2068
|
+
fillStyle: this.enclose ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
2069
|
+
enclosed: this.enclose,
|
|
2070
|
+
fillColor: this.fillColor,
|
|
2071
|
+
strokeColor: this.strokeColor,
|
|
2072
|
+
strokeWidth: this.strokeWidth,
|
|
2073
|
+
lineDash: this.lineDash
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
}, {
|
|
2077
|
+
key: "getVertexRenders",
|
|
2078
|
+
value: function getVertexRenders(coordinates) {
|
|
2079
|
+
if (!this.showVertex) return;
|
|
2080
|
+
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2081
|
+
return acc.concat(curr);
|
|
2082
|
+
}, []);
|
|
2083
|
+
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2084
|
+
size: 6,
|
|
2085
|
+
strokeWidth: 2,
|
|
2086
|
+
shadowColor: this.shadowColor,
|
|
2087
|
+
strokeColor: this.strokeColor,
|
|
2088
|
+
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2089
|
+
fillColor: '#ffffff'
|
|
2090
|
+
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2091
|
+
}
|
|
2092
|
+
}]);
|
|
2084
2093
|
|
|
2085
|
-
return
|
|
2094
|
+
return ShadowedPolySymbol;
|
|
2095
|
+
}(PolylineSymbol.PolylineSymbol);
|
|
2096
|
+
const polySymbolParams = {
|
|
2097
|
+
strokeWidth: 2,
|
|
2098
|
+
strokeColor: '#e33600',
|
|
2099
|
+
shadowSize: 8,
|
|
2100
|
+
shadowColor: 'rgba(227, 54, 0, 0.3)'
|
|
2086
2101
|
};
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
case 'right':
|
|
2092
|
-
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
2093
|
-
|
|
2094
|
-
default:
|
|
2095
|
-
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
2096
|
-
}
|
|
2097
|
-
});
|
|
2102
|
+
const measureSymbolParams = {
|
|
2103
|
+
strokeColor: '#ff6933',
|
|
2104
|
+
shadowSize: 0,
|
|
2105
|
+
vertexShadowSize: 0
|
|
2098
2106
|
};
|
|
2107
|
+
const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2108
|
+
enclose: false,
|
|
2109
|
+
showVertex: true
|
|
2110
|
+
}));
|
|
2111
|
+
const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2112
|
+
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2113
|
+
enclose: true,
|
|
2114
|
+
showVertex: true
|
|
2115
|
+
}));
|
|
2116
|
+
const snapSymbolParams = {
|
|
2117
|
+
size: 10,
|
|
2118
|
+
strokeWidth: 2,
|
|
2119
|
+
strokeColor: '#e33600',
|
|
2120
|
+
fillColor: '#ffffff',
|
|
2121
|
+
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2122
|
+
shadowSize: 3
|
|
2123
|
+
};
|
|
2124
|
+
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2125
|
+
strokeColor: '#ff6933',
|
|
2126
|
+
shadowSize: 0
|
|
2127
|
+
}));
|
|
2099
2128
|
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
2103
|
-
|
|
2104
|
-
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
2105
|
-
|
|
2106
|
-
function SGisPolylineSymbol(originalSymbol) {
|
|
2107
|
-
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
2129
|
+
let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
|
|
2130
|
+
_inherits(SelectedPointSymbol, _ShadowedPointSymbol);
|
|
2108
2131
|
|
|
2109
|
-
|
|
2132
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
|
|
2110
2133
|
|
|
2111
|
-
|
|
2134
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2135
|
+
function SelectedPointSymbol(props) {
|
|
2136
|
+
_classCallCheck(this, SelectedPointSymbol);
|
|
2112
2137
|
|
|
2113
|
-
|
|
2114
|
-
// @ts-ignore
|
|
2115
|
-
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
2116
|
-
strokeWidth: clamp( // @ts-ignore
|
|
2117
|
-
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
2118
|
-
// @ts-ignore
|
|
2119
|
-
lineDash: getLineDash(originalSymbol.stroke),
|
|
2120
|
-
// @ts-ignore
|
|
2121
|
-
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
2122
|
-
});
|
|
2123
|
-
_this.originalSymbol = originalSymbol;
|
|
2124
|
-
return _this;
|
|
2138
|
+
return _super.call(this, props);
|
|
2125
2139
|
}
|
|
2126
2140
|
|
|
2127
|
-
_createClass(
|
|
2128
|
-
key: "
|
|
2129
|
-
value: function
|
|
2130
|
-
if (
|
|
2131
|
-
|
|
2132
|
-
ending,
|
|
2133
|
-
beginningSize,
|
|
2134
|
-
beginning,
|
|
2135
|
-
endingSize
|
|
2136
|
-
} = this.originalSymbol;
|
|
2137
|
-
const renders = [];
|
|
2138
|
-
const featureCopy = feature.clone();
|
|
2139
|
-
const beginningMiterRender = getLineMiterRender({
|
|
2140
|
-
color: this.strokeColor,
|
|
2141
|
-
// @ts-ignore
|
|
2142
|
-
kind: beginning,
|
|
2143
|
-
position: 'left',
|
|
2144
|
-
// @ts-ignore
|
|
2145
|
-
size: beginningSize,
|
|
2146
|
-
strokeWidth: this.strokeWidth
|
|
2147
|
-
});
|
|
2148
|
-
const endingMiterRender = getLineMiterRender({
|
|
2149
|
-
color: this.strokeColor,
|
|
2150
|
-
// @ts-ignore
|
|
2151
|
-
kind: ending,
|
|
2152
|
-
position: 'right',
|
|
2153
|
-
// @ts-ignore
|
|
2154
|
-
size: endingSize,
|
|
2155
|
-
strokeWidth: this.strokeWidth
|
|
2156
|
-
});
|
|
2157
|
-
|
|
2158
|
-
if (beginningMiterRender) {
|
|
2159
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
2160
|
-
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2161
|
-
featureCopy.rings = updatedRings;
|
|
2162
|
-
renders.push(render);
|
|
2141
|
+
_createClass(SelectedPointSymbol, [{
|
|
2142
|
+
key: "getShadow",
|
|
2143
|
+
value: function getShadow(position, feature) {
|
|
2144
|
+
if (feature.isSelected) {
|
|
2145
|
+
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2163
2146
|
}
|
|
2164
|
-
|
|
2165
|
-
if (endingMiterRender) {
|
|
2166
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
2167
|
-
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2168
|
-
featureCopy.rings = updatedRings;
|
|
2169
|
-
renders.push(render);
|
|
2170
|
-
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
2174
|
-
return renders;
|
|
2175
2147
|
}
|
|
2176
2148
|
}, {
|
|
2177
|
-
key: "
|
|
2178
|
-
value: function
|
|
2179
|
-
|
|
2180
|
-
}
|
|
2181
|
-
}]);
|
|
2149
|
+
key: "getPoint",
|
|
2150
|
+
value: function getPoint(position, feature) {
|
|
2151
|
+
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2182
2152
|
|
|
2183
|
-
|
|
2184
|
-
|
|
2153
|
+
if (feature.isSelected) {
|
|
2154
|
+
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2155
|
+
pointRender.fillColor = this.selectedFillColor;
|
|
2156
|
+
}
|
|
2185
2157
|
|
|
2186
|
-
|
|
2187
|
-
|
|
2158
|
+
return pointRender;
|
|
2159
|
+
}
|
|
2160
|
+
}]);
|
|
2188
2161
|
|
|
2189
|
-
|
|
2162
|
+
return SelectedPointSymbol;
|
|
2163
|
+
}(ShadowedPointSymbol);
|
|
2190
2164
|
|
|
2191
|
-
|
|
2192
|
-
|
|
2165
|
+
let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
|
|
2166
|
+
_inherits(SelectedPolySymbol, _ShadowedPolySymbol);
|
|
2193
2167
|
|
|
2194
|
-
|
|
2195
|
-
component,
|
|
2196
|
-
offset
|
|
2197
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2168
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
|
|
2198
2169
|
|
|
2199
|
-
|
|
2170
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2171
|
+
function SelectedPolySymbol(props) {
|
|
2172
|
+
_classCallCheck(this, SelectedPolySymbol);
|
|
2200
2173
|
|
|
2201
|
-
|
|
2202
|
-
offset
|
|
2203
|
-
});
|
|
2204
|
-
_this.component = component;
|
|
2205
|
-
return _this;
|
|
2174
|
+
return _super.call(this, props);
|
|
2206
2175
|
}
|
|
2207
2176
|
|
|
2208
|
-
_createClass(
|
|
2209
|
-
key: "
|
|
2210
|
-
value: function
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
}
|
|
2215
|
-
}, {
|
|
2216
|
-
key: "_updateFeatureNode",
|
|
2217
|
-
value: function _updateFeatureNode(feature) {
|
|
2218
|
-
this.renderDom(feature.content, this.getNode(feature));
|
|
2177
|
+
_createClass(SelectedPolySymbol, [{
|
|
2178
|
+
key: "getShadow",
|
|
2179
|
+
value: function getShadow(coordinates, feature) {
|
|
2180
|
+
if (feature.isSelected) {
|
|
2181
|
+
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2182
|
+
}
|
|
2219
2183
|
}
|
|
2220
2184
|
}, {
|
|
2221
|
-
key: "
|
|
2222
|
-
value: function
|
|
2223
|
-
|
|
2224
|
-
return;
|
|
2225
|
-
}
|
|
2185
|
+
key: "getPolyRender",
|
|
2186
|
+
value: function getPolyRender(coordinates, feature) {
|
|
2187
|
+
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2226
2188
|
|
|
2227
|
-
|
|
2189
|
+
if (feature.isSelected) {
|
|
2190
|
+
polyRender.fillColor = this.selectedFillColor;
|
|
2191
|
+
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2228
2192
|
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
}), node);
|
|
2233
|
-
} else {
|
|
2234
|
-
node.innerText = content;
|
|
2193
|
+
if (this.selectedStrokeWidth !== void 0) {
|
|
2194
|
+
polyRender.strokeWidth = this.selectedStrokeWidth;
|
|
2195
|
+
}
|
|
2235
2196
|
}
|
|
2197
|
+
|
|
2198
|
+
return polyRender;
|
|
2236
2199
|
}
|
|
2237
2200
|
}]);
|
|
2238
2201
|
|
|
2239
|
-
return
|
|
2240
|
-
}(
|
|
2202
|
+
return SelectedPolySymbol;
|
|
2203
|
+
}(ShadowedPolySymbol);
|
|
2241
2204
|
|
|
2242
|
-
const
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2205
|
+
const selectedPoint = /*#__PURE__*/new SelectedPointSymbol({
|
|
2206
|
+
size: 8,
|
|
2207
|
+
strokeWidth: 2,
|
|
2208
|
+
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2209
|
+
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2210
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2211
|
+
shadowSize: 3,
|
|
2212
|
+
selectedStrokeColor: '#ff5722',
|
|
2213
|
+
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2214
|
+
});
|
|
2215
|
+
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2216
|
+
strokeWidth: 6,
|
|
2217
|
+
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2218
|
+
shadowSize: 8,
|
|
2219
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2220
|
+
selectedStrokeColor: '#ff5722',
|
|
2221
|
+
selectedStrokeWidth: 2
|
|
2222
|
+
});
|
|
2223
|
+
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2224
|
+
strokeWidth: 2,
|
|
2225
|
+
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2226
|
+
shadowSize: 8,
|
|
2227
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2228
|
+
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2229
|
+
enclose: true,
|
|
2230
|
+
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2231
|
+
selectedStrokeColor: '#ff5722'
|
|
2232
|
+
});
|
|
2267
2233
|
|
|
2268
|
-
|
|
2234
|
+
const metersToPixels = (meters, _ref) => {
|
|
2269
2235
|
let {
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
shadowSize,
|
|
2273
|
-
size = 6
|
|
2236
|
+
painter,
|
|
2237
|
+
crs = Crs.geo
|
|
2274
2238
|
} = _ref;
|
|
2275
|
-
const
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
let {
|
|
2285
|
-
strokeColor,
|
|
2286
|
-
strokeWidth,
|
|
2287
|
-
shadowColor,
|
|
2288
|
-
fillColor,
|
|
2289
|
-
shadowSize,
|
|
2290
|
-
size = 0
|
|
2291
|
-
} = _ref2;
|
|
2292
|
-
return [createShadowRender(position, {
|
|
2293
|
-
strokeWidth,
|
|
2294
|
-
strokeColor,
|
|
2295
|
-
shadowSize,
|
|
2296
|
-
shadowColor,
|
|
2297
|
-
size
|
|
2298
|
-
}), new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
2299
|
-
fillColor,
|
|
2300
|
-
strokeColor,
|
|
2301
|
-
strokeWidth,
|
|
2302
|
-
enclosed: true
|
|
2303
|
-
})];
|
|
2304
|
-
}
|
|
2239
|
+
const {
|
|
2240
|
+
width
|
|
2241
|
+
} = painter;
|
|
2242
|
+
const zeroPoint = painter.getPointFromPxPosition(0, 0).projectTo(crs);
|
|
2243
|
+
const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
|
|
2244
|
+
const widthDistance = geotools.distance(zeroPoint, maxWidthPoint);
|
|
2245
|
+
const pxK = width / (widthDistance || 1);
|
|
2246
|
+
return Math.round(meters * pxK);
|
|
2247
|
+
};
|
|
2305
2248
|
|
|
2306
|
-
|
|
2307
|
-
|
|
2249
|
+
const defaultPathStyles = {
|
|
2250
|
+
strokeWidth: 2,
|
|
2251
|
+
strokeColor: 'rgb(0, 163, 245)',
|
|
2252
|
+
fillStyle: Poly.FillStyle.None
|
|
2253
|
+
};
|
|
2254
|
+
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2255
|
+
_inherits(SVGPoly, _Symbol);
|
|
2308
2256
|
|
|
2309
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
2257
|
+
var _super = /*#__PURE__*/_createSuper(SVGPoly);
|
|
2310
2258
|
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
_classCallCheck(this, ShadowedPointSymbol);
|
|
2259
|
+
function SVGPoly(_temp) {
|
|
2260
|
+
var _this;
|
|
2314
2261
|
|
|
2315
|
-
|
|
2262
|
+
let {
|
|
2263
|
+
redrawFeatureNode,
|
|
2264
|
+
pathStyles,
|
|
2265
|
+
circle,
|
|
2266
|
+
className,
|
|
2267
|
+
appendToSvg
|
|
2268
|
+
} = _temp === void 0 ? {} : _temp;
|
|
2269
|
+
|
|
2270
|
+
_classCallCheck(this, SVGPoly);
|
|
2271
|
+
|
|
2272
|
+
_this = _super.call(this);
|
|
2273
|
+
_this.container = document.createElement('div');
|
|
2274
|
+
_this.container.style.position = 'absolute';
|
|
2275
|
+
_this.redrawFeatureNode = redrawFeatureNode;
|
|
2276
|
+
_this.pathStyles = _extends({
|
|
2277
|
+
center: [0, 0],
|
|
2278
|
+
fillColor: 'none'
|
|
2279
|
+
}, pathStyles);
|
|
2280
|
+
_this.circle = circle;
|
|
2281
|
+
_this.className = className;
|
|
2282
|
+
_this.appendToSvg = appendToSvg;
|
|
2283
|
+
return _this;
|
|
2316
2284
|
}
|
|
2317
2285
|
|
|
2318
|
-
_createClass(
|
|
2286
|
+
_createClass(SVGPoly, [{
|
|
2319
2287
|
key: "renderFunction",
|
|
2320
2288
|
value: function renderFunction(feature, resolution, crs) {
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2289
|
+
const coordinates = feature instanceof Poly$1.Poly ? new PolylineSymbol.PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2290
|
+
this.setCirclePxRaius(crs);
|
|
2291
|
+
this.container.innerHTML = '';
|
|
2292
|
+
const svg = this.setSvg(coordinates);
|
|
2293
|
+
svg && this.container.append(svg);
|
|
2294
|
+
feature.__dynamicSymbolRender = new Render.DynamicRender({
|
|
2295
|
+
node: this.container,
|
|
2296
|
+
update: (bbox, resolution) => this.update({
|
|
2297
|
+
bbox,
|
|
2298
|
+
resolution,
|
|
2299
|
+
feature,
|
|
2300
|
+
crs
|
|
2301
|
+
}),
|
|
2302
|
+
redraw: () => {
|
|
2303
|
+
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2304
|
+
}
|
|
2305
|
+
});
|
|
2306
|
+
|
|
2307
|
+
this._setEventListeners(feature);
|
|
2308
|
+
|
|
2309
|
+
return [feature.__dynamicSymbolRender];
|
|
2329
2310
|
}
|
|
2330
2311
|
}, {
|
|
2331
|
-
key: "
|
|
2332
|
-
value: function
|
|
2333
|
-
|
|
2312
|
+
key: "setCirclePxRaius",
|
|
2313
|
+
value: function setCirclePxRaius(crs) {
|
|
2314
|
+
if (this.circle && this.pathStyles) {
|
|
2315
|
+
var _this$circle;
|
|
2316
|
+
|
|
2317
|
+
this.pathStyles.radius = metersToPixels(this.circle.radius, {
|
|
2318
|
+
painter: this.circle.painter,
|
|
2319
|
+
crs
|
|
2320
|
+
}) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
|
|
2321
|
+
}
|
|
2334
2322
|
}
|
|
2335
2323
|
}, {
|
|
2336
|
-
key: "
|
|
2337
|
-
value: function
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
}], [{
|
|
2341
|
-
key: "getShadowArc",
|
|
2342
|
-
value: function getShadowArc(position, _ref) {
|
|
2324
|
+
key: "update",
|
|
2325
|
+
value: function update(_ref) {
|
|
2326
|
+
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2327
|
+
|
|
2343
2328
|
let {
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2329
|
+
bbox,
|
|
2330
|
+
resolution,
|
|
2331
|
+
feature,
|
|
2332
|
+
crs
|
|
2348
2333
|
} = _ref;
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2334
|
+
if (!feature) return;
|
|
2335
|
+
if (!bbox) bbox = feature.__lastBbox;
|
|
2336
|
+
if (!resolution) resolution = feature.__lastResolution;
|
|
2337
|
+
if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
|
|
2338
|
+
|
|
2339
|
+
if (feature.__lastResolution && resolution !== feature.__lastResolution) {
|
|
2340
|
+
const newCoordinates = feature instanceof Poly$1.Poly ? new PolylineSymbol.PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2341
|
+
this.setCirclePxRaius(crs);
|
|
2342
|
+
this.container.innerHTML = '';
|
|
2343
|
+
const svg = this.setSvg(newCoordinates);
|
|
2344
|
+
svg && this.container.append(svg);
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
const polygon = feature.projectTo(bbox.crs);
|
|
2348
|
+
const radiusOffset = (_this$pathStyles = this.pathStyles) != null && _this$pathStyles.radius ? ((_this$pathStyles2 = this.pathStyles) == null ? void 0 : _this$pathStyles2.radius) + ((_this$pathStyles3 = this.pathStyles) != null && _this$pathStyles3.strokeWidth ? ((_this$pathStyles4 = this.pathStyles) == null ? void 0 : _this$pathStyles4.strokeWidth) / 2 : 0) : 0;
|
|
2349
|
+
const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
|
|
2350
|
+
const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
|
|
2351
|
+
this.container.style.left = dx.toString() + "px";
|
|
2352
|
+
this.container.style.top = dy.toString() + "px";
|
|
2353
|
+
feature.__lastBbox = bbox;
|
|
2354
|
+
feature.__lastResolution = resolution;
|
|
2355
2355
|
}
|
|
2356
2356
|
}, {
|
|
2357
|
-
key: "
|
|
2358
|
-
value: function
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
});
|
|
2371
|
-
}
|
|
2372
|
-
}, {
|
|
2373
|
-
key: "getArcs",
|
|
2374
|
-
value: function getArcs(position, params) {
|
|
2375
|
-
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2376
|
-
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2377
|
-
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2378
|
-
}
|
|
2379
|
-
}]);
|
|
2380
|
-
|
|
2381
|
-
return ShadowedPointSymbol;
|
|
2382
|
-
}(Point.PointSymbol);
|
|
2383
|
-
|
|
2384
|
-
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2385
|
-
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2386
|
-
|
|
2387
|
-
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2388
|
-
|
|
2389
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2390
|
-
function ShadowedPolySymbol(options) {
|
|
2391
|
-
_classCallCheck(this, ShadowedPolySymbol);
|
|
2392
|
-
|
|
2393
|
-
return _super.call(this, options);
|
|
2394
|
-
}
|
|
2395
|
-
|
|
2396
|
-
_createClass(ShadowedPolySymbol, [{
|
|
2397
|
-
key: "renderFunction",
|
|
2398
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2399
|
-
if (!(feature instanceof Poly$1.Poly)) return [];
|
|
2400
|
-
|
|
2401
|
-
const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
|
|
2402
|
-
|
|
2403
|
-
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2404
|
-
const shadowRender = this.getShadow(coordinates, feature);
|
|
2405
|
-
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2406
|
-
let renders = [polyRender];
|
|
2357
|
+
key: "setSvg",
|
|
2358
|
+
value: function setSvg(coordinates) {
|
|
2359
|
+
const {
|
|
2360
|
+
lineCap,
|
|
2361
|
+
lineJoin,
|
|
2362
|
+
miterLimit,
|
|
2363
|
+
lineDash,
|
|
2364
|
+
dashOffset
|
|
2365
|
+
} = this.pathStyles || {};
|
|
2366
|
+
const svgRender = new SvgRender.SvgRender(_extends({
|
|
2367
|
+
coordinates
|
|
2368
|
+
}, defaultPathStyles, {
|
|
2369
|
+
appendToSvg: this.appendToSvg
|
|
2370
|
+
}, this.pathStyles));
|
|
2407
2371
|
|
|
2408
|
-
if (
|
|
2409
|
-
|
|
2372
|
+
if (this.circle) {
|
|
2373
|
+
svgRender._setArcNode();
|
|
2374
|
+
} else {
|
|
2375
|
+
svgRender._setPolyNode();
|
|
2410
2376
|
}
|
|
2411
2377
|
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2378
|
+
let svgElement;
|
|
2379
|
+
svgRender.getNode((_, svg) => {
|
|
2380
|
+
svgElement = svg;
|
|
2381
|
+
this.className && svgElement.classList.add(this.className);
|
|
2382
|
+
const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
|
|
2415
2383
|
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
lineDash: this.lineDash
|
|
2384
|
+
if (path) {
|
|
2385
|
+
path.setAttribute('stroke-linecap', lineCap || 'round');
|
|
2386
|
+
path.setAttribute('stroke-linejoin', lineJoin || 'round');
|
|
2387
|
+
path.setAttribute('stroke-miterlimit', (miterLimit || 10).toString());
|
|
2388
|
+
path.setAttribute('stroke-dashoffset', (dashOffset || 0).toString());
|
|
2389
|
+
|
|
2390
|
+
if (this.circle) {
|
|
2391
|
+
path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2427
2394
|
});
|
|
2395
|
+
return svgElement;
|
|
2428
2396
|
}
|
|
2429
2397
|
}, {
|
|
2430
|
-
key: "
|
|
2431
|
-
value: function
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2398
|
+
key: "_setEventListeners",
|
|
2399
|
+
value: function _setEventListeners(dynamicFeature) {
|
|
2400
|
+
var _dynamicFeature$__dyn;
|
|
2401
|
+
|
|
2402
|
+
if (dynamicFeature.eventFlags === EventHandler.MouseEventFlags.None) return;
|
|
2403
|
+
const svgNode = dynamicFeature == null ? void 0 : (_dynamicFeature$__dyn = dynamicFeature.__dynamicSymbolRender) == null ? void 0 : _dynamicFeature$__dyn.node.querySelector(this.circle ? 'circle' : 'path');
|
|
2404
|
+
Object.keys(EventHandler.mouseEvents).forEach(eventName => {
|
|
2405
|
+
if (dynamicFeature.eventFlags & EventHandler.mouseEvents[eventName].flag) {
|
|
2406
|
+
domEvent.listenDomEvent(svgNode, EventHandler.mouseEvents[eventName].type, event => {
|
|
2407
|
+
dynamicFeature.fire(EventHandler.mouseEvents[eventName].type, {
|
|
2408
|
+
node: svgNode,
|
|
2409
|
+
browserEvent: event
|
|
2410
|
+
});
|
|
2411
|
+
});
|
|
2412
|
+
}
|
|
2439
2413
|
});
|
|
2440
2414
|
}
|
|
2441
|
-
}, {
|
|
2442
|
-
key: "getVertexRenders",
|
|
2443
|
-
value: function getVertexRenders(coordinates) {
|
|
2444
|
-
if (!this.showVertex) return;
|
|
2445
|
-
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2446
|
-
return acc.concat(curr);
|
|
2447
|
-
}, []);
|
|
2448
|
-
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2449
|
-
size: 6,
|
|
2450
|
-
strokeWidth: 2,
|
|
2451
|
-
shadowColor: this.shadowColor,
|
|
2452
|
-
strokeColor: this.strokeColor,
|
|
2453
|
-
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2454
|
-
fillColor: '#ffffff'
|
|
2455
|
-
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2456
|
-
}
|
|
2457
2415
|
}]);
|
|
2458
2416
|
|
|
2459
|
-
return
|
|
2460
|
-
}(
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2417
|
+
return SVGPoly;
|
|
2418
|
+
}(_Symbol.Symbol);
|
|
2419
|
+
|
|
2420
|
+
function isSGisPointSymbol(symbol) {
|
|
2421
|
+
return symbol instanceof Point.PointSymbol || symbol instanceof StaticImageSymbol.StaticImageSymbol || symbol instanceof Square.SquareSymbol || symbol instanceof MaskedImage.MaskedImage;
|
|
2422
|
+
}
|
|
2423
|
+
function isSGisImageSymbol(symbol) {
|
|
2424
|
+
return symbol instanceof StaticImageSymbol.StaticImageSymbol || symbol instanceof MaskedImage.MaskedImage;
|
|
2425
|
+
}
|
|
2426
|
+
function isSGisPolygonSymbol(symbol) {
|
|
2427
|
+
return symbol instanceof Simple.PolygonSymbol || symbol instanceof BrushFill.BrushFill || symbol instanceof ImageFill.ImageFill;
|
|
2428
|
+
}
|
|
2429
|
+
function isSGisPolylineSymbol(symbol) {
|
|
2430
|
+
return symbol instanceof PolylineSymbol.PolylineSymbol;
|
|
2431
|
+
}
|
|
2432
|
+
function isSGisH3Symbol(symbol) {
|
|
2433
|
+
return symbol instanceof H3Symbol.H3Symbol;
|
|
2434
|
+
}
|
|
2435
|
+
function isSGisClusterSymbol(symbol) {
|
|
2436
|
+
return !!symbol.singleObjectSymbol;
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
/**
|
|
2440
|
+
* Моки фич для отображения превью символа
|
|
2441
|
+
* http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
|
|
2442
|
+
*/
|
|
2443
|
+
|
|
2444
|
+
const viewBoxSize = 100;
|
|
2445
|
+
const pointFeature = /*#__PURE__*/new PointFeature.PointFeature([50, -50], {
|
|
2446
|
+
crs: Crs.plain
|
|
2447
|
+
});
|
|
2448
|
+
const lineFeature = /*#__PURE__*/new Polyline.Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2449
|
+
crs: Crs.plain
|
|
2450
|
+
});
|
|
2451
|
+
const polygonFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
|
|
2452
|
+
crs: Crs.plain
|
|
2453
|
+
});
|
|
2454
|
+
const h3gridFeature = /*#__PURE__*/new H3Feature.H3Feature([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2455
|
+
crs: Crs.plain
|
|
2456
|
+
});
|
|
2457
|
+
const lineLegendFeature = /*#__PURE__*/new Polyline.Polyline([[0, -50], [100, -50]], {
|
|
2458
|
+
crs: Crs.plain
|
|
2459
|
+
});
|
|
2460
|
+
const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
|
|
2461
|
+
crs: Crs.plain
|
|
2462
|
+
});
|
|
2463
|
+
const polygonMapLegendFeature = /*#__PURE__*/new Polygon.Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2464
|
+
crs: Crs.plain
|
|
2465
|
+
});
|
|
2466
|
+
const MAP_LEGEND_FEATURES = {
|
|
2467
|
+
polygon: polygonMapLegendFeature
|
|
2466
2468
|
};
|
|
2467
|
-
const
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2469
|
+
const LEGEND_FEATURES = {
|
|
2470
|
+
point: pointFeature,
|
|
2471
|
+
polyline: lineLegendFeature,
|
|
2472
|
+
polygon: polygonLegendFeature,
|
|
2473
|
+
h3grid: h3gridFeature
|
|
2471
2474
|
};
|
|
2472
|
-
const
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2478
|
-
enclose: true,
|
|
2479
|
-
showVertex: true
|
|
2480
|
-
}));
|
|
2481
|
-
const snapSymbolParams = {
|
|
2482
|
-
size: 10,
|
|
2483
|
-
strokeWidth: 2,
|
|
2484
|
-
strokeColor: '#e33600',
|
|
2485
|
-
fillColor: '#ffffff',
|
|
2486
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2487
|
-
shadowSize: 3
|
|
2475
|
+
const MOCK_FEATURES = {
|
|
2476
|
+
point: pointFeature,
|
|
2477
|
+
polyline: lineFeature,
|
|
2478
|
+
polygon: polygonFeature,
|
|
2479
|
+
h3grid: h3gridFeature
|
|
2488
2480
|
};
|
|
2489
|
-
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2490
|
-
strokeColor: '#ff6933',
|
|
2491
|
-
shadowSize: 0
|
|
2492
|
-
}));
|
|
2493
2481
|
|
|
2494
|
-
|
|
2495
|
-
|
|
2482
|
+
function getSymbolRenders(symbol, size, features) {
|
|
2483
|
+
if (size === void 0) {
|
|
2484
|
+
size = viewBoxSize;
|
|
2485
|
+
}
|
|
2496
2486
|
|
|
2497
|
-
|
|
2487
|
+
if (features === void 0) {
|
|
2488
|
+
features = {};
|
|
2489
|
+
}
|
|
2498
2490
|
|
|
2499
|
-
|
|
2500
|
-
function SelectedPointSymbol(props) {
|
|
2501
|
-
_classCallCheck(this, SelectedPointSymbol);
|
|
2491
|
+
const resolution = viewBoxSize / size;
|
|
2502
2492
|
|
|
2503
|
-
|
|
2493
|
+
const featuresToRender = _extends({}, MOCK_FEATURES, features);
|
|
2494
|
+
|
|
2495
|
+
if (isSGisPolygonSymbol(symbol)) {
|
|
2496
|
+
return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, Crs.plain);
|
|
2504
2497
|
}
|
|
2505
2498
|
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
if (feature.isSelected) {
|
|
2510
|
-
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
}, {
|
|
2514
|
-
key: "getPoint",
|
|
2515
|
-
value: function getPoint(position, feature) {
|
|
2516
|
-
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2499
|
+
if (isSGisPolylineSymbol(symbol)) {
|
|
2500
|
+
return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, Crs.plain);
|
|
2501
|
+
}
|
|
2517
2502
|
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
}
|
|
2522
|
-
|
|
2523
|
-
return pointRender;
|
|
2524
|
-
}
|
|
2525
|
-
}]);
|
|
2526
|
-
|
|
2527
|
-
return SelectedPointSymbol;
|
|
2528
|
-
}(ShadowedPointSymbol);
|
|
2529
|
-
|
|
2530
|
-
let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
|
|
2531
|
-
_inherits(SelectedPolySymbol, _ShadowedPolySymbol);
|
|
2532
|
-
|
|
2533
|
-
var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
|
|
2503
|
+
if (isSGisH3Symbol(symbol)) {
|
|
2504
|
+
return symbol.renderFunctionAsync(featuresToRender.h3grid, resolution, Crs.plain);
|
|
2505
|
+
}
|
|
2534
2506
|
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2507
|
+
return symbol.renderFunctionAsync(featuresToRender.point, resolution, Crs.plain);
|
|
2508
|
+
}
|
|
2509
|
+
const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
|
|
2510
|
+
if (size === void 0) {
|
|
2511
|
+
size = viewBoxSize;
|
|
2512
|
+
}
|
|
2538
2513
|
|
|
2539
|
-
|
|
2514
|
+
return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
|
|
2515
|
+
};
|
|
2516
|
+
const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
|
|
2517
|
+
if (size === void 0) {
|
|
2518
|
+
size = viewBoxSize;
|
|
2540
2519
|
}
|
|
2541
2520
|
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
value: function getShadow(coordinates, feature) {
|
|
2545
|
-
if (feature.isSelected) {
|
|
2546
|
-
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2547
|
-
}
|
|
2548
|
-
}
|
|
2549
|
-
}, {
|
|
2550
|
-
key: "getPolyRender",
|
|
2551
|
-
value: function getPolyRender(coordinates, feature) {
|
|
2552
|
-
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2521
|
+
return getSymbolRenders(symbol, size, LEGEND_FEATURES);
|
|
2522
|
+
};
|
|
2553
2523
|
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2524
|
+
function renderSymbolToCanvas(renders, canvas) {
|
|
2525
|
+
renders.forEach(render => {
|
|
2526
|
+
canvas.draw(render);
|
|
2527
|
+
});
|
|
2528
|
+
}
|
|
2557
2529
|
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2530
|
+
function deserializeSymbol(symbol) {
|
|
2531
|
+
switch (symbol.type) {
|
|
2532
|
+
case "h3grid":
|
|
2533
|
+
return deserializeH3Symbol(symbol);
|
|
2562
2534
|
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
}]);
|
|
2535
|
+
case "svgPointSymbol":
|
|
2536
|
+
return deserializeSvgPointSymbol(symbol);
|
|
2566
2537
|
|
|
2567
|
-
|
|
2568
|
-
|
|
2538
|
+
case 'circlePointSymbol':
|
|
2539
|
+
return deserializePointSymbol(symbol);
|
|
2569
2540
|
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
strokeWidth: 2,
|
|
2573
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2574
|
-
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2575
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2576
|
-
shadowSize: 3,
|
|
2577
|
-
selectedStrokeColor: '#ff5722',
|
|
2578
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2579
|
-
});
|
|
2580
|
-
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2581
|
-
strokeWidth: 6,
|
|
2582
|
-
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2583
|
-
shadowSize: 8,
|
|
2584
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2585
|
-
selectedStrokeColor: '#ff5722',
|
|
2586
|
-
selectedStrokeWidth: 2
|
|
2587
|
-
});
|
|
2588
|
-
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2589
|
-
strokeWidth: 2,
|
|
2590
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2591
|
-
shadowSize: 8,
|
|
2592
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2593
|
-
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2594
|
-
enclose: true,
|
|
2595
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2596
|
-
selectedStrokeColor: '#ff5722'
|
|
2597
|
-
});
|
|
2541
|
+
case 'squarePointSymbol':
|
|
2542
|
+
return deserializeSquareSymbol(symbol);
|
|
2598
2543
|
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
strokeColor: 'rgb(0, 163, 245)',
|
|
2602
|
-
fillStyle: Poly.FillStyle.None
|
|
2603
|
-
};
|
|
2604
|
-
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2605
|
-
_inherits(SVGPoly, _Symbol);
|
|
2544
|
+
case 'maskedImagePointSymbol':
|
|
2545
|
+
return deserializeMaskedImageSymbol(symbol);
|
|
2606
2546
|
|
|
2607
|
-
|
|
2547
|
+
case 'imagePointSymbol':
|
|
2548
|
+
return deserializeImagePointSymbol(symbol);
|
|
2608
2549
|
|
|
2609
|
-
|
|
2610
|
-
|
|
2550
|
+
case 'polygonSymbol':
|
|
2551
|
+
return deserializePolygonSymbol(symbol);
|
|
2611
2552
|
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
circle,
|
|
2616
|
-
className,
|
|
2617
|
-
appendToSvg
|
|
2618
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2553
|
+
case 'simplePolylineSymbol':
|
|
2554
|
+
case 'polylineSymbol':
|
|
2555
|
+
return deserializePolylineSymbol(symbol);
|
|
2619
2556
|
|
|
2620
|
-
|
|
2557
|
+
case "clusterSymbol":
|
|
2558
|
+
return deserializeSymbol(symbol.singleObjectSymbol);
|
|
2621
2559
|
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
_this.container.style.position = 'absolute';
|
|
2625
|
-
_this.redrawFeatureNode = redrawFeatureNode;
|
|
2626
|
-
_this.pathStyles = _extends({
|
|
2627
|
-
center: [0, 0],
|
|
2628
|
-
fillColor: 'none'
|
|
2629
|
-
}, pathStyles);
|
|
2630
|
-
_this.circle = circle;
|
|
2631
|
-
_this.className = className;
|
|
2632
|
-
_this.appendToSvg = appendToSvg;
|
|
2633
|
-
return _this;
|
|
2560
|
+
default:
|
|
2561
|
+
return null;
|
|
2634
2562
|
}
|
|
2563
|
+
}
|
|
2635
2564
|
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2639
|
-
const coordinates = feature instanceof Poly$1.Poly ? new PolylineSymbol.PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2640
|
-
this.setCirclePxRaius(crs);
|
|
2641
|
-
this.container.innerHTML = '';
|
|
2642
|
-
const svg = this.setSvg(coordinates);
|
|
2643
|
-
svg && this.container.append(svg);
|
|
2644
|
-
feature.__dynamicSymbolRender = new Render.DynamicRender({
|
|
2645
|
-
node: this.container,
|
|
2646
|
-
update: (bbox, resolution) => this.update({
|
|
2647
|
-
bbox,
|
|
2648
|
-
resolution,
|
|
2649
|
-
feature,
|
|
2650
|
-
crs
|
|
2651
|
-
}),
|
|
2652
|
-
redraw: () => {
|
|
2653
|
-
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2654
|
-
}
|
|
2655
|
-
});
|
|
2565
|
+
function deserializeH3Symbol(symbol) {
|
|
2566
|
+
var _symbol$stroke, _symbol$stroke2, _symbol$fill;
|
|
2656
2567
|
|
|
2657
|
-
|
|
2568
|
+
return new H3Symbol.H3Symbol(_extends({}, symbol, {
|
|
2569
|
+
cellSize: getParameterValue(symbol.cellSize),
|
|
2570
|
+
strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
|
|
2571
|
+
strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
|
|
2572
|
+
fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
|
|
2573
|
+
}));
|
|
2574
|
+
}
|
|
2658
2575
|
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
value: function setCirclePxRaius(crs) {
|
|
2664
|
-
if (this.circle && this.pathStyles) {
|
|
2665
|
-
var _this$circle;
|
|
2576
|
+
function deserializePointSymbol(symbol) {
|
|
2577
|
+
// @ts-ignore
|
|
2578
|
+
return new Point.PointSymbol(deserializePointSymbolParams(symbol));
|
|
2579
|
+
}
|
|
2666
2580
|
|
|
2667
|
-
|
|
2668
|
-
painter: this.circle.painter,
|
|
2669
|
-
crs
|
|
2670
|
-
}) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
}, {
|
|
2674
|
-
key: "update",
|
|
2675
|
-
value: function update(_ref) {
|
|
2676
|
-
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2581
|
+
const getOffsetParameterValue = offset => [getParameterValue(offset == null ? void 0 : offset[0]), getParameterValue(offset == null ? void 0 : offset[1])];
|
|
2677
2582
|
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2583
|
+
function deserializeSvgPointSymbolParams(_ref) {
|
|
2584
|
+
let {
|
|
2585
|
+
type,
|
|
2586
|
+
data,
|
|
2587
|
+
size,
|
|
2588
|
+
offset,
|
|
2589
|
+
angle,
|
|
2590
|
+
background,
|
|
2591
|
+
figure
|
|
2592
|
+
} = _ref;
|
|
2593
|
+
return _extends({
|
|
2594
|
+
type: getParameterValue(type),
|
|
2595
|
+
data: getParameterValue(data),
|
|
2596
|
+
size: getParameterValue(size),
|
|
2597
|
+
offset: getOffsetParameterValue(offset),
|
|
2598
|
+
angle: getParameterValue(angle)
|
|
2599
|
+
}, background ? {
|
|
2600
|
+
background: _extends({}, background, {
|
|
2601
|
+
fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
|
|
2602
|
+
strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
|
|
2603
|
+
strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
|
|
2604
|
+
})
|
|
2605
|
+
} : {}, figure ? {
|
|
2606
|
+
figure: _extends({}, figure, {
|
|
2607
|
+
fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
|
|
2608
|
+
})
|
|
2609
|
+
} : {});
|
|
2610
|
+
}
|
|
2688
2611
|
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
this.container.innerHTML = '';
|
|
2693
|
-
const svg = this.setSvg(newCoordinates);
|
|
2694
|
-
svg && this.container.append(svg);
|
|
2695
|
-
}
|
|
2612
|
+
function deserializeSvgPointSymbol(symbol) {
|
|
2613
|
+
return new Point.PointSymbol(deserializeSvgPointSymbolParams(symbol));
|
|
2614
|
+
}
|
|
2696
2615
|
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
feature.__lastBbox = bbox;
|
|
2704
|
-
feature.__lastResolution = resolution;
|
|
2705
|
-
}
|
|
2706
|
-
}, {
|
|
2707
|
-
key: "setSvg",
|
|
2708
|
-
value: function setSvg(coordinates) {
|
|
2709
|
-
const {
|
|
2710
|
-
lineCap,
|
|
2711
|
-
lineJoin,
|
|
2712
|
-
miterLimit,
|
|
2713
|
-
lineDash,
|
|
2714
|
-
dashOffset
|
|
2715
|
-
} = this.pathStyles || {};
|
|
2716
|
-
const svgRender = new SvgRender.SvgRender(_extends({
|
|
2717
|
-
coordinates
|
|
2718
|
-
}, defaultPathStyles, {
|
|
2719
|
-
appendToSvg: this.appendToSvg
|
|
2720
|
-
}, this.pathStyles));
|
|
2721
|
-
|
|
2722
|
-
if (this.circle) {
|
|
2723
|
-
svgRender._setArcNode();
|
|
2724
|
-
} else {
|
|
2725
|
-
svgRender._setPolyNode();
|
|
2726
|
-
}
|
|
2727
|
-
|
|
2728
|
-
let svgElement;
|
|
2729
|
-
svgRender.getNode((_, svg) => {
|
|
2730
|
-
svgElement = svg;
|
|
2731
|
-
this.className && svgElement.classList.add(this.className);
|
|
2732
|
-
const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
|
|
2616
|
+
function deserializeSquareSymbol(symbol) {
|
|
2617
|
+
return new Square.SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
|
|
2618
|
+
// @ts-ignore
|
|
2619
|
+
angle: getParameterValue(symbol.angle)
|
|
2620
|
+
}));
|
|
2621
|
+
}
|
|
2733
2622
|
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2623
|
+
function deserializeMaskedImageSymbol(symbol) {
|
|
2624
|
+
return new MaskedImage.MaskedImage(_extends({}, symbol, {
|
|
2625
|
+
// @ts-ignore
|
|
2626
|
+
angle: getParameterValue(symbol.angle),
|
|
2627
|
+
// @ts-ignore
|
|
2628
|
+
width: getParameterValue(symbol.width),
|
|
2629
|
+
// @ts-ignore
|
|
2630
|
+
height: getParameterValue(symbol.height),
|
|
2631
|
+
// @ts-ignore
|
|
2632
|
+
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2633
|
+
// @ts-ignore
|
|
2634
|
+
imageSource: deserializeBase64(symbol.image),
|
|
2635
|
+
// @ts-ignore
|
|
2636
|
+
maskSource: deserializeBase64(symbol.imageMask),
|
|
2637
|
+
// @ts-ignore
|
|
2638
|
+
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2639
|
+
}));
|
|
2640
|
+
}
|
|
2739
2641
|
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2642
|
+
function deserializeImagePointSymbol(symbol) {
|
|
2643
|
+
return new StaticImageSymbol.StaticImageSymbol(_extends({}, symbol, {
|
|
2644
|
+
// @ts-ignore
|
|
2645
|
+
angle: getParameterValue(symbol.angle),
|
|
2646
|
+
// @ts-ignore
|
|
2647
|
+
width: getParameterValue(symbol.width),
|
|
2648
|
+
// @ts-ignore
|
|
2649
|
+
height: getParameterValue(symbol.height),
|
|
2650
|
+
// @ts-ignore
|
|
2651
|
+
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2652
|
+
// @ts-ignore
|
|
2653
|
+
source: deserializeBase64(symbol.image)
|
|
2654
|
+
}));
|
|
2655
|
+
}
|
|
2751
2656
|
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
domEvent.listenDomEvent(svgNode, EventHandler.mouseEvents[eventName].type, event => {
|
|
2757
|
-
dynamicFeature.fire(EventHandler.mouseEvents[eventName].type, {
|
|
2758
|
-
node: svgNode,
|
|
2759
|
-
browserEvent: event
|
|
2760
|
-
});
|
|
2761
|
-
});
|
|
2762
|
-
}
|
|
2763
|
-
});
|
|
2764
|
-
}
|
|
2765
|
-
}]);
|
|
2657
|
+
function deserializePolygonSymbol(symbol) {
|
|
2658
|
+
if (isPolygonHasPatternBrush(symbol)) {
|
|
2659
|
+
return new SGisImageFill(symbol);
|
|
2660
|
+
}
|
|
2766
2661
|
|
|
2767
|
-
|
|
2768
|
-
|
|
2662
|
+
if (isPolygonHasHatchBrush(symbol)) {
|
|
2663
|
+
return new SGisBrushFill(symbol);
|
|
2664
|
+
}
|
|
2769
2665
|
|
|
2770
|
-
|
|
2771
|
-
return symbol instanceof Point.PointSymbol || symbol instanceof StaticImageSymbol.StaticImageSymbol || symbol instanceof Square.SquareSymbol || symbol instanceof MaskedImage.MaskedImage;
|
|
2666
|
+
return new SGisPolygonSymbol(symbol);
|
|
2772
2667
|
}
|
|
2773
|
-
|
|
2774
|
-
|
|
2668
|
+
|
|
2669
|
+
function deserializePolylineSymbol(symbol) {
|
|
2670
|
+
return new SGisPolylineSymbol(symbol);
|
|
2775
2671
|
}
|
|
2776
|
-
|
|
2777
|
-
|
|
2672
|
+
|
|
2673
|
+
function deserializePointSymbolParams(_ref2) {
|
|
2674
|
+
let {
|
|
2675
|
+
size,
|
|
2676
|
+
offset,
|
|
2677
|
+
strokeColor,
|
|
2678
|
+
strokeWidth,
|
|
2679
|
+
fillColor
|
|
2680
|
+
} = _ref2;
|
|
2681
|
+
return {
|
|
2682
|
+
size: getParameterValue(size),
|
|
2683
|
+
offset: deserializeAnchor(offset),
|
|
2684
|
+
strokeWidth: getParameterValue(strokeWidth),
|
|
2685
|
+
strokeColor: deserializeColor(getParameterValue(strokeColor)),
|
|
2686
|
+
fillColor: deserializeColor(getParameterValue(fillColor))
|
|
2687
|
+
};
|
|
2778
2688
|
}
|
|
2779
|
-
|
|
2780
|
-
|
|
2689
|
+
|
|
2690
|
+
function deserializeBase64(base) {
|
|
2691
|
+
return "data:image/png;base64," + base;
|
|
2781
2692
|
}
|
|
2782
|
-
|
|
2783
|
-
|
|
2693
|
+
|
|
2694
|
+
function deserializeAnchor(offset) {
|
|
2695
|
+
// @ts-ignore
|
|
2696
|
+
return offset.map(getParameterValue);
|
|
2784
2697
|
}
|
|
2785
|
-
|
|
2786
|
-
|
|
2698
|
+
|
|
2699
|
+
function deserializeColor(color$1) {
|
|
2700
|
+
return color$1 ? new color.Color(color$1).toString() : null;
|
|
2787
2701
|
}
|
|
2788
2702
|
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2703
|
+
const clampSymbol = (symbol, min, max) => {
|
|
2704
|
+
if (isSGisImageSymbol(symbol)) {
|
|
2705
|
+
symbol.width = clamp(symbol.width, min, max);
|
|
2706
|
+
symbol.height = clamp(symbol.height, min, max);
|
|
2707
|
+
} else if (isSGisPointSymbol(symbol)) {
|
|
2708
|
+
symbol.size = clamp(symbol.size, min, max);
|
|
2709
|
+
}
|
|
2793
2710
|
|
|
2794
|
-
|
|
2795
|
-
const pointFeature = /*#__PURE__*/new PointFeature.PointFeature([50, -50], {
|
|
2796
|
-
crs: Crs.plain
|
|
2797
|
-
});
|
|
2798
|
-
const lineFeature = /*#__PURE__*/new Polyline.Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2799
|
-
crs: Crs.plain
|
|
2800
|
-
});
|
|
2801
|
-
const polygonFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
|
|
2802
|
-
crs: Crs.plain
|
|
2803
|
-
});
|
|
2804
|
-
const h3gridFeature = /*#__PURE__*/new H3Feature.H3Feature([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2805
|
-
crs: Crs.plain
|
|
2806
|
-
});
|
|
2807
|
-
const lineLegendFeature = /*#__PURE__*/new Polyline.Polyline([[0, -50], [100, -50]], {
|
|
2808
|
-
crs: Crs.plain
|
|
2809
|
-
});
|
|
2810
|
-
const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
|
|
2811
|
-
crs: Crs.plain
|
|
2812
|
-
});
|
|
2813
|
-
const polygonMapLegendFeature = /*#__PURE__*/new Polygon.Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2814
|
-
crs: Crs.plain
|
|
2815
|
-
});
|
|
2816
|
-
const MAP_LEGEND_FEATURES = {
|
|
2817
|
-
polygon: polygonMapLegendFeature
|
|
2818
|
-
};
|
|
2819
|
-
const LEGEND_FEATURES = {
|
|
2820
|
-
point: pointFeature,
|
|
2821
|
-
polyline: lineLegendFeature,
|
|
2822
|
-
polygon: polygonLegendFeature,
|
|
2823
|
-
h3grid: h3gridFeature
|
|
2711
|
+
return symbol;
|
|
2824
2712
|
};
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2713
|
+
function centerAlignSymbol(symbol) {
|
|
2714
|
+
if (isSGisImageSymbol(symbol)) {
|
|
2715
|
+
symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
|
|
2716
|
+
} else if (isSGisPointSymbol(symbol)) {
|
|
2717
|
+
symbol.offset = [0, 0];
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
return symbol;
|
|
2721
|
+
}
|
|
2722
|
+
const adjustSymbol = (symbol, _ref) => {
|
|
2723
|
+
let {
|
|
2724
|
+
size
|
|
2725
|
+
} = _ref;
|
|
2726
|
+
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
2830
2727
|
};
|
|
2831
2728
|
|
|
2832
|
-
function
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
}
|
|
2729
|
+
let EvergisFeature = /*#__PURE__*/function () {
|
|
2730
|
+
function EvergisFeature(feature) {
|
|
2731
|
+
_classCallCheck(this, EvergisFeature);
|
|
2836
2732
|
|
|
2837
|
-
|
|
2838
|
-
|
|
2733
|
+
this.id = null;
|
|
2734
|
+
this.displayName = null;
|
|
2735
|
+
this.geometry = null;
|
|
2736
|
+
this.layerName = null;
|
|
2737
|
+
this.layerAlias = null;
|
|
2738
|
+
this.attributes = null;
|
|
2739
|
+
this.symbol = null;
|
|
2740
|
+
this.id = feature.id;
|
|
2741
|
+
this.displayName = feature.id;
|
|
2742
|
+
this.geometry = feature.geometry;
|
|
2743
|
+
this.layerName = feature.layer;
|
|
2744
|
+
this.layerAlias = feature.layer;
|
|
2745
|
+
this.attributes = getFeatureAttributes(feature.attributes);
|
|
2839
2746
|
}
|
|
2840
2747
|
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2748
|
+
_createClass(EvergisFeature, [{
|
|
2749
|
+
key: "sGisFeature",
|
|
2750
|
+
value: function sGisFeature() {
|
|
2751
|
+
if (!this.geometry || !this.symbol) {
|
|
2752
|
+
return null;
|
|
2753
|
+
} // @ts-ignore
|
|
2844
2754
|
|
|
2845
|
-
if (isSGisPolygonSymbol(symbol)) {
|
|
2846
|
-
return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, Crs.plain);
|
|
2847
|
-
}
|
|
2848
2755
|
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2756
|
+
const {
|
|
2757
|
+
type,
|
|
2758
|
+
coordinates,
|
|
2759
|
+
sr
|
|
2760
|
+
} = this.geometry;
|
|
2761
|
+
const crs = CRS_MAP[sr];
|
|
2852
2762
|
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2763
|
+
if (!crs) {
|
|
2764
|
+
return null;
|
|
2765
|
+
}
|
|
2856
2766
|
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
|
|
2865
|
-
};
|
|
2866
|
-
const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
|
|
2867
|
-
if (size === void 0) {
|
|
2868
|
-
size = viewBoxSize;
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
return getSymbolRenders(symbol, size, LEGEND_FEATURES);
|
|
2872
|
-
};
|
|
2767
|
+
switch (type) {
|
|
2768
|
+
case api.GeometryType.Point:
|
|
2769
|
+
return new PointFeature.PointFeature(coordinates, {
|
|
2770
|
+
symbol: selectedPoint,
|
|
2771
|
+
crs
|
|
2772
|
+
});
|
|
2873
2773
|
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
}
|
|
2774
|
+
case api.GeometryType.Multipoint:
|
|
2775
|
+
return new MultiPoint.MultiPoint(coordinates, {
|
|
2776
|
+
symbol: selectedPoint,
|
|
2777
|
+
crs
|
|
2778
|
+
});
|
|
2879
2779
|
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2780
|
+
case api.GeometryType.Polyline:
|
|
2781
|
+
return new Polyline.Polyline(coordinates, {
|
|
2782
|
+
symbol: selectedPolyline,
|
|
2783
|
+
crs
|
|
2784
|
+
});
|
|
2884
2785
|
|
|
2885
|
-
|
|
2886
|
-
|
|
2786
|
+
case api.GeometryType.Polygon:
|
|
2787
|
+
return new Polygon.Polygon(coordinates, {
|
|
2788
|
+
symbol: selectedPolygon,
|
|
2789
|
+
crs
|
|
2790
|
+
});
|
|
2887
2791
|
|
|
2888
|
-
|
|
2889
|
-
|
|
2792
|
+
default:
|
|
2793
|
+
return null;
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
}, {
|
|
2797
|
+
key: "extent",
|
|
2798
|
+
value: function extent() {
|
|
2799
|
+
const feature = this.sGisFeature();
|
|
2800
|
+
return feature && feature.bbox;
|
|
2801
|
+
}
|
|
2802
|
+
}]);
|
|
2890
2803
|
|
|
2891
|
-
|
|
2892
|
-
|
|
2804
|
+
return EvergisFeature;
|
|
2805
|
+
}();
|
|
2893
2806
|
|
|
2894
|
-
|
|
2895
|
-
|
|
2807
|
+
function evaluateCondition(condition$1, attributes) {
|
|
2808
|
+
try {
|
|
2809
|
+
const evaluator = new condition.ConditionEvaluator(attributes);
|
|
2810
|
+
const result = evaluator.evaluate(condition$1);
|
|
2896
2811
|
|
|
2897
|
-
|
|
2898
|
-
return
|
|
2812
|
+
if (result instanceof Error) {
|
|
2813
|
+
return null;
|
|
2814
|
+
}
|
|
2899
2815
|
|
|
2900
|
-
|
|
2901
|
-
|
|
2816
|
+
return result;
|
|
2817
|
+
} catch (_unused) {
|
|
2818
|
+
return null;
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2902
2821
|
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2822
|
+
function getAttributeValue(attributes, attributeName) {
|
|
2823
|
+
const attributeMeta = attributes.find((_ref) => {
|
|
2824
|
+
let {
|
|
2825
|
+
name
|
|
2826
|
+
} = _ref;
|
|
2827
|
+
return name === attributeName;
|
|
2828
|
+
});
|
|
2829
|
+
return attributeMeta ? attributeMeta.value : null;
|
|
2830
|
+
}
|
|
2906
2831
|
|
|
2907
|
-
|
|
2908
|
-
|
|
2832
|
+
const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
|
|
2833
|
+
const getAttributeNameFromClassified = values => values.length > 0 ? getAttributeNameFromCondition(values[0].condition) : null;
|
|
2909
2834
|
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2835
|
+
function findFeatureValue(parameterValues, _ref2) {
|
|
2836
|
+
let [name, value] = _ref2;
|
|
2837
|
+
return value !== null ? parameterValues.find((_ref3) => {
|
|
2838
|
+
let {
|
|
2839
|
+
condition
|
|
2840
|
+
} = _ref3;
|
|
2841
|
+
return value !== undefined && evaluateCondition(condition, {
|
|
2842
|
+
[name]: value
|
|
2843
|
+
});
|
|
2844
|
+
}) : null;
|
|
2913
2845
|
}
|
|
2914
2846
|
|
|
2915
|
-
function
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
return
|
|
2919
|
-
cellSize: getParameterValue(symbol.cellSize),
|
|
2920
|
-
strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
|
|
2921
|
-
strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
|
|
2922
|
-
fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
|
|
2923
|
-
}));
|
|
2847
|
+
function extractValuesAttribute(parameterValues, attributes) {
|
|
2848
|
+
const name = getAttributeNameFromClassified(parameterValues) || '';
|
|
2849
|
+
const value = name && getAttributeValue(attributes, name);
|
|
2850
|
+
return [name, value];
|
|
2924
2851
|
}
|
|
2925
2852
|
|
|
2926
|
-
function
|
|
2853
|
+
function evaluateFeatureSymbol(attributes) {
|
|
2927
2854
|
// @ts-ignore
|
|
2928
|
-
|
|
2929
|
-
|
|
2855
|
+
function calc(result, _ref4) {
|
|
2856
|
+
let [parameterName, parameterValue] = _ref4;
|
|
2857
|
+
let newParameterValue;
|
|
2930
2858
|
|
|
2931
|
-
|
|
2859
|
+
if (isParameterByAttribute(parameterValue)) {
|
|
2860
|
+
const [attributeName, attributeValue] = extractValuesAttribute(parameterValue.values, attributes);
|
|
2861
|
+
const featureValue = findFeatureValue(parameterValue.values, [attributeName, attributeValue]);
|
|
2862
|
+
newParameterValue = featureValue ? featureValue.value : parameterValue.defaultValue;
|
|
2863
|
+
} else if (isObject(parameterValue)) {
|
|
2864
|
+
// @ts-ignore
|
|
2865
|
+
newParameterValue = Object.entries(parameterValue).reduce(calc, parameterValue);
|
|
2866
|
+
}
|
|
2932
2867
|
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
size,
|
|
2938
|
-
offset,
|
|
2939
|
-
angle,
|
|
2940
|
-
background,
|
|
2941
|
-
figure
|
|
2942
|
-
} = _ref;
|
|
2943
|
-
return _extends({
|
|
2944
|
-
type: getParameterValue(type),
|
|
2945
|
-
data: getParameterValue(data),
|
|
2946
|
-
size: getParameterValue(size),
|
|
2947
|
-
offset: getOffsetParameterValue(offset),
|
|
2948
|
-
angle: getParameterValue(angle)
|
|
2949
|
-
}, background ? {
|
|
2950
|
-
background: _extends({}, background, {
|
|
2951
|
-
fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
|
|
2952
|
-
strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
|
|
2953
|
-
strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
|
|
2954
|
-
})
|
|
2955
|
-
} : {}, figure ? {
|
|
2956
|
-
figure: _extends({}, figure, {
|
|
2957
|
-
fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
|
|
2958
|
-
})
|
|
2959
|
-
} : {});
|
|
2960
|
-
}
|
|
2868
|
+
return newParameterValue !== undefined ? _extends({}, result, {
|
|
2869
|
+
[parameterName]: newParameterValue
|
|
2870
|
+
}) : result;
|
|
2871
|
+
}
|
|
2961
2872
|
|
|
2962
|
-
|
|
2963
|
-
return new Point.PointSymbol(deserializeSvgPointSymbolParams(symbol));
|
|
2873
|
+
return calc;
|
|
2964
2874
|
}
|
|
2965
2875
|
|
|
2966
|
-
function
|
|
2967
|
-
return
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2876
|
+
function findChildFeatureStyle(childStyles, attributes) {
|
|
2877
|
+
return (childStyles || []).find((_ref5) => {
|
|
2878
|
+
let {
|
|
2879
|
+
condition
|
|
2880
|
+
} = _ref5;
|
|
2881
|
+
const attributeName = condition && getAttributeNameFromCondition(condition);
|
|
2882
|
+
const attributeValue = attributeName && getAttributeValue(attributes, attributeName);
|
|
2972
2883
|
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
width: getParameterValue(symbol.width),
|
|
2979
|
-
// @ts-ignore
|
|
2980
|
-
height: getParameterValue(symbol.height),
|
|
2981
|
-
// @ts-ignore
|
|
2982
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2983
|
-
// @ts-ignore
|
|
2984
|
-
imageSource: deserializeBase64(symbol.image),
|
|
2985
|
-
// @ts-ignore
|
|
2986
|
-
maskSource: deserializeBase64(symbol.imageMask),
|
|
2987
|
-
// @ts-ignore
|
|
2988
|
-
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2989
|
-
}));
|
|
2990
|
-
}
|
|
2884
|
+
if (condition && attributeName && attributeValue !== undefined) {
|
|
2885
|
+
return evaluateCondition(condition, {
|
|
2886
|
+
[attributeName]: attributeValue
|
|
2887
|
+
});
|
|
2888
|
+
}
|
|
2991
2889
|
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
// @ts-ignore
|
|
2995
|
-
angle: getParameterValue(symbol.angle),
|
|
2996
|
-
// @ts-ignore
|
|
2997
|
-
width: getParameterValue(symbol.width),
|
|
2998
|
-
// @ts-ignore
|
|
2999
|
-
height: getParameterValue(symbol.height),
|
|
3000
|
-
// @ts-ignore
|
|
3001
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
3002
|
-
// @ts-ignore
|
|
3003
|
-
source: deserializeBase64(symbol.image)
|
|
3004
|
-
}));
|
|
2890
|
+
return false;
|
|
2891
|
+
}) || null;
|
|
3005
2892
|
}
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
2893
|
+
function findChildFeatureSymbol(childStyles, attributes) {
|
|
2894
|
+
const featureStyle = findChildFeatureStyle(childStyles, attributes);
|
|
2895
|
+
return featureStyle ? featureStyle.symbol : null;
|
|
2896
|
+
}
|
|
2897
|
+
function getFeatureSymbol(style, attributes) {
|
|
2898
|
+
if (!style || !style.symbol) {
|
|
2899
|
+
return null;
|
|
3010
2900
|
}
|
|
3011
2901
|
|
|
3012
|
-
if (
|
|
3013
|
-
return
|
|
2902
|
+
if (style.children !== null) {
|
|
2903
|
+
return findChildFeatureSymbol(style.children, attributes) || style.symbol;
|
|
3014
2904
|
}
|
|
3015
2905
|
|
|
3016
|
-
return
|
|
2906
|
+
return Object.entries(style.symbol).reduce(evaluateFeatureSymbol(attributes), style.symbol);
|
|
3017
2907
|
}
|
|
3018
2908
|
|
|
3019
|
-
function
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
function deserializePointSymbolParams(_ref2) {
|
|
3024
|
-
let {
|
|
3025
|
-
size,
|
|
3026
|
-
offset,
|
|
3027
|
-
strokeColor,
|
|
3028
|
-
strokeWidth,
|
|
3029
|
-
fillColor
|
|
3030
|
-
} = _ref2;
|
|
3031
|
-
return {
|
|
3032
|
-
size: getParameterValue(size),
|
|
3033
|
-
offset: deserializeAnchor(offset),
|
|
3034
|
-
strokeWidth: getParameterValue(strokeWidth),
|
|
3035
|
-
strokeColor: deserializeColor(getParameterValue(strokeColor)),
|
|
3036
|
-
fillColor: deserializeColor(getParameterValue(fillColor))
|
|
3037
|
-
};
|
|
3038
|
-
}
|
|
3039
|
-
|
|
3040
|
-
function deserializeBase64(base) {
|
|
3041
|
-
return "data:image/png;base64," + base;
|
|
3042
|
-
}
|
|
3043
|
-
|
|
3044
|
-
function deserializeAnchor(offset) {
|
|
3045
|
-
// @ts-ignore
|
|
3046
|
-
return offset.map(getParameterValue);
|
|
3047
|
-
}
|
|
3048
|
-
|
|
3049
|
-
function deserializeColor(color$1) {
|
|
3050
|
-
return color$1 ? new color.Color(color$1).toString() : null;
|
|
3051
|
-
}
|
|
3052
|
-
|
|
3053
|
-
const clampSymbol = (symbol, min, max) => {
|
|
3054
|
-
if (isSGisImageSymbol(symbol)) {
|
|
3055
|
-
symbol.width = clamp(symbol.width, min, max);
|
|
3056
|
-
symbol.height = clamp(symbol.height, min, max);
|
|
3057
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
3058
|
-
symbol.size = clamp(symbol.size, min, max);
|
|
3059
|
-
}
|
|
3060
|
-
|
|
3061
|
-
return symbol;
|
|
3062
|
-
};
|
|
3063
|
-
function centerAlignSymbol(symbol) {
|
|
3064
|
-
if (isSGisImageSymbol(symbol)) {
|
|
3065
|
-
symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
|
|
3066
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
3067
|
-
symbol.offset = [0, 0];
|
|
3068
|
-
}
|
|
3069
|
-
|
|
3070
|
-
return symbol;
|
|
3071
|
-
}
|
|
3072
|
-
const adjustSymbol = (symbol, _ref) => {
|
|
3073
|
-
let {
|
|
3074
|
-
size
|
|
3075
|
-
} = _ref;
|
|
3076
|
-
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
3077
|
-
};
|
|
3078
|
-
|
|
3079
|
-
let EvergisFeature = /*#__PURE__*/function () {
|
|
3080
|
-
function EvergisFeature(feature) {
|
|
3081
|
-
_classCallCheck(this, EvergisFeature);
|
|
3082
|
-
|
|
3083
|
-
this.id = null;
|
|
3084
|
-
this.displayName = null;
|
|
3085
|
-
this.geometry = null;
|
|
3086
|
-
this.layerName = null;
|
|
3087
|
-
this.layerAlias = null;
|
|
3088
|
-
this.attributes = null;
|
|
3089
|
-
this.symbol = null;
|
|
3090
|
-
this.id = feature.id;
|
|
3091
|
-
this.displayName = feature.id;
|
|
3092
|
-
this.geometry = feature.geometry;
|
|
3093
|
-
this.layerName = feature.layer;
|
|
3094
|
-
this.layerAlias = feature.layer;
|
|
3095
|
-
this.attributes = getFeatureAttributes(feature.attributes);
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
|
-
_createClass(EvergisFeature, [{
|
|
3099
|
-
key: "sGisFeature",
|
|
3100
|
-
value: function sGisFeature() {
|
|
3101
|
-
if (!this.geometry || !this.symbol) {
|
|
3102
|
-
return null;
|
|
3103
|
-
} // @ts-ignore
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
const {
|
|
3107
|
-
type,
|
|
3108
|
-
coordinates,
|
|
3109
|
-
sr
|
|
3110
|
-
} = this.geometry;
|
|
3111
|
-
const crs = CRS_MAP[sr];
|
|
3112
|
-
|
|
3113
|
-
if (!crs) {
|
|
3114
|
-
return null;
|
|
3115
|
-
}
|
|
3116
|
-
|
|
3117
|
-
switch (type) {
|
|
3118
|
-
case api.GeometryType.Point:
|
|
3119
|
-
return new PointFeature.PointFeature(coordinates, {
|
|
3120
|
-
symbol: selectedPoint,
|
|
3121
|
-
crs
|
|
3122
|
-
});
|
|
3123
|
-
|
|
3124
|
-
case api.GeometryType.Multipoint:
|
|
3125
|
-
return new MultiPoint.MultiPoint(coordinates, {
|
|
3126
|
-
symbol: selectedPoint,
|
|
3127
|
-
crs
|
|
3128
|
-
});
|
|
3129
|
-
|
|
3130
|
-
case api.GeometryType.Polyline:
|
|
3131
|
-
return new Polyline.Polyline(coordinates, {
|
|
3132
|
-
symbol: selectedPolyline,
|
|
3133
|
-
crs
|
|
3134
|
-
});
|
|
3135
|
-
|
|
3136
|
-
case api.GeometryType.Polygon:
|
|
3137
|
-
return new Polygon.Polygon(coordinates, {
|
|
3138
|
-
symbol: selectedPolygon,
|
|
3139
|
-
crs
|
|
3140
|
-
});
|
|
3141
|
-
|
|
3142
|
-
default:
|
|
3143
|
-
return null;
|
|
3144
|
-
}
|
|
3145
|
-
}
|
|
3146
|
-
}, {
|
|
3147
|
-
key: "extent",
|
|
3148
|
-
value: function extent() {
|
|
3149
|
-
const feature = this.sGisFeature();
|
|
3150
|
-
return feature && feature.bbox;
|
|
3151
|
-
}
|
|
3152
|
-
}]);
|
|
3153
|
-
|
|
3154
|
-
return EvergisFeature;
|
|
3155
|
-
}();
|
|
3156
|
-
|
|
3157
|
-
function evaluateCondition(condition$1, attributes) {
|
|
3158
|
-
try {
|
|
3159
|
-
const evaluator = new condition.ConditionEvaluator(attributes);
|
|
3160
|
-
const result = evaluator.evaluate(condition$1);
|
|
3161
|
-
|
|
3162
|
-
if (result instanceof Error) {
|
|
3163
|
-
return null;
|
|
3164
|
-
}
|
|
3165
|
-
|
|
3166
|
-
return result;
|
|
3167
|
-
} catch (_unused) {
|
|
3168
|
-
return null;
|
|
3169
|
-
}
|
|
3170
|
-
}
|
|
3171
|
-
|
|
3172
|
-
function getAttributeValue(attributes, attributeName) {
|
|
3173
|
-
const attributeMeta = attributes.find(_ref => {
|
|
3174
|
-
let {
|
|
3175
|
-
name
|
|
3176
|
-
} = _ref;
|
|
3177
|
-
return name === attributeName;
|
|
3178
|
-
});
|
|
3179
|
-
return attributeMeta ? attributeMeta.value : null;
|
|
3180
|
-
}
|
|
3181
|
-
|
|
3182
|
-
const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
|
|
3183
|
-
const getAttributeNameFromClassified = values => values.length > 0 ? getAttributeNameFromCondition(values[0].condition) : null;
|
|
3184
|
-
|
|
3185
|
-
function findFeatureValue(parameterValues, _ref2) {
|
|
3186
|
-
let [name, value] = _ref2;
|
|
3187
|
-
return value !== null ? parameterValues.find(_ref3 => {
|
|
3188
|
-
let {
|
|
3189
|
-
condition
|
|
3190
|
-
} = _ref3;
|
|
3191
|
-
return value !== undefined && evaluateCondition(condition, {
|
|
3192
|
-
[name]: value
|
|
3193
|
-
});
|
|
3194
|
-
}) : null;
|
|
3195
|
-
}
|
|
3196
|
-
|
|
3197
|
-
function extractValuesAttribute(parameterValues, attributes) {
|
|
3198
|
-
const name = getAttributeNameFromClassified(parameterValues) || '';
|
|
3199
|
-
const value = name && getAttributeValue(attributes, name);
|
|
3200
|
-
return [name, value];
|
|
3201
|
-
}
|
|
3202
|
-
|
|
3203
|
-
function evaluateFeatureSymbol(attributes) {
|
|
3204
|
-
// @ts-ignore
|
|
3205
|
-
function calc(result, _ref4) {
|
|
3206
|
-
let [parameterName, parameterValue] = _ref4;
|
|
3207
|
-
let newParameterValue;
|
|
3208
|
-
|
|
3209
|
-
if (isParameterByAttribute(parameterValue)) {
|
|
3210
|
-
const [attributeName, attributeValue] = extractValuesAttribute(parameterValue.values, attributes);
|
|
3211
|
-
const featureValue = findFeatureValue(parameterValue.values, [attributeName, attributeValue]);
|
|
3212
|
-
newParameterValue = featureValue ? featureValue.value : parameterValue.defaultValue;
|
|
3213
|
-
} else if (isObject(parameterValue)) {
|
|
3214
|
-
// @ts-ignore
|
|
3215
|
-
newParameterValue = Object.entries(parameterValue).reduce(calc, parameterValue);
|
|
3216
|
-
}
|
|
3217
|
-
|
|
3218
|
-
return newParameterValue !== undefined ? _extends({}, result, {
|
|
3219
|
-
[parameterName]: newParameterValue
|
|
3220
|
-
}) : result;
|
|
3221
|
-
}
|
|
3222
|
-
|
|
3223
|
-
return calc;
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3226
|
-
function findChildFeatureStyle(childStyles, attributes) {
|
|
3227
|
-
return (childStyles || []).find(_ref5 => {
|
|
3228
|
-
let {
|
|
3229
|
-
condition
|
|
3230
|
-
} = _ref5;
|
|
3231
|
-
const attributeName = condition && getAttributeNameFromCondition(condition);
|
|
3232
|
-
const attributeValue = attributeName && getAttributeValue(attributes, attributeName);
|
|
3233
|
-
|
|
3234
|
-
if (condition && attributeName && attributeValue !== undefined) {
|
|
3235
|
-
return evaluateCondition(condition, {
|
|
3236
|
-
[attributeName]: attributeValue
|
|
3237
|
-
});
|
|
3238
|
-
}
|
|
3239
|
-
|
|
3240
|
-
return false;
|
|
3241
|
-
}) || null;
|
|
3242
|
-
}
|
|
3243
|
-
function findChildFeatureSymbol(childStyles, attributes) {
|
|
3244
|
-
const featureStyle = findChildFeatureStyle(childStyles, attributes);
|
|
3245
|
-
return featureStyle ? featureStyle.symbol : null;
|
|
3246
|
-
}
|
|
3247
|
-
function getFeatureSymbol(style, attributes) {
|
|
3248
|
-
if (!style || !style.symbol) {
|
|
3249
|
-
return null;
|
|
3250
|
-
}
|
|
3251
|
-
|
|
3252
|
-
if (style.children !== null) {
|
|
3253
|
-
return findChildFeatureSymbol(style.children, attributes) || style.symbol;
|
|
3254
|
-
}
|
|
3255
|
-
|
|
3256
|
-
return Object.entries(style.symbol).reduce(evaluateFeatureSymbol(attributes), style.symbol);
|
|
3257
|
-
}
|
|
3258
|
-
|
|
3259
|
-
let EvergisLayer = /*#__PURE__*/function () {
|
|
3260
|
-
function EvergisLayer(service) {
|
|
3261
|
-
_classCallCheck(this, EvergisLayer);
|
|
2909
|
+
let EvergisLayer = /*#__PURE__*/function () {
|
|
2910
|
+
function EvergisLayer(service) {
|
|
2911
|
+
_classCallCheck(this, EvergisLayer);
|
|
3262
2912
|
|
|
3263
2913
|
this.name = null;
|
|
3264
2914
|
this.titleAttribute = null;
|
|
@@ -3285,7 +2935,7 @@ let EvergisLayer = /*#__PURE__*/function () {
|
|
|
3285
2935
|
feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
|
|
3286
2936
|
feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
|
|
3287
2937
|
feature.layerAlias = this.alias;
|
|
3288
|
-
const titleAttribute = (feature.attributes || []).find(_ref => {
|
|
2938
|
+
const titleAttribute = (feature.attributes || []).find((_ref) => {
|
|
3289
2939
|
let {
|
|
3290
2940
|
name
|
|
3291
2941
|
} = _ref;
|
|
@@ -3308,7 +2958,7 @@ const evaluateFeature = layers => feature => {
|
|
|
3308
2958
|
};
|
|
3309
2959
|
|
|
3310
2960
|
const OTHERS_TITLE = 'Другое';
|
|
3311
|
-
const createLegendItem = _ref => {
|
|
2961
|
+
const createLegendItem = (_ref) => {
|
|
3312
2962
|
let {
|
|
3313
2963
|
attributes,
|
|
3314
2964
|
renderTitle,
|
|
@@ -3354,7 +3004,7 @@ function createStyleLegend(style, config) {
|
|
|
3354
3004
|
classificationManager,
|
|
3355
3005
|
symbol
|
|
3356
3006
|
} = style;
|
|
3357
|
-
const items = classificationManager.filter(_ref => {
|
|
3007
|
+
const items = classificationManager.filter((_ref) => {
|
|
3358
3008
|
let {
|
|
3359
3009
|
parameter
|
|
3360
3010
|
} = _ref;
|
|
@@ -3470,7 +3120,7 @@ const useMapLegend = (layer, config) => {
|
|
|
3470
3120
|
};
|
|
3471
3121
|
|
|
3472
3122
|
const LEGEND_SYMBOL_MAX_SIZE = 32;
|
|
3473
|
-
const useLegendValueSymbol = _ref => {
|
|
3123
|
+
const useLegendValueSymbol = (_ref) => {
|
|
3474
3124
|
let {
|
|
3475
3125
|
parameter,
|
|
3476
3126
|
parameterValue
|
|
@@ -3704,21 +3354,23 @@ function useFeatureLayer(_ref) {
|
|
|
3704
3354
|
let {
|
|
3705
3355
|
zIndex,
|
|
3706
3356
|
isDisplayed = true,
|
|
3707
|
-
features
|
|
3357
|
+
features,
|
|
3358
|
+
opacity
|
|
3708
3359
|
} = _ref;
|
|
3709
3360
|
const {
|
|
3710
3361
|
map
|
|
3711
3362
|
} = useMapContext();
|
|
3712
3363
|
const layer = useProperty({
|
|
3713
3364
|
factory: () => new FeatureLayer$1.FeatureLayer({
|
|
3714
|
-
features
|
|
3365
|
+
features,
|
|
3366
|
+
opacity
|
|
3715
3367
|
}),
|
|
3716
3368
|
destructor: layer => map.indexOf(layer) !== -1 && map.removeLayer(layer),
|
|
3717
3369
|
update: (layer, _ref2) => {
|
|
3718
3370
|
let [features] = _ref2;
|
|
3719
3371
|
layer.features = features;
|
|
3720
3372
|
}
|
|
3721
|
-
}, [features]);
|
|
3373
|
+
}, [features, opacity]);
|
|
3722
3374
|
useLayerOrder(layer, zIndex);
|
|
3723
3375
|
useLayerVisibility(layer, isDisplayed);
|
|
3724
3376
|
return layer;
|
|
@@ -3874,7 +3526,7 @@ function useMapWrapper() {
|
|
|
3874
3526
|
return wrapperRef;
|
|
3875
3527
|
}
|
|
3876
3528
|
|
|
3877
|
-
const byScale = scale => _ref => {
|
|
3529
|
+
const byScale = scale => (_ref) => {
|
|
3878
3530
|
let {
|
|
3879
3531
|
zIndex
|
|
3880
3532
|
} = _ref;
|
|
@@ -4073,7 +3725,7 @@ const useTooltip = function useTooltip(zIndex) {
|
|
|
4073
3725
|
|
|
4074
3726
|
return reset;
|
|
4075
3727
|
}, [reset, map, layer, zIndex]);
|
|
4076
|
-
const onSetLabelFeature = React.useCallback(_ref => {
|
|
3728
|
+
const onSetLabelFeature = React.useCallback((_ref) => {
|
|
4077
3729
|
let {
|
|
4078
3730
|
point,
|
|
4079
3731
|
position,
|
|
@@ -4237,7 +3889,7 @@ function useClusterLayer(_ref) {
|
|
|
4237
3889
|
}
|
|
4238
3890
|
|
|
4239
3891
|
const INIT_FEATURES = [];
|
|
4240
|
-
const useEvergisSelect = _ref => {
|
|
3892
|
+
const useEvergisSelect = (_ref) => {
|
|
4241
3893
|
let {
|
|
4242
3894
|
onPick,
|
|
4243
3895
|
onFeatures
|
|
@@ -4270,7 +3922,7 @@ function none() {
|
|
|
4270
3922
|
return;
|
|
4271
3923
|
}
|
|
4272
3924
|
|
|
4273
|
-
const useDraggableMarker = _ref => {
|
|
3925
|
+
const useDraggableMarker = (_ref) => {
|
|
4274
3926
|
let {
|
|
4275
3927
|
position,
|
|
4276
3928
|
onChange,
|
|
@@ -4392,7 +4044,7 @@ const useToggle = initial => {
|
|
|
4392
4044
|
return [state, toggle, setState];
|
|
4393
4045
|
};
|
|
4394
4046
|
|
|
4395
|
-
const Symbol = _ref => {
|
|
4047
|
+
const Symbol = (_ref) => {
|
|
4396
4048
|
let {
|
|
4397
4049
|
symbol,
|
|
4398
4050
|
size,
|
|
@@ -4413,19 +4065,19 @@ const Symbol = _ref => {
|
|
|
4413
4065
|
};
|
|
4414
4066
|
|
|
4415
4067
|
var _templateObject, _templateObject2;
|
|
4416
|
-
const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), _ref => {
|
|
4068
|
+
const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), (_ref) => {
|
|
4417
4069
|
let {
|
|
4418
4070
|
geometryType,
|
|
4419
4071
|
icons
|
|
4420
4072
|
} = _ref;
|
|
4421
4073
|
return "url(" + icons[geometryType] + ") center center / " + (geometryType === api.GeometryType.Polyline ? '2rem 1.3rem' : 'auto 1rem') + " no-repeat";
|
|
4422
4074
|
});
|
|
4423
|
-
const ClusterSymbol = /*#__PURE__*/styled__default.div(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 32px;\n height: 32px;\n\n :before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: inherit;\n height: inherit;\n background-color: ", ";\n border-radius: 50%;\n opacity: 0.28;\n }\n \n :after {\n content: \"99\";\n position: absolute;\n top: 4px;\n left: 4px;\n display: flex;\n justify-content: center;\n align-items: center;\n width: 24px;\n height: 24px;\n background-color: ", ";\n border-radius: 50%;\n color: white;\n font-size: 0.75rem;\n line-height: 1;\n }\n"])), _ref2 => {
|
|
4075
|
+
const ClusterSymbol = /*#__PURE__*/styled__default.div(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 32px;\n height: 32px;\n\n :before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: inherit;\n height: inherit;\n background-color: ", ";\n border-radius: 50%;\n opacity: 0.28;\n }\n \n :after {\n content: \"99\";\n position: absolute;\n top: 4px;\n left: 4px;\n display: flex;\n justify-content: center;\n align-items: center;\n width: 24px;\n height: 24px;\n background-color: ", ";\n border-radius: 50%;\n color: white;\n font-size: 0.75rem;\n line-height: 1;\n }\n"])), (_ref2) => {
|
|
4424
4076
|
let {
|
|
4425
4077
|
color
|
|
4426
4078
|
} = _ref2;
|
|
4427
4079
|
return color;
|
|
4428
|
-
}, _ref3 => {
|
|
4080
|
+
}, (_ref3) => {
|
|
4429
4081
|
let {
|
|
4430
4082
|
color
|
|
4431
4083
|
} = _ref3;
|
|
@@ -4433,7 +4085,7 @@ const ClusterSymbol = /*#__PURE__*/styled__default.div(_templateObject2 || (_tem
|
|
|
4433
4085
|
});
|
|
4434
4086
|
|
|
4435
4087
|
const MAX_SIZE = 32;
|
|
4436
|
-
const StyleSymbol = _ref => {
|
|
4088
|
+
const StyleSymbol = (_ref) => {
|
|
4437
4089
|
let {
|
|
4438
4090
|
symbol,
|
|
4439
4091
|
size = MAX_SIZE,
|
|
@@ -4490,7 +4142,7 @@ const AttributeValueContainer = /*#__PURE__*/styled__default.div(_templateObject
|
|
|
4490
4142
|
const SimpleAttribute = /*#__PURE__*/styled__default.div(_templateObject15 || (_templateObject15 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
|
|
4491
4143
|
const ValueLink = /*#__PURE__*/styled__default.a(_templateObject16 || (_templateObject16 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 0 0.25rem;\n color: #1fb3aa;\n text-decoration: none;\n"])));
|
|
4492
4144
|
|
|
4493
|
-
const MailValue = _ref => {
|
|
4145
|
+
const MailValue = (_ref) => {
|
|
4494
4146
|
let {
|
|
4495
4147
|
mail
|
|
4496
4148
|
} = _ref;
|
|
@@ -4501,7 +4153,7 @@ const MailValue = _ref => {
|
|
|
4501
4153
|
}, mail);
|
|
4502
4154
|
};
|
|
4503
4155
|
|
|
4504
|
-
const PhoneValue = _ref => {
|
|
4156
|
+
const PhoneValue = (_ref) => {
|
|
4505
4157
|
let {
|
|
4506
4158
|
phone
|
|
4507
4159
|
} = _ref;
|
|
@@ -4512,7 +4164,7 @@ const PhoneValue = _ref => {
|
|
|
4512
4164
|
}, phone);
|
|
4513
4165
|
};
|
|
4514
4166
|
|
|
4515
|
-
const UrlValue = _ref => {
|
|
4167
|
+
const UrlValue = (_ref) => {
|
|
4516
4168
|
let {
|
|
4517
4169
|
url
|
|
4518
4170
|
} = _ref;
|
|
@@ -4523,7 +4175,7 @@ const UrlValue = _ref => {
|
|
|
4523
4175
|
}, url);
|
|
4524
4176
|
};
|
|
4525
4177
|
|
|
4526
|
-
const AttributeValue = _ref => {
|
|
4178
|
+
const AttributeValue = (_ref) => {
|
|
4527
4179
|
let {
|
|
4528
4180
|
attribute
|
|
4529
4181
|
} = _ref;
|
|
@@ -4537,29 +4189,29 @@ const AttributeValue = _ref => {
|
|
|
4537
4189
|
if (attributeValue.type === 2
|
|
4538
4190
|
/* Url */
|
|
4539
4191
|
) {
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4192
|
+
return React__default.createElement(UrlValue, {
|
|
4193
|
+
key: key,
|
|
4194
|
+
url: punycodeDecode(value)
|
|
4195
|
+
});
|
|
4196
|
+
}
|
|
4545
4197
|
|
|
4546
4198
|
if (attributeValue.type === 3
|
|
4547
4199
|
/* Mail */
|
|
4548
4200
|
) {
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4201
|
+
return React__default.createElement(MailValue, {
|
|
4202
|
+
key: key,
|
|
4203
|
+
mail: value
|
|
4204
|
+
});
|
|
4205
|
+
}
|
|
4554
4206
|
|
|
4555
4207
|
if (attributeValue.type === 1
|
|
4556
4208
|
/* Phone */
|
|
4557
4209
|
) {
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4210
|
+
return React__default.createElement(PhoneValue, {
|
|
4211
|
+
key: key,
|
|
4212
|
+
phone: value
|
|
4213
|
+
});
|
|
4214
|
+
}
|
|
4563
4215
|
|
|
4564
4216
|
return React__default.createElement(SimpleAttribute, {
|
|
4565
4217
|
key: value
|
|
@@ -4575,7 +4227,7 @@ function punycodeDecode(domains) {
|
|
|
4575
4227
|
}
|
|
4576
4228
|
}
|
|
4577
4229
|
|
|
4578
|
-
const EvergisCardAttribute = _ref => {
|
|
4230
|
+
const EvergisCardAttribute = (_ref) => {
|
|
4579
4231
|
let {
|
|
4580
4232
|
attribute,
|
|
4581
4233
|
className
|
|
@@ -4587,7 +4239,7 @@ const EvergisCardAttribute = _ref => {
|
|
|
4587
4239
|
}));
|
|
4588
4240
|
};
|
|
4589
4241
|
|
|
4590
|
-
const StyledCard = _ref => {
|
|
4242
|
+
const StyledCard = (_ref) => {
|
|
4591
4243
|
let {
|
|
4592
4244
|
features = [],
|
|
4593
4245
|
className,
|
|
@@ -4633,7 +4285,7 @@ const StyledCard = _ref => {
|
|
|
4633
4285
|
};
|
|
4634
4286
|
|
|
4635
4287
|
const _excluded$1 = ["renderCard", "className", "children"];
|
|
4636
|
-
const EvergisCard = _ref => {
|
|
4288
|
+
const EvergisCard = (_ref) => {
|
|
4637
4289
|
let {
|
|
4638
4290
|
renderCard,
|
|
4639
4291
|
className,
|
|
@@ -4685,7 +4337,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
|
|
|
4685
4337
|
|
|
4686
4338
|
const useSGisFeatures = (features, currentIndex) => React.useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
|
|
4687
4339
|
|
|
4688
|
-
const EvergisSelectLayer = _ref => {
|
|
4340
|
+
const EvergisSelectLayer = (_ref) => {
|
|
4689
4341
|
let {
|
|
4690
4342
|
features,
|
|
4691
4343
|
zIndex,
|
|
@@ -4730,7 +4382,7 @@ const TileLayer = props => {
|
|
|
4730
4382
|
};
|
|
4731
4383
|
|
|
4732
4384
|
const defaultZIndex = 200;
|
|
4733
|
-
const EvergisSelect = _ref => {
|
|
4385
|
+
const EvergisSelect = (_ref) => {
|
|
4734
4386
|
let {
|
|
4735
4387
|
onPick,
|
|
4736
4388
|
className,
|
|
@@ -4765,7 +4417,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled__default.p(_templateObject3$1 || (
|
|
|
4765
4417
|
const LegendValueContainer = /*#__PURE__*/styled__default.div(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n font-size: 0.75rem;\n\n ", " {\n padding-left: 0.5rem;\n }\n"])), LegendSymbolTitle);
|
|
4766
4418
|
const LegendSectionHeader = /*#__PURE__*/styled__default.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
|
|
4767
4419
|
|
|
4768
|
-
const LegendSection = _ref => {
|
|
4420
|
+
const LegendSection = (_ref) => {
|
|
4769
4421
|
let {
|
|
4770
4422
|
item,
|
|
4771
4423
|
renderLegendTitle,
|
|
@@ -4779,7 +4431,7 @@ var _templateObject$3, _templateObject2$3;
|
|
|
4779
4431
|
const InputContainer = /*#__PURE__*/styled__default.div(_templateObject$3 || (_templateObject$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n border-radius: 0.125rem;\n box-sizing: border-box;\n border: 0.0625rem solid rgba(48, 69, 79, 0.12);\n margin-bottom: 0.5rem;\n \n i {\n color: rgba(48, 69, 79, 0.54);\n padding: 0.25rem;\n\n &:hover {\n cursor: pointer;\n color: rgba(48, 69, 79, 0.87);\n }\n }\n"])));
|
|
4780
4432
|
const InputField = /*#__PURE__*/styled__default.input(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n border: none;\n outline: none;\n font-size: 1rem;\n line-height: 1.1875rem;\n padding: 0 0.5rem;\n background-color: transparent;\n color: rgba(48, 69, 79, 0.87);\n"])));
|
|
4781
4433
|
|
|
4782
|
-
const SearchInput = _ref => {
|
|
4434
|
+
const SearchInput = (_ref) => {
|
|
4783
4435
|
let {
|
|
4784
4436
|
onChange
|
|
4785
4437
|
} = _ref;
|
|
@@ -4788,7 +4440,7 @@ const SearchInput = _ref => {
|
|
|
4788
4440
|
}));
|
|
4789
4441
|
};
|
|
4790
4442
|
|
|
4791
|
-
const LegendSymbol = _ref => {
|
|
4443
|
+
const LegendSymbol = (_ref) => {
|
|
4792
4444
|
let {
|
|
4793
4445
|
parameter,
|
|
4794
4446
|
parameterValue,
|
|
@@ -4806,7 +4458,7 @@ const LegendSymbol = _ref => {
|
|
|
4806
4458
|
return React__default.createElement(React__default.Fragment, null, children(symbol));
|
|
4807
4459
|
};
|
|
4808
4460
|
|
|
4809
|
-
const LegendValue = _ref => {
|
|
4461
|
+
const LegendValue = (_ref) => {
|
|
4810
4462
|
let {
|
|
4811
4463
|
value,
|
|
4812
4464
|
parameter,
|
|
@@ -4828,7 +4480,7 @@ const getNumberParam = (parameterValue, param) => {
|
|
|
4828
4480
|
return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
|
|
4829
4481
|
};
|
|
4830
4482
|
|
|
4831
|
-
const getSymbolSize = _ref => {
|
|
4483
|
+
const getSymbolSize = (_ref) => {
|
|
4832
4484
|
let {
|
|
4833
4485
|
parameterValue,
|
|
4834
4486
|
maxSize
|
|
@@ -4853,7 +4505,7 @@ const getSymbolSize = _ref => {
|
|
|
4853
4505
|
}
|
|
4854
4506
|
};
|
|
4855
4507
|
|
|
4856
|
-
const Legend = _ref => {
|
|
4508
|
+
const Legend = (_ref) => {
|
|
4857
4509
|
let {
|
|
4858
4510
|
layer,
|
|
4859
4511
|
children,
|
|
@@ -4897,7 +4549,7 @@ const Legend = _ref => {
|
|
|
4897
4549
|
})))));
|
|
4898
4550
|
};
|
|
4899
4551
|
|
|
4900
|
-
const Map = _ref => {
|
|
4552
|
+
const Map = (_ref) => {
|
|
4901
4553
|
let {
|
|
4902
4554
|
className,
|
|
4903
4555
|
position,
|
|
@@ -4969,27 +4621,27 @@ const FullscreenBtn = /*#__PURE__*/styled__default(icons.Icon)(_templateObject5$
|
|
|
4969
4621
|
const MeasureBtn = /*#__PURE__*/styled__default(icons.Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin); // MeasureBtn.defaultProps = { kind: "measure_length" };
|
|
4970
4622
|
|
|
4971
4623
|
const MapControl = /*#__PURE__*/styled__default.div(_templateObject7$1 || (_templateObject7$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-radius: 0.15rem;\n background: rgba(28, 33, 48, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n font-size: 1.5rem;\n cursor: pointer;\n height: auto;\n width: auto;\n padding: 0.25rem;\n"])));
|
|
4972
|
-
const MapControls = /*#__PURE__*/styled__default.div(_templateObject8$1 || (_templateObject8$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n display: flex;\n flex-direction: ", ";\n\n ", "\n\n ", " {\n margin-bottom: ", ";\n margin-right: ", ";\n flex-direction: ", ";\n }\n"])), _ref => {
|
|
4624
|
+
const MapControls = /*#__PURE__*/styled__default.div(_templateObject8$1 || (_templateObject8$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n display: flex;\n flex-direction: ", ";\n\n ", "\n\n ", " {\n margin-bottom: ", ";\n margin-right: ", ";\n flex-direction: ", ";\n }\n"])), (_ref) => {
|
|
4973
4625
|
let {
|
|
4974
4626
|
vertical
|
|
4975
4627
|
} = _ref;
|
|
4976
4628
|
return vertical ? 'column' : 'row';
|
|
4977
|
-
}, _ref2 => {
|
|
4629
|
+
}, (_ref2) => {
|
|
4978
4630
|
let {
|
|
4979
4631
|
placement
|
|
4980
4632
|
} = _ref2;
|
|
4981
4633
|
return placementMixin(placement);
|
|
4982
|
-
}, MapControl, _ref3 => {
|
|
4634
|
+
}, MapControl, (_ref3) => {
|
|
4983
4635
|
let {
|
|
4984
4636
|
vertical
|
|
4985
4637
|
} = _ref3;
|
|
4986
4638
|
return vertical ? '0.5rem' : '0';
|
|
4987
|
-
}, _ref4 => {
|
|
4639
|
+
}, (_ref4) => {
|
|
4988
4640
|
let {
|
|
4989
4641
|
vertical
|
|
4990
4642
|
} = _ref4;
|
|
4991
4643
|
return vertical ? '0' : '0.5rem';
|
|
4992
|
-
}, _ref5 => {
|
|
4644
|
+
}, (_ref5) => {
|
|
4993
4645
|
let {
|
|
4994
4646
|
vertical
|
|
4995
4647
|
} = _ref5;
|
|
@@ -5002,148 +4654,475 @@ const Measure = () => {
|
|
|
5002
4654
|
}));
|
|
5003
4655
|
};
|
|
5004
4656
|
|
|
5005
|
-
const Search = () => {
|
|
5006
|
-
return React__default.createElement(MapControl, null, React__default.createElement(SearchBtn, {
|
|
5007
|
-
onClick: () => {}
|
|
5008
|
-
}));
|
|
5009
|
-
};
|
|
4657
|
+
const Search = () => {
|
|
4658
|
+
return React__default.createElement(MapControl, null, React__default.createElement(SearchBtn, {
|
|
4659
|
+
onClick: () => {}
|
|
4660
|
+
}));
|
|
4661
|
+
};
|
|
4662
|
+
|
|
4663
|
+
const Fullscreen = () => {
|
|
4664
|
+
return React__default.createElement(MapControl, null, React__default.createElement(FullscreenBtn, {
|
|
4665
|
+
onClick: () => {}
|
|
4666
|
+
}));
|
|
4667
|
+
};
|
|
4668
|
+
|
|
4669
|
+
var _templateObject$6, _templateObject2$6, _templateObject3$4, _templateObject4$4, _templateObject5$4, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12$1, _templateObject13$1;
|
|
4670
|
+
const MapLegendControl = /*#__PURE__*/styled__default(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4671
|
+
const MapLegendContainer = /*#__PURE__*/styled__default.div(_templateObject2$6 || (_templateObject2$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 12.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1.625rem;\n width: 1.625rem;\n }\n"])));
|
|
4672
|
+
const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-weight: 500;\n"])));
|
|
4673
|
+
const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
|
|
4674
|
+
const MapLegendItem = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n height: 1rem;\n background: ", ";\n border: 1px rgba(48, 69, 79, 0.1) solid;\n margin-right: -1px;\n \n ", "\n"])), (_ref) => {
|
|
4675
|
+
let {
|
|
4676
|
+
value
|
|
4677
|
+
} = _ref;
|
|
4678
|
+
return typeof value === "number" ? "none" : value;
|
|
4679
|
+
}, (_ref2) => {
|
|
4680
|
+
let {
|
|
4681
|
+
value
|
|
4682
|
+
} = _ref2;
|
|
4683
|
+
return !!value && typeof value === "number" && SizeLegendMixin(value);
|
|
4684
|
+
});
|
|
4685
|
+
const MapLegendOther = /*#__PURE__*/styled__default(MapLegendItem)(_templateObject6$2 || (_templateObject6$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: none;\n width: 1rem;\n margin-left: 0.25rem;\n border-radius: 0.125rem;\n"])));
|
|
4686
|
+
const SizeOverlayLegendMixin = /*#__PURE__*/styled.css(_templateObject7$2 || (_templateObject7$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 2rem;\n height: 2rem;\n \n ", ", ", " {\n flex: none;\n position: absolute;\n top: 0;\n left: 50%;\n width: inherit;\n height: inherit;\n margin-left: -1rem;\n \n :after {\n top: 0;\n margin-top: 0;\n }\n }\n"])), MapLegendItem, MapLegendOther);
|
|
4687
|
+
const MapLegendItems = /*#__PURE__*/styled__default.div(_templateObject8$2 || (_templateObject8$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n"])), (_ref3) => {
|
|
4688
|
+
let {
|
|
4689
|
+
overlay
|
|
4690
|
+
} = _ref3;
|
|
4691
|
+
return overlay && SizeOverlayLegendMixin;
|
|
4692
|
+
});
|
|
4693
|
+
|
|
4694
|
+
const SizeLegendMixin = function SizeLegendMixin(value) {
|
|
4695
|
+
if (value === void 0) {
|
|
4696
|
+
value = 0;
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
return styled.css(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n position: relative;\n height: 2rem;\n background: none;\n border: none;\n margin-right: 0;\n \n :after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n border: 1px rgba(48, 69, 79, 0.28) solid;\n border-radius: 50%;\n margin: -", "px 0 0 -", "px;\n width: ", "px;\n height: ", "px;\n }\n"])), value / 2, value / 2, value, value);
|
|
4700
|
+
};
|
|
4701
|
+
|
|
4702
|
+
const MapLegendValues = /*#__PURE__*/styled__default.div(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n font-size: 0.75rem;\n color: rgba(48, 69, 79, 0.65);\n"])));
|
|
4703
|
+
const MapLegendValuesRange = /*#__PURE__*/styled__default.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
4704
|
+
const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
|
|
4705
|
+
const MapLegendExpandButton = /*#__PURE__*/styled__default.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin: 0.1rem 0 0.5rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
|
|
4706
|
+
|
|
4707
|
+
const isNumeric = number => !isNaN(parseFloat(number)) && isFinite(number);
|
|
4708
|
+
|
|
4709
|
+
const getValueFromLegendTitle = (title, minOrMax) => {
|
|
4710
|
+
var _title$split;
|
|
4711
|
+
|
|
4712
|
+
if (title.includes(" - ")) {
|
|
4713
|
+
const result = title == null ? void 0 : title.split(" - ");
|
|
4714
|
+
return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
|
|
4715
|
+
}
|
|
4716
|
+
|
|
4717
|
+
return (title == null ? void 0 : (_title$split = title.split(" ")) == null ? void 0 : _title$split.find(isNumeric)) || "";
|
|
4718
|
+
};
|
|
4719
|
+
|
|
4720
|
+
const MinimizedLegend = (_ref) => {
|
|
4721
|
+
var _currentValues$, _currentValues;
|
|
4722
|
+
|
|
4723
|
+
let {
|
|
4724
|
+
values,
|
|
4725
|
+
title,
|
|
4726
|
+
overlay
|
|
4727
|
+
} = _ref;
|
|
4728
|
+
const currentValues = [...values];
|
|
4729
|
+
const other = currentValues.pop();
|
|
4730
|
+
return React__default.createElement(React__default.Fragment, null, !!title && React__default.createElement(MapLegendValueDescr, null, title), React__default.createElement(MapLegendItems, {
|
|
4731
|
+
overlay: overlay
|
|
4732
|
+
}, currentValues.map(value => React__default.createElement(MapLegendItem, {
|
|
4733
|
+
key: value.title,
|
|
4734
|
+
title: value.title,
|
|
4735
|
+
value: value.parameterValue
|
|
4736
|
+
})), React__default.createElement(MapLegendOther, {
|
|
4737
|
+
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
4738
|
+
value: other == null ? void 0 : other.parameterValue
|
|
4739
|
+
})), typeof (other == null ? void 0 : other.parameterValue) === "string" && React__default.createElement(MapLegendValues, null, React__default.createElement(MapLegendValuesRange, null, React__default.createElement("div", null, getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max")), React__default.createElement("div", null, getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min"))), React__default.createElement(MapLegendValuesOther, null, "-")));
|
|
4740
|
+
};
|
|
4741
|
+
|
|
4742
|
+
const MapLegend = (_ref) => {
|
|
4743
|
+
let {
|
|
4744
|
+
layer,
|
|
4745
|
+
config,
|
|
4746
|
+
className
|
|
4747
|
+
} = _ref;
|
|
4748
|
+
const legend = useMapLegend(layer, config);
|
|
4749
|
+
const [isExpanded, toggleExpanded] = useToggle();
|
|
4750
|
+
|
|
4751
|
+
if (!legend) {
|
|
4752
|
+
return null;
|
|
4753
|
+
}
|
|
4754
|
+
|
|
4755
|
+
const {
|
|
4756
|
+
symbol,
|
|
4757
|
+
items
|
|
4758
|
+
} = legend;
|
|
4759
|
+
return React__default.createElement(LegendProvider, {
|
|
4760
|
+
symbol: symbol
|
|
4761
|
+
}, React__default.createElement(MapLegendControl, {
|
|
4762
|
+
className: className
|
|
4763
|
+
}, React__default.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), !!items.length && React__default.createElement(MapLegendContainer, null, isExpanded ? React__default.createElement(Legend, {
|
|
4764
|
+
layer: layer,
|
|
4765
|
+
config: config
|
|
4766
|
+
}) : React__default.createElement(React__default.Fragment, null, items.map(item => {
|
|
4767
|
+
var _symbol$fill, _item$parameter, _symbol$fill2;
|
|
4768
|
+
|
|
4769
|
+
return React__default.createElement(React.Fragment, {
|
|
4770
|
+
key: item.title
|
|
4771
|
+
}, React__default.createElement(MinimizedLegend, {
|
|
4772
|
+
values: item.values,
|
|
4773
|
+
defaultValue: (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color,
|
|
4774
|
+
title: item.title !== (layer == null ? void 0 : layer.alias) ? item.title : ""
|
|
4775
|
+
}), ((_item$parameter = item.parameter) == null ? void 0 : _item$parameter.includes("size")) && React__default.createElement(MinimizedLegend, {
|
|
4776
|
+
values: item.values,
|
|
4777
|
+
defaultValue: (_symbol$fill2 = symbol.fill) == null ? void 0 : _symbol$fill2.color,
|
|
4778
|
+
overlay: true
|
|
4779
|
+
}));
|
|
4780
|
+
})), React__default.createElement(MapLegendExpandButton, {
|
|
4781
|
+
onClick: toggleExpanded
|
|
4782
|
+
}, isExpanded ? "Свернуть" : "Развернуть"))));
|
|
4783
|
+
};
|
|
4784
|
+
|
|
4785
|
+
const MAX_SIZE$2 = 100;
|
|
4786
|
+
const MapLegendSymbol = (_ref) => {
|
|
4787
|
+
let {
|
|
4788
|
+
value,
|
|
4789
|
+
parameter
|
|
4790
|
+
} = _ref;
|
|
4791
|
+
return React__default.createElement(LegendSymbol, {
|
|
4792
|
+
key: value.title,
|
|
4793
|
+
parameter: parameter,
|
|
4794
|
+
parameterValue: value.parameterValue
|
|
4795
|
+
}, symbol => React__default.createElement(Symbol, {
|
|
4796
|
+
render: getMapLegendSymbolRenders,
|
|
4797
|
+
symbol: symbol,
|
|
4798
|
+
size: MAX_SIZE$2
|
|
4799
|
+
}));
|
|
4800
|
+
};
|
|
4801
|
+
|
|
4802
|
+
const DEFAULT_FORMATTERS = {
|
|
4803
|
+
polygon: formatPolygonMeasure,
|
|
4804
|
+
length: formatLength
|
|
4805
|
+
};
|
|
4806
|
+
|
|
4807
|
+
const COORD_FRACTION = 6;
|
|
4808
|
+
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
4809
|
+
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
4810
|
+
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
4811
|
+
|
|
4812
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
4813
|
+
|
|
4814
|
+
function BaseMeasureToolCreator(map, painter, params) {
|
|
4815
|
+
var _this;
|
|
4816
|
+
|
|
4817
|
+
_classCallCheck(this, BaseMeasureToolCreator);
|
|
4818
|
+
|
|
4819
|
+
_this = _super.call(this, map, params);
|
|
4820
|
+
|
|
4821
|
+
_this.cancel = () => {
|
|
4822
|
+
_this.fire('cancel');
|
|
4823
|
+
};
|
|
4824
|
+
|
|
4825
|
+
_this.painter = painter;
|
|
4826
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4827
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4828
|
+
_this.areaSymbol = params.areaSymbol;
|
|
4829
|
+
|
|
4830
|
+
_this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
|
|
4831
|
+
|
|
4832
|
+
|
|
4833
|
+
_this.on('change', _this.updateDistance);
|
|
4834
|
+
|
|
4835
|
+
return _this;
|
|
4836
|
+
}
|
|
4837
|
+
|
|
4838
|
+
_createClass(BaseMeasureToolCreator, [{
|
|
4839
|
+
key: "_handleMousemove",
|
|
4840
|
+
value: function _handleMousemove(event) {
|
|
4841
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_handleMousemove", this).call(this, event);
|
|
4842
|
+
|
|
4843
|
+
this.drawPointOnMouseMove(event);
|
|
4844
|
+
}
|
|
4845
|
+
}, {
|
|
4846
|
+
key: "_activate",
|
|
4847
|
+
value: function _activate() {
|
|
4848
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_activate", this).call(this);
|
|
4849
|
+
|
|
4850
|
+
this.addTempLabel();
|
|
4851
|
+
this.setCursor('pointer');
|
|
4852
|
+
}
|
|
4853
|
+
}, {
|
|
4854
|
+
key: "_deactivate",
|
|
4855
|
+
value: function _deactivate() {
|
|
4856
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_deactivate", this).call(this);
|
|
4857
|
+
|
|
4858
|
+
this.removeCoordLabel();
|
|
4859
|
+
this.removeTempLabel();
|
|
4860
|
+
this.removeMeasureLabel();
|
|
4861
|
+
this.removeTempPolygon();
|
|
4862
|
+
this.setCursor('default');
|
|
4863
|
+
}
|
|
4864
|
+
}, {
|
|
4865
|
+
key: "handlePointAdd",
|
|
4866
|
+
value: function handlePointAdd() {
|
|
4867
|
+
const feature = this.activeFeature;
|
|
4868
|
+
if (!feature) return;
|
|
4869
|
+
const {
|
|
4870
|
+
rings,
|
|
4871
|
+
crs
|
|
4872
|
+
} = feature;
|
|
4873
|
+
|
|
4874
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4875
|
+
this.finishDrawing();
|
|
4876
|
+
this.fire(new Control.DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
4877
|
+
return;
|
|
4878
|
+
}
|
|
4879
|
+
|
|
4880
|
+
if (rings[0].length === 2) {
|
|
4881
|
+
const projection = crs.projectionTo(Crs.geo);
|
|
4882
|
+
const point = rings[0][0];
|
|
4883
|
+
if (!projection) return;
|
|
4884
|
+
const [lat, long] = projection(point);
|
|
4885
|
+
this.removeTempLabel();
|
|
4886
|
+
this.addMeasureResultLabel();
|
|
4887
|
+
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
4888
|
+
} else {
|
|
4889
|
+
this.removeCoordLabel();
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
}, {
|
|
4893
|
+
key: "polygonPreview",
|
|
4894
|
+
value: function polygonPreview() {
|
|
4895
|
+
if (this.tempPolygon) {
|
|
4896
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
4897
|
+
}
|
|
4898
|
+
|
|
4899
|
+
const feature = this.activeFeature;
|
|
4900
|
+
if (!feature) return;
|
|
4901
|
+
const {
|
|
4902
|
+
rings,
|
|
4903
|
+
crs
|
|
4904
|
+
} = feature;
|
|
4905
|
+
const polygonRings = [...rings[0]];
|
|
4906
|
+
polygonRings.shift();
|
|
4907
|
+
this.tempPolygon = new Polygon.Polygon(polygonRings, {
|
|
4908
|
+
crs
|
|
4909
|
+
});
|
|
4910
|
+
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
4911
|
+
this.activeFeature && this.activeFeature.hide();
|
|
4912
|
+
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
4913
|
+
}
|
|
4914
|
+
}, {
|
|
4915
|
+
key: "removeTempPolygon",
|
|
4916
|
+
value: function removeTempPolygon() {
|
|
4917
|
+
if (this.tempPolygon) {
|
|
4918
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
4919
|
+
delete this.tempPolygon;
|
|
4920
|
+
}
|
|
4921
|
+
}
|
|
4922
|
+
}, {
|
|
4923
|
+
key: "updateDistance",
|
|
4924
|
+
value: function updateDistance(event) {
|
|
4925
|
+
const feature = this.activeFeature;
|
|
4926
|
+
const {
|
|
4927
|
+
ringIndex,
|
|
4928
|
+
pointIndex
|
|
4929
|
+
} = event;
|
|
4930
|
+
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
4931
|
+
const {
|
|
4932
|
+
rings,
|
|
4933
|
+
crs
|
|
4934
|
+
} = feature;
|
|
4935
|
+
const position = rings[ringIndex][pointIndex];
|
|
4936
|
+
const length = geotools.length(rings, crs);
|
|
4937
|
+
let content = this.formatters.length(length);
|
|
4938
|
+
|
|
4939
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4940
|
+
this.polygonPreview();
|
|
4941
|
+
const area = geotools.area(rings, crs);
|
|
4942
|
+
content = this.formatters.polygon(area, length);
|
|
4943
|
+
} else if (this.tempPolygon) {
|
|
4944
|
+
feature.show();
|
|
4945
|
+
this.removeTempPolygon();
|
|
4946
|
+
}
|
|
4947
|
+
|
|
4948
|
+
if (this.measureResultLabel) {
|
|
4949
|
+
this.measureResultLabel.position = position;
|
|
4950
|
+
this.measureResultLabel.content = content;
|
|
4951
|
+
}
|
|
4952
|
+
}
|
|
4953
|
+
}, {
|
|
4954
|
+
key: "addTempLabel",
|
|
4955
|
+
value: function addTempLabel() {
|
|
4956
|
+
this.tempLabel = new Label.LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
4957
|
+
content: 'Нажмите на карту, чтобы начать измерение',
|
|
4958
|
+
crs: this.map.crs,
|
|
4959
|
+
symbol: createLabelSymbol({
|
|
4960
|
+
renderLabel: this.renderLabelSymbol
|
|
4961
|
+
})
|
|
4962
|
+
});
|
|
4963
|
+
this._tempLayer && this._tempLayer.add(this.tempLabel);
|
|
4964
|
+
}
|
|
4965
|
+
}, {
|
|
4966
|
+
key: "addCoordLabel",
|
|
4967
|
+
value: function addCoordLabel(content, position) {
|
|
4968
|
+
this.coordLabel = new Label.LabelFeature(position, {
|
|
4969
|
+
content,
|
|
4970
|
+
crs: this.map.crs,
|
|
4971
|
+
symbol: createLabelSymbol({
|
|
4972
|
+
renderLabel: this.renderLabelSymbol,
|
|
4973
|
+
onClose: this.cancel
|
|
4974
|
+
})
|
|
4975
|
+
});
|
|
4976
|
+
this._tempLayer && this.coordLabel && this._tempLayer.add(this.coordLabel);
|
|
4977
|
+
}
|
|
4978
|
+
}, {
|
|
4979
|
+
key: "addMeasureResultLabel",
|
|
4980
|
+
value: function addMeasureResultLabel() {
|
|
4981
|
+
this.measureResultLabel = new Label.LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
4982
|
+
crs: this.map.crs,
|
|
4983
|
+
symbol: createLabelSymbol({
|
|
4984
|
+
renderLabel: this.renderLabelSymbol
|
|
4985
|
+
})
|
|
4986
|
+
});
|
|
4987
|
+
this._tempLayer && this.measureResultLabel && this._tempLayer.add(this.measureResultLabel);
|
|
4988
|
+
}
|
|
4989
|
+
}, {
|
|
4990
|
+
key: "removeTempLabel",
|
|
4991
|
+
value: function removeTempLabel() {
|
|
4992
|
+
if (this.tempLabel) {
|
|
4993
|
+
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
4994
|
+
delete this.tempLabel;
|
|
4995
|
+
}
|
|
4996
|
+
}
|
|
4997
|
+
}, {
|
|
4998
|
+
key: "removeCoordLabel",
|
|
4999
|
+
value: function removeCoordLabel() {
|
|
5000
|
+
if (this.coordLabel) {
|
|
5001
|
+
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
5002
|
+
delete this.coordLabel;
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
}, {
|
|
5006
|
+
key: "removeMeasureLabel",
|
|
5007
|
+
value: function removeMeasureLabel() {
|
|
5008
|
+
if (this.measureResultLabel) {
|
|
5009
|
+
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
5010
|
+
delete this.measureResultLabel;
|
|
5011
|
+
}
|
|
5012
|
+
}
|
|
5013
|
+
}, {
|
|
5014
|
+
key: "drawPointOnMouseMove",
|
|
5015
|
+
value: function drawPointOnMouseMove(event) {
|
|
5016
|
+
if (this.tempLabel) {
|
|
5017
|
+
this.tempLabel.position = event.point.position;
|
|
5018
|
+
}
|
|
5019
|
+
}
|
|
5020
|
+
}, {
|
|
5021
|
+
key: "setCursor",
|
|
5022
|
+
value: function setCursor(cursor) {
|
|
5023
|
+
const {
|
|
5024
|
+
wrapper
|
|
5025
|
+
} = this.painter;
|
|
5026
|
+
|
|
5027
|
+
if (wrapper && typeof wrapper !== 'string') {
|
|
5028
|
+
wrapper.style.cursor = cursor;
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5031
|
+
}]);
|
|
5010
5032
|
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
onClick: () => {}
|
|
5014
|
-
}));
|
|
5015
|
-
};
|
|
5033
|
+
return BaseMeasureToolCreator;
|
|
5034
|
+
}(PolylineControl.PolylineControl);
|
|
5016
5035
|
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
const MapLegendContainer = /*#__PURE__*/styled__default.div(_templateObject2$6 || (_templateObject2$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 12.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1.625rem;\n width: 1.625rem;\n }\n"])));
|
|
5020
|
-
const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-weight: 500;\n"])));
|
|
5021
|
-
const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
|
|
5022
|
-
const MapLegendItem = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n height: 1rem;\n background: ", ";\n border: 1px rgba(48, 69, 79, 0.1) solid;\n margin-right: -1px;\n \n ", "\n"])), _ref => {
|
|
5023
|
-
let {
|
|
5024
|
-
value
|
|
5025
|
-
} = _ref;
|
|
5026
|
-
return typeof value === "number" ? "none" : value;
|
|
5027
|
-
}, _ref2 => {
|
|
5028
|
-
let {
|
|
5029
|
-
value
|
|
5030
|
-
} = _ref2;
|
|
5031
|
-
return !!value && typeof value === "number" && SizeLegendMixin(value);
|
|
5032
|
-
});
|
|
5033
|
-
const MapLegendOther = /*#__PURE__*/styled__default(MapLegendItem)(_templateObject6$2 || (_templateObject6$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: none;\n width: 1rem;\n margin-left: 0.25rem;\n border-radius: 0.125rem;\n"])));
|
|
5034
|
-
const SizeOverlayLegendMixin = /*#__PURE__*/styled.css(_templateObject7$2 || (_templateObject7$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 2rem;\n height: 2rem;\n \n ", ", ", " {\n flex: none;\n position: absolute;\n top: 0;\n left: 50%;\n width: inherit;\n height: inherit;\n margin-left: -1rem;\n \n :after {\n top: 0;\n margin-top: 0;\n }\n }\n"])), MapLegendItem, MapLegendOther);
|
|
5035
|
-
const MapLegendItems = /*#__PURE__*/styled__default.div(_templateObject8$2 || (_templateObject8$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n"])), _ref3 => {
|
|
5036
|
-
let {
|
|
5037
|
-
overlay
|
|
5038
|
-
} = _ref3;
|
|
5039
|
-
return overlay && SizeOverlayLegendMixin;
|
|
5040
|
-
});
|
|
5036
|
+
let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
|
|
5037
|
+
_inherits(BaseMeasureToolEditor, _PolyEditor);
|
|
5041
5038
|
|
|
5042
|
-
|
|
5043
|
-
if (value === void 0) {
|
|
5044
|
-
value = 0;
|
|
5045
|
-
}
|
|
5039
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
|
|
5046
5040
|
|
|
5047
|
-
|
|
5048
|
-
|
|
5041
|
+
function BaseMeasureToolEditor(map, painter, params) {
|
|
5042
|
+
var _this;
|
|
5049
5043
|
|
|
5050
|
-
|
|
5051
|
-
const MapLegendValuesRange = /*#__PURE__*/styled__default.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
5052
|
-
const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
|
|
5053
|
-
const MapLegendExpandButton = /*#__PURE__*/styled__default.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin: 0.1rem 0 0.5rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
|
|
5044
|
+
_classCallCheck(this, BaseMeasureToolEditor);
|
|
5054
5045
|
|
|
5055
|
-
|
|
5056
|
-
var _title$split;
|
|
5046
|
+
_this = _super.call(this, map, params);
|
|
5057
5047
|
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5048
|
+
_this.measureResult = () => {
|
|
5049
|
+
const feature = _this.activeFeature;
|
|
5050
|
+
if (!feature) return null;
|
|
5051
|
+
const {
|
|
5052
|
+
rings,
|
|
5053
|
+
isEnclosed,
|
|
5054
|
+
crs
|
|
5055
|
+
} = feature;
|
|
5056
|
+
const pointsCount = rings[0].length;
|
|
5057
|
+
const position = rings[0][pointsCount - 1];
|
|
5058
|
+
const area = geotools.area(rings, crs);
|
|
5059
|
+
const length = geotools.length(rings, crs, isEnclosed);
|
|
5060
|
+
const content = isEnclosed ? _this.formatters.polygon(area, length) : _this.formatters.length(length);
|
|
5061
|
+
return {
|
|
5062
|
+
content,
|
|
5063
|
+
position
|
|
5064
|
+
};
|
|
5065
|
+
};
|
|
5062
5066
|
|
|
5063
|
-
|
|
5064
|
-
|
|
5067
|
+
_this.removeFeature = () => {
|
|
5068
|
+
_this.fire('remove');
|
|
5069
|
+
};
|
|
5065
5070
|
|
|
5066
|
-
|
|
5067
|
-
|
|
5071
|
+
_this.painter = painter;
|
|
5072
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
5073
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
5068
5074
|
|
|
5069
|
-
|
|
5070
|
-
values,
|
|
5071
|
-
title,
|
|
5072
|
-
overlay
|
|
5073
|
-
} = _ref;
|
|
5074
|
-
const currentValues = [...values];
|
|
5075
|
-
const other = currentValues.pop();
|
|
5076
|
-
return React__default.createElement(React__default.Fragment, null, !!title && React__default.createElement(MapLegendValueDescr, null, title), React__default.createElement(MapLegendItems, {
|
|
5077
|
-
overlay: overlay
|
|
5078
|
-
}, currentValues.map(value => React__default.createElement(MapLegendItem, {
|
|
5079
|
-
key: value.title,
|
|
5080
|
-
title: value.title,
|
|
5081
|
-
value: value.parameterValue
|
|
5082
|
-
})), React__default.createElement(MapLegendOther, {
|
|
5083
|
-
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
5084
|
-
value: other == null ? void 0 : other.parameterValue
|
|
5085
|
-
})), typeof (other == null ? void 0 : other.parameterValue) === "string" && React__default.createElement(MapLegendValues, null, React__default.createElement(MapLegendValuesRange, null, React__default.createElement("div", null, getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max")), React__default.createElement("div", null, getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min"))), React__default.createElement(MapLegendValuesOther, null, "-")));
|
|
5086
|
-
};
|
|
5075
|
+
_this.on('change', _this.updateMeasureResult);
|
|
5087
5076
|
|
|
5088
|
-
|
|
5089
|
-
let {
|
|
5090
|
-
layer,
|
|
5091
|
-
config,
|
|
5092
|
-
className
|
|
5093
|
-
} = _ref;
|
|
5094
|
-
const legend = useMapLegend(layer, config);
|
|
5095
|
-
const [isExpanded, toggleExpanded] = useToggle();
|
|
5077
|
+
_this.on('edit', _this.updateMeasureResult);
|
|
5096
5078
|
|
|
5097
|
-
|
|
5098
|
-
return null;
|
|
5079
|
+
return _this;
|
|
5099
5080
|
}
|
|
5100
5081
|
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
return React__default.createElement(LegendProvider, {
|
|
5106
|
-
symbol: symbol
|
|
5107
|
-
}, React__default.createElement(MapLegendControl, {
|
|
5108
|
-
className: className
|
|
5109
|
-
}, React__default.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), !!items.length && React__default.createElement(MapLegendContainer, null, isExpanded ? React__default.createElement(Legend, {
|
|
5110
|
-
layer: layer,
|
|
5111
|
-
config: config
|
|
5112
|
-
}) : React__default.createElement(React__default.Fragment, null, items.map(item => {
|
|
5113
|
-
var _symbol$fill, _item$parameter, _symbol$fill2;
|
|
5082
|
+
_createClass(BaseMeasureToolEditor, [{
|
|
5083
|
+
key: "_activate",
|
|
5084
|
+
value: function _activate() {
|
|
5085
|
+
_get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
|
|
5114
5086
|
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5087
|
+
this.addMeasureResultLabel();
|
|
5088
|
+
}
|
|
5089
|
+
}, {
|
|
5090
|
+
key: "addMeasureResultLabel",
|
|
5091
|
+
value: function addMeasureResultLabel() {
|
|
5092
|
+
const measureResult = this.measureResult();
|
|
5093
|
+
if (measureResult === null) return;
|
|
5094
|
+
const {
|
|
5095
|
+
content,
|
|
5096
|
+
position
|
|
5097
|
+
} = measureResult;
|
|
5098
|
+
this.measureResultLabel = new Label.LabelFeature(position, {
|
|
5099
|
+
content,
|
|
5100
|
+
crs: this.map.crs,
|
|
5101
|
+
symbol: createLabelSymbol({
|
|
5102
|
+
onClose: this.removeFeature,
|
|
5103
|
+
renderLabel: this.renderLabelSymbol
|
|
5104
|
+
})
|
|
5105
|
+
});
|
|
5106
|
+
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
5107
|
+
}
|
|
5108
|
+
}, {
|
|
5109
|
+
key: "updateMeasureResult",
|
|
5110
|
+
value: function updateMeasureResult() {
|
|
5111
|
+
if (this.measureResultLabel) {
|
|
5112
|
+
const measureResult = this.measureResult();
|
|
5113
|
+
if (measureResult === null) return;
|
|
5114
|
+
const {
|
|
5115
|
+
content,
|
|
5116
|
+
position
|
|
5117
|
+
} = measureResult;
|
|
5118
|
+
this.measureResultLabel.content = content;
|
|
5119
|
+
this.measureResultLabel.position = position;
|
|
5120
|
+
}
|
|
5121
|
+
}
|
|
5122
|
+
}]);
|
|
5130
5123
|
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
let {
|
|
5134
|
-
value,
|
|
5135
|
-
parameter
|
|
5136
|
-
} = _ref;
|
|
5137
|
-
return React__default.createElement(LegendSymbol, {
|
|
5138
|
-
key: value.title,
|
|
5139
|
-
parameter: parameter,
|
|
5140
|
-
parameterValue: value.parameterValue
|
|
5141
|
-
}, symbol => React__default.createElement(Symbol, {
|
|
5142
|
-
render: getMapLegendSymbolRenders,
|
|
5143
|
-
symbol: symbol,
|
|
5144
|
-
size: MAX_SIZE$2
|
|
5145
|
-
}));
|
|
5146
|
-
};
|
|
5124
|
+
return BaseMeasureToolEditor;
|
|
5125
|
+
}(PolyEditor.PolyEditor);
|
|
5147
5126
|
|
|
5148
5127
|
let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
5149
5128
|
_inherits(MeasureTool, _React$Component);
|
|
@@ -5333,7 +5312,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
|
5333
5312
|
}(React__default.Component);
|
|
5334
5313
|
|
|
5335
5314
|
const _excluded$3 = ["isActive"];
|
|
5336
|
-
const Measurer = _ref => {
|
|
5315
|
+
const Measurer = (_ref) => {
|
|
5337
5316
|
let {
|
|
5338
5317
|
isActive
|
|
5339
5318
|
} = _ref,
|
|
@@ -5351,18 +5330,18 @@ const Measurer = _ref => {
|
|
|
5351
5330
|
|
|
5352
5331
|
var _templateObject$7, _templateObject2$7, _templateObject3$5;
|
|
5353
5332
|
const ScaleRulerContainer = /*#__PURE__*/styled__default.div(_templateObject$7 || (_templateObject$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 2rem;\n cursor: default;\n display: flex;\n align-items: flex-end;\n padding: 0 0.5rem 0.5rem;\n box-sizing: border-box;\n"])));
|
|
5354
|
-
const ScaleRulerBlock = /*#__PURE__*/styled__default.div(_templateObject2$7 || (_templateObject2$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: flex-end;\n justify-content: center;\n width: ", ";\n height: 0.25rem;\n border: 0.0625rem solid white;\n border-top: 0;\n"])), _ref => {
|
|
5333
|
+
const ScaleRulerBlock = /*#__PURE__*/styled__default.div(_templateObject2$7 || (_templateObject2$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: flex-end;\n justify-content: center;\n width: ", ";\n height: 0.25rem;\n border: 0.0625rem solid white;\n border-top: 0;\n"])), (_ref) => {
|
|
5355
5334
|
let {
|
|
5356
5335
|
width
|
|
5357
5336
|
} = _ref;
|
|
5358
5337
|
return width + "px";
|
|
5359
5338
|
});
|
|
5360
|
-
const TextContainer = /*#__PURE__*/styled__default.div(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 2rem;\n display: flex;\n justify-content: center;\n align-items: ", ";\n width: ", ";\n color: #fff;\n font-size: 1rem;\n cursor: default;\n padding: 0 0.5rem;\n"])), _ref2 => {
|
|
5339
|
+
const TextContainer = /*#__PURE__*/styled__default.div(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 2rem;\n display: flex;\n justify-content: center;\n align-items: ", ";\n width: ", ";\n color: #fff;\n font-size: 1rem;\n cursor: default;\n padding: 0 0.5rem;\n"])), (_ref2) => {
|
|
5361
5340
|
let {
|
|
5362
5341
|
alignEnd
|
|
5363
5342
|
} = _ref2;
|
|
5364
5343
|
return alignEnd ? 'flex-end' : 'center';
|
|
5365
|
-
}, _ref3 => {
|
|
5344
|
+
}, (_ref3) => {
|
|
5366
5345
|
let {
|
|
5367
5346
|
width
|
|
5368
5347
|
} = _ref3;
|
|
@@ -5387,7 +5366,7 @@ const ScaleRuler = () => {
|
|
|
5387
5366
|
}, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
|
|
5388
5367
|
};
|
|
5389
5368
|
|
|
5390
|
-
const Zoom = _ref => {
|
|
5369
|
+
const Zoom = (_ref) => {
|
|
5391
5370
|
let {
|
|
5392
5371
|
children
|
|
5393
5372
|
} = _ref;
|
|
@@ -5436,7 +5415,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
|
|
|
5436
5415
|
return styled.css(_templateObject9$2 || (_templateObject9$2 = _taggedTemplateLiteralLoose(["\n ", "\n ", "\n ", "\n ", "\n"])), placement === 'top' && top(distance, cornerSize), placement === 'right' && right(distance, cornerSize), placement === 'left' && left(distance, cornerSize), placement === 'bottom' && bottom(distance, cornerSize));
|
|
5437
5416
|
};
|
|
5438
5417
|
const corner = /*#__PURE__*/styled.css(_templateObject10$2 || (_templateObject10$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n &:before {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n }\n"])));
|
|
5439
|
-
const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$2 || (_templateObject11$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 999;\n display: flex;\n font-size: 0.625rem;\n color: #fff;\n background-color: rgba(28, 33, 48, 0.8);\n padding: 0.4em 0.6em;\n border-radius: 2px;\n user-select: none;\n box-sizing: border-box;\n white-space: pre;\n ", "\n ", "\n"])), _ref => {
|
|
5418
|
+
const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$2 || (_templateObject11$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 999;\n display: flex;\n font-size: 0.625rem;\n color: #fff;\n background-color: rgba(28, 33, 48, 0.8);\n padding: 0.4em 0.6em;\n border-radius: 2px;\n user-select: none;\n box-sizing: border-box;\n white-space: pre;\n ", "\n ", "\n"])), (_ref) => {
|
|
5440
5419
|
let {
|
|
5441
5420
|
placement,
|
|
5442
5421
|
distance = '0.5rem',
|
|
@@ -5444,7 +5423,7 @@ const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$2 ||
|
|
|
5444
5423
|
cornerSize = '0.25rem'
|
|
5445
5424
|
} = _ref;
|
|
5446
5425
|
return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
|
|
5447
|
-
}, _ref2 => {
|
|
5426
|
+
}, (_ref2) => {
|
|
5448
5427
|
let {
|
|
5449
5428
|
withArrow
|
|
5450
5429
|
} = _ref2;
|
|
@@ -5458,7 +5437,7 @@ const {
|
|
|
5458
5437
|
Consumer
|
|
5459
5438
|
} = /*#__PURE__*/React.createContext([]); // TODO I just cant read that
|
|
5460
5439
|
|
|
5461
|
-
const Tooltip = _ref => {
|
|
5440
|
+
const Tooltip = (_ref) => {
|
|
5462
5441
|
let {
|
|
5463
5442
|
features = [],
|
|
5464
5443
|
map,
|
|
@@ -5497,7 +5476,7 @@ const Noop = () => React__default.createElement("div", {
|
|
|
5497
5476
|
}
|
|
5498
5477
|
});
|
|
5499
5478
|
|
|
5500
|
-
const DraggableMarker = _ref => {
|
|
5479
|
+
const DraggableMarker = (_ref) => {
|
|
5501
5480
|
let {
|
|
5502
5481
|
position,
|
|
5503
5482
|
onChange,
|
|
@@ -5511,6 +5490,21 @@ const DraggableMarker = _ref => {
|
|
|
5511
5490
|
return React__default.createElement(React.Fragment, null);
|
|
5512
5491
|
};
|
|
5513
5492
|
|
|
5493
|
+
const polygonCircleFromPoint = (center, diameter) => {
|
|
5494
|
+
const coordinates = [];
|
|
5495
|
+
const radius = diameter / 2;
|
|
5496
|
+
const endAngle = Math.PI * 2;
|
|
5497
|
+
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
5498
|
+
let start = 0;
|
|
5499
|
+
let end = endAngle;
|
|
5500
|
+
|
|
5501
|
+
for (let ang = start; ang < end; ang += step) {
|
|
5502
|
+
coordinates.push([Math.cos(ang) * radius + center[0], Math.sin(ang) * radius + center[1]]);
|
|
5503
|
+
}
|
|
5504
|
+
|
|
5505
|
+
return [coordinates];
|
|
5506
|
+
};
|
|
5507
|
+
|
|
5514
5508
|
exports.ArrowLineMiterRender = ArrowLineMiterRender;
|
|
5515
5509
|
exports.BaseMeasureToolCreator = BaseMeasureToolCreator;
|
|
5516
5510
|
exports.BaseMeasureToolEditor = BaseMeasureToolEditor;
|
|
@@ -5569,8 +5563,10 @@ exports.MapControl = MapControl;
|
|
|
5569
5563
|
exports.MapControls = MapControls;
|
|
5570
5564
|
exports.MapLegend = MapLegend;
|
|
5571
5565
|
exports.MapLegendContainer = MapLegendContainer;
|
|
5566
|
+
exports.MapLegendExpandButton = MapLegendExpandButton;
|
|
5572
5567
|
exports.MapLegendHeader = MapLegendHeader;
|
|
5573
5568
|
exports.MapLegendSymbol = MapLegendSymbol;
|
|
5569
|
+
exports.MapLegendValueDescr = MapLegendValueDescr;
|
|
5574
5570
|
exports.MapProvider = MapProvider;
|
|
5575
5571
|
exports.Measure = Measure;
|
|
5576
5572
|
exports.MeasureTool = MeasureTool;
|