@evergis/react 2.0.97 → 2.0.99

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
@@ -3781,7 +3433,7 @@ function useMapWrapper() {
3781
3433
  return wrapperRef;
3782
3434
  }
3783
3435
 
3784
- const byScale = scale => _ref => {
3436
+ const byScale = scale => (_ref) => {
3785
3437
  let {
3786
3438
  zIndex
3787
3439
  } = _ref;
@@ -3980,7 +3632,7 @@ const useTooltip = function useTooltip(zIndex) {
3980
3632
 
3981
3633
  return reset;
3982
3634
  }, [reset, map, layer, zIndex]);
3983
- const onSetLabelFeature = useCallback(_ref => {
3635
+ const onSetLabelFeature = useCallback((_ref) => {
3984
3636
  let {
3985
3637
  point,
3986
3638
  position,
@@ -4144,7 +3796,7 @@ function useClusterLayer(_ref) {
4144
3796
  }
4145
3797
 
4146
3798
  const INIT_FEATURES = [];
4147
- const useEvergisSelect = _ref => {
3799
+ const useEvergisSelect = (_ref) => {
4148
3800
  let {
4149
3801
  onPick,
4150
3802
  onFeatures
@@ -4177,7 +3829,7 @@ function none() {
4177
3829
  return;
4178
3830
  }
4179
3831
 
4180
- const useDraggableMarker = _ref => {
3832
+ const useDraggableMarker = (_ref) => {
4181
3833
  let {
4182
3834
  position,
4183
3835
  onChange,
@@ -4293,7 +3945,7 @@ const useDebouncedCallback = interval => {
4293
3945
  }, interval), [interval]);
4294
3946
  };
4295
3947
 
4296
- const Symbol = _ref => {
3948
+ const Symbol = (_ref) => {
4297
3949
  let {
4298
3950
  symbol,
4299
3951
  size,
@@ -4314,7 +3966,7 @@ const Symbol = _ref => {
4314
3966
  };
4315
3967
 
4316
3968
  var _templateObject;
4317
- const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), _ref => {
3969
+ const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), (_ref) => {
4318
3970
  let {
4319
3971
  geometryType,
4320
3972
  icons
@@ -4323,7 +3975,7 @@ const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject
4323
3975
  });
4324
3976
 
4325
3977
  const MAX_SIZE = 32;
4326
- const StyleSymbol = _ref => {
3978
+ const StyleSymbol = (_ref) => {
4327
3979
  let {
4328
3980
  symbol,
4329
3981
  size = MAX_SIZE,
@@ -4368,7 +4020,7 @@ const CloseIcon = /*#__PURE__*/styled(Icon)(_templateObject20 || (_templateObjec
4368
4020
  const PrevIcon = /*#__PURE__*/styled(Icon)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
4369
4021
  const NextIcon = /*#__PURE__*/styled(Icon)(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
4370
4022
 
4371
- const MailValue = _ref => {
4023
+ const MailValue = (_ref) => {
4372
4024
  let {
4373
4025
  mail
4374
4026
  } = _ref;
@@ -4379,7 +4031,7 @@ const MailValue = _ref => {
4379
4031
  }, mail);
4380
4032
  };
4381
4033
 
4382
- const PhoneValue = _ref => {
4034
+ const PhoneValue = (_ref) => {
4383
4035
  let {
4384
4036
  phone
4385
4037
  } = _ref;
@@ -4390,7 +4042,7 @@ const PhoneValue = _ref => {
4390
4042
  }, phone);
4391
4043
  };
4392
4044
 
4393
- const UrlValue = _ref => {
4045
+ const UrlValue = (_ref) => {
4394
4046
  let {
4395
4047
  url
4396
4048
  } = _ref;
@@ -4401,7 +4053,7 @@ const UrlValue = _ref => {
4401
4053
  }, url);
4402
4054
  };
4403
4055
 
4404
- const AttributeValue = _ref => {
4056
+ const AttributeValue = (_ref) => {
4405
4057
  let {
4406
4058
  attribute
4407
4059
  } = _ref;
@@ -4415,29 +4067,29 @@ const AttributeValue = _ref => {
4415
4067
  if (attributeValue.type === 2
4416
4068
  /* Url */
4417
4069
  ) {
4418
- return React.createElement(UrlValue, {
4419
- key: key,
4420
- url: punycodeDecode(value)
4421
- });
4422
- }
4070
+ return React.createElement(UrlValue, {
4071
+ key: key,
4072
+ url: punycodeDecode(value)
4073
+ });
4074
+ }
4423
4075
 
4424
4076
  if (attributeValue.type === 3
4425
4077
  /* Mail */
4426
4078
  ) {
4427
- return React.createElement(MailValue, {
4428
- key: key,
4429
- mail: value
4430
- });
4431
- }
4079
+ return React.createElement(MailValue, {
4080
+ key: key,
4081
+ mail: value
4082
+ });
4083
+ }
4432
4084
 
4433
4085
  if (attributeValue.type === 1
4434
4086
  /* Phone */
4435
4087
  ) {
4436
- return React.createElement(PhoneValue, {
4437
- key: key,
4438
- phone: value
4439
- });
4440
- }
4088
+ return React.createElement(PhoneValue, {
4089
+ key: key,
4090
+ phone: value
4091
+ });
4092
+ }
4441
4093
 
4442
4094
  return React.createElement(SimpleAttribute, {
4443
4095
  key: value
@@ -4453,7 +4105,7 @@ function punycodeDecode(domains) {
4453
4105
  }
4454
4106
  }
4455
4107
 
4456
- const EvergisCardAttribute = _ref => {
4108
+ const EvergisCardAttribute = (_ref) => {
4457
4109
  let {
4458
4110
  attribute,
4459
4111
  className
@@ -4465,7 +4117,7 @@ const EvergisCardAttribute = _ref => {
4465
4117
  }));
4466
4118
  };
4467
4119
 
4468
- const StyledCard = _ref => {
4120
+ const StyledCard = (_ref) => {
4469
4121
  let {
4470
4122
  features = [],
4471
4123
  className,
@@ -4516,7 +4168,7 @@ const StyledCard = _ref => {
4516
4168
  };
4517
4169
 
4518
4170
  const _excluded$1 = ["renderCard", "className", "children"];
4519
- const EvergisCard = _ref => {
4171
+ const EvergisCard = (_ref) => {
4520
4172
  let {
4521
4173
  renderCard,
4522
4174
  className,
@@ -4568,7 +4220,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
4568
4220
 
4569
4221
  const useSGisFeatures = (features, currentIndex) => useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
4570
4222
 
4571
- const EvergisSelectLayer = _ref => {
4223
+ const EvergisSelectLayer = (_ref) => {
4572
4224
  let {
4573
4225
  features,
4574
4226
  zIndex,
@@ -4613,7 +4265,7 @@ const TileLayer = props => {
4613
4265
  };
4614
4266
 
4615
4267
  const defaultZIndex = 200;
4616
- const EvergisSelect = _ref => {
4268
+ const EvergisSelect = (_ref) => {
4617
4269
  let {
4618
4270
  onPick,
4619
4271
  className,
@@ -4648,7 +4300,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled.p(_templateObject3$1 || (_template
4648
4300
  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);
4649
4301
  const LegendSectionHeader = /*#__PURE__*/styled.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])));
4650
4302
 
4651
- const LegendSection = _ref => {
4303
+ const LegendSection = (_ref) => {
4652
4304
  let {
4653
4305
  item,
4654
4306
  renderLegendTitle,
@@ -4665,7 +4317,7 @@ SearchPrefix.defaultProps = {
4665
4317
  kind: "search"
4666
4318
  };
4667
4319
 
4668
- const SearchInput = _ref => {
4320
+ const SearchInput = (_ref) => {
4669
4321
  let {
4670
4322
  onChange
4671
4323
  } = _ref;
@@ -4674,7 +4326,7 @@ const SearchInput = _ref => {
4674
4326
  }));
4675
4327
  };
4676
4328
 
4677
- const LegendSymbol = _ref => {
4329
+ const LegendSymbol = (_ref) => {
4678
4330
  let {
4679
4331
  parameter,
4680
4332
  parameterValue,
@@ -4692,7 +4344,7 @@ const LegendSymbol = _ref => {
4692
4344
  return React.createElement(React.Fragment, null, children(symbol));
4693
4345
  };
4694
4346
 
4695
- const LegendValue = _ref => {
4347
+ const LegendValue = (_ref) => {
4696
4348
  let {
4697
4349
  value,
4698
4350
  parameter,
@@ -4714,7 +4366,7 @@ const getNumberParam = (parameterValue, param) => {
4714
4366
  return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
4715
4367
  };
4716
4368
 
4717
- const getSymbolSize = _ref => {
4369
+ const getSymbolSize = (_ref) => {
4718
4370
  let {
4719
4371
  parameterValue,
4720
4372
  maxSize
@@ -4739,7 +4391,7 @@ const getSymbolSize = _ref => {
4739
4391
  }
4740
4392
  };
4741
4393
 
4742
- const Legend = _ref => {
4394
+ const Legend = (_ref) => {
4743
4395
  let {
4744
4396
  layer,
4745
4397
  children,
@@ -4782,7 +4434,7 @@ const Legend = _ref => {
4782
4434
  })))));
4783
4435
  };
4784
4436
 
4785
- const Map = _ref => {
4437
+ const Map = (_ref) => {
4786
4438
  let {
4787
4439
  className,
4788
4440
  position,
@@ -4804,163 +4456,488 @@ const Map = _ref => {
4804
4456
  })) {
4805
4457
  onBboxChange(state);
4806
4458
  }
4807
- }, [map, onBboxChange, position, resolution]);
4808
- useUpdateMapView({
4809
- position,
4810
- resolution
4811
- });
4812
- useMaxMinScale(minScale, maxScale, position, resolution);
4813
- useMapBboxChange(handleBboxChange);
4814
- return React.createElement("div", {
4815
- className: className,
4816
- ref: wrapperRef,
4817
- style: style
4818
- }, children);
4819
- };
4820
-
4821
- var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
4822
-
4823
- const topLeft = distance => css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
4459
+ }, [map, onBboxChange, position, resolution]);
4460
+ useUpdateMapView({
4461
+ position,
4462
+ resolution
4463
+ });
4464
+ useMaxMinScale(minScale, maxScale, position, resolution);
4465
+ useMapBboxChange(handleBboxChange);
4466
+ return React.createElement("div", {
4467
+ className: className,
4468
+ ref: wrapperRef,
4469
+ style: style
4470
+ }, children);
4471
+ };
4472
+
4473
+ var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
4474
+
4475
+ const topLeft = distance => css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
4476
+
4477
+ const topRight = distance => css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n top: ", ";\n right: ", ";\n"])), distance, distance);
4478
+
4479
+ const bottomLeft = distance => css(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n left: ", ";\n"])), distance, distance);
4480
+
4481
+ const bottomRight = distance => css(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n right: ", ";\n"])), distance, distance);
4482
+
4483
+ const placementMixin = function placementMixin(placement, distance) {
4484
+ if (placement === void 0) {
4485
+ placement = 'bottom-left';
4486
+ }
4487
+
4488
+ if (distance === void 0) {
4489
+ distance = '1rem';
4490
+ }
4491
+
4492
+ 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));
4493
+ };
4494
+
4495
+ var _templateObject$5, _templateObject2$4, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$1, _templateObject7$1, _templateObject8$1;
4496
+ 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"])));
4497
+ const ZoomInBtn = /*#__PURE__*/styled(Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4498
+ ZoomInBtn.defaultProps = {
4499
+ kind: "plus"
4500
+ };
4501
+ const ZoomOutBtn = /*#__PURE__*/styled(Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4502
+ ZoomOutBtn.defaultProps = {
4503
+ kind: "minus"
4504
+ };
4505
+ const SearchBtn = /*#__PURE__*/styled(Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4506
+ SearchBtn.defaultProps = {
4507
+ kind: "search"
4508
+ }; // TODO not exists in fonts
4509
+
4510
+ const FullscreenBtn = /*#__PURE__*/styled(Icon)(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4511
+ FullscreenBtn.defaultProps = {
4512
+ kind: "maximize"
4513
+ };
4514
+ const MeasureBtn = /*#__PURE__*/styled(Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4515
+ MeasureBtn.defaultProps = {
4516
+ kind: "measure_length"
4517
+ };
4518
+ 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"])));
4519
+ 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) => {
4520
+ let {
4521
+ vertical
4522
+ } = _ref;
4523
+ return vertical ? 'column' : 'row';
4524
+ }, (_ref2) => {
4525
+ let {
4526
+ placement
4527
+ } = _ref2;
4528
+ return placementMixin(placement);
4529
+ }, MapControl, (_ref3) => {
4530
+ let {
4531
+ vertical
4532
+ } = _ref3;
4533
+ return vertical ? '0.5rem' : '0';
4534
+ }, (_ref4) => {
4535
+ let {
4536
+ vertical
4537
+ } = _ref4;
4538
+ return vertical ? '0' : '0.5rem';
4539
+ }, (_ref5) => {
4540
+ let {
4541
+ vertical
4542
+ } = _ref5;
4543
+ return vertical ? 'column' : 'row';
4544
+ });
4545
+
4546
+ const Measure = () => {
4547
+ return React.createElement(MapControl, null, React.createElement(MeasureBtn, {
4548
+ onClick: () => {}
4549
+ }));
4550
+ };
4551
+
4552
+ const Search = () => {
4553
+ return React.createElement(MapControl, null, React.createElement(SearchBtn, {
4554
+ onClick: () => {}
4555
+ }));
4556
+ };
4557
+
4558
+ const Fullscreen = () => {
4559
+ return React.createElement(MapControl, null, React.createElement(FullscreenBtn, {
4560
+ onClick: () => {}
4561
+ }));
4562
+ };
4563
+
4564
+ var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4;
4565
+ const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
4566
+ 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"])));
4567
+ const MapLegendHeader = /*#__PURE__*/styled(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
4568
+ const MapLegendSection = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
4569
+ 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"])));
4570
+
4571
+ const MAX_SIZE$2 = 100;
4572
+ const MapLegendSymbol = (_ref) => {
4573
+ let {
4574
+ value,
4575
+ parameter
4576
+ } = _ref;
4577
+ return React.createElement(LegendSymbol, {
4578
+ key: value.title,
4579
+ parameter: parameter,
4580
+ parameterValue: value.parameterValue
4581
+ }, symbol => React.createElement(Symbol, {
4582
+ render: getMapLegendSymbolRenders,
4583
+ symbol: symbol,
4584
+ size: MAX_SIZE$2
4585
+ }));
4586
+ };
4587
+
4588
+ const DEFAULT_FROM_TO = ['Выше', 'Ниже'];
4589
+ const MapLegend = (_ref) => {
4590
+ let {
4591
+ layer,
4592
+ config,
4593
+ fromToTitle = DEFAULT_FROM_TO,
4594
+ className
4595
+ } = _ref;
4596
+ const legend = useMapLegend(layer, config);
4597
+
4598
+ if (!legend) {
4599
+ return null;
4600
+ }
4601
+
4602
+ const {
4603
+ symbol,
4604
+ item
4605
+ } = legend;
4606
+ return React.createElement(LegendProvider, {
4607
+ symbol: symbol
4608
+ }, React.createElement(MapLegendControl, {
4609
+ className: className
4610
+ }, 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, {
4611
+ key: value.title,
4612
+ value: value,
4613
+ parameter: item.parameter
4614
+ })), React.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
4615
+ };
4616
+
4617
+ const DEFAULT_FORMATTERS = {
4618
+ polygon: formatPolygonMeasure,
4619
+ length: formatLength
4620
+ };
4621
+
4622
+ const COORD_FRACTION = 6;
4623
+ const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
4624
+ let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
4625
+ _inherits(BaseMeasureToolCreator, _PolylineControl);
4626
+
4627
+ var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
4628
+
4629
+ function BaseMeasureToolCreator(map, painter, params) {
4630
+ var _this;
4631
+
4632
+ _classCallCheck(this, BaseMeasureToolCreator);
4633
+
4634
+ _this = _super.call(this, map, params);
4635
+
4636
+ _this.cancel = () => {
4637
+ _this.fire('cancel');
4638
+ };
4639
+
4640
+ _this.painter = painter;
4641
+ _this.renderLabelSymbol = params.renderLabelSymbol;
4642
+ _this.formatters = params.formatters || DEFAULT_FORMATTERS;
4643
+ _this.areaSymbol = params.areaSymbol;
4644
+
4645
+ _this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
4646
+
4647
+
4648
+ _this.on('change', _this.updateDistance);
4649
+
4650
+ return _this;
4651
+ }
4652
+
4653
+ _createClass(BaseMeasureToolCreator, [{
4654
+ key: "_handleMousemove",
4655
+ value: function _handleMousemove(event) {
4656
+ _get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_handleMousemove", this).call(this, event);
4657
+
4658
+ this.drawPointOnMouseMove(event);
4659
+ }
4660
+ }, {
4661
+ key: "_activate",
4662
+ value: function _activate() {
4663
+ _get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_activate", this).call(this);
4664
+
4665
+ this.addTempLabel();
4666
+ this.setCursor('pointer');
4667
+ }
4668
+ }, {
4669
+ key: "_deactivate",
4670
+ value: function _deactivate() {
4671
+ _get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_deactivate", this).call(this);
4672
+
4673
+ this.removeCoordLabel();
4674
+ this.removeTempLabel();
4675
+ this.removeMeasureLabel();
4676
+ this.removeTempPolygon();
4677
+ this.setCursor('default');
4678
+ }
4679
+ }, {
4680
+ key: "handlePointAdd",
4681
+ value: function handlePointAdd() {
4682
+ const feature = this.activeFeature;
4683
+ if (!feature) return;
4684
+ const {
4685
+ rings,
4686
+ crs
4687
+ } = feature;
4688
+
4689
+ if (isPolylineLikePolygon(rings, this.map.resolution)) {
4690
+ this.finishDrawing();
4691
+ this.fire(new DrawingFinishEvent(feature, new MouseEvent('mouseup')));
4692
+ return;
4693
+ }
4694
+
4695
+ if (rings[0].length === 2) {
4696
+ const projection = crs.projectionTo(geo);
4697
+ const point = rings[0][0];
4698
+ if (!projection) return;
4699
+ const [lat, long] = projection(point);
4700
+ this.removeTempLabel();
4701
+ this.addMeasureResultLabel();
4702
+ this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
4703
+ } else {
4704
+ this.removeCoordLabel();
4705
+ }
4706
+ }
4707
+ }, {
4708
+ key: "polygonPreview",
4709
+ value: function polygonPreview() {
4710
+ if (this.tempPolygon) {
4711
+ this._tempLayer && this._tempLayer.remove(this.tempPolygon);
4712
+ }
4713
+
4714
+ const feature = this.activeFeature;
4715
+ if (!feature) return;
4716
+ const {
4717
+ rings,
4718
+ crs
4719
+ } = feature;
4720
+ const polygonRings = [...rings[0]];
4721
+ polygonRings.shift();
4722
+ this.tempPolygon = new Polygon(polygonRings, {
4723
+ crs
4724
+ });
4725
+ this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
4726
+ this.activeFeature && this.activeFeature.hide();
4727
+ this._tempLayer && this._tempLayer.add(this.tempPolygon);
4728
+ }
4729
+ }, {
4730
+ key: "removeTempPolygon",
4731
+ value: function removeTempPolygon() {
4732
+ if (this.tempPolygon) {
4733
+ this._tempLayer && this._tempLayer.remove(this.tempPolygon);
4734
+ delete this.tempPolygon;
4735
+ }
4736
+ }
4737
+ }, {
4738
+ key: "updateDistance",
4739
+ value: function updateDistance(event) {
4740
+ const feature = this.activeFeature;
4741
+ const {
4742
+ ringIndex,
4743
+ pointIndex
4744
+ } = event;
4745
+ if (!feature || ringIndex === null || pointIndex === null) return;
4746
+ const {
4747
+ rings,
4748
+ crs
4749
+ } = feature;
4750
+ const position = rings[ringIndex][pointIndex];
4751
+ const length$1 = length(rings, crs);
4752
+ let content = this.formatters.length(length$1);
4753
+
4754
+ if (isPolylineLikePolygon(rings, this.map.resolution)) {
4755
+ this.polygonPreview();
4756
+ const area$1 = area(rings, crs);
4757
+ content = this.formatters.polygon(area$1, length$1);
4758
+ } else if (this.tempPolygon) {
4759
+ feature.show();
4760
+ this.removeTempPolygon();
4761
+ }
4762
+
4763
+ if (this.measureResultLabel) {
4764
+ this.measureResultLabel.position = position;
4765
+ this.measureResultLabel.content = content;
4766
+ }
4767
+ }
4768
+ }, {
4769
+ key: "addTempLabel",
4770
+ value: function addTempLabel() {
4771
+ this.tempLabel = new LabelFeature(DEFAULT_LABEL_POSITION, {
4772
+ content: 'Нажмите на карту, чтобы начать измерение',
4773
+ crs: this.map.crs,
4774
+ symbol: createLabelSymbol({
4775
+ renderLabel: this.renderLabelSymbol
4776
+ })
4777
+ });
4778
+ this._tempLayer && this._tempLayer.add(this.tempLabel);
4779
+ }
4780
+ }, {
4781
+ key: "addCoordLabel",
4782
+ value: function addCoordLabel(content, position) {
4783
+ this.coordLabel = new LabelFeature(position, {
4784
+ content,
4785
+ crs: this.map.crs,
4786
+ symbol: createLabelSymbol({
4787
+ renderLabel: this.renderLabelSymbol,
4788
+ onClose: this.cancel
4789
+ })
4790
+ });
4791
+ this._tempLayer && this.coordLabel && this._tempLayer.add(this.coordLabel);
4792
+ }
4793
+ }, {
4794
+ key: "addMeasureResultLabel",
4795
+ value: function addMeasureResultLabel() {
4796
+ this.measureResultLabel = new LabelFeature(DEFAULT_LABEL_POSITION, {
4797
+ crs: this.map.crs,
4798
+ symbol: createLabelSymbol({
4799
+ renderLabel: this.renderLabelSymbol
4800
+ })
4801
+ });
4802
+ this._tempLayer && this.measureResultLabel && this._tempLayer.add(this.measureResultLabel);
4803
+ }
4804
+ }, {
4805
+ key: "removeTempLabel",
4806
+ value: function removeTempLabel() {
4807
+ if (this.tempLabel) {
4808
+ this._tempLayer && this._tempLayer.remove(this.tempLabel);
4809
+ delete this.tempLabel;
4810
+ }
4811
+ }
4812
+ }, {
4813
+ key: "removeCoordLabel",
4814
+ value: function removeCoordLabel() {
4815
+ if (this.coordLabel) {
4816
+ this._tempLayer && this._tempLayer.remove(this.coordLabel);
4817
+ delete this.coordLabel;
4818
+ }
4819
+ }
4820
+ }, {
4821
+ key: "removeMeasureLabel",
4822
+ value: function removeMeasureLabel() {
4823
+ if (this.measureResultLabel) {
4824
+ this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
4825
+ delete this.measureResultLabel;
4826
+ }
4827
+ }
4828
+ }, {
4829
+ key: "drawPointOnMouseMove",
4830
+ value: function drawPointOnMouseMove(event) {
4831
+ if (this.tempLabel) {
4832
+ this.tempLabel.position = event.point.position;
4833
+ }
4834
+ }
4835
+ }, {
4836
+ key: "setCursor",
4837
+ value: function setCursor(cursor) {
4838
+ const {
4839
+ wrapper
4840
+ } = this.painter;
4824
4841
 
4825
- const topRight = distance => css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n top: ", ";\n right: ", ";\n"])), distance, distance);
4842
+ if (wrapper && typeof wrapper !== 'string') {
4843
+ wrapper.style.cursor = cursor;
4844
+ }
4845
+ }
4846
+ }]);
4826
4847
 
4827
- const bottomLeft = distance => css(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n left: ", ";\n"])), distance, distance);
4848
+ return BaseMeasureToolCreator;
4849
+ }(PolylineControl);
4828
4850
 
4829
- const bottomRight = distance => css(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n right: ", ";\n"])), distance, distance);
4851
+ let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
4852
+ _inherits(BaseMeasureToolEditor, _PolyEditor);
4830
4853
 
4831
- const placementMixin = function placementMixin(placement, distance) {
4832
- if (placement === void 0) {
4833
- placement = 'bottom-left';
4834
- }
4854
+ var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
4835
4855
 
4836
- if (distance === void 0) {
4837
- distance = '1rem';
4838
- }
4856
+ function BaseMeasureToolEditor(map, painter, params) {
4857
+ var _this;
4839
4858
 
4840
- 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));
4841
- };
4859
+ _classCallCheck(this, BaseMeasureToolEditor);
4842
4860
 
4843
- var _templateObject$5, _templateObject2$4, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$1, _templateObject7$1, _templateObject8$1;
4844
- 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"])));
4845
- const ZoomInBtn = /*#__PURE__*/styled(Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4846
- ZoomInBtn.defaultProps = {
4847
- kind: "plus"
4848
- };
4849
- const ZoomOutBtn = /*#__PURE__*/styled(Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4850
- ZoomOutBtn.defaultProps = {
4851
- kind: "minus"
4852
- };
4853
- const SearchBtn = /*#__PURE__*/styled(Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4854
- SearchBtn.defaultProps = {
4855
- kind: "search"
4856
- }; // TODO not exists in fonts
4861
+ _this = _super.call(this, map, params);
4857
4862
 
4858
- const FullscreenBtn = /*#__PURE__*/styled(Icon)(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4859
- FullscreenBtn.defaultProps = {
4860
- kind: "maximize"
4861
- };
4862
- const MeasureBtn = /*#__PURE__*/styled(Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
4863
- MeasureBtn.defaultProps = {
4864
- kind: "measure_length"
4865
- };
4866
- 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"])));
4867
- 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 => {
4868
- let {
4869
- vertical
4870
- } = _ref;
4871
- return vertical ? 'column' : 'row';
4872
- }, _ref2 => {
4873
- let {
4874
- placement
4875
- } = _ref2;
4876
- return placementMixin(placement);
4877
- }, MapControl, _ref3 => {
4878
- let {
4879
- vertical
4880
- } = _ref3;
4881
- return vertical ? '0.5rem' : '0';
4882
- }, _ref4 => {
4883
- let {
4884
- vertical
4885
- } = _ref4;
4886
- return vertical ? '0' : '0.5rem';
4887
- }, _ref5 => {
4888
- let {
4889
- vertical
4890
- } = _ref5;
4891
- return vertical ? 'column' : 'row';
4892
- });
4863
+ _this.measureResult = () => {
4864
+ const feature = _this.activeFeature;
4865
+ if (!feature) return null;
4866
+ const {
4867
+ rings,
4868
+ isEnclosed,
4869
+ crs
4870
+ } = feature;
4871
+ const pointsCount = rings[0].length;
4872
+ const position = rings[0][pointsCount - 1];
4873
+ const area$1 = area(rings, crs);
4874
+ const length$1 = length(rings, crs, isEnclosed);
4875
+ const content = isEnclosed ? _this.formatters.polygon(area$1, length$1) : _this.formatters.length(length$1);
4876
+ return {
4877
+ content,
4878
+ position
4879
+ };
4880
+ };
4893
4881
 
4894
- const Measure = () => {
4895
- return React.createElement(MapControl, null, React.createElement(MeasureBtn, {
4896
- onClick: () => {}
4897
- }));
4898
- };
4882
+ _this.removeFeature = () => {
4883
+ _this.fire('remove');
4884
+ };
4899
4885
 
4900
- const Search = () => {
4901
- return React.createElement(MapControl, null, React.createElement(SearchBtn, {
4902
- onClick: () => {}
4903
- }));
4904
- };
4886
+ _this.painter = painter;
4887
+ _this.renderLabelSymbol = params.renderLabelSymbol;
4888
+ _this.formatters = params.formatters || DEFAULT_FORMATTERS;
4905
4889
 
4906
- const Fullscreen = () => {
4907
- return React.createElement(MapControl, null, React.createElement(FullscreenBtn, {
4908
- onClick: () => {}
4909
- }));
4910
- };
4890
+ _this.on('change', _this.updateMeasureResult);
4911
4891
 
4912
- var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4;
4913
- const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
4914
- 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"])));
4915
- const MapLegendHeader = /*#__PURE__*/styled(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
4916
- const MapLegendSection = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
4917
- 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"])));
4892
+ _this.on('edit', _this.updateMeasureResult);
4918
4893
 
4919
- const MAX_SIZE$2 = 100;
4920
- const MapLegendSymbol = _ref => {
4921
- let {
4922
- value,
4923
- parameter
4924
- } = _ref;
4925
- return React.createElement(LegendSymbol, {
4926
- key: value.title,
4927
- parameter: parameter,
4928
- parameterValue: value.parameterValue
4929
- }, symbol => React.createElement(Symbol, {
4930
- render: getMapLegendSymbolRenders,
4931
- symbol: symbol,
4932
- size: MAX_SIZE$2
4933
- }));
4934
- };
4894
+ return _this;
4895
+ }
4935
4896
 
4936
- const DEFAULT_FROM_TO = ['Выше', 'Ниже'];
4937
- const MapLegend = _ref => {
4938
- let {
4939
- layer,
4940
- config,
4941
- fromToTitle = DEFAULT_FROM_TO,
4942
- className
4943
- } = _ref;
4944
- const legend = useMapLegend(layer, config);
4897
+ _createClass(BaseMeasureToolEditor, [{
4898
+ key: "_activate",
4899
+ value: function _activate() {
4900
+ _get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
4945
4901
 
4946
- if (!legend) {
4947
- return null;
4948
- }
4902
+ this.addMeasureResultLabel();
4903
+ }
4904
+ }, {
4905
+ key: "addMeasureResultLabel",
4906
+ value: function addMeasureResultLabel() {
4907
+ const measureResult = this.measureResult();
4908
+ if (measureResult === null) return;
4909
+ const {
4910
+ content,
4911
+ position
4912
+ } = measureResult;
4913
+ this.measureResultLabel = new LabelFeature(position, {
4914
+ content,
4915
+ crs: this.map.crs,
4916
+ symbol: createLabelSymbol({
4917
+ onClose: this.removeFeature,
4918
+ renderLabel: this.renderLabelSymbol
4919
+ })
4920
+ });
4921
+ this._tempLayer && this._tempLayer.add(this.measureResultLabel);
4922
+ }
4923
+ }, {
4924
+ key: "updateMeasureResult",
4925
+ value: function updateMeasureResult() {
4926
+ if (this.measureResultLabel) {
4927
+ const measureResult = this.measureResult();
4928
+ if (measureResult === null) return;
4929
+ const {
4930
+ content,
4931
+ position
4932
+ } = measureResult;
4933
+ this.measureResultLabel.content = content;
4934
+ this.measureResultLabel.position = position;
4935
+ }
4936
+ }
4937
+ }]);
4949
4938
 
4950
- const {
4951
- symbol,
4952
- item
4953
- } = legend;
4954
- return React.createElement(LegendProvider, {
4955
- symbol: symbol
4956
- }, React.createElement(MapLegendControl, {
4957
- className: className
4958
- }, 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, {
4959
- key: value.title,
4960
- value: value,
4961
- parameter: item.parameter
4962
- })), React.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
4963
- };
4939
+ return BaseMeasureToolEditor;
4940
+ }(PolyEditor);
4964
4941
 
4965
4942
  let MeasureTool = /*#__PURE__*/function (_React$Component) {
4966
4943
  _inherits(MeasureTool, _React$Component);
@@ -5150,7 +5127,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
5150
5127
  }(React.Component);
5151
5128
 
5152
5129
  const _excluded$3 = ["isActive"];
5153
- const Measurer = _ref => {
5130
+ const Measurer = (_ref) => {
5154
5131
  let {
5155
5132
  isActive
5156
5133
  } = _ref,
@@ -5168,18 +5145,18 @@ const Measurer = _ref => {
5168
5145
 
5169
5146
  var _templateObject$7, _templateObject2$6, _templateObject3$6;
5170
5147
  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"])));
5171
- 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 => {
5148
+ 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) => {
5172
5149
  let {
5173
5150
  width
5174
5151
  } = _ref;
5175
5152
  return width + "px";
5176
5153
  });
5177
- 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 => {
5154
+ 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) => {
5178
5155
  let {
5179
5156
  alignEnd
5180
5157
  } = _ref2;
5181
5158
  return alignEnd ? 'flex-end' : 'center';
5182
- }, _ref3 => {
5159
+ }, (_ref3) => {
5183
5160
  let {
5184
5161
  width
5185
5162
  } = _ref3;
@@ -5204,7 +5181,7 @@ const ScaleRuler = () => {
5204
5181
  }, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
5205
5182
  };
5206
5183
 
5207
- const Zoom = _ref => {
5184
+ const Zoom = (_ref) => {
5208
5185
  let {
5209
5186
  children
5210
5187
  } = _ref;
@@ -5253,7 +5230,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
5253
5230
  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));
5254
5231
  };
5255
5232
  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"])));
5256
- 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 => {
5233
+ 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) => {
5257
5234
  let {
5258
5235
  placement,
5259
5236
  distance = '0.5rem',
@@ -5261,7 +5238,7 @@ const TooltipComponent = /*#__PURE__*/styled.div(_templateObject11$1 || (_templa
5261
5238
  cornerSize = '0.25rem'
5262
5239
  } = _ref;
5263
5240
  return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
5264
- }, _ref2 => {
5241
+ }, (_ref2) => {
5265
5242
  let {
5266
5243
  withArrow
5267
5244
  } = _ref2;
@@ -5275,7 +5252,7 @@ const {
5275
5252
  Consumer
5276
5253
  } = /*#__PURE__*/createContext([]); // TODO I just cant read that
5277
5254
 
5278
- const Tooltip = _ref => {
5255
+ const Tooltip = (_ref) => {
5279
5256
  let {
5280
5257
  features = [],
5281
5258
  map,
@@ -5314,7 +5291,7 @@ const Noop = () => React.createElement("div", {
5314
5291
  }
5315
5292
  });
5316
5293
 
5317
- const DraggableMarker = _ref => {
5294
+ const DraggableMarker = (_ref) => {
5318
5295
  let {
5319
5296
  position,
5320
5297
  onChange,
@@ -5328,5 +5305,20 @@ const DraggableMarker = _ref => {
5328
5305
  return React.createElement(Fragment, null);
5329
5306
  };
5330
5307
 
5308
+ const polygonCircleFromPoint = (center, diameter) => {
5309
+ const coordinates = [];
5310
+ const radius = diameter / 2;
5311
+ const endAngle = Math.PI * 2;
5312
+ const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
5313
+ let start = 0;
5314
+ let end = endAngle;
5315
+
5316
+ for (let ang = start; ang < end; ang += step) {
5317
+ coordinates.push([Math.cos(ang) * radius + center[0], Math.sin(ang) * radius + center[1]]);
5318
+ }
5319
+
5320
+ return [coordinates];
5321
+ };
5322
+
5331
5323
  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 };
5332
5324
  //# sourceMappingURL=react.esm.js.map