@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
|
@@ -27,10 +27,6 @@ var PolylineSymbol = require('@evergis/sgis/es/symbols/PolylineSymbol');
|
|
|
27
27
|
var Poly = require('@evergis/sgis/es/renders/Poly');
|
|
28
28
|
var geotools = require('@evergis/sgis/es/geotools');
|
|
29
29
|
var math = require('@evergis/sgis/es/utils/math');
|
|
30
|
-
var PolylineControl = require('@evergis/sgis/es/controls/PolylineControl');
|
|
31
|
-
var Label = require('@evergis/sgis/es/features/Label');
|
|
32
|
-
var Control = require('@evergis/sgis/es/controls/Control');
|
|
33
|
-
var PolyEditor = require('@evergis/sgis/es/controls/PolyEditor');
|
|
34
30
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
35
31
|
var _Symbol = require('@evergis/sgis/es/symbols/Symbol');
|
|
36
32
|
var Poly$1 = require('@evergis/sgis/es/features/Poly');
|
|
@@ -45,6 +41,7 @@ var H3Symbol = require('@evergis/sgis/es/symbols/H3Symbol');
|
|
|
45
41
|
var H3Feature = require('@evergis/sgis/es/features/H3Feature');
|
|
46
42
|
var Canvas = require('@evergis/sgis/es/painters/DomPainter/Canvas');
|
|
47
43
|
var commonEvents = require('@evergis/sgis/es/commonEvents');
|
|
44
|
+
var Label = require('@evergis/sgis/es/features/Label');
|
|
48
45
|
var ClusterLayer$1 = require('@evergis/sgis/es/layers/ClusterLayer');
|
|
49
46
|
var GridClusterProvider = require('@evergis/sgis/es/layers/clusterProviders/GridClusterProvider');
|
|
50
47
|
var PointEditor = require('@evergis/sgis/es/controls/PointEditor');
|
|
@@ -53,6 +50,9 @@ var styled = require('styled-components');
|
|
|
53
50
|
var styled__default = _interopDefault(styled);
|
|
54
51
|
var punycode = _interopDefault(require('punycode'));
|
|
55
52
|
var TileLayer$1 = require('@evergis/sgis/es/layers/TileLayer');
|
|
53
|
+
var PolylineControl = require('@evergis/sgis/es/controls/PolylineControl');
|
|
54
|
+
var Control = require('@evergis/sgis/es/controls/Control');
|
|
55
|
+
var PolyEditor = require('@evergis/sgis/es/controls/PolyEditor');
|
|
56
56
|
|
|
57
57
|
function _classCallCheck(instance, Constructor) {
|
|
58
58
|
if (!(instance instanceof Constructor)) {
|
|
@@ -73,9 +73,6 @@ function _defineProperties(target, props) {
|
|
|
73
73
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
74
74
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
75
75
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
76
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
77
|
-
writable: false
|
|
78
|
-
});
|
|
79
76
|
return Constructor;
|
|
80
77
|
}
|
|
81
78
|
|
|
@@ -109,9 +106,6 @@ function _inherits(subClass, superClass) {
|
|
|
109
106
|
configurable: true
|
|
110
107
|
}
|
|
111
108
|
});
|
|
112
|
-
Object.defineProperty(subClass, "prototype", {
|
|
113
|
-
writable: false
|
|
114
|
-
});
|
|
115
109
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
116
110
|
}
|
|
117
111
|
|
|
@@ -170,8 +164,6 @@ function _assertThisInitialized(self) {
|
|
|
170
164
|
function _possibleConstructorReturn(self, call) {
|
|
171
165
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
172
166
|
return call;
|
|
173
|
-
} else if (call !== void 0) {
|
|
174
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
175
167
|
}
|
|
176
168
|
|
|
177
169
|
return _assertThisInitialized(self);
|
|
@@ -205,7 +197,7 @@ function _superPropBase(object, property) {
|
|
|
205
197
|
return object;
|
|
206
198
|
}
|
|
207
199
|
|
|
208
|
-
function _get() {
|
|
200
|
+
function _get(target, property, receiver) {
|
|
209
201
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
210
202
|
_get = Reflect.get;
|
|
211
203
|
} else {
|
|
@@ -216,14 +208,14 @@ function _get() {
|
|
|
216
208
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
217
209
|
|
|
218
210
|
if (desc.get) {
|
|
219
|
-
return desc.get.call(
|
|
211
|
+
return desc.get.call(receiver);
|
|
220
212
|
}
|
|
221
213
|
|
|
222
214
|
return desc.value;
|
|
223
215
|
};
|
|
224
216
|
}
|
|
225
217
|
|
|
226
|
-
return _get
|
|
218
|
+
return _get(target, property, receiver || target);
|
|
227
219
|
}
|
|
228
220
|
|
|
229
221
|
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
@@ -252,7 +244,7 @@ const defaultApi = /*#__PURE__*/new api.Api({
|
|
|
252
244
|
url: BASE_URL
|
|
253
245
|
});
|
|
254
246
|
const evergisContext = /*#__PURE__*/React.createContext(defaultApi);
|
|
255
|
-
const EvergisProvider = _ref => {
|
|
247
|
+
const EvergisProvider = (_ref) => {
|
|
256
248
|
let {
|
|
257
249
|
api,
|
|
258
250
|
children
|
|
@@ -270,7 +262,7 @@ const mapContext = /*#__PURE__*/React.createContext({
|
|
|
270
262
|
map: defaultMap,
|
|
271
263
|
painter: defaultPainter
|
|
272
264
|
});
|
|
273
|
-
const MapProvider = _ref => {
|
|
265
|
+
const MapProvider = (_ref) => {
|
|
274
266
|
let {
|
|
275
267
|
map,
|
|
276
268
|
painter,
|
|
@@ -292,7 +284,7 @@ const tooltipContext = /*#__PURE__*/React.createContext({
|
|
|
292
284
|
layer: defaultLayer,
|
|
293
285
|
popupLayer: defaultPopupLayer
|
|
294
286
|
});
|
|
295
|
-
const TooltipProvider = _ref => {
|
|
287
|
+
const TooltipProvider = (_ref) => {
|
|
296
288
|
let {
|
|
297
289
|
layer,
|
|
298
290
|
popupLayer,
|
|
@@ -309,7 +301,7 @@ const TooltipProvider = _ref => {
|
|
|
309
301
|
const useTooltipContext = () => React.useContext(tooltipContext);
|
|
310
302
|
|
|
311
303
|
const LegendContext = /*#__PURE__*/React.createContext(null);
|
|
312
|
-
const LegendProvider = _ref => {
|
|
304
|
+
const LegendProvider = (_ref) => {
|
|
313
305
|
let {
|
|
314
306
|
symbol,
|
|
315
307
|
children
|
|
@@ -321,7 +313,7 @@ const LegendProvider = _ref => {
|
|
|
321
313
|
const useLegendContext = () => React.useContext(LegendContext);
|
|
322
314
|
|
|
323
315
|
const evergisSelectContext = /*#__PURE__*/React.createContext([]);
|
|
324
|
-
const EvergisSelectProvider = _ref => {
|
|
316
|
+
const EvergisSelectProvider = (_ref) => {
|
|
325
317
|
let {
|
|
326
318
|
layers,
|
|
327
319
|
children
|
|
@@ -366,7 +358,7 @@ function useMapViewActions() {
|
|
|
366
358
|
}, [map]);
|
|
367
359
|
const zoomIn = React.useCallback(() => zoomTo(1), [zoomTo]);
|
|
368
360
|
const zoomOut = React.useCallback(() => zoomTo(-1), [zoomTo]);
|
|
369
|
-
const animateTo = React.useCallback(_ref => {
|
|
361
|
+
const animateTo = React.useCallback((_ref) => {
|
|
370
362
|
let {
|
|
371
363
|
position,
|
|
372
364
|
resolution,
|
|
@@ -396,7 +388,7 @@ function useMapViewActions() {
|
|
|
396
388
|
const {
|
|
397
389
|
tileScheme
|
|
398
390
|
} = map;
|
|
399
|
-
let tileLevel = tileScheme.levels.find(_ref2 => {
|
|
391
|
+
let tileLevel = tileScheme.levels.find((_ref2) => {
|
|
400
392
|
let {
|
|
401
393
|
zIndex
|
|
402
394
|
} = _ref2;
|
|
@@ -572,7 +564,7 @@ const formatStringAttribute = value => {
|
|
|
572
564
|
|
|
573
565
|
const attributeValues = value.split(/[\s|]/).map(convertStringAttribute);
|
|
574
566
|
|
|
575
|
-
if (attributeValues.every(_ref => {
|
|
567
|
+
if (attributeValues.every((_ref) => {
|
|
576
568
|
let {
|
|
577
569
|
type
|
|
578
570
|
} = _ref;
|
|
@@ -580,7 +572,7 @@ const formatStringAttribute = value => {
|
|
|
580
572
|
}
|
|
581
573
|
/* String */
|
|
582
574
|
)) {
|
|
583
|
-
return [stringAttribute(attributeValues.map(_ref2 => {
|
|
575
|
+
return [stringAttribute(attributeValues.map((_ref2) => {
|
|
584
576
|
let {
|
|
585
577
|
value
|
|
586
578
|
} = _ref2;
|
|
@@ -1057,7 +1049,7 @@ const getFeatureAttributeType = attributeValue => {
|
|
|
1057
1049
|
};
|
|
1058
1050
|
const getLayerAttributes = layerDefinition => {
|
|
1059
1051
|
const attributes = layerDefinition && layerDefinition.attributes || {};
|
|
1060
|
-
return Object.entries(attributes).map(_ref => {
|
|
1052
|
+
return Object.entries(attributes).map((_ref) => {
|
|
1061
1053
|
let [name, definition] = _ref;
|
|
1062
1054
|
return _extends({
|
|
1063
1055
|
name
|
|
@@ -1065,7 +1057,7 @@ const getLayerAttributes = layerDefinition => {
|
|
|
1065
1057
|
});
|
|
1066
1058
|
};
|
|
1067
1059
|
const getFeatureAttributes = attributes => {
|
|
1068
|
-
return attributes ? Object.entries(attributes).map(_ref2 => {
|
|
1060
|
+
return attributes ? Object.entries(attributes).map((_ref2) => {
|
|
1069
1061
|
let [name, value] = _ref2;
|
|
1070
1062
|
return {
|
|
1071
1063
|
name,
|
|
@@ -1083,7 +1075,7 @@ const getClassificationAttribute = (attributeName, attributes) => {
|
|
|
1083
1075
|
return attribute ? _extends({}, attrNamePart, attribute) : attrNamePart;
|
|
1084
1076
|
};
|
|
1085
1077
|
const mergeAttributes = (attributes1, attributes2) => {
|
|
1086
|
-
return attributes1.map(attribute => _extends({}, attribute, attributes2.find(_ref3 => {
|
|
1078
|
+
return attributes1.map(attribute => _extends({}, attribute, attributes2.find((_ref3) => {
|
|
1087
1079
|
let {
|
|
1088
1080
|
name
|
|
1089
1081
|
} = _ref3;
|
|
@@ -1498,7 +1490,7 @@ let SGisPolygonSymbol = /*#__PURE__*/function (_sPolygonSymbol) {
|
|
|
1498
1490
|
const adaptMiterRings = (rings, resolution, fromCrs, toCrs) => {
|
|
1499
1491
|
const projected = geotools.projectRings(rings, fromCrs, toCrs);
|
|
1500
1492
|
return math.simplifyCoordinates(projected.map(ring => // @ts-ignore
|
|
1501
|
-
ring.map(_ref => {
|
|
1493
|
+
ring.map((_ref) => {
|
|
1502
1494
|
let [x, y] = _ref;
|
|
1503
1495
|
return [x / resolution, y / -resolution];
|
|
1504
1496
|
})), 1);
|
|
@@ -1590,1677 +1582,1325 @@ let ArrowLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
|
1590
1582
|
return ArrowLineMiterRender;
|
|
1591
1583
|
}(LineMiterRender);
|
|
1592
1584
|
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
length: formatLength
|
|
1596
|
-
};
|
|
1597
|
-
|
|
1598
|
-
const COORD_FRACTION = 6;
|
|
1599
|
-
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
1600
|
-
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
1601
|
-
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
1602
|
-
|
|
1603
|
-
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
1585
|
+
let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1586
|
+
_inherits(CircleLineMiterRender, _LineMiterRender);
|
|
1604
1587
|
|
|
1605
|
-
|
|
1606
|
-
var _this;
|
|
1588
|
+
var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
|
|
1607
1589
|
|
|
1608
|
-
|
|
1590
|
+
function CircleLineMiterRender() {
|
|
1591
|
+
_classCallCheck(this, CircleLineMiterRender);
|
|
1609
1592
|
|
|
1610
|
-
|
|
1593
|
+
return _super.apply(this, arguments);
|
|
1594
|
+
}
|
|
1611
1595
|
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1596
|
+
_createClass(CircleLineMiterRender, [{
|
|
1597
|
+
key: "usageSize",
|
|
1598
|
+
get: function get() {
|
|
1599
|
+
return this.miterSize + this.strokeWidth * 3;
|
|
1600
|
+
}
|
|
1601
|
+
}, {
|
|
1602
|
+
key: "createRings",
|
|
1603
|
+
value: function createRings(_ref, xMultiplier) {
|
|
1604
|
+
let [x, y] = _ref;
|
|
1605
|
+
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1606
|
+
}
|
|
1607
|
+
}, {
|
|
1608
|
+
key: "createRender",
|
|
1609
|
+
value: function createRender(miterRings) {
|
|
1610
|
+
const isFilled = this.kind === exports.LineMiterKind.FilledCircle;
|
|
1611
|
+
return new Poly.PolyRender(polygonCircleFromPoint(miterRings[0][0], this.miterSize), {
|
|
1612
|
+
fillColor: isFilled ? this.color : 'transparent',
|
|
1613
|
+
strokeColor: this.color,
|
|
1614
|
+
strokeWidth: this.strokeWidth,
|
|
1615
|
+
enclosed: true
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
}]);
|
|
1615
1619
|
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1619
|
-
_this.areaSymbol = params.areaSymbol;
|
|
1620
|
+
return CircleLineMiterRender;
|
|
1621
|
+
}(LineMiterRender);
|
|
1620
1622
|
|
|
1621
|
-
|
|
1623
|
+
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1624
|
+
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1622
1625
|
|
|
1626
|
+
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1623
1627
|
|
|
1624
|
-
|
|
1628
|
+
function SquareLineMiterRender() {
|
|
1629
|
+
_classCallCheck(this, SquareLineMiterRender);
|
|
1625
1630
|
|
|
1626
|
-
return
|
|
1631
|
+
return _super.apply(this, arguments);
|
|
1627
1632
|
}
|
|
1628
1633
|
|
|
1629
|
-
_createClass(
|
|
1630
|
-
key: "
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
this.drawPointOnMouseMove(event);
|
|
1634
|
+
_createClass(SquareLineMiterRender, [{
|
|
1635
|
+
key: "usageSize",
|
|
1636
|
+
get: function get() {
|
|
1637
|
+
return this.miterSize + this.strokeWidth;
|
|
1635
1638
|
}
|
|
1636
1639
|
}, {
|
|
1637
|
-
key: "
|
|
1638
|
-
value: function
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
this.addTempLabel();
|
|
1642
|
-
this.setCursor('pointer');
|
|
1640
|
+
key: "createRings",
|
|
1641
|
+
value: function createRings(_ref, xMultiplier) {
|
|
1642
|
+
let [x, y] = _ref;
|
|
1643
|
+
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]]];
|
|
1643
1644
|
}
|
|
1644
1645
|
}, {
|
|
1645
|
-
key: "
|
|
1646
|
-
value: function
|
|
1647
|
-
|
|
1646
|
+
key: "createRender",
|
|
1647
|
+
value: function createRender(miterRings) {
|
|
1648
|
+
const isFilled = this.kind === exports.LineMiterKind.FilledSquare;
|
|
1649
|
+
return new Poly.PolyRender(miterRings, {
|
|
1650
|
+
enclosed: true,
|
|
1651
|
+
fillColor: isFilled ? this.color : void 0,
|
|
1652
|
+
fillStyle: isFilled ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
1653
|
+
lineCap: 'square',
|
|
1654
|
+
lineJoin: 'miter',
|
|
1655
|
+
strokeColor: this.color,
|
|
1656
|
+
strokeWidth: this.strokeWidth
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
}]);
|
|
1648
1660
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1661
|
+
return SquareLineMiterRender;
|
|
1662
|
+
}(LineMiterRender);
|
|
1663
|
+
|
|
1664
|
+
const getLineMiterRender = options => {
|
|
1665
|
+
switch (options.kind) {
|
|
1666
|
+
case exports.LineMiterKind.Arrow:
|
|
1667
|
+
case exports.LineMiterKind.FilledArrow:
|
|
1668
|
+
return new ArrowLineMiterRender(options);
|
|
1669
|
+
|
|
1670
|
+
case exports.LineMiterKind.Square:
|
|
1671
|
+
case exports.LineMiterKind.FilledSquare:
|
|
1672
|
+
return new SquareLineMiterRender(options);
|
|
1673
|
+
|
|
1674
|
+
case exports.LineMiterKind.Circle:
|
|
1675
|
+
case exports.LineMiterKind.FilledCircle:
|
|
1676
|
+
return new CircleLineMiterRender(options);
|
|
1677
|
+
|
|
1678
|
+
default:
|
|
1679
|
+
return null;
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
1682
|
+
|
|
1683
|
+
const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
|
|
1684
|
+
const reversedRing = ring.slice().reverse();
|
|
1685
|
+
|
|
1686
|
+
for (let i = 0; i < reversedRing.length; i++) {
|
|
1687
|
+
const coordinates = reversedRing[i];
|
|
1688
|
+
|
|
1689
|
+
if (isLastRing && i === 0) {
|
|
1690
|
+
reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
|
|
1654
1691
|
}
|
|
1655
|
-
}, {
|
|
1656
|
-
key: "handlePointAdd",
|
|
1657
|
-
value: function handlePointAdd() {
|
|
1658
|
-
const feature = this.activeFeature;
|
|
1659
|
-
if (!feature) return;
|
|
1660
|
-
const {
|
|
1661
|
-
rings,
|
|
1662
|
-
crs
|
|
1663
|
-
} = feature;
|
|
1664
1692
|
|
|
1665
|
-
|
|
1666
|
-
this.finishDrawing();
|
|
1667
|
-
this.fire(new Control.DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
1668
|
-
return;
|
|
1669
|
-
}
|
|
1693
|
+
const nextCoordinates = reversedRing[i - 1];
|
|
1670
1694
|
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
const point = rings[0][0];
|
|
1674
|
-
if (!projection) return;
|
|
1675
|
-
const [lat, long] = projection(point);
|
|
1676
|
-
this.removeTempLabel();
|
|
1677
|
-
this.addMeasureResultLabel();
|
|
1678
|
-
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
1679
|
-
} else {
|
|
1680
|
-
this.removeCoordLabel();
|
|
1681
|
-
}
|
|
1695
|
+
if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
|
|
1696
|
+
reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
|
|
1682
1697
|
}
|
|
1683
|
-
}
|
|
1684
|
-
key: "polygonPreview",
|
|
1685
|
-
value: function polygonPreview() {
|
|
1686
|
-
if (this.tempPolygon) {
|
|
1687
|
-
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
1688
|
-
}
|
|
1698
|
+
}
|
|
1689
1699
|
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
1702
|
-
this.activeFeature && this.activeFeature.hide();
|
|
1703
|
-
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
1700
|
+
return reversedRing.reverse();
|
|
1701
|
+
};
|
|
1702
|
+
|
|
1703
|
+
const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
|
|
1704
|
+
const newRing = ring.slice();
|
|
1705
|
+
|
|
1706
|
+
for (let i = 0; i < newRing.length; i++) {
|
|
1707
|
+
const coordinates = newRing[i];
|
|
1708
|
+
|
|
1709
|
+
if (i === 0 && isFirstRing) {
|
|
1710
|
+
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
1704
1711
|
}
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
delete this.tempPolygon;
|
|
1711
|
-
}
|
|
1712
|
+
|
|
1713
|
+
const prevCoordinates = newRing[i - 1];
|
|
1714
|
+
|
|
1715
|
+
if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
|
|
1716
|
+
newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
|
|
1712
1717
|
}
|
|
1713
|
-
}
|
|
1714
|
-
key: "updateDistance",
|
|
1715
|
-
value: function updateDistance(event) {
|
|
1716
|
-
const feature = this.activeFeature;
|
|
1717
|
-
const {
|
|
1718
|
-
ringIndex,
|
|
1719
|
-
pointIndex
|
|
1720
|
-
} = event;
|
|
1721
|
-
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
1722
|
-
const {
|
|
1723
|
-
rings,
|
|
1724
|
-
crs
|
|
1725
|
-
} = feature;
|
|
1726
|
-
const position = rings[ringIndex][pointIndex];
|
|
1727
|
-
const length = geotools.length(rings, crs);
|
|
1728
|
-
let content = this.formatters.length(length);
|
|
1718
|
+
}
|
|
1729
1719
|
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
const area = geotools.area(rings, crs);
|
|
1733
|
-
content = this.formatters.polygon(area, length);
|
|
1734
|
-
} else if (this.tempPolygon) {
|
|
1735
|
-
feature.show();
|
|
1736
|
-
this.removeTempPolygon();
|
|
1737
|
-
}
|
|
1720
|
+
return newRing;
|
|
1721
|
+
};
|
|
1738
1722
|
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1723
|
+
const updateRingsForMiter = (rings, position, miterSize) => {
|
|
1724
|
+
return rings.map((ring, ringIndex) => {
|
|
1725
|
+
switch (position) {
|
|
1726
|
+
case 'right':
|
|
1727
|
+
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
1728
|
+
|
|
1729
|
+
default:
|
|
1730
|
+
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
1743
1731
|
}
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1732
|
+
});
|
|
1733
|
+
};
|
|
1734
|
+
|
|
1735
|
+
const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
|
|
1736
|
+
let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
|
|
1737
|
+
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
1738
|
+
|
|
1739
|
+
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
1740
|
+
|
|
1741
|
+
function SGisPolylineSymbol(originalSymbol) {
|
|
1742
|
+
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
1743
|
+
|
|
1744
|
+
var _this;
|
|
1745
|
+
|
|
1746
|
+
_classCallCheck(this, SGisPolylineSymbol);
|
|
1747
|
+
|
|
1748
|
+
_this = _super.call(this, {
|
|
1749
|
+
// @ts-ignore
|
|
1750
|
+
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
1751
|
+
strokeWidth: clamp( // @ts-ignore
|
|
1752
|
+
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
1753
|
+
// @ts-ignore
|
|
1754
|
+
lineDash: getLineDash(originalSymbol.stroke),
|
|
1755
|
+
// @ts-ignore
|
|
1756
|
+
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
1757
|
+
});
|
|
1758
|
+
_this.originalSymbol = originalSymbol;
|
|
1759
|
+
return _this;
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
_createClass(SGisPolylineSymbol, [{
|
|
1763
|
+
key: "renderFunction",
|
|
1764
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
1765
|
+
if (!isSimplePolylineSymbol(this.originalSymbol)) return _get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, feature, resolution, crs);
|
|
1766
|
+
const {
|
|
1767
|
+
ending,
|
|
1768
|
+
beginningSize,
|
|
1769
|
+
beginning,
|
|
1770
|
+
endingSize
|
|
1771
|
+
} = this.originalSymbol;
|
|
1772
|
+
const renders = [];
|
|
1773
|
+
const featureCopy = feature.clone();
|
|
1774
|
+
const beginningMiterRender = getLineMiterRender({
|
|
1775
|
+
color: this.strokeColor,
|
|
1776
|
+
// @ts-ignore
|
|
1777
|
+
kind: beginning,
|
|
1778
|
+
position: 'left',
|
|
1779
|
+
// @ts-ignore
|
|
1780
|
+
size: beginningSize,
|
|
1781
|
+
strokeWidth: this.strokeWidth
|
|
1766
1782
|
});
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
renderLabel: this.renderLabelSymbol
|
|
1776
|
-
})
|
|
1783
|
+
const endingMiterRender = getLineMiterRender({
|
|
1784
|
+
color: this.strokeColor,
|
|
1785
|
+
// @ts-ignore
|
|
1786
|
+
kind: ending,
|
|
1787
|
+
position: 'right',
|
|
1788
|
+
// @ts-ignore
|
|
1789
|
+
size: endingSize,
|
|
1790
|
+
strokeWidth: this.strokeWidth
|
|
1777
1791
|
});
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
1785
|
-
delete this.tempLabel;
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
}, {
|
|
1789
|
-
key: "removeCoordLabel",
|
|
1790
|
-
value: function removeCoordLabel() {
|
|
1791
|
-
if (this.coordLabel) {
|
|
1792
|
-
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
1793
|
-
delete this.coordLabel;
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
}, {
|
|
1797
|
-
key: "removeMeasureLabel",
|
|
1798
|
-
value: function removeMeasureLabel() {
|
|
1799
|
-
if (this.measureResultLabel) {
|
|
1800
|
-
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
1801
|
-
delete this.measureResultLabel;
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
}, {
|
|
1805
|
-
key: "drawPointOnMouseMove",
|
|
1806
|
-
value: function drawPointOnMouseMove(event) {
|
|
1807
|
-
if (this.tempLabel) {
|
|
1808
|
-
this.tempLabel.position = event.point.position;
|
|
1792
|
+
|
|
1793
|
+
if (beginningMiterRender) {
|
|
1794
|
+
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
1795
|
+
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
1796
|
+
featureCopy.rings = updatedRings;
|
|
1797
|
+
renders.push(render);
|
|
1809
1798
|
}
|
|
1799
|
+
|
|
1800
|
+
if (endingMiterRender) {
|
|
1801
|
+
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
1802
|
+
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
1803
|
+
featureCopy.rings = updatedRings;
|
|
1804
|
+
renders.push(render);
|
|
1805
|
+
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
1809
|
+
return renders;
|
|
1810
1810
|
}
|
|
1811
1811
|
}, {
|
|
1812
|
-
key: "
|
|
1813
|
-
value: function
|
|
1814
|
-
|
|
1815
|
-
wrapper
|
|
1816
|
-
} = this.painter;
|
|
1817
|
-
|
|
1818
|
-
if (wrapper && typeof wrapper !== 'string') {
|
|
1819
|
-
wrapper.style.cursor = cursor;
|
|
1820
|
-
}
|
|
1812
|
+
key: "clone",
|
|
1813
|
+
value: function clone() {
|
|
1814
|
+
return new SGisPolylineSymbol(this.originalSymbol);
|
|
1821
1815
|
}
|
|
1822
1816
|
}]);
|
|
1823
1817
|
|
|
1824
|
-
return
|
|
1825
|
-
}(
|
|
1818
|
+
return SGisPolylineSymbol;
|
|
1819
|
+
}(PolylineSymbol.PolylineSymbol);
|
|
1826
1820
|
|
|
1827
|
-
let
|
|
1828
|
-
_inherits(
|
|
1821
|
+
let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
|
|
1822
|
+
_inherits(LabelSymbol, _DynamicPointSymbol);
|
|
1829
1823
|
|
|
1830
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
1824
|
+
var _super = /*#__PURE__*/_createSuper(LabelSymbol);
|
|
1831
1825
|
|
|
1832
|
-
function
|
|
1826
|
+
function LabelSymbol(_temp) {
|
|
1833
1827
|
var _this;
|
|
1834
1828
|
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
_this.measureResult = () => {
|
|
1840
|
-
const feature = _this.activeFeature;
|
|
1841
|
-
if (!feature) return null;
|
|
1842
|
-
const {
|
|
1843
|
-
rings,
|
|
1844
|
-
isEnclosed,
|
|
1845
|
-
crs
|
|
1846
|
-
} = feature;
|
|
1847
|
-
const pointsCount = rings[0].length;
|
|
1848
|
-
const position = rings[0][pointsCount - 1];
|
|
1849
|
-
const area = geotools.area(rings, crs);
|
|
1850
|
-
const length = geotools.length(rings, crs, isEnclosed);
|
|
1851
|
-
const content = isEnclosed ? _this.formatters.polygon(area, length) : _this.formatters.length(length);
|
|
1852
|
-
return {
|
|
1853
|
-
content,
|
|
1854
|
-
position
|
|
1855
|
-
};
|
|
1856
|
-
};
|
|
1857
|
-
|
|
1858
|
-
_this.removeFeature = () => {
|
|
1859
|
-
_this.fire('remove');
|
|
1860
|
-
};
|
|
1861
|
-
|
|
1862
|
-
_this.painter = painter;
|
|
1863
|
-
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
1864
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1865
|
-
|
|
1866
|
-
_this.on('change', _this.updateMeasureResult);
|
|
1829
|
+
let {
|
|
1830
|
+
component,
|
|
1831
|
+
offset
|
|
1832
|
+
} = _temp === void 0 ? {} : _temp;
|
|
1867
1833
|
|
|
1868
|
-
|
|
1834
|
+
_classCallCheck(this, LabelSymbol);
|
|
1869
1835
|
|
|
1836
|
+
_this = _super.call(this, {
|
|
1837
|
+
offset
|
|
1838
|
+
});
|
|
1839
|
+
_this.component = component;
|
|
1870
1840
|
return _this;
|
|
1871
1841
|
}
|
|
1872
1842
|
|
|
1873
|
-
_createClass(
|
|
1874
|
-
key: "
|
|
1875
|
-
value: function
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1843
|
+
_createClass(LabelSymbol, [{
|
|
1844
|
+
key: "_getFeatureNode",
|
|
1845
|
+
value: function _getFeatureNode(feature) {
|
|
1846
|
+
const node = document.createElement('div');
|
|
1847
|
+
this.renderDom(feature.content, node);
|
|
1848
|
+
return node;
|
|
1879
1849
|
}
|
|
1880
1850
|
}, {
|
|
1881
|
-
key: "
|
|
1882
|
-
value: function
|
|
1883
|
-
|
|
1884
|
-
if (measureResult === null) return;
|
|
1885
|
-
const {
|
|
1886
|
-
content,
|
|
1887
|
-
position
|
|
1888
|
-
} = measureResult;
|
|
1889
|
-
this.measureResultLabel = new Label.LabelFeature(position, {
|
|
1890
|
-
content,
|
|
1891
|
-
crs: this.map.crs,
|
|
1892
|
-
symbol: createLabelSymbol({
|
|
1893
|
-
onClose: this.removeFeature,
|
|
1894
|
-
renderLabel: this.renderLabelSymbol
|
|
1895
|
-
})
|
|
1896
|
-
});
|
|
1897
|
-
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
1851
|
+
key: "_updateFeatureNode",
|
|
1852
|
+
value: function _updateFeatureNode(feature) {
|
|
1853
|
+
this.renderDom(feature.content, this.getNode(feature));
|
|
1898
1854
|
}
|
|
1899
1855
|
}, {
|
|
1900
|
-
key: "
|
|
1901
|
-
value: function
|
|
1902
|
-
if (
|
|
1903
|
-
|
|
1904
|
-
if (measureResult === null) return;
|
|
1905
|
-
const {
|
|
1906
|
-
content,
|
|
1907
|
-
position
|
|
1908
|
-
} = measureResult;
|
|
1909
|
-
this.measureResultLabel.content = content;
|
|
1910
|
-
this.measureResultLabel.position = position;
|
|
1856
|
+
key: "renderDom",
|
|
1857
|
+
value: function renderDom(content, node) {
|
|
1858
|
+
if (!node) {
|
|
1859
|
+
return;
|
|
1911
1860
|
}
|
|
1912
|
-
}
|
|
1913
|
-
}]);
|
|
1914
1861
|
|
|
1915
|
-
|
|
1916
|
-
}(PolyEditor.PolyEditor);
|
|
1862
|
+
const Component = this.component;
|
|
1917
1863
|
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
|
|
1928
|
-
const widthDistance = geotools.distance(zeroPoint, maxWidthPoint);
|
|
1929
|
-
const pxK = width / (widthDistance || 1);
|
|
1930
|
-
return Math.round(meters * pxK);
|
|
1931
|
-
};
|
|
1932
|
-
|
|
1933
|
-
const polygonCircleFromPoint = (center, diameter) => {
|
|
1934
|
-
const coordinates = [];
|
|
1935
|
-
const radius = diameter / 2;
|
|
1936
|
-
const endAngle = Math.PI * 2;
|
|
1937
|
-
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
1938
|
-
let start = 0;
|
|
1939
|
-
let end = endAngle;
|
|
1864
|
+
if (Component) {
|
|
1865
|
+
ReactDOM.render(React__default.createElement(Component, {
|
|
1866
|
+
content: content
|
|
1867
|
+
}), node);
|
|
1868
|
+
} else {
|
|
1869
|
+
node.innerText = content;
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
}]);
|
|
1940
1873
|
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
}
|
|
1874
|
+
return LabelSymbol;
|
|
1875
|
+
}(_Symbol.DynamicPointSymbol);
|
|
1944
1876
|
|
|
1945
|
-
|
|
1877
|
+
const defaultOffset = [8, -16];
|
|
1878
|
+
const createLabelSymbol = props => {
|
|
1879
|
+
const {
|
|
1880
|
+
offset = defaultOffset,
|
|
1881
|
+
renderLabel = (_ref) => {
|
|
1882
|
+
let {
|
|
1883
|
+
content
|
|
1884
|
+
} = _ref;
|
|
1885
|
+
return React__default.createElement("div", null, content);
|
|
1886
|
+
},
|
|
1887
|
+
onClose = undefined
|
|
1888
|
+
} = props || {};
|
|
1889
|
+
return new LabelSymbol({
|
|
1890
|
+
offset,
|
|
1891
|
+
component: (_ref2) => {
|
|
1892
|
+
let {
|
|
1893
|
+
content
|
|
1894
|
+
} = _ref2;
|
|
1895
|
+
return renderLabel({
|
|
1896
|
+
content,
|
|
1897
|
+
onClose
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
});
|
|
1946
1901
|
};
|
|
1947
1902
|
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1903
|
+
function createShadowRender(position, _ref) {
|
|
1904
|
+
let {
|
|
1905
|
+
strokeWidth = 2,
|
|
1906
|
+
shadowColor,
|
|
1907
|
+
shadowSize,
|
|
1908
|
+
size = 6
|
|
1909
|
+
} = _ref;
|
|
1910
|
+
const shadowDiameter = size + strokeWidth + shadowSize;
|
|
1911
|
+
return new Poly.PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
|
|
1912
|
+
fillColor: 'transparent',
|
|
1913
|
+
strokeColor: shadowColor,
|
|
1914
|
+
strokeWidth: shadowSize,
|
|
1915
|
+
enclosed: true
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
function getEditorPointRenderer(position, _ref2) {
|
|
1919
|
+
let {
|
|
1920
|
+
strokeColor,
|
|
1921
|
+
strokeWidth,
|
|
1922
|
+
shadowColor,
|
|
1923
|
+
fillColor,
|
|
1924
|
+
shadowSize,
|
|
1925
|
+
size = 0
|
|
1926
|
+
} = _ref2;
|
|
1927
|
+
return [createShadowRender(position, {
|
|
1928
|
+
strokeWidth,
|
|
1929
|
+
strokeColor,
|
|
1930
|
+
shadowSize,
|
|
1931
|
+
shadowColor,
|
|
1932
|
+
size
|
|
1933
|
+
}), new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
1934
|
+
fillColor,
|
|
1935
|
+
strokeColor,
|
|
1936
|
+
strokeWidth,
|
|
1937
|
+
enclosed: true
|
|
1938
|
+
})];
|
|
1939
|
+
}
|
|
1959
1940
|
|
|
1960
|
-
let
|
|
1961
|
-
_inherits(
|
|
1941
|
+
let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
|
|
1942
|
+
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
1962
1943
|
|
|
1963
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
1944
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
|
|
1964
1945
|
|
|
1965
|
-
|
|
1966
|
-
|
|
1946
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
1947
|
+
function ShadowedPointSymbol(options) {
|
|
1948
|
+
_classCallCheck(this, ShadowedPointSymbol);
|
|
1967
1949
|
|
|
1968
|
-
return _super.
|
|
1950
|
+
return _super.call(this, options);
|
|
1969
1951
|
}
|
|
1970
1952
|
|
|
1971
|
-
_createClass(
|
|
1972
|
-
key: "
|
|
1973
|
-
|
|
1974
|
-
|
|
1953
|
+
_createClass(ShadowedPointSymbol, [{
|
|
1954
|
+
key: "renderFunction",
|
|
1955
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
1956
|
+
if (!(feature instanceof PointFeature.PointFeature)) return [];
|
|
1957
|
+
const {
|
|
1958
|
+
position
|
|
1959
|
+
} = feature.projectTo(crs);
|
|
1960
|
+
const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
|
|
1961
|
+
const shadowRender = this.getShadow(pxPosition, feature);
|
|
1962
|
+
const pointArc = this.getPoint(pxPosition, feature);
|
|
1963
|
+
return shadowRender ? [shadowRender, pointArc] : [pointArc];
|
|
1975
1964
|
}
|
|
1976
1965
|
}, {
|
|
1977
|
-
key: "
|
|
1978
|
-
value: function
|
|
1979
|
-
|
|
1980
|
-
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1966
|
+
key: "getShadow",
|
|
1967
|
+
value: function getShadow(position, _feature) {
|
|
1968
|
+
return ShadowedPointSymbol.getShadowArc(position, this);
|
|
1981
1969
|
}
|
|
1982
1970
|
}, {
|
|
1983
|
-
key: "
|
|
1984
|
-
value: function
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1971
|
+
key: "getPoint",
|
|
1972
|
+
value: function getPoint(position, _feature) {
|
|
1973
|
+
return ShadowedPointSymbol.getPointArc(position, this);
|
|
1974
|
+
}
|
|
1975
|
+
}], [{
|
|
1976
|
+
key: "getShadowArc",
|
|
1977
|
+
value: function getShadowArc(position, _ref) {
|
|
1978
|
+
let {
|
|
1979
|
+
strokeWidth = 2,
|
|
1980
|
+
shadowColor,
|
|
1981
|
+
shadowSize,
|
|
1982
|
+
size = 6
|
|
1983
|
+
} = _ref;
|
|
1984
|
+
return new Poly.PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
|
|
1985
|
+
fillColor: 'transparent',
|
|
1986
|
+
strokeColor: shadowColor,
|
|
1987
|
+
strokeWidth: shadowSize,
|
|
1990
1988
|
enclosed: true
|
|
1991
1989
|
});
|
|
1992
1990
|
}
|
|
1993
|
-
}]);
|
|
1994
|
-
|
|
1995
|
-
return CircleLineMiterRender;
|
|
1996
|
-
}(LineMiterRender);
|
|
1997
|
-
|
|
1998
|
-
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1999
|
-
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
2000
|
-
|
|
2001
|
-
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
2002
|
-
|
|
2003
|
-
function SquareLineMiterRender() {
|
|
2004
|
-
_classCallCheck(this, SquareLineMiterRender);
|
|
2005
|
-
|
|
2006
|
-
return _super.apply(this, arguments);
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
_createClass(SquareLineMiterRender, [{
|
|
2010
|
-
key: "usageSize",
|
|
2011
|
-
get: function get() {
|
|
2012
|
-
return this.miterSize + this.strokeWidth;
|
|
2013
|
-
}
|
|
2014
1991
|
}, {
|
|
2015
|
-
key: "
|
|
2016
|
-
value: function
|
|
2017
|
-
let
|
|
2018
|
-
|
|
1992
|
+
key: "getPointArc",
|
|
1993
|
+
value: function getPointArc(position, _ref2) {
|
|
1994
|
+
let {
|
|
1995
|
+
strokeWidth,
|
|
1996
|
+
fillColor,
|
|
1997
|
+
strokeColor,
|
|
1998
|
+
size = 6
|
|
1999
|
+
} = _ref2;
|
|
2000
|
+
return new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
2001
|
+
fillColor,
|
|
2002
|
+
strokeColor,
|
|
2003
|
+
strokeWidth,
|
|
2004
|
+
enclosed: true
|
|
2005
|
+
});
|
|
2019
2006
|
}
|
|
2020
2007
|
}, {
|
|
2021
|
-
key: "
|
|
2022
|
-
value: function
|
|
2023
|
-
const
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
fillColor: isFilled ? this.color : void 0,
|
|
2027
|
-
fillStyle: isFilled ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
2028
|
-
lineCap: 'square',
|
|
2029
|
-
lineJoin: 'miter',
|
|
2030
|
-
strokeColor: this.color,
|
|
2031
|
-
strokeWidth: this.strokeWidth
|
|
2032
|
-
});
|
|
2008
|
+
key: "getArcs",
|
|
2009
|
+
value: function getArcs(position, params) {
|
|
2010
|
+
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2011
|
+
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2012
|
+
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2033
2013
|
}
|
|
2034
2014
|
}]);
|
|
2035
2015
|
|
|
2036
|
-
return
|
|
2037
|
-
}(
|
|
2016
|
+
return ShadowedPointSymbol;
|
|
2017
|
+
}(Point.PointSymbol);
|
|
2038
2018
|
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
case exports.LineMiterKind.Arrow:
|
|
2042
|
-
case exports.LineMiterKind.FilledArrow:
|
|
2043
|
-
return new ArrowLineMiterRender(options);
|
|
2019
|
+
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2020
|
+
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2044
2021
|
|
|
2045
|
-
|
|
2046
|
-
case exports.LineMiterKind.FilledSquare:
|
|
2047
|
-
return new SquareLineMiterRender(options);
|
|
2022
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2048
2023
|
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2024
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2025
|
+
function ShadowedPolySymbol(options) {
|
|
2026
|
+
_classCallCheck(this, ShadowedPolySymbol);
|
|
2052
2027
|
|
|
2053
|
-
|
|
2054
|
-
return null;
|
|
2028
|
+
return _super.call(this, options);
|
|
2055
2029
|
}
|
|
2056
|
-
};
|
|
2057
2030
|
|
|
2058
|
-
|
|
2059
|
-
|
|
2031
|
+
_createClass(ShadowedPolySymbol, [{
|
|
2032
|
+
key: "renderFunction",
|
|
2033
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
2034
|
+
if (!(feature instanceof Poly$1.Poly)) return [];
|
|
2060
2035
|
|
|
2061
|
-
|
|
2062
|
-
const coordinates = reversedRing[i];
|
|
2036
|
+
const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
|
|
2063
2037
|
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2038
|
+
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2039
|
+
const shadowRender = this.getShadow(coordinates, feature);
|
|
2040
|
+
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2041
|
+
let renders = [polyRender];
|
|
2067
2042
|
|
|
2068
|
-
|
|
2043
|
+
if (shadowRender) {
|
|
2044
|
+
renders = [shadowRender, polyRender];
|
|
2045
|
+
}
|
|
2069
2046
|
|
|
2070
|
-
|
|
2071
|
-
|
|
2047
|
+
if (vertexRenders) {
|
|
2048
|
+
renders = renders.concat(vertexRenders);
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
return renders;
|
|
2072
2052
|
}
|
|
2073
|
-
}
|
|
2053
|
+
}, {
|
|
2054
|
+
key: "getShadow",
|
|
2055
|
+
value: function getShadow(coordinates, _feature) {
|
|
2056
|
+
return new Poly.PolyRender(coordinates, {
|
|
2057
|
+
fillStyle: Poly.FillStyle.None,
|
|
2058
|
+
enclosed: this.enclose,
|
|
2059
|
+
strokeColor: this.shadowColor,
|
|
2060
|
+
strokeWidth: this.shadowSize,
|
|
2061
|
+
lineDash: this.lineDash
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
}, {
|
|
2065
|
+
key: "getPolyRender",
|
|
2066
|
+
value: function getPolyRender(coordinates, _feature) {
|
|
2067
|
+
return new Poly.PolyRender(coordinates, {
|
|
2068
|
+
fillStyle: this.enclose ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
2069
|
+
enclosed: this.enclose,
|
|
2070
|
+
fillColor: this.fillColor,
|
|
2071
|
+
strokeColor: this.strokeColor,
|
|
2072
|
+
strokeWidth: this.strokeWidth,
|
|
2073
|
+
lineDash: this.lineDash
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
}, {
|
|
2077
|
+
key: "getVertexRenders",
|
|
2078
|
+
value: function getVertexRenders(coordinates) {
|
|
2079
|
+
if (!this.showVertex) return;
|
|
2080
|
+
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2081
|
+
return acc.concat(curr);
|
|
2082
|
+
}, []);
|
|
2083
|
+
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2084
|
+
size: 6,
|
|
2085
|
+
strokeWidth: 2,
|
|
2086
|
+
shadowColor: this.shadowColor,
|
|
2087
|
+
strokeColor: this.strokeColor,
|
|
2088
|
+
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2089
|
+
fillColor: '#ffffff'
|
|
2090
|
+
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2091
|
+
}
|
|
2092
|
+
}]);
|
|
2074
2093
|
|
|
2075
|
-
return
|
|
2094
|
+
return ShadowedPolySymbol;
|
|
2095
|
+
}(PolylineSymbol.PolylineSymbol);
|
|
2096
|
+
const polySymbolParams = {
|
|
2097
|
+
strokeWidth: 2,
|
|
2098
|
+
strokeColor: '#e33600',
|
|
2099
|
+
shadowSize: 8,
|
|
2100
|
+
shadowColor: 'rgba(227, 54, 0, 0.3)'
|
|
2076
2101
|
};
|
|
2102
|
+
const measureSymbolParams = {
|
|
2103
|
+
strokeColor: '#ff6933',
|
|
2104
|
+
shadowSize: 0,
|
|
2105
|
+
vertexShadowSize: 0
|
|
2106
|
+
};
|
|
2107
|
+
const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2108
|
+
enclose: false,
|
|
2109
|
+
showVertex: true
|
|
2110
|
+
}));
|
|
2111
|
+
const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2112
|
+
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2113
|
+
enclose: true,
|
|
2114
|
+
showVertex: true
|
|
2115
|
+
}));
|
|
2116
|
+
const snapSymbolParams = {
|
|
2117
|
+
size: 10,
|
|
2118
|
+
strokeWidth: 2,
|
|
2119
|
+
strokeColor: '#e33600',
|
|
2120
|
+
fillColor: '#ffffff',
|
|
2121
|
+
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2122
|
+
shadowSize: 3
|
|
2123
|
+
};
|
|
2124
|
+
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2125
|
+
strokeColor: '#ff6933',
|
|
2126
|
+
shadowSize: 0
|
|
2127
|
+
}));
|
|
2077
2128
|
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
for (let i = 0; i < newRing.length; i++) {
|
|
2082
|
-
const coordinates = newRing[i];
|
|
2129
|
+
let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
|
|
2130
|
+
_inherits(SelectedPointSymbol, _ShadowedPointSymbol);
|
|
2083
2131
|
|
|
2084
|
-
|
|
2085
|
-
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
2086
|
-
}
|
|
2132
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
|
|
2087
2133
|
|
|
2088
|
-
|
|
2134
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2135
|
+
function SelectedPointSymbol(props) {
|
|
2136
|
+
_classCallCheck(this, SelectedPointSymbol);
|
|
2089
2137
|
|
|
2090
|
-
|
|
2091
|
-
newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
|
|
2092
|
-
}
|
|
2138
|
+
return _super.call(this, props);
|
|
2093
2139
|
}
|
|
2094
2140
|
|
|
2095
|
-
|
|
2096
|
-
|
|
2141
|
+
_createClass(SelectedPointSymbol, [{
|
|
2142
|
+
key: "getShadow",
|
|
2143
|
+
value: function getShadow(position, feature) {
|
|
2144
|
+
if (feature.isSelected) {
|
|
2145
|
+
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
}, {
|
|
2149
|
+
key: "getPoint",
|
|
2150
|
+
value: function getPoint(position, feature) {
|
|
2151
|
+
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2097
2152
|
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
2153
|
+
if (feature.isSelected) {
|
|
2154
|
+
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2155
|
+
pointRender.fillColor = this.selectedFillColor;
|
|
2156
|
+
}
|
|
2103
2157
|
|
|
2104
|
-
|
|
2105
|
-
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
2158
|
+
return pointRender;
|
|
2106
2159
|
}
|
|
2107
|
-
});
|
|
2108
|
-
};
|
|
2109
|
-
|
|
2110
|
-
const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
|
|
2111
|
-
let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
|
|
2112
|
-
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
2160
|
+
}]);
|
|
2113
2161
|
|
|
2114
|
-
|
|
2162
|
+
return SelectedPointSymbol;
|
|
2163
|
+
}(ShadowedPointSymbol);
|
|
2115
2164
|
|
|
2116
|
-
|
|
2117
|
-
|
|
2165
|
+
let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
|
|
2166
|
+
_inherits(SelectedPolySymbol, _ShadowedPolySymbol);
|
|
2118
2167
|
|
|
2119
|
-
|
|
2168
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
|
|
2120
2169
|
|
|
2121
|
-
|
|
2170
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2171
|
+
function SelectedPolySymbol(props) {
|
|
2172
|
+
_classCallCheck(this, SelectedPolySymbol);
|
|
2122
2173
|
|
|
2123
|
-
|
|
2124
|
-
// @ts-ignore
|
|
2125
|
-
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
2126
|
-
strokeWidth: clamp( // @ts-ignore
|
|
2127
|
-
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
2128
|
-
// @ts-ignore
|
|
2129
|
-
lineDash: getLineDash(originalSymbol.stroke),
|
|
2130
|
-
// @ts-ignore
|
|
2131
|
-
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
2132
|
-
});
|
|
2133
|
-
_this.originalSymbol = originalSymbol;
|
|
2134
|
-
return _this;
|
|
2174
|
+
return _super.call(this, props);
|
|
2135
2175
|
}
|
|
2136
2176
|
|
|
2137
|
-
_createClass(
|
|
2138
|
-
key: "
|
|
2139
|
-
value: function
|
|
2140
|
-
if (
|
|
2141
|
-
|
|
2142
|
-
ending,
|
|
2143
|
-
beginningSize,
|
|
2144
|
-
beginning,
|
|
2145
|
-
endingSize
|
|
2146
|
-
} = this.originalSymbol;
|
|
2147
|
-
const renders = [];
|
|
2148
|
-
const featureCopy = feature.clone();
|
|
2149
|
-
const beginningMiterRender = getLineMiterRender({
|
|
2150
|
-
color: this.strokeColor,
|
|
2151
|
-
// @ts-ignore
|
|
2152
|
-
kind: beginning,
|
|
2153
|
-
position: 'left',
|
|
2154
|
-
// @ts-ignore
|
|
2155
|
-
size: beginningSize,
|
|
2156
|
-
strokeWidth: this.strokeWidth
|
|
2157
|
-
});
|
|
2158
|
-
const endingMiterRender = getLineMiterRender({
|
|
2159
|
-
color: this.strokeColor,
|
|
2160
|
-
// @ts-ignore
|
|
2161
|
-
kind: ending,
|
|
2162
|
-
position: 'right',
|
|
2163
|
-
// @ts-ignore
|
|
2164
|
-
size: endingSize,
|
|
2165
|
-
strokeWidth: this.strokeWidth
|
|
2166
|
-
});
|
|
2167
|
-
|
|
2168
|
-
if (beginningMiterRender) {
|
|
2169
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
2170
|
-
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2171
|
-
featureCopy.rings = updatedRings;
|
|
2172
|
-
renders.push(render);
|
|
2177
|
+
_createClass(SelectedPolySymbol, [{
|
|
2178
|
+
key: "getShadow",
|
|
2179
|
+
value: function getShadow(coordinates, feature) {
|
|
2180
|
+
if (feature.isSelected) {
|
|
2181
|
+
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2173
2182
|
}
|
|
2174
|
-
|
|
2175
|
-
if (endingMiterRender) {
|
|
2176
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
2177
|
-
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2178
|
-
featureCopy.rings = updatedRings;
|
|
2179
|
-
renders.push(render);
|
|
2180
|
-
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
2184
|
-
return renders;
|
|
2185
2183
|
}
|
|
2186
2184
|
}, {
|
|
2187
|
-
key: "
|
|
2188
|
-
value: function
|
|
2189
|
-
|
|
2190
|
-
}
|
|
2191
|
-
}]);
|
|
2192
|
-
|
|
2193
|
-
return SGisPolylineSymbol;
|
|
2194
|
-
}(PolylineSymbol.PolylineSymbol);
|
|
2195
|
-
|
|
2196
|
-
let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
|
|
2197
|
-
_inherits(LabelSymbol, _DynamicPointSymbol);
|
|
2185
|
+
key: "getPolyRender",
|
|
2186
|
+
value: function getPolyRender(coordinates, feature) {
|
|
2187
|
+
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2198
2188
|
|
|
2199
|
-
|
|
2189
|
+
if (feature.isSelected) {
|
|
2190
|
+
polyRender.fillColor = this.selectedFillColor;
|
|
2191
|
+
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2200
2192
|
|
|
2201
|
-
|
|
2202
|
-
|
|
2193
|
+
if (this.selectedStrokeWidth !== void 0) {
|
|
2194
|
+
polyRender.strokeWidth = this.selectedStrokeWidth;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2203
2197
|
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2198
|
+
return polyRender;
|
|
2199
|
+
}
|
|
2200
|
+
}]);
|
|
2208
2201
|
|
|
2209
|
-
|
|
2202
|
+
return SelectedPolySymbol;
|
|
2203
|
+
}(ShadowedPolySymbol);
|
|
2210
2204
|
|
|
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
|
-
|
|
2238
|
-
|
|
2239
|
-
if (Component) {
|
|
2240
|
-
ReactDOM.render(React__default.createElement(Component, {
|
|
2241
|
-
content: content
|
|
2242
|
-
}), node);
|
|
2243
|
-
} else {
|
|
2244
|
-
node.innerText = content;
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
}]);
|
|
2248
|
-
|
|
2249
|
-
return LabelSymbol;
|
|
2250
|
-
}(_Symbol.DynamicPointSymbol);
|
|
2205
|
+
const selectedPoint = /*#__PURE__*/new SelectedPointSymbol({
|
|
2206
|
+
size: 8,
|
|
2207
|
+
strokeWidth: 2,
|
|
2208
|
+
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2209
|
+
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2210
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2211
|
+
shadowSize: 3,
|
|
2212
|
+
selectedStrokeColor: '#ff5722',
|
|
2213
|
+
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2214
|
+
});
|
|
2215
|
+
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2216
|
+
strokeWidth: 6,
|
|
2217
|
+
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2218
|
+
shadowSize: 8,
|
|
2219
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2220
|
+
selectedStrokeColor: '#ff5722',
|
|
2221
|
+
selectedStrokeWidth: 2
|
|
2222
|
+
});
|
|
2223
|
+
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2224
|
+
strokeWidth: 2,
|
|
2225
|
+
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2226
|
+
shadowSize: 8,
|
|
2227
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2228
|
+
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2229
|
+
enclose: true,
|
|
2230
|
+
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2231
|
+
selectedStrokeColor: '#ff5722'
|
|
2232
|
+
});
|
|
2251
2233
|
|
|
2252
|
-
const
|
|
2253
|
-
|
|
2234
|
+
const metersToPixels = (meters, _ref) => {
|
|
2235
|
+
let {
|
|
2236
|
+
painter,
|
|
2237
|
+
crs = Crs.geo
|
|
2238
|
+
} = _ref;
|
|
2254
2239
|
const {
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
onClose = undefined
|
|
2263
|
-
} = props || {};
|
|
2264
|
-
return new LabelSymbol({
|
|
2265
|
-
offset,
|
|
2266
|
-
component: _ref2 => {
|
|
2267
|
-
let {
|
|
2268
|
-
content
|
|
2269
|
-
} = _ref2;
|
|
2270
|
-
return renderLabel({
|
|
2271
|
-
content,
|
|
2272
|
-
onClose
|
|
2273
|
-
});
|
|
2274
|
-
}
|
|
2275
|
-
});
|
|
2240
|
+
width
|
|
2241
|
+
} = painter;
|
|
2242
|
+
const zeroPoint = painter.getPointFromPxPosition(0, 0).projectTo(crs);
|
|
2243
|
+
const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
|
|
2244
|
+
const widthDistance = geotools.distance(zeroPoint, maxWidthPoint);
|
|
2245
|
+
const pxK = width / (widthDistance || 1);
|
|
2246
|
+
return Math.round(meters * pxK);
|
|
2276
2247
|
};
|
|
2277
2248
|
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
const shadowDiameter = size + strokeWidth + shadowSize;
|
|
2286
|
-
return new Poly.PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
|
|
2287
|
-
fillColor: 'transparent',
|
|
2288
|
-
strokeColor: shadowColor,
|
|
2289
|
-
strokeWidth: shadowSize,
|
|
2290
|
-
enclosed: true
|
|
2291
|
-
});
|
|
2292
|
-
}
|
|
2293
|
-
function getEditorPointRenderer(position, _ref2) {
|
|
2294
|
-
let {
|
|
2295
|
-
strokeColor,
|
|
2296
|
-
strokeWidth,
|
|
2297
|
-
shadowColor,
|
|
2298
|
-
fillColor,
|
|
2299
|
-
shadowSize,
|
|
2300
|
-
size = 0
|
|
2301
|
-
} = _ref2;
|
|
2302
|
-
return [createShadowRender(position, {
|
|
2303
|
-
strokeWidth,
|
|
2304
|
-
strokeColor,
|
|
2305
|
-
shadowSize,
|
|
2306
|
-
shadowColor,
|
|
2307
|
-
size
|
|
2308
|
-
}), new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
2309
|
-
fillColor,
|
|
2310
|
-
strokeColor,
|
|
2311
|
-
strokeWidth,
|
|
2312
|
-
enclosed: true
|
|
2313
|
-
})];
|
|
2314
|
-
}
|
|
2249
|
+
const defaultPathStyles = {
|
|
2250
|
+
strokeWidth: 2,
|
|
2251
|
+
strokeColor: 'rgb(0, 163, 245)',
|
|
2252
|
+
fillStyle: Poly.FillStyle.None
|
|
2253
|
+
};
|
|
2254
|
+
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2255
|
+
_inherits(SVGPoly, _Symbol);
|
|
2315
2256
|
|
|
2316
|
-
|
|
2317
|
-
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
2257
|
+
var _super = /*#__PURE__*/_createSuper(SVGPoly);
|
|
2318
2258
|
|
|
2319
|
-
|
|
2259
|
+
function SVGPoly(_temp) {
|
|
2260
|
+
var _this;
|
|
2320
2261
|
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2262
|
+
let {
|
|
2263
|
+
redrawFeatureNode,
|
|
2264
|
+
pathStyles,
|
|
2265
|
+
circle,
|
|
2266
|
+
className,
|
|
2267
|
+
appendToSvg
|
|
2268
|
+
} = _temp === void 0 ? {} : _temp;
|
|
2324
2269
|
|
|
2325
|
-
|
|
2270
|
+
_classCallCheck(this, SVGPoly);
|
|
2271
|
+
|
|
2272
|
+
_this = _super.call(this);
|
|
2273
|
+
_this.container = document.createElement('div');
|
|
2274
|
+
_this.container.style.position = 'absolute';
|
|
2275
|
+
_this.redrawFeatureNode = redrawFeatureNode;
|
|
2276
|
+
_this.pathStyles = _extends({
|
|
2277
|
+
center: [0, 0],
|
|
2278
|
+
fillColor: 'none'
|
|
2279
|
+
}, pathStyles);
|
|
2280
|
+
_this.circle = circle;
|
|
2281
|
+
_this.className = className;
|
|
2282
|
+
_this.appendToSvg = appendToSvg;
|
|
2283
|
+
return _this;
|
|
2326
2284
|
}
|
|
2327
2285
|
|
|
2328
|
-
_createClass(
|
|
2286
|
+
_createClass(SVGPoly, [{
|
|
2329
2287
|
key: "renderFunction",
|
|
2330
2288
|
value: function renderFunction(feature, resolution, crs) {
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2289
|
+
const coordinates = feature instanceof Poly$1.Poly ? new PolylineSymbol.PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2290
|
+
this.setCirclePxRaius(crs);
|
|
2291
|
+
this.container.innerHTML = '';
|
|
2292
|
+
const svg = this.setSvg(coordinates);
|
|
2293
|
+
svg && this.container.append(svg);
|
|
2294
|
+
feature.__dynamicSymbolRender = new Render.DynamicRender({
|
|
2295
|
+
node: this.container,
|
|
2296
|
+
update: (bbox, resolution) => this.update({
|
|
2297
|
+
bbox,
|
|
2298
|
+
resolution,
|
|
2299
|
+
feature,
|
|
2300
|
+
crs
|
|
2301
|
+
}),
|
|
2302
|
+
redraw: () => {
|
|
2303
|
+
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2304
|
+
}
|
|
2305
|
+
});
|
|
2306
|
+
|
|
2307
|
+
this._setEventListeners(feature);
|
|
2308
|
+
|
|
2309
|
+
return [feature.__dynamicSymbolRender];
|
|
2339
2310
|
}
|
|
2340
2311
|
}, {
|
|
2341
|
-
key: "
|
|
2342
|
-
value: function
|
|
2343
|
-
|
|
2312
|
+
key: "setCirclePxRaius",
|
|
2313
|
+
value: function setCirclePxRaius(crs) {
|
|
2314
|
+
if (this.circle && this.pathStyles) {
|
|
2315
|
+
var _this$circle;
|
|
2316
|
+
|
|
2317
|
+
this.pathStyles.radius = metersToPixels(this.circle.radius, {
|
|
2318
|
+
painter: this.circle.painter,
|
|
2319
|
+
crs
|
|
2320
|
+
}) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
|
|
2321
|
+
}
|
|
2344
2322
|
}
|
|
2345
2323
|
}, {
|
|
2346
|
-
key: "
|
|
2347
|
-
value: function
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
}], [{
|
|
2351
|
-
key: "getShadowArc",
|
|
2352
|
-
value: function getShadowArc(position, _ref) {
|
|
2324
|
+
key: "update",
|
|
2325
|
+
value: function update(_ref) {
|
|
2326
|
+
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2327
|
+
|
|
2353
2328
|
let {
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2329
|
+
bbox,
|
|
2330
|
+
resolution,
|
|
2331
|
+
feature,
|
|
2332
|
+
crs
|
|
2358
2333
|
} = _ref;
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
enclosed: true
|
|
2364
|
-
});
|
|
2365
|
-
}
|
|
2366
|
-
}, {
|
|
2367
|
-
key: "getPointArc",
|
|
2368
|
-
value: function getPointArc(position, _ref2) {
|
|
2369
|
-
let {
|
|
2370
|
-
strokeWidth,
|
|
2371
|
-
fillColor,
|
|
2372
|
-
strokeColor,
|
|
2373
|
-
size = 6
|
|
2374
|
-
} = _ref2;
|
|
2375
|
-
return new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
2376
|
-
fillColor,
|
|
2377
|
-
strokeColor,
|
|
2378
|
-
strokeWidth,
|
|
2379
|
-
enclosed: true
|
|
2380
|
-
});
|
|
2381
|
-
}
|
|
2382
|
-
}, {
|
|
2383
|
-
key: "getArcs",
|
|
2384
|
-
value: function getArcs(position, params) {
|
|
2385
|
-
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2386
|
-
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2387
|
-
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2388
|
-
}
|
|
2389
|
-
}]);
|
|
2390
|
-
|
|
2391
|
-
return ShadowedPointSymbol;
|
|
2392
|
-
}(Point.PointSymbol);
|
|
2393
|
-
|
|
2394
|
-
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2395
|
-
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2396
|
-
|
|
2397
|
-
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2398
|
-
|
|
2399
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2400
|
-
function ShadowedPolySymbol(options) {
|
|
2401
|
-
_classCallCheck(this, ShadowedPolySymbol);
|
|
2402
|
-
|
|
2403
|
-
return _super.call(this, options);
|
|
2404
|
-
}
|
|
2405
|
-
|
|
2406
|
-
_createClass(ShadowedPolySymbol, [{
|
|
2407
|
-
key: "renderFunction",
|
|
2408
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2409
|
-
if (!(feature instanceof Poly$1.Poly)) return [];
|
|
2334
|
+
if (!feature) return;
|
|
2335
|
+
if (!bbox) bbox = feature.__lastBbox;
|
|
2336
|
+
if (!resolution) resolution = feature.__lastResolution;
|
|
2337
|
+
if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
|
|
2410
2338
|
|
|
2411
|
-
|
|
2339
|
+
if (feature.__lastResolution && resolution !== feature.__lastResolution) {
|
|
2340
|
+
const newCoordinates = feature instanceof Poly$1.Poly ? new PolylineSymbol.PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2341
|
+
this.setCirclePxRaius(crs);
|
|
2342
|
+
this.container.innerHTML = '';
|
|
2343
|
+
const svg = this.setSvg(newCoordinates);
|
|
2344
|
+
svg && this.container.append(svg);
|
|
2345
|
+
}
|
|
2412
2346
|
|
|
2413
|
-
const
|
|
2414
|
-
const
|
|
2415
|
-
const
|
|
2416
|
-
|
|
2347
|
+
const polygon = feature.projectTo(bbox.crs);
|
|
2348
|
+
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;
|
|
2349
|
+
const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
|
|
2350
|
+
const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
|
|
2351
|
+
this.container.style.left = dx.toString() + "px";
|
|
2352
|
+
this.container.style.top = dy.toString() + "px";
|
|
2353
|
+
feature.__lastBbox = bbox;
|
|
2354
|
+
feature.__lastResolution = resolution;
|
|
2355
|
+
}
|
|
2356
|
+
}, {
|
|
2357
|
+
key: "setSvg",
|
|
2358
|
+
value: function setSvg(coordinates) {
|
|
2359
|
+
const {
|
|
2360
|
+
lineCap,
|
|
2361
|
+
lineJoin,
|
|
2362
|
+
miterLimit,
|
|
2363
|
+
lineDash,
|
|
2364
|
+
dashOffset
|
|
2365
|
+
} = this.pathStyles || {};
|
|
2366
|
+
const svgRender = new SvgRender.SvgRender(_extends({
|
|
2367
|
+
coordinates
|
|
2368
|
+
}, defaultPathStyles, {
|
|
2369
|
+
appendToSvg: this.appendToSvg
|
|
2370
|
+
}, this.pathStyles));
|
|
2417
2371
|
|
|
2418
|
-
if (
|
|
2419
|
-
|
|
2372
|
+
if (this.circle) {
|
|
2373
|
+
svgRender._setArcNode();
|
|
2374
|
+
} else {
|
|
2375
|
+
svgRender._setPolyNode();
|
|
2420
2376
|
}
|
|
2421
2377
|
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2378
|
+
let svgElement;
|
|
2379
|
+
svgRender.getNode((_, svg) => {
|
|
2380
|
+
svgElement = svg;
|
|
2381
|
+
this.className && svgElement.classList.add(this.className);
|
|
2382
|
+
const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
|
|
2425
2383
|
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
lineDash: this.lineDash
|
|
2384
|
+
if (path) {
|
|
2385
|
+
path.setAttribute('stroke-linecap', lineCap || 'round');
|
|
2386
|
+
path.setAttribute('stroke-linejoin', lineJoin || 'round');
|
|
2387
|
+
path.setAttribute('stroke-miterlimit', (miterLimit || 10).toString());
|
|
2388
|
+
path.setAttribute('stroke-dashoffset', (dashOffset || 0).toString());
|
|
2389
|
+
|
|
2390
|
+
if (this.circle) {
|
|
2391
|
+
path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2437
2394
|
});
|
|
2395
|
+
return svgElement;
|
|
2438
2396
|
}
|
|
2439
2397
|
}, {
|
|
2440
|
-
key: "
|
|
2441
|
-
value: function
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2398
|
+
key: "_setEventListeners",
|
|
2399
|
+
value: function _setEventListeners(dynamicFeature) {
|
|
2400
|
+
var _dynamicFeature$__dyn;
|
|
2401
|
+
|
|
2402
|
+
if (dynamicFeature.eventFlags === EventHandler.MouseEventFlags.None) return;
|
|
2403
|
+
const svgNode = dynamicFeature == null ? void 0 : (_dynamicFeature$__dyn = dynamicFeature.__dynamicSymbolRender) == null ? void 0 : _dynamicFeature$__dyn.node.querySelector(this.circle ? 'circle' : 'path');
|
|
2404
|
+
Object.keys(EventHandler.mouseEvents).forEach(eventName => {
|
|
2405
|
+
if (dynamicFeature.eventFlags & EventHandler.mouseEvents[eventName].flag) {
|
|
2406
|
+
domEvent.listenDomEvent(svgNode, EventHandler.mouseEvents[eventName].type, event => {
|
|
2407
|
+
dynamicFeature.fire(EventHandler.mouseEvents[eventName].type, {
|
|
2408
|
+
node: svgNode,
|
|
2409
|
+
browserEvent: event
|
|
2410
|
+
});
|
|
2411
|
+
});
|
|
2412
|
+
}
|
|
2449
2413
|
});
|
|
2450
2414
|
}
|
|
2451
|
-
}, {
|
|
2452
|
-
key: "getVertexRenders",
|
|
2453
|
-
value: function getVertexRenders(coordinates) {
|
|
2454
|
-
if (!this.showVertex) return;
|
|
2455
|
-
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2456
|
-
return acc.concat(curr);
|
|
2457
|
-
}, []);
|
|
2458
|
-
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2459
|
-
size: 6,
|
|
2460
|
-
strokeWidth: 2,
|
|
2461
|
-
shadowColor: this.shadowColor,
|
|
2462
|
-
strokeColor: this.strokeColor,
|
|
2463
|
-
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2464
|
-
fillColor: '#ffffff'
|
|
2465
|
-
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2466
|
-
}
|
|
2467
2415
|
}]);
|
|
2468
2416
|
|
|
2469
|
-
return
|
|
2470
|
-
}(
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2417
|
+
return SVGPoly;
|
|
2418
|
+
}(_Symbol.Symbol);
|
|
2419
|
+
|
|
2420
|
+
function isSGisPointSymbol(symbol) {
|
|
2421
|
+
return symbol instanceof Point.PointSymbol || symbol instanceof StaticImageSymbol.StaticImageSymbol || symbol instanceof Square.SquareSymbol || symbol instanceof MaskedImage.MaskedImage;
|
|
2422
|
+
}
|
|
2423
|
+
function isSGisImageSymbol(symbol) {
|
|
2424
|
+
return symbol instanceof StaticImageSymbol.StaticImageSymbol || symbol instanceof MaskedImage.MaskedImage;
|
|
2425
|
+
}
|
|
2426
|
+
function isSGisPolygonSymbol(symbol) {
|
|
2427
|
+
return symbol instanceof Simple.PolygonSymbol || symbol instanceof BrushFill.BrushFill || symbol instanceof ImageFill.ImageFill;
|
|
2428
|
+
}
|
|
2429
|
+
function isSGisPolylineSymbol(symbol) {
|
|
2430
|
+
return symbol instanceof PolylineSymbol.PolylineSymbol;
|
|
2431
|
+
}
|
|
2432
|
+
function isSGisH3Symbol(symbol) {
|
|
2433
|
+
return symbol instanceof H3Symbol.H3Symbol;
|
|
2434
|
+
}
|
|
2435
|
+
function isSGisClusterSymbol(symbol) {
|
|
2436
|
+
return !!symbol.singleObjectSymbol;
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
/**
|
|
2440
|
+
* Моки фич для отображения превью символа
|
|
2441
|
+
* http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
|
|
2442
|
+
*/
|
|
2443
|
+
|
|
2444
|
+
const viewBoxSize = 100;
|
|
2445
|
+
const pointFeature = /*#__PURE__*/new PointFeature.PointFeature([50, -50], {
|
|
2446
|
+
crs: Crs.plain
|
|
2447
|
+
});
|
|
2448
|
+
const lineFeature = /*#__PURE__*/new Polyline.Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2449
|
+
crs: Crs.plain
|
|
2450
|
+
});
|
|
2451
|
+
const polygonFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
|
|
2452
|
+
crs: Crs.plain
|
|
2453
|
+
});
|
|
2454
|
+
const h3gridFeature = /*#__PURE__*/new H3Feature.H3Feature([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2455
|
+
crs: Crs.plain
|
|
2456
|
+
});
|
|
2457
|
+
const lineLegendFeature = /*#__PURE__*/new Polyline.Polyline([[0, -50], [100, -50]], {
|
|
2458
|
+
crs: Crs.plain
|
|
2459
|
+
});
|
|
2460
|
+
const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
|
|
2461
|
+
crs: Crs.plain
|
|
2462
|
+
});
|
|
2463
|
+
const polygonMapLegendFeature = /*#__PURE__*/new Polygon.Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2464
|
+
crs: Crs.plain
|
|
2465
|
+
});
|
|
2466
|
+
const MAP_LEGEND_FEATURES = {
|
|
2467
|
+
polygon: polygonMapLegendFeature
|
|
2476
2468
|
};
|
|
2477
|
-
const
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2469
|
+
const LEGEND_FEATURES = {
|
|
2470
|
+
point: pointFeature,
|
|
2471
|
+
polyline: lineLegendFeature,
|
|
2472
|
+
polygon: polygonLegendFeature,
|
|
2473
|
+
h3grid: h3gridFeature
|
|
2481
2474
|
};
|
|
2482
|
-
const
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2488
|
-
enclose: true,
|
|
2489
|
-
showVertex: true
|
|
2490
|
-
}));
|
|
2491
|
-
const snapSymbolParams = {
|
|
2492
|
-
size: 10,
|
|
2493
|
-
strokeWidth: 2,
|
|
2494
|
-
strokeColor: '#e33600',
|
|
2495
|
-
fillColor: '#ffffff',
|
|
2496
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2497
|
-
shadowSize: 3
|
|
2475
|
+
const MOCK_FEATURES = {
|
|
2476
|
+
point: pointFeature,
|
|
2477
|
+
polyline: lineFeature,
|
|
2478
|
+
polygon: polygonFeature,
|
|
2479
|
+
h3grid: h3gridFeature
|
|
2498
2480
|
};
|
|
2499
|
-
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2500
|
-
strokeColor: '#ff6933',
|
|
2501
|
-
shadowSize: 0
|
|
2502
|
-
}));
|
|
2503
2481
|
|
|
2504
|
-
|
|
2505
|
-
|
|
2482
|
+
function getSymbolRenders(symbol, size, features) {
|
|
2483
|
+
if (size === void 0) {
|
|
2484
|
+
size = viewBoxSize;
|
|
2485
|
+
}
|
|
2506
2486
|
|
|
2507
|
-
|
|
2487
|
+
if (features === void 0) {
|
|
2488
|
+
features = {};
|
|
2489
|
+
}
|
|
2508
2490
|
|
|
2509
|
-
|
|
2510
|
-
function SelectedPointSymbol(props) {
|
|
2511
|
-
_classCallCheck(this, SelectedPointSymbol);
|
|
2491
|
+
const resolution = viewBoxSize / size;
|
|
2512
2492
|
|
|
2513
|
-
|
|
2514
|
-
}
|
|
2515
|
-
|
|
2516
|
-
_createClass(SelectedPointSymbol, [{
|
|
2517
|
-
key: "getShadow",
|
|
2518
|
-
value: function getShadow(position, feature) {
|
|
2519
|
-
if (feature.isSelected) {
|
|
2520
|
-
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2521
|
-
}
|
|
2522
|
-
}
|
|
2523
|
-
}, {
|
|
2524
|
-
key: "getPoint",
|
|
2525
|
-
value: function getPoint(position, feature) {
|
|
2526
|
-
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2527
|
-
|
|
2528
|
-
if (feature.isSelected) {
|
|
2529
|
-
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2530
|
-
pointRender.fillColor = this.selectedFillColor;
|
|
2531
|
-
}
|
|
2532
|
-
|
|
2533
|
-
return pointRender;
|
|
2534
|
-
}
|
|
2535
|
-
}]);
|
|
2493
|
+
const featuresToRender = _extends({}, MOCK_FEATURES, features);
|
|
2536
2494
|
|
|
2537
|
-
|
|
2538
|
-
|
|
2495
|
+
if (isSGisPolygonSymbol(symbol)) {
|
|
2496
|
+
return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, Crs.plain);
|
|
2497
|
+
}
|
|
2539
2498
|
|
|
2540
|
-
|
|
2541
|
-
|
|
2499
|
+
if (isSGisPolylineSymbol(symbol)) {
|
|
2500
|
+
return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, Crs.plain);
|
|
2501
|
+
}
|
|
2542
2502
|
|
|
2543
|
-
|
|
2503
|
+
if (isSGisH3Symbol(symbol)) {
|
|
2504
|
+
return symbol.renderFunctionAsync(featuresToRender.h3grid, resolution, Crs.plain);
|
|
2505
|
+
}
|
|
2544
2506
|
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2507
|
+
return symbol.renderFunctionAsync(featuresToRender.point, resolution, Crs.plain);
|
|
2508
|
+
}
|
|
2509
|
+
const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
|
|
2510
|
+
if (size === void 0) {
|
|
2511
|
+
size = viewBoxSize;
|
|
2512
|
+
}
|
|
2548
2513
|
|
|
2549
|
-
|
|
2514
|
+
return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
|
|
2515
|
+
};
|
|
2516
|
+
const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
|
|
2517
|
+
if (size === void 0) {
|
|
2518
|
+
size = viewBoxSize;
|
|
2550
2519
|
}
|
|
2551
2520
|
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
value: function getShadow(coordinates, feature) {
|
|
2555
|
-
if (feature.isSelected) {
|
|
2556
|
-
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
}, {
|
|
2560
|
-
key: "getPolyRender",
|
|
2561
|
-
value: function getPolyRender(coordinates, feature) {
|
|
2562
|
-
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2521
|
+
return getSymbolRenders(symbol, size, LEGEND_FEATURES);
|
|
2522
|
+
};
|
|
2563
2523
|
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2524
|
+
function renderSymbolToCanvas(renders, canvas) {
|
|
2525
|
+
renders.forEach(render => {
|
|
2526
|
+
canvas.draw(render);
|
|
2527
|
+
});
|
|
2528
|
+
}
|
|
2567
2529
|
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2530
|
+
function deserializeSymbol(symbol) {
|
|
2531
|
+
switch (symbol.type) {
|
|
2532
|
+
case "h3grid":
|
|
2533
|
+
return deserializeH3Symbol(symbol);
|
|
2572
2534
|
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
}]);
|
|
2535
|
+
case "svgPointSymbol":
|
|
2536
|
+
return deserializeSvgPointSymbol(symbol);
|
|
2576
2537
|
|
|
2577
|
-
|
|
2578
|
-
|
|
2538
|
+
case 'circlePointSymbol':
|
|
2539
|
+
return deserializePointSymbol(symbol);
|
|
2579
2540
|
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
strokeWidth: 2,
|
|
2583
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2584
|
-
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2585
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2586
|
-
shadowSize: 3,
|
|
2587
|
-
selectedStrokeColor: '#ff5722',
|
|
2588
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2589
|
-
});
|
|
2590
|
-
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2591
|
-
strokeWidth: 6,
|
|
2592
|
-
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2593
|
-
shadowSize: 8,
|
|
2594
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2595
|
-
selectedStrokeColor: '#ff5722',
|
|
2596
|
-
selectedStrokeWidth: 2
|
|
2597
|
-
});
|
|
2598
|
-
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2599
|
-
strokeWidth: 2,
|
|
2600
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2601
|
-
shadowSize: 8,
|
|
2602
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2603
|
-
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2604
|
-
enclose: true,
|
|
2605
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2606
|
-
selectedStrokeColor: '#ff5722'
|
|
2607
|
-
});
|
|
2541
|
+
case 'squarePointSymbol':
|
|
2542
|
+
return deserializeSquareSymbol(symbol);
|
|
2608
2543
|
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
strokeColor: 'rgb(0, 163, 245)',
|
|
2612
|
-
fillStyle: Poly.FillStyle.None
|
|
2613
|
-
};
|
|
2614
|
-
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2615
|
-
_inherits(SVGPoly, _Symbol);
|
|
2544
|
+
case 'maskedImagePointSymbol':
|
|
2545
|
+
return deserializeMaskedImageSymbol(symbol);
|
|
2616
2546
|
|
|
2617
|
-
|
|
2547
|
+
case 'imagePointSymbol':
|
|
2548
|
+
return deserializeImagePointSymbol(symbol);
|
|
2618
2549
|
|
|
2619
|
-
|
|
2620
|
-
|
|
2550
|
+
case 'polygonSymbol':
|
|
2551
|
+
return deserializePolygonSymbol(symbol);
|
|
2621
2552
|
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
circle,
|
|
2626
|
-
className,
|
|
2627
|
-
appendToSvg
|
|
2628
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2553
|
+
case 'simplePolylineSymbol':
|
|
2554
|
+
case 'polylineSymbol':
|
|
2555
|
+
return deserializePolylineSymbol(symbol);
|
|
2629
2556
|
|
|
2630
|
-
|
|
2557
|
+
case "clusterSymbol":
|
|
2558
|
+
return deserializeSymbol(symbol.singleObjectSymbol);
|
|
2631
2559
|
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
_this.container.style.position = 'absolute';
|
|
2635
|
-
_this.redrawFeatureNode = redrawFeatureNode;
|
|
2636
|
-
_this.pathStyles = _extends({
|
|
2637
|
-
center: [0, 0],
|
|
2638
|
-
fillColor: 'none'
|
|
2639
|
-
}, pathStyles);
|
|
2640
|
-
_this.circle = circle;
|
|
2641
|
-
_this.className = className;
|
|
2642
|
-
_this.appendToSvg = appendToSvg;
|
|
2643
|
-
return _this;
|
|
2560
|
+
default:
|
|
2561
|
+
return null;
|
|
2644
2562
|
}
|
|
2563
|
+
}
|
|
2645
2564
|
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2649
|
-
const coordinates = feature instanceof Poly$1.Poly ? new PolylineSymbol.PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2650
|
-
this.setCirclePxRaius(crs);
|
|
2651
|
-
this.container.innerHTML = '';
|
|
2652
|
-
const svg = this.setSvg(coordinates);
|
|
2653
|
-
svg && this.container.append(svg);
|
|
2654
|
-
feature.__dynamicSymbolRender = new Render.DynamicRender({
|
|
2655
|
-
node: this.container,
|
|
2656
|
-
update: (bbox, resolution) => this.update({
|
|
2657
|
-
bbox,
|
|
2658
|
-
resolution,
|
|
2659
|
-
feature,
|
|
2660
|
-
crs
|
|
2661
|
-
}),
|
|
2662
|
-
redraw: () => {
|
|
2663
|
-
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2664
|
-
}
|
|
2665
|
-
});
|
|
2565
|
+
function deserializeH3Symbol(symbol) {
|
|
2566
|
+
var _symbol$stroke, _symbol$stroke2, _symbol$fill;
|
|
2666
2567
|
|
|
2667
|
-
|
|
2568
|
+
return new H3Symbol.H3Symbol(_extends({}, symbol, {
|
|
2569
|
+
cellSize: getParameterValue(symbol.cellSize),
|
|
2570
|
+
strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
|
|
2571
|
+
strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
|
|
2572
|
+
fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
|
|
2573
|
+
}));
|
|
2574
|
+
}
|
|
2668
2575
|
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
value: function setCirclePxRaius(crs) {
|
|
2674
|
-
if (this.circle && this.pathStyles) {
|
|
2675
|
-
var _this$circle;
|
|
2576
|
+
function deserializePointSymbol(symbol) {
|
|
2577
|
+
// @ts-ignore
|
|
2578
|
+
return new Point.PointSymbol(deserializePointSymbolParams(symbol));
|
|
2579
|
+
}
|
|
2676
2580
|
|
|
2677
|
-
|
|
2678
|
-
painter: this.circle.painter,
|
|
2679
|
-
crs
|
|
2680
|
-
}) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
|
|
2681
|
-
}
|
|
2682
|
-
}
|
|
2683
|
-
}, {
|
|
2684
|
-
key: "update",
|
|
2685
|
-
value: function update(_ref) {
|
|
2686
|
-
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2581
|
+
const getOffsetParameterValue = offset => [getParameterValue(offset == null ? void 0 : offset[0]), getParameterValue(offset == null ? void 0 : offset[1])];
|
|
2687
2582
|
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2583
|
+
function deserializeSvgPointSymbolParams(_ref) {
|
|
2584
|
+
let {
|
|
2585
|
+
type,
|
|
2586
|
+
data,
|
|
2587
|
+
size,
|
|
2588
|
+
offset,
|
|
2589
|
+
angle,
|
|
2590
|
+
background,
|
|
2591
|
+
figure
|
|
2592
|
+
} = _ref;
|
|
2593
|
+
return _extends({
|
|
2594
|
+
type: getParameterValue(type),
|
|
2595
|
+
data: getParameterValue(data),
|
|
2596
|
+
size: getParameterValue(size),
|
|
2597
|
+
offset: getOffsetParameterValue(offset),
|
|
2598
|
+
angle: getParameterValue(angle)
|
|
2599
|
+
}, background ? {
|
|
2600
|
+
background: _extends({}, background, {
|
|
2601
|
+
fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
|
|
2602
|
+
strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
|
|
2603
|
+
strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
|
|
2604
|
+
})
|
|
2605
|
+
} : {}, figure ? {
|
|
2606
|
+
figure: _extends({}, figure, {
|
|
2607
|
+
fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
|
|
2608
|
+
})
|
|
2609
|
+
} : {});
|
|
2610
|
+
}
|
|
2698
2611
|
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
this.container.innerHTML = '';
|
|
2703
|
-
const svg = this.setSvg(newCoordinates);
|
|
2704
|
-
svg && this.container.append(svg);
|
|
2705
|
-
}
|
|
2706
|
-
|
|
2707
|
-
const polygon = feature.projectTo(bbox.crs);
|
|
2708
|
-
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;
|
|
2709
|
-
const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
|
|
2710
|
-
const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
|
|
2711
|
-
this.container.style.left = dx.toString() + "px";
|
|
2712
|
-
this.container.style.top = dy.toString() + "px";
|
|
2713
|
-
feature.__lastBbox = bbox;
|
|
2714
|
-
feature.__lastResolution = resolution;
|
|
2715
|
-
}
|
|
2716
|
-
}, {
|
|
2717
|
-
key: "setSvg",
|
|
2718
|
-
value: function setSvg(coordinates) {
|
|
2719
|
-
const {
|
|
2720
|
-
lineCap,
|
|
2721
|
-
lineJoin,
|
|
2722
|
-
miterLimit,
|
|
2723
|
-
lineDash,
|
|
2724
|
-
dashOffset
|
|
2725
|
-
} = this.pathStyles || {};
|
|
2726
|
-
const svgRender = new SvgRender.SvgRender(_extends({
|
|
2727
|
-
coordinates
|
|
2728
|
-
}, defaultPathStyles, {
|
|
2729
|
-
appendToSvg: this.appendToSvg
|
|
2730
|
-
}, this.pathStyles));
|
|
2731
|
-
|
|
2732
|
-
if (this.circle) {
|
|
2733
|
-
svgRender._setArcNode();
|
|
2734
|
-
} else {
|
|
2735
|
-
svgRender._setPolyNode();
|
|
2736
|
-
}
|
|
2612
|
+
function deserializeSvgPointSymbol(symbol) {
|
|
2613
|
+
return new Point.PointSymbol(deserializeSvgPointSymbolParams(symbol));
|
|
2614
|
+
}
|
|
2737
2615
|
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2616
|
+
function deserializeSquareSymbol(symbol) {
|
|
2617
|
+
return new Square.SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
|
|
2618
|
+
// @ts-ignore
|
|
2619
|
+
angle: getParameterValue(symbol.angle)
|
|
2620
|
+
}));
|
|
2621
|
+
}
|
|
2743
2622
|
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2623
|
+
function deserializeMaskedImageSymbol(symbol) {
|
|
2624
|
+
return new MaskedImage.MaskedImage(_extends({}, symbol, {
|
|
2625
|
+
// @ts-ignore
|
|
2626
|
+
angle: getParameterValue(symbol.angle),
|
|
2627
|
+
// @ts-ignore
|
|
2628
|
+
width: getParameterValue(symbol.width),
|
|
2629
|
+
// @ts-ignore
|
|
2630
|
+
height: getParameterValue(symbol.height),
|
|
2631
|
+
// @ts-ignore
|
|
2632
|
+
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2633
|
+
// @ts-ignore
|
|
2634
|
+
imageSource: deserializeBase64(symbol.image),
|
|
2635
|
+
// @ts-ignore
|
|
2636
|
+
maskSource: deserializeBase64(symbol.imageMask),
|
|
2637
|
+
// @ts-ignore
|
|
2638
|
+
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2639
|
+
}));
|
|
2640
|
+
}
|
|
2749
2641
|
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2642
|
+
function deserializeImagePointSymbol(symbol) {
|
|
2643
|
+
return new StaticImageSymbol.StaticImageSymbol(_extends({}, symbol, {
|
|
2644
|
+
// @ts-ignore
|
|
2645
|
+
angle: getParameterValue(symbol.angle),
|
|
2646
|
+
// @ts-ignore
|
|
2647
|
+
width: getParameterValue(symbol.width),
|
|
2648
|
+
// @ts-ignore
|
|
2649
|
+
height: getParameterValue(symbol.height),
|
|
2650
|
+
// @ts-ignore
|
|
2651
|
+
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2652
|
+
// @ts-ignore
|
|
2653
|
+
source: deserializeBase64(symbol.image)
|
|
2654
|
+
}));
|
|
2655
|
+
}
|
|
2761
2656
|
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
domEvent.listenDomEvent(svgNode, EventHandler.mouseEvents[eventName].type, event => {
|
|
2767
|
-
dynamicFeature.fire(EventHandler.mouseEvents[eventName].type, {
|
|
2768
|
-
node: svgNode,
|
|
2769
|
-
browserEvent: event
|
|
2770
|
-
});
|
|
2771
|
-
});
|
|
2772
|
-
}
|
|
2773
|
-
});
|
|
2774
|
-
}
|
|
2775
|
-
}]);
|
|
2657
|
+
function deserializePolygonSymbol(symbol) {
|
|
2658
|
+
if (isPolygonHasPatternBrush(symbol)) {
|
|
2659
|
+
return new SGisImageFill(symbol);
|
|
2660
|
+
}
|
|
2776
2661
|
|
|
2777
|
-
|
|
2778
|
-
|
|
2662
|
+
if (isPolygonHasHatchBrush(symbol)) {
|
|
2663
|
+
return new SGisBrushFill(symbol);
|
|
2664
|
+
}
|
|
2779
2665
|
|
|
2780
|
-
|
|
2781
|
-
return symbol instanceof Point.PointSymbol || symbol instanceof StaticImageSymbol.StaticImageSymbol || symbol instanceof Square.SquareSymbol || symbol instanceof MaskedImage.MaskedImage;
|
|
2666
|
+
return new SGisPolygonSymbol(symbol);
|
|
2782
2667
|
}
|
|
2783
|
-
|
|
2784
|
-
|
|
2668
|
+
|
|
2669
|
+
function deserializePolylineSymbol(symbol) {
|
|
2670
|
+
return new SGisPolylineSymbol(symbol);
|
|
2785
2671
|
}
|
|
2786
|
-
|
|
2787
|
-
|
|
2672
|
+
|
|
2673
|
+
function deserializePointSymbolParams(_ref2) {
|
|
2674
|
+
let {
|
|
2675
|
+
size,
|
|
2676
|
+
offset,
|
|
2677
|
+
strokeColor,
|
|
2678
|
+
strokeWidth,
|
|
2679
|
+
fillColor
|
|
2680
|
+
} = _ref2;
|
|
2681
|
+
return {
|
|
2682
|
+
size: getParameterValue(size),
|
|
2683
|
+
offset: deserializeAnchor(offset),
|
|
2684
|
+
strokeWidth: getParameterValue(strokeWidth),
|
|
2685
|
+
strokeColor: deserializeColor(getParameterValue(strokeColor)),
|
|
2686
|
+
fillColor: deserializeColor(getParameterValue(fillColor))
|
|
2687
|
+
};
|
|
2788
2688
|
}
|
|
2789
|
-
|
|
2790
|
-
|
|
2689
|
+
|
|
2690
|
+
function deserializeBase64(base) {
|
|
2691
|
+
return "data:image/png;base64," + base;
|
|
2791
2692
|
}
|
|
2792
|
-
|
|
2793
|
-
|
|
2693
|
+
|
|
2694
|
+
function deserializeAnchor(offset) {
|
|
2695
|
+
// @ts-ignore
|
|
2696
|
+
return offset.map(getParameterValue);
|
|
2794
2697
|
}
|
|
2795
|
-
|
|
2796
|
-
|
|
2698
|
+
|
|
2699
|
+
function deserializeColor(color$1) {
|
|
2700
|
+
return color$1 ? new color.Color(color$1).toString() : null;
|
|
2797
2701
|
}
|
|
2798
2702
|
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2703
|
+
const clampSymbol = (symbol, min, max) => {
|
|
2704
|
+
if (isSGisImageSymbol(symbol)) {
|
|
2705
|
+
symbol.width = clamp(symbol.width, min, max);
|
|
2706
|
+
symbol.height = clamp(symbol.height, min, max);
|
|
2707
|
+
} else if (isSGisPointSymbol(symbol)) {
|
|
2708
|
+
symbol.size = clamp(symbol.size, min, max);
|
|
2709
|
+
}
|
|
2803
2710
|
|
|
2804
|
-
|
|
2805
|
-
const pointFeature = /*#__PURE__*/new PointFeature.PointFeature([50, -50], {
|
|
2806
|
-
crs: Crs.plain
|
|
2807
|
-
});
|
|
2808
|
-
const lineFeature = /*#__PURE__*/new Polyline.Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2809
|
-
crs: Crs.plain
|
|
2810
|
-
});
|
|
2811
|
-
const polygonFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
|
|
2812
|
-
crs: Crs.plain
|
|
2813
|
-
});
|
|
2814
|
-
const h3gridFeature = /*#__PURE__*/new H3Feature.H3Feature([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2815
|
-
crs: Crs.plain
|
|
2816
|
-
});
|
|
2817
|
-
const lineLegendFeature = /*#__PURE__*/new Polyline.Polyline([[0, -50], [100, -50]], {
|
|
2818
|
-
crs: Crs.plain
|
|
2819
|
-
});
|
|
2820
|
-
const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
|
|
2821
|
-
crs: Crs.plain
|
|
2822
|
-
});
|
|
2823
|
-
const polygonMapLegendFeature = /*#__PURE__*/new Polygon.Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2824
|
-
crs: Crs.plain
|
|
2825
|
-
});
|
|
2826
|
-
const MAP_LEGEND_FEATURES = {
|
|
2827
|
-
polygon: polygonMapLegendFeature
|
|
2828
|
-
};
|
|
2829
|
-
const LEGEND_FEATURES = {
|
|
2830
|
-
point: pointFeature,
|
|
2831
|
-
polyline: lineLegendFeature,
|
|
2832
|
-
polygon: polygonLegendFeature,
|
|
2833
|
-
h3grid: h3gridFeature
|
|
2711
|
+
return symbol;
|
|
2834
2712
|
};
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2713
|
+
function centerAlignSymbol(symbol) {
|
|
2714
|
+
if (isSGisImageSymbol(symbol)) {
|
|
2715
|
+
symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
|
|
2716
|
+
} else if (isSGisPointSymbol(symbol)) {
|
|
2717
|
+
symbol.offset = [0, 0];
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
return symbol;
|
|
2721
|
+
}
|
|
2722
|
+
const adjustSymbol = (symbol, _ref) => {
|
|
2723
|
+
let {
|
|
2724
|
+
size
|
|
2725
|
+
} = _ref;
|
|
2726
|
+
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
2840
2727
|
};
|
|
2841
2728
|
|
|
2842
|
-
function
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
}
|
|
2729
|
+
let EvergisFeature = /*#__PURE__*/function () {
|
|
2730
|
+
function EvergisFeature(feature) {
|
|
2731
|
+
_classCallCheck(this, EvergisFeature);
|
|
2846
2732
|
|
|
2847
|
-
|
|
2848
|
-
|
|
2733
|
+
this.id = null;
|
|
2734
|
+
this.displayName = null;
|
|
2735
|
+
this.geometry = null;
|
|
2736
|
+
this.layerName = null;
|
|
2737
|
+
this.layerAlias = null;
|
|
2738
|
+
this.attributes = null;
|
|
2739
|
+
this.symbol = null;
|
|
2740
|
+
this.id = feature.id;
|
|
2741
|
+
this.displayName = feature.id;
|
|
2742
|
+
this.geometry = feature.geometry;
|
|
2743
|
+
this.layerName = feature.layer;
|
|
2744
|
+
this.layerAlias = feature.layer;
|
|
2745
|
+
this.attributes = getFeatureAttributes(feature.attributes);
|
|
2849
2746
|
}
|
|
2850
2747
|
|
|
2851
|
-
|
|
2748
|
+
_createClass(EvergisFeature, [{
|
|
2749
|
+
key: "sGisFeature",
|
|
2750
|
+
value: function sGisFeature() {
|
|
2751
|
+
if (!this.geometry || !this.symbol) {
|
|
2752
|
+
return null;
|
|
2753
|
+
} // @ts-ignore
|
|
2852
2754
|
|
|
2853
|
-
const featuresToRender = _extends({}, MOCK_FEATURES, features);
|
|
2854
2755
|
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
}
|
|
2862
|
-
|
|
2863
|
-
if (isSGisH3Symbol(symbol)) {
|
|
2864
|
-
return symbol.renderFunctionAsync(featuresToRender.h3grid, resolution, Crs.plain);
|
|
2865
|
-
}
|
|
2866
|
-
|
|
2867
|
-
return symbol.renderFunctionAsync(featuresToRender.point, resolution, Crs.plain);
|
|
2868
|
-
}
|
|
2869
|
-
const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
|
|
2870
|
-
if (size === void 0) {
|
|
2871
|
-
size = viewBoxSize;
|
|
2872
|
-
}
|
|
2756
|
+
const {
|
|
2757
|
+
type,
|
|
2758
|
+
coordinates,
|
|
2759
|
+
sr
|
|
2760
|
+
} = this.geometry;
|
|
2761
|
+
const crs = CRS_MAP[sr];
|
|
2873
2762
|
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
if (size === void 0) {
|
|
2878
|
-
size = viewBoxSize;
|
|
2879
|
-
}
|
|
2763
|
+
if (!crs) {
|
|
2764
|
+
return null;
|
|
2765
|
+
}
|
|
2880
2766
|
|
|
2881
|
-
|
|
2882
|
-
|
|
2767
|
+
switch (type) {
|
|
2768
|
+
case api.GeometryType.Point:
|
|
2769
|
+
return new PointFeature.PointFeature(coordinates, {
|
|
2770
|
+
symbol: selectedPoint,
|
|
2771
|
+
crs
|
|
2772
|
+
});
|
|
2883
2773
|
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
}
|
|
2774
|
+
case api.GeometryType.Multipoint:
|
|
2775
|
+
return new MultiPoint.MultiPoint(coordinates, {
|
|
2776
|
+
symbol: selectedPoint,
|
|
2777
|
+
crs
|
|
2778
|
+
});
|
|
2889
2779
|
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2780
|
+
case api.GeometryType.Polyline:
|
|
2781
|
+
return new Polyline.Polyline(coordinates, {
|
|
2782
|
+
symbol: selectedPolyline,
|
|
2783
|
+
crs
|
|
2784
|
+
});
|
|
2894
2785
|
|
|
2895
|
-
|
|
2896
|
-
|
|
2786
|
+
case api.GeometryType.Polygon:
|
|
2787
|
+
return new Polygon.Polygon(coordinates, {
|
|
2788
|
+
symbol: selectedPolygon,
|
|
2789
|
+
crs
|
|
2790
|
+
});
|
|
2897
2791
|
|
|
2898
|
-
|
|
2899
|
-
|
|
2792
|
+
default:
|
|
2793
|
+
return null;
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
}, {
|
|
2797
|
+
key: "extent",
|
|
2798
|
+
value: function extent() {
|
|
2799
|
+
const feature = this.sGisFeature();
|
|
2800
|
+
return feature && feature.bbox;
|
|
2801
|
+
}
|
|
2802
|
+
}]);
|
|
2900
2803
|
|
|
2901
|
-
|
|
2902
|
-
|
|
2804
|
+
return EvergisFeature;
|
|
2805
|
+
}();
|
|
2903
2806
|
|
|
2904
|
-
|
|
2905
|
-
|
|
2807
|
+
function evaluateCondition(condition$1, attributes) {
|
|
2808
|
+
try {
|
|
2809
|
+
const evaluator = new condition.ConditionEvaluator(attributes);
|
|
2810
|
+
const result = evaluator.evaluate(condition$1);
|
|
2906
2811
|
|
|
2907
|
-
|
|
2908
|
-
return
|
|
2812
|
+
if (result instanceof Error) {
|
|
2813
|
+
return null;
|
|
2814
|
+
}
|
|
2909
2815
|
|
|
2910
|
-
|
|
2911
|
-
|
|
2816
|
+
return result;
|
|
2817
|
+
} catch (_unused) {
|
|
2818
|
+
return null;
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2912
2821
|
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2822
|
+
function getAttributeValue(attributes, attributeName) {
|
|
2823
|
+
const attributeMeta = attributes.find((_ref) => {
|
|
2824
|
+
let {
|
|
2825
|
+
name
|
|
2826
|
+
} = _ref;
|
|
2827
|
+
return name === attributeName;
|
|
2828
|
+
});
|
|
2829
|
+
return attributeMeta ? attributeMeta.value : null;
|
|
2830
|
+
}
|
|
2916
2831
|
|
|
2917
|
-
|
|
2918
|
-
|
|
2832
|
+
const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
|
|
2833
|
+
const getAttributeNameFromClassified = values => values.length > 0 ? getAttributeNameFromCondition(values[0].condition) : null;
|
|
2919
2834
|
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2835
|
+
function findFeatureValue(parameterValues, _ref2) {
|
|
2836
|
+
let [name, value] = _ref2;
|
|
2837
|
+
return value !== null ? parameterValues.find((_ref3) => {
|
|
2838
|
+
let {
|
|
2839
|
+
condition
|
|
2840
|
+
} = _ref3;
|
|
2841
|
+
return value !== undefined && evaluateCondition(condition, {
|
|
2842
|
+
[name]: value
|
|
2843
|
+
});
|
|
2844
|
+
}) : null;
|
|
2923
2845
|
}
|
|
2924
2846
|
|
|
2925
|
-
function
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
return
|
|
2929
|
-
cellSize: getParameterValue(symbol.cellSize),
|
|
2930
|
-
strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
|
|
2931
|
-
strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
|
|
2932
|
-
fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
|
|
2933
|
-
}));
|
|
2847
|
+
function extractValuesAttribute(parameterValues, attributes) {
|
|
2848
|
+
const name = getAttributeNameFromClassified(parameterValues) || '';
|
|
2849
|
+
const value = name && getAttributeValue(attributes, name);
|
|
2850
|
+
return [name, value];
|
|
2934
2851
|
}
|
|
2935
2852
|
|
|
2936
|
-
function
|
|
2853
|
+
function evaluateFeatureSymbol(attributes) {
|
|
2937
2854
|
// @ts-ignore
|
|
2938
|
-
|
|
2939
|
-
|
|
2855
|
+
function calc(result, _ref4) {
|
|
2856
|
+
let [parameterName, parameterValue] = _ref4;
|
|
2857
|
+
let newParameterValue;
|
|
2940
2858
|
|
|
2941
|
-
|
|
2859
|
+
if (isParameterByAttribute(parameterValue)) {
|
|
2860
|
+
const [attributeName, attributeValue] = extractValuesAttribute(parameterValue.values, attributes);
|
|
2861
|
+
const featureValue = findFeatureValue(parameterValue.values, [attributeName, attributeValue]);
|
|
2862
|
+
newParameterValue = featureValue ? featureValue.value : parameterValue.defaultValue;
|
|
2863
|
+
} else if (isObject(parameterValue)) {
|
|
2864
|
+
// @ts-ignore
|
|
2865
|
+
newParameterValue = Object.entries(parameterValue).reduce(calc, parameterValue);
|
|
2866
|
+
}
|
|
2942
2867
|
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
size,
|
|
2948
|
-
offset,
|
|
2949
|
-
angle,
|
|
2950
|
-
background,
|
|
2951
|
-
figure
|
|
2952
|
-
} = _ref;
|
|
2953
|
-
return _extends({
|
|
2954
|
-
type: getParameterValue(type),
|
|
2955
|
-
data: getParameterValue(data),
|
|
2956
|
-
size: getParameterValue(size),
|
|
2957
|
-
offset: getOffsetParameterValue(offset),
|
|
2958
|
-
angle: getParameterValue(angle)
|
|
2959
|
-
}, background ? {
|
|
2960
|
-
background: _extends({}, background, {
|
|
2961
|
-
fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
|
|
2962
|
-
strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
|
|
2963
|
-
strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
|
|
2964
|
-
})
|
|
2965
|
-
} : {}, figure ? {
|
|
2966
|
-
figure: _extends({}, figure, {
|
|
2967
|
-
fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
|
|
2968
|
-
})
|
|
2969
|
-
} : {});
|
|
2970
|
-
}
|
|
2868
|
+
return newParameterValue !== undefined ? _extends({}, result, {
|
|
2869
|
+
[parameterName]: newParameterValue
|
|
2870
|
+
}) : result;
|
|
2871
|
+
}
|
|
2971
2872
|
|
|
2972
|
-
|
|
2973
|
-
return new Point.PointSymbol(deserializeSvgPointSymbolParams(symbol));
|
|
2873
|
+
return calc;
|
|
2974
2874
|
}
|
|
2975
2875
|
|
|
2976
|
-
function
|
|
2977
|
-
return
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2876
|
+
function findChildFeatureStyle(childStyles, attributes) {
|
|
2877
|
+
return (childStyles || []).find((_ref5) => {
|
|
2878
|
+
let {
|
|
2879
|
+
condition
|
|
2880
|
+
} = _ref5;
|
|
2881
|
+
const attributeName = condition && getAttributeNameFromCondition(condition);
|
|
2882
|
+
const attributeValue = attributeName && getAttributeValue(attributes, attributeName);
|
|
2982
2883
|
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
width: getParameterValue(symbol.width),
|
|
2989
|
-
// @ts-ignore
|
|
2990
|
-
height: getParameterValue(symbol.height),
|
|
2991
|
-
// @ts-ignore
|
|
2992
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2993
|
-
// @ts-ignore
|
|
2994
|
-
imageSource: deserializeBase64(symbol.image),
|
|
2995
|
-
// @ts-ignore
|
|
2996
|
-
maskSource: deserializeBase64(symbol.imageMask),
|
|
2997
|
-
// @ts-ignore
|
|
2998
|
-
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2999
|
-
}));
|
|
3000
|
-
}
|
|
2884
|
+
if (condition && attributeName && attributeValue !== undefined) {
|
|
2885
|
+
return evaluateCondition(condition, {
|
|
2886
|
+
[attributeName]: attributeValue
|
|
2887
|
+
});
|
|
2888
|
+
}
|
|
3001
2889
|
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
// @ts-ignore
|
|
3009
|
-
height: getParameterValue(symbol.height),
|
|
3010
|
-
// @ts-ignore
|
|
3011
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
3012
|
-
// @ts-ignore
|
|
3013
|
-
source: deserializeBase64(symbol.image)
|
|
3014
|
-
}));
|
|
2890
|
+
return false;
|
|
2891
|
+
}) || null;
|
|
2892
|
+
}
|
|
2893
|
+
function findChildFeatureSymbol(childStyles, attributes) {
|
|
2894
|
+
const featureStyle = findChildFeatureStyle(childStyles, attributes);
|
|
2895
|
+
return featureStyle ? featureStyle.symbol : null;
|
|
3015
2896
|
}
|
|
2897
|
+
function getFeatureSymbol(style, attributes) {
|
|
2898
|
+
if (!style || !style.symbol) {
|
|
2899
|
+
return null;
|
|
2900
|
+
}
|
|
3016
2901
|
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
return new SGisImageFill(symbol);
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
|
-
if (isPolygonHasHatchBrush(symbol)) {
|
|
3023
|
-
return new SGisBrushFill(symbol);
|
|
3024
|
-
}
|
|
3025
|
-
|
|
3026
|
-
return new SGisPolygonSymbol(symbol);
|
|
3027
|
-
}
|
|
3028
|
-
|
|
3029
|
-
function deserializePolylineSymbol(symbol) {
|
|
3030
|
-
return new SGisPolylineSymbol(symbol);
|
|
3031
|
-
}
|
|
3032
|
-
|
|
3033
|
-
function deserializePointSymbolParams(_ref2) {
|
|
3034
|
-
let {
|
|
3035
|
-
size,
|
|
3036
|
-
offset,
|
|
3037
|
-
strokeColor,
|
|
3038
|
-
strokeWidth,
|
|
3039
|
-
fillColor
|
|
3040
|
-
} = _ref2;
|
|
3041
|
-
return {
|
|
3042
|
-
size: getParameterValue(size),
|
|
3043
|
-
offset: deserializeAnchor(offset),
|
|
3044
|
-
strokeWidth: getParameterValue(strokeWidth),
|
|
3045
|
-
strokeColor: deserializeColor(getParameterValue(strokeColor)),
|
|
3046
|
-
fillColor: deserializeColor(getParameterValue(fillColor))
|
|
3047
|
-
};
|
|
3048
|
-
}
|
|
3049
|
-
|
|
3050
|
-
function deserializeBase64(base) {
|
|
3051
|
-
return "data:image/png;base64," + base;
|
|
3052
|
-
}
|
|
3053
|
-
|
|
3054
|
-
function deserializeAnchor(offset) {
|
|
3055
|
-
// @ts-ignore
|
|
3056
|
-
return offset.map(getParameterValue);
|
|
3057
|
-
}
|
|
3058
|
-
|
|
3059
|
-
function deserializeColor(color$1) {
|
|
3060
|
-
return color$1 ? new color.Color(color$1).toString() : null;
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
const clampSymbol = (symbol, min, max) => {
|
|
3064
|
-
if (isSGisImageSymbol(symbol)) {
|
|
3065
|
-
symbol.width = clamp(symbol.width, min, max);
|
|
3066
|
-
symbol.height = clamp(symbol.height, min, max);
|
|
3067
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
3068
|
-
symbol.size = clamp(symbol.size, min, max);
|
|
3069
|
-
}
|
|
3070
|
-
|
|
3071
|
-
return symbol;
|
|
3072
|
-
};
|
|
3073
|
-
function centerAlignSymbol(symbol) {
|
|
3074
|
-
if (isSGisImageSymbol(symbol)) {
|
|
3075
|
-
symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
|
|
3076
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
3077
|
-
symbol.offset = [0, 0];
|
|
3078
|
-
}
|
|
3079
|
-
|
|
3080
|
-
return symbol;
|
|
3081
|
-
}
|
|
3082
|
-
const adjustSymbol = (symbol, _ref) => {
|
|
3083
|
-
let {
|
|
3084
|
-
size
|
|
3085
|
-
} = _ref;
|
|
3086
|
-
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
3087
|
-
};
|
|
3088
|
-
|
|
3089
|
-
let EvergisFeature = /*#__PURE__*/function () {
|
|
3090
|
-
function EvergisFeature(feature) {
|
|
3091
|
-
_classCallCheck(this, EvergisFeature);
|
|
3092
|
-
|
|
3093
|
-
this.id = null;
|
|
3094
|
-
this.displayName = null;
|
|
3095
|
-
this.geometry = null;
|
|
3096
|
-
this.layerName = null;
|
|
3097
|
-
this.layerAlias = null;
|
|
3098
|
-
this.attributes = null;
|
|
3099
|
-
this.symbol = null;
|
|
3100
|
-
this.id = feature.id;
|
|
3101
|
-
this.displayName = feature.id;
|
|
3102
|
-
this.geometry = feature.geometry;
|
|
3103
|
-
this.layerName = feature.layer;
|
|
3104
|
-
this.layerAlias = feature.layer;
|
|
3105
|
-
this.attributes = getFeatureAttributes(feature.attributes);
|
|
3106
|
-
}
|
|
3107
|
-
|
|
3108
|
-
_createClass(EvergisFeature, [{
|
|
3109
|
-
key: "sGisFeature",
|
|
3110
|
-
value: function sGisFeature() {
|
|
3111
|
-
if (!this.geometry || !this.symbol) {
|
|
3112
|
-
return null;
|
|
3113
|
-
} // @ts-ignore
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
const {
|
|
3117
|
-
type,
|
|
3118
|
-
coordinates,
|
|
3119
|
-
sr
|
|
3120
|
-
} = this.geometry;
|
|
3121
|
-
const crs = CRS_MAP[sr];
|
|
3122
|
-
|
|
3123
|
-
if (!crs) {
|
|
3124
|
-
return null;
|
|
3125
|
-
}
|
|
3126
|
-
|
|
3127
|
-
switch (type) {
|
|
3128
|
-
case api.GeometryType.Point:
|
|
3129
|
-
return new PointFeature.PointFeature(coordinates, {
|
|
3130
|
-
symbol: selectedPoint,
|
|
3131
|
-
crs
|
|
3132
|
-
});
|
|
3133
|
-
|
|
3134
|
-
case api.GeometryType.Multipoint:
|
|
3135
|
-
return new MultiPoint.MultiPoint(coordinates, {
|
|
3136
|
-
symbol: selectedPoint,
|
|
3137
|
-
crs
|
|
3138
|
-
});
|
|
3139
|
-
|
|
3140
|
-
case api.GeometryType.Polyline:
|
|
3141
|
-
return new Polyline.Polyline(coordinates, {
|
|
3142
|
-
symbol: selectedPolyline,
|
|
3143
|
-
crs
|
|
3144
|
-
});
|
|
3145
|
-
|
|
3146
|
-
case api.GeometryType.Polygon:
|
|
3147
|
-
return new Polygon.Polygon(coordinates, {
|
|
3148
|
-
symbol: selectedPolygon,
|
|
3149
|
-
crs
|
|
3150
|
-
});
|
|
3151
|
-
|
|
3152
|
-
default:
|
|
3153
|
-
return null;
|
|
3154
|
-
}
|
|
3155
|
-
}
|
|
3156
|
-
}, {
|
|
3157
|
-
key: "extent",
|
|
3158
|
-
value: function extent() {
|
|
3159
|
-
const feature = this.sGisFeature();
|
|
3160
|
-
return feature && feature.bbox;
|
|
3161
|
-
}
|
|
3162
|
-
}]);
|
|
3163
|
-
|
|
3164
|
-
return EvergisFeature;
|
|
3165
|
-
}();
|
|
3166
|
-
|
|
3167
|
-
function evaluateCondition(condition$1, attributes) {
|
|
3168
|
-
try {
|
|
3169
|
-
const evaluator = new condition.ConditionEvaluator(attributes);
|
|
3170
|
-
const result = evaluator.evaluate(condition$1);
|
|
3171
|
-
|
|
3172
|
-
if (result instanceof Error) {
|
|
3173
|
-
return null;
|
|
3174
|
-
}
|
|
3175
|
-
|
|
3176
|
-
return result;
|
|
3177
|
-
} catch (_unused) {
|
|
3178
|
-
return null;
|
|
3179
|
-
}
|
|
3180
|
-
}
|
|
3181
|
-
|
|
3182
|
-
function getAttributeValue(attributes, attributeName) {
|
|
3183
|
-
const attributeMeta = attributes.find(_ref => {
|
|
3184
|
-
let {
|
|
3185
|
-
name
|
|
3186
|
-
} = _ref;
|
|
3187
|
-
return name === attributeName;
|
|
3188
|
-
});
|
|
3189
|
-
return attributeMeta ? attributeMeta.value : null;
|
|
3190
|
-
}
|
|
3191
|
-
|
|
3192
|
-
const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
|
|
3193
|
-
const getAttributeNameFromClassified = values => values.length > 0 ? getAttributeNameFromCondition(values[0].condition) : null;
|
|
3194
|
-
|
|
3195
|
-
function findFeatureValue(parameterValues, _ref2) {
|
|
3196
|
-
let [name, value] = _ref2;
|
|
3197
|
-
return value !== null ? parameterValues.find(_ref3 => {
|
|
3198
|
-
let {
|
|
3199
|
-
condition
|
|
3200
|
-
} = _ref3;
|
|
3201
|
-
return value !== undefined && evaluateCondition(condition, {
|
|
3202
|
-
[name]: value
|
|
3203
|
-
});
|
|
3204
|
-
}) : null;
|
|
3205
|
-
}
|
|
3206
|
-
|
|
3207
|
-
function extractValuesAttribute(parameterValues, attributes) {
|
|
3208
|
-
const name = getAttributeNameFromClassified(parameterValues) || '';
|
|
3209
|
-
const value = name && getAttributeValue(attributes, name);
|
|
3210
|
-
return [name, value];
|
|
3211
|
-
}
|
|
3212
|
-
|
|
3213
|
-
function evaluateFeatureSymbol(attributes) {
|
|
3214
|
-
// @ts-ignore
|
|
3215
|
-
function calc(result, _ref4) {
|
|
3216
|
-
let [parameterName, parameterValue] = _ref4;
|
|
3217
|
-
let newParameterValue;
|
|
3218
|
-
|
|
3219
|
-
if (isParameterByAttribute(parameterValue)) {
|
|
3220
|
-
const [attributeName, attributeValue] = extractValuesAttribute(parameterValue.values, attributes);
|
|
3221
|
-
const featureValue = findFeatureValue(parameterValue.values, [attributeName, attributeValue]);
|
|
3222
|
-
newParameterValue = featureValue ? featureValue.value : parameterValue.defaultValue;
|
|
3223
|
-
} else if (isObject(parameterValue)) {
|
|
3224
|
-
// @ts-ignore
|
|
3225
|
-
newParameterValue = Object.entries(parameterValue).reduce(calc, parameterValue);
|
|
3226
|
-
}
|
|
3227
|
-
|
|
3228
|
-
return newParameterValue !== undefined ? _extends({}, result, {
|
|
3229
|
-
[parameterName]: newParameterValue
|
|
3230
|
-
}) : result;
|
|
3231
|
-
}
|
|
3232
|
-
|
|
3233
|
-
return calc;
|
|
3234
|
-
}
|
|
3235
|
-
|
|
3236
|
-
function findChildFeatureStyle(childStyles, attributes) {
|
|
3237
|
-
return (childStyles || []).find(_ref5 => {
|
|
3238
|
-
let {
|
|
3239
|
-
condition
|
|
3240
|
-
} = _ref5;
|
|
3241
|
-
const attributeName = condition && getAttributeNameFromCondition(condition);
|
|
3242
|
-
const attributeValue = attributeName && getAttributeValue(attributes, attributeName);
|
|
3243
|
-
|
|
3244
|
-
if (condition && attributeName && attributeValue !== undefined) {
|
|
3245
|
-
return evaluateCondition(condition, {
|
|
3246
|
-
[attributeName]: attributeValue
|
|
3247
|
-
});
|
|
3248
|
-
}
|
|
3249
|
-
|
|
3250
|
-
return false;
|
|
3251
|
-
}) || null;
|
|
3252
|
-
}
|
|
3253
|
-
function findChildFeatureSymbol(childStyles, attributes) {
|
|
3254
|
-
const featureStyle = findChildFeatureStyle(childStyles, attributes);
|
|
3255
|
-
return featureStyle ? featureStyle.symbol : null;
|
|
3256
|
-
}
|
|
3257
|
-
function getFeatureSymbol(style, attributes) {
|
|
3258
|
-
if (!style || !style.symbol) {
|
|
3259
|
-
return null;
|
|
3260
|
-
}
|
|
3261
|
-
|
|
3262
|
-
if (style.children !== null) {
|
|
3263
|
-
return findChildFeatureSymbol(style.children, attributes) || style.symbol;
|
|
2902
|
+
if (style.children !== null) {
|
|
2903
|
+
return findChildFeatureSymbol(style.children, attributes) || style.symbol;
|
|
3264
2904
|
}
|
|
3265
2905
|
|
|
3266
2906
|
return Object.entries(style.symbol).reduce(evaluateFeatureSymbol(attributes), style.symbol);
|
|
@@ -3295,7 +2935,7 @@ let EvergisLayer = /*#__PURE__*/function () {
|
|
|
3295
2935
|
feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
|
|
3296
2936
|
feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
|
|
3297
2937
|
feature.layerAlias = this.alias;
|
|
3298
|
-
const titleAttribute = (feature.attributes || []).find(_ref => {
|
|
2938
|
+
const titleAttribute = (feature.attributes || []).find((_ref) => {
|
|
3299
2939
|
let {
|
|
3300
2940
|
name
|
|
3301
2941
|
} = _ref;
|
|
@@ -3318,7 +2958,7 @@ const evaluateFeature = layers => feature => {
|
|
|
3318
2958
|
};
|
|
3319
2959
|
|
|
3320
2960
|
const OTHERS_TITLE = 'Другое';
|
|
3321
|
-
const createLegendItem = _ref => {
|
|
2961
|
+
const createLegendItem = (_ref) => {
|
|
3322
2962
|
let {
|
|
3323
2963
|
attributes,
|
|
3324
2964
|
renderTitle,
|
|
@@ -3364,7 +3004,7 @@ function createStyleLegend(style, config) {
|
|
|
3364
3004
|
classificationManager,
|
|
3365
3005
|
symbol
|
|
3366
3006
|
} = style;
|
|
3367
|
-
const items = classificationManager.filter(_ref => {
|
|
3007
|
+
const items = classificationManager.filter((_ref) => {
|
|
3368
3008
|
let {
|
|
3369
3009
|
parameter
|
|
3370
3010
|
} = _ref;
|
|
@@ -3480,7 +3120,7 @@ const useMapLegend = (layer, config) => {
|
|
|
3480
3120
|
};
|
|
3481
3121
|
|
|
3482
3122
|
const LEGEND_SYMBOL_MAX_SIZE = 32;
|
|
3483
|
-
const useLegendValueSymbol = _ref => {
|
|
3123
|
+
const useLegendValueSymbol = (_ref) => {
|
|
3484
3124
|
let {
|
|
3485
3125
|
parameter,
|
|
3486
3126
|
parameterValue
|
|
@@ -3727,11 +3367,10 @@ function useFeatureLayer(_ref) {
|
|
|
3727
3367
|
}),
|
|
3728
3368
|
destructor: layer => map.indexOf(layer) !== -1 && map.removeLayer(layer),
|
|
3729
3369
|
update: (layer, _ref2) => {
|
|
3730
|
-
let [features
|
|
3370
|
+
let [features] = _ref2;
|
|
3731
3371
|
layer.features = features;
|
|
3732
|
-
layer.opacity = opacity != null ? opacity : 1;
|
|
3733
3372
|
}
|
|
3734
|
-
}, [features
|
|
3373
|
+
}, [features]);
|
|
3735
3374
|
useLayerOrder(layer, zIndex);
|
|
3736
3375
|
useLayerVisibility(layer, isDisplayed);
|
|
3737
3376
|
useLayerOpacity(layer, opacity);
|
|
@@ -3888,7 +3527,7 @@ function useMapWrapper() {
|
|
|
3888
3527
|
return wrapperRef;
|
|
3889
3528
|
}
|
|
3890
3529
|
|
|
3891
|
-
const byScale = scale => _ref => {
|
|
3530
|
+
const byScale = scale => (_ref) => {
|
|
3892
3531
|
let {
|
|
3893
3532
|
zIndex
|
|
3894
3533
|
} = _ref;
|
|
@@ -4087,7 +3726,7 @@ const useTooltip = function useTooltip(zIndex) {
|
|
|
4087
3726
|
|
|
4088
3727
|
return reset;
|
|
4089
3728
|
}, [reset, map, layer, zIndex]);
|
|
4090
|
-
const onSetLabelFeature = React.useCallback(_ref => {
|
|
3729
|
+
const onSetLabelFeature = React.useCallback((_ref) => {
|
|
4091
3730
|
let {
|
|
4092
3731
|
point,
|
|
4093
3732
|
position,
|
|
@@ -4251,7 +3890,7 @@ function useClusterLayer(_ref) {
|
|
|
4251
3890
|
}
|
|
4252
3891
|
|
|
4253
3892
|
const INIT_FEATURES = [];
|
|
4254
|
-
const useEvergisSelect = _ref => {
|
|
3893
|
+
const useEvergisSelect = (_ref) => {
|
|
4255
3894
|
let {
|
|
4256
3895
|
onPick,
|
|
4257
3896
|
onFeatures
|
|
@@ -4284,7 +3923,7 @@ function none() {
|
|
|
4284
3923
|
return;
|
|
4285
3924
|
}
|
|
4286
3925
|
|
|
4287
|
-
const useDraggableMarker = _ref => {
|
|
3926
|
+
const useDraggableMarker = (_ref) => {
|
|
4288
3927
|
let {
|
|
4289
3928
|
position,
|
|
4290
3929
|
onChange,
|
|
@@ -4406,7 +4045,7 @@ const useToggle = initial => {
|
|
|
4406
4045
|
return [state, toggle, setState];
|
|
4407
4046
|
};
|
|
4408
4047
|
|
|
4409
|
-
const Symbol = _ref => {
|
|
4048
|
+
const Symbol = (_ref) => {
|
|
4410
4049
|
let {
|
|
4411
4050
|
symbol,
|
|
4412
4051
|
size,
|
|
@@ -4427,19 +4066,19 @@ const Symbol = _ref => {
|
|
|
4427
4066
|
};
|
|
4428
4067
|
|
|
4429
4068
|
var _templateObject, _templateObject2;
|
|
4430
|
-
const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), _ref => {
|
|
4069
|
+
const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), (_ref) => {
|
|
4431
4070
|
let {
|
|
4432
4071
|
geometryType,
|
|
4433
4072
|
icons
|
|
4434
4073
|
} = _ref;
|
|
4435
4074
|
return "url(" + icons[geometryType] + ") center center / " + (geometryType === api.GeometryType.Polyline ? '2rem 1.3rem' : 'auto 1rem') + " no-repeat";
|
|
4436
4075
|
});
|
|
4437
|
-
const ClusterSymbol = /*#__PURE__*/styled__default.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 => {
|
|
4076
|
+
const ClusterSymbol = /*#__PURE__*/styled__default.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) => {
|
|
4438
4077
|
let {
|
|
4439
4078
|
color
|
|
4440
4079
|
} = _ref2;
|
|
4441
4080
|
return color;
|
|
4442
|
-
}, _ref3 => {
|
|
4081
|
+
}, (_ref3) => {
|
|
4443
4082
|
let {
|
|
4444
4083
|
color
|
|
4445
4084
|
} = _ref3;
|
|
@@ -4447,7 +4086,7 @@ const ClusterSymbol = /*#__PURE__*/styled__default.div(_templateObject2 || (_tem
|
|
|
4447
4086
|
});
|
|
4448
4087
|
|
|
4449
4088
|
const MAX_SIZE = 32;
|
|
4450
|
-
const StyleSymbol = _ref => {
|
|
4089
|
+
const StyleSymbol = (_ref) => {
|
|
4451
4090
|
let {
|
|
4452
4091
|
symbol,
|
|
4453
4092
|
size = MAX_SIZE,
|
|
@@ -4504,7 +4143,7 @@ const AttributeValueContainer = /*#__PURE__*/styled__default.div(_templateObject
|
|
|
4504
4143
|
const SimpleAttribute = /*#__PURE__*/styled__default.div(_templateObject15 || (_templateObject15 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
|
|
4505
4144
|
const ValueLink = /*#__PURE__*/styled__default.a(_templateObject16 || (_templateObject16 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 0 0.25rem;\n color: #1fb3aa;\n text-decoration: none;\n"])));
|
|
4506
4145
|
|
|
4507
|
-
const MailValue = _ref => {
|
|
4146
|
+
const MailValue = (_ref) => {
|
|
4508
4147
|
let {
|
|
4509
4148
|
mail
|
|
4510
4149
|
} = _ref;
|
|
@@ -4515,7 +4154,7 @@ const MailValue = _ref => {
|
|
|
4515
4154
|
}, mail);
|
|
4516
4155
|
};
|
|
4517
4156
|
|
|
4518
|
-
const PhoneValue = _ref => {
|
|
4157
|
+
const PhoneValue = (_ref) => {
|
|
4519
4158
|
let {
|
|
4520
4159
|
phone
|
|
4521
4160
|
} = _ref;
|
|
@@ -4526,7 +4165,7 @@ const PhoneValue = _ref => {
|
|
|
4526
4165
|
}, phone);
|
|
4527
4166
|
};
|
|
4528
4167
|
|
|
4529
|
-
const UrlValue = _ref => {
|
|
4168
|
+
const UrlValue = (_ref) => {
|
|
4530
4169
|
let {
|
|
4531
4170
|
url
|
|
4532
4171
|
} = _ref;
|
|
@@ -4537,7 +4176,7 @@ const UrlValue = _ref => {
|
|
|
4537
4176
|
}, url);
|
|
4538
4177
|
};
|
|
4539
4178
|
|
|
4540
|
-
const AttributeValue = _ref => {
|
|
4179
|
+
const AttributeValue = (_ref) => {
|
|
4541
4180
|
let {
|
|
4542
4181
|
attribute
|
|
4543
4182
|
} = _ref;
|
|
@@ -4551,29 +4190,29 @@ const AttributeValue = _ref => {
|
|
|
4551
4190
|
if (attributeValue.type === 2
|
|
4552
4191
|
/* Url */
|
|
4553
4192
|
) {
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4193
|
+
return React__default.createElement(UrlValue, {
|
|
4194
|
+
key: key,
|
|
4195
|
+
url: punycodeDecode(value)
|
|
4196
|
+
});
|
|
4197
|
+
}
|
|
4559
4198
|
|
|
4560
4199
|
if (attributeValue.type === 3
|
|
4561
4200
|
/* Mail */
|
|
4562
4201
|
) {
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4202
|
+
return React__default.createElement(MailValue, {
|
|
4203
|
+
key: key,
|
|
4204
|
+
mail: value
|
|
4205
|
+
});
|
|
4206
|
+
}
|
|
4568
4207
|
|
|
4569
4208
|
if (attributeValue.type === 1
|
|
4570
4209
|
/* Phone */
|
|
4571
4210
|
) {
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4211
|
+
return React__default.createElement(PhoneValue, {
|
|
4212
|
+
key: key,
|
|
4213
|
+
phone: value
|
|
4214
|
+
});
|
|
4215
|
+
}
|
|
4577
4216
|
|
|
4578
4217
|
return React__default.createElement(SimpleAttribute, {
|
|
4579
4218
|
key: value
|
|
@@ -4589,7 +4228,7 @@ function punycodeDecode(domains) {
|
|
|
4589
4228
|
}
|
|
4590
4229
|
}
|
|
4591
4230
|
|
|
4592
|
-
const EvergisCardAttribute = _ref => {
|
|
4231
|
+
const EvergisCardAttribute = (_ref) => {
|
|
4593
4232
|
let {
|
|
4594
4233
|
attribute,
|
|
4595
4234
|
className
|
|
@@ -4601,7 +4240,7 @@ const EvergisCardAttribute = _ref => {
|
|
|
4601
4240
|
}));
|
|
4602
4241
|
};
|
|
4603
4242
|
|
|
4604
|
-
const StyledCard = _ref => {
|
|
4243
|
+
const StyledCard = (_ref) => {
|
|
4605
4244
|
let {
|
|
4606
4245
|
features = [],
|
|
4607
4246
|
className,
|
|
@@ -4647,7 +4286,7 @@ const StyledCard = _ref => {
|
|
|
4647
4286
|
};
|
|
4648
4287
|
|
|
4649
4288
|
const _excluded$1 = ["renderCard", "className", "children"];
|
|
4650
|
-
const EvergisCard = _ref => {
|
|
4289
|
+
const EvergisCard = (_ref) => {
|
|
4651
4290
|
let {
|
|
4652
4291
|
renderCard,
|
|
4653
4292
|
className,
|
|
@@ -4699,7 +4338,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
|
|
|
4699
4338
|
|
|
4700
4339
|
const useSGisFeatures = (features, currentIndex) => React.useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
|
|
4701
4340
|
|
|
4702
|
-
const EvergisSelectLayer = _ref => {
|
|
4341
|
+
const EvergisSelectLayer = (_ref) => {
|
|
4703
4342
|
let {
|
|
4704
4343
|
features,
|
|
4705
4344
|
zIndex,
|
|
@@ -4744,7 +4383,7 @@ const TileLayer = props => {
|
|
|
4744
4383
|
};
|
|
4745
4384
|
|
|
4746
4385
|
const defaultZIndex = 200;
|
|
4747
|
-
const EvergisSelect = _ref => {
|
|
4386
|
+
const EvergisSelect = (_ref) => {
|
|
4748
4387
|
let {
|
|
4749
4388
|
onPick,
|
|
4750
4389
|
className,
|
|
@@ -4779,7 +4418,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled__default.p(_templateObject3$1 || (
|
|
|
4779
4418
|
const LegendValueContainer = /*#__PURE__*/styled__default.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);
|
|
4780
4419
|
const LegendSectionHeader = /*#__PURE__*/styled__default.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
|
|
4781
4420
|
|
|
4782
|
-
const LegendSection = _ref => {
|
|
4421
|
+
const LegendSection = (_ref) => {
|
|
4783
4422
|
let {
|
|
4784
4423
|
item,
|
|
4785
4424
|
renderLegendTitle,
|
|
@@ -4793,7 +4432,7 @@ var _templateObject$3, _templateObject2$3;
|
|
|
4793
4432
|
const InputContainer = /*#__PURE__*/styled__default.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"])));
|
|
4794
4433
|
const InputField = /*#__PURE__*/styled__default.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"])));
|
|
4795
4434
|
|
|
4796
|
-
const SearchInput = _ref => {
|
|
4435
|
+
const SearchInput = (_ref) => {
|
|
4797
4436
|
let {
|
|
4798
4437
|
onChange
|
|
4799
4438
|
} = _ref;
|
|
@@ -4802,7 +4441,7 @@ const SearchInput = _ref => {
|
|
|
4802
4441
|
}));
|
|
4803
4442
|
};
|
|
4804
4443
|
|
|
4805
|
-
const LegendSymbol = _ref => {
|
|
4444
|
+
const LegendSymbol = (_ref) => {
|
|
4806
4445
|
let {
|
|
4807
4446
|
parameter,
|
|
4808
4447
|
parameterValue,
|
|
@@ -4820,7 +4459,7 @@ const LegendSymbol = _ref => {
|
|
|
4820
4459
|
return React__default.createElement(React__default.Fragment, null, children(symbol));
|
|
4821
4460
|
};
|
|
4822
4461
|
|
|
4823
|
-
const LegendValue = _ref => {
|
|
4462
|
+
const LegendValue = (_ref) => {
|
|
4824
4463
|
let {
|
|
4825
4464
|
value,
|
|
4826
4465
|
parameter,
|
|
@@ -4842,7 +4481,7 @@ const getNumberParam = (parameterValue, param) => {
|
|
|
4842
4481
|
return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
|
|
4843
4482
|
};
|
|
4844
4483
|
|
|
4845
|
-
const getSymbolSize = _ref => {
|
|
4484
|
+
const getSymbolSize = (_ref) => {
|
|
4846
4485
|
let {
|
|
4847
4486
|
parameterValue,
|
|
4848
4487
|
maxSize
|
|
@@ -4867,7 +4506,7 @@ const getSymbolSize = _ref => {
|
|
|
4867
4506
|
}
|
|
4868
4507
|
};
|
|
4869
4508
|
|
|
4870
|
-
const Legend = _ref => {
|
|
4509
|
+
const Legend = (_ref) => {
|
|
4871
4510
|
let {
|
|
4872
4511
|
layer,
|
|
4873
4512
|
children,
|
|
@@ -4911,7 +4550,7 @@ const Legend = _ref => {
|
|
|
4911
4550
|
})))));
|
|
4912
4551
|
};
|
|
4913
4552
|
|
|
4914
|
-
const Map = _ref => {
|
|
4553
|
+
const Map = (_ref) => {
|
|
4915
4554
|
let {
|
|
4916
4555
|
className,
|
|
4917
4556
|
position,
|
|
@@ -4983,27 +4622,27 @@ const FullscreenBtn = /*#__PURE__*/styled__default(icons.Icon)(_templateObject5$
|
|
|
4983
4622
|
const MeasureBtn = /*#__PURE__*/styled__default(icons.Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin); // MeasureBtn.defaultProps = { kind: "measure_length" };
|
|
4984
4623
|
|
|
4985
4624
|
const MapControl = /*#__PURE__*/styled__default.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"])));
|
|
4986
|
-
const MapControls = /*#__PURE__*/styled__default.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 => {
|
|
4625
|
+
const MapControls = /*#__PURE__*/styled__default.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) => {
|
|
4987
4626
|
let {
|
|
4988
4627
|
vertical
|
|
4989
4628
|
} = _ref;
|
|
4990
4629
|
return vertical ? 'column' : 'row';
|
|
4991
|
-
}, _ref2 => {
|
|
4630
|
+
}, (_ref2) => {
|
|
4992
4631
|
let {
|
|
4993
4632
|
placement
|
|
4994
4633
|
} = _ref2;
|
|
4995
4634
|
return placementMixin(placement);
|
|
4996
|
-
}, MapControl, _ref3 => {
|
|
4635
|
+
}, MapControl, (_ref3) => {
|
|
4997
4636
|
let {
|
|
4998
4637
|
vertical
|
|
4999
4638
|
} = _ref3;
|
|
5000
4639
|
return vertical ? '0.5rem' : '0';
|
|
5001
|
-
}, _ref4 => {
|
|
4640
|
+
}, (_ref4) => {
|
|
5002
4641
|
let {
|
|
5003
4642
|
vertical
|
|
5004
4643
|
} = _ref4;
|
|
5005
4644
|
return vertical ? '0' : '0.5rem';
|
|
5006
|
-
}, _ref5 => {
|
|
4645
|
+
}, (_ref5) => {
|
|
5007
4646
|
let {
|
|
5008
4647
|
vertical
|
|
5009
4648
|
} = _ref5;
|
|
@@ -5028,8 +4667,18 @@ const Fullscreen = () => {
|
|
|
5028
4667
|
}));
|
|
5029
4668
|
};
|
|
5030
4669
|
|
|
5031
|
-
|
|
5032
|
-
|
|
4670
|
+
const isParameterType = (types, parameter) => {
|
|
4671
|
+
var _parameter$toLowerCas;
|
|
4672
|
+
|
|
4673
|
+
return (typeof types === "string" ? parameter == null ? void 0 : (_parameter$toLowerCas = parameter.toLowerCase()) == null ? void 0 : _parameter$toLowerCas.includes(types.toLowerCase()) : types.some(type => {
|
|
4674
|
+
var _parameter$toLowerCas2;
|
|
4675
|
+
|
|
4676
|
+
return parameter == null ? void 0 : (_parameter$toLowerCas2 = parameter.toLowerCase()) == null ? void 0 : _parameter$toLowerCas2.includes(type.toLowerCase());
|
|
4677
|
+
})) || false;
|
|
4678
|
+
};
|
|
4679
|
+
|
|
4680
|
+
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;
|
|
4681
|
+
const MapLegendControl = /*#__PURE__*/styled__default(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
5033
4682
|
const MapLegendContainer = /*#__PURE__*/styled__default.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"])));
|
|
5034
4683
|
const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-weight: 500;\n"])));
|
|
5035
4684
|
const MapLegendDescriptionContainer = /*#__PURE__*/styled__default.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"])));
|
|
@@ -5041,195 +4690,523 @@ const SizeLegendItemMixin = function SizeLegendItemMixin(value) {
|
|
|
5041
4690
|
value = 0;
|
|
5042
4691
|
}
|
|
5043
4692
|
|
|
5044
|
-
return styled.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);
|
|
5045
|
-
};
|
|
4693
|
+
return styled.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);
|
|
4694
|
+
};
|
|
4695
|
+
|
|
4696
|
+
const StrokeWidthLegendItemMixin = function StrokeWidthLegendItemMixin(value) {
|
|
4697
|
+
if (value === void 0) {
|
|
4698
|
+
value = 0;
|
|
4699
|
+
}
|
|
4700
|
+
|
|
4701
|
+
return styled.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));
|
|
4702
|
+
};
|
|
4703
|
+
|
|
4704
|
+
const MapLegendItem = /*#__PURE__*/styled__default.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) => {
|
|
4705
|
+
let {
|
|
4706
|
+
parameter
|
|
4707
|
+
} = _ref;
|
|
4708
|
+
return isParameterType(["strokeColor", "stroke.color"], parameter) ? 0.25 : 1;
|
|
4709
|
+
}, (_ref2) => {
|
|
4710
|
+
let {
|
|
4711
|
+
value
|
|
4712
|
+
} = _ref2;
|
|
4713
|
+
return typeof value === "number" ? "none" : value;
|
|
4714
|
+
}, (_ref3) => {
|
|
4715
|
+
let {
|
|
4716
|
+
value,
|
|
4717
|
+
parameter
|
|
4718
|
+
} = _ref3;
|
|
4719
|
+
return isParameterType("size", parameter) && SizeLegendItemMixin(value);
|
|
4720
|
+
}, (_ref4) => {
|
|
4721
|
+
let {
|
|
4722
|
+
value,
|
|
4723
|
+
parameter
|
|
4724
|
+
} = _ref4;
|
|
4725
|
+
return isParameterType(["strokeWidth", "stroke.width"], parameter) && StrokeWidthLegendItemMixin(value);
|
|
4726
|
+
});
|
|
4727
|
+
const MapLegendOther = /*#__PURE__*/styled__default(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"])));
|
|
4728
|
+
const SizeLegendItemsMixin = /*#__PURE__*/styled.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);
|
|
4729
|
+
const StrokeWidthLegendItemsMixin = /*#__PURE__*/styled.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);
|
|
4730
|
+
const SizeMinimizedLegend = /*#__PURE__*/styled__default.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n margin-top: 0.5rem;\n"])));
|
|
4731
|
+
const SizeMinimizedLegendSymbol = /*#__PURE__*/styled__default.div(_templateObject14$1 || (_templateObject14$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n"])));
|
|
4732
|
+
const SizeMinimizedLegendLabel = /*#__PURE__*/styled__default.div(_templateObject15$1 || (_templateObject15$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
|
|
4733
|
+
const SizeMinimizedLegendDown = /*#__PURE__*/styled__default.div(_templateObject16$1 || (_templateObject16$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.28;\n"])));
|
|
4734
|
+
const SizeMinimizedLegendUp = /*#__PURE__*/styled__default.div(_templateObject17 || (_templateObject17 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.65;\n"])));
|
|
4735
|
+
const MapLegendItems = /*#__PURE__*/styled__default.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) => {
|
|
4736
|
+
let {
|
|
4737
|
+
isSize
|
|
4738
|
+
} = _ref5;
|
|
4739
|
+
return isSize && SizeLegendItemsMixin;
|
|
4740
|
+
}, (_ref6) => {
|
|
4741
|
+
let {
|
|
4742
|
+
isStrokeWidth
|
|
4743
|
+
} = _ref6;
|
|
4744
|
+
return isStrokeWidth && StrokeWidthLegendItemsMixin;
|
|
4745
|
+
});
|
|
4746
|
+
const MapLegendValues = /*#__PURE__*/styled__default.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"])));
|
|
4747
|
+
const MapLegendValuesRange = /*#__PURE__*/styled__default.div(_templateObject20 || (_templateObject20 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
4748
|
+
const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
|
|
4749
|
+
const MapLegendExpandButton = /*#__PURE__*/styled__default.div(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin: 0.1rem 0 0.5rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
|
|
4750
|
+
|
|
4751
|
+
const MapLegendDescription = (_ref) => {
|
|
4752
|
+
let {
|
|
4753
|
+
parameter
|
|
4754
|
+
} = _ref;
|
|
4755
|
+
const isSize = isParameterType("size", parameter);
|
|
4756
|
+
const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
|
|
4757
|
+
const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
|
|
4758
|
+
console.info("MapLegendDescription", parameter, isSize, isStrokeWidth, isStrokeColor);
|
|
4759
|
+
return React__default.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
|
|
4760
|
+
};
|
|
4761
|
+
|
|
4762
|
+
const isNumeric = number => !isNaN(parseFloat(number)) && isFinite(number);
|
|
4763
|
+
|
|
4764
|
+
const getValueFromLegendTitle = (title, minOrMax) => {
|
|
4765
|
+
var _title$split;
|
|
4766
|
+
|
|
4767
|
+
if (title.includes(" - ")) {
|
|
4768
|
+
const result = title == null ? void 0 : title.split(" - ");
|
|
4769
|
+
return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
|
|
4770
|
+
}
|
|
4771
|
+
|
|
4772
|
+
return (title == null ? void 0 : (_title$split = title.split(" ")) == null ? void 0 : _title$split.find(isNumeric)) || "";
|
|
4773
|
+
};
|
|
4774
|
+
|
|
4775
|
+
const MinimizedLegend = (_ref) => {
|
|
4776
|
+
var _currentValues$, _currentValues, _currentValues$2, _currentValues2;
|
|
4777
|
+
|
|
4778
|
+
let {
|
|
4779
|
+
values,
|
|
4780
|
+
title,
|
|
4781
|
+
parameter
|
|
4782
|
+
} = _ref;
|
|
4783
|
+
const currentValues = [...values];
|
|
4784
|
+
const other = currentValues.pop();
|
|
4785
|
+
const isSize = isParameterType("size", parameter);
|
|
4786
|
+
const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
|
|
4787
|
+
const titleMax = getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max");
|
|
4788
|
+
const titleMin = getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min");
|
|
4789
|
+
return React__default.createElement(MinimizedLegendContainer, null, !!title && React__default.createElement(MapLegendValueDescr, null, title), React__default.createElement(MapLegendDescription, {
|
|
4790
|
+
parameter: parameter
|
|
4791
|
+
}), isSize ? React__default.createElement(React__default.Fragment, null, React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
|
|
4792
|
+
isSize: true
|
|
4793
|
+
}, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
|
|
4794
|
+
key: "" + value.title + index,
|
|
4795
|
+
title: value.title,
|
|
4796
|
+
value: value.parameterValue,
|
|
4797
|
+
parameter: parameter
|
|
4798
|
+
})))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendDown, null, (_currentValues$2 = currentValues[0]) == null ? void 0 : _currentValues$2.title), React__default.createElement(SizeMinimizedLegendUp, null, (_currentValues2 = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues2.title))), React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
|
|
4799
|
+
isSize: true
|
|
4800
|
+
}, React__default.createElement(MapLegendOther, {
|
|
4801
|
+
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
4802
|
+
value: other == null ? void 0 : other.parameterValue,
|
|
4803
|
+
parameter: parameter
|
|
4804
|
+
}))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendUp, null, "\u0414\u0440\u0443\u0433\u043E\u0435")))) : isStrokeWidth ? React__default.createElement(MapLegendItems, {
|
|
4805
|
+
isStrokeWidth: true
|
|
4806
|
+
}, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
|
|
4807
|
+
key: "" + value.title + index,
|
|
4808
|
+
title: value.title,
|
|
4809
|
+
value: value.parameterValue,
|
|
4810
|
+
parameter: parameter
|
|
4811
|
+
}, (!index || index === currentValues.length - 1) && value.title)), React__default.createElement(MapLegendOther, {
|
|
4812
|
+
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
4813
|
+
value: other == null ? void 0 : other.parameterValue,
|
|
4814
|
+
parameter: parameter
|
|
4815
|
+
}, "\u0414\u0440\u0443\u0433\u043E\u0435")) : React__default.createElement(MapLegendItems, null, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
|
|
4816
|
+
key: "" + value.title + index,
|
|
4817
|
+
title: value.title,
|
|
4818
|
+
value: value.parameterValue,
|
|
4819
|
+
parameter: parameter
|
|
4820
|
+
})), React__default.createElement(MapLegendOther, {
|
|
4821
|
+
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
4822
|
+
value: other == null ? void 0 : other.parameterValue,
|
|
4823
|
+
parameter: parameter
|
|
4824
|
+
})), typeof (other == null ? void 0 : other.parameterValue) === "string" && (titleMax || titleMin) && React__default.createElement(MapLegendValues, null, React__default.createElement(MapLegendValuesRange, null, React__default.createElement("div", null, titleMax), React__default.createElement("div", null, titleMin)), React__default.createElement(MapLegendValuesOther, null, "-")));
|
|
4825
|
+
};
|
|
4826
|
+
|
|
4827
|
+
const MapLegend = (_ref) => {
|
|
4828
|
+
let {
|
|
4829
|
+
layer,
|
|
4830
|
+
config,
|
|
4831
|
+
className,
|
|
4832
|
+
hideTitle
|
|
4833
|
+
} = _ref;
|
|
4834
|
+
const legend = useMapLegend(layer, config);
|
|
4835
|
+
const [isExpanded, toggleExpanded] = useToggle();
|
|
4836
|
+
|
|
4837
|
+
if (!legend) {
|
|
4838
|
+
return null;
|
|
4839
|
+
}
|
|
4840
|
+
|
|
4841
|
+
const {
|
|
4842
|
+
symbol,
|
|
4843
|
+
items
|
|
4844
|
+
} = legend;
|
|
4845
|
+
return React__default.createElement(LegendProvider, {
|
|
4846
|
+
symbol: symbol
|
|
4847
|
+
}, React__default.createElement(MapLegendControl, {
|
|
4848
|
+
className: className
|
|
4849
|
+
}, !hideTitle && React__default.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), !!items.length && React__default.createElement(MapLegendContainer, null, isExpanded ? React__default.createElement(Legend, {
|
|
4850
|
+
layer: layer,
|
|
4851
|
+
config: config
|
|
4852
|
+
}) : React__default.createElement(React__default.Fragment, null, items.map(item => {
|
|
4853
|
+
var _symbol$fill;
|
|
4854
|
+
|
|
4855
|
+
return React__default.createElement(React.Fragment, {
|
|
4856
|
+
key: item.title
|
|
4857
|
+
}, React__default.createElement(MinimizedLegend, {
|
|
4858
|
+
values: item.values,
|
|
4859
|
+
defaultValue: (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color,
|
|
4860
|
+
title: item.title !== (layer == null ? void 0 : layer.alias) ? item.title : "",
|
|
4861
|
+
parameter: item.parameter
|
|
4862
|
+
}));
|
|
4863
|
+
})), React__default.createElement(MapLegendExpandButton, {
|
|
4864
|
+
onClick: toggleExpanded,
|
|
4865
|
+
"data-html2canvas-ignore": true
|
|
4866
|
+
}, isExpanded ? "Свернуть" : "Развернуть"))));
|
|
4867
|
+
};
|
|
4868
|
+
|
|
4869
|
+
const MAX_SIZE$2 = 100;
|
|
4870
|
+
const MapLegendSymbol = (_ref) => {
|
|
4871
|
+
let {
|
|
4872
|
+
value,
|
|
4873
|
+
parameter
|
|
4874
|
+
} = _ref;
|
|
4875
|
+
return React__default.createElement(LegendSymbol, {
|
|
4876
|
+
key: value.title,
|
|
4877
|
+
parameter: parameter,
|
|
4878
|
+
parameterValue: value.parameterValue
|
|
4879
|
+
}, symbol => React__default.createElement(Symbol, {
|
|
4880
|
+
render: getMapLegendSymbolRenders,
|
|
4881
|
+
symbol: symbol,
|
|
4882
|
+
size: MAX_SIZE$2
|
|
4883
|
+
}));
|
|
4884
|
+
};
|
|
4885
|
+
|
|
4886
|
+
const DEFAULT_FORMATTERS = {
|
|
4887
|
+
polygon: formatPolygonMeasure,
|
|
4888
|
+
length: formatLength
|
|
4889
|
+
};
|
|
4890
|
+
|
|
4891
|
+
const COORD_FRACTION = 6;
|
|
4892
|
+
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
4893
|
+
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
4894
|
+
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
4895
|
+
|
|
4896
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
4897
|
+
|
|
4898
|
+
function BaseMeasureToolCreator(map, painter, params) {
|
|
4899
|
+
var _this;
|
|
4900
|
+
|
|
4901
|
+
_classCallCheck(this, BaseMeasureToolCreator);
|
|
4902
|
+
|
|
4903
|
+
_this = _super.call(this, map, params);
|
|
4904
|
+
|
|
4905
|
+
_this.cancel = () => {
|
|
4906
|
+
_this.fire('cancel');
|
|
4907
|
+
};
|
|
4908
|
+
|
|
4909
|
+
_this.painter = painter;
|
|
4910
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4911
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4912
|
+
_this.areaSymbol = params.areaSymbol;
|
|
4913
|
+
|
|
4914
|
+
_this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
|
|
4915
|
+
|
|
4916
|
+
|
|
4917
|
+
_this.on('change', _this.updateDistance);
|
|
4918
|
+
|
|
4919
|
+
return _this;
|
|
4920
|
+
}
|
|
4921
|
+
|
|
4922
|
+
_createClass(BaseMeasureToolCreator, [{
|
|
4923
|
+
key: "_handleMousemove",
|
|
4924
|
+
value: function _handleMousemove(event) {
|
|
4925
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_handleMousemove", this).call(this, event);
|
|
4926
|
+
|
|
4927
|
+
this.drawPointOnMouseMove(event);
|
|
4928
|
+
}
|
|
4929
|
+
}, {
|
|
4930
|
+
key: "_activate",
|
|
4931
|
+
value: function _activate() {
|
|
4932
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_activate", this).call(this);
|
|
4933
|
+
|
|
4934
|
+
this.addTempLabel();
|
|
4935
|
+
this.setCursor('pointer');
|
|
4936
|
+
}
|
|
4937
|
+
}, {
|
|
4938
|
+
key: "_deactivate",
|
|
4939
|
+
value: function _deactivate() {
|
|
4940
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_deactivate", this).call(this);
|
|
4941
|
+
|
|
4942
|
+
this.removeCoordLabel();
|
|
4943
|
+
this.removeTempLabel();
|
|
4944
|
+
this.removeMeasureLabel();
|
|
4945
|
+
this.removeTempPolygon();
|
|
4946
|
+
this.setCursor('default');
|
|
4947
|
+
}
|
|
4948
|
+
}, {
|
|
4949
|
+
key: "handlePointAdd",
|
|
4950
|
+
value: function handlePointAdd() {
|
|
4951
|
+
const feature = this.activeFeature;
|
|
4952
|
+
if (!feature) return;
|
|
4953
|
+
const {
|
|
4954
|
+
rings,
|
|
4955
|
+
crs
|
|
4956
|
+
} = feature;
|
|
4957
|
+
|
|
4958
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4959
|
+
this.finishDrawing();
|
|
4960
|
+
this.fire(new Control.DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
4961
|
+
return;
|
|
4962
|
+
}
|
|
4963
|
+
|
|
4964
|
+
if (rings[0].length === 2) {
|
|
4965
|
+
const projection = crs.projectionTo(Crs.geo);
|
|
4966
|
+
const point = rings[0][0];
|
|
4967
|
+
if (!projection) return;
|
|
4968
|
+
const [lat, long] = projection(point);
|
|
4969
|
+
this.removeTempLabel();
|
|
4970
|
+
this.addMeasureResultLabel();
|
|
4971
|
+
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
4972
|
+
} else {
|
|
4973
|
+
this.removeCoordLabel();
|
|
4974
|
+
}
|
|
4975
|
+
}
|
|
4976
|
+
}, {
|
|
4977
|
+
key: "polygonPreview",
|
|
4978
|
+
value: function polygonPreview() {
|
|
4979
|
+
if (this.tempPolygon) {
|
|
4980
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
4981
|
+
}
|
|
4982
|
+
|
|
4983
|
+
const feature = this.activeFeature;
|
|
4984
|
+
if (!feature) return;
|
|
4985
|
+
const {
|
|
4986
|
+
rings,
|
|
4987
|
+
crs
|
|
4988
|
+
} = feature;
|
|
4989
|
+
const polygonRings = [...rings[0]];
|
|
4990
|
+
polygonRings.shift();
|
|
4991
|
+
this.tempPolygon = new Polygon.Polygon(polygonRings, {
|
|
4992
|
+
crs
|
|
4993
|
+
});
|
|
4994
|
+
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
4995
|
+
this.activeFeature && this.activeFeature.hide();
|
|
4996
|
+
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
4997
|
+
}
|
|
4998
|
+
}, {
|
|
4999
|
+
key: "removeTempPolygon",
|
|
5000
|
+
value: function removeTempPolygon() {
|
|
5001
|
+
if (this.tempPolygon) {
|
|
5002
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
5003
|
+
delete this.tempPolygon;
|
|
5004
|
+
}
|
|
5005
|
+
}
|
|
5006
|
+
}, {
|
|
5007
|
+
key: "updateDistance",
|
|
5008
|
+
value: function updateDistance(event) {
|
|
5009
|
+
const feature = this.activeFeature;
|
|
5010
|
+
const {
|
|
5011
|
+
ringIndex,
|
|
5012
|
+
pointIndex
|
|
5013
|
+
} = event;
|
|
5014
|
+
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
5015
|
+
const {
|
|
5016
|
+
rings,
|
|
5017
|
+
crs
|
|
5018
|
+
} = feature;
|
|
5019
|
+
const position = rings[ringIndex][pointIndex];
|
|
5020
|
+
const length = geotools.length(rings, crs);
|
|
5021
|
+
let content = this.formatters.length(length);
|
|
5022
|
+
|
|
5023
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
5024
|
+
this.polygonPreview();
|
|
5025
|
+
const area = geotools.area(rings, crs);
|
|
5026
|
+
content = this.formatters.polygon(area, length);
|
|
5027
|
+
} else if (this.tempPolygon) {
|
|
5028
|
+
feature.show();
|
|
5029
|
+
this.removeTempPolygon();
|
|
5030
|
+
}
|
|
5031
|
+
|
|
5032
|
+
if (this.measureResultLabel) {
|
|
5033
|
+
this.measureResultLabel.position = position;
|
|
5034
|
+
this.measureResultLabel.content = content;
|
|
5035
|
+
}
|
|
5036
|
+
}
|
|
5037
|
+
}, {
|
|
5038
|
+
key: "addTempLabel",
|
|
5039
|
+
value: function addTempLabel() {
|
|
5040
|
+
this.tempLabel = new Label.LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
5041
|
+
content: 'Нажмите на карту, чтобы начать измерение',
|
|
5042
|
+
crs: this.map.crs,
|
|
5043
|
+
symbol: createLabelSymbol({
|
|
5044
|
+
renderLabel: this.renderLabelSymbol
|
|
5045
|
+
})
|
|
5046
|
+
});
|
|
5047
|
+
this._tempLayer && this._tempLayer.add(this.tempLabel);
|
|
5048
|
+
}
|
|
5049
|
+
}, {
|
|
5050
|
+
key: "addCoordLabel",
|
|
5051
|
+
value: function addCoordLabel(content, position) {
|
|
5052
|
+
this.coordLabel = new Label.LabelFeature(position, {
|
|
5053
|
+
content,
|
|
5054
|
+
crs: this.map.crs,
|
|
5055
|
+
symbol: createLabelSymbol({
|
|
5056
|
+
renderLabel: this.renderLabelSymbol,
|
|
5057
|
+
onClose: this.cancel
|
|
5058
|
+
})
|
|
5059
|
+
});
|
|
5060
|
+
this._tempLayer && this.coordLabel && this._tempLayer.add(this.coordLabel);
|
|
5061
|
+
}
|
|
5062
|
+
}, {
|
|
5063
|
+
key: "addMeasureResultLabel",
|
|
5064
|
+
value: function addMeasureResultLabel() {
|
|
5065
|
+
this.measureResultLabel = new Label.LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
5066
|
+
crs: this.map.crs,
|
|
5067
|
+
symbol: createLabelSymbol({
|
|
5068
|
+
renderLabel: this.renderLabelSymbol
|
|
5069
|
+
})
|
|
5070
|
+
});
|
|
5071
|
+
this._tempLayer && this.measureResultLabel && this._tempLayer.add(this.measureResultLabel);
|
|
5072
|
+
}
|
|
5073
|
+
}, {
|
|
5074
|
+
key: "removeTempLabel",
|
|
5075
|
+
value: function removeTempLabel() {
|
|
5076
|
+
if (this.tempLabel) {
|
|
5077
|
+
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
5078
|
+
delete this.tempLabel;
|
|
5079
|
+
}
|
|
5080
|
+
}
|
|
5081
|
+
}, {
|
|
5082
|
+
key: "removeCoordLabel",
|
|
5083
|
+
value: function removeCoordLabel() {
|
|
5084
|
+
if (this.coordLabel) {
|
|
5085
|
+
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
5086
|
+
delete this.coordLabel;
|
|
5087
|
+
}
|
|
5088
|
+
}
|
|
5089
|
+
}, {
|
|
5090
|
+
key: "removeMeasureLabel",
|
|
5091
|
+
value: function removeMeasureLabel() {
|
|
5092
|
+
if (this.measureResultLabel) {
|
|
5093
|
+
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
5094
|
+
delete this.measureResultLabel;
|
|
5095
|
+
}
|
|
5096
|
+
}
|
|
5097
|
+
}, {
|
|
5098
|
+
key: "drawPointOnMouseMove",
|
|
5099
|
+
value: function drawPointOnMouseMove(event) {
|
|
5100
|
+
if (this.tempLabel) {
|
|
5101
|
+
this.tempLabel.position = event.point.position;
|
|
5102
|
+
}
|
|
5103
|
+
}
|
|
5104
|
+
}, {
|
|
5105
|
+
key: "setCursor",
|
|
5106
|
+
value: function setCursor(cursor) {
|
|
5107
|
+
const {
|
|
5108
|
+
wrapper
|
|
5109
|
+
} = this.painter;
|
|
5110
|
+
|
|
5111
|
+
if (wrapper && typeof wrapper !== 'string') {
|
|
5112
|
+
wrapper.style.cursor = cursor;
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
}]);
|
|
5116
|
+
|
|
5117
|
+
return BaseMeasureToolCreator;
|
|
5118
|
+
}(PolylineControl.PolylineControl);
|
|
5046
5119
|
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
value = 0;
|
|
5050
|
-
}
|
|
5120
|
+
let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
|
|
5121
|
+
_inherits(BaseMeasureToolEditor, _PolyEditor);
|
|
5051
5122
|
|
|
5052
|
-
|
|
5053
|
-
};
|
|
5123
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
|
|
5054
5124
|
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
parameter
|
|
5058
|
-
} = _ref;
|
|
5059
|
-
return isParameterType(["strokeColor", "stroke.color"], parameter) ? 0.25 : 1;
|
|
5060
|
-
}, _ref2 => {
|
|
5061
|
-
let {
|
|
5062
|
-
value
|
|
5063
|
-
} = _ref2;
|
|
5064
|
-
return typeof value === "number" ? "none" : value;
|
|
5065
|
-
}, _ref3 => {
|
|
5066
|
-
let {
|
|
5067
|
-
value,
|
|
5068
|
-
parameter
|
|
5069
|
-
} = _ref3;
|
|
5070
|
-
return isParameterType("size", parameter) && SizeLegendItemMixin(value);
|
|
5071
|
-
}, _ref4 => {
|
|
5072
|
-
let {
|
|
5073
|
-
value,
|
|
5074
|
-
parameter
|
|
5075
|
-
} = _ref4;
|
|
5076
|
-
return isParameterType(["strokeWidth", "stroke.width"], parameter) && StrokeWidthLegendItemMixin(value);
|
|
5077
|
-
});
|
|
5078
|
-
const MapLegendOther = /*#__PURE__*/styled__default(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"])));
|
|
5079
|
-
const SizeLegendItemsMixin = /*#__PURE__*/styled.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);
|
|
5080
|
-
const StrokeWidthLegendItemsMixin = /*#__PURE__*/styled.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);
|
|
5081
|
-
const SizeMinimizedLegend = /*#__PURE__*/styled__default.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n margin-top: 0.5rem;\n"])));
|
|
5082
|
-
const SizeMinimizedLegendSymbol = /*#__PURE__*/styled__default.div(_templateObject14$1 || (_templateObject14$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n"])));
|
|
5083
|
-
const SizeMinimizedLegendLabel = /*#__PURE__*/styled__default.div(_templateObject15$1 || (_templateObject15$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
|
|
5084
|
-
const SizeMinimizedLegendDown = /*#__PURE__*/styled__default.div(_templateObject16$1 || (_templateObject16$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.28;\n"])));
|
|
5085
|
-
const SizeMinimizedLegendUp = /*#__PURE__*/styled__default.div(_templateObject17 || (_templateObject17 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.65;\n"])));
|
|
5086
|
-
const MapLegendItems = /*#__PURE__*/styled__default.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 => {
|
|
5087
|
-
let {
|
|
5088
|
-
isSize
|
|
5089
|
-
} = _ref5;
|
|
5090
|
-
return isSize && SizeLegendItemsMixin;
|
|
5091
|
-
}, _ref6 => {
|
|
5092
|
-
let {
|
|
5093
|
-
isStrokeWidth
|
|
5094
|
-
} = _ref6;
|
|
5095
|
-
return isStrokeWidth && StrokeWidthLegendItemsMixin;
|
|
5096
|
-
});
|
|
5097
|
-
const MapLegendValues = /*#__PURE__*/styled__default.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"])));
|
|
5098
|
-
const MapLegendValuesRange = /*#__PURE__*/styled__default.div(_templateObject20 || (_templateObject20 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
5099
|
-
const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
|
|
5100
|
-
const MapLegendExpandButton = /*#__PURE__*/styled__default.div(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin: 0.1rem 0 0.5rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
|
|
5125
|
+
function BaseMeasureToolEditor(map, painter, params) {
|
|
5126
|
+
var _this;
|
|
5101
5127
|
|
|
5102
|
-
|
|
5103
|
-
let {
|
|
5104
|
-
parameter
|
|
5105
|
-
} = _ref;
|
|
5106
|
-
const isSize = isParameterType("size", parameter);
|
|
5107
|
-
const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
|
|
5108
|
-
const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
|
|
5109
|
-
console.info("MapLegendDescription", parameter, isSize, isStrokeWidth, isStrokeColor);
|
|
5110
|
-
return React__default.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? "Толщина обводки" : "Цвет обводки" : isSize ? "Размер знака" : "Цвет символа");
|
|
5111
|
-
};
|
|
5128
|
+
_classCallCheck(this, BaseMeasureToolEditor);
|
|
5112
5129
|
|
|
5113
|
-
|
|
5114
|
-
var _title$split;
|
|
5130
|
+
_this = _super.call(this, map, params);
|
|
5115
5131
|
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5132
|
+
_this.measureResult = () => {
|
|
5133
|
+
const feature = _this.activeFeature;
|
|
5134
|
+
if (!feature) return null;
|
|
5135
|
+
const {
|
|
5136
|
+
rings,
|
|
5137
|
+
isEnclosed,
|
|
5138
|
+
crs
|
|
5139
|
+
} = feature;
|
|
5140
|
+
const pointsCount = rings[0].length;
|
|
5141
|
+
const position = rings[0][pointsCount - 1];
|
|
5142
|
+
const area = geotools.area(rings, crs);
|
|
5143
|
+
const length = geotools.length(rings, crs, isEnclosed);
|
|
5144
|
+
const content = isEnclosed ? _this.formatters.polygon(area, length) : _this.formatters.length(length);
|
|
5145
|
+
return {
|
|
5146
|
+
content,
|
|
5147
|
+
position
|
|
5148
|
+
};
|
|
5149
|
+
};
|
|
5120
5150
|
|
|
5121
|
-
|
|
5122
|
-
|
|
5151
|
+
_this.removeFeature = () => {
|
|
5152
|
+
_this.fire('remove');
|
|
5153
|
+
};
|
|
5123
5154
|
|
|
5124
|
-
|
|
5125
|
-
|
|
5155
|
+
_this.painter = painter;
|
|
5156
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
5157
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
5126
5158
|
|
|
5127
|
-
|
|
5128
|
-
values,
|
|
5129
|
-
title,
|
|
5130
|
-
parameter
|
|
5131
|
-
} = _ref;
|
|
5132
|
-
const currentValues = [...values];
|
|
5133
|
-
const other = currentValues.pop();
|
|
5134
|
-
const isSize = isParameterType("size", parameter);
|
|
5135
|
-
const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
|
|
5136
|
-
const titleMax = getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max");
|
|
5137
|
-
const titleMin = getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min");
|
|
5138
|
-
return React__default.createElement(MinimizedLegendContainer, null, !!title && React__default.createElement(MapLegendValueDescr, null, title), React__default.createElement(MapLegendDescription, {
|
|
5139
|
-
parameter: parameter
|
|
5140
|
-
}), isSize ? React__default.createElement(React__default.Fragment, null, React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
|
|
5141
|
-
isSize: true
|
|
5142
|
-
}, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
|
|
5143
|
-
key: "" + value.title + index,
|
|
5144
|
-
title: value.title,
|
|
5145
|
-
value: value.parameterValue,
|
|
5146
|
-
parameter: parameter
|
|
5147
|
-
})))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendDown, null, (_currentValues$2 = currentValues[0]) == null ? void 0 : _currentValues$2.title), React__default.createElement(SizeMinimizedLegendUp, null, (_currentValues2 = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues2.title))), React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
|
|
5148
|
-
isSize: true
|
|
5149
|
-
}, React__default.createElement(MapLegendOther, {
|
|
5150
|
-
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
5151
|
-
value: other == null ? void 0 : other.parameterValue,
|
|
5152
|
-
parameter: parameter
|
|
5153
|
-
}))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendUp, null, "\u0414\u0440\u0443\u0433\u043E\u0435")))) : isStrokeWidth ? React__default.createElement(MapLegendItems, {
|
|
5154
|
-
isStrokeWidth: true
|
|
5155
|
-
}, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
|
|
5156
|
-
key: "" + value.title + index,
|
|
5157
|
-
title: value.title,
|
|
5158
|
-
value: value.parameterValue,
|
|
5159
|
-
parameter: parameter
|
|
5160
|
-
}, (!index || index === currentValues.length - 1) && value.title)), React__default.createElement(MapLegendOther, {
|
|
5161
|
-
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
5162
|
-
value: other == null ? void 0 : other.parameterValue,
|
|
5163
|
-
parameter: parameter
|
|
5164
|
-
}, "\u0414\u0440\u0443\u0433\u043E\u0435")) : React__default.createElement(MapLegendItems, null, currentValues.map((value, index) => React__default.createElement(MapLegendItem, {
|
|
5165
|
-
key: "" + value.title + index,
|
|
5166
|
-
title: value.title,
|
|
5167
|
-
value: value.parameterValue,
|
|
5168
|
-
parameter: parameter
|
|
5169
|
-
})), React__default.createElement(MapLegendOther, {
|
|
5170
|
-
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
5171
|
-
value: other == null ? void 0 : other.parameterValue,
|
|
5172
|
-
parameter: parameter
|
|
5173
|
-
})), typeof (other == null ? void 0 : other.parameterValue) === "string" && (titleMax || titleMin) && React__default.createElement(MapLegendValues, null, React__default.createElement(MapLegendValuesRange, null, React__default.createElement("div", null, titleMax), React__default.createElement("div", null, titleMin)), React__default.createElement(MapLegendValuesOther, null, "-")));
|
|
5174
|
-
};
|
|
5159
|
+
_this.on('change', _this.updateMeasureResult);
|
|
5175
5160
|
|
|
5176
|
-
|
|
5177
|
-
let {
|
|
5178
|
-
layer,
|
|
5179
|
-
config,
|
|
5180
|
-
className,
|
|
5181
|
-
hideTitle
|
|
5182
|
-
} = _ref;
|
|
5183
|
-
const legend = useMapLegend(layer, config);
|
|
5184
|
-
const [isExpanded, toggleExpanded] = useToggle();
|
|
5161
|
+
_this.on('edit', _this.updateMeasureResult);
|
|
5185
5162
|
|
|
5186
|
-
|
|
5187
|
-
return null;
|
|
5163
|
+
return _this;
|
|
5188
5164
|
}
|
|
5189
5165
|
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
return React__default.createElement(LegendProvider, {
|
|
5195
|
-
symbol: symbol
|
|
5196
|
-
}, React__default.createElement(MapLegendControl, {
|
|
5197
|
-
className: className
|
|
5198
|
-
}, !hideTitle && React__default.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), !!items.length && React__default.createElement(MapLegendContainer, null, isExpanded ? React__default.createElement(Legend, {
|
|
5199
|
-
layer: layer,
|
|
5200
|
-
config: config
|
|
5201
|
-
}) : React__default.createElement(React__default.Fragment, null, items.map(item => {
|
|
5202
|
-
var _symbol$fill;
|
|
5166
|
+
_createClass(BaseMeasureToolEditor, [{
|
|
5167
|
+
key: "_activate",
|
|
5168
|
+
value: function _activate() {
|
|
5169
|
+
_get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
|
|
5203
5170
|
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5171
|
+
this.addMeasureResultLabel();
|
|
5172
|
+
}
|
|
5173
|
+
}, {
|
|
5174
|
+
key: "addMeasureResultLabel",
|
|
5175
|
+
value: function addMeasureResultLabel() {
|
|
5176
|
+
const measureResult = this.measureResult();
|
|
5177
|
+
if (measureResult === null) return;
|
|
5178
|
+
const {
|
|
5179
|
+
content,
|
|
5180
|
+
position
|
|
5181
|
+
} = measureResult;
|
|
5182
|
+
this.measureResultLabel = new Label.LabelFeature(position, {
|
|
5183
|
+
content,
|
|
5184
|
+
crs: this.map.crs,
|
|
5185
|
+
symbol: createLabelSymbol({
|
|
5186
|
+
onClose: this.removeFeature,
|
|
5187
|
+
renderLabel: this.renderLabelSymbol
|
|
5188
|
+
})
|
|
5189
|
+
});
|
|
5190
|
+
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
5191
|
+
}
|
|
5192
|
+
}, {
|
|
5193
|
+
key: "updateMeasureResult",
|
|
5194
|
+
value: function updateMeasureResult() {
|
|
5195
|
+
if (this.measureResultLabel) {
|
|
5196
|
+
const measureResult = this.measureResult();
|
|
5197
|
+
if (measureResult === null) return;
|
|
5198
|
+
const {
|
|
5199
|
+
content,
|
|
5200
|
+
position
|
|
5201
|
+
} = measureResult;
|
|
5202
|
+
this.measureResultLabel.content = content;
|
|
5203
|
+
this.measureResultLabel.position = position;
|
|
5204
|
+
}
|
|
5205
|
+
}
|
|
5206
|
+
}]);
|
|
5216
5207
|
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
let {
|
|
5220
|
-
value,
|
|
5221
|
-
parameter
|
|
5222
|
-
} = _ref;
|
|
5223
|
-
return React__default.createElement(LegendSymbol, {
|
|
5224
|
-
key: value.title,
|
|
5225
|
-
parameter: parameter,
|
|
5226
|
-
parameterValue: value.parameterValue
|
|
5227
|
-
}, symbol => React__default.createElement(Symbol, {
|
|
5228
|
-
render: getMapLegendSymbolRenders,
|
|
5229
|
-
symbol: symbol,
|
|
5230
|
-
size: MAX_SIZE$2
|
|
5231
|
-
}));
|
|
5232
|
-
};
|
|
5208
|
+
return BaseMeasureToolEditor;
|
|
5209
|
+
}(PolyEditor.PolyEditor);
|
|
5233
5210
|
|
|
5234
5211
|
let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
5235
5212
|
_inherits(MeasureTool, _React$Component);
|
|
@@ -5419,7 +5396,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
|
5419
5396
|
}(React__default.Component);
|
|
5420
5397
|
|
|
5421
5398
|
const _excluded$3 = ["isActive"];
|
|
5422
|
-
const Measurer = _ref => {
|
|
5399
|
+
const Measurer = (_ref) => {
|
|
5423
5400
|
let {
|
|
5424
5401
|
isActive
|
|
5425
5402
|
} = _ref,
|
|
@@ -5437,18 +5414,18 @@ const Measurer = _ref => {
|
|
|
5437
5414
|
|
|
5438
5415
|
var _templateObject$7, _templateObject2$7, _templateObject3$5;
|
|
5439
5416
|
const ScaleRulerContainer = /*#__PURE__*/styled__default.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"])));
|
|
5440
|
-
const ScaleRulerBlock = /*#__PURE__*/styled__default.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 => {
|
|
5417
|
+
const ScaleRulerBlock = /*#__PURE__*/styled__default.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) => {
|
|
5441
5418
|
let {
|
|
5442
5419
|
width
|
|
5443
5420
|
} = _ref;
|
|
5444
5421
|
return width + "px";
|
|
5445
5422
|
});
|
|
5446
|
-
const TextContainer = /*#__PURE__*/styled__default.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 => {
|
|
5423
|
+
const TextContainer = /*#__PURE__*/styled__default.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) => {
|
|
5447
5424
|
let {
|
|
5448
5425
|
alignEnd
|
|
5449
5426
|
} = _ref2;
|
|
5450
5427
|
return alignEnd ? 'flex-end' : 'center';
|
|
5451
|
-
}, _ref3 => {
|
|
5428
|
+
}, (_ref3) => {
|
|
5452
5429
|
let {
|
|
5453
5430
|
width
|
|
5454
5431
|
} = _ref3;
|
|
@@ -5473,7 +5450,7 @@ const ScaleRuler = () => {
|
|
|
5473
5450
|
}, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
|
|
5474
5451
|
};
|
|
5475
5452
|
|
|
5476
|
-
const Zoom = _ref => {
|
|
5453
|
+
const Zoom = (_ref) => {
|
|
5477
5454
|
let {
|
|
5478
5455
|
children
|
|
5479
5456
|
} = _ref;
|
|
@@ -5522,7 +5499,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
|
|
|
5522
5499
|
return styled.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));
|
|
5523
5500
|
};
|
|
5524
5501
|
const corner = /*#__PURE__*/styled.css(_templateObject10$2 || (_templateObject10$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n &:before {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n }\n"])));
|
|
5525
|
-
const TooltipComponent = /*#__PURE__*/styled__default.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 => {
|
|
5502
|
+
const TooltipComponent = /*#__PURE__*/styled__default.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) => {
|
|
5526
5503
|
let {
|
|
5527
5504
|
placement,
|
|
5528
5505
|
distance = '0.5rem',
|
|
@@ -5530,7 +5507,7 @@ const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$2 ||
|
|
|
5530
5507
|
cornerSize = '0.25rem'
|
|
5531
5508
|
} = _ref;
|
|
5532
5509
|
return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
|
|
5533
|
-
}, _ref2 => {
|
|
5510
|
+
}, (_ref2) => {
|
|
5534
5511
|
let {
|
|
5535
5512
|
withArrow
|
|
5536
5513
|
} = _ref2;
|
|
@@ -5544,7 +5521,7 @@ const {
|
|
|
5544
5521
|
Consumer
|
|
5545
5522
|
} = /*#__PURE__*/React.createContext([]); // TODO I just cant read that
|
|
5546
5523
|
|
|
5547
|
-
const Tooltip = _ref => {
|
|
5524
|
+
const Tooltip = (_ref) => {
|
|
5548
5525
|
let {
|
|
5549
5526
|
features = [],
|
|
5550
5527
|
map,
|
|
@@ -5583,7 +5560,7 @@ const Noop = () => React__default.createElement("div", {
|
|
|
5583
5560
|
}
|
|
5584
5561
|
});
|
|
5585
5562
|
|
|
5586
|
-
const DraggableMarker = _ref => {
|
|
5563
|
+
const DraggableMarker = (_ref) => {
|
|
5587
5564
|
let {
|
|
5588
5565
|
position,
|
|
5589
5566
|
onChange,
|
|
@@ -5597,6 +5574,21 @@ const DraggableMarker = _ref => {
|
|
|
5597
5574
|
return React__default.createElement(React.Fragment, null);
|
|
5598
5575
|
};
|
|
5599
5576
|
|
|
5577
|
+
const polygonCircleFromPoint = (center, diameter) => {
|
|
5578
|
+
const coordinates = [];
|
|
5579
|
+
const radius = diameter / 2;
|
|
5580
|
+
const endAngle = Math.PI * 2;
|
|
5581
|
+
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
5582
|
+
let start = 0;
|
|
5583
|
+
let end = endAngle;
|
|
5584
|
+
|
|
5585
|
+
for (let ang = start; ang < end; ang += step) {
|
|
5586
|
+
coordinates.push([Math.cos(ang) * radius + center[0], Math.sin(ang) * radius + center[1]]);
|
|
5587
|
+
}
|
|
5588
|
+
|
|
5589
|
+
return [coordinates];
|
|
5590
|
+
};
|
|
5591
|
+
|
|
5600
5592
|
exports.ArrowLineMiterRender = ArrowLineMiterRender;
|
|
5601
5593
|
exports.BaseMeasureToolCreator = BaseMeasureToolCreator;
|
|
5602
5594
|
exports.BaseMeasureToolEditor = BaseMeasureToolEditor;
|