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