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