@evergis/react 2.0.111 → 2.0.112

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
@@ -17,12 +17,8 @@ import { ImageFill } from '@evergis/sgis/es/symbols/polygon/ImageFill';
17
17
  import { PolygonSymbol } from '@evergis/sgis/es/symbols/polygon/Simple';
18
18
  import { PolylineSymbol } from '@evergis/sgis/es/symbols/PolylineSymbol';
19
19
  import { PolyRender, FillStyle } from '@evergis/sgis/es/renders/Poly';
20
- import { projectRings, length, area, distance } from '@evergis/sgis/es/geotools';
20
+ import { projectRings, distance, length, area } from '@evergis/sgis/es/geotools';
21
21
  import { simplifyCoordinates, softEquals } from '@evergis/sgis/es/utils/math';
22
- import { PolylineControl } from '@evergis/sgis/es/controls/PolylineControl';
23
- import { LabelFeature } from '@evergis/sgis/es/features/Label';
24
- import { DrawingFinishEvent } from '@evergis/sgis/es/controls/Control';
25
- import { PolyEditor } from '@evergis/sgis/es/controls/PolyEditor';
26
22
  import ReactDOM from 'react-dom';
27
23
  import { DynamicPointSymbol, Symbol as Symbol$1 } from '@evergis/sgis/es/symbols/Symbol';
28
24
  import { Poly } from '@evergis/sgis/es/features/Poly';
@@ -35,6 +31,7 @@ import { SquareSymbol } from '@evergis/sgis/es/symbols/point/Square';
35
31
  import { MaskedImage } from '@evergis/sgis/es/symbols/point/MaskedImage';
36
32
  import { Canvas } from '@evergis/sgis/es/painters/DomPainter/Canvas';
37
33
  import { sGisClickEvent } from '@evergis/sgis/es/commonEvents';
34
+ import { LabelFeature } from '@evergis/sgis/es/features/Label';
38
35
  import { ClusterLayer as ClusterLayer$1 } from '@evergis/sgis/es/layers/ClusterLayer';
39
36
  import { GridClusterProvider } from '@evergis/sgis/es/layers/clusterProviders/GridClusterProvider';
40
37
  import { PointEditor } from '@evergis/sgis/es/controls/PointEditor';
@@ -43,6 +40,9 @@ import styled, { css } from 'styled-components';
43
40
  import { Icon } from '@evergis/ui';
44
41
  import punycode from 'punycode';
45
42
  import { TileLayer as TileLayer$1 } from '@evergis/sgis/es/layers/TileLayer';
43
+ import { PolylineControl } from '@evergis/sgis/es/controls/PolylineControl';
44
+ import { DrawingFinishEvent } from '@evergis/sgis/es/controls/Control';
45
+ import { PolyEditor } from '@evergis/sgis/es/controls/PolyEditor';
46
46
 
47
47
  function _classCallCheck(instance, Constructor) {
48
48
  if (!(instance instanceof Constructor)) {
@@ -63,9 +63,6 @@ function _defineProperties(target, props) {
63
63
  function _createClass(Constructor, protoProps, staticProps) {
64
64
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
65
65
  if (staticProps) _defineProperties(Constructor, staticProps);
66
- Object.defineProperty(Constructor, "prototype", {
67
- writable: false
68
- });
69
66
  return Constructor;
70
67
  }
71
68
 
@@ -99,9 +96,6 @@ function _inherits(subClass, superClass) {
99
96
  configurable: true
100
97
  }
101
98
  });
102
- Object.defineProperty(subClass, "prototype", {
103
- writable: false
104
- });
105
99
  if (superClass) _setPrototypeOf(subClass, superClass);
106
100
  }
107
101
 
@@ -160,8 +154,6 @@ function _assertThisInitialized(self) {
160
154
  function _possibleConstructorReturn(self, call) {
161
155
  if (call && (typeof call === "object" || typeof call === "function")) {
162
156
  return call;
163
- } else if (call !== void 0) {
164
- throw new TypeError("Derived constructors may only return object or undefined");
165
157
  }
166
158
 
167
159
  return _assertThisInitialized(self);
@@ -195,7 +187,7 @@ function _superPropBase(object, property) {
195
187
  return object;
196
188
  }
197
189
 
198
- function _get() {
190
+ function _get(target, property, receiver) {
199
191
  if (typeof Reflect !== "undefined" && Reflect.get) {
200
192
  _get = Reflect.get;
201
193
  } else {
@@ -206,14 +198,14 @@ function _get() {
206
198
  var desc = Object.getOwnPropertyDescriptor(base, property);
207
199
 
208
200
  if (desc.get) {
209
- return desc.get.call(arguments.length < 3 ? target : receiver);
201
+ return desc.get.call(receiver);
210
202
  }
211
203
 
212
204
  return desc.value;
213
205
  };
214
206
  }
215
207
 
216
- return _get.apply(this, arguments);
208
+ return _get(target, property, receiver || target);
217
209
  }
218
210
 
219
211
  function _taggedTemplateLiteralLoose(strings, raw) {
@@ -242,7 +234,7 @@ const defaultApi = /*#__PURE__*/new Api({
242
234
  url: BASE_URL
243
235
  });
244
236
  const evergisContext = /*#__PURE__*/createContext(defaultApi);
245
- const EvergisProvider = _ref => {
237
+ const EvergisProvider = (_ref) => {
246
238
  let {
247
239
  api,
248
240
  children
@@ -260,7 +252,7 @@ const mapContext = /*#__PURE__*/createContext({
260
252
  map: defaultMap,
261
253
  painter: defaultPainter
262
254
  });
263
- const MapProvider = _ref => {
255
+ const MapProvider = (_ref) => {
264
256
  let {
265
257
  map,
266
258
  painter,
@@ -282,7 +274,7 @@ const tooltipContext = /*#__PURE__*/createContext({
282
274
  layer: defaultLayer,
283
275
  popupLayer: defaultPopupLayer
284
276
  });
285
- const TooltipProvider = _ref => {
277
+ const TooltipProvider = (_ref) => {
286
278
  let {
287
279
  layer,
288
280
  popupLayer,
@@ -299,7 +291,7 @@ const TooltipProvider = _ref => {
299
291
  const useTooltipContext = () => useContext(tooltipContext);
300
292
 
301
293
  const LegendContext = /*#__PURE__*/createContext(null);
302
- const LegendProvider = _ref => {
294
+ const LegendProvider = (_ref) => {
303
295
  let {
304
296
  symbol,
305
297
  children
@@ -311,7 +303,7 @@ const LegendProvider = _ref => {
311
303
  const useLegendContext = () => useContext(LegendContext);
312
304
 
313
305
  const evergisSelectContext = /*#__PURE__*/createContext([]);
314
- const EvergisSelectProvider = _ref => {
306
+ const EvergisSelectProvider = (_ref) => {
315
307
  let {
316
308
  layers,
317
309
  children
@@ -356,7 +348,7 @@ function useMapViewActions() {
356
348
  }, [map]);
357
349
  const zoomIn = useCallback(() => zoomTo(1), [zoomTo]);
358
350
  const zoomOut = useCallback(() => zoomTo(-1), [zoomTo]);
359
- const animateTo = useCallback(_ref => {
351
+ const animateTo = useCallback((_ref) => {
360
352
  let {
361
353
  position,
362
354
  resolution,
@@ -386,7 +378,7 @@ function useMapViewActions() {
386
378
  const {
387
379
  tileScheme
388
380
  } = map;
389
- let tileLevel = tileScheme.levels.find(_ref2 => {
381
+ let tileLevel = tileScheme.levels.find((_ref2) => {
390
382
  let {
391
383
  zIndex
392
384
  } = _ref2;
@@ -562,7 +554,7 @@ const formatStringAttribute = value => {
562
554
 
563
555
  const attributeValues = value.split(/[\s|]/).map(convertStringAttribute);
564
556
 
565
- if (attributeValues.every(_ref => {
557
+ if (attributeValues.every((_ref) => {
566
558
  let {
567
559
  type
568
560
  } = _ref;
@@ -570,7 +562,7 @@ const formatStringAttribute = value => {
570
562
  }
571
563
  /* String */
572
564
  )) {
573
- return [stringAttribute(attributeValues.map(_ref2 => {
565
+ return [stringAttribute(attributeValues.map((_ref2) => {
574
566
  let {
575
567
  value
576
568
  } = _ref2;
@@ -1053,7 +1045,7 @@ const getFeatureAttributeType = attributeValue => {
1053
1045
  };
1054
1046
  const getLayerAttributes = layerDefinition => {
1055
1047
  const attributes = layerDefinition && layerDefinition.attributes || {};
1056
- return Object.entries(attributes).map(_ref => {
1048
+ return Object.entries(attributes).map((_ref) => {
1057
1049
  let [name, definition] = _ref;
1058
1050
  return _extends({
1059
1051
  name
@@ -1061,7 +1053,7 @@ const getLayerAttributes = layerDefinition => {
1061
1053
  });
1062
1054
  };
1063
1055
  const getFeatureAttributes = attributes => {
1064
- return attributes ? Object.entries(attributes).map(_ref2 => {
1056
+ return attributes ? Object.entries(attributes).map((_ref2) => {
1065
1057
  let [name, value] = _ref2;
1066
1058
  return {
1067
1059
  name,
@@ -1079,7 +1071,7 @@ const getClassificationAttribute = (attributeName, attributes) => {
1079
1071
  return attribute ? _extends({}, attrNamePart, attribute) : attrNamePart;
1080
1072
  };
1081
1073
  const mergeAttributes = (attributes1, attributes2) => {
1082
- return attributes1.map(attribute => _extends({}, attribute, attributes2.find(_ref3 => {
1074
+ return attributes1.map(attribute => _extends({}, attribute, attributes2.find((_ref3) => {
1083
1075
  let {
1084
1076
  name
1085
1077
  } = _ref3;
@@ -1494,7 +1486,7 @@ let SGisPolygonSymbol = /*#__PURE__*/function (_sPolygonSymbol) {
1494
1486
  const adaptMiterRings = (rings, resolution, fromCrs, toCrs) => {
1495
1487
  const projected = projectRings(rings, fromCrs, toCrs);
1496
1488
  return simplifyCoordinates(projected.map(ring => // @ts-ignore
1497
- ring.map(_ref => {
1489
+ ring.map((_ref) => {
1498
1490
  let [x, y] = _ref;
1499
1491
  return [x / resolution, y / -resolution];
1500
1492
  })), 1);
@@ -1586,1518 +1578,1178 @@ let ArrowLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
1586
1578
  return ArrowLineMiterRender;
1587
1579
  }(LineMiterRender);
1588
1580
 
1589
- const DEFAULT_FORMATTERS = {
1590
- polygon: formatPolygonMeasure,
1591
- length: formatLength
1592
- };
1593
-
1594
- const COORD_FRACTION = 6;
1595
- const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
1596
- let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
1597
- _inherits(BaseMeasureToolCreator, _PolylineControl);
1598
-
1599
- var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
1581
+ let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
1582
+ _inherits(CircleLineMiterRender, _LineMiterRender);
1600
1583
 
1601
- function BaseMeasureToolCreator(map, painter, params) {
1602
- var _this;
1584
+ var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
1603
1585
 
1604
- _classCallCheck(this, BaseMeasureToolCreator);
1586
+ function CircleLineMiterRender() {
1587
+ _classCallCheck(this, CircleLineMiterRender);
1605
1588
 
1606
- _this = _super.call(this, map, params);
1589
+ return _super.apply(this, arguments);
1590
+ }
1607
1591
 
1608
- _this.cancel = () => {
1609
- _this.fire('cancel');
1610
- };
1592
+ _createClass(CircleLineMiterRender, [{
1593
+ key: "usageSize",
1594
+ get: function get() {
1595
+ return this.miterSize + this.strokeWidth * 3;
1596
+ }
1597
+ }, {
1598
+ key: "createRings",
1599
+ value: function createRings(_ref, xMultiplier) {
1600
+ let [x, y] = _ref;
1601
+ return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
1602
+ }
1603
+ }, {
1604
+ key: "createRender",
1605
+ value: function createRender(miterRings) {
1606
+ const isFilled = this.kind === LineMiterKind.FilledCircle;
1607
+ return new PolyRender(polygonCircleFromPoint(miterRings[0][0], this.miterSize), {
1608
+ fillColor: isFilled ? this.color : 'transparent',
1609
+ strokeColor: this.color,
1610
+ strokeWidth: this.strokeWidth,
1611
+ enclosed: true
1612
+ });
1613
+ }
1614
+ }]);
1611
1615
 
1612
- _this.painter = painter;
1613
- _this.renderLabelSymbol = params.renderLabelSymbol;
1614
- _this.formatters = params.formatters || DEFAULT_FORMATTERS;
1615
- _this.areaSymbol = params.areaSymbol;
1616
+ return CircleLineMiterRender;
1617
+ }(LineMiterRender);
1616
1618
 
1617
- _this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
1619
+ let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
1620
+ _inherits(SquareLineMiterRender, _LineMiterRender);
1618
1621
 
1622
+ var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
1619
1623
 
1620
- _this.on('change', _this.updateDistance);
1624
+ function SquareLineMiterRender() {
1625
+ _classCallCheck(this, SquareLineMiterRender);
1621
1626
 
1622
- return _this;
1627
+ return _super.apply(this, arguments);
1623
1628
  }
1624
1629
 
1625
- _createClass(BaseMeasureToolCreator, [{
1626
- key: "_handleMousemove",
1627
- value: function _handleMousemove(event) {
1628
- _get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_handleMousemove", this).call(this, event);
1629
-
1630
- this.drawPointOnMouseMove(event);
1630
+ _createClass(SquareLineMiterRender, [{
1631
+ key: "usageSize",
1632
+ get: function get() {
1633
+ return this.miterSize + this.strokeWidth;
1631
1634
  }
1632
1635
  }, {
1633
- key: "_activate",
1634
- value: function _activate() {
1635
- _get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_activate", this).call(this);
1636
-
1637
- this.addTempLabel();
1638
- this.setCursor('pointer');
1636
+ key: "createRings",
1637
+ value: function createRings(_ref, xMultiplier) {
1638
+ let [x, y] = _ref;
1639
+ 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]]];
1639
1640
  }
1640
1641
  }, {
1641
- key: "_deactivate",
1642
- value: function _deactivate() {
1643
- _get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_deactivate", this).call(this);
1642
+ key: "createRender",
1643
+ value: function createRender(miterRings) {
1644
+ const isFilled = this.kind === LineMiterKind.FilledSquare;
1645
+ return new PolyRender(miterRings, {
1646
+ enclosed: true,
1647
+ fillColor: isFilled ? this.color : void 0,
1648
+ fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
1649
+ lineCap: 'square',
1650
+ lineJoin: 'miter',
1651
+ strokeColor: this.color,
1652
+ strokeWidth: this.strokeWidth
1653
+ });
1654
+ }
1655
+ }]);
1644
1656
 
1645
- this.removeCoordLabel();
1646
- this.removeTempLabel();
1647
- this.removeMeasureLabel();
1648
- this.removeTempPolygon();
1649
- this.setCursor('default');
1657
+ return SquareLineMiterRender;
1658
+ }(LineMiterRender);
1659
+
1660
+ const getLineMiterRender = options => {
1661
+ switch (options.kind) {
1662
+ case LineMiterKind.Arrow:
1663
+ case LineMiterKind.FilledArrow:
1664
+ return new ArrowLineMiterRender(options);
1665
+
1666
+ case LineMiterKind.Square:
1667
+ case LineMiterKind.FilledSquare:
1668
+ return new SquareLineMiterRender(options);
1669
+
1670
+ case LineMiterKind.Circle:
1671
+ case LineMiterKind.FilledCircle:
1672
+ return new CircleLineMiterRender(options);
1673
+
1674
+ default:
1675
+ return null;
1676
+ }
1677
+ };
1678
+
1679
+ const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
1680
+ const reversedRing = ring.slice().reverse();
1681
+
1682
+ for (let i = 0; i < reversedRing.length; i++) {
1683
+ const coordinates = reversedRing[i];
1684
+
1685
+ if (isLastRing && i === 0) {
1686
+ reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
1650
1687
  }
1651
- }, {
1652
- key: "handlePointAdd",
1653
- value: function handlePointAdd() {
1654
- const feature = this.activeFeature;
1655
- if (!feature) return;
1656
- const {
1657
- rings,
1658
- crs
1659
- } = feature;
1660
1688
 
1661
- if (isPolylineLikePolygon(rings, this.map.resolution)) {
1662
- this.finishDrawing();
1663
- this.fire(new DrawingFinishEvent(feature, new MouseEvent('mouseup')));
1664
- return;
1665
- }
1689
+ const nextCoordinates = reversedRing[i - 1];
1666
1690
 
1667
- if (rings[0].length === 2) {
1668
- const projection = crs.projectionTo(geo);
1669
- const point = rings[0][0];
1670
- if (!projection) return;
1671
- const [lat, long] = projection(point);
1672
- this.removeTempLabel();
1673
- this.addMeasureResultLabel();
1674
- this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
1675
- } else {
1676
- this.removeCoordLabel();
1677
- }
1691
+ if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
1692
+ reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
1678
1693
  }
1679
- }, {
1680
- key: "polygonPreview",
1681
- value: function polygonPreview() {
1682
- if (this.tempPolygon) {
1683
- this._tempLayer && this._tempLayer.remove(this.tempPolygon);
1684
- }
1694
+ }
1685
1695
 
1686
- const feature = this.activeFeature;
1687
- if (!feature) return;
1688
- const {
1689
- rings,
1690
- crs
1691
- } = feature;
1692
- const polygonRings = [...rings[0]];
1693
- polygonRings.shift();
1694
- this.tempPolygon = new Polygon(polygonRings, {
1695
- crs
1696
- });
1697
- this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
1698
- this.activeFeature && this.activeFeature.hide();
1699
- this._tempLayer && this._tempLayer.add(this.tempPolygon);
1696
+ return reversedRing.reverse();
1697
+ };
1698
+
1699
+ const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
1700
+ const newRing = ring.slice();
1701
+
1702
+ for (let i = 0; i < newRing.length; i++) {
1703
+ const coordinates = newRing[i];
1704
+
1705
+ if (i === 0 && isFirstRing) {
1706
+ newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
1700
1707
  }
1701
- }, {
1702
- key: "removeTempPolygon",
1703
- value: function removeTempPolygon() {
1704
- if (this.tempPolygon) {
1705
- this._tempLayer && this._tempLayer.remove(this.tempPolygon);
1706
- delete this.tempPolygon;
1707
- }
1708
+
1709
+ const prevCoordinates = newRing[i - 1];
1710
+
1711
+ if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
1712
+ newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
1708
1713
  }
1709
- }, {
1710
- key: "updateDistance",
1711
- value: function updateDistance(event) {
1712
- const feature = this.activeFeature;
1713
- const {
1714
- ringIndex,
1715
- pointIndex
1716
- } = event;
1717
- if (!feature || ringIndex === null || pointIndex === null) return;
1718
- const {
1719
- rings,
1720
- crs
1721
- } = feature;
1722
- const position = rings[ringIndex][pointIndex];
1723
- const length$1 = length(rings, crs);
1724
- let content = this.formatters.length(length$1);
1714
+ }
1725
1715
 
1726
- if (isPolylineLikePolygon(rings, this.map.resolution)) {
1727
- this.polygonPreview();
1728
- const area$1 = area(rings, crs);
1729
- content = this.formatters.polygon(area$1, length$1);
1730
- } else if (this.tempPolygon) {
1731
- feature.show();
1732
- this.removeTempPolygon();
1733
- }
1716
+ return newRing;
1717
+ };
1734
1718
 
1735
- if (this.measureResultLabel) {
1736
- this.measureResultLabel.position = position;
1737
- this.measureResultLabel.content = content;
1738
- }
1719
+ const updateRingsForMiter = (rings, position, miterSize) => {
1720
+ return rings.map((ring, ringIndex) => {
1721
+ switch (position) {
1722
+ case 'right':
1723
+ return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
1724
+
1725
+ default:
1726
+ return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
1739
1727
  }
1740
- }, {
1741
- key: "addTempLabel",
1742
- value: function addTempLabel() {
1743
- this.tempLabel = new LabelFeature(DEFAULT_LABEL_POSITION, {
1744
- content: 'Нажмите на карту, чтобы начать измерение',
1745
- crs: this.map.crs,
1746
- symbol: createLabelSymbol({
1747
- renderLabel: this.renderLabelSymbol
1748
- })
1749
- });
1750
- this._tempLayer && this._tempLayer.add(this.tempLabel);
1751
- }
1752
- }, {
1753
- key: "addCoordLabel",
1754
- value: function addCoordLabel(content, position) {
1755
- this.coordLabel = new LabelFeature(position, {
1756
- content,
1757
- crs: this.map.crs,
1758
- symbol: createLabelSymbol({
1759
- renderLabel: this.renderLabelSymbol,
1760
- onClose: this.cancel
1761
- })
1728
+ });
1729
+ };
1730
+
1731
+ const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
1732
+ let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
1733
+ _inherits(SGisPolylineSymbol, _sPolylineSymbol);
1734
+
1735
+ var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
1736
+
1737
+ function SGisPolylineSymbol(originalSymbol) {
1738
+ var _originalSymbol$strok, _originalSymbol$strok2;
1739
+
1740
+ var _this;
1741
+
1742
+ _classCallCheck(this, SGisPolylineSymbol);
1743
+
1744
+ _this = _super.call(this, {
1745
+ // @ts-ignore
1746
+ strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
1747
+ strokeWidth: clamp( // @ts-ignore
1748
+ getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
1749
+ // @ts-ignore
1750
+ lineDash: getLineDash(originalSymbol.stroke),
1751
+ // @ts-ignore
1752
+ lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
1753
+ });
1754
+ _this.originalSymbol = originalSymbol;
1755
+ return _this;
1756
+ }
1757
+
1758
+ _createClass(SGisPolylineSymbol, [{
1759
+ key: "renderFunction",
1760
+ value: function renderFunction(feature, resolution, crs) {
1761
+ if (!isSimplePolylineSymbol(this.originalSymbol)) return _get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, feature, resolution, crs);
1762
+ const {
1763
+ ending,
1764
+ beginningSize,
1765
+ beginning,
1766
+ endingSize
1767
+ } = this.originalSymbol;
1768
+ const renders = [];
1769
+ const featureCopy = feature.clone();
1770
+ const beginningMiterRender = getLineMiterRender({
1771
+ color: this.strokeColor,
1772
+ // @ts-ignore
1773
+ kind: beginning,
1774
+ position: 'left',
1775
+ // @ts-ignore
1776
+ size: beginningSize,
1777
+ strokeWidth: this.strokeWidth
1762
1778
  });
1763
- this._tempLayer && this.coordLabel && this._tempLayer.add(this.coordLabel);
1764
- }
1765
- }, {
1766
- key: "addMeasureResultLabel",
1767
- value: function addMeasureResultLabel() {
1768
- this.measureResultLabel = new LabelFeature(DEFAULT_LABEL_POSITION, {
1769
- crs: this.map.crs,
1770
- symbol: createLabelSymbol({
1771
- renderLabel: this.renderLabelSymbol
1772
- })
1779
+ const endingMiterRender = getLineMiterRender({
1780
+ color: this.strokeColor,
1781
+ // @ts-ignore
1782
+ kind: ending,
1783
+ position: 'right',
1784
+ // @ts-ignore
1785
+ size: endingSize,
1786
+ strokeWidth: this.strokeWidth
1773
1787
  });
1774
- this._tempLayer && this.measureResultLabel && this._tempLayer.add(this.measureResultLabel);
1775
- }
1776
- }, {
1777
- key: "removeTempLabel",
1778
- value: function removeTempLabel() {
1779
- if (this.tempLabel) {
1780
- this._tempLayer && this._tempLayer.remove(this.tempLabel);
1781
- delete this.tempLabel;
1782
- }
1783
- }
1784
- }, {
1785
- key: "removeCoordLabel",
1786
- value: function removeCoordLabel() {
1787
- if (this.coordLabel) {
1788
- this._tempLayer && this._tempLayer.remove(this.coordLabel);
1789
- delete this.coordLabel;
1790
- }
1791
- }
1792
- }, {
1793
- key: "removeMeasureLabel",
1794
- value: function removeMeasureLabel() {
1795
- if (this.measureResultLabel) {
1796
- this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
1797
- delete this.measureResultLabel;
1798
- }
1799
- }
1800
- }, {
1801
- key: "drawPointOnMouseMove",
1802
- value: function drawPointOnMouseMove(event) {
1803
- if (this.tempLabel) {
1804
- this.tempLabel.position = event.point.position;
1788
+
1789
+ if (beginningMiterRender) {
1790
+ const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
1791
+ const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
1792
+ featureCopy.rings = updatedRings;
1793
+ renders.push(render);
1805
1794
  }
1795
+
1796
+ if (endingMiterRender) {
1797
+ const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
1798
+ const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
1799
+ featureCopy.rings = updatedRings;
1800
+ renders.push(render);
1801
+ } // NOTE: линия должна быть в начале чтобы быть под митерами
1802
+
1803
+
1804
+ renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
1805
+ return renders;
1806
1806
  }
1807
1807
  }, {
1808
- key: "setCursor",
1809
- value: function setCursor(cursor) {
1810
- const {
1811
- wrapper
1812
- } = this.painter;
1813
-
1814
- if (wrapper && typeof wrapper !== 'string') {
1815
- wrapper.style.cursor = cursor;
1816
- }
1808
+ key: "clone",
1809
+ value: function clone() {
1810
+ return new SGisPolylineSymbol(this.originalSymbol);
1817
1811
  }
1818
1812
  }]);
1819
1813
 
1820
- return BaseMeasureToolCreator;
1821
- }(PolylineControl);
1814
+ return SGisPolylineSymbol;
1815
+ }(PolylineSymbol);
1822
1816
 
1823
- let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
1824
- _inherits(BaseMeasureToolEditor, _PolyEditor);
1817
+ let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
1818
+ _inherits(LabelSymbol, _DynamicPointSymbol);
1825
1819
 
1826
- var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
1820
+ var _super = /*#__PURE__*/_createSuper(LabelSymbol);
1827
1821
 
1828
- function BaseMeasureToolEditor(map, painter, params) {
1822
+ function LabelSymbol(_temp) {
1829
1823
  var _this;
1830
1824
 
1831
- _classCallCheck(this, BaseMeasureToolEditor);
1832
-
1833
- _this = _super.call(this, map, params);
1834
-
1835
- _this.measureResult = () => {
1836
- const feature = _this.activeFeature;
1837
- if (!feature) return null;
1838
- const {
1839
- rings,
1840
- isEnclosed,
1841
- crs
1842
- } = feature;
1843
- const pointsCount = rings[0].length;
1844
- const position = rings[0][pointsCount - 1];
1845
- const area$1 = area(rings, crs);
1846
- const length$1 = length(rings, crs, isEnclosed);
1847
- const content = isEnclosed ? _this.formatters.polygon(area$1, length$1) : _this.formatters.length(length$1);
1848
- return {
1849
- content,
1850
- position
1851
- };
1852
- };
1853
-
1854
- _this.removeFeature = () => {
1855
- _this.fire('remove');
1856
- };
1857
-
1858
- _this.painter = painter;
1859
- _this.renderLabelSymbol = params.renderLabelSymbol;
1860
- _this.formatters = params.formatters || DEFAULT_FORMATTERS;
1861
-
1862
- _this.on('change', _this.updateMeasureResult);
1825
+ let {
1826
+ component,
1827
+ offset
1828
+ } = _temp === void 0 ? {} : _temp;
1863
1829
 
1864
- _this.on('edit', _this.updateMeasureResult);
1830
+ _classCallCheck(this, LabelSymbol);
1865
1831
 
1832
+ _this = _super.call(this, {
1833
+ offset
1834
+ });
1835
+ _this.component = component;
1866
1836
  return _this;
1867
1837
  }
1868
1838
 
1869
- _createClass(BaseMeasureToolEditor, [{
1870
- key: "_activate",
1871
- value: function _activate() {
1872
- _get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
1873
-
1874
- this.addMeasureResultLabel();
1839
+ _createClass(LabelSymbol, [{
1840
+ key: "_getFeatureNode",
1841
+ value: function _getFeatureNode(feature) {
1842
+ const node = document.createElement('div');
1843
+ this.renderDom(feature.content, node);
1844
+ return node;
1875
1845
  }
1876
1846
  }, {
1877
- key: "addMeasureResultLabel",
1878
- value: function addMeasureResultLabel() {
1879
- const measureResult = this.measureResult();
1880
- if (measureResult === null) return;
1881
- const {
1882
- content,
1883
- position
1884
- } = measureResult;
1885
- this.measureResultLabel = new LabelFeature(position, {
1886
- content,
1887
- crs: this.map.crs,
1888
- symbol: createLabelSymbol({
1889
- onClose: this.removeFeature,
1890
- renderLabel: this.renderLabelSymbol
1891
- })
1892
- });
1893
- this._tempLayer && this._tempLayer.add(this.measureResultLabel);
1847
+ key: "_updateFeatureNode",
1848
+ value: function _updateFeatureNode(feature) {
1849
+ this.renderDom(feature.content, this.getNode(feature));
1894
1850
  }
1895
1851
  }, {
1896
- key: "updateMeasureResult",
1897
- value: function updateMeasureResult() {
1898
- if (this.measureResultLabel) {
1899
- const measureResult = this.measureResult();
1900
- if (measureResult === null) return;
1901
- const {
1902
- content,
1903
- position
1904
- } = measureResult;
1905
- this.measureResultLabel.content = content;
1906
- this.measureResultLabel.position = position;
1852
+ key: "renderDom",
1853
+ value: function renderDom(content, node) {
1854
+ if (!node) {
1855
+ return;
1907
1856
  }
1908
- }
1909
- }]);
1910
1857
 
1911
- return BaseMeasureToolEditor;
1912
- }(PolyEditor);
1858
+ const Component = this.component;
1913
1859
 
1914
- const metersToPixels = (meters, _ref) => {
1915
- let {
1916
- painter,
1917
- crs = geo
1918
- } = _ref;
1919
- const {
1920
- width
1921
- } = painter;
1922
- const zeroPoint = painter.getPointFromPxPosition(0, 0).projectTo(crs);
1923
- const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
1924
- const widthDistance = distance(zeroPoint, maxWidthPoint);
1925
- const pxK = width / (widthDistance || 1);
1926
- return Math.round(meters * pxK);
1927
- };
1928
-
1929
- const polygonCircleFromPoint = (center, diameter) => {
1930
- const coordinates = [];
1931
- const radius = diameter / 2;
1932
- const endAngle = Math.PI * 2;
1933
- const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
1934
- let start = 0;
1935
- let end = endAngle;
1860
+ if (Component) {
1861
+ ReactDOM.render(React.createElement(Component, {
1862
+ content: content
1863
+ }), node);
1864
+ } else {
1865
+ node.innerText = content;
1866
+ }
1867
+ }
1868
+ }]);
1936
1869
 
1937
- for (let ang = start; ang < end; ang += step) {
1938
- coordinates.push([Math.cos(ang) * radius + center[0], Math.sin(ang) * radius + center[1]]);
1939
- }
1870
+ return LabelSymbol;
1871
+ }(DynamicPointSymbol);
1940
1872
 
1941
- return [coordinates];
1873
+ const defaultOffset = [8, -16];
1874
+ const createLabelSymbol = props => {
1875
+ const {
1876
+ offset = defaultOffset,
1877
+ renderLabel = (_ref) => {
1878
+ let {
1879
+ content
1880
+ } = _ref;
1881
+ return React.createElement("div", null, content);
1882
+ },
1883
+ onClose = undefined
1884
+ } = props || {};
1885
+ return new LabelSymbol({
1886
+ offset,
1887
+ component: (_ref2) => {
1888
+ let {
1889
+ content
1890
+ } = _ref2;
1891
+ return renderLabel({
1892
+ content,
1893
+ onClose
1894
+ });
1895
+ }
1896
+ });
1942
1897
  };
1943
1898
 
1944
- let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
1945
- _inherits(CircleLineMiterRender, _LineMiterRender);
1899
+ function createShadowRender(position, _ref) {
1900
+ let {
1901
+ strokeWidth = 2,
1902
+ shadowColor,
1903
+ shadowSize,
1904
+ size = 6
1905
+ } = _ref;
1906
+ const shadowDiameter = size + strokeWidth + shadowSize;
1907
+ return new PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
1908
+ fillColor: 'transparent',
1909
+ strokeColor: shadowColor,
1910
+ strokeWidth: shadowSize,
1911
+ enclosed: true
1912
+ });
1913
+ }
1914
+ function getEditorPointRenderer(position, _ref2) {
1915
+ let {
1916
+ strokeColor,
1917
+ strokeWidth,
1918
+ shadowColor,
1919
+ fillColor,
1920
+ shadowSize,
1921
+ size = 0
1922
+ } = _ref2;
1923
+ return [createShadowRender(position, {
1924
+ strokeWidth,
1925
+ strokeColor,
1926
+ shadowSize,
1927
+ shadowColor,
1928
+ size
1929
+ }), new PolyRender(polygonCircleFromPoint(position, size), {
1930
+ fillColor,
1931
+ strokeColor,
1932
+ strokeWidth,
1933
+ enclosed: true
1934
+ })];
1935
+ }
1946
1936
 
1947
- var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
1937
+ let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
1938
+ _inherits(ShadowedPointSymbol, _PointSymbol);
1948
1939
 
1949
- function CircleLineMiterRender() {
1950
- _classCallCheck(this, CircleLineMiterRender);
1940
+ var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
1951
1941
 
1952
- return _super.apply(this, arguments);
1942
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
1943
+ function ShadowedPointSymbol(options) {
1944
+ _classCallCheck(this, ShadowedPointSymbol);
1945
+
1946
+ return _super.call(this, options);
1953
1947
  }
1954
1948
 
1955
- _createClass(CircleLineMiterRender, [{
1956
- key: "usageSize",
1957
- get: function get() {
1958
- return this.miterSize + this.strokeWidth * 3;
1949
+ _createClass(ShadowedPointSymbol, [{
1950
+ key: "renderFunction",
1951
+ value: function renderFunction(feature, resolution, crs) {
1952
+ if (!(feature instanceof PointFeature)) return [];
1953
+ const {
1954
+ position
1955
+ } = feature.projectTo(crs);
1956
+ const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
1957
+ const shadowRender = this.getShadow(pxPosition, feature);
1958
+ const pointArc = this.getPoint(pxPosition, feature);
1959
+ return shadowRender ? [shadowRender, pointArc] : [pointArc];
1959
1960
  }
1960
1961
  }, {
1961
- key: "createRings",
1962
- value: function createRings(_ref, xMultiplier) {
1963
- let [x, y] = _ref;
1964
- return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
1962
+ key: "getShadow",
1963
+ value: function getShadow(position, _feature) {
1964
+ return ShadowedPointSymbol.getShadowArc(position, this);
1965
1965
  }
1966
1966
  }, {
1967
- key: "createRender",
1968
- value: function createRender(miterRings) {
1969
- const isFilled = this.kind === LineMiterKind.FilledCircle;
1970
- return new PolyRender(polygonCircleFromPoint(miterRings[0][0], this.miterSize), {
1971
- fillColor: isFilled ? this.color : 'transparent',
1972
- strokeColor: this.color,
1973
- strokeWidth: this.strokeWidth,
1967
+ key: "getPoint",
1968
+ value: function getPoint(position, _feature) {
1969
+ return ShadowedPointSymbol.getPointArc(position, this);
1970
+ }
1971
+ }], [{
1972
+ key: "getShadowArc",
1973
+ value: function getShadowArc(position, _ref) {
1974
+ let {
1975
+ strokeWidth = 2,
1976
+ shadowColor,
1977
+ shadowSize,
1978
+ size = 6
1979
+ } = _ref;
1980
+ return new PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
1981
+ fillColor: 'transparent',
1982
+ strokeColor: shadowColor,
1983
+ strokeWidth: shadowSize,
1974
1984
  enclosed: true
1975
1985
  });
1976
1986
  }
1977
- }]);
1978
-
1979
- return CircleLineMiterRender;
1980
- }(LineMiterRender);
1981
-
1982
- let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
1983
- _inherits(SquareLineMiterRender, _LineMiterRender);
1984
-
1985
- var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
1986
-
1987
- function SquareLineMiterRender() {
1988
- _classCallCheck(this, SquareLineMiterRender);
1989
-
1990
- return _super.apply(this, arguments);
1991
- }
1992
-
1993
- _createClass(SquareLineMiterRender, [{
1994
- key: "usageSize",
1995
- get: function get() {
1996
- return this.miterSize + this.strokeWidth;
1997
- }
1998
1987
  }, {
1999
- key: "createRings",
2000
- value: function createRings(_ref, xMultiplier) {
2001
- let [x, y] = _ref;
2002
- 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]]];
1988
+ key: "getPointArc",
1989
+ value: function getPointArc(position, _ref2) {
1990
+ let {
1991
+ strokeWidth,
1992
+ fillColor,
1993
+ strokeColor,
1994
+ size = 6
1995
+ } = _ref2;
1996
+ return new PolyRender(polygonCircleFromPoint(position, size), {
1997
+ fillColor,
1998
+ strokeColor,
1999
+ strokeWidth,
2000
+ enclosed: true
2001
+ });
2003
2002
  }
2004
2003
  }, {
2005
- key: "createRender",
2006
- value: function createRender(miterRings) {
2007
- const isFilled = this.kind === LineMiterKind.FilledSquare;
2008
- return new PolyRender(miterRings, {
2009
- enclosed: true,
2010
- fillColor: isFilled ? this.color : void 0,
2011
- fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
2012
- lineCap: 'square',
2013
- lineJoin: 'miter',
2014
- strokeColor: this.color,
2015
- strokeWidth: this.strokeWidth
2016
- });
2004
+ key: "getArcs",
2005
+ value: function getArcs(position, params) {
2006
+ const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
2007
+ const pointRender = ShadowedPointSymbol.getPointArc(position, params);
2008
+ return shadowRender ? [shadowRender, pointRender] : [pointRender];
2017
2009
  }
2018
2010
  }]);
2019
2011
 
2020
- return SquareLineMiterRender;
2021
- }(LineMiterRender);
2012
+ return ShadowedPointSymbol;
2013
+ }(PointSymbol);
2022
2014
 
2023
- const getLineMiterRender = options => {
2024
- switch (options.kind) {
2025
- case LineMiterKind.Arrow:
2026
- case LineMiterKind.FilledArrow:
2027
- return new ArrowLineMiterRender(options);
2015
+ let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
2016
+ _inherits(ShadowedPolySymbol, _PolylineSymbol);
2028
2017
 
2029
- case LineMiterKind.Square:
2030
- case LineMiterKind.FilledSquare:
2031
- return new SquareLineMiterRender(options);
2018
+ var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
2032
2019
 
2033
- case LineMiterKind.Circle:
2034
- case LineMiterKind.FilledCircle:
2035
- return new CircleLineMiterRender(options);
2020
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
2021
+ function ShadowedPolySymbol(options) {
2022
+ _classCallCheck(this, ShadowedPolySymbol);
2036
2023
 
2037
- default:
2038
- return null;
2024
+ return _super.call(this, options);
2039
2025
  }
2040
- };
2041
2026
 
2042
- const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
2043
- const reversedRing = ring.slice().reverse();
2027
+ _createClass(ShadowedPolySymbol, [{
2028
+ key: "renderFunction",
2029
+ value: function renderFunction(feature, resolution, crs) {
2030
+ if (!(feature instanceof Poly)) return [];
2031
+ const coordinates = PolylineSymbol.getRenderedCoordinates(feature, resolution, crs);
2032
+ const polyRender = this.getPolyRender(coordinates, feature);
2033
+ const shadowRender = this.getShadow(coordinates, feature);
2034
+ const vertexRenders = this.getVertexRenders(coordinates);
2035
+ let renders = [polyRender];
2044
2036
 
2045
- for (let i = 0; i < reversedRing.length; i++) {
2046
- const coordinates = reversedRing[i];
2037
+ if (shadowRender) {
2038
+ renders = [shadowRender, polyRender];
2039
+ }
2047
2040
 
2048
- if (isLastRing && i === 0) {
2049
- reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
2050
- }
2051
-
2052
- const nextCoordinates = reversedRing[i - 1];
2041
+ if (vertexRenders) {
2042
+ renders = renders.concat(vertexRenders);
2043
+ }
2053
2044
 
2054
- if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
2055
- reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
2045
+ return renders;
2056
2046
  }
2057
- }
2058
-
2059
- return reversedRing.reverse();
2060
- };
2061
-
2062
- const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
2063
- const newRing = ring.slice();
2064
-
2065
- for (let i = 0; i < newRing.length; i++) {
2066
- const coordinates = newRing[i];
2067
-
2068
- if (i === 0 && isFirstRing) {
2069
- newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
2047
+ }, {
2048
+ key: "getShadow",
2049
+ value: function getShadow(coordinates, _feature) {
2050
+ return new PolyRender(coordinates, {
2051
+ fillStyle: FillStyle.None,
2052
+ enclosed: this.enclose,
2053
+ strokeColor: this.shadowColor,
2054
+ strokeWidth: this.shadowSize,
2055
+ lineDash: this.lineDash
2056
+ });
2070
2057
  }
2071
-
2072
- const prevCoordinates = newRing[i - 1];
2073
-
2074
- if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
2075
- newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
2058
+ }, {
2059
+ key: "getPolyRender",
2060
+ value: function getPolyRender(coordinates, _feature) {
2061
+ return new PolyRender(coordinates, {
2062
+ fillStyle: this.enclose ? FillStyle.Color : FillStyle.None,
2063
+ enclosed: this.enclose,
2064
+ fillColor: this.fillColor,
2065
+ strokeColor: this.strokeColor,
2066
+ strokeWidth: this.strokeWidth,
2067
+ lineDash: this.lineDash
2068
+ });
2076
2069
  }
2077
- }
2070
+ }, {
2071
+ key: "getVertexRenders",
2072
+ value: function getVertexRenders(coordinates) {
2073
+ if (!this.showVertex) return;
2074
+ const vertexCoordinates = coordinates.reduce((acc, curr) => {
2075
+ return acc.concat(curr);
2076
+ }, []);
2077
+ return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
2078
+ size: 6,
2079
+ strokeWidth: 2,
2080
+ shadowColor: this.shadowColor,
2081
+ strokeColor: this.strokeColor,
2082
+ shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
2083
+ fillColor: '#ffffff'
2084
+ })).reduce((acc, curr) => acc.concat(curr), []);
2085
+ }
2086
+ }]);
2078
2087
 
2079
- return newRing;
2088
+ return ShadowedPolySymbol;
2089
+ }(PolylineSymbol);
2090
+ const polySymbolParams = {
2091
+ strokeWidth: 2,
2092
+ strokeColor: '#e33600',
2093
+ shadowSize: 8,
2094
+ shadowColor: 'rgba(227, 54, 0, 0.3)'
2080
2095
  };
2081
-
2082
- const updateRingsForMiter = (rings, position, miterSize) => {
2083
- return rings.map((ring, ringIndex) => {
2084
- switch (position) {
2085
- case 'right':
2086
- return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
2087
-
2088
- default:
2089
- return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
2090
- }
2091
- });
2096
+ const measureSymbolParams = {
2097
+ strokeColor: '#ff6933',
2098
+ shadowSize: 0,
2099
+ vertexShadowSize: 0
2092
2100
  };
2101
+ const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
2102
+ enclose: false,
2103
+ showVertex: true
2104
+ }));
2105
+ const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
2106
+ fillColor: 'rgba(255, 105, 51, 0.25)',
2107
+ enclose: true,
2108
+ showVertex: true
2109
+ }));
2110
+ const snapSymbolParams = {
2111
+ size: 10,
2112
+ strokeWidth: 2,
2113
+ strokeColor: '#e33600',
2114
+ fillColor: '#ffffff',
2115
+ shadowColor: 'rgba(227, 54, 0, 0.3)',
2116
+ shadowSize: 3
2117
+ };
2118
+ const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
2119
+ strokeColor: '#ff6933',
2120
+ shadowSize: 0
2121
+ }));
2093
2122
 
2094
- const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
2095
- let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
2096
- _inherits(SGisPolylineSymbol, _sPolylineSymbol);
2097
-
2098
- var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
2099
-
2100
- function SGisPolylineSymbol(originalSymbol) {
2101
- var _originalSymbol$strok, _originalSymbol$strok2;
2123
+ let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
2124
+ _inherits(SelectedPointSymbol, _ShadowedPointSymbol);
2102
2125
 
2103
- var _this;
2126
+ var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
2104
2127
 
2105
- _classCallCheck(this, SGisPolylineSymbol);
2128
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
2129
+ function SelectedPointSymbol(props) {
2130
+ _classCallCheck(this, SelectedPointSymbol);
2106
2131
 
2107
- _this = _super.call(this, {
2108
- // @ts-ignore
2109
- strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
2110
- strokeWidth: clamp( // @ts-ignore
2111
- getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
2112
- // @ts-ignore
2113
- lineDash: getLineDash(originalSymbol.stroke),
2114
- // @ts-ignore
2115
- lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
2116
- });
2117
- _this.originalSymbol = originalSymbol;
2118
- return _this;
2132
+ return _super.call(this, props);
2119
2133
  }
2120
2134
 
2121
- _createClass(SGisPolylineSymbol, [{
2122
- key: "renderFunction",
2123
- value: function renderFunction(feature, resolution, crs) {
2124
- if (!isSimplePolylineSymbol(this.originalSymbol)) return _get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, feature, resolution, crs);
2125
- const {
2126
- ending,
2127
- beginningSize,
2128
- beginning,
2129
- endingSize
2130
- } = this.originalSymbol;
2131
- const renders = [];
2132
- const featureCopy = feature.clone();
2133
- const beginningMiterRender = getLineMiterRender({
2134
- color: this.strokeColor,
2135
- // @ts-ignore
2136
- kind: beginning,
2137
- position: 'left',
2138
- // @ts-ignore
2139
- size: beginningSize,
2140
- strokeWidth: this.strokeWidth
2141
- });
2142
- const endingMiterRender = getLineMiterRender({
2143
- color: this.strokeColor,
2144
- // @ts-ignore
2145
- kind: ending,
2146
- position: 'right',
2147
- // @ts-ignore
2148
- size: endingSize,
2149
- strokeWidth: this.strokeWidth
2150
- });
2151
-
2152
- if (beginningMiterRender) {
2153
- const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
2154
- const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
2155
- featureCopy.rings = updatedRings;
2156
- renders.push(render);
2135
+ _createClass(SelectedPointSymbol, [{
2136
+ key: "getShadow",
2137
+ value: function getShadow(position, feature) {
2138
+ if (feature.isSelected) {
2139
+ return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
2157
2140
  }
2158
-
2159
- if (endingMiterRender) {
2160
- const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
2161
- const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
2162
- featureCopy.rings = updatedRings;
2163
- renders.push(render);
2164
- } // NOTE: линия должна быть в начале чтобы быть под митерами
2165
-
2166
-
2167
- renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
2168
- return renders;
2169
2141
  }
2170
2142
  }, {
2171
- key: "clone",
2172
- value: function clone() {
2173
- return new SGisPolylineSymbol(this.originalSymbol);
2174
- }
2175
- }]);
2143
+ key: "getPoint",
2144
+ value: function getPoint(position, feature) {
2145
+ const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
2176
2146
 
2177
- return SGisPolylineSymbol;
2178
- }(PolylineSymbol);
2147
+ if (feature.isSelected) {
2148
+ pointRender.strokeColor = this.selectedStrokeColor;
2149
+ pointRender.fillColor = this.selectedFillColor;
2150
+ }
2179
2151
 
2180
- let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
2181
- _inherits(LabelSymbol, _DynamicPointSymbol);
2152
+ return pointRender;
2153
+ }
2154
+ }]);
2182
2155
 
2183
- var _super = /*#__PURE__*/_createSuper(LabelSymbol);
2156
+ return SelectedPointSymbol;
2157
+ }(ShadowedPointSymbol);
2184
2158
 
2185
- function LabelSymbol(_temp) {
2186
- var _this;
2159
+ let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
2160
+ _inherits(SelectedPolySymbol, _ShadowedPolySymbol);
2187
2161
 
2188
- let {
2189
- component,
2190
- offset
2191
- } = _temp === void 0 ? {} : _temp;
2162
+ var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
2192
2163
 
2193
- _classCallCheck(this, LabelSymbol);
2164
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
2165
+ function SelectedPolySymbol(props) {
2166
+ _classCallCheck(this, SelectedPolySymbol);
2194
2167
 
2195
- _this = _super.call(this, {
2196
- offset
2197
- });
2198
- _this.component = component;
2199
- return _this;
2168
+ return _super.call(this, props);
2200
2169
  }
2201
2170
 
2202
- _createClass(LabelSymbol, [{
2203
- key: "_getFeatureNode",
2204
- value: function _getFeatureNode(feature) {
2205
- const node = document.createElement('div');
2206
- this.renderDom(feature.content, node);
2207
- return node;
2208
- }
2209
- }, {
2210
- key: "_updateFeatureNode",
2211
- value: function _updateFeatureNode(feature) {
2212
- this.renderDom(feature.content, this.getNode(feature));
2171
+ _createClass(SelectedPolySymbol, [{
2172
+ key: "getShadow",
2173
+ value: function getShadow(coordinates, feature) {
2174
+ if (feature.isSelected) {
2175
+ return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
2176
+ }
2213
2177
  }
2214
2178
  }, {
2215
- key: "renderDom",
2216
- value: function renderDom(content, node) {
2217
- if (!node) {
2218
- return;
2219
- }
2179
+ key: "getPolyRender",
2180
+ value: function getPolyRender(coordinates, feature) {
2181
+ const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
2220
2182
 
2221
- const Component = this.component;
2183
+ if (feature.isSelected) {
2184
+ polyRender.fillColor = this.selectedFillColor;
2185
+ polyRender.strokeColor = this.selectedStrokeColor;
2222
2186
 
2223
- if (Component) {
2224
- ReactDOM.render(React.createElement(Component, {
2225
- content: content
2226
- }), node);
2227
- } else {
2228
- node.innerText = content;
2187
+ if (this.selectedStrokeWidth !== void 0) {
2188
+ polyRender.strokeWidth = this.selectedStrokeWidth;
2189
+ }
2229
2190
  }
2191
+
2192
+ return polyRender;
2230
2193
  }
2231
2194
  }]);
2232
2195
 
2233
- return LabelSymbol;
2234
- }(DynamicPointSymbol);
2196
+ return SelectedPolySymbol;
2197
+ }(ShadowedPolySymbol);
2235
2198
 
2236
- const defaultOffset = [8, -16];
2237
- const createLabelSymbol = props => {
2238
- const {
2239
- offset = defaultOffset,
2240
- renderLabel = _ref => {
2241
- let {
2242
- content
2243
- } = _ref;
2244
- return React.createElement("div", null, content);
2245
- },
2246
- onClose = undefined
2247
- } = props || {};
2248
- return new LabelSymbol({
2249
- offset,
2250
- component: _ref2 => {
2251
- let {
2252
- content
2253
- } = _ref2;
2254
- return renderLabel({
2255
- content,
2256
- onClose
2257
- });
2258
- }
2259
- });
2260
- };
2199
+ const selectedPoint = /*#__PURE__*/new SelectedPointSymbol({
2200
+ size: 8,
2201
+ strokeWidth: 2,
2202
+ strokeColor: 'rgba(255, 87, 34, 0.3)',
2203
+ fillColor: 'rgba(255, 255, 255, 0.65)',
2204
+ shadowColor: 'rgba(255, 87, 34, 0.3)',
2205
+ shadowSize: 3,
2206
+ selectedStrokeColor: '#ff5722',
2207
+ selectedFillColor: 'rgba(255, 255, 255, 0.65)'
2208
+ });
2209
+ const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
2210
+ strokeWidth: 6,
2211
+ strokeColor: 'rgba(255, 87, 34, 0.2)',
2212
+ shadowSize: 8,
2213
+ shadowColor: 'rgba(255, 87, 34, 0.3)',
2214
+ selectedStrokeColor: '#ff5722',
2215
+ selectedStrokeWidth: 2
2216
+ });
2217
+ const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
2218
+ strokeWidth: 2,
2219
+ strokeColor: 'rgba(255, 87, 34, 0.3)',
2220
+ shadowSize: 8,
2221
+ shadowColor: 'rgba(255, 87, 34, 0.3)',
2222
+ fillColor: 'rgba(255, 255, 255, 0.36)',
2223
+ enclose: true,
2224
+ selectedFillColor: 'rgba(255, 255, 255, 0.56)',
2225
+ selectedStrokeColor: '#ff5722'
2226
+ });
2261
2227
 
2262
- function createShadowRender(position, _ref) {
2228
+ const metersToPixels = (meters, _ref) => {
2263
2229
  let {
2264
- strokeWidth = 2,
2265
- shadowColor,
2266
- shadowSize,
2267
- size = 6
2230
+ painter,
2231
+ crs = geo
2268
2232
  } = _ref;
2269
- const shadowDiameter = size + strokeWidth + shadowSize;
2270
- return new PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
2271
- fillColor: 'transparent',
2272
- strokeColor: shadowColor,
2273
- strokeWidth: shadowSize,
2274
- enclosed: true
2275
- });
2276
- }
2277
- function getEditorPointRenderer(position, _ref2) {
2278
- let {
2279
- strokeColor,
2280
- strokeWidth,
2281
- shadowColor,
2282
- fillColor,
2283
- shadowSize,
2284
- size = 0
2285
- } = _ref2;
2286
- return [createShadowRender(position, {
2287
- strokeWidth,
2288
- strokeColor,
2289
- shadowSize,
2290
- shadowColor,
2291
- size
2292
- }), new PolyRender(polygonCircleFromPoint(position, size), {
2293
- fillColor,
2294
- strokeColor,
2295
- strokeWidth,
2296
- enclosed: true
2297
- })];
2298
- }
2233
+ const {
2234
+ width
2235
+ } = painter;
2236
+ const zeroPoint = painter.getPointFromPxPosition(0, 0).projectTo(crs);
2237
+ const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
2238
+ const widthDistance = distance(zeroPoint, maxWidthPoint);
2239
+ const pxK = width / (widthDistance || 1);
2240
+ return Math.round(meters * pxK);
2241
+ };
2299
2242
 
2300
- let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
2301
- _inherits(ShadowedPointSymbol, _PointSymbol);
2243
+ const defaultPathStyles = {
2244
+ strokeWidth: 2,
2245
+ strokeColor: 'rgb(0, 163, 245)',
2246
+ fillStyle: FillStyle.None
2247
+ };
2248
+ let SVGPoly = /*#__PURE__*/function (_Symbol) {
2249
+ _inherits(SVGPoly, _Symbol);
2302
2250
 
2303
- var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
2251
+ var _super = /*#__PURE__*/_createSuper(SVGPoly);
2304
2252
 
2305
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
2306
- function ShadowedPointSymbol(options) {
2307
- _classCallCheck(this, ShadowedPointSymbol);
2253
+ function SVGPoly(_temp) {
2254
+ var _this;
2308
2255
 
2309
- return _super.call(this, options);
2256
+ let {
2257
+ redrawFeatureNode,
2258
+ pathStyles,
2259
+ circle,
2260
+ className,
2261
+ appendToSvg
2262
+ } = _temp === void 0 ? {} : _temp;
2263
+
2264
+ _classCallCheck(this, SVGPoly);
2265
+
2266
+ _this = _super.call(this);
2267
+ _this.container = document.createElement('div');
2268
+ _this.container.style.position = 'absolute';
2269
+ _this.redrawFeatureNode = redrawFeatureNode;
2270
+ _this.pathStyles = _extends({
2271
+ center: [0, 0],
2272
+ fillColor: 'none'
2273
+ }, pathStyles);
2274
+ _this.circle = circle;
2275
+ _this.className = className;
2276
+ _this.appendToSvg = appendToSvg;
2277
+ return _this;
2310
2278
  }
2311
2279
 
2312
- _createClass(ShadowedPointSymbol, [{
2280
+ _createClass(SVGPoly, [{
2313
2281
  key: "renderFunction",
2314
2282
  value: function renderFunction(feature, resolution, crs) {
2315
- if (!(feature instanceof PointFeature)) return [];
2316
- const {
2317
- position
2318
- } = feature.projectTo(crs);
2319
- const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
2320
- const shadowRender = this.getShadow(pxPosition, feature);
2321
- const pointArc = this.getPoint(pxPosition, feature);
2322
- return shadowRender ? [shadowRender, pointArc] : [pointArc];
2283
+ const coordinates = feature instanceof Poly ? PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
2284
+ this.setCirclePxRaius(crs);
2285
+ this.container.innerHTML = '';
2286
+ const svg = this.setSvg(coordinates);
2287
+ svg && this.container.append(svg);
2288
+ feature.__dynamicSymbolRender = new DynamicRender({
2289
+ node: this.container,
2290
+ update: (bbox, resolution) => this.update({
2291
+ bbox,
2292
+ resolution,
2293
+ feature,
2294
+ crs
2295
+ }),
2296
+ redraw: () => {
2297
+ this.redrawFeatureNode && this.redrawFeatureNode(feature);
2298
+ }
2299
+ });
2300
+
2301
+ this._setEventListeners(feature);
2302
+
2303
+ return [feature.__dynamicSymbolRender];
2323
2304
  }
2324
2305
  }, {
2325
- key: "getShadow",
2326
- value: function getShadow(position, _feature) {
2327
- return ShadowedPointSymbol.getShadowArc(position, this);
2306
+ key: "setCirclePxRaius",
2307
+ value: function setCirclePxRaius(crs) {
2308
+ if (this.circle && this.pathStyles) {
2309
+ var _this$circle;
2310
+
2311
+ this.pathStyles.radius = metersToPixels(this.circle.radius, {
2312
+ painter: this.circle.painter,
2313
+ crs
2314
+ }) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
2315
+ }
2328
2316
  }
2329
2317
  }, {
2330
- key: "getPoint",
2331
- value: function getPoint(position, _feature) {
2332
- return ShadowedPointSymbol.getPointArc(position, this);
2333
- }
2334
- }], [{
2335
- key: "getShadowArc",
2336
- value: function getShadowArc(position, _ref) {
2318
+ key: "update",
2319
+ value: function update(_ref) {
2320
+ var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
2321
+
2337
2322
  let {
2338
- strokeWidth = 2,
2339
- shadowColor,
2340
- shadowSize,
2341
- size = 6
2323
+ bbox,
2324
+ resolution,
2325
+ feature,
2326
+ crs
2342
2327
  } = _ref;
2343
- return new PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
2344
- fillColor: 'transparent',
2345
- strokeColor: shadowColor,
2346
- strokeWidth: shadowSize,
2347
- enclosed: true
2348
- });
2328
+ if (!feature) return;
2329
+ if (!bbox) bbox = feature.__lastBbox;
2330
+ if (!resolution) resolution = feature.__lastResolution;
2331
+ if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
2332
+
2333
+ if (feature.__lastResolution && resolution !== feature.__lastResolution) {
2334
+ const newCoordinates = feature instanceof Poly ? PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
2335
+ this.setCirclePxRaius(crs);
2336
+ this.container.innerHTML = '';
2337
+ const svg = this.setSvg(newCoordinates);
2338
+ svg && this.container.append(svg);
2339
+ }
2340
+
2341
+ const polygon = feature.projectTo(bbox.crs);
2342
+ 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;
2343
+ const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
2344
+ const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
2345
+ this.container.style.left = dx.toString() + "px";
2346
+ this.container.style.top = dy.toString() + "px";
2347
+ feature.__lastBbox = bbox;
2348
+ feature.__lastResolution = resolution;
2349
2349
  }
2350
2350
  }, {
2351
- key: "getPointArc",
2352
- value: function getPointArc(position, _ref2) {
2353
- let {
2354
- strokeWidth,
2355
- fillColor,
2356
- strokeColor,
2357
- size = 6
2358
- } = _ref2;
2359
- return new PolyRender(polygonCircleFromPoint(position, size), {
2360
- fillColor,
2361
- strokeColor,
2362
- strokeWidth,
2363
- enclosed: true
2364
- });
2365
- }
2366
- }, {
2367
- key: "getArcs",
2368
- value: function getArcs(position, params) {
2369
- const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
2370
- const pointRender = ShadowedPointSymbol.getPointArc(position, params);
2371
- return shadowRender ? [shadowRender, pointRender] : [pointRender];
2372
- }
2373
- }]);
2374
-
2375
- return ShadowedPointSymbol;
2376
- }(PointSymbol);
2377
-
2378
- let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
2379
- _inherits(ShadowedPolySymbol, _PolylineSymbol);
2380
-
2381
- var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
2382
-
2383
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
2384
- function ShadowedPolySymbol(options) {
2385
- _classCallCheck(this, ShadowedPolySymbol);
2386
-
2387
- return _super.call(this, options);
2388
- }
2389
-
2390
- _createClass(ShadowedPolySymbol, [{
2391
- key: "renderFunction",
2392
- value: function renderFunction(feature, resolution, crs) {
2393
- if (!(feature instanceof Poly)) return [];
2394
- const coordinates = PolylineSymbol.getRenderedCoordinates(feature, resolution, crs);
2395
- const polyRender = this.getPolyRender(coordinates, feature);
2396
- const shadowRender = this.getShadow(coordinates, feature);
2397
- const vertexRenders = this.getVertexRenders(coordinates);
2398
- let renders = [polyRender];
2351
+ key: "setSvg",
2352
+ value: function setSvg(coordinates) {
2353
+ const {
2354
+ lineCap,
2355
+ lineJoin,
2356
+ miterLimit,
2357
+ lineDash,
2358
+ dashOffset
2359
+ } = this.pathStyles || {};
2360
+ const svgRender = new SvgRender(_extends({
2361
+ coordinates
2362
+ }, defaultPathStyles, {
2363
+ appendToSvg: this.appendToSvg
2364
+ }, this.pathStyles));
2399
2365
 
2400
- if (shadowRender) {
2401
- renders = [shadowRender, polyRender];
2366
+ if (this.circle) {
2367
+ svgRender._setArcNode();
2368
+ } else {
2369
+ svgRender._setPolyNode();
2402
2370
  }
2403
2371
 
2404
- if (vertexRenders) {
2405
- renders = renders.concat(vertexRenders);
2406
- }
2372
+ let svgElement;
2373
+ svgRender.getNode((_, svg) => {
2374
+ svgElement = svg;
2375
+ this.className && svgElement.classList.add(this.className);
2376
+ const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
2407
2377
 
2408
- return renders;
2409
- }
2410
- }, {
2411
- key: "getShadow",
2412
- value: function getShadow(coordinates, _feature) {
2413
- return new PolyRender(coordinates, {
2414
- fillStyle: FillStyle.None,
2415
- enclosed: this.enclose,
2416
- strokeColor: this.shadowColor,
2417
- strokeWidth: this.shadowSize,
2418
- lineDash: this.lineDash
2378
+ if (path) {
2379
+ path.setAttribute('stroke-linecap', lineCap || 'round');
2380
+ path.setAttribute('stroke-linejoin', lineJoin || 'round');
2381
+ path.setAttribute('stroke-miterlimit', (miterLimit || 10).toString());
2382
+ path.setAttribute('stroke-dashoffset', (dashOffset || 0).toString());
2383
+
2384
+ if (this.circle) {
2385
+ path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
2386
+ }
2387
+ }
2419
2388
  });
2389
+ return svgElement;
2420
2390
  }
2421
2391
  }, {
2422
- key: "getPolyRender",
2423
- value: function getPolyRender(coordinates, _feature) {
2424
- return new PolyRender(coordinates, {
2425
- fillStyle: this.enclose ? FillStyle.Color : FillStyle.None,
2426
- enclosed: this.enclose,
2427
- fillColor: this.fillColor,
2428
- strokeColor: this.strokeColor,
2429
- strokeWidth: this.strokeWidth,
2430
- lineDash: this.lineDash
2392
+ key: "_setEventListeners",
2393
+ value: function _setEventListeners(dynamicFeature) {
2394
+ var _dynamicFeature$__dyn;
2395
+
2396
+ if (dynamicFeature.eventFlags === MouseEventFlags.None) return;
2397
+ const svgNode = dynamicFeature == null ? void 0 : (_dynamicFeature$__dyn = dynamicFeature.__dynamicSymbolRender) == null ? void 0 : _dynamicFeature$__dyn.node.querySelector(this.circle ? 'circle' : 'path');
2398
+ Object.keys(mouseEvents).forEach(eventName => {
2399
+ if (dynamicFeature.eventFlags & mouseEvents[eventName].flag) {
2400
+ listenDomEvent(svgNode, mouseEvents[eventName].type, event => {
2401
+ dynamicFeature.fire(mouseEvents[eventName].type, {
2402
+ node: svgNode,
2403
+ browserEvent: event
2404
+ });
2405
+ });
2406
+ }
2431
2407
  });
2432
2408
  }
2433
- }, {
2434
- key: "getVertexRenders",
2435
- value: function getVertexRenders(coordinates) {
2436
- if (!this.showVertex) return;
2437
- const vertexCoordinates = coordinates.reduce((acc, curr) => {
2438
- return acc.concat(curr);
2439
- }, []);
2440
- return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
2441
- size: 6,
2442
- strokeWidth: 2,
2443
- shadowColor: this.shadowColor,
2444
- strokeColor: this.strokeColor,
2445
- shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
2446
- fillColor: '#ffffff'
2447
- })).reduce((acc, curr) => acc.concat(curr), []);
2448
- }
2449
2409
  }]);
2450
2410
 
2451
- return ShadowedPolySymbol;
2452
- }(PolylineSymbol);
2453
- const polySymbolParams = {
2454
- strokeWidth: 2,
2455
- strokeColor: '#e33600',
2456
- shadowSize: 8,
2457
- shadowColor: 'rgba(227, 54, 0, 0.3)'
2458
- };
2459
- const measureSymbolParams = {
2460
- strokeColor: '#ff6933',
2461
- shadowSize: 0,
2462
- vertexShadowSize: 0
2463
- };
2464
- const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
2465
- enclose: false,
2466
- showVertex: true
2467
- }));
2468
- const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
2469
- fillColor: 'rgba(255, 105, 51, 0.25)',
2470
- enclose: true,
2471
- showVertex: true
2472
- }));
2473
- const snapSymbolParams = {
2474
- size: 10,
2475
- strokeWidth: 2,
2476
- strokeColor: '#e33600',
2477
- fillColor: '#ffffff',
2478
- shadowColor: 'rgba(227, 54, 0, 0.3)',
2479
- shadowSize: 3
2480
- };
2481
- const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
2482
- strokeColor: '#ff6933',
2483
- shadowSize: 0
2484
- }));
2411
+ return SVGPoly;
2412
+ }(Symbol$1);
2485
2413
 
2486
- let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
2487
- _inherits(SelectedPointSymbol, _ShadowedPointSymbol);
2414
+ function isSGisPointSymbol(symbol) {
2415
+ return symbol instanceof PointSymbol || symbol instanceof StaticImageSymbol || symbol instanceof SquareSymbol || symbol instanceof MaskedImage;
2416
+ }
2417
+ function isSGisImageSymbol(symbol) {
2418
+ return symbol instanceof StaticImageSymbol || symbol instanceof MaskedImage;
2419
+ }
2420
+ function isSGisPolygonSymbol(symbol) {
2421
+ return symbol instanceof PolygonSymbol || symbol instanceof BrushFill || symbol instanceof ImageFill;
2422
+ }
2423
+ function isSGisPolylineSymbol(symbol) {
2424
+ return symbol instanceof PolylineSymbol;
2425
+ }
2488
2426
 
2489
- var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
2427
+ /**
2428
+ * Моки фич для отображения превью символа
2429
+ * http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
2430
+ */
2490
2431
 
2491
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
2492
- function SelectedPointSymbol(props) {
2493
- _classCallCheck(this, SelectedPointSymbol);
2432
+ const viewBoxSize = 100;
2433
+ const pointFeature = /*#__PURE__*/new PointFeature([50, -50], {
2434
+ crs: plain
2435
+ });
2436
+ const lineFeature = /*#__PURE__*/new Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
2437
+ crs: plain
2438
+ });
2439
+ const polygonFeature = /*#__PURE__*/new Polygon([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
2440
+ crs: plain
2441
+ });
2442
+ const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
2443
+ crs: plain
2444
+ });
2445
+ const polygonLegendFeature = /*#__PURE__*/new Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
2446
+ crs: plain
2447
+ });
2448
+ const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
2449
+ crs: plain
2450
+ });
2451
+ const MAP_LEGEND_FEATURES = {
2452
+ polygon: polygonMapLegendFeature
2453
+ };
2454
+ const LEGEND_FEATURES = {
2455
+ polyline: lineLegendFeature,
2456
+ polygon: polygonLegendFeature
2457
+ };
2458
+ const MOCK_FEATURES = {
2459
+ point: pointFeature,
2460
+ polyline: lineFeature,
2461
+ polygon: polygonFeature
2462
+ };
2494
2463
 
2495
- return _super.call(this, props);
2464
+ function getSymbolRenders(symbol, size, features) {
2465
+ if (size === void 0) {
2466
+ size = viewBoxSize;
2496
2467
  }
2497
2468
 
2498
- _createClass(SelectedPointSymbol, [{
2499
- key: "getShadow",
2500
- value: function getShadow(position, feature) {
2501
- if (feature.isSelected) {
2502
- return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
2503
- }
2504
- }
2505
- }, {
2506
- key: "getPoint",
2507
- value: function getPoint(position, feature) {
2508
- const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
2509
-
2510
- if (feature.isSelected) {
2511
- pointRender.strokeColor = this.selectedStrokeColor;
2512
- pointRender.fillColor = this.selectedFillColor;
2513
- }
2469
+ if (features === void 0) {
2470
+ features = {};
2471
+ }
2514
2472
 
2515
- return pointRender;
2516
- }
2517
- }]);
2473
+ const resolution = viewBoxSize / size;
2518
2474
 
2519
- return SelectedPointSymbol;
2520
- }(ShadowedPointSymbol);
2475
+ const featuresToRender = _extends({}, MOCK_FEATURES, features);
2521
2476
 
2522
- let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
2523
- _inherits(SelectedPolySymbol, _ShadowedPolySymbol);
2477
+ if (isSGisPolygonSymbol(symbol)) {
2478
+ return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, plain);
2479
+ }
2524
2480
 
2525
- var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
2481
+ if (isSGisPolylineSymbol(symbol)) {
2482
+ return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, plain);
2483
+ }
2526
2484
 
2527
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
2528
- function SelectedPolySymbol(props) {
2529
- _classCallCheck(this, SelectedPolySymbol);
2485
+ return symbol.renderFunctionAsync(featuresToRender.point, resolution, plain);
2486
+ }
2487
+ const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
2488
+ if (size === void 0) {
2489
+ size = viewBoxSize;
2490
+ }
2530
2491
 
2531
- return _super.call(this, props);
2492
+ return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
2493
+ };
2494
+ const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
2495
+ if (size === void 0) {
2496
+ size = viewBoxSize;
2532
2497
  }
2533
2498
 
2534
- _createClass(SelectedPolySymbol, [{
2535
- key: "getShadow",
2536
- value: function getShadow(coordinates, feature) {
2537
- if (feature.isSelected) {
2538
- return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
2539
- }
2540
- }
2541
- }, {
2542
- key: "getPolyRender",
2543
- value: function getPolyRender(coordinates, feature) {
2544
- const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
2499
+ return getSymbolRenders(symbol, size, LEGEND_FEATURES);
2500
+ };
2545
2501
 
2546
- if (feature.isSelected) {
2547
- polyRender.fillColor = this.selectedFillColor;
2548
- polyRender.strokeColor = this.selectedStrokeColor;
2502
+ function renderSymbolToCanvas(renders, canvas) {
2503
+ renders.forEach(render => {
2504
+ canvas.draw(render);
2505
+ });
2506
+ }
2549
2507
 
2550
- if (this.selectedStrokeWidth !== void 0) {
2551
- polyRender.strokeWidth = this.selectedStrokeWidth;
2552
- }
2553
- }
2508
+ function deserializeSymbol(symbol) {
2509
+ switch (symbol.type) {
2510
+ case 'circlePointSymbol':
2511
+ return deserializePointSymbol(symbol);
2554
2512
 
2555
- return polyRender;
2556
- }
2557
- }]);
2513
+ case 'squarePointSymbol':
2514
+ return deserializeSquareSymbol(symbol);
2558
2515
 
2559
- return SelectedPolySymbol;
2560
- }(ShadowedPolySymbol);
2516
+ case 'maskedImagePointSymbol':
2517
+ return deserializeMaskedImageSymbol(symbol);
2561
2518
 
2562
- const selectedPoint = /*#__PURE__*/new SelectedPointSymbol({
2563
- size: 8,
2564
- strokeWidth: 2,
2565
- strokeColor: 'rgba(255, 87, 34, 0.3)',
2566
- fillColor: 'rgba(255, 255, 255, 0.65)',
2567
- shadowColor: 'rgba(255, 87, 34, 0.3)',
2568
- shadowSize: 3,
2569
- selectedStrokeColor: '#ff5722',
2570
- selectedFillColor: 'rgba(255, 255, 255, 0.65)'
2571
- });
2572
- const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
2573
- strokeWidth: 6,
2574
- strokeColor: 'rgba(255, 87, 34, 0.2)',
2575
- shadowSize: 8,
2576
- shadowColor: 'rgba(255, 87, 34, 0.3)',
2577
- selectedStrokeColor: '#ff5722',
2578
- selectedStrokeWidth: 2
2579
- });
2580
- const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
2581
- strokeWidth: 2,
2582
- strokeColor: 'rgba(255, 87, 34, 0.3)',
2583
- shadowSize: 8,
2584
- shadowColor: 'rgba(255, 87, 34, 0.3)',
2585
- fillColor: 'rgba(255, 255, 255, 0.36)',
2586
- enclose: true,
2587
- selectedFillColor: 'rgba(255, 255, 255, 0.56)',
2588
- selectedStrokeColor: '#ff5722'
2589
- });
2519
+ case 'imagePointSymbol':
2520
+ return deserializeImagePointSymbol(symbol);
2590
2521
 
2591
- const defaultPathStyles = {
2592
- strokeWidth: 2,
2593
- strokeColor: 'rgb(0, 163, 245)',
2594
- fillStyle: FillStyle.None
2595
- };
2596
- let SVGPoly = /*#__PURE__*/function (_Symbol) {
2597
- _inherits(SVGPoly, _Symbol);
2522
+ case 'polygonSymbol':
2523
+ return deserializePolygonSymbol(symbol);
2598
2524
 
2599
- var _super = /*#__PURE__*/_createSuper(SVGPoly);
2525
+ case 'simplePolylineSymbol':
2526
+ case 'polylineSymbol':
2527
+ return deserializePolylineSymbol(symbol);
2600
2528
 
2601
- function SVGPoly(_temp) {
2602
- var _this;
2529
+ default:
2530
+ return null;
2531
+ }
2532
+ }
2603
2533
 
2604
- let {
2605
- redrawFeatureNode,
2606
- pathStyles,
2607
- circle,
2608
- className,
2609
- appendToSvg
2610
- } = _temp === void 0 ? {} : _temp;
2534
+ function deserializePointSymbol(symbol) {
2535
+ // @ts-ignore
2536
+ return new PointSymbol(deserializePointSymbolParams(symbol));
2537
+ }
2611
2538
 
2612
- _classCallCheck(this, SVGPoly);
2539
+ function deserializeSquareSymbol(symbol) {
2540
+ return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
2541
+ // @ts-ignore
2542
+ angle: getParameterValue(symbol.angle)
2543
+ }));
2544
+ }
2613
2545
 
2614
- _this = _super.call(this);
2615
- _this.container = document.createElement('div');
2616
- _this.container.style.position = 'absolute';
2617
- _this.redrawFeatureNode = redrawFeatureNode;
2618
- _this.pathStyles = _extends({
2619
- center: [0, 0],
2620
- fillColor: 'none'
2621
- }, pathStyles);
2622
- _this.circle = circle;
2623
- _this.className = className;
2624
- _this.appendToSvg = appendToSvg;
2625
- return _this;
2546
+ function deserializeMaskedImageSymbol(symbol) {
2547
+ return new MaskedImage(_extends({}, symbol, {
2548
+ // @ts-ignore
2549
+ angle: getParameterValue(symbol.angle),
2550
+ // @ts-ignore
2551
+ width: getParameterValue(symbol.width),
2552
+ // @ts-ignore
2553
+ height: getParameterValue(symbol.height),
2554
+ // @ts-ignore
2555
+ anchorPoint: deserializeAnchor(symbol.offset),
2556
+ // @ts-ignore
2557
+ imageSource: deserializeBase64(symbol.image),
2558
+ // @ts-ignore
2559
+ maskSource: deserializeBase64(symbol.imageMask),
2560
+ // @ts-ignore
2561
+ maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
2562
+ }));
2563
+ }
2564
+
2565
+ function deserializeImagePointSymbol(symbol) {
2566
+ return new StaticImageSymbol(_extends({}, symbol, {
2567
+ // @ts-ignore
2568
+ angle: getParameterValue(symbol.angle),
2569
+ // @ts-ignore
2570
+ width: getParameterValue(symbol.width),
2571
+ // @ts-ignore
2572
+ height: getParameterValue(symbol.height),
2573
+ // @ts-ignore
2574
+ anchorPoint: deserializeAnchor(symbol.offset),
2575
+ // @ts-ignore
2576
+ source: deserializeBase64(symbol.image)
2577
+ }));
2578
+ }
2579
+
2580
+ function deserializePolygonSymbol(symbol) {
2581
+ if (isPolygonHasPatternBrush(symbol)) {
2582
+ return new SGisImageFill(symbol);
2626
2583
  }
2627
2584
 
2628
- _createClass(SVGPoly, [{
2629
- key: "renderFunction",
2630
- value: function renderFunction(feature, resolution, crs) {
2631
- const coordinates = feature instanceof Poly ? PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
2632
- this.setCirclePxRaius(crs);
2633
- this.container.innerHTML = '';
2634
- const svg = this.setSvg(coordinates);
2635
- svg && this.container.append(svg);
2636
- feature.__dynamicSymbolRender = new DynamicRender({
2637
- node: this.container,
2638
- update: (bbox, resolution) => this.update({
2639
- bbox,
2640
- resolution,
2641
- feature,
2642
- crs
2643
- }),
2644
- redraw: () => {
2645
- this.redrawFeatureNode && this.redrawFeatureNode(feature);
2646
- }
2647
- });
2585
+ if (isPolygonHasHatchBrush(symbol)) {
2586
+ return new SGisBrushFill(symbol);
2587
+ }
2648
2588
 
2649
- this._setEventListeners(feature);
2589
+ return new SGisPolygonSymbol(symbol);
2590
+ }
2650
2591
 
2651
- return [feature.__dynamicSymbolRender];
2652
- }
2653
- }, {
2654
- key: "setCirclePxRaius",
2655
- value: function setCirclePxRaius(crs) {
2656
- if (this.circle && this.pathStyles) {
2657
- var _this$circle;
2592
+ function deserializePolylineSymbol(symbol) {
2593
+ return new SGisPolylineSymbol(symbol);
2594
+ }
2658
2595
 
2659
- this.pathStyles.radius = metersToPixels(this.circle.radius, {
2660
- painter: this.circle.painter,
2661
- crs
2662
- }) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
2663
- }
2664
- }
2665
- }, {
2666
- key: "update",
2667
- value: function update(_ref) {
2668
- var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
2596
+ function deserializePointSymbolParams(_ref) {
2597
+ let {
2598
+ size,
2599
+ offset,
2600
+ strokeColor,
2601
+ strokeWidth,
2602
+ fillColor
2603
+ } = _ref;
2604
+ return {
2605
+ size: getParameterValue(size),
2606
+ offset: deserializeAnchor(offset),
2607
+ strokeWidth: getParameterValue(strokeWidth),
2608
+ strokeColor: deserializeColor(getParameterValue(strokeColor)),
2609
+ fillColor: deserializeColor(getParameterValue(fillColor))
2610
+ };
2611
+ }
2669
2612
 
2670
- let {
2671
- bbox,
2672
- resolution,
2673
- feature,
2674
- crs
2675
- } = _ref;
2676
- if (!feature) return;
2677
- if (!bbox) bbox = feature.__lastBbox;
2678
- if (!resolution) resolution = feature.__lastResolution;
2679
- if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
2613
+ function deserializeBase64(base) {
2614
+ return "data:image/png;base64," + base;
2615
+ }
2680
2616
 
2681
- if (feature.__lastResolution && resolution !== feature.__lastResolution) {
2682
- const newCoordinates = feature instanceof Poly ? PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
2683
- this.setCirclePxRaius(crs);
2684
- this.container.innerHTML = '';
2685
- const svg = this.setSvg(newCoordinates);
2686
- svg && this.container.append(svg);
2687
- }
2617
+ function deserializeAnchor(offset) {
2618
+ // @ts-ignore
2619
+ return offset.map(getParameterValue);
2620
+ }
2688
2621
 
2689
- const polygon = feature.projectTo(bbox.crs);
2690
- 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;
2691
- const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
2692
- const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
2693
- this.container.style.left = dx.toString() + "px";
2694
- this.container.style.top = dy.toString() + "px";
2695
- feature.__lastBbox = bbox;
2696
- feature.__lastResolution = resolution;
2697
- }
2698
- }, {
2699
- key: "setSvg",
2700
- value: function setSvg(coordinates) {
2701
- const {
2702
- lineCap,
2703
- lineJoin,
2704
- miterLimit,
2705
- lineDash,
2706
- dashOffset
2707
- } = this.pathStyles || {};
2708
- const svgRender = new SvgRender(_extends({
2709
- coordinates
2710
- }, defaultPathStyles, {
2711
- appendToSvg: this.appendToSvg
2712
- }, this.pathStyles));
2622
+ function deserializeColor(color) {
2623
+ return color ? new Color(color).toString() : null;
2624
+ }
2713
2625
 
2714
- if (this.circle) {
2715
- svgRender._setArcNode();
2716
- } else {
2717
- svgRender._setPolyNode();
2718
- }
2626
+ const clampSymbol = (symbol, min, max) => {
2627
+ if (isSGisImageSymbol(symbol)) {
2628
+ symbol.width = clamp(symbol.width, min, max);
2629
+ symbol.height = clamp(symbol.height, min, max);
2630
+ } else if (isSGisPointSymbol(symbol)) {
2631
+ symbol.size = clamp(symbol.size, min, max);
2632
+ }
2719
2633
 
2720
- let svgElement;
2721
- svgRender.getNode((_, svg) => {
2722
- svgElement = svg;
2723
- this.className && svgElement.classList.add(this.className);
2724
- const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
2634
+ return symbol;
2635
+ };
2636
+ function centerAlignSymbol(symbol) {
2637
+ if (isSGisImageSymbol(symbol)) {
2638
+ symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
2639
+ } else if (isSGisPointSymbol(symbol)) {
2640
+ symbol.offset = [0, 0];
2641
+ }
2725
2642
 
2726
- if (path) {
2727
- path.setAttribute('stroke-linecap', lineCap || 'round');
2728
- path.setAttribute('stroke-linejoin', lineJoin || 'round');
2729
- path.setAttribute('stroke-miterlimit', (miterLimit || 10).toString());
2730
- path.setAttribute('stroke-dashoffset', (dashOffset || 0).toString());
2643
+ return symbol;
2644
+ }
2645
+ const adjustSymbol = (symbol, _ref) => {
2646
+ let {
2647
+ size
2648
+ } = _ref;
2649
+ return centerAlignSymbol(clampSymbol(symbol, 0, size));
2650
+ };
2731
2651
 
2732
- if (this.circle) {
2733
- path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
2734
- }
2735
- }
2736
- });
2737
- return svgElement;
2738
- }
2739
- }, {
2740
- key: "_setEventListeners",
2741
- value: function _setEventListeners(dynamicFeature) {
2742
- var _dynamicFeature$__dyn;
2652
+ let EvergisFeature = /*#__PURE__*/function () {
2653
+ function EvergisFeature(feature) {
2654
+ _classCallCheck(this, EvergisFeature);
2743
2655
 
2744
- if (dynamicFeature.eventFlags === MouseEventFlags.None) return;
2745
- const svgNode = dynamicFeature == null ? void 0 : (_dynamicFeature$__dyn = dynamicFeature.__dynamicSymbolRender) == null ? void 0 : _dynamicFeature$__dyn.node.querySelector(this.circle ? 'circle' : 'path');
2746
- Object.keys(mouseEvents).forEach(eventName => {
2747
- if (dynamicFeature.eventFlags & mouseEvents[eventName].flag) {
2748
- listenDomEvent(svgNode, mouseEvents[eventName].type, event => {
2749
- dynamicFeature.fire(mouseEvents[eventName].type, {
2750
- node: svgNode,
2751
- browserEvent: event
2752
- });
2753
- });
2754
- }
2755
- });
2756
- }
2757
- }]);
2656
+ this.id = null;
2657
+ this.displayName = null;
2658
+ this.geometry = null;
2659
+ this.layerName = null;
2660
+ this.layerAlias = null;
2661
+ this.attributes = null;
2662
+ this.symbol = null;
2663
+ this.id = feature.id;
2664
+ this.displayName = feature.id;
2665
+ this.geometry = feature.geometry;
2666
+ this.layerName = feature.layer;
2667
+ this.layerAlias = feature.layer;
2668
+ this.attributes = getFeatureAttributes(feature.attributes);
2669
+ }
2758
2670
 
2759
- return SVGPoly;
2760
- }(Symbol$1);
2671
+ _createClass(EvergisFeature, [{
2672
+ key: "sGisFeature",
2673
+ value: function sGisFeature() {
2674
+ if (!this.geometry || !this.symbol) {
2675
+ return null;
2676
+ } // @ts-ignore
2761
2677
 
2762
- function isSGisPointSymbol(symbol) {
2763
- return symbol instanceof PointSymbol || symbol instanceof StaticImageSymbol || symbol instanceof SquareSymbol || symbol instanceof MaskedImage;
2764
- }
2765
- function isSGisImageSymbol(symbol) {
2766
- return symbol instanceof StaticImageSymbol || symbol instanceof MaskedImage;
2767
- }
2768
- function isSGisPolygonSymbol(symbol) {
2769
- return symbol instanceof PolygonSymbol || symbol instanceof BrushFill || symbol instanceof ImageFill;
2770
- }
2771
- function isSGisPolylineSymbol(symbol) {
2772
- return symbol instanceof PolylineSymbol;
2773
- }
2774
2678
 
2775
- /**
2776
- * Моки фич для отображения превью символа
2777
- * http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
2778
- */
2679
+ const {
2680
+ type,
2681
+ coordinates,
2682
+ sr
2683
+ } = this.geometry;
2684
+ const crs = CRS_MAP[sr];
2779
2685
 
2780
- const viewBoxSize = 100;
2781
- const pointFeature = /*#__PURE__*/new PointFeature([50, -50], {
2782
- crs: plain
2783
- });
2784
- const lineFeature = /*#__PURE__*/new Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
2785
- crs: plain
2786
- });
2787
- const polygonFeature = /*#__PURE__*/new Polygon([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
2788
- crs: plain
2789
- });
2790
- const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
2791
- crs: plain
2792
- });
2793
- const polygonLegendFeature = /*#__PURE__*/new Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
2794
- crs: plain
2795
- });
2796
- const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
2797
- crs: plain
2798
- });
2799
- const MAP_LEGEND_FEATURES = {
2800
- polygon: polygonMapLegendFeature
2801
- };
2802
- const LEGEND_FEATURES = {
2803
- polyline: lineLegendFeature,
2804
- polygon: polygonLegendFeature
2805
- };
2806
- const MOCK_FEATURES = {
2807
- point: pointFeature,
2808
- polyline: lineFeature,
2809
- polygon: polygonFeature
2810
- };
2686
+ if (!crs) {
2687
+ return null;
2688
+ }
2811
2689
 
2812
- function getSymbolRenders(symbol, size, features) {
2813
- if (size === void 0) {
2814
- size = viewBoxSize;
2815
- }
2690
+ switch (type) {
2691
+ case GeometryType.Point:
2692
+ return new PointFeature(coordinates, {
2693
+ symbol: selectedPoint,
2694
+ crs
2695
+ });
2816
2696
 
2817
- if (features === void 0) {
2818
- features = {};
2819
- }
2697
+ case GeometryType.Multipoint:
2698
+ return new MultiPoint(coordinates, {
2699
+ symbol: selectedPoint,
2700
+ crs
2701
+ });
2820
2702
 
2821
- const resolution = viewBoxSize / size;
2703
+ case GeometryType.Polyline:
2704
+ return new Polyline(coordinates, {
2705
+ symbol: selectedPolyline,
2706
+ crs
2707
+ });
2822
2708
 
2823
- const featuresToRender = _extends({}, MOCK_FEATURES, features);
2709
+ case GeometryType.Polygon:
2710
+ return new Polygon(coordinates, {
2711
+ symbol: selectedPolygon,
2712
+ crs
2713
+ });
2824
2714
 
2825
- if (isSGisPolygonSymbol(symbol)) {
2826
- return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, plain);
2827
- }
2715
+ default:
2716
+ return null;
2717
+ }
2718
+ }
2719
+ }, {
2720
+ key: "extent",
2721
+ value: function extent() {
2722
+ const feature = this.sGisFeature();
2723
+ return feature && feature.bbox;
2724
+ }
2725
+ }]);
2828
2726
 
2829
- if (isSGisPolylineSymbol(symbol)) {
2830
- return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, plain);
2831
- }
2727
+ return EvergisFeature;
2728
+ }();
2832
2729
 
2833
- return symbol.renderFunctionAsync(featuresToRender.point, resolution, plain);
2834
- }
2835
- const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
2836
- if (size === void 0) {
2837
- size = viewBoxSize;
2838
- }
2730
+ function evaluateCondition(condition, attributes) {
2731
+ try {
2732
+ const evaluator = new ConditionEvaluator(attributes);
2733
+ const result = evaluator.evaluate(condition);
2839
2734
 
2840
- return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
2841
- };
2842
- const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
2843
- if (size === void 0) {
2844
- size = viewBoxSize;
2845
- }
2735
+ if (result instanceof Error) {
2736
+ return null;
2737
+ }
2846
2738
 
2847
- return getSymbolRenders(symbol, size, LEGEND_FEATURES);
2848
- };
2739
+ return result;
2740
+ } catch (_unused) {
2741
+ return null;
2742
+ }
2743
+ }
2849
2744
 
2850
- function renderSymbolToCanvas(renders, canvas) {
2851
- renders.forEach(render => {
2852
- canvas.draw(render);
2745
+ function getAttributeValue(attributes, attributeName) {
2746
+ const attributeMeta = attributes.find((_ref) => {
2747
+ let {
2748
+ name
2749
+ } = _ref;
2750
+ return name === attributeName;
2853
2751
  });
2854
- }
2855
-
2856
- function deserializeSymbol(symbol) {
2857
- switch (symbol.type) {
2858
- case 'circlePointSymbol':
2859
- return deserializePointSymbol(symbol);
2860
-
2861
- case 'squarePointSymbol':
2862
- return deserializeSquareSymbol(symbol);
2863
-
2864
- case 'maskedImagePointSymbol':
2865
- return deserializeMaskedImageSymbol(symbol);
2866
-
2867
- case 'imagePointSymbol':
2868
- return deserializeImagePointSymbol(symbol);
2869
-
2870
- case 'polygonSymbol':
2871
- return deserializePolygonSymbol(symbol);
2872
-
2873
- case 'simplePolylineSymbol':
2874
- case 'polylineSymbol':
2875
- return deserializePolylineSymbol(symbol);
2876
-
2877
- default:
2878
- return null;
2879
- }
2880
- }
2881
-
2882
- function deserializePointSymbol(symbol) {
2883
- // @ts-ignore
2884
- return new PointSymbol(deserializePointSymbolParams(symbol));
2885
- }
2886
-
2887
- function deserializeSquareSymbol(symbol) {
2888
- return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
2889
- // @ts-ignore
2890
- angle: getParameterValue(symbol.angle)
2891
- }));
2892
- }
2893
-
2894
- function deserializeMaskedImageSymbol(symbol) {
2895
- return new MaskedImage(_extends({}, symbol, {
2896
- // @ts-ignore
2897
- angle: getParameterValue(symbol.angle),
2898
- // @ts-ignore
2899
- width: getParameterValue(symbol.width),
2900
- // @ts-ignore
2901
- height: getParameterValue(symbol.height),
2902
- // @ts-ignore
2903
- anchorPoint: deserializeAnchor(symbol.offset),
2904
- // @ts-ignore
2905
- imageSource: deserializeBase64(symbol.image),
2906
- // @ts-ignore
2907
- maskSource: deserializeBase64(symbol.imageMask),
2908
- // @ts-ignore
2909
- maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
2910
- }));
2911
- }
2912
-
2913
- function deserializeImagePointSymbol(symbol) {
2914
- return new StaticImageSymbol(_extends({}, symbol, {
2915
- // @ts-ignore
2916
- angle: getParameterValue(symbol.angle),
2917
- // @ts-ignore
2918
- width: getParameterValue(symbol.width),
2919
- // @ts-ignore
2920
- height: getParameterValue(symbol.height),
2921
- // @ts-ignore
2922
- anchorPoint: deserializeAnchor(symbol.offset),
2923
- // @ts-ignore
2924
- source: deserializeBase64(symbol.image)
2925
- }));
2926
- }
2927
-
2928
- function deserializePolygonSymbol(symbol) {
2929
- if (isPolygonHasPatternBrush(symbol)) {
2930
- return new SGisImageFill(symbol);
2931
- }
2932
-
2933
- if (isPolygonHasHatchBrush(symbol)) {
2934
- return new SGisBrushFill(symbol);
2935
- }
2936
-
2937
- return new SGisPolygonSymbol(symbol);
2938
- }
2939
-
2940
- function deserializePolylineSymbol(symbol) {
2941
- return new SGisPolylineSymbol(symbol);
2942
- }
2943
-
2944
- function deserializePointSymbolParams(_ref) {
2945
- let {
2946
- size,
2947
- offset,
2948
- strokeColor,
2949
- strokeWidth,
2950
- fillColor
2951
- } = _ref;
2952
- return {
2953
- size: getParameterValue(size),
2954
- offset: deserializeAnchor(offset),
2955
- strokeWidth: getParameterValue(strokeWidth),
2956
- strokeColor: deserializeColor(getParameterValue(strokeColor)),
2957
- fillColor: deserializeColor(getParameterValue(fillColor))
2958
- };
2959
- }
2960
-
2961
- function deserializeBase64(base) {
2962
- return "data:image/png;base64," + base;
2963
- }
2964
-
2965
- function deserializeAnchor(offset) {
2966
- // @ts-ignore
2967
- return offset.map(getParameterValue);
2968
- }
2969
-
2970
- function deserializeColor(color) {
2971
- return color ? new Color(color).toString() : null;
2972
- }
2973
-
2974
- const clampSymbol = (symbol, min, max) => {
2975
- if (isSGisImageSymbol(symbol)) {
2976
- symbol.width = clamp(symbol.width, min, max);
2977
- symbol.height = clamp(symbol.height, min, max);
2978
- } else if (isSGisPointSymbol(symbol)) {
2979
- symbol.size = clamp(symbol.size, min, max);
2980
- }
2981
-
2982
- return symbol;
2983
- };
2984
- function centerAlignSymbol(symbol) {
2985
- if (isSGisImageSymbol(symbol)) {
2986
- symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
2987
- } else if (isSGisPointSymbol(symbol)) {
2988
- symbol.offset = [0, 0];
2989
- }
2990
-
2991
- return symbol;
2992
- }
2993
- const adjustSymbol = (symbol, _ref) => {
2994
- let {
2995
- size
2996
- } = _ref;
2997
- return centerAlignSymbol(clampSymbol(symbol, 0, size));
2998
- };
2999
-
3000
- let EvergisFeature = /*#__PURE__*/function () {
3001
- function EvergisFeature(feature) {
3002
- _classCallCheck(this, EvergisFeature);
3003
-
3004
- this.id = null;
3005
- this.displayName = null;
3006
- this.geometry = null;
3007
- this.layerName = null;
3008
- this.layerAlias = null;
3009
- this.attributes = null;
3010
- this.symbol = null;
3011
- this.id = feature.id;
3012
- this.displayName = feature.id;
3013
- this.geometry = feature.geometry;
3014
- this.layerName = feature.layer;
3015
- this.layerAlias = feature.layer;
3016
- this.attributes = getFeatureAttributes(feature.attributes);
3017
- }
3018
-
3019
- _createClass(EvergisFeature, [{
3020
- key: "sGisFeature",
3021
- value: function sGisFeature() {
3022
- if (!this.geometry || !this.symbol) {
3023
- return null;
3024
- } // @ts-ignore
3025
-
3026
-
3027
- const {
3028
- type,
3029
- coordinates,
3030
- sr
3031
- } = this.geometry;
3032
- const crs = CRS_MAP[sr];
3033
-
3034
- if (!crs) {
3035
- return null;
3036
- }
3037
-
3038
- switch (type) {
3039
- case GeometryType.Point:
3040
- return new PointFeature(coordinates, {
3041
- symbol: selectedPoint,
3042
- crs
3043
- });
3044
-
3045
- case GeometryType.Multipoint:
3046
- return new MultiPoint(coordinates, {
3047
- symbol: selectedPoint,
3048
- crs
3049
- });
3050
-
3051
- case GeometryType.Polyline:
3052
- return new Polyline(coordinates, {
3053
- symbol: selectedPolyline,
3054
- crs
3055
- });
3056
-
3057
- case GeometryType.Polygon:
3058
- return new Polygon(coordinates, {
3059
- symbol: selectedPolygon,
3060
- crs
3061
- });
3062
-
3063
- default:
3064
- return null;
3065
- }
3066
- }
3067
- }, {
3068
- key: "extent",
3069
- value: function extent() {
3070
- const feature = this.sGisFeature();
3071
- return feature && feature.bbox;
3072
- }
3073
- }]);
3074
-
3075
- return EvergisFeature;
3076
- }();
3077
-
3078
- function evaluateCondition(condition, attributes) {
3079
- try {
3080
- const evaluator = new ConditionEvaluator(attributes);
3081
- const result = evaluator.evaluate(condition);
3082
-
3083
- if (result instanceof Error) {
3084
- return null;
3085
- }
3086
-
3087
- return result;
3088
- } catch (_unused) {
3089
- return null;
3090
- }
3091
- }
3092
-
3093
- function getAttributeValue(attributes, attributeName) {
3094
- const attributeMeta = attributes.find(_ref => {
3095
- let {
3096
- name
3097
- } = _ref;
3098
- return name === attributeName;
3099
- });
3100
- return attributeMeta ? attributeMeta.value : null;
2752
+ return attributeMeta ? attributeMeta.value : null;
3101
2753
  }
3102
2754
 
3103
2755
  const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
@@ -3105,7 +2757,7 @@ const getAttributeNameFromClassified = values => values.length > 0 ? getAttribut
3105
2757
 
3106
2758
  function findFeatureValue(parameterValues, _ref2) {
3107
2759
  let [name, value] = _ref2;
3108
- return value !== null ? parameterValues.find(_ref3 => {
2760
+ return value !== null ? parameterValues.find((_ref3) => {
3109
2761
  let {
3110
2762
  condition
3111
2763
  } = _ref3;
@@ -3145,7 +2797,7 @@ function evaluateFeatureSymbol(attributes) {
3145
2797
  }
3146
2798
 
3147
2799
  function findChildFeatureStyle(childStyles, attributes) {
3148
- return (childStyles || []).find(_ref5 => {
2800
+ return (childStyles || []).find((_ref5) => {
3149
2801
  let {
3150
2802
  condition
3151
2803
  } = _ref5;
@@ -3206,7 +2858,7 @@ let EvergisLayer = /*#__PURE__*/function () {
3206
2858
  feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
3207
2859
  feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
3208
2860
  feature.layerAlias = this.alias;
3209
- const titleAttribute = (feature.attributes || []).find(_ref => {
2861
+ const titleAttribute = (feature.attributes || []).find((_ref) => {
3210
2862
  let {
3211
2863
  name
3212
2864
  } = _ref;
@@ -3229,7 +2881,7 @@ const evaluateFeature = layers => feature => {
3229
2881
  };
3230
2882
 
3231
2883
  const OTHERS_TITLE = 'Другое';
3232
- const createLegendItem = _ref => {
2884
+ const createLegendItem = (_ref) => {
3233
2885
  let {
3234
2886
  attributes,
3235
2887
  renderTitle,
@@ -3271,7 +2923,7 @@ function createStyleLegend(style, config) {
3271
2923
  classificationManager,
3272
2924
  symbol
3273
2925
  } = style;
3274
- const items = classificationManager.filter(_ref => {
2926
+ const items = classificationManager.filter((_ref) => {
3275
2927
  let {
3276
2928
  parameter
3277
2929
  } = _ref;
@@ -3388,7 +3040,7 @@ const useMapLegend = (layer, config) => {
3388
3040
  };
3389
3041
 
3390
3042
  const LEGEND_SYMBOL_MAX_SIZE = 32;
3391
- const useLegendValueSymbol = _ref => {
3043
+ const useLegendValueSymbol = (_ref) => {
3392
3044
  let {
3393
3045
  parameter,
3394
3046
  parameterValue
@@ -3790,7 +3442,7 @@ function useMapWrapper() {
3790
3442
  return wrapperRef;
3791
3443
  }
3792
3444
 
3793
- const byScale = scale => _ref => {
3445
+ const byScale = scale => (_ref) => {
3794
3446
  let {
3795
3447
  zIndex
3796
3448
  } = _ref;
@@ -3989,7 +3641,7 @@ const useTooltip = function useTooltip(zIndex) {
3989
3641
 
3990
3642
  return reset;
3991
3643
  }, [reset, map, layer, zIndex]);
3992
- const onSetLabelFeature = useCallback(_ref => {
3644
+ const onSetLabelFeature = useCallback((_ref) => {
3993
3645
  let {
3994
3646
  point,
3995
3647
  position,
@@ -4153,7 +3805,7 @@ function useClusterLayer(_ref) {
4153
3805
  }
4154
3806
 
4155
3807
  const INIT_FEATURES = [];
4156
- const useEvergisSelect = _ref => {
3808
+ const useEvergisSelect = (_ref) => {
4157
3809
  let {
4158
3810
  onPick,
4159
3811
  onFeatures
@@ -4186,7 +3838,7 @@ function none() {
4186
3838
  return;
4187
3839
  }
4188
3840
 
4189
- const useDraggableMarker = _ref => {
3841
+ const useDraggableMarker = (_ref) => {
4190
3842
  let {
4191
3843
  position,
4192
3844
  onChange,
@@ -4302,7 +3954,7 @@ const useDebouncedCallback = interval => {
4302
3954
  }, interval), [interval]);
4303
3955
  };
4304
3956
 
4305
- const Symbol = _ref => {
3957
+ const Symbol = (_ref) => {
4306
3958
  let {
4307
3959
  symbol,
4308
3960
  size,
@@ -4323,7 +3975,7 @@ const Symbol = _ref => {
4323
3975
  };
4324
3976
 
4325
3977
  var _templateObject;
4326
- const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), _ref => {
3978
+ const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), (_ref) => {
4327
3979
  let {
4328
3980
  geometryType,
4329
3981
  icons
@@ -4332,7 +3984,7 @@ const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject
4332
3984
  });
4333
3985
 
4334
3986
  const MAX_SIZE = 32;
4335
- const StyleSymbol = _ref => {
3987
+ const StyleSymbol = (_ref) => {
4336
3988
  let {
4337
3989
  symbol,
4338
3990
  size = MAX_SIZE,
@@ -4377,7 +4029,7 @@ const CloseIcon = /*#__PURE__*/styled(Icon)(_templateObject20 || (_templateObjec
4377
4029
  const PrevIcon = /*#__PURE__*/styled(Icon)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
4378
4030
  const NextIcon = /*#__PURE__*/styled(Icon)(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
4379
4031
 
4380
- const MailValue = _ref => {
4032
+ const MailValue = (_ref) => {
4381
4033
  let {
4382
4034
  mail
4383
4035
  } = _ref;
@@ -4388,7 +4040,7 @@ const MailValue = _ref => {
4388
4040
  }, mail);
4389
4041
  };
4390
4042
 
4391
- const PhoneValue = _ref => {
4043
+ const PhoneValue = (_ref) => {
4392
4044
  let {
4393
4045
  phone
4394
4046
  } = _ref;
@@ -4399,7 +4051,7 @@ const PhoneValue = _ref => {
4399
4051
  }, phone);
4400
4052
  };
4401
4053
 
4402
- const UrlValue = _ref => {
4054
+ const UrlValue = (_ref) => {
4403
4055
  let {
4404
4056
  url
4405
4057
  } = _ref;
@@ -4410,7 +4062,7 @@ const UrlValue = _ref => {
4410
4062
  }, url);
4411
4063
  };
4412
4064
 
4413
- const AttributeValue = _ref => {
4065
+ const AttributeValue = (_ref) => {
4414
4066
  let {
4415
4067
  attribute
4416
4068
  } = _ref;
@@ -4424,29 +4076,29 @@ const AttributeValue = _ref => {
4424
4076
  if (attributeValue.type === 2
4425
4077
  /* Url */
4426
4078
  ) {
4427
- return React.createElement(UrlValue, {
4428
- key: key,
4429
- url: punycodeDecode(value)
4430
- });
4431
- }
4079
+ return React.createElement(UrlValue, {
4080
+ key: key,
4081
+ url: punycodeDecode(value)
4082
+ });
4083
+ }
4432
4084
 
4433
4085
  if (attributeValue.type === 3
4434
4086
  /* Mail */
4435
4087
  ) {
4436
- return React.createElement(MailValue, {
4437
- key: key,
4438
- mail: value
4439
- });
4440
- }
4088
+ return React.createElement(MailValue, {
4089
+ key: key,
4090
+ mail: value
4091
+ });
4092
+ }
4441
4093
 
4442
4094
  if (attributeValue.type === 1
4443
4095
  /* Phone */
4444
4096
  ) {
4445
- return React.createElement(PhoneValue, {
4446
- key: key,
4447
- phone: value
4448
- });
4449
- }
4097
+ return React.createElement(PhoneValue, {
4098
+ key: key,
4099
+ phone: value
4100
+ });
4101
+ }
4450
4102
 
4451
4103
  return React.createElement(SimpleAttribute, {
4452
4104
  key: value
@@ -4462,7 +4114,7 @@ function punycodeDecode(domains) {
4462
4114
  }
4463
4115
  }
4464
4116
 
4465
- const EvergisCardAttribute = _ref => {
4117
+ const EvergisCardAttribute = (_ref) => {
4466
4118
  let {
4467
4119
  attribute,
4468
4120
  className
@@ -4474,7 +4126,7 @@ const EvergisCardAttribute = _ref => {
4474
4126
  }));
4475
4127
  };
4476
4128
 
4477
- const StyledCard = _ref => {
4129
+ const StyledCard = (_ref) => {
4478
4130
  let {
4479
4131
  features = [],
4480
4132
  className,
@@ -4525,7 +4177,7 @@ const StyledCard = _ref => {
4525
4177
  };
4526
4178
 
4527
4179
  const _excluded$1 = ["renderCard", "className", "children"];
4528
- const EvergisCard = _ref => {
4180
+ const EvergisCard = (_ref) => {
4529
4181
  let {
4530
4182
  renderCard,
4531
4183
  className,
@@ -4577,7 +4229,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
4577
4229
 
4578
4230
  const useSGisFeatures = (features, currentIndex) => useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
4579
4231
 
4580
- const EvergisSelectLayer = _ref => {
4232
+ const EvergisSelectLayer = (_ref) => {
4581
4233
  let {
4582
4234
  features,
4583
4235
  zIndex,
@@ -4622,7 +4274,7 @@ const TileLayer = props => {
4622
4274
  };
4623
4275
 
4624
4276
  const defaultZIndex = 200;
4625
- const EvergisSelect = _ref => {
4277
+ const EvergisSelect = (_ref) => {
4626
4278
  let {
4627
4279
  onPick,
4628
4280
  className,
@@ -4657,7 +4309,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled.p(_templateObject3$1 || (_template
4657
4309
  const LegendValueContainer = /*#__PURE__*/styled.div(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n font-size: 0.625rem;\n padding: 0.125rem 0;\n\n ", " {\n padding-left: 0.5rem;\n }\n"])), LegendSymbolTitle);
4658
4310
  const LegendSectionHeader = /*#__PURE__*/styled.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])));
4659
4311
 
4660
- const LegendSection = _ref => {
4312
+ const LegendSection = (_ref) => {
4661
4313
  let {
4662
4314
  item,
4663
4315
  renderLegendTitle,
@@ -4674,7 +4326,7 @@ SearchPrefix.defaultProps = {
4674
4326
  kind: "search"
4675
4327
  };
4676
4328
 
4677
- const SearchInput = _ref => {
4329
+ const SearchInput = (_ref) => {
4678
4330
  let {
4679
4331
  onChange
4680
4332
  } = _ref;
@@ -4683,7 +4335,7 @@ const SearchInput = _ref => {
4683
4335
  }));
4684
4336
  };
4685
4337
 
4686
- const LegendSymbol = _ref => {
4338
+ const LegendSymbol = (_ref) => {
4687
4339
  let {
4688
4340
  parameter,
4689
4341
  parameterValue,
@@ -4701,7 +4353,7 @@ const LegendSymbol = _ref => {
4701
4353
  return React.createElement(React.Fragment, null, children(symbol));
4702
4354
  };
4703
4355
 
4704
- const LegendValue = _ref => {
4356
+ const LegendValue = (_ref) => {
4705
4357
  let {
4706
4358
  value,
4707
4359
  parameter,
@@ -4723,7 +4375,7 @@ const getNumberParam = (parameterValue, param) => {
4723
4375
  return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
4724
4376
  };
4725
4377
 
4726
- const getSymbolSize = _ref => {
4378
+ const getSymbolSize = (_ref) => {
4727
4379
  let {
4728
4380
  parameterValue,
4729
4381
  maxSize
@@ -4748,7 +4400,7 @@ const getSymbolSize = _ref => {
4748
4400
  }
4749
4401
  };
4750
4402
 
4751
- const Legend = _ref => {
4403
+ const Legend = (_ref) => {
4752
4404
  let {
4753
4405
  layer,
4754
4406
  children,
@@ -4791,7 +4443,7 @@ const Legend = _ref => {
4791
4443
  })))));
4792
4444
  };
4793
4445
 
4794
- const Map = _ref => {
4446
+ const Map = (_ref) => {
4795
4447
  let {
4796
4448
  className,
4797
4449
  position,
@@ -4813,163 +4465,488 @@ const Map = _ref => {
4813
4465
  })) {
4814
4466
  onBboxChange(state);
4815
4467
  }
4816
- }, [map, onBboxChange, position, resolution]);
4817
- useUpdateMapView({
4818
- position,
4819
- resolution
4820
- });
4821
- useMaxMinScale(minScale, maxScale, position, resolution);
4822
- useMapBboxChange(handleBboxChange);
4823
- return React.createElement("div", {
4824
- className: className,
4825
- ref: wrapperRef,
4826
- style: style
4827
- }, children);
4828
- };
4829
-
4830
- var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
4831
-
4832
- const topLeft = distance => css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
4468
+ }, [map, onBboxChange, position, resolution]);
4469
+ useUpdateMapView({
4470
+ position,
4471
+ resolution
4472
+ });
4473
+ useMaxMinScale(minScale, maxScale, position, resolution);
4474
+ useMapBboxChange(handleBboxChange);
4475
+ return React.createElement("div", {
4476
+ className: className,
4477
+ ref: wrapperRef,
4478
+ style: style
4479
+ }, children);
4480
+ };
4481
+
4482
+ var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
4483
+
4484
+ const topLeft = distance => css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
4485
+
4486
+ const topRight = distance => css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n top: ", ";\n right: ", ";\n"])), distance, distance);
4487
+
4488
+ const bottomLeft = distance => css(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n left: ", ";\n"])), distance, distance);
4489
+
4490
+ const bottomRight = distance => css(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n right: ", ";\n"])), distance, distance);
4491
+
4492
+ const placementMixin = function placementMixin(placement, distance) {
4493
+ if (placement === void 0) {
4494
+ placement = 'bottom-left';
4495
+ }
4496
+
4497
+ if (distance === void 0) {
4498
+ distance = '1rem';
4499
+ }
4500
+
4501
+ return css(_templateObject5$2 || (_templateObject5$2 = _taggedTemplateLiteralLoose(["\n ", "\n ", "\n ", "\n ", "\n"])), placement === 'top-left' && topLeft(distance), placement === 'top-right' && topRight(distance), placement === 'bottom-left' && bottomLeft(distance), placement === 'bottom-right' && bottomRight(distance));
4502
+ };
4503
+
4504
+ var _templateObject$5, _templateObject2$4, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$1, _templateObject7$1, _templateObject8$1;
4505
+ const mapControlBtnMixin = /*#__PURE__*/css(_templateObject$5 || (_templateObject$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 2rem;\n height: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: #fff;\n"])));
4506
+ const ZoomInBtn = /*#__PURE__*/styled(Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4507
+ ZoomInBtn.defaultProps = {
4508
+ kind: "plus"
4509
+ };
4510
+ const ZoomOutBtn = /*#__PURE__*/styled(Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4511
+ ZoomOutBtn.defaultProps = {
4512
+ kind: "minus"
4513
+ };
4514
+ const SearchBtn = /*#__PURE__*/styled(Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4515
+ SearchBtn.defaultProps = {
4516
+ kind: "search"
4517
+ }; // TODO not exists in fonts
4518
+
4519
+ const FullscreenBtn = /*#__PURE__*/styled(Icon)(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4520
+ FullscreenBtn.defaultProps = {
4521
+ kind: "maximize"
4522
+ };
4523
+ const MeasureBtn = /*#__PURE__*/styled(Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4524
+ MeasureBtn.defaultProps = {
4525
+ kind: "measure_length"
4526
+ };
4527
+ 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"])));
4528
+ 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) => {
4529
+ let {
4530
+ vertical
4531
+ } = _ref;
4532
+ return vertical ? 'column' : 'row';
4533
+ }, (_ref2) => {
4534
+ let {
4535
+ placement
4536
+ } = _ref2;
4537
+ return placementMixin(placement);
4538
+ }, MapControl, (_ref3) => {
4539
+ let {
4540
+ vertical
4541
+ } = _ref3;
4542
+ return vertical ? '0.5rem' : '0';
4543
+ }, (_ref4) => {
4544
+ let {
4545
+ vertical
4546
+ } = _ref4;
4547
+ return vertical ? '0' : '0.5rem';
4548
+ }, (_ref5) => {
4549
+ let {
4550
+ vertical
4551
+ } = _ref5;
4552
+ return vertical ? 'column' : 'row';
4553
+ });
4554
+
4555
+ const Measure = () => {
4556
+ return React.createElement(MapControl, null, React.createElement(MeasureBtn, {
4557
+ onClick: () => {}
4558
+ }));
4559
+ };
4560
+
4561
+ const Search = () => {
4562
+ return React.createElement(MapControl, null, React.createElement(SearchBtn, {
4563
+ onClick: () => {}
4564
+ }));
4565
+ };
4566
+
4567
+ const Fullscreen = () => {
4568
+ return React.createElement(MapControl, null, React.createElement(FullscreenBtn, {
4569
+ onClick: () => {}
4570
+ }));
4571
+ };
4572
+
4573
+ var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4;
4574
+ const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
4575
+ const MapLegendContainer = /*#__PURE__*/styled.div(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 16.5rem;\n height: 3.875rem;\n align-items: center;\n padding: 0.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1rem;\n width: 0.835rem;\n }\n"])));
4576
+ const MapLegendHeader = /*#__PURE__*/styled(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
4577
+ const MapLegendSection = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
4578
+ const MapLegendValueDescr = /*#__PURE__*/styled.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0.5rem;\n font-size: 0.625rem;\n opacity: 0.65;\n"])));
4579
+
4580
+ const MAX_SIZE$2 = 100;
4581
+ const MapLegendSymbol = (_ref) => {
4582
+ let {
4583
+ value,
4584
+ parameter
4585
+ } = _ref;
4586
+ return React.createElement(LegendSymbol, {
4587
+ key: value.title,
4588
+ parameter: parameter,
4589
+ parameterValue: value.parameterValue
4590
+ }, symbol => React.createElement(Symbol, {
4591
+ render: getMapLegendSymbolRenders,
4592
+ symbol: symbol,
4593
+ size: MAX_SIZE$2
4594
+ }));
4595
+ };
4596
+
4597
+ const DEFAULT_FROM_TO = ['Выше', 'Ниже'];
4598
+ const MapLegend = (_ref) => {
4599
+ let {
4600
+ layer,
4601
+ config,
4602
+ fromToTitle = DEFAULT_FROM_TO,
4603
+ className
4604
+ } = _ref;
4605
+ const legend = useMapLegend(layer, config);
4606
+
4607
+ if (!legend) {
4608
+ return null;
4609
+ }
4610
+
4611
+ const {
4612
+ symbol,
4613
+ item
4614
+ } = legend;
4615
+ return React.createElement(LegendProvider, {
4616
+ symbol: symbol
4617
+ }, React.createElement(MapLegendControl, {
4618
+ className: className
4619
+ }, React.createElement(MapLegendContainer, null, React.createElement(MapLegendHeader, null, item.title), React.createElement(MapLegendSection, null, React.createElement(MapLegendValueDescr, null, fromToTitle[0]), item.values.map(value => React.createElement(MapLegendSymbol, {
4620
+ key: value.title,
4621
+ value: value,
4622
+ parameter: item.parameter
4623
+ })), React.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
4624
+ };
4625
+
4626
+ const DEFAULT_FORMATTERS = {
4627
+ polygon: formatPolygonMeasure,
4628
+ length: formatLength
4629
+ };
4630
+
4631
+ const COORD_FRACTION = 6;
4632
+ const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
4633
+ let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
4634
+ _inherits(BaseMeasureToolCreator, _PolylineControl);
4635
+
4636
+ var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
4637
+
4638
+ function BaseMeasureToolCreator(map, painter, params) {
4639
+ var _this;
4640
+
4641
+ _classCallCheck(this, BaseMeasureToolCreator);
4642
+
4643
+ _this = _super.call(this, map, params);
4644
+
4645
+ _this.cancel = () => {
4646
+ _this.fire('cancel');
4647
+ };
4648
+
4649
+ _this.painter = painter;
4650
+ _this.renderLabelSymbol = params.renderLabelSymbol;
4651
+ _this.formatters = params.formatters || DEFAULT_FORMATTERS;
4652
+ _this.areaSymbol = params.areaSymbol;
4653
+
4654
+ _this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
4655
+
4656
+
4657
+ _this.on('change', _this.updateDistance);
4658
+
4659
+ return _this;
4660
+ }
4661
+
4662
+ _createClass(BaseMeasureToolCreator, [{
4663
+ key: "_handleMousemove",
4664
+ value: function _handleMousemove(event) {
4665
+ _get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_handleMousemove", this).call(this, event);
4666
+
4667
+ this.drawPointOnMouseMove(event);
4668
+ }
4669
+ }, {
4670
+ key: "_activate",
4671
+ value: function _activate() {
4672
+ _get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_activate", this).call(this);
4673
+
4674
+ this.addTempLabel();
4675
+ this.setCursor('pointer');
4676
+ }
4677
+ }, {
4678
+ key: "_deactivate",
4679
+ value: function _deactivate() {
4680
+ _get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_deactivate", this).call(this);
4681
+
4682
+ this.removeCoordLabel();
4683
+ this.removeTempLabel();
4684
+ this.removeMeasureLabel();
4685
+ this.removeTempPolygon();
4686
+ this.setCursor('default');
4687
+ }
4688
+ }, {
4689
+ key: "handlePointAdd",
4690
+ value: function handlePointAdd() {
4691
+ const feature = this.activeFeature;
4692
+ if (!feature) return;
4693
+ const {
4694
+ rings,
4695
+ crs
4696
+ } = feature;
4697
+
4698
+ if (isPolylineLikePolygon(rings, this.map.resolution)) {
4699
+ this.finishDrawing();
4700
+ this.fire(new DrawingFinishEvent(feature, new MouseEvent('mouseup')));
4701
+ return;
4702
+ }
4703
+
4704
+ if (rings[0].length === 2) {
4705
+ const projection = crs.projectionTo(geo);
4706
+ const point = rings[0][0];
4707
+ if (!projection) return;
4708
+ const [lat, long] = projection(point);
4709
+ this.removeTempLabel();
4710
+ this.addMeasureResultLabel();
4711
+ this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
4712
+ } else {
4713
+ this.removeCoordLabel();
4714
+ }
4715
+ }
4716
+ }, {
4717
+ key: "polygonPreview",
4718
+ value: function polygonPreview() {
4719
+ if (this.tempPolygon) {
4720
+ this._tempLayer && this._tempLayer.remove(this.tempPolygon);
4721
+ }
4722
+
4723
+ const feature = this.activeFeature;
4724
+ if (!feature) return;
4725
+ const {
4726
+ rings,
4727
+ crs
4728
+ } = feature;
4729
+ const polygonRings = [...rings[0]];
4730
+ polygonRings.shift();
4731
+ this.tempPolygon = new Polygon(polygonRings, {
4732
+ crs
4733
+ });
4734
+ this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
4735
+ this.activeFeature && this.activeFeature.hide();
4736
+ this._tempLayer && this._tempLayer.add(this.tempPolygon);
4737
+ }
4738
+ }, {
4739
+ key: "removeTempPolygon",
4740
+ value: function removeTempPolygon() {
4741
+ if (this.tempPolygon) {
4742
+ this._tempLayer && this._tempLayer.remove(this.tempPolygon);
4743
+ delete this.tempPolygon;
4744
+ }
4745
+ }
4746
+ }, {
4747
+ key: "updateDistance",
4748
+ value: function updateDistance(event) {
4749
+ const feature = this.activeFeature;
4750
+ const {
4751
+ ringIndex,
4752
+ pointIndex
4753
+ } = event;
4754
+ if (!feature || ringIndex === null || pointIndex === null) return;
4755
+ const {
4756
+ rings,
4757
+ crs
4758
+ } = feature;
4759
+ const position = rings[ringIndex][pointIndex];
4760
+ const length$1 = length(rings, crs);
4761
+ let content = this.formatters.length(length$1);
4762
+
4763
+ if (isPolylineLikePolygon(rings, this.map.resolution)) {
4764
+ this.polygonPreview();
4765
+ const area$1 = area(rings, crs);
4766
+ content = this.formatters.polygon(area$1, length$1);
4767
+ } else if (this.tempPolygon) {
4768
+ feature.show();
4769
+ this.removeTempPolygon();
4770
+ }
4771
+
4772
+ if (this.measureResultLabel) {
4773
+ this.measureResultLabel.position = position;
4774
+ this.measureResultLabel.content = content;
4775
+ }
4776
+ }
4777
+ }, {
4778
+ key: "addTempLabel",
4779
+ value: function addTempLabel() {
4780
+ this.tempLabel = new LabelFeature(DEFAULT_LABEL_POSITION, {
4781
+ content: 'Нажмите на карту, чтобы начать измерение',
4782
+ crs: this.map.crs,
4783
+ symbol: createLabelSymbol({
4784
+ renderLabel: this.renderLabelSymbol
4785
+ })
4786
+ });
4787
+ this._tempLayer && this._tempLayer.add(this.tempLabel);
4788
+ }
4789
+ }, {
4790
+ key: "addCoordLabel",
4791
+ value: function addCoordLabel(content, position) {
4792
+ this.coordLabel = new LabelFeature(position, {
4793
+ content,
4794
+ crs: this.map.crs,
4795
+ symbol: createLabelSymbol({
4796
+ renderLabel: this.renderLabelSymbol,
4797
+ onClose: this.cancel
4798
+ })
4799
+ });
4800
+ this._tempLayer && this.coordLabel && this._tempLayer.add(this.coordLabel);
4801
+ }
4802
+ }, {
4803
+ key: "addMeasureResultLabel",
4804
+ value: function addMeasureResultLabel() {
4805
+ this.measureResultLabel = new LabelFeature(DEFAULT_LABEL_POSITION, {
4806
+ crs: this.map.crs,
4807
+ symbol: createLabelSymbol({
4808
+ renderLabel: this.renderLabelSymbol
4809
+ })
4810
+ });
4811
+ this._tempLayer && this.measureResultLabel && this._tempLayer.add(this.measureResultLabel);
4812
+ }
4813
+ }, {
4814
+ key: "removeTempLabel",
4815
+ value: function removeTempLabel() {
4816
+ if (this.tempLabel) {
4817
+ this._tempLayer && this._tempLayer.remove(this.tempLabel);
4818
+ delete this.tempLabel;
4819
+ }
4820
+ }
4821
+ }, {
4822
+ key: "removeCoordLabel",
4823
+ value: function removeCoordLabel() {
4824
+ if (this.coordLabel) {
4825
+ this._tempLayer && this._tempLayer.remove(this.coordLabel);
4826
+ delete this.coordLabel;
4827
+ }
4828
+ }
4829
+ }, {
4830
+ key: "removeMeasureLabel",
4831
+ value: function removeMeasureLabel() {
4832
+ if (this.measureResultLabel) {
4833
+ this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
4834
+ delete this.measureResultLabel;
4835
+ }
4836
+ }
4837
+ }, {
4838
+ key: "drawPointOnMouseMove",
4839
+ value: function drawPointOnMouseMove(event) {
4840
+ if (this.tempLabel) {
4841
+ this.tempLabel.position = event.point.position;
4842
+ }
4843
+ }
4844
+ }, {
4845
+ key: "setCursor",
4846
+ value: function setCursor(cursor) {
4847
+ const {
4848
+ wrapper
4849
+ } = this.painter;
4833
4850
 
4834
- const topRight = distance => css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n top: ", ";\n right: ", ";\n"])), distance, distance);
4851
+ if (wrapper && typeof wrapper !== 'string') {
4852
+ wrapper.style.cursor = cursor;
4853
+ }
4854
+ }
4855
+ }]);
4835
4856
 
4836
- const bottomLeft = distance => css(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n left: ", ";\n"])), distance, distance);
4857
+ return BaseMeasureToolCreator;
4858
+ }(PolylineControl);
4837
4859
 
4838
- const bottomRight = distance => css(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n right: ", ";\n"])), distance, distance);
4860
+ let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
4861
+ _inherits(BaseMeasureToolEditor, _PolyEditor);
4839
4862
 
4840
- const placementMixin = function placementMixin(placement, distance) {
4841
- if (placement === void 0) {
4842
- placement = 'bottom-left';
4843
- }
4863
+ var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
4844
4864
 
4845
- if (distance === void 0) {
4846
- distance = '1rem';
4847
- }
4865
+ function BaseMeasureToolEditor(map, painter, params) {
4866
+ var _this;
4848
4867
 
4849
- return css(_templateObject5$2 || (_templateObject5$2 = _taggedTemplateLiteralLoose(["\n ", "\n ", "\n ", "\n ", "\n"])), placement === 'top-left' && topLeft(distance), placement === 'top-right' && topRight(distance), placement === 'bottom-left' && bottomLeft(distance), placement === 'bottom-right' && bottomRight(distance));
4850
- };
4868
+ _classCallCheck(this, BaseMeasureToolEditor);
4851
4869
 
4852
- var _templateObject$5, _templateObject2$4, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$1, _templateObject7$1, _templateObject8$1;
4853
- const mapControlBtnMixin = /*#__PURE__*/css(_templateObject$5 || (_templateObject$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 2rem;\n height: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: #fff;\n"])));
4854
- const ZoomInBtn = /*#__PURE__*/styled(Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4855
- ZoomInBtn.defaultProps = {
4856
- kind: "plus"
4857
- };
4858
- const ZoomOutBtn = /*#__PURE__*/styled(Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4859
- ZoomOutBtn.defaultProps = {
4860
- kind: "minus"
4861
- };
4862
- const SearchBtn = /*#__PURE__*/styled(Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4863
- SearchBtn.defaultProps = {
4864
- kind: "search"
4865
- }; // TODO not exists in fonts
4870
+ _this = _super.call(this, map, params);
4866
4871
 
4867
- const FullscreenBtn = /*#__PURE__*/styled(Icon)(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4868
- FullscreenBtn.defaultProps = {
4869
- kind: "maximize"
4870
- };
4871
- const MeasureBtn = /*#__PURE__*/styled(Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4872
- MeasureBtn.defaultProps = {
4873
- kind: "measure_length"
4874
- };
4875
- 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"])));
4876
- 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 => {
4877
- let {
4878
- vertical
4879
- } = _ref;
4880
- return vertical ? 'column' : 'row';
4881
- }, _ref2 => {
4882
- let {
4883
- placement
4884
- } = _ref2;
4885
- return placementMixin(placement);
4886
- }, MapControl, _ref3 => {
4887
- let {
4888
- vertical
4889
- } = _ref3;
4890
- return vertical ? '0.5rem' : '0';
4891
- }, _ref4 => {
4892
- let {
4893
- vertical
4894
- } = _ref4;
4895
- return vertical ? '0' : '0.5rem';
4896
- }, _ref5 => {
4897
- let {
4898
- vertical
4899
- } = _ref5;
4900
- return vertical ? 'column' : 'row';
4901
- });
4872
+ _this.measureResult = () => {
4873
+ const feature = _this.activeFeature;
4874
+ if (!feature) return null;
4875
+ const {
4876
+ rings,
4877
+ isEnclosed,
4878
+ crs
4879
+ } = feature;
4880
+ const pointsCount = rings[0].length;
4881
+ const position = rings[0][pointsCount - 1];
4882
+ const area$1 = area(rings, crs);
4883
+ const length$1 = length(rings, crs, isEnclosed);
4884
+ const content = isEnclosed ? _this.formatters.polygon(area$1, length$1) : _this.formatters.length(length$1);
4885
+ return {
4886
+ content,
4887
+ position
4888
+ };
4889
+ };
4902
4890
 
4903
- const Measure = () => {
4904
- return React.createElement(MapControl, null, React.createElement(MeasureBtn, {
4905
- onClick: () => {}
4906
- }));
4907
- };
4891
+ _this.removeFeature = () => {
4892
+ _this.fire('remove');
4893
+ };
4908
4894
 
4909
- const Search = () => {
4910
- return React.createElement(MapControl, null, React.createElement(SearchBtn, {
4911
- onClick: () => {}
4912
- }));
4913
- };
4895
+ _this.painter = painter;
4896
+ _this.renderLabelSymbol = params.renderLabelSymbol;
4897
+ _this.formatters = params.formatters || DEFAULT_FORMATTERS;
4914
4898
 
4915
- const Fullscreen = () => {
4916
- return React.createElement(MapControl, null, React.createElement(FullscreenBtn, {
4917
- onClick: () => {}
4918
- }));
4919
- };
4899
+ _this.on('change', _this.updateMeasureResult);
4920
4900
 
4921
- var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4;
4922
- const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
4923
- const MapLegendContainer = /*#__PURE__*/styled.div(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 16.5rem;\n height: 3.875rem;\n align-items: center;\n padding: 0.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1rem;\n width: 0.835rem;\n }\n"])));
4924
- const MapLegendHeader = /*#__PURE__*/styled(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
4925
- const MapLegendSection = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
4926
- const MapLegendValueDescr = /*#__PURE__*/styled.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0.5rem;\n font-size: 0.625rem;\n opacity: 0.65;\n"])));
4901
+ _this.on('edit', _this.updateMeasureResult);
4927
4902
 
4928
- const MAX_SIZE$2 = 100;
4929
- const MapLegendSymbol = _ref => {
4930
- let {
4931
- value,
4932
- parameter
4933
- } = _ref;
4934
- return React.createElement(LegendSymbol, {
4935
- key: value.title,
4936
- parameter: parameter,
4937
- parameterValue: value.parameterValue
4938
- }, symbol => React.createElement(Symbol, {
4939
- render: getMapLegendSymbolRenders,
4940
- symbol: symbol,
4941
- size: MAX_SIZE$2
4942
- }));
4943
- };
4903
+ return _this;
4904
+ }
4944
4905
 
4945
- const DEFAULT_FROM_TO = ['Выше', 'Ниже'];
4946
- const MapLegend = _ref => {
4947
- let {
4948
- layer,
4949
- config,
4950
- fromToTitle = DEFAULT_FROM_TO,
4951
- className
4952
- } = _ref;
4953
- const legend = useMapLegend(layer, config);
4906
+ _createClass(BaseMeasureToolEditor, [{
4907
+ key: "_activate",
4908
+ value: function _activate() {
4909
+ _get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
4954
4910
 
4955
- if (!legend) {
4956
- return null;
4957
- }
4911
+ this.addMeasureResultLabel();
4912
+ }
4913
+ }, {
4914
+ key: "addMeasureResultLabel",
4915
+ value: function addMeasureResultLabel() {
4916
+ const measureResult = this.measureResult();
4917
+ if (measureResult === null) return;
4918
+ const {
4919
+ content,
4920
+ position
4921
+ } = measureResult;
4922
+ this.measureResultLabel = new LabelFeature(position, {
4923
+ content,
4924
+ crs: this.map.crs,
4925
+ symbol: createLabelSymbol({
4926
+ onClose: this.removeFeature,
4927
+ renderLabel: this.renderLabelSymbol
4928
+ })
4929
+ });
4930
+ this._tempLayer && this._tempLayer.add(this.measureResultLabel);
4931
+ }
4932
+ }, {
4933
+ key: "updateMeasureResult",
4934
+ value: function updateMeasureResult() {
4935
+ if (this.measureResultLabel) {
4936
+ const measureResult = this.measureResult();
4937
+ if (measureResult === null) return;
4938
+ const {
4939
+ content,
4940
+ position
4941
+ } = measureResult;
4942
+ this.measureResultLabel.content = content;
4943
+ this.measureResultLabel.position = position;
4944
+ }
4945
+ }
4946
+ }]);
4958
4947
 
4959
- const {
4960
- symbol,
4961
- item
4962
- } = legend;
4963
- return React.createElement(LegendProvider, {
4964
- symbol: symbol
4965
- }, React.createElement(MapLegendControl, {
4966
- className: className
4967
- }, React.createElement(MapLegendContainer, null, React.createElement(MapLegendHeader, null, item.title), React.createElement(MapLegendSection, null, React.createElement(MapLegendValueDescr, null, fromToTitle[0]), item.values.map(value => React.createElement(MapLegendSymbol, {
4968
- key: value.title,
4969
- value: value,
4970
- parameter: item.parameter
4971
- })), React.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
4972
- };
4948
+ return BaseMeasureToolEditor;
4949
+ }(PolyEditor);
4973
4950
 
4974
4951
  let MeasureTool = /*#__PURE__*/function (_React$Component) {
4975
4952
  _inherits(MeasureTool, _React$Component);
@@ -5159,7 +5136,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
5159
5136
  }(React.Component);
5160
5137
 
5161
5138
  const _excluded$3 = ["isActive"];
5162
- const Measurer = _ref => {
5139
+ const Measurer = (_ref) => {
5163
5140
  let {
5164
5141
  isActive
5165
5142
  } = _ref,
@@ -5177,18 +5154,18 @@ const Measurer = _ref => {
5177
5154
 
5178
5155
  var _templateObject$7, _templateObject2$6, _templateObject3$6;
5179
5156
  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"])));
5180
- const ScaleRulerBlock = /*#__PURE__*/styled.div(_templateObject2$6 || (_templateObject2$6 = /*#__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 => {
5157
+ const ScaleRulerBlock = /*#__PURE__*/styled.div(_templateObject2$6 || (_templateObject2$6 = /*#__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) => {
5181
5158
  let {
5182
5159
  width
5183
5160
  } = _ref;
5184
5161
  return width + "px";
5185
5162
  });
5186
- const TextContainer = /*#__PURE__*/styled.div(_templateObject3$6 || (_templateObject3$6 = /*#__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 => {
5163
+ const TextContainer = /*#__PURE__*/styled.div(_templateObject3$6 || (_templateObject3$6 = /*#__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) => {
5187
5164
  let {
5188
5165
  alignEnd
5189
5166
  } = _ref2;
5190
5167
  return alignEnd ? 'flex-end' : 'center';
5191
- }, _ref3 => {
5168
+ }, (_ref3) => {
5192
5169
  let {
5193
5170
  width
5194
5171
  } = _ref3;
@@ -5213,7 +5190,7 @@ const ScaleRuler = () => {
5213
5190
  }, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
5214
5191
  };
5215
5192
 
5216
- const Zoom = _ref => {
5193
+ const Zoom = (_ref) => {
5217
5194
  let {
5218
5195
  children
5219
5196
  } = _ref;
@@ -5262,7 +5239,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
5262
5239
  return css(_templateObject9$1 || (_templateObject9$1 = _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));
5263
5240
  };
5264
5241
  const corner = /*#__PURE__*/css(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n &:before {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n }\n"])));
5265
- const TooltipComponent = /*#__PURE__*/styled.div(_templateObject11$1 || (_templateObject11$1 = /*#__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 => {
5242
+ const TooltipComponent = /*#__PURE__*/styled.div(_templateObject11$1 || (_templateObject11$1 = /*#__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) => {
5266
5243
  let {
5267
5244
  placement,
5268
5245
  distance = '0.5rem',
@@ -5270,7 +5247,7 @@ const TooltipComponent = /*#__PURE__*/styled.div(_templateObject11$1 || (_templa
5270
5247
  cornerSize = '0.25rem'
5271
5248
  } = _ref;
5272
5249
  return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
5273
- }, _ref2 => {
5250
+ }, (_ref2) => {
5274
5251
  let {
5275
5252
  withArrow
5276
5253
  } = _ref2;
@@ -5284,7 +5261,7 @@ const {
5284
5261
  Consumer
5285
5262
  } = /*#__PURE__*/createContext([]); // TODO I just cant read that
5286
5263
 
5287
- const Tooltip = _ref => {
5264
+ const Tooltip = (_ref) => {
5288
5265
  let {
5289
5266
  features = [],
5290
5267
  map,
@@ -5323,7 +5300,7 @@ const Noop = () => React.createElement("div", {
5323
5300
  }
5324
5301
  });
5325
5302
 
5326
- const DraggableMarker = _ref => {
5303
+ const DraggableMarker = (_ref) => {
5327
5304
  let {
5328
5305
  position,
5329
5306
  onChange,
@@ -5337,5 +5314,20 @@ const DraggableMarker = _ref => {
5337
5314
  return React.createElement(Fragment, null);
5338
5315
  };
5339
5316
 
5317
+ const polygonCircleFromPoint = (center, diameter) => {
5318
+ const coordinates = [];
5319
+ const radius = diameter / 2;
5320
+ const endAngle = Math.PI * 2;
5321
+ const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
5322
+ let start = 0;
5323
+ let end = endAngle;
5324
+
5325
+ for (let ang = start; ang < end; ang += step) {
5326
+ coordinates.push([Math.cos(ang) * radius + center[0], Math.sin(ang) * radius + center[1]]);
5327
+ }
5328
+
5329
+ return [coordinates];
5330
+ };
5331
+
5340
5332
  export { ArrowLineMiterRender, BaseMeasureToolCreator, BaseMeasureToolEditor, CRS_MAP, CardAttributes, CardHeader, CircleLineMiterRender, ClassificationCondition, ClassificationManager, ClusterLayer, 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, CloseIcon as EvergisCardCloseIcon, EvergisCardContainer, CurrentFeatureIndex as EvergisCardCurrentFeatureIndex, FeatureName as EvergisCardFeatureName, LayerName as EvergisCardLayerName, NextIcon as EvergisCardNextIcon, CardPagination as EvergisCardPagination, PaginationDescription as EvergisCardPaginationDescription, PrevIcon as EvergisCardPrevIcon, SimpleAttribute as EvergisCardSimpleValue, StickyHeader as EvergisCardStickyHeader, ValueLink as EvergisCardValueLink, ZoomIcon as EvergisCardZoomIcon, 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, MapLegendSection, 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, getLineMiterRender, getMapLegendSymbolRenders, getMapState, getParameterValue, getScale, getSymbolRenders, isArrowLineMiter, isCalculatedParameter, isCircleLineMiter, isCompositeSymbol, isDashedBrush, isFilledLineMitter, isHatchBrush, isImageSymbol, isLabelSymbol, isMaskedImageSymbol, isMiterExist, isParameterByAttribute, isParameterValueSimple, isParameterValueSymbol, isPatternBrush, isPointLabelSymbol, isPointSymbol, isPolygonHasHatchBrush, isPolygonHasPatternBrush, isPolygonLabelSymbol, isPolygonSymbol, isPolylineLabelSymbol, isPolylineLikePolygon, isPolylineSymbol, isPolylineSymbols, isRangeClass, isRasterSymbol, isSGisImageSymbol, isSGisPointSymbol, isSGisPolygonSymbol, isSGisPolylineSymbol, isScalablePolylineSymbol, isSimpleOffset, isSimplePolylineSymbol, isSimpleSymbol, isSizableSymbol, isSolidBrush, isSquareLineMiter, isSquareSymbol, isStaticImageSymbol, isStringParameterValue, isStrokeStyledSymbol, isStyle, isSymbolWithOffset, isTwoDimensionalSymbol, isUniqueClass, 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, useTooltip, useTooltipContext, useUpdate, useUpdateMapView };
5341
5333
  //# sourceMappingURL=react.esm.js.map