@evergis/react 2.0.152 → 2.0.153
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/react.cjs.development.js +1705 -1713
- 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 +1706 -1714
- 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,1677 +1580,1325 @@ 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
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
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
|
+
}
|
|
1957
1938
|
|
|
1958
|
-
let
|
|
1959
|
-
_inherits(
|
|
1939
|
+
let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
|
|
1940
|
+
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
1960
1941
|
|
|
1961
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
1942
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
|
|
1962
1943
|
|
|
1963
|
-
|
|
1964
|
-
|
|
1944
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
1945
|
+
function ShadowedPointSymbol(options) {
|
|
1946
|
+
_classCallCheck(this, ShadowedPointSymbol);
|
|
1965
1947
|
|
|
1966
|
-
return _super.
|
|
1948
|
+
return _super.call(this, options);
|
|
1967
1949
|
}
|
|
1968
1950
|
|
|
1969
|
-
_createClass(
|
|
1970
|
-
key: "
|
|
1971
|
-
|
|
1972
|
-
|
|
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];
|
|
1973
1962
|
}
|
|
1974
1963
|
}, {
|
|
1975
|
-
key: "
|
|
1976
|
-
value: function
|
|
1977
|
-
|
|
1978
|
-
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1964
|
+
key: "getShadow",
|
|
1965
|
+
value: function getShadow(position, _feature) {
|
|
1966
|
+
return ShadowedPointSymbol.getShadowArc(position, this);
|
|
1979
1967
|
}
|
|
1980
1968
|
}, {
|
|
1981
|
-
key: "
|
|
1982
|
-
value: function
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
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,
|
|
1988
1986
|
enclosed: true
|
|
1989
1987
|
});
|
|
1990
1988
|
}
|
|
1991
|
-
}]);
|
|
1992
|
-
|
|
1993
|
-
return CircleLineMiterRender;
|
|
1994
|
-
}(LineMiterRender);
|
|
1995
|
-
|
|
1996
|
-
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1997
|
-
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1998
|
-
|
|
1999
|
-
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
2000
|
-
|
|
2001
|
-
function SquareLineMiterRender() {
|
|
2002
|
-
_classCallCheck(this, SquareLineMiterRender);
|
|
2003
|
-
|
|
2004
|
-
return _super.apply(this, arguments);
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
_createClass(SquareLineMiterRender, [{
|
|
2008
|
-
key: "usageSize",
|
|
2009
|
-
get: function get() {
|
|
2010
|
-
return this.miterSize + this.strokeWidth;
|
|
2011
|
-
}
|
|
2012
1989
|
}, {
|
|
2013
|
-
key: "
|
|
2014
|
-
value: function
|
|
2015
|
-
let
|
|
2016
|
-
|
|
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
|
+
});
|
|
2017
2004
|
}
|
|
2018
2005
|
}, {
|
|
2019
|
-
key: "
|
|
2020
|
-
value: function
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
fillColor: isFilled ? this.color : void 0,
|
|
2025
|
-
fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
|
|
2026
|
-
lineCap: 'square',
|
|
2027
|
-
lineJoin: 'miter',
|
|
2028
|
-
strokeColor: this.color,
|
|
2029
|
-
strokeWidth: this.strokeWidth
|
|
2030
|
-
});
|
|
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];
|
|
2031
2011
|
}
|
|
2032
2012
|
}]);
|
|
2033
2013
|
|
|
2034
|
-
return
|
|
2035
|
-
}(
|
|
2014
|
+
return ShadowedPointSymbol;
|
|
2015
|
+
}(PointSymbol);
|
|
2036
2016
|
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
case LineMiterKind.Arrow:
|
|
2040
|
-
case LineMiterKind.FilledArrow:
|
|
2041
|
-
return new ArrowLineMiterRender(options);
|
|
2017
|
+
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2018
|
+
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2042
2019
|
|
|
2043
|
-
|
|
2044
|
-
case LineMiterKind.FilledSquare:
|
|
2045
|
-
return new SquareLineMiterRender(options);
|
|
2020
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2046
2021
|
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2022
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2023
|
+
function ShadowedPolySymbol(options) {
|
|
2024
|
+
_classCallCheck(this, ShadowedPolySymbol);
|
|
2050
2025
|
|
|
2051
|
-
|
|
2052
|
-
return null;
|
|
2026
|
+
return _super.call(this, options);
|
|
2053
2027
|
}
|
|
2054
|
-
};
|
|
2055
2028
|
|
|
2056
|
-
|
|
2057
|
-
|
|
2029
|
+
_createClass(ShadowedPolySymbol, [{
|
|
2030
|
+
key: "renderFunction",
|
|
2031
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
2032
|
+
if (!(feature instanceof Poly)) return [];
|
|
2058
2033
|
|
|
2059
|
-
|
|
2060
|
-
const coordinates = reversedRing[i];
|
|
2034
|
+
const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
|
|
2061
2035
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2036
|
+
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2037
|
+
const shadowRender = this.getShadow(coordinates, feature);
|
|
2038
|
+
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2039
|
+
let renders = [polyRender];
|
|
2065
2040
|
|
|
2066
|
-
|
|
2041
|
+
if (shadowRender) {
|
|
2042
|
+
renders = [shadowRender, polyRender];
|
|
2043
|
+
}
|
|
2067
2044
|
|
|
2068
|
-
|
|
2069
|
-
|
|
2045
|
+
if (vertexRenders) {
|
|
2046
|
+
renders = renders.concat(vertexRenders);
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
return renders;
|
|
2070
2050
|
}
|
|
2071
|
-
}
|
|
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
|
+
});
|
|
2061
|
+
}
|
|
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
|
+
}]);
|
|
2072
2091
|
|
|
2073
|
-
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)'
|
|
2074
2099
|
};
|
|
2100
|
+
const measureSymbolParams = {
|
|
2101
|
+
strokeColor: '#ff6933',
|
|
2102
|
+
shadowSize: 0,
|
|
2103
|
+
vertexShadowSize: 0
|
|
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
|
+
}));
|
|
2075
2126
|
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
for (let i = 0; i < newRing.length; i++) {
|
|
2080
|
-
const coordinates = newRing[i];
|
|
2127
|
+
let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
|
|
2128
|
+
_inherits(SelectedPointSymbol, _ShadowedPointSymbol);
|
|
2081
2129
|
|
|
2082
|
-
|
|
2083
|
-
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
2084
|
-
}
|
|
2130
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
|
|
2085
2131
|
|
|
2086
|
-
|
|
2132
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2133
|
+
function SelectedPointSymbol(props) {
|
|
2134
|
+
_classCallCheck(this, SelectedPointSymbol);
|
|
2087
2135
|
|
|
2088
|
-
|
|
2089
|
-
newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
|
|
2090
|
-
}
|
|
2136
|
+
return _super.call(this, props);
|
|
2091
2137
|
}
|
|
2092
2138
|
|
|
2093
|
-
|
|
2094
|
-
|
|
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);
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
}, {
|
|
2147
|
+
key: "getPoint",
|
|
2148
|
+
value: function getPoint(position, feature) {
|
|
2149
|
+
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2095
2150
|
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
2151
|
+
if (feature.isSelected) {
|
|
2152
|
+
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2153
|
+
pointRender.fillColor = this.selectedFillColor;
|
|
2154
|
+
}
|
|
2101
2155
|
|
|
2102
|
-
|
|
2103
|
-
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
2156
|
+
return pointRender;
|
|
2104
2157
|
}
|
|
2105
|
-
});
|
|
2106
|
-
};
|
|
2107
|
-
|
|
2108
|
-
const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
|
|
2109
|
-
let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
|
|
2110
|
-
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
2158
|
+
}]);
|
|
2111
2159
|
|
|
2112
|
-
|
|
2160
|
+
return SelectedPointSymbol;
|
|
2161
|
+
}(ShadowedPointSymbol);
|
|
2113
2162
|
|
|
2114
|
-
|
|
2115
|
-
|
|
2163
|
+
let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
|
|
2164
|
+
_inherits(SelectedPolySymbol, _ShadowedPolySymbol);
|
|
2116
2165
|
|
|
2117
|
-
|
|
2166
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
|
|
2118
2167
|
|
|
2119
|
-
|
|
2168
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2169
|
+
function SelectedPolySymbol(props) {
|
|
2170
|
+
_classCallCheck(this, SelectedPolySymbol);
|
|
2120
2171
|
|
|
2121
|
-
|
|
2122
|
-
// @ts-ignore
|
|
2123
|
-
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
2124
|
-
strokeWidth: clamp( // @ts-ignore
|
|
2125
|
-
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
2126
|
-
// @ts-ignore
|
|
2127
|
-
lineDash: getLineDash(originalSymbol.stroke),
|
|
2128
|
-
// @ts-ignore
|
|
2129
|
-
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
2130
|
-
});
|
|
2131
|
-
_this.originalSymbol = originalSymbol;
|
|
2132
|
-
return _this;
|
|
2172
|
+
return _super.call(this, props);
|
|
2133
2173
|
}
|
|
2134
2174
|
|
|
2135
|
-
_createClass(
|
|
2136
|
-
key: "
|
|
2137
|
-
value: function
|
|
2138
|
-
if (
|
|
2139
|
-
|
|
2140
|
-
ending,
|
|
2141
|
-
beginningSize,
|
|
2142
|
-
beginning,
|
|
2143
|
-
endingSize
|
|
2144
|
-
} = this.originalSymbol;
|
|
2145
|
-
const renders = [];
|
|
2146
|
-
const featureCopy = feature.clone();
|
|
2147
|
-
const beginningMiterRender = getLineMiterRender({
|
|
2148
|
-
color: this.strokeColor,
|
|
2149
|
-
// @ts-ignore
|
|
2150
|
-
kind: beginning,
|
|
2151
|
-
position: 'left',
|
|
2152
|
-
// @ts-ignore
|
|
2153
|
-
size: beginningSize,
|
|
2154
|
-
strokeWidth: this.strokeWidth
|
|
2155
|
-
});
|
|
2156
|
-
const endingMiterRender = getLineMiterRender({
|
|
2157
|
-
color: this.strokeColor,
|
|
2158
|
-
// @ts-ignore
|
|
2159
|
-
kind: ending,
|
|
2160
|
-
position: 'right',
|
|
2161
|
-
// @ts-ignore
|
|
2162
|
-
size: endingSize,
|
|
2163
|
-
strokeWidth: this.strokeWidth
|
|
2164
|
-
});
|
|
2165
|
-
|
|
2166
|
-
if (beginningMiterRender) {
|
|
2167
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
2168
|
-
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2169
|
-
featureCopy.rings = updatedRings;
|
|
2170
|
-
renders.push(render);
|
|
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);
|
|
2171
2180
|
}
|
|
2172
|
-
|
|
2173
|
-
if (endingMiterRender) {
|
|
2174
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
2175
|
-
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2176
|
-
featureCopy.rings = updatedRings;
|
|
2177
|
-
renders.push(render);
|
|
2178
|
-
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
2182
|
-
return renders;
|
|
2183
2181
|
}
|
|
2184
2182
|
}, {
|
|
2185
|
-
key: "
|
|
2186
|
-
value: function
|
|
2187
|
-
|
|
2188
|
-
}
|
|
2189
|
-
}]);
|
|
2190
|
-
|
|
2191
|
-
return SGisPolylineSymbol;
|
|
2192
|
-
}(PolylineSymbol);
|
|
2193
|
-
|
|
2194
|
-
let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
|
|
2195
|
-
_inherits(LabelSymbol, _DynamicPointSymbol);
|
|
2183
|
+
key: "getPolyRender",
|
|
2184
|
+
value: function getPolyRender(coordinates, feature) {
|
|
2185
|
+
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2196
2186
|
|
|
2197
|
-
|
|
2187
|
+
if (feature.isSelected) {
|
|
2188
|
+
polyRender.fillColor = this.selectedFillColor;
|
|
2189
|
+
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2198
2190
|
|
|
2199
|
-
|
|
2200
|
-
|
|
2191
|
+
if (this.selectedStrokeWidth !== void 0) {
|
|
2192
|
+
polyRender.strokeWidth = this.selectedStrokeWidth;
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2201
2195
|
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2196
|
+
return polyRender;
|
|
2197
|
+
}
|
|
2198
|
+
}]);
|
|
2206
2199
|
|
|
2207
|
-
|
|
2200
|
+
return SelectedPolySymbol;
|
|
2201
|
+
}(ShadowedPolySymbol);
|
|
2208
2202
|
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
if (Component) {
|
|
2238
|
-
ReactDOM.render(React.createElement(Component, {
|
|
2239
|
-
content: content
|
|
2240
|
-
}), node);
|
|
2241
|
-
} else {
|
|
2242
|
-
node.innerText = content;
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
}]);
|
|
2246
|
-
|
|
2247
|
-
return LabelSymbol;
|
|
2248
|
-
}(DynamicPointSymbol);
|
|
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
|
+
});
|
|
2249
2231
|
|
|
2250
|
-
const
|
|
2251
|
-
|
|
2232
|
+
const metersToPixels = (meters, _ref) => {
|
|
2233
|
+
let {
|
|
2234
|
+
painter,
|
|
2235
|
+
crs = geo
|
|
2236
|
+
} = _ref;
|
|
2252
2237
|
const {
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
onClose = undefined
|
|
2261
|
-
} = props || {};
|
|
2262
|
-
return new LabelSymbol({
|
|
2263
|
-
offset,
|
|
2264
|
-
component: _ref2 => {
|
|
2265
|
-
let {
|
|
2266
|
-
content
|
|
2267
|
-
} = _ref2;
|
|
2268
|
-
return renderLabel({
|
|
2269
|
-
content,
|
|
2270
|
-
onClose
|
|
2271
|
-
});
|
|
2272
|
-
}
|
|
2273
|
-
});
|
|
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);
|
|
2274
2245
|
};
|
|
2275
2246
|
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
const shadowDiameter = size + strokeWidth + shadowSize;
|
|
2284
|
-
return new PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
|
|
2285
|
-
fillColor: 'transparent',
|
|
2286
|
-
strokeColor: shadowColor,
|
|
2287
|
-
strokeWidth: shadowSize,
|
|
2288
|
-
enclosed: true
|
|
2289
|
-
});
|
|
2290
|
-
}
|
|
2291
|
-
function getEditorPointRenderer(position, _ref2) {
|
|
2292
|
-
let {
|
|
2293
|
-
strokeColor,
|
|
2294
|
-
strokeWidth,
|
|
2295
|
-
shadowColor,
|
|
2296
|
-
fillColor,
|
|
2297
|
-
shadowSize,
|
|
2298
|
-
size = 0
|
|
2299
|
-
} = _ref2;
|
|
2300
|
-
return [createShadowRender(position, {
|
|
2301
|
-
strokeWidth,
|
|
2302
|
-
strokeColor,
|
|
2303
|
-
shadowSize,
|
|
2304
|
-
shadowColor,
|
|
2305
|
-
size
|
|
2306
|
-
}), new PolyRender(polygonCircleFromPoint(position, size), {
|
|
2307
|
-
fillColor,
|
|
2308
|
-
strokeColor,
|
|
2309
|
-
strokeWidth,
|
|
2310
|
-
enclosed: true
|
|
2311
|
-
})];
|
|
2312
|
-
}
|
|
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);
|
|
2313
2254
|
|
|
2314
|
-
|
|
2315
|
-
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
2255
|
+
var _super = /*#__PURE__*/_createSuper(SVGPoly);
|
|
2316
2256
|
|
|
2317
|
-
|
|
2257
|
+
function SVGPoly(_temp) {
|
|
2258
|
+
var _this;
|
|
2318
2259
|
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2260
|
+
let {
|
|
2261
|
+
redrawFeatureNode,
|
|
2262
|
+
pathStyles,
|
|
2263
|
+
circle,
|
|
2264
|
+
className,
|
|
2265
|
+
appendToSvg
|
|
2266
|
+
} = _temp === void 0 ? {} : _temp;
|
|
2322
2267
|
|
|
2323
|
-
|
|
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;
|
|
2324
2282
|
}
|
|
2325
2283
|
|
|
2326
|
-
_createClass(
|
|
2284
|
+
_createClass(SVGPoly, [{
|
|
2327
2285
|
key: "renderFunction",
|
|
2328
2286
|
value: function renderFunction(feature, resolution, crs) {
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
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];
|
|
2337
2308
|
}
|
|
2338
2309
|
}, {
|
|
2339
|
-
key: "
|
|
2340
|
-
value: function
|
|
2341
|
-
|
|
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
|
+
}
|
|
2342
2320
|
}
|
|
2343
2321
|
}, {
|
|
2344
|
-
key: "
|
|
2345
|
-
value: function
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
}], [{
|
|
2349
|
-
key: "getShadowArc",
|
|
2350
|
-
value: function getShadowArc(position, _ref) {
|
|
2322
|
+
key: "update",
|
|
2323
|
+
value: function update(_ref) {
|
|
2324
|
+
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2325
|
+
|
|
2351
2326
|
let {
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2327
|
+
bbox,
|
|
2328
|
+
resolution,
|
|
2329
|
+
feature,
|
|
2330
|
+
crs
|
|
2356
2331
|
} = _ref;
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
enclosed: true
|
|
2362
|
-
});
|
|
2363
|
-
}
|
|
2364
|
-
}, {
|
|
2365
|
-
key: "getPointArc",
|
|
2366
|
-
value: function getPointArc(position, _ref2) {
|
|
2367
|
-
let {
|
|
2368
|
-
strokeWidth,
|
|
2369
|
-
fillColor,
|
|
2370
|
-
strokeColor,
|
|
2371
|
-
size = 6
|
|
2372
|
-
} = _ref2;
|
|
2373
|
-
return new PolyRender(polygonCircleFromPoint(position, size), {
|
|
2374
|
-
fillColor,
|
|
2375
|
-
strokeColor,
|
|
2376
|
-
strokeWidth,
|
|
2377
|
-
enclosed: true
|
|
2378
|
-
});
|
|
2379
|
-
}
|
|
2380
|
-
}, {
|
|
2381
|
-
key: "getArcs",
|
|
2382
|
-
value: function getArcs(position, params) {
|
|
2383
|
-
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2384
|
-
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2385
|
-
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2386
|
-
}
|
|
2387
|
-
}]);
|
|
2388
|
-
|
|
2389
|
-
return ShadowedPointSymbol;
|
|
2390
|
-
}(PointSymbol);
|
|
2391
|
-
|
|
2392
|
-
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2393
|
-
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2394
|
-
|
|
2395
|
-
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2396
|
-
|
|
2397
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2398
|
-
function ShadowedPolySymbol(options) {
|
|
2399
|
-
_classCallCheck(this, ShadowedPolySymbol);
|
|
2400
|
-
|
|
2401
|
-
return _super.call(this, options);
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
_createClass(ShadowedPolySymbol, [{
|
|
2405
|
-
key: "renderFunction",
|
|
2406
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2407
|
-
if (!(feature instanceof Poly)) return [];
|
|
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;
|
|
2408
2336
|
|
|
2409
|
-
|
|
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
|
+
}
|
|
2410
2344
|
|
|
2411
|
-
const
|
|
2412
|
-
const
|
|
2413
|
-
const
|
|
2414
|
-
|
|
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
|
+
}
|
|
2354
|
+
}, {
|
|
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));
|
|
2415
2369
|
|
|
2416
|
-
if (
|
|
2417
|
-
|
|
2370
|
+
if (this.circle) {
|
|
2371
|
+
svgRender._setArcNode();
|
|
2372
|
+
} else {
|
|
2373
|
+
svgRender._setPolyNode();
|
|
2418
2374
|
}
|
|
2419
2375
|
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
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');
|
|
2423
2381
|
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
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
|
+
}
|
|
2435
2392
|
});
|
|
2393
|
+
return svgElement;
|
|
2436
2394
|
}
|
|
2437
2395
|
}, {
|
|
2438
|
-
key: "
|
|
2439
|
-
value: function
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
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
|
+
}
|
|
2447
2411
|
});
|
|
2448
2412
|
}
|
|
2449
|
-
}, {
|
|
2450
|
-
key: "getVertexRenders",
|
|
2451
|
-
value: function getVertexRenders(coordinates) {
|
|
2452
|
-
if (!this.showVertex) return;
|
|
2453
|
-
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2454
|
-
return acc.concat(curr);
|
|
2455
|
-
}, []);
|
|
2456
|
-
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2457
|
-
size: 6,
|
|
2458
|
-
strokeWidth: 2,
|
|
2459
|
-
shadowColor: this.shadowColor,
|
|
2460
|
-
strokeColor: this.strokeColor,
|
|
2461
|
-
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2462
|
-
fillColor: '#ffffff'
|
|
2463
|
-
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2464
|
-
}
|
|
2465
2413
|
}]);
|
|
2466
2414
|
|
|
2467
|
-
return
|
|
2468
|
-
}(
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
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
|
|
2474
2466
|
};
|
|
2475
|
-
const
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2467
|
+
const LEGEND_FEATURES = {
|
|
2468
|
+
point: pointFeature,
|
|
2469
|
+
polyline: lineLegendFeature,
|
|
2470
|
+
polygon: polygonLegendFeature,
|
|
2471
|
+
h3grid: h3gridFeature
|
|
2479
2472
|
};
|
|
2480
|
-
const
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2486
|
-
enclose: true,
|
|
2487
|
-
showVertex: true
|
|
2488
|
-
}));
|
|
2489
|
-
const snapSymbolParams = {
|
|
2490
|
-
size: 10,
|
|
2491
|
-
strokeWidth: 2,
|
|
2492
|
-
strokeColor: '#e33600',
|
|
2493
|
-
fillColor: '#ffffff',
|
|
2494
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2495
|
-
shadowSize: 3
|
|
2473
|
+
const MOCK_FEATURES = {
|
|
2474
|
+
point: pointFeature,
|
|
2475
|
+
polyline: lineFeature,
|
|
2476
|
+
polygon: polygonFeature,
|
|
2477
|
+
h3grid: h3gridFeature
|
|
2496
2478
|
};
|
|
2497
|
-
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2498
|
-
strokeColor: '#ff6933',
|
|
2499
|
-
shadowSize: 0
|
|
2500
|
-
}));
|
|
2501
2479
|
|
|
2502
|
-
|
|
2503
|
-
|
|
2480
|
+
function getSymbolRenders(symbol, size, features) {
|
|
2481
|
+
if (size === void 0) {
|
|
2482
|
+
size = viewBoxSize;
|
|
2483
|
+
}
|
|
2504
2484
|
|
|
2505
|
-
|
|
2485
|
+
if (features === void 0) {
|
|
2486
|
+
features = {};
|
|
2487
|
+
}
|
|
2506
2488
|
|
|
2507
|
-
|
|
2508
|
-
function SelectedPointSymbol(props) {
|
|
2509
|
-
_classCallCheck(this, SelectedPointSymbol);
|
|
2489
|
+
const resolution = viewBoxSize / size;
|
|
2510
2490
|
|
|
2511
|
-
|
|
2512
|
-
}
|
|
2513
|
-
|
|
2514
|
-
_createClass(SelectedPointSymbol, [{
|
|
2515
|
-
key: "getShadow",
|
|
2516
|
-
value: function getShadow(position, feature) {
|
|
2517
|
-
if (feature.isSelected) {
|
|
2518
|
-
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2519
|
-
}
|
|
2520
|
-
}
|
|
2521
|
-
}, {
|
|
2522
|
-
key: "getPoint",
|
|
2523
|
-
value: function getPoint(position, feature) {
|
|
2524
|
-
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2525
|
-
|
|
2526
|
-
if (feature.isSelected) {
|
|
2527
|
-
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2528
|
-
pointRender.fillColor = this.selectedFillColor;
|
|
2529
|
-
}
|
|
2530
|
-
|
|
2531
|
-
return pointRender;
|
|
2532
|
-
}
|
|
2533
|
-
}]);
|
|
2491
|
+
const featuresToRender = _extends({}, MOCK_FEATURES, features);
|
|
2534
2492
|
|
|
2535
|
-
|
|
2536
|
-
|
|
2493
|
+
if (isSGisPolygonSymbol(symbol)) {
|
|
2494
|
+
return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, plain);
|
|
2495
|
+
}
|
|
2537
2496
|
|
|
2538
|
-
|
|
2539
|
-
|
|
2497
|
+
if (isSGisPolylineSymbol(symbol)) {
|
|
2498
|
+
return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, plain);
|
|
2499
|
+
}
|
|
2540
2500
|
|
|
2541
|
-
|
|
2501
|
+
if (isSGisH3Symbol(symbol)) {
|
|
2502
|
+
return symbol.renderFunctionAsync(featuresToRender.h3grid, resolution, plain);
|
|
2503
|
+
}
|
|
2542
2504
|
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
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
|
+
}
|
|
2546
2511
|
|
|
2547
|
-
|
|
2512
|
+
return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
|
|
2513
|
+
};
|
|
2514
|
+
const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
|
|
2515
|
+
if (size === void 0) {
|
|
2516
|
+
size = viewBoxSize;
|
|
2548
2517
|
}
|
|
2549
2518
|
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
value: function getShadow(coordinates, feature) {
|
|
2553
|
-
if (feature.isSelected) {
|
|
2554
|
-
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2555
|
-
}
|
|
2556
|
-
}
|
|
2557
|
-
}, {
|
|
2558
|
-
key: "getPolyRender",
|
|
2559
|
-
value: function getPolyRender(coordinates, feature) {
|
|
2560
|
-
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2519
|
+
return getSymbolRenders(symbol, size, LEGEND_FEATURES);
|
|
2520
|
+
};
|
|
2561
2521
|
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2522
|
+
function renderSymbolToCanvas(renders, canvas) {
|
|
2523
|
+
renders.forEach(render => {
|
|
2524
|
+
canvas.draw(render);
|
|
2525
|
+
});
|
|
2526
|
+
}
|
|
2565
2527
|
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2528
|
+
function deserializeSymbol(symbol) {
|
|
2529
|
+
switch (symbol.type) {
|
|
2530
|
+
case "h3grid":
|
|
2531
|
+
return deserializeH3Symbol(symbol);
|
|
2570
2532
|
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
}]);
|
|
2533
|
+
case "svgPointSymbol":
|
|
2534
|
+
return deserializeSvgPointSymbol(symbol);
|
|
2574
2535
|
|
|
2575
|
-
|
|
2576
|
-
|
|
2536
|
+
case 'circlePointSymbol':
|
|
2537
|
+
return deserializePointSymbol(symbol);
|
|
2577
2538
|
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
strokeWidth: 2,
|
|
2581
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2582
|
-
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2583
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2584
|
-
shadowSize: 3,
|
|
2585
|
-
selectedStrokeColor: '#ff5722',
|
|
2586
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2587
|
-
});
|
|
2588
|
-
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2589
|
-
strokeWidth: 6,
|
|
2590
|
-
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2591
|
-
shadowSize: 8,
|
|
2592
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2593
|
-
selectedStrokeColor: '#ff5722',
|
|
2594
|
-
selectedStrokeWidth: 2
|
|
2595
|
-
});
|
|
2596
|
-
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2597
|
-
strokeWidth: 2,
|
|
2598
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2599
|
-
shadowSize: 8,
|
|
2600
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2601
|
-
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2602
|
-
enclose: true,
|
|
2603
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2604
|
-
selectedStrokeColor: '#ff5722'
|
|
2605
|
-
});
|
|
2539
|
+
case 'squarePointSymbol':
|
|
2540
|
+
return deserializeSquareSymbol(symbol);
|
|
2606
2541
|
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
strokeColor: 'rgb(0, 163, 245)',
|
|
2610
|
-
fillStyle: FillStyle.None
|
|
2611
|
-
};
|
|
2612
|
-
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2613
|
-
_inherits(SVGPoly, _Symbol);
|
|
2542
|
+
case 'maskedImagePointSymbol':
|
|
2543
|
+
return deserializeMaskedImageSymbol(symbol);
|
|
2614
2544
|
|
|
2615
|
-
|
|
2545
|
+
case 'imagePointSymbol':
|
|
2546
|
+
return deserializeImagePointSymbol(symbol);
|
|
2616
2547
|
|
|
2617
|
-
|
|
2618
|
-
|
|
2548
|
+
case 'polygonSymbol':
|
|
2549
|
+
return deserializePolygonSymbol(symbol);
|
|
2619
2550
|
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
circle,
|
|
2624
|
-
className,
|
|
2625
|
-
appendToSvg
|
|
2626
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2551
|
+
case 'simplePolylineSymbol':
|
|
2552
|
+
case 'polylineSymbol':
|
|
2553
|
+
return deserializePolylineSymbol(symbol);
|
|
2627
2554
|
|
|
2628
|
-
|
|
2555
|
+
case "clusterSymbol":
|
|
2556
|
+
return deserializeSymbol(symbol.singleObjectSymbol);
|
|
2629
2557
|
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
_this.container.style.position = 'absolute';
|
|
2633
|
-
_this.redrawFeatureNode = redrawFeatureNode;
|
|
2634
|
-
_this.pathStyles = _extends({
|
|
2635
|
-
center: [0, 0],
|
|
2636
|
-
fillColor: 'none'
|
|
2637
|
-
}, pathStyles);
|
|
2638
|
-
_this.circle = circle;
|
|
2639
|
-
_this.className = className;
|
|
2640
|
-
_this.appendToSvg = appendToSvg;
|
|
2641
|
-
return _this;
|
|
2558
|
+
default:
|
|
2559
|
+
return null;
|
|
2642
2560
|
}
|
|
2561
|
+
}
|
|
2643
2562
|
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2647
|
-
const coordinates = feature instanceof Poly ? new PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2648
|
-
this.setCirclePxRaius(crs);
|
|
2649
|
-
this.container.innerHTML = '';
|
|
2650
|
-
const svg = this.setSvg(coordinates);
|
|
2651
|
-
svg && this.container.append(svg);
|
|
2652
|
-
feature.__dynamicSymbolRender = new DynamicRender({
|
|
2653
|
-
node: this.container,
|
|
2654
|
-
update: (bbox, resolution) => this.update({
|
|
2655
|
-
bbox,
|
|
2656
|
-
resolution,
|
|
2657
|
-
feature,
|
|
2658
|
-
crs
|
|
2659
|
-
}),
|
|
2660
|
-
redraw: () => {
|
|
2661
|
-
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2662
|
-
}
|
|
2663
|
-
});
|
|
2563
|
+
function deserializeH3Symbol(symbol) {
|
|
2564
|
+
var _symbol$stroke, _symbol$stroke2, _symbol$fill;
|
|
2664
2565
|
|
|
2665
|
-
|
|
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
|
+
}
|
|
2666
2573
|
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
value: function setCirclePxRaius(crs) {
|
|
2672
|
-
if (this.circle && this.pathStyles) {
|
|
2673
|
-
var _this$circle;
|
|
2574
|
+
function deserializePointSymbol(symbol) {
|
|
2575
|
+
// @ts-ignore
|
|
2576
|
+
return new PointSymbol(deserializePointSymbolParams(symbol));
|
|
2577
|
+
}
|
|
2674
2578
|
|
|
2675
|
-
|
|
2676
|
-
painter: this.circle.painter,
|
|
2677
|
-
crs
|
|
2678
|
-
}) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
}, {
|
|
2682
|
-
key: "update",
|
|
2683
|
-
value: function update(_ref) {
|
|
2684
|
-
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])];
|
|
2685
2580
|
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
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
|
+
}
|
|
2696
2609
|
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
this.container.innerHTML = '';
|
|
2701
|
-
const svg = this.setSvg(newCoordinates);
|
|
2702
|
-
svg && this.container.append(svg);
|
|
2703
|
-
}
|
|
2704
|
-
|
|
2705
|
-
const polygon = feature.projectTo(bbox.crs);
|
|
2706
|
-
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;
|
|
2707
|
-
const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
|
|
2708
|
-
const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
|
|
2709
|
-
this.container.style.left = dx.toString() + "px";
|
|
2710
|
-
this.container.style.top = dy.toString() + "px";
|
|
2711
|
-
feature.__lastBbox = bbox;
|
|
2712
|
-
feature.__lastResolution = resolution;
|
|
2713
|
-
}
|
|
2714
|
-
}, {
|
|
2715
|
-
key: "setSvg",
|
|
2716
|
-
value: function setSvg(coordinates) {
|
|
2717
|
-
const {
|
|
2718
|
-
lineCap,
|
|
2719
|
-
lineJoin,
|
|
2720
|
-
miterLimit,
|
|
2721
|
-
lineDash,
|
|
2722
|
-
dashOffset
|
|
2723
|
-
} = this.pathStyles || {};
|
|
2724
|
-
const svgRender = new SvgRender(_extends({
|
|
2725
|
-
coordinates
|
|
2726
|
-
}, defaultPathStyles, {
|
|
2727
|
-
appendToSvg: this.appendToSvg
|
|
2728
|
-
}, this.pathStyles));
|
|
2729
|
-
|
|
2730
|
-
if (this.circle) {
|
|
2731
|
-
svgRender._setArcNode();
|
|
2732
|
-
} else {
|
|
2733
|
-
svgRender._setPolyNode();
|
|
2734
|
-
}
|
|
2610
|
+
function deserializeSvgPointSymbol(symbol) {
|
|
2611
|
+
return new PointSymbol(deserializeSvgPointSymbolParams(symbol));
|
|
2612
|
+
}
|
|
2735
2613
|
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2614
|
+
function deserializeSquareSymbol(symbol) {
|
|
2615
|
+
return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
|
|
2616
|
+
// @ts-ignore
|
|
2617
|
+
angle: getParameterValue(symbol.angle)
|
|
2618
|
+
}));
|
|
2619
|
+
}
|
|
2741
2620
|
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
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
|
+
}
|
|
2747
2639
|
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
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
|
+
}
|
|
2759
2654
|
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
listenDomEvent(svgNode, mouseEvents[eventName].type, event => {
|
|
2765
|
-
dynamicFeature.fire(mouseEvents[eventName].type, {
|
|
2766
|
-
node: svgNode,
|
|
2767
|
-
browserEvent: event
|
|
2768
|
-
});
|
|
2769
|
-
});
|
|
2770
|
-
}
|
|
2771
|
-
});
|
|
2772
|
-
}
|
|
2773
|
-
}]);
|
|
2655
|
+
function deserializePolygonSymbol(symbol) {
|
|
2656
|
+
if (isPolygonHasPatternBrush(symbol)) {
|
|
2657
|
+
return new SGisImageFill(symbol);
|
|
2658
|
+
}
|
|
2774
2659
|
|
|
2775
|
-
|
|
2776
|
-
|
|
2660
|
+
if (isPolygonHasHatchBrush(symbol)) {
|
|
2661
|
+
return new SGisBrushFill(symbol);
|
|
2662
|
+
}
|
|
2777
2663
|
|
|
2778
|
-
|
|
2779
|
-
return symbol instanceof PointSymbol || symbol instanceof StaticImageSymbol || symbol instanceof SquareSymbol || symbol instanceof MaskedImage;
|
|
2664
|
+
return new SGisPolygonSymbol(symbol);
|
|
2780
2665
|
}
|
|
2781
|
-
|
|
2782
|
-
|
|
2666
|
+
|
|
2667
|
+
function deserializePolylineSymbol(symbol) {
|
|
2668
|
+
return new SGisPolylineSymbol(symbol);
|
|
2783
2669
|
}
|
|
2784
|
-
|
|
2785
|
-
|
|
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
|
+
};
|
|
2786
2686
|
}
|
|
2787
|
-
|
|
2788
|
-
|
|
2687
|
+
|
|
2688
|
+
function deserializeBase64(base) {
|
|
2689
|
+
return "data:image/png;base64," + base;
|
|
2789
2690
|
}
|
|
2790
|
-
|
|
2791
|
-
|
|
2691
|
+
|
|
2692
|
+
function deserializeAnchor(offset) {
|
|
2693
|
+
// @ts-ignore
|
|
2694
|
+
return offset.map(getParameterValue);
|
|
2792
2695
|
}
|
|
2793
|
-
|
|
2794
|
-
|
|
2696
|
+
|
|
2697
|
+
function deserializeColor(color) {
|
|
2698
|
+
return color ? new Color(color).toString() : null;
|
|
2795
2699
|
}
|
|
2796
2700
|
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
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
|
+
}
|
|
2801
2708
|
|
|
2802
|
-
|
|
2803
|
-
const pointFeature = /*#__PURE__*/new PointFeature([50, -50], {
|
|
2804
|
-
crs: plain
|
|
2805
|
-
});
|
|
2806
|
-
const lineFeature = /*#__PURE__*/new Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2807
|
-
crs: plain
|
|
2808
|
-
});
|
|
2809
|
-
const polygonFeature = /*#__PURE__*/new Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
|
|
2810
|
-
crs: plain
|
|
2811
|
-
});
|
|
2812
|
-
const h3gridFeature = /*#__PURE__*/new H3Feature([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2813
|
-
crs: plain
|
|
2814
|
-
});
|
|
2815
|
-
const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
|
|
2816
|
-
crs: plain
|
|
2817
|
-
});
|
|
2818
|
-
const polygonLegendFeature = /*#__PURE__*/new Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
|
|
2819
|
-
crs: plain
|
|
2820
|
-
});
|
|
2821
|
-
const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2822
|
-
crs: plain
|
|
2823
|
-
});
|
|
2824
|
-
const MAP_LEGEND_FEATURES = {
|
|
2825
|
-
polygon: polygonMapLegendFeature
|
|
2826
|
-
};
|
|
2827
|
-
const LEGEND_FEATURES = {
|
|
2828
|
-
point: pointFeature,
|
|
2829
|
-
polyline: lineLegendFeature,
|
|
2830
|
-
polygon: polygonLegendFeature,
|
|
2831
|
-
h3grid: h3gridFeature
|
|
2709
|
+
return symbol;
|
|
2832
2710
|
};
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
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));
|
|
2838
2725
|
};
|
|
2839
2726
|
|
|
2840
|
-
function
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
}
|
|
2727
|
+
let EvergisFeature = /*#__PURE__*/function () {
|
|
2728
|
+
function EvergisFeature(feature) {
|
|
2729
|
+
_classCallCheck(this, EvergisFeature);
|
|
2844
2730
|
|
|
2845
|
-
|
|
2846
|
-
|
|
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);
|
|
2847
2744
|
}
|
|
2848
2745
|
|
|
2849
|
-
|
|
2746
|
+
_createClass(EvergisFeature, [{
|
|
2747
|
+
key: "sGisFeature",
|
|
2748
|
+
value: function sGisFeature() {
|
|
2749
|
+
if (!this.geometry || !this.symbol) {
|
|
2750
|
+
return null;
|
|
2751
|
+
} // @ts-ignore
|
|
2850
2752
|
|
|
2851
|
-
const featuresToRender = _extends({}, MOCK_FEATURES, features);
|
|
2852
2753
|
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
}
|
|
2860
|
-
|
|
2861
|
-
if (isSGisH3Symbol(symbol)) {
|
|
2862
|
-
return symbol.renderFunctionAsync(featuresToRender.h3grid, resolution, plain);
|
|
2863
|
-
}
|
|
2864
|
-
|
|
2865
|
-
return symbol.renderFunctionAsync(featuresToRender.point, resolution, plain);
|
|
2866
|
-
}
|
|
2867
|
-
const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
|
|
2868
|
-
if (size === void 0) {
|
|
2869
|
-
size = viewBoxSize;
|
|
2870
|
-
}
|
|
2754
|
+
const {
|
|
2755
|
+
type,
|
|
2756
|
+
coordinates,
|
|
2757
|
+
sr
|
|
2758
|
+
} = this.geometry;
|
|
2759
|
+
const crs = CRS_MAP[sr];
|
|
2871
2760
|
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
if (size === void 0) {
|
|
2876
|
-
size = viewBoxSize;
|
|
2877
|
-
}
|
|
2761
|
+
if (!crs) {
|
|
2762
|
+
return null;
|
|
2763
|
+
}
|
|
2878
2764
|
|
|
2879
|
-
|
|
2880
|
-
|
|
2765
|
+
switch (type) {
|
|
2766
|
+
case GeometryType.Point:
|
|
2767
|
+
return new PointFeature(coordinates, {
|
|
2768
|
+
symbol: selectedPoint,
|
|
2769
|
+
crs
|
|
2770
|
+
});
|
|
2881
2771
|
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
}
|
|
2772
|
+
case GeometryType.Multipoint:
|
|
2773
|
+
return new MultiPoint(coordinates, {
|
|
2774
|
+
symbol: selectedPoint,
|
|
2775
|
+
crs
|
|
2776
|
+
});
|
|
2887
2777
|
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2778
|
+
case GeometryType.Polyline:
|
|
2779
|
+
return new Polyline(coordinates, {
|
|
2780
|
+
symbol: selectedPolyline,
|
|
2781
|
+
crs
|
|
2782
|
+
});
|
|
2892
2783
|
|
|
2893
|
-
|
|
2894
|
-
|
|
2784
|
+
case GeometryType.Polygon:
|
|
2785
|
+
return new Polygon(coordinates, {
|
|
2786
|
+
symbol: selectedPolygon,
|
|
2787
|
+
crs
|
|
2788
|
+
});
|
|
2895
2789
|
|
|
2896
|
-
|
|
2897
|
-
|
|
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
|
+
}]);
|
|
2898
2801
|
|
|
2899
|
-
|
|
2900
|
-
|
|
2802
|
+
return EvergisFeature;
|
|
2803
|
+
}();
|
|
2901
2804
|
|
|
2902
|
-
|
|
2903
|
-
|
|
2805
|
+
function evaluateCondition(condition, attributes) {
|
|
2806
|
+
try {
|
|
2807
|
+
const evaluator = new ConditionEvaluator(attributes);
|
|
2808
|
+
const result = evaluator.evaluate(condition);
|
|
2904
2809
|
|
|
2905
|
-
|
|
2906
|
-
return
|
|
2810
|
+
if (result instanceof Error) {
|
|
2811
|
+
return null;
|
|
2812
|
+
}
|
|
2907
2813
|
|
|
2908
|
-
|
|
2909
|
-
|
|
2814
|
+
return result;
|
|
2815
|
+
} catch (_unused) {
|
|
2816
|
+
return null;
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2910
2819
|
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
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
|
+
}
|
|
2914
2829
|
|
|
2915
|
-
|
|
2916
|
-
|
|
2830
|
+
const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
|
|
2831
|
+
const getAttributeNameFromClassified = values => values.length > 0 ? getAttributeNameFromCondition(values[0].condition) : null;
|
|
2917
2832
|
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
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;
|
|
2921
2843
|
}
|
|
2922
2844
|
|
|
2923
|
-
function
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
return
|
|
2927
|
-
cellSize: getParameterValue(symbol.cellSize),
|
|
2928
|
-
strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
|
|
2929
|
-
strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
|
|
2930
|
-
fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
|
|
2931
|
-
}));
|
|
2845
|
+
function extractValuesAttribute(parameterValues, attributes) {
|
|
2846
|
+
const name = getAttributeNameFromClassified(parameterValues) || '';
|
|
2847
|
+
const value = name && getAttributeValue(attributes, name);
|
|
2848
|
+
return [name, value];
|
|
2932
2849
|
}
|
|
2933
2850
|
|
|
2934
|
-
function
|
|
2851
|
+
function evaluateFeatureSymbol(attributes) {
|
|
2935
2852
|
// @ts-ignore
|
|
2936
|
-
|
|
2937
|
-
|
|
2853
|
+
function calc(result, _ref4) {
|
|
2854
|
+
let [parameterName, parameterValue] = _ref4;
|
|
2855
|
+
let newParameterValue;
|
|
2938
2856
|
|
|
2939
|
-
|
|
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
|
+
}
|
|
2940
2865
|
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
size,
|
|
2946
|
-
offset,
|
|
2947
|
-
angle,
|
|
2948
|
-
background,
|
|
2949
|
-
figure
|
|
2950
|
-
} = _ref;
|
|
2951
|
-
return _extends({
|
|
2952
|
-
type: getParameterValue(type),
|
|
2953
|
-
data: getParameterValue(data),
|
|
2954
|
-
size: getParameterValue(size),
|
|
2955
|
-
offset: getOffsetParameterValue(offset),
|
|
2956
|
-
angle: getParameterValue(angle)
|
|
2957
|
-
}, background ? {
|
|
2958
|
-
background: _extends({}, background, {
|
|
2959
|
-
fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
|
|
2960
|
-
strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
|
|
2961
|
-
strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
|
|
2962
|
-
})
|
|
2963
|
-
} : {}, figure ? {
|
|
2964
|
-
figure: _extends({}, figure, {
|
|
2965
|
-
fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
|
|
2966
|
-
})
|
|
2967
|
-
} : {});
|
|
2968
|
-
}
|
|
2866
|
+
return newParameterValue !== undefined ? _extends({}, result, {
|
|
2867
|
+
[parameterName]: newParameterValue
|
|
2868
|
+
}) : result;
|
|
2869
|
+
}
|
|
2969
2870
|
|
|
2970
|
-
|
|
2971
|
-
return new PointSymbol(deserializeSvgPointSymbolParams(symbol));
|
|
2871
|
+
return calc;
|
|
2972
2872
|
}
|
|
2973
2873
|
|
|
2974
|
-
function
|
|
2975
|
-
return
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
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);
|
|
2980
2881
|
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
width: getParameterValue(symbol.width),
|
|
2987
|
-
// @ts-ignore
|
|
2988
|
-
height: getParameterValue(symbol.height),
|
|
2989
|
-
// @ts-ignore
|
|
2990
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2991
|
-
// @ts-ignore
|
|
2992
|
-
imageSource: deserializeBase64(symbol.image),
|
|
2993
|
-
// @ts-ignore
|
|
2994
|
-
maskSource: deserializeBase64(symbol.imageMask),
|
|
2995
|
-
// @ts-ignore
|
|
2996
|
-
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2997
|
-
}));
|
|
2998
|
-
}
|
|
2882
|
+
if (condition && attributeName && attributeValue !== undefined) {
|
|
2883
|
+
return evaluateCondition(condition, {
|
|
2884
|
+
[attributeName]: attributeValue
|
|
2885
|
+
});
|
|
2886
|
+
}
|
|
2999
2887
|
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
// @ts-ignore
|
|
3007
|
-
height: getParameterValue(symbol.height),
|
|
3008
|
-
// @ts-ignore
|
|
3009
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
3010
|
-
// @ts-ignore
|
|
3011
|
-
source: deserializeBase64(symbol.image)
|
|
3012
|
-
}));
|
|
2888
|
+
return false;
|
|
2889
|
+
}) || null;
|
|
2890
|
+
}
|
|
2891
|
+
function findChildFeatureSymbol(childStyles, attributes) {
|
|
2892
|
+
const featureStyle = findChildFeatureStyle(childStyles, attributes);
|
|
2893
|
+
return featureStyle ? featureStyle.symbol : null;
|
|
3013
2894
|
}
|
|
2895
|
+
function getFeatureSymbol(style, attributes) {
|
|
2896
|
+
if (!style || !style.symbol) {
|
|
2897
|
+
return null;
|
|
2898
|
+
}
|
|
3014
2899
|
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
return new SGisImageFill(symbol);
|
|
3018
|
-
}
|
|
3019
|
-
|
|
3020
|
-
if (isPolygonHasHatchBrush(symbol)) {
|
|
3021
|
-
return new SGisBrushFill(symbol);
|
|
3022
|
-
}
|
|
3023
|
-
|
|
3024
|
-
return new SGisPolygonSymbol(symbol);
|
|
3025
|
-
}
|
|
3026
|
-
|
|
3027
|
-
function deserializePolylineSymbol(symbol) {
|
|
3028
|
-
return new SGisPolylineSymbol(symbol);
|
|
3029
|
-
}
|
|
3030
|
-
|
|
3031
|
-
function deserializePointSymbolParams(_ref2) {
|
|
3032
|
-
let {
|
|
3033
|
-
size,
|
|
3034
|
-
offset,
|
|
3035
|
-
strokeColor,
|
|
3036
|
-
strokeWidth,
|
|
3037
|
-
fillColor
|
|
3038
|
-
} = _ref2;
|
|
3039
|
-
return {
|
|
3040
|
-
size: getParameterValue(size),
|
|
3041
|
-
offset: deserializeAnchor(offset),
|
|
3042
|
-
strokeWidth: getParameterValue(strokeWidth),
|
|
3043
|
-
strokeColor: deserializeColor(getParameterValue(strokeColor)),
|
|
3044
|
-
fillColor: deserializeColor(getParameterValue(fillColor))
|
|
3045
|
-
};
|
|
3046
|
-
}
|
|
3047
|
-
|
|
3048
|
-
function deserializeBase64(base) {
|
|
3049
|
-
return "data:image/png;base64," + base;
|
|
3050
|
-
}
|
|
3051
|
-
|
|
3052
|
-
function deserializeAnchor(offset) {
|
|
3053
|
-
// @ts-ignore
|
|
3054
|
-
return offset.map(getParameterValue);
|
|
3055
|
-
}
|
|
3056
|
-
|
|
3057
|
-
function deserializeColor(color) {
|
|
3058
|
-
return color ? new Color(color).toString() : null;
|
|
3059
|
-
}
|
|
3060
|
-
|
|
3061
|
-
const clampSymbol = (symbol, min, max) => {
|
|
3062
|
-
if (isSGisImageSymbol(symbol)) {
|
|
3063
|
-
symbol.width = clamp(symbol.width, min, max);
|
|
3064
|
-
symbol.height = clamp(symbol.height, min, max);
|
|
3065
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
3066
|
-
symbol.size = clamp(symbol.size, min, max);
|
|
3067
|
-
}
|
|
3068
|
-
|
|
3069
|
-
return symbol;
|
|
3070
|
-
};
|
|
3071
|
-
function centerAlignSymbol(symbol) {
|
|
3072
|
-
if (isSGisImageSymbol(symbol)) {
|
|
3073
|
-
symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
|
|
3074
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
3075
|
-
symbol.offset = [0, 0];
|
|
3076
|
-
}
|
|
3077
|
-
|
|
3078
|
-
return symbol;
|
|
3079
|
-
}
|
|
3080
|
-
const adjustSymbol = (symbol, _ref) => {
|
|
3081
|
-
let {
|
|
3082
|
-
size
|
|
3083
|
-
} = _ref;
|
|
3084
|
-
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
3085
|
-
};
|
|
3086
|
-
|
|
3087
|
-
let EvergisFeature = /*#__PURE__*/function () {
|
|
3088
|
-
function EvergisFeature(feature) {
|
|
3089
|
-
_classCallCheck(this, EvergisFeature);
|
|
3090
|
-
|
|
3091
|
-
this.id = null;
|
|
3092
|
-
this.displayName = null;
|
|
3093
|
-
this.geometry = null;
|
|
3094
|
-
this.layerName = null;
|
|
3095
|
-
this.layerAlias = null;
|
|
3096
|
-
this.attributes = null;
|
|
3097
|
-
this.symbol = null;
|
|
3098
|
-
this.id = feature.id;
|
|
3099
|
-
this.displayName = feature.id;
|
|
3100
|
-
this.geometry = feature.geometry;
|
|
3101
|
-
this.layerName = feature.layer;
|
|
3102
|
-
this.layerAlias = feature.layer;
|
|
3103
|
-
this.attributes = getFeatureAttributes(feature.attributes);
|
|
3104
|
-
}
|
|
3105
|
-
|
|
3106
|
-
_createClass(EvergisFeature, [{
|
|
3107
|
-
key: "sGisFeature",
|
|
3108
|
-
value: function sGisFeature() {
|
|
3109
|
-
if (!this.geometry || !this.symbol) {
|
|
3110
|
-
return null;
|
|
3111
|
-
} // @ts-ignore
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
const {
|
|
3115
|
-
type,
|
|
3116
|
-
coordinates,
|
|
3117
|
-
sr
|
|
3118
|
-
} = this.geometry;
|
|
3119
|
-
const crs = CRS_MAP[sr];
|
|
3120
|
-
|
|
3121
|
-
if (!crs) {
|
|
3122
|
-
return null;
|
|
3123
|
-
}
|
|
3124
|
-
|
|
3125
|
-
switch (type) {
|
|
3126
|
-
case GeometryType.Point:
|
|
3127
|
-
return new PointFeature(coordinates, {
|
|
3128
|
-
symbol: selectedPoint,
|
|
3129
|
-
crs
|
|
3130
|
-
});
|
|
3131
|
-
|
|
3132
|
-
case GeometryType.Multipoint:
|
|
3133
|
-
return new MultiPoint(coordinates, {
|
|
3134
|
-
symbol: selectedPoint,
|
|
3135
|
-
crs
|
|
3136
|
-
});
|
|
3137
|
-
|
|
3138
|
-
case GeometryType.Polyline:
|
|
3139
|
-
return new Polyline(coordinates, {
|
|
3140
|
-
symbol: selectedPolyline,
|
|
3141
|
-
crs
|
|
3142
|
-
});
|
|
3143
|
-
|
|
3144
|
-
case GeometryType.Polygon:
|
|
3145
|
-
return new Polygon(coordinates, {
|
|
3146
|
-
symbol: selectedPolygon,
|
|
3147
|
-
crs
|
|
3148
|
-
});
|
|
3149
|
-
|
|
3150
|
-
default:
|
|
3151
|
-
return null;
|
|
3152
|
-
}
|
|
3153
|
-
}
|
|
3154
|
-
}, {
|
|
3155
|
-
key: "extent",
|
|
3156
|
-
value: function extent() {
|
|
3157
|
-
const feature = this.sGisFeature();
|
|
3158
|
-
return feature && feature.bbox;
|
|
3159
|
-
}
|
|
3160
|
-
}]);
|
|
3161
|
-
|
|
3162
|
-
return EvergisFeature;
|
|
3163
|
-
}();
|
|
3164
|
-
|
|
3165
|
-
function evaluateCondition(condition, attributes) {
|
|
3166
|
-
try {
|
|
3167
|
-
const evaluator = new ConditionEvaluator(attributes);
|
|
3168
|
-
const result = evaluator.evaluate(condition);
|
|
3169
|
-
|
|
3170
|
-
if (result instanceof Error) {
|
|
3171
|
-
return null;
|
|
3172
|
-
}
|
|
3173
|
-
|
|
3174
|
-
return result;
|
|
3175
|
-
} catch (_unused) {
|
|
3176
|
-
return null;
|
|
3177
|
-
}
|
|
3178
|
-
}
|
|
3179
|
-
|
|
3180
|
-
function getAttributeValue(attributes, attributeName) {
|
|
3181
|
-
const attributeMeta = attributes.find(_ref => {
|
|
3182
|
-
let {
|
|
3183
|
-
name
|
|
3184
|
-
} = _ref;
|
|
3185
|
-
return name === attributeName;
|
|
3186
|
-
});
|
|
3187
|
-
return attributeMeta ? attributeMeta.value : null;
|
|
3188
|
-
}
|
|
3189
|
-
|
|
3190
|
-
const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
|
|
3191
|
-
const getAttributeNameFromClassified = values => values.length > 0 ? getAttributeNameFromCondition(values[0].condition) : null;
|
|
3192
|
-
|
|
3193
|
-
function findFeatureValue(parameterValues, _ref2) {
|
|
3194
|
-
let [name, value] = _ref2;
|
|
3195
|
-
return value !== null ? parameterValues.find(_ref3 => {
|
|
3196
|
-
let {
|
|
3197
|
-
condition
|
|
3198
|
-
} = _ref3;
|
|
3199
|
-
return value !== undefined && evaluateCondition(condition, {
|
|
3200
|
-
[name]: value
|
|
3201
|
-
});
|
|
3202
|
-
}) : null;
|
|
3203
|
-
}
|
|
3204
|
-
|
|
3205
|
-
function extractValuesAttribute(parameterValues, attributes) {
|
|
3206
|
-
const name = getAttributeNameFromClassified(parameterValues) || '';
|
|
3207
|
-
const value = name && getAttributeValue(attributes, name);
|
|
3208
|
-
return [name, value];
|
|
3209
|
-
}
|
|
3210
|
-
|
|
3211
|
-
function evaluateFeatureSymbol(attributes) {
|
|
3212
|
-
// @ts-ignore
|
|
3213
|
-
function calc(result, _ref4) {
|
|
3214
|
-
let [parameterName, parameterValue] = _ref4;
|
|
3215
|
-
let newParameterValue;
|
|
3216
|
-
|
|
3217
|
-
if (isParameterByAttribute(parameterValue)) {
|
|
3218
|
-
const [attributeName, attributeValue] = extractValuesAttribute(parameterValue.values, attributes);
|
|
3219
|
-
const featureValue = findFeatureValue(parameterValue.values, [attributeName, attributeValue]);
|
|
3220
|
-
newParameterValue = featureValue ? featureValue.value : parameterValue.defaultValue;
|
|
3221
|
-
} else if (isObject(parameterValue)) {
|
|
3222
|
-
// @ts-ignore
|
|
3223
|
-
newParameterValue = Object.entries(parameterValue).reduce(calc, parameterValue);
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3226
|
-
return newParameterValue !== undefined ? _extends({}, result, {
|
|
3227
|
-
[parameterName]: newParameterValue
|
|
3228
|
-
}) : result;
|
|
3229
|
-
}
|
|
3230
|
-
|
|
3231
|
-
return calc;
|
|
3232
|
-
}
|
|
3233
|
-
|
|
3234
|
-
function findChildFeatureStyle(childStyles, attributes) {
|
|
3235
|
-
return (childStyles || []).find(_ref5 => {
|
|
3236
|
-
let {
|
|
3237
|
-
condition
|
|
3238
|
-
} = _ref5;
|
|
3239
|
-
const attributeName = condition && getAttributeNameFromCondition(condition);
|
|
3240
|
-
const attributeValue = attributeName && getAttributeValue(attributes, attributeName);
|
|
3241
|
-
|
|
3242
|
-
if (condition && attributeName && attributeValue !== undefined) {
|
|
3243
|
-
return evaluateCondition(condition, {
|
|
3244
|
-
[attributeName]: attributeValue
|
|
3245
|
-
});
|
|
3246
|
-
}
|
|
3247
|
-
|
|
3248
|
-
return false;
|
|
3249
|
-
}) || null;
|
|
3250
|
-
}
|
|
3251
|
-
function findChildFeatureSymbol(childStyles, attributes) {
|
|
3252
|
-
const featureStyle = findChildFeatureStyle(childStyles, attributes);
|
|
3253
|
-
return featureStyle ? featureStyle.symbol : null;
|
|
3254
|
-
}
|
|
3255
|
-
function getFeatureSymbol(style, attributes) {
|
|
3256
|
-
if (!style || !style.symbol) {
|
|
3257
|
-
return null;
|
|
3258
|
-
}
|
|
3259
|
-
|
|
3260
|
-
if (style.children !== null) {
|
|
3261
|
-
return findChildFeatureSymbol(style.children, attributes) || style.symbol;
|
|
2900
|
+
if (style.children !== null) {
|
|
2901
|
+
return findChildFeatureSymbol(style.children, attributes) || style.symbol;
|
|
3262
2902
|
}
|
|
3263
2903
|
|
|
3264
2904
|
return Object.entries(style.symbol).reduce(evaluateFeatureSymbol(attributes), style.symbol);
|
|
@@ -3293,7 +2933,7 @@ let EvergisLayer = /*#__PURE__*/function () {
|
|
|
3293
2933
|
feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
|
|
3294
2934
|
feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
|
|
3295
2935
|
feature.layerAlias = this.alias;
|
|
3296
|
-
const titleAttribute = (feature.attributes || []).find(_ref => {
|
|
2936
|
+
const titleAttribute = (feature.attributes || []).find((_ref) => {
|
|
3297
2937
|
let {
|
|
3298
2938
|
name
|
|
3299
2939
|
} = _ref;
|
|
@@ -3316,7 +2956,7 @@ const evaluateFeature = layers => feature => {
|
|
|
3316
2956
|
};
|
|
3317
2957
|
|
|
3318
2958
|
const OTHERS_TITLE = 'Другое';
|
|
3319
|
-
const createLegendItem = _ref => {
|
|
2959
|
+
const createLegendItem = (_ref) => {
|
|
3320
2960
|
let {
|
|
3321
2961
|
attributes,
|
|
3322
2962
|
renderTitle,
|
|
@@ -3362,7 +3002,7 @@ function createStyleLegend(style, config) {
|
|
|
3362
3002
|
classificationManager,
|
|
3363
3003
|
symbol
|
|
3364
3004
|
} = style;
|
|
3365
|
-
const items = classificationManager.filter(_ref => {
|
|
3005
|
+
const items = classificationManager.filter((_ref) => {
|
|
3366
3006
|
let {
|
|
3367
3007
|
parameter
|
|
3368
3008
|
} = _ref;
|
|
@@ -3478,7 +3118,7 @@ const useMapLegend = (layer, config) => {
|
|
|
3478
3118
|
};
|
|
3479
3119
|
|
|
3480
3120
|
const LEGEND_SYMBOL_MAX_SIZE = 32;
|
|
3481
|
-
const useLegendValueSymbol = _ref => {
|
|
3121
|
+
const useLegendValueSymbol = (_ref) => {
|
|
3482
3122
|
let {
|
|
3483
3123
|
parameter,
|
|
3484
3124
|
parameterValue
|
|
@@ -3725,11 +3365,10 @@ function useFeatureLayer(_ref) {
|
|
|
3725
3365
|
}),
|
|
3726
3366
|
destructor: layer => map.indexOf(layer) !== -1 && map.removeLayer(layer),
|
|
3727
3367
|
update: (layer, _ref2) => {
|
|
3728
|
-
let [features
|
|
3368
|
+
let [features] = _ref2;
|
|
3729
3369
|
layer.features = features;
|
|
3730
|
-
layer.opacity = opacity != null ? opacity : 1;
|
|
3731
3370
|
}
|
|
3732
|
-
}, [features
|
|
3371
|
+
}, [features]);
|
|
3733
3372
|
useLayerOrder(layer, zIndex);
|
|
3734
3373
|
useLayerVisibility(layer, isDisplayed);
|
|
3735
3374
|
useLayerOpacity(layer, opacity);
|
|
@@ -3886,7 +3525,7 @@ function useMapWrapper() {
|
|
|
3886
3525
|
return wrapperRef;
|
|
3887
3526
|
}
|
|
3888
3527
|
|
|
3889
|
-
const byScale = scale => _ref => {
|
|
3528
|
+
const byScale = scale => (_ref) => {
|
|
3890
3529
|
let {
|
|
3891
3530
|
zIndex
|
|
3892
3531
|
} = _ref;
|
|
@@ -4085,7 +3724,7 @@ const useTooltip = function useTooltip(zIndex) {
|
|
|
4085
3724
|
|
|
4086
3725
|
return reset;
|
|
4087
3726
|
}, [reset, map, layer, zIndex]);
|
|
4088
|
-
const onSetLabelFeature = useCallback(_ref => {
|
|
3727
|
+
const onSetLabelFeature = useCallback((_ref) => {
|
|
4089
3728
|
let {
|
|
4090
3729
|
point,
|
|
4091
3730
|
position,
|
|
@@ -4249,7 +3888,7 @@ function useClusterLayer(_ref) {
|
|
|
4249
3888
|
}
|
|
4250
3889
|
|
|
4251
3890
|
const INIT_FEATURES = [];
|
|
4252
|
-
const useEvergisSelect = _ref => {
|
|
3891
|
+
const useEvergisSelect = (_ref) => {
|
|
4253
3892
|
let {
|
|
4254
3893
|
onPick,
|
|
4255
3894
|
onFeatures
|
|
@@ -4282,7 +3921,7 @@ function none() {
|
|
|
4282
3921
|
return;
|
|
4283
3922
|
}
|
|
4284
3923
|
|
|
4285
|
-
const useDraggableMarker = _ref => {
|
|
3924
|
+
const useDraggableMarker = (_ref) => {
|
|
4286
3925
|
let {
|
|
4287
3926
|
position,
|
|
4288
3927
|
onChange,
|
|
@@ -4404,7 +4043,7 @@ const useToggle = initial => {
|
|
|
4404
4043
|
return [state, toggle, setState];
|
|
4405
4044
|
};
|
|
4406
4045
|
|
|
4407
|
-
const Symbol = _ref => {
|
|
4046
|
+
const Symbol = (_ref) => {
|
|
4408
4047
|
let {
|
|
4409
4048
|
symbol,
|
|
4410
4049
|
size,
|
|
@@ -4425,19 +4064,19 @@ const Symbol = _ref => {
|
|
|
4425
4064
|
};
|
|
4426
4065
|
|
|
4427
4066
|
var _templateObject, _templateObject2;
|
|
4428
|
-
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) => {
|
|
4429
4068
|
let {
|
|
4430
4069
|
geometryType,
|
|
4431
4070
|
icons
|
|
4432
4071
|
} = _ref;
|
|
4433
4072
|
return "url(" + icons[geometryType] + ") center center / " + (geometryType === GeometryType.Polyline ? '2rem 1.3rem' : 'auto 1rem') + " no-repeat";
|
|
4434
4073
|
});
|
|
4435
|
-
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) => {
|
|
4436
4075
|
let {
|
|
4437
4076
|
color
|
|
4438
4077
|
} = _ref2;
|
|
4439
4078
|
return color;
|
|
4440
|
-
}, _ref3 => {
|
|
4079
|
+
}, (_ref3) => {
|
|
4441
4080
|
let {
|
|
4442
4081
|
color
|
|
4443
4082
|
} = _ref3;
|
|
@@ -4445,7 +4084,7 @@ const ClusterSymbol = /*#__PURE__*/styled.div(_templateObject2 || (_templateObje
|
|
|
4445
4084
|
});
|
|
4446
4085
|
|
|
4447
4086
|
const MAX_SIZE = 32;
|
|
4448
|
-
const StyleSymbol = _ref => {
|
|
4087
|
+
const StyleSymbol = (_ref) => {
|
|
4449
4088
|
let {
|
|
4450
4089
|
symbol,
|
|
4451
4090
|
size = MAX_SIZE,
|
|
@@ -4502,7 +4141,7 @@ const AttributeValueContainer = /*#__PURE__*/styled.div(_templateObject14 || (_t
|
|
|
4502
4141
|
const SimpleAttribute = /*#__PURE__*/styled.div(_templateObject15 || (_templateObject15 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
|
|
4503
4142
|
const ValueLink = /*#__PURE__*/styled.a(_templateObject16 || (_templateObject16 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 0 0.25rem;\n color: #1fb3aa;\n text-decoration: none;\n"])));
|
|
4504
4143
|
|
|
4505
|
-
const MailValue = _ref => {
|
|
4144
|
+
const MailValue = (_ref) => {
|
|
4506
4145
|
let {
|
|
4507
4146
|
mail
|
|
4508
4147
|
} = _ref;
|
|
@@ -4513,7 +4152,7 @@ const MailValue = _ref => {
|
|
|
4513
4152
|
}, mail);
|
|
4514
4153
|
};
|
|
4515
4154
|
|
|
4516
|
-
const PhoneValue = _ref => {
|
|
4155
|
+
const PhoneValue = (_ref) => {
|
|
4517
4156
|
let {
|
|
4518
4157
|
phone
|
|
4519
4158
|
} = _ref;
|
|
@@ -4524,7 +4163,7 @@ const PhoneValue = _ref => {
|
|
|
4524
4163
|
}, phone);
|
|
4525
4164
|
};
|
|
4526
4165
|
|
|
4527
|
-
const UrlValue = _ref => {
|
|
4166
|
+
const UrlValue = (_ref) => {
|
|
4528
4167
|
let {
|
|
4529
4168
|
url
|
|
4530
4169
|
} = _ref;
|
|
@@ -4535,7 +4174,7 @@ const UrlValue = _ref => {
|
|
|
4535
4174
|
}, url);
|
|
4536
4175
|
};
|
|
4537
4176
|
|
|
4538
|
-
const AttributeValue = _ref => {
|
|
4177
|
+
const AttributeValue = (_ref) => {
|
|
4539
4178
|
let {
|
|
4540
4179
|
attribute
|
|
4541
4180
|
} = _ref;
|
|
@@ -4549,29 +4188,29 @@ const AttributeValue = _ref => {
|
|
|
4549
4188
|
if (attributeValue.type === 2
|
|
4550
4189
|
/* Url */
|
|
4551
4190
|
) {
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4191
|
+
return React.createElement(UrlValue, {
|
|
4192
|
+
key: key,
|
|
4193
|
+
url: punycodeDecode(value)
|
|
4194
|
+
});
|
|
4195
|
+
}
|
|
4557
4196
|
|
|
4558
4197
|
if (attributeValue.type === 3
|
|
4559
4198
|
/* Mail */
|
|
4560
4199
|
) {
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4200
|
+
return React.createElement(MailValue, {
|
|
4201
|
+
key: key,
|
|
4202
|
+
mail: value
|
|
4203
|
+
});
|
|
4204
|
+
}
|
|
4566
4205
|
|
|
4567
4206
|
if (attributeValue.type === 1
|
|
4568
4207
|
/* Phone */
|
|
4569
4208
|
) {
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4209
|
+
return React.createElement(PhoneValue, {
|
|
4210
|
+
key: key,
|
|
4211
|
+
phone: value
|
|
4212
|
+
});
|
|
4213
|
+
}
|
|
4575
4214
|
|
|
4576
4215
|
return React.createElement(SimpleAttribute, {
|
|
4577
4216
|
key: value
|
|
@@ -4587,7 +4226,7 @@ function punycodeDecode(domains) {
|
|
|
4587
4226
|
}
|
|
4588
4227
|
}
|
|
4589
4228
|
|
|
4590
|
-
const EvergisCardAttribute = _ref => {
|
|
4229
|
+
const EvergisCardAttribute = (_ref) => {
|
|
4591
4230
|
let {
|
|
4592
4231
|
attribute,
|
|
4593
4232
|
className
|
|
@@ -4599,7 +4238,7 @@ const EvergisCardAttribute = _ref => {
|
|
|
4599
4238
|
}));
|
|
4600
4239
|
};
|
|
4601
4240
|
|
|
4602
|
-
const StyledCard = _ref => {
|
|
4241
|
+
const StyledCard = (_ref) => {
|
|
4603
4242
|
let {
|
|
4604
4243
|
features = [],
|
|
4605
4244
|
className,
|
|
@@ -4645,7 +4284,7 @@ const StyledCard = _ref => {
|
|
|
4645
4284
|
};
|
|
4646
4285
|
|
|
4647
4286
|
const _excluded$1 = ["renderCard", "className", "children"];
|
|
4648
|
-
const EvergisCard = _ref => {
|
|
4287
|
+
const EvergisCard = (_ref) => {
|
|
4649
4288
|
let {
|
|
4650
4289
|
renderCard,
|
|
4651
4290
|
className,
|
|
@@ -4697,7 +4336,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
|
|
|
4697
4336
|
|
|
4698
4337
|
const useSGisFeatures = (features, currentIndex) => useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
|
|
4699
4338
|
|
|
4700
|
-
const EvergisSelectLayer = _ref => {
|
|
4339
|
+
const EvergisSelectLayer = (_ref) => {
|
|
4701
4340
|
let {
|
|
4702
4341
|
features,
|
|
4703
4342
|
zIndex,
|
|
@@ -4742,7 +4381,7 @@ const TileLayer = props => {
|
|
|
4742
4381
|
};
|
|
4743
4382
|
|
|
4744
4383
|
const defaultZIndex = 200;
|
|
4745
|
-
const EvergisSelect = _ref => {
|
|
4384
|
+
const EvergisSelect = (_ref) => {
|
|
4746
4385
|
let {
|
|
4747
4386
|
onPick,
|
|
4748
4387
|
className,
|
|
@@ -4777,7 +4416,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled.p(_templateObject3$1 || (_template
|
|
|
4777
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);
|
|
4778
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"])));
|
|
4779
4418
|
|
|
4780
|
-
const LegendSection = _ref => {
|
|
4419
|
+
const LegendSection = (_ref) => {
|
|
4781
4420
|
let {
|
|
4782
4421
|
item,
|
|
4783
4422
|
renderLegendTitle,
|
|
@@ -4791,7 +4430,7 @@ var _templateObject$3, _templateObject2$3;
|
|
|
4791
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"])));
|
|
4792
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"])));
|
|
4793
4432
|
|
|
4794
|
-
const SearchInput = _ref => {
|
|
4433
|
+
const SearchInput = (_ref) => {
|
|
4795
4434
|
let {
|
|
4796
4435
|
onChange
|
|
4797
4436
|
} = _ref;
|
|
@@ -4800,7 +4439,7 @@ const SearchInput = _ref => {
|
|
|
4800
4439
|
}));
|
|
4801
4440
|
};
|
|
4802
4441
|
|
|
4803
|
-
const LegendSymbol = _ref => {
|
|
4442
|
+
const LegendSymbol = (_ref) => {
|
|
4804
4443
|
let {
|
|
4805
4444
|
parameter,
|
|
4806
4445
|
parameterValue,
|
|
@@ -4818,7 +4457,7 @@ const LegendSymbol = _ref => {
|
|
|
4818
4457
|
return React.createElement(React.Fragment, null, children(symbol));
|
|
4819
4458
|
};
|
|
4820
4459
|
|
|
4821
|
-
const LegendValue = _ref => {
|
|
4460
|
+
const LegendValue = (_ref) => {
|
|
4822
4461
|
let {
|
|
4823
4462
|
value,
|
|
4824
4463
|
parameter,
|
|
@@ -4840,7 +4479,7 @@ const getNumberParam = (parameterValue, param) => {
|
|
|
4840
4479
|
return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
|
|
4841
4480
|
};
|
|
4842
4481
|
|
|
4843
|
-
const getSymbolSize = _ref => {
|
|
4482
|
+
const getSymbolSize = (_ref) => {
|
|
4844
4483
|
let {
|
|
4845
4484
|
parameterValue,
|
|
4846
4485
|
maxSize
|
|
@@ -4865,7 +4504,7 @@ const getSymbolSize = _ref => {
|
|
|
4865
4504
|
}
|
|
4866
4505
|
};
|
|
4867
4506
|
|
|
4868
|
-
const Legend = _ref => {
|
|
4507
|
+
const Legend = (_ref) => {
|
|
4869
4508
|
let {
|
|
4870
4509
|
layer,
|
|
4871
4510
|
children,
|
|
@@ -4909,7 +4548,7 @@ const Legend = _ref => {
|
|
|
4909
4548
|
})))));
|
|
4910
4549
|
};
|
|
4911
4550
|
|
|
4912
|
-
const Map = _ref => {
|
|
4551
|
+
const Map = (_ref) => {
|
|
4913
4552
|
let {
|
|
4914
4553
|
className,
|
|
4915
4554
|
position,
|
|
@@ -4981,27 +4620,27 @@ const FullscreenBtn = /*#__PURE__*/styled(Icon)(_templateObject5$3 || (_template
|
|
|
4981
4620
|
const MeasureBtn = /*#__PURE__*/styled(Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin); // MeasureBtn.defaultProps = { kind: "measure_length" };
|
|
4982
4621
|
|
|
4983
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"])));
|
|
4984
|
-
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) => {
|
|
4985
4624
|
let {
|
|
4986
4625
|
vertical
|
|
4987
4626
|
} = _ref;
|
|
4988
4627
|
return vertical ? 'column' : 'row';
|
|
4989
|
-
}, _ref2 => {
|
|
4628
|
+
}, (_ref2) => {
|
|
4990
4629
|
let {
|
|
4991
4630
|
placement
|
|
4992
4631
|
} = _ref2;
|
|
4993
4632
|
return placementMixin(placement);
|
|
4994
|
-
}, MapControl, _ref3 => {
|
|
4633
|
+
}, MapControl, (_ref3) => {
|
|
4995
4634
|
let {
|
|
4996
4635
|
vertical
|
|
4997
4636
|
} = _ref3;
|
|
4998
4637
|
return vertical ? '0.5rem' : '0';
|
|
4999
|
-
}, _ref4 => {
|
|
4638
|
+
}, (_ref4) => {
|
|
5000
4639
|
let {
|
|
5001
4640
|
vertical
|
|
5002
4641
|
} = _ref4;
|
|
5003
4642
|
return vertical ? '0' : '0.5rem';
|
|
5004
|
-
}, _ref5 => {
|
|
4643
|
+
}, (_ref5) => {
|
|
5005
4644
|
let {
|
|
5006
4645
|
vertical
|
|
5007
4646
|
} = _ref5;
|
|
@@ -5026,8 +4665,18 @@ const Fullscreen = () => {
|
|
|
5026
4665
|
}));
|
|
5027
4666
|
};
|
|
5028
4667
|
|
|
5029
|
-
|
|
5030
|
-
|
|
4668
|
+
const isParameterType = (types, parameter) => {
|
|
4669
|
+
var _parameter$toLowerCas;
|
|
4670
|
+
|
|
4671
|
+
return (typeof types === "string" ? parameter == null ? void 0 : (_parameter$toLowerCas = parameter.toLowerCase()) == null ? void 0 : _parameter$toLowerCas.includes(types.toLowerCase()) : types.some(type => {
|
|
4672
|
+
var _parameter$toLowerCas2;
|
|
4673
|
+
|
|
4674
|
+
return parameter == null ? void 0 : (_parameter$toLowerCas2 = parameter.toLowerCase()) == null ? void 0 : _parameter$toLowerCas2.includes(type.toLowerCase());
|
|
4675
|
+
})) || false;
|
|
4676
|
+
};
|
|
4677
|
+
|
|
4678
|
+
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, _templateObject14$1, _templateObject15$1, _templateObject16$1, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22;
|
|
4679
|
+
const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
5031
4680
|
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 padding-bottom: 1rem;\n box-sizing: border-box;\n\n canvas {\n height: 1.625rem;\n width: 1.625rem;\n }\n"])));
|
|
5032
4681
|
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"])));
|
|
5033
4682
|
const MapLegendDescriptionContainer = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 0.5rem;\n font-weight: 400;\n font-size: 0.625rem;\n color: rgba(255, 255, 255, 0.65);\n"])));
|
|
@@ -5039,195 +4688,523 @@ const SizeLegendItemMixin = function SizeLegendItemMixin(value) {
|
|
|
5039
4688
|
value = 0;
|
|
5040
4689
|
}
|
|
5041
4690
|
|
|
5042
|
-
return css(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 50%;\n flex: none;\n height: inherit;\n width: inherit;\n margin: 0 0 0 -1rem;\n background: none;\n border: none;\n\n :after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 50%;\n border: 1px rgba(48, 69, 79, 0.28) solid;\n border-radius: 50%;\n margin: 0 0 0 -", "px;\n width: ", "px;\n height: ", "px;\n }\n"])), value / 2, value, value);
|
|
5043
|
-
};
|
|
4691
|
+
return css(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 50%;\n flex: none;\n height: inherit;\n width: inherit;\n margin: 0 0 0 -1rem;\n background: none;\n border: none;\n\n :after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 50%;\n border: 1px rgba(48, 69, 79, 0.28) solid;\n border-radius: 50%;\n margin: 0 0 0 -", "px;\n width: ", "px;\n height: ", "px;\n }\n"])), value / 2, value, value);
|
|
4692
|
+
};
|
|
4693
|
+
|
|
4694
|
+
const StrokeWidthLegendItemMixin = function StrokeWidthLegendItemMixin(value) {
|
|
4695
|
+
if (value === void 0) {
|
|
4696
|
+
value = 0;
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
return css(_templateObject8$2 || (_templateObject8$2 = _taggedTemplateLiteralLoose(["\n position: relative;\n background: none;\n border: none;\n display: flex;\n align-items: center;\n flex: none;\n min-height: 1rem;\n height: auto;\n width: calc(100% - 2rem);\n margin: 0 0 0.25rem 0;\n padding-left: 2rem;\n font-size: 0.75rem;\n \n :after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 0;\n width: 1.5rem;\n height: ", "px;\n margin-top: -", ";\n background: rgb(224, 224, 224);\n }\n"])), value, Math.round(value / 2));
|
|
4700
|
+
};
|
|
4701
|
+
|
|
4702
|
+
const MapLegendItem = /*#__PURE__*/styled.div(_templateObject9$1 || (_templateObject9$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n height: ", "rem;\n background: ", ";\n border: 1px rgba(48, 69, 79, 0.1) solid;\n margin-right: -1px;\n\n ", "\n\n ", "\n"])), (_ref) => {
|
|
4703
|
+
let {
|
|
4704
|
+
parameter
|
|
4705
|
+
} = _ref;
|
|
4706
|
+
return isParameterType(["strokeColor", "stroke.color"], parameter) ? 0.25 : 1;
|
|
4707
|
+
}, (_ref2) => {
|
|
4708
|
+
let {
|
|
4709
|
+
value
|
|
4710
|
+
} = _ref2;
|
|
4711
|
+
return typeof value === "number" ? "none" : value;
|
|
4712
|
+
}, (_ref3) => {
|
|
4713
|
+
let {
|
|
4714
|
+
value,
|
|
4715
|
+
parameter
|
|
4716
|
+
} = _ref3;
|
|
4717
|
+
return isParameterType("size", parameter) && SizeLegendItemMixin(value);
|
|
4718
|
+
}, (_ref4) => {
|
|
4719
|
+
let {
|
|
4720
|
+
value,
|
|
4721
|
+
parameter
|
|
4722
|
+
} = _ref4;
|
|
4723
|
+
return isParameterType(["strokeWidth", "stroke.width"], parameter) && StrokeWidthLegendItemMixin(value);
|
|
4724
|
+
});
|
|
4725
|
+
const MapLegendOther = /*#__PURE__*/styled(MapLegendItem)(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: none;\n position: relative;\n width: 1rem;\n margin-left: 0.25rem;\n border-radius: 0.125rem;\n"])));
|
|
4726
|
+
const SizeLegendItemsMixin = /*#__PURE__*/css(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 2rem;\n height: 2rem;\n margin: 0 auto;\n\n ", " {\n width: auto;\n margin-left: 0;\n }\n"])), MapLegendOther);
|
|
4727
|
+
const StrokeWidthLegendItemsMixin = /*#__PURE__*/css(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n flex-direction: column;\n\n ", " {\n width: calc(100% - 2rem);\n margin-left: 0;\n }\n"])), MapLegendOther);
|
|
4728
|
+
const SizeMinimizedLegend = /*#__PURE__*/styled.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n margin-top: 0.5rem;\n"])));
|
|
4729
|
+
const SizeMinimizedLegendSymbol = /*#__PURE__*/styled.div(_templateObject14$1 || (_templateObject14$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n"])));
|
|
4730
|
+
const SizeMinimizedLegendLabel = /*#__PURE__*/styled.div(_templateObject15$1 || (_templateObject15$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
|
|
4731
|
+
const SizeMinimizedLegendDown = /*#__PURE__*/styled.div(_templateObject16$1 || (_templateObject16$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.28;\n"])));
|
|
4732
|
+
const SizeMinimizedLegendUp = /*#__PURE__*/styled.div(_templateObject17 || (_templateObject17 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.65;\n"])));
|
|
4733
|
+
const MapLegendItems = /*#__PURE__*/styled.div(_templateObject18 || (_templateObject18 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n ", ";\n"])), (_ref5) => {
|
|
4734
|
+
let {
|
|
4735
|
+
isSize
|
|
4736
|
+
} = _ref5;
|
|
4737
|
+
return isSize && SizeLegendItemsMixin;
|
|
4738
|
+
}, (_ref6) => {
|
|
4739
|
+
let {
|
|
4740
|
+
isStrokeWidth
|
|
4741
|
+
} = _ref6;
|
|
4742
|
+
return isStrokeWidth && StrokeWidthLegendItemsMixin;
|
|
4743
|
+
});
|
|
4744
|
+
const MapLegendValues = /*#__PURE__*/styled.div(_templateObject19 || (_templateObject19 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n font-size: 0.75rem;\n color: rgba(48, 69, 79, 0.65);\n"])));
|
|
4745
|
+
const MapLegendValuesRange = /*#__PURE__*/styled.div(_templateObject20 || (_templateObject20 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
4746
|
+
const MapLegendValuesOther = /*#__PURE__*/styled(MapLegendOther)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
|
|
4747
|
+
const MapLegendExpandButton = /*#__PURE__*/styled.div(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin: 0.1rem 0 0.5rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
|
|
4748
|
+
|
|
4749
|
+
const MapLegendDescription = (_ref) => {
|
|
4750
|
+
let {
|
|
4751
|
+
parameter
|
|
4752
|
+
} = _ref;
|
|
4753
|
+
const isSize = isParameterType("size", parameter);
|
|
4754
|
+
const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
|
|
4755
|
+
const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
|
|
4756
|
+
console.info("MapLegendDescription", parameter, isSize, isStrokeWidth, isStrokeColor);
|
|
4757
|
+
return React.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
|
|
4758
|
+
};
|
|
4759
|
+
|
|
4760
|
+
const isNumeric = number => !isNaN(parseFloat(number)) && isFinite(number);
|
|
4761
|
+
|
|
4762
|
+
const getValueFromLegendTitle = (title, minOrMax) => {
|
|
4763
|
+
var _title$split;
|
|
4764
|
+
|
|
4765
|
+
if (title.includes(" - ")) {
|
|
4766
|
+
const result = title == null ? void 0 : title.split(" - ");
|
|
4767
|
+
return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
|
|
4768
|
+
}
|
|
4769
|
+
|
|
4770
|
+
return (title == null ? void 0 : (_title$split = title.split(" ")) == null ? void 0 : _title$split.find(isNumeric)) || "";
|
|
4771
|
+
};
|
|
4772
|
+
|
|
4773
|
+
const MinimizedLegend = (_ref) => {
|
|
4774
|
+
var _currentValues$, _currentValues, _currentValues$2, _currentValues2;
|
|
4775
|
+
|
|
4776
|
+
let {
|
|
4777
|
+
values,
|
|
4778
|
+
title,
|
|
4779
|
+
parameter
|
|
4780
|
+
} = _ref;
|
|
4781
|
+
const currentValues = [...values];
|
|
4782
|
+
const other = currentValues.pop();
|
|
4783
|
+
const isSize = isParameterType("size", parameter);
|
|
4784
|
+
const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
|
|
4785
|
+
const titleMax = getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max");
|
|
4786
|
+
const titleMin = getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min");
|
|
4787
|
+
return React.createElement(MinimizedLegendContainer, null, !!title && React.createElement(MapLegendValueDescr, null, title), React.createElement(MapLegendDescription, {
|
|
4788
|
+
parameter: parameter
|
|
4789
|
+
}), isSize ? React.createElement(React.Fragment, null, React.createElement(SizeMinimizedLegend, null, React.createElement(SizeMinimizedLegendSymbol, null, React.createElement(MapLegendItems, {
|
|
4790
|
+
isSize: true
|
|
4791
|
+
}, currentValues.map((value, index) => React.createElement(MapLegendItem, {
|
|
4792
|
+
key: "" + value.title + index,
|
|
4793
|
+
title: value.title,
|
|
4794
|
+
value: value.parameterValue,
|
|
4795
|
+
parameter: parameter
|
|
4796
|
+
})))), React.createElement(SizeMinimizedLegendLabel, null, React.createElement(SizeMinimizedLegendDown, null, (_currentValues$2 = currentValues[0]) == null ? void 0 : _currentValues$2.title), React.createElement(SizeMinimizedLegendUp, null, (_currentValues2 = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues2.title))), React.createElement(SizeMinimizedLegend, null, React.createElement(SizeMinimizedLegendSymbol, null, React.createElement(MapLegendItems, {
|
|
4797
|
+
isSize: true
|
|
4798
|
+
}, React.createElement(MapLegendOther, {
|
|
4799
|
+
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
4800
|
+
value: other == null ? void 0 : other.parameterValue,
|
|
4801
|
+
parameter: parameter
|
|
4802
|
+
}))), React.createElement(SizeMinimizedLegendLabel, null, React.createElement(SizeMinimizedLegendUp, null, "\u0414\u0440\u0443\u0433\u043E\u0435")))) : isStrokeWidth ? React.createElement(MapLegendItems, {
|
|
4803
|
+
isStrokeWidth: true
|
|
4804
|
+
}, currentValues.map((value, index) => React.createElement(MapLegendItem, {
|
|
4805
|
+
key: "" + value.title + index,
|
|
4806
|
+
title: value.title,
|
|
4807
|
+
value: value.parameterValue,
|
|
4808
|
+
parameter: parameter
|
|
4809
|
+
}, (!index || index === currentValues.length - 1) && value.title)), React.createElement(MapLegendOther, {
|
|
4810
|
+
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
4811
|
+
value: other == null ? void 0 : other.parameterValue,
|
|
4812
|
+
parameter: parameter
|
|
4813
|
+
}, "\u0414\u0440\u0443\u0433\u043E\u0435")) : React.createElement(MapLegendItems, null, currentValues.map((value, index) => React.createElement(MapLegendItem, {
|
|
4814
|
+
key: "" + value.title + index,
|
|
4815
|
+
title: value.title,
|
|
4816
|
+
value: value.parameterValue,
|
|
4817
|
+
parameter: parameter
|
|
4818
|
+
})), React.createElement(MapLegendOther, {
|
|
4819
|
+
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
4820
|
+
value: other == null ? void 0 : other.parameterValue,
|
|
4821
|
+
parameter: parameter
|
|
4822
|
+
})), typeof (other == null ? void 0 : other.parameterValue) === "string" && (titleMax || titleMin) && React.createElement(MapLegendValues, null, React.createElement(MapLegendValuesRange, null, React.createElement("div", null, titleMax), React.createElement("div", null, titleMin)), React.createElement(MapLegendValuesOther, null, "-")));
|
|
4823
|
+
};
|
|
4824
|
+
|
|
4825
|
+
const MapLegend = (_ref) => {
|
|
4826
|
+
let {
|
|
4827
|
+
layer,
|
|
4828
|
+
config,
|
|
4829
|
+
className,
|
|
4830
|
+
hideTitle
|
|
4831
|
+
} = _ref;
|
|
4832
|
+
const legend = useMapLegend(layer, config);
|
|
4833
|
+
const [isExpanded, toggleExpanded] = useToggle();
|
|
4834
|
+
|
|
4835
|
+
if (!legend) {
|
|
4836
|
+
return null;
|
|
4837
|
+
}
|
|
4838
|
+
|
|
4839
|
+
const {
|
|
4840
|
+
symbol,
|
|
4841
|
+
items
|
|
4842
|
+
} = legend;
|
|
4843
|
+
return React.createElement(LegendProvider, {
|
|
4844
|
+
symbol: symbol
|
|
4845
|
+
}, React.createElement(MapLegendControl, {
|
|
4846
|
+
className: className
|
|
4847
|
+
}, !hideTitle && React.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), !!items.length && React.createElement(MapLegendContainer, null, isExpanded ? React.createElement(Legend, {
|
|
4848
|
+
layer: layer,
|
|
4849
|
+
config: config
|
|
4850
|
+
}) : React.createElement(React.Fragment, null, items.map(item => {
|
|
4851
|
+
var _symbol$fill;
|
|
4852
|
+
|
|
4853
|
+
return React.createElement(Fragment, {
|
|
4854
|
+
key: item.title
|
|
4855
|
+
}, React.createElement(MinimizedLegend, {
|
|
4856
|
+
values: item.values,
|
|
4857
|
+
defaultValue: (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color,
|
|
4858
|
+
title: item.title !== (layer == null ? void 0 : layer.alias) ? item.title : "",
|
|
4859
|
+
parameter: item.parameter
|
|
4860
|
+
}));
|
|
4861
|
+
})), React.createElement(MapLegendExpandButton, {
|
|
4862
|
+
onClick: toggleExpanded,
|
|
4863
|
+
"data-html2canvas-ignore": true
|
|
4864
|
+
}, isExpanded ? "Свернуть" : "Развернуть"))));
|
|
4865
|
+
};
|
|
4866
|
+
|
|
4867
|
+
const MAX_SIZE$2 = 100;
|
|
4868
|
+
const MapLegendSymbol = (_ref) => {
|
|
4869
|
+
let {
|
|
4870
|
+
value,
|
|
4871
|
+
parameter
|
|
4872
|
+
} = _ref;
|
|
4873
|
+
return React.createElement(LegendSymbol, {
|
|
4874
|
+
key: value.title,
|
|
4875
|
+
parameter: parameter,
|
|
4876
|
+
parameterValue: value.parameterValue
|
|
4877
|
+
}, symbol => React.createElement(Symbol, {
|
|
4878
|
+
render: getMapLegendSymbolRenders,
|
|
4879
|
+
symbol: symbol,
|
|
4880
|
+
size: MAX_SIZE$2
|
|
4881
|
+
}));
|
|
4882
|
+
};
|
|
4883
|
+
|
|
4884
|
+
const DEFAULT_FORMATTERS = {
|
|
4885
|
+
polygon: formatPolygonMeasure,
|
|
4886
|
+
length: formatLength
|
|
4887
|
+
};
|
|
4888
|
+
|
|
4889
|
+
const COORD_FRACTION = 6;
|
|
4890
|
+
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
4891
|
+
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
4892
|
+
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
4893
|
+
|
|
4894
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
4895
|
+
|
|
4896
|
+
function BaseMeasureToolCreator(map, painter, params) {
|
|
4897
|
+
var _this;
|
|
4898
|
+
|
|
4899
|
+
_classCallCheck(this, BaseMeasureToolCreator);
|
|
4900
|
+
|
|
4901
|
+
_this = _super.call(this, map, params);
|
|
4902
|
+
|
|
4903
|
+
_this.cancel = () => {
|
|
4904
|
+
_this.fire('cancel');
|
|
4905
|
+
};
|
|
4906
|
+
|
|
4907
|
+
_this.painter = painter;
|
|
4908
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4909
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4910
|
+
_this.areaSymbol = params.areaSymbol;
|
|
4911
|
+
|
|
4912
|
+
_this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
|
|
4913
|
+
|
|
4914
|
+
|
|
4915
|
+
_this.on('change', _this.updateDistance);
|
|
4916
|
+
|
|
4917
|
+
return _this;
|
|
4918
|
+
}
|
|
4919
|
+
|
|
4920
|
+
_createClass(BaseMeasureToolCreator, [{
|
|
4921
|
+
key: "_handleMousemove",
|
|
4922
|
+
value: function _handleMousemove(event) {
|
|
4923
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_handleMousemove", this).call(this, event);
|
|
4924
|
+
|
|
4925
|
+
this.drawPointOnMouseMove(event);
|
|
4926
|
+
}
|
|
4927
|
+
}, {
|
|
4928
|
+
key: "_activate",
|
|
4929
|
+
value: function _activate() {
|
|
4930
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_activate", this).call(this);
|
|
4931
|
+
|
|
4932
|
+
this.addTempLabel();
|
|
4933
|
+
this.setCursor('pointer');
|
|
4934
|
+
}
|
|
4935
|
+
}, {
|
|
4936
|
+
key: "_deactivate",
|
|
4937
|
+
value: function _deactivate() {
|
|
4938
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_deactivate", this).call(this);
|
|
4939
|
+
|
|
4940
|
+
this.removeCoordLabel();
|
|
4941
|
+
this.removeTempLabel();
|
|
4942
|
+
this.removeMeasureLabel();
|
|
4943
|
+
this.removeTempPolygon();
|
|
4944
|
+
this.setCursor('default');
|
|
4945
|
+
}
|
|
4946
|
+
}, {
|
|
4947
|
+
key: "handlePointAdd",
|
|
4948
|
+
value: function handlePointAdd() {
|
|
4949
|
+
const feature = this.activeFeature;
|
|
4950
|
+
if (!feature) return;
|
|
4951
|
+
const {
|
|
4952
|
+
rings,
|
|
4953
|
+
crs
|
|
4954
|
+
} = feature;
|
|
4955
|
+
|
|
4956
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4957
|
+
this.finishDrawing();
|
|
4958
|
+
this.fire(new DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
4959
|
+
return;
|
|
4960
|
+
}
|
|
4961
|
+
|
|
4962
|
+
if (rings[0].length === 2) {
|
|
4963
|
+
const projection = crs.projectionTo(geo);
|
|
4964
|
+
const point = rings[0][0];
|
|
4965
|
+
if (!projection) return;
|
|
4966
|
+
const [lat, long] = projection(point);
|
|
4967
|
+
this.removeTempLabel();
|
|
4968
|
+
this.addMeasureResultLabel();
|
|
4969
|
+
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
4970
|
+
} else {
|
|
4971
|
+
this.removeCoordLabel();
|
|
4972
|
+
}
|
|
4973
|
+
}
|
|
4974
|
+
}, {
|
|
4975
|
+
key: "polygonPreview",
|
|
4976
|
+
value: function polygonPreview() {
|
|
4977
|
+
if (this.tempPolygon) {
|
|
4978
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
4979
|
+
}
|
|
4980
|
+
|
|
4981
|
+
const feature = this.activeFeature;
|
|
4982
|
+
if (!feature) return;
|
|
4983
|
+
const {
|
|
4984
|
+
rings,
|
|
4985
|
+
crs
|
|
4986
|
+
} = feature;
|
|
4987
|
+
const polygonRings = [...rings[0]];
|
|
4988
|
+
polygonRings.shift();
|
|
4989
|
+
this.tempPolygon = new Polygon(polygonRings, {
|
|
4990
|
+
crs
|
|
4991
|
+
});
|
|
4992
|
+
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
4993
|
+
this.activeFeature && this.activeFeature.hide();
|
|
4994
|
+
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
4995
|
+
}
|
|
4996
|
+
}, {
|
|
4997
|
+
key: "removeTempPolygon",
|
|
4998
|
+
value: function removeTempPolygon() {
|
|
4999
|
+
if (this.tempPolygon) {
|
|
5000
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
5001
|
+
delete this.tempPolygon;
|
|
5002
|
+
}
|
|
5003
|
+
}
|
|
5004
|
+
}, {
|
|
5005
|
+
key: "updateDistance",
|
|
5006
|
+
value: function updateDistance(event) {
|
|
5007
|
+
const feature = this.activeFeature;
|
|
5008
|
+
const {
|
|
5009
|
+
ringIndex,
|
|
5010
|
+
pointIndex
|
|
5011
|
+
} = event;
|
|
5012
|
+
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
5013
|
+
const {
|
|
5014
|
+
rings,
|
|
5015
|
+
crs
|
|
5016
|
+
} = feature;
|
|
5017
|
+
const position = rings[ringIndex][pointIndex];
|
|
5018
|
+
const length$1 = length(rings, crs);
|
|
5019
|
+
let content = this.formatters.length(length$1);
|
|
5020
|
+
|
|
5021
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
5022
|
+
this.polygonPreview();
|
|
5023
|
+
const area$1 = area(rings, crs);
|
|
5024
|
+
content = this.formatters.polygon(area$1, length$1);
|
|
5025
|
+
} else if (this.tempPolygon) {
|
|
5026
|
+
feature.show();
|
|
5027
|
+
this.removeTempPolygon();
|
|
5028
|
+
}
|
|
5029
|
+
|
|
5030
|
+
if (this.measureResultLabel) {
|
|
5031
|
+
this.measureResultLabel.position = position;
|
|
5032
|
+
this.measureResultLabel.content = content;
|
|
5033
|
+
}
|
|
5034
|
+
}
|
|
5035
|
+
}, {
|
|
5036
|
+
key: "addTempLabel",
|
|
5037
|
+
value: function addTempLabel() {
|
|
5038
|
+
this.tempLabel = new LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
5039
|
+
content: 'Нажмите на карту, чтобы начать измерение',
|
|
5040
|
+
crs: this.map.crs,
|
|
5041
|
+
symbol: createLabelSymbol({
|
|
5042
|
+
renderLabel: this.renderLabelSymbol
|
|
5043
|
+
})
|
|
5044
|
+
});
|
|
5045
|
+
this._tempLayer && this._tempLayer.add(this.tempLabel);
|
|
5046
|
+
}
|
|
5047
|
+
}, {
|
|
5048
|
+
key: "addCoordLabel",
|
|
5049
|
+
value: function addCoordLabel(content, position) {
|
|
5050
|
+
this.coordLabel = new LabelFeature(position, {
|
|
5051
|
+
content,
|
|
5052
|
+
crs: this.map.crs,
|
|
5053
|
+
symbol: createLabelSymbol({
|
|
5054
|
+
renderLabel: this.renderLabelSymbol,
|
|
5055
|
+
onClose: this.cancel
|
|
5056
|
+
})
|
|
5057
|
+
});
|
|
5058
|
+
this._tempLayer && this.coordLabel && this._tempLayer.add(this.coordLabel);
|
|
5059
|
+
}
|
|
5060
|
+
}, {
|
|
5061
|
+
key: "addMeasureResultLabel",
|
|
5062
|
+
value: function addMeasureResultLabel() {
|
|
5063
|
+
this.measureResultLabel = new LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
5064
|
+
crs: this.map.crs,
|
|
5065
|
+
symbol: createLabelSymbol({
|
|
5066
|
+
renderLabel: this.renderLabelSymbol
|
|
5067
|
+
})
|
|
5068
|
+
});
|
|
5069
|
+
this._tempLayer && this.measureResultLabel && this._tempLayer.add(this.measureResultLabel);
|
|
5070
|
+
}
|
|
5071
|
+
}, {
|
|
5072
|
+
key: "removeTempLabel",
|
|
5073
|
+
value: function removeTempLabel() {
|
|
5074
|
+
if (this.tempLabel) {
|
|
5075
|
+
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
5076
|
+
delete this.tempLabel;
|
|
5077
|
+
}
|
|
5078
|
+
}
|
|
5079
|
+
}, {
|
|
5080
|
+
key: "removeCoordLabel",
|
|
5081
|
+
value: function removeCoordLabel() {
|
|
5082
|
+
if (this.coordLabel) {
|
|
5083
|
+
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
5084
|
+
delete this.coordLabel;
|
|
5085
|
+
}
|
|
5086
|
+
}
|
|
5087
|
+
}, {
|
|
5088
|
+
key: "removeMeasureLabel",
|
|
5089
|
+
value: function removeMeasureLabel() {
|
|
5090
|
+
if (this.measureResultLabel) {
|
|
5091
|
+
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
5092
|
+
delete this.measureResultLabel;
|
|
5093
|
+
}
|
|
5094
|
+
}
|
|
5095
|
+
}, {
|
|
5096
|
+
key: "drawPointOnMouseMove",
|
|
5097
|
+
value: function drawPointOnMouseMove(event) {
|
|
5098
|
+
if (this.tempLabel) {
|
|
5099
|
+
this.tempLabel.position = event.point.position;
|
|
5100
|
+
}
|
|
5101
|
+
}
|
|
5102
|
+
}, {
|
|
5103
|
+
key: "setCursor",
|
|
5104
|
+
value: function setCursor(cursor) {
|
|
5105
|
+
const {
|
|
5106
|
+
wrapper
|
|
5107
|
+
} = this.painter;
|
|
5108
|
+
|
|
5109
|
+
if (wrapper && typeof wrapper !== 'string') {
|
|
5110
|
+
wrapper.style.cursor = cursor;
|
|
5111
|
+
}
|
|
5112
|
+
}
|
|
5113
|
+
}]);
|
|
5114
|
+
|
|
5115
|
+
return BaseMeasureToolCreator;
|
|
5116
|
+
}(PolylineControl);
|
|
5044
5117
|
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
value = 0;
|
|
5048
|
-
}
|
|
5118
|
+
let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
|
|
5119
|
+
_inherits(BaseMeasureToolEditor, _PolyEditor);
|
|
5049
5120
|
|
|
5050
|
-
|
|
5051
|
-
};
|
|
5121
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
|
|
5052
5122
|
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
parameter
|
|
5056
|
-
} = _ref;
|
|
5057
|
-
return isParameterType(["strokeColor", "stroke.color"], parameter) ? 0.25 : 1;
|
|
5058
|
-
}, _ref2 => {
|
|
5059
|
-
let {
|
|
5060
|
-
value
|
|
5061
|
-
} = _ref2;
|
|
5062
|
-
return typeof value === "number" ? "none" : value;
|
|
5063
|
-
}, _ref3 => {
|
|
5064
|
-
let {
|
|
5065
|
-
value,
|
|
5066
|
-
parameter
|
|
5067
|
-
} = _ref3;
|
|
5068
|
-
return isParameterType("size", parameter) && SizeLegendItemMixin(value);
|
|
5069
|
-
}, _ref4 => {
|
|
5070
|
-
let {
|
|
5071
|
-
value,
|
|
5072
|
-
parameter
|
|
5073
|
-
} = _ref4;
|
|
5074
|
-
return isParameterType(["strokeWidth", "stroke.width"], parameter) && StrokeWidthLegendItemMixin(value);
|
|
5075
|
-
});
|
|
5076
|
-
const MapLegendOther = /*#__PURE__*/styled(MapLegendItem)(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: none;\n position: relative;\n width: 1rem;\n margin-left: 0.25rem;\n border-radius: 0.125rem;\n"])));
|
|
5077
|
-
const SizeLegendItemsMixin = /*#__PURE__*/css(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 2rem;\n height: 2rem;\n margin: 0 auto;\n\n ", " {\n width: auto;\n margin-left: 0;\n }\n"])), MapLegendOther);
|
|
5078
|
-
const StrokeWidthLegendItemsMixin = /*#__PURE__*/css(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n flex-direction: column;\n\n ", " {\n width: calc(100% - 2rem);\n margin-left: 0;\n }\n"])), MapLegendOther);
|
|
5079
|
-
const SizeMinimizedLegend = /*#__PURE__*/styled.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n margin-top: 0.5rem;\n"])));
|
|
5080
|
-
const SizeMinimizedLegendSymbol = /*#__PURE__*/styled.div(_templateObject14$1 || (_templateObject14$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n"])));
|
|
5081
|
-
const SizeMinimizedLegendLabel = /*#__PURE__*/styled.div(_templateObject15$1 || (_templateObject15$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
|
|
5082
|
-
const SizeMinimizedLegendDown = /*#__PURE__*/styled.div(_templateObject16$1 || (_templateObject16$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.28;\n"])));
|
|
5083
|
-
const SizeMinimizedLegendUp = /*#__PURE__*/styled.div(_templateObject17 || (_templateObject17 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.65;\n"])));
|
|
5084
|
-
const MapLegendItems = /*#__PURE__*/styled.div(_templateObject18 || (_templateObject18 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n ", ";\n"])), _ref5 => {
|
|
5085
|
-
let {
|
|
5086
|
-
isSize
|
|
5087
|
-
} = _ref5;
|
|
5088
|
-
return isSize && SizeLegendItemsMixin;
|
|
5089
|
-
}, _ref6 => {
|
|
5090
|
-
let {
|
|
5091
|
-
isStrokeWidth
|
|
5092
|
-
} = _ref6;
|
|
5093
|
-
return isStrokeWidth && StrokeWidthLegendItemsMixin;
|
|
5094
|
-
});
|
|
5095
|
-
const MapLegendValues = /*#__PURE__*/styled.div(_templateObject19 || (_templateObject19 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n font-size: 0.75rem;\n color: rgba(48, 69, 79, 0.65);\n"])));
|
|
5096
|
-
const MapLegendValuesRange = /*#__PURE__*/styled.div(_templateObject20 || (_templateObject20 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
5097
|
-
const MapLegendValuesOther = /*#__PURE__*/styled(MapLegendOther)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
|
|
5098
|
-
const MapLegendExpandButton = /*#__PURE__*/styled.div(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin: 0.1rem 0 0.5rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
|
|
5123
|
+
function BaseMeasureToolEditor(map, painter, params) {
|
|
5124
|
+
var _this;
|
|
5099
5125
|
|
|
5100
|
-
|
|
5101
|
-
let {
|
|
5102
|
-
parameter
|
|
5103
|
-
} = _ref;
|
|
5104
|
-
const isSize = isParameterType("size", parameter);
|
|
5105
|
-
const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
|
|
5106
|
-
const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
|
|
5107
|
-
console.info("MapLegendDescription", parameter, isSize, isStrokeWidth, isStrokeColor);
|
|
5108
|
-
return React.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
|
|
5109
|
-
};
|
|
5126
|
+
_classCallCheck(this, BaseMeasureToolEditor);
|
|
5110
5127
|
|
|
5111
|
-
|
|
5112
|
-
var _title$split;
|
|
5128
|
+
_this = _super.call(this, map, params);
|
|
5113
5129
|
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5130
|
+
_this.measureResult = () => {
|
|
5131
|
+
const feature = _this.activeFeature;
|
|
5132
|
+
if (!feature) return null;
|
|
5133
|
+
const {
|
|
5134
|
+
rings,
|
|
5135
|
+
isEnclosed,
|
|
5136
|
+
crs
|
|
5137
|
+
} = feature;
|
|
5138
|
+
const pointsCount = rings[0].length;
|
|
5139
|
+
const position = rings[0][pointsCount - 1];
|
|
5140
|
+
const area$1 = area(rings, crs);
|
|
5141
|
+
const length$1 = length(rings, crs, isEnclosed);
|
|
5142
|
+
const content = isEnclosed ? _this.formatters.polygon(area$1, length$1) : _this.formatters.length(length$1);
|
|
5143
|
+
return {
|
|
5144
|
+
content,
|
|
5145
|
+
position
|
|
5146
|
+
};
|
|
5147
|
+
};
|
|
5118
5148
|
|
|
5119
|
-
|
|
5120
|
-
|
|
5149
|
+
_this.removeFeature = () => {
|
|
5150
|
+
_this.fire('remove');
|
|
5151
|
+
};
|
|
5121
5152
|
|
|
5122
|
-
|
|
5123
|
-
|
|
5153
|
+
_this.painter = painter;
|
|
5154
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
5155
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
5124
5156
|
|
|
5125
|
-
|
|
5126
|
-
values,
|
|
5127
|
-
title,
|
|
5128
|
-
parameter
|
|
5129
|
-
} = _ref;
|
|
5130
|
-
const currentValues = [...values];
|
|
5131
|
-
const other = currentValues.pop();
|
|
5132
|
-
const isSize = isParameterType("size", parameter);
|
|
5133
|
-
const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
|
|
5134
|
-
const titleMax = getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max");
|
|
5135
|
-
const titleMin = getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min");
|
|
5136
|
-
return React.createElement(MinimizedLegendContainer, null, !!title && React.createElement(MapLegendValueDescr, null, title), React.createElement(MapLegendDescription, {
|
|
5137
|
-
parameter: parameter
|
|
5138
|
-
}), isSize ? React.createElement(React.Fragment, null, React.createElement(SizeMinimizedLegend, null, React.createElement(SizeMinimizedLegendSymbol, null, React.createElement(MapLegendItems, {
|
|
5139
|
-
isSize: true
|
|
5140
|
-
}, currentValues.map((value, index) => React.createElement(MapLegendItem, {
|
|
5141
|
-
key: "" + value.title + index,
|
|
5142
|
-
title: value.title,
|
|
5143
|
-
value: value.parameterValue,
|
|
5144
|
-
parameter: parameter
|
|
5145
|
-
})))), React.createElement(SizeMinimizedLegendLabel, null, React.createElement(SizeMinimizedLegendDown, null, (_currentValues$2 = currentValues[0]) == null ? void 0 : _currentValues$2.title), React.createElement(SizeMinimizedLegendUp, null, (_currentValues2 = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues2.title))), React.createElement(SizeMinimizedLegend, null, React.createElement(SizeMinimizedLegendSymbol, null, React.createElement(MapLegendItems, {
|
|
5146
|
-
isSize: true
|
|
5147
|
-
}, React.createElement(MapLegendOther, {
|
|
5148
|
-
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
5149
|
-
value: other == null ? void 0 : other.parameterValue,
|
|
5150
|
-
parameter: parameter
|
|
5151
|
-
}))), React.createElement(SizeMinimizedLegendLabel, null, React.createElement(SizeMinimizedLegendUp, null, "\u0414\u0440\u0443\u0433\u043E\u0435")))) : isStrokeWidth ? React.createElement(MapLegendItems, {
|
|
5152
|
-
isStrokeWidth: true
|
|
5153
|
-
}, currentValues.map((value, index) => React.createElement(MapLegendItem, {
|
|
5154
|
-
key: "" + value.title + index,
|
|
5155
|
-
title: value.title,
|
|
5156
|
-
value: value.parameterValue,
|
|
5157
|
-
parameter: parameter
|
|
5158
|
-
}, (!index || index === currentValues.length - 1) && value.title)), React.createElement(MapLegendOther, {
|
|
5159
|
-
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
5160
|
-
value: other == null ? void 0 : other.parameterValue,
|
|
5161
|
-
parameter: parameter
|
|
5162
|
-
}, "\u0414\u0440\u0443\u0433\u043E\u0435")) : React.createElement(MapLegendItems, null, currentValues.map((value, index) => React.createElement(MapLegendItem, {
|
|
5163
|
-
key: "" + value.title + index,
|
|
5164
|
-
title: value.title,
|
|
5165
|
-
value: value.parameterValue,
|
|
5166
|
-
parameter: parameter
|
|
5167
|
-
})), React.createElement(MapLegendOther, {
|
|
5168
|
-
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
5169
|
-
value: other == null ? void 0 : other.parameterValue,
|
|
5170
|
-
parameter: parameter
|
|
5171
|
-
})), typeof (other == null ? void 0 : other.parameterValue) === "string" && (titleMax || titleMin) && React.createElement(MapLegendValues, null, React.createElement(MapLegendValuesRange, null, React.createElement("div", null, titleMax), React.createElement("div", null, titleMin)), React.createElement(MapLegendValuesOther, null, "-")));
|
|
5172
|
-
};
|
|
5157
|
+
_this.on('change', _this.updateMeasureResult);
|
|
5173
5158
|
|
|
5174
|
-
|
|
5175
|
-
let {
|
|
5176
|
-
layer,
|
|
5177
|
-
config,
|
|
5178
|
-
className,
|
|
5179
|
-
hideTitle
|
|
5180
|
-
} = _ref;
|
|
5181
|
-
const legend = useMapLegend(layer, config);
|
|
5182
|
-
const [isExpanded, toggleExpanded] = useToggle();
|
|
5159
|
+
_this.on('edit', _this.updateMeasureResult);
|
|
5183
5160
|
|
|
5184
|
-
|
|
5185
|
-
return null;
|
|
5161
|
+
return _this;
|
|
5186
5162
|
}
|
|
5187
5163
|
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
return React.createElement(LegendProvider, {
|
|
5193
|
-
symbol: symbol
|
|
5194
|
-
}, React.createElement(MapLegendControl, {
|
|
5195
|
-
className: className
|
|
5196
|
-
}, !hideTitle && React.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), !!items.length && React.createElement(MapLegendContainer, null, isExpanded ? React.createElement(Legend, {
|
|
5197
|
-
layer: layer,
|
|
5198
|
-
config: config
|
|
5199
|
-
}) : React.createElement(React.Fragment, null, items.map(item => {
|
|
5200
|
-
var _symbol$fill;
|
|
5164
|
+
_createClass(BaseMeasureToolEditor, [{
|
|
5165
|
+
key: "_activate",
|
|
5166
|
+
value: function _activate() {
|
|
5167
|
+
_get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
|
|
5201
5168
|
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5169
|
+
this.addMeasureResultLabel();
|
|
5170
|
+
}
|
|
5171
|
+
}, {
|
|
5172
|
+
key: "addMeasureResultLabel",
|
|
5173
|
+
value: function addMeasureResultLabel() {
|
|
5174
|
+
const measureResult = this.measureResult();
|
|
5175
|
+
if (measureResult === null) return;
|
|
5176
|
+
const {
|
|
5177
|
+
content,
|
|
5178
|
+
position
|
|
5179
|
+
} = measureResult;
|
|
5180
|
+
this.measureResultLabel = new LabelFeature(position, {
|
|
5181
|
+
content,
|
|
5182
|
+
crs: this.map.crs,
|
|
5183
|
+
symbol: createLabelSymbol({
|
|
5184
|
+
onClose: this.removeFeature,
|
|
5185
|
+
renderLabel: this.renderLabelSymbol
|
|
5186
|
+
})
|
|
5187
|
+
});
|
|
5188
|
+
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
5189
|
+
}
|
|
5190
|
+
}, {
|
|
5191
|
+
key: "updateMeasureResult",
|
|
5192
|
+
value: function updateMeasureResult() {
|
|
5193
|
+
if (this.measureResultLabel) {
|
|
5194
|
+
const measureResult = this.measureResult();
|
|
5195
|
+
if (measureResult === null) return;
|
|
5196
|
+
const {
|
|
5197
|
+
content,
|
|
5198
|
+
position
|
|
5199
|
+
} = measureResult;
|
|
5200
|
+
this.measureResultLabel.content = content;
|
|
5201
|
+
this.measureResultLabel.position = position;
|
|
5202
|
+
}
|
|
5203
|
+
}
|
|
5204
|
+
}]);
|
|
5214
5205
|
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
let {
|
|
5218
|
-
value,
|
|
5219
|
-
parameter
|
|
5220
|
-
} = _ref;
|
|
5221
|
-
return React.createElement(LegendSymbol, {
|
|
5222
|
-
key: value.title,
|
|
5223
|
-
parameter: parameter,
|
|
5224
|
-
parameterValue: value.parameterValue
|
|
5225
|
-
}, symbol => React.createElement(Symbol, {
|
|
5226
|
-
render: getMapLegendSymbolRenders,
|
|
5227
|
-
symbol: symbol,
|
|
5228
|
-
size: MAX_SIZE$2
|
|
5229
|
-
}));
|
|
5230
|
-
};
|
|
5206
|
+
return BaseMeasureToolEditor;
|
|
5207
|
+
}(PolyEditor);
|
|
5231
5208
|
|
|
5232
5209
|
let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
5233
5210
|
_inherits(MeasureTool, _React$Component);
|
|
@@ -5417,7 +5394,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
|
5417
5394
|
}(React.Component);
|
|
5418
5395
|
|
|
5419
5396
|
const _excluded$3 = ["isActive"];
|
|
5420
|
-
const Measurer = _ref => {
|
|
5397
|
+
const Measurer = (_ref) => {
|
|
5421
5398
|
let {
|
|
5422
5399
|
isActive
|
|
5423
5400
|
} = _ref,
|
|
@@ -5435,18 +5412,18 @@ const Measurer = _ref => {
|
|
|
5435
5412
|
|
|
5436
5413
|
var _templateObject$7, _templateObject2$7, _templateObject3$5;
|
|
5437
5414
|
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"])));
|
|
5438
|
-
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 => {
|
|
5415
|
+
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) => {
|
|
5439
5416
|
let {
|
|
5440
5417
|
width
|
|
5441
5418
|
} = _ref;
|
|
5442
5419
|
return width + "px";
|
|
5443
5420
|
});
|
|
5444
|
-
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 => {
|
|
5421
|
+
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) => {
|
|
5445
5422
|
let {
|
|
5446
5423
|
alignEnd
|
|
5447
5424
|
} = _ref2;
|
|
5448
5425
|
return alignEnd ? 'flex-end' : 'center';
|
|
5449
|
-
}, _ref3 => {
|
|
5426
|
+
}, (_ref3) => {
|
|
5450
5427
|
let {
|
|
5451
5428
|
width
|
|
5452
5429
|
} = _ref3;
|
|
@@ -5471,7 +5448,7 @@ const ScaleRuler = () => {
|
|
|
5471
5448
|
}, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
|
|
5472
5449
|
};
|
|
5473
5450
|
|
|
5474
|
-
const Zoom = _ref => {
|
|
5451
|
+
const Zoom = (_ref) => {
|
|
5475
5452
|
let {
|
|
5476
5453
|
children
|
|
5477
5454
|
} = _ref;
|
|
@@ -5520,7 +5497,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
|
|
|
5520
5497
|
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));
|
|
5521
5498
|
};
|
|
5522
5499
|
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"])));
|
|
5523
|
-
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 => {
|
|
5500
|
+
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) => {
|
|
5524
5501
|
let {
|
|
5525
5502
|
placement,
|
|
5526
5503
|
distance = '0.5rem',
|
|
@@ -5528,7 +5505,7 @@ const TooltipComponent = /*#__PURE__*/styled.div(_templateObject11$2 || (_templa
|
|
|
5528
5505
|
cornerSize = '0.25rem'
|
|
5529
5506
|
} = _ref;
|
|
5530
5507
|
return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
|
|
5531
|
-
}, _ref2 => {
|
|
5508
|
+
}, (_ref2) => {
|
|
5532
5509
|
let {
|
|
5533
5510
|
withArrow
|
|
5534
5511
|
} = _ref2;
|
|
@@ -5542,7 +5519,7 @@ const {
|
|
|
5542
5519
|
Consumer
|
|
5543
5520
|
} = /*#__PURE__*/createContext([]); // TODO I just cant read that
|
|
5544
5521
|
|
|
5545
|
-
const Tooltip = _ref => {
|
|
5522
|
+
const Tooltip = (_ref) => {
|
|
5546
5523
|
let {
|
|
5547
5524
|
features = [],
|
|
5548
5525
|
map,
|
|
@@ -5581,7 +5558,7 @@ const Noop = () => React.createElement("div", {
|
|
|
5581
5558
|
}
|
|
5582
5559
|
});
|
|
5583
5560
|
|
|
5584
|
-
const DraggableMarker = _ref => {
|
|
5561
|
+
const DraggableMarker = (_ref) => {
|
|
5585
5562
|
let {
|
|
5586
5563
|
position,
|
|
5587
5564
|
onChange,
|
|
@@ -5595,5 +5572,20 @@ const DraggableMarker = _ref => {
|
|
|
5595
5572
|
return React.createElement(Fragment, null);
|
|
5596
5573
|
};
|
|
5597
5574
|
|
|
5575
|
+
const polygonCircleFromPoint = (center, diameter) => {
|
|
5576
|
+
const coordinates = [];
|
|
5577
|
+
const radius = diameter / 2;
|
|
5578
|
+
const endAngle = Math.PI * 2;
|
|
5579
|
+
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
5580
|
+
let start = 0;
|
|
5581
|
+
let end = endAngle;
|
|
5582
|
+
|
|
5583
|
+
for (let ang = start; ang < end; ang += step) {
|
|
5584
|
+
coordinates.push([Math.cos(ang) * radius + center[0], Math.sin(ang) * radius + center[1]]);
|
|
5585
|
+
}
|
|
5586
|
+
|
|
5587
|
+
return [coordinates];
|
|
5588
|
+
};
|
|
5589
|
+
|
|
5598
5590
|
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, MapLegendDescription, MapLegendDescriptionContainer, MapLegendExpandButton, MapLegendHeader, MapLegendItem, MapLegendSymbol, MapLegendValueDescr, MapLegendValues, 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, SizeMinimizedLegendDown, SizeMinimizedLegendUp, 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, isParameterType, 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 };
|
|
5599
5591
|
//# sourceMappingURL=react.esm.js.map
|