@evergis/react 2.0.151 → 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/components/MapLegend/MapLegendDescription.d.ts +2 -1
- package/dist/components/MapLegend/styled.d.ts +6 -1
- package/dist/components/MapLegend/types.d.ts +2 -2
- package/dist/react.cjs.development.js +1350 -1304
- 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 +1351 -1305
- package/dist/react.esm.js.map +1 -1
- package/dist/utils/isParameterType.d.ts +3 -2
- 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,1124 +1582,776 @@ 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
|
-
};
|
|
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
|
+
}
|
|
1955
1940
|
|
|
1956
|
-
let
|
|
1957
|
-
_inherits(
|
|
1941
|
+
let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
|
|
1942
|
+
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
1958
1943
|
|
|
1959
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
1944
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
|
|
1960
1945
|
|
|
1961
|
-
|
|
1962
|
-
|
|
1946
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
1947
|
+
function ShadowedPointSymbol(options) {
|
|
1948
|
+
_classCallCheck(this, ShadowedPointSymbol);
|
|
1963
1949
|
|
|
1964
|
-
return _super.
|
|
1950
|
+
return _super.call(this, options);
|
|
1965
1951
|
}
|
|
1966
1952
|
|
|
1967
|
-
_createClass(
|
|
1968
|
-
key: "
|
|
1969
|
-
|
|
1970
|
-
|
|
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];
|
|
1971
1964
|
}
|
|
1972
1965
|
}, {
|
|
1973
|
-
key: "
|
|
1974
|
-
value: function
|
|
1975
|
-
|
|
1976
|
-
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1966
|
+
key: "getShadow",
|
|
1967
|
+
value: function getShadow(position, _feature) {
|
|
1968
|
+
return ShadowedPointSymbol.getShadowArc(position, this);
|
|
1977
1969
|
}
|
|
1978
1970
|
}, {
|
|
1979
|
-
key: "
|
|
1980
|
-
value: function
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
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,
|
|
1986
1988
|
enclosed: true
|
|
1987
1989
|
});
|
|
1988
1990
|
}
|
|
1989
|
-
}]);
|
|
1990
|
-
|
|
1991
|
-
return CircleLineMiterRender;
|
|
1992
|
-
}(LineMiterRender);
|
|
1993
|
-
|
|
1994
|
-
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1995
|
-
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1996
|
-
|
|
1997
|
-
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1998
|
-
|
|
1999
|
-
function SquareLineMiterRender() {
|
|
2000
|
-
_classCallCheck(this, SquareLineMiterRender);
|
|
2001
|
-
|
|
2002
|
-
return _super.apply(this, arguments);
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
_createClass(SquareLineMiterRender, [{
|
|
2006
|
-
key: "usageSize",
|
|
2007
|
-
get: function get() {
|
|
2008
|
-
return this.miterSize + this.strokeWidth;
|
|
2009
|
-
}
|
|
2010
1991
|
}, {
|
|
2011
|
-
key: "
|
|
2012
|
-
value: function
|
|
2013
|
-
let
|
|
2014
|
-
|
|
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
|
+
});
|
|
2015
2006
|
}
|
|
2016
2007
|
}, {
|
|
2017
|
-
key: "
|
|
2018
|
-
value: function
|
|
2019
|
-
const
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
fillColor: isFilled ? this.color : void 0,
|
|
2023
|
-
fillStyle: isFilled ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
2024
|
-
lineCap: 'square',
|
|
2025
|
-
lineJoin: 'miter',
|
|
2026
|
-
strokeColor: this.color,
|
|
2027
|
-
strokeWidth: this.strokeWidth
|
|
2028
|
-
});
|
|
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];
|
|
2029
2013
|
}
|
|
2030
2014
|
}]);
|
|
2031
2015
|
|
|
2032
|
-
return
|
|
2033
|
-
}(
|
|
2016
|
+
return ShadowedPointSymbol;
|
|
2017
|
+
}(Point.PointSymbol);
|
|
2034
2018
|
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
case exports.LineMiterKind.Arrow:
|
|
2038
|
-
case exports.LineMiterKind.FilledArrow:
|
|
2039
|
-
return new ArrowLineMiterRender(options);
|
|
2019
|
+
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2020
|
+
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2040
2021
|
|
|
2041
|
-
|
|
2042
|
-
case exports.LineMiterKind.FilledSquare:
|
|
2043
|
-
return new SquareLineMiterRender(options);
|
|
2022
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2044
2023
|
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2024
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2025
|
+
function ShadowedPolySymbol(options) {
|
|
2026
|
+
_classCallCheck(this, ShadowedPolySymbol);
|
|
2048
2027
|
|
|
2049
|
-
|
|
2050
|
-
return null;
|
|
2028
|
+
return _super.call(this, options);
|
|
2051
2029
|
}
|
|
2052
|
-
};
|
|
2053
|
-
|
|
2054
|
-
const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
|
|
2055
|
-
const reversedRing = ring.slice().reverse();
|
|
2056
2030
|
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
|
|
2062
|
-
}
|
|
2031
|
+
_createClass(ShadowedPolySymbol, [{
|
|
2032
|
+
key: "renderFunction",
|
|
2033
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
2034
|
+
if (!(feature instanceof Poly$1.Poly)) return [];
|
|
2063
2035
|
|
|
2064
|
-
|
|
2036
|
+
const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
|
|
2065
2037
|
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
return reversedRing.reverse();
|
|
2072
|
-
};
|
|
2038
|
+
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2039
|
+
const shadowRender = this.getShadow(coordinates, feature);
|
|
2040
|
+
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2041
|
+
let renders = [polyRender];
|
|
2073
2042
|
|
|
2074
|
-
|
|
2075
|
-
|
|
2043
|
+
if (shadowRender) {
|
|
2044
|
+
renders = [shadowRender, polyRender];
|
|
2045
|
+
}
|
|
2076
2046
|
|
|
2077
|
-
|
|
2078
|
-
|
|
2047
|
+
if (vertexRenders) {
|
|
2048
|
+
renders = renders.concat(vertexRenders);
|
|
2049
|
+
}
|
|
2079
2050
|
|
|
2080
|
-
|
|
2081
|
-
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
2051
|
+
return renders;
|
|
2082
2052
|
}
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
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
|
+
});
|
|
2088
2063
|
}
|
|
2089
|
-
}
|
|
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
|
+
}]);
|
|
2090
2093
|
|
|
2091
|
-
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)'
|
|
2092
2101
|
};
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
case 'right':
|
|
2098
|
-
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
2099
|
-
|
|
2100
|
-
default:
|
|
2101
|
-
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
2102
|
-
}
|
|
2103
|
-
});
|
|
2102
|
+
const measureSymbolParams = {
|
|
2103
|
+
strokeColor: '#ff6933',
|
|
2104
|
+
shadowSize: 0,
|
|
2105
|
+
vertexShadowSize: 0
|
|
2104
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
|
+
}));
|
|
2105
2128
|
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
2109
|
-
|
|
2110
|
-
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
2111
|
-
|
|
2112
|
-
function SGisPolylineSymbol(originalSymbol) {
|
|
2113
|
-
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
2129
|
+
let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
|
|
2130
|
+
_inherits(SelectedPointSymbol, _ShadowedPointSymbol);
|
|
2114
2131
|
|
|
2115
|
-
|
|
2132
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
|
|
2116
2133
|
|
|
2117
|
-
|
|
2134
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2135
|
+
function SelectedPointSymbol(props) {
|
|
2136
|
+
_classCallCheck(this, SelectedPointSymbol);
|
|
2118
2137
|
|
|
2119
|
-
|
|
2120
|
-
// @ts-ignore
|
|
2121
|
-
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
2122
|
-
strokeWidth: clamp( // @ts-ignore
|
|
2123
|
-
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
2124
|
-
// @ts-ignore
|
|
2125
|
-
lineDash: getLineDash(originalSymbol.stroke),
|
|
2126
|
-
// @ts-ignore
|
|
2127
|
-
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
2128
|
-
});
|
|
2129
|
-
_this.originalSymbol = originalSymbol;
|
|
2130
|
-
return _this;
|
|
2138
|
+
return _super.call(this, props);
|
|
2131
2139
|
}
|
|
2132
2140
|
|
|
2133
|
-
_createClass(
|
|
2134
|
-
key: "
|
|
2135
|
-
value: function
|
|
2136
|
-
if (
|
|
2137
|
-
|
|
2138
|
-
ending,
|
|
2139
|
-
beginningSize,
|
|
2140
|
-
beginning,
|
|
2141
|
-
endingSize
|
|
2142
|
-
} = this.originalSymbol;
|
|
2143
|
-
const renders = [];
|
|
2144
|
-
const featureCopy = feature.clone();
|
|
2145
|
-
const beginningMiterRender = getLineMiterRender({
|
|
2146
|
-
color: this.strokeColor,
|
|
2147
|
-
// @ts-ignore
|
|
2148
|
-
kind: beginning,
|
|
2149
|
-
position: 'left',
|
|
2150
|
-
// @ts-ignore
|
|
2151
|
-
size: beginningSize,
|
|
2152
|
-
strokeWidth: this.strokeWidth
|
|
2153
|
-
});
|
|
2154
|
-
const endingMiterRender = getLineMiterRender({
|
|
2155
|
-
color: this.strokeColor,
|
|
2156
|
-
// @ts-ignore
|
|
2157
|
-
kind: ending,
|
|
2158
|
-
position: 'right',
|
|
2159
|
-
// @ts-ignore
|
|
2160
|
-
size: endingSize,
|
|
2161
|
-
strokeWidth: this.strokeWidth
|
|
2162
|
-
});
|
|
2163
|
-
|
|
2164
|
-
if (beginningMiterRender) {
|
|
2165
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
2166
|
-
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2167
|
-
featureCopy.rings = updatedRings;
|
|
2168
|
-
renders.push(render);
|
|
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);
|
|
2169
2146
|
}
|
|
2170
|
-
|
|
2171
|
-
if (endingMiterRender) {
|
|
2172
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
2173
|
-
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2174
|
-
featureCopy.rings = updatedRings;
|
|
2175
|
-
renders.push(render);
|
|
2176
|
-
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
2180
|
-
return renders;
|
|
2181
2147
|
}
|
|
2182
2148
|
}, {
|
|
2183
|
-
key: "
|
|
2184
|
-
value: function
|
|
2185
|
-
|
|
2186
|
-
}
|
|
2187
|
-
}]);
|
|
2149
|
+
key: "getPoint",
|
|
2150
|
+
value: function getPoint(position, feature) {
|
|
2151
|
+
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2188
2152
|
|
|
2189
|
-
|
|
2190
|
-
|
|
2153
|
+
if (feature.isSelected) {
|
|
2154
|
+
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2155
|
+
pointRender.fillColor = this.selectedFillColor;
|
|
2156
|
+
}
|
|
2191
2157
|
|
|
2192
|
-
|
|
2193
|
-
|
|
2158
|
+
return pointRender;
|
|
2159
|
+
}
|
|
2160
|
+
}]);
|
|
2194
2161
|
|
|
2195
|
-
|
|
2162
|
+
return SelectedPointSymbol;
|
|
2163
|
+
}(ShadowedPointSymbol);
|
|
2196
2164
|
|
|
2197
|
-
|
|
2198
|
-
|
|
2165
|
+
let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
|
|
2166
|
+
_inherits(SelectedPolySymbol, _ShadowedPolySymbol);
|
|
2199
2167
|
|
|
2200
|
-
|
|
2201
|
-
component,
|
|
2202
|
-
offset
|
|
2203
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2168
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
|
|
2204
2169
|
|
|
2205
|
-
|
|
2170
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2171
|
+
function SelectedPolySymbol(props) {
|
|
2172
|
+
_classCallCheck(this, SelectedPolySymbol);
|
|
2206
2173
|
|
|
2207
|
-
|
|
2208
|
-
offset
|
|
2209
|
-
});
|
|
2210
|
-
_this.component = component;
|
|
2211
|
-
return _this;
|
|
2174
|
+
return _super.call(this, props);
|
|
2212
2175
|
}
|
|
2213
2176
|
|
|
2214
|
-
_createClass(
|
|
2215
|
-
key: "
|
|
2216
|
-
value: function
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
}
|
|
2221
|
-
}, {
|
|
2222
|
-
key: "_updateFeatureNode",
|
|
2223
|
-
value: function _updateFeatureNode(feature) {
|
|
2224
|
-
this.renderDom(feature.content, this.getNode(feature));
|
|
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);
|
|
2182
|
+
}
|
|
2225
2183
|
}
|
|
2226
2184
|
}, {
|
|
2227
|
-
key: "
|
|
2228
|
-
value: function
|
|
2229
|
-
|
|
2230
|
-
return;
|
|
2231
|
-
}
|
|
2185
|
+
key: "getPolyRender",
|
|
2186
|
+
value: function getPolyRender(coordinates, feature) {
|
|
2187
|
+
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2232
2188
|
|
|
2233
|
-
|
|
2189
|
+
if (feature.isSelected) {
|
|
2190
|
+
polyRender.fillColor = this.selectedFillColor;
|
|
2191
|
+
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2234
2192
|
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
}), node);
|
|
2239
|
-
} else {
|
|
2240
|
-
node.innerText = content;
|
|
2193
|
+
if (this.selectedStrokeWidth !== void 0) {
|
|
2194
|
+
polyRender.strokeWidth = this.selectedStrokeWidth;
|
|
2195
|
+
}
|
|
2241
2196
|
}
|
|
2197
|
+
|
|
2198
|
+
return polyRender;
|
|
2242
2199
|
}
|
|
2243
2200
|
}]);
|
|
2244
2201
|
|
|
2245
|
-
return
|
|
2246
|
-
}(
|
|
2202
|
+
return SelectedPolySymbol;
|
|
2203
|
+
}(ShadowedPolySymbol);
|
|
2247
2204
|
|
|
2248
|
-
const
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
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
|
+
});
|
|
2273
2233
|
|
|
2274
|
-
|
|
2234
|
+
const metersToPixels = (meters, _ref) => {
|
|
2275
2235
|
let {
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
shadowSize,
|
|
2279
|
-
size = 6
|
|
2236
|
+
painter,
|
|
2237
|
+
crs = Crs.geo
|
|
2280
2238
|
} = _ref;
|
|
2281
|
-
const
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
let {
|
|
2291
|
-
strokeColor,
|
|
2292
|
-
strokeWidth,
|
|
2293
|
-
shadowColor,
|
|
2294
|
-
fillColor,
|
|
2295
|
-
shadowSize,
|
|
2296
|
-
size = 0
|
|
2297
|
-
} = _ref2;
|
|
2298
|
-
return [createShadowRender(position, {
|
|
2299
|
-
strokeWidth,
|
|
2300
|
-
strokeColor,
|
|
2301
|
-
shadowSize,
|
|
2302
|
-
shadowColor,
|
|
2303
|
-
size
|
|
2304
|
-
}), new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
2305
|
-
fillColor,
|
|
2306
|
-
strokeColor,
|
|
2307
|
-
strokeWidth,
|
|
2308
|
-
enclosed: true
|
|
2309
|
-
})];
|
|
2310
|
-
}
|
|
2239
|
+
const {
|
|
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);
|
|
2247
|
+
};
|
|
2311
2248
|
|
|
2312
|
-
|
|
2313
|
-
|
|
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);
|
|
2314
2256
|
|
|
2315
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
2257
|
+
var _super = /*#__PURE__*/_createSuper(SVGPoly);
|
|
2316
2258
|
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
_classCallCheck(this, ShadowedPointSymbol);
|
|
2259
|
+
function SVGPoly(_temp) {
|
|
2260
|
+
var _this;
|
|
2320
2261
|
|
|
2321
|
-
|
|
2262
|
+
let {
|
|
2263
|
+
redrawFeatureNode,
|
|
2264
|
+
pathStyles,
|
|
2265
|
+
circle,
|
|
2266
|
+
className,
|
|
2267
|
+
appendToSvg
|
|
2268
|
+
} = _temp === void 0 ? {} : _temp;
|
|
2269
|
+
|
|
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;
|
|
2322
2284
|
}
|
|
2323
2285
|
|
|
2324
|
-
_createClass(
|
|
2286
|
+
_createClass(SVGPoly, [{
|
|
2325
2287
|
key: "renderFunction",
|
|
2326
2288
|
value: function renderFunction(feature, resolution, crs) {
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
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];
|
|
2335
2310
|
}
|
|
2336
2311
|
}, {
|
|
2337
|
-
key: "
|
|
2338
|
-
value: function
|
|
2339
|
-
|
|
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
|
+
}
|
|
2340
2322
|
}
|
|
2341
2323
|
}, {
|
|
2342
|
-
key: "
|
|
2343
|
-
value: function
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
}], [{
|
|
2347
|
-
key: "getShadowArc",
|
|
2348
|
-
value: function getShadowArc(position, _ref) {
|
|
2324
|
+
key: "update",
|
|
2325
|
+
value: function update(_ref) {
|
|
2326
|
+
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2327
|
+
|
|
2349
2328
|
let {
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2329
|
+
bbox,
|
|
2330
|
+
resolution,
|
|
2331
|
+
feature,
|
|
2332
|
+
crs
|
|
2354
2333
|
} = _ref;
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
});
|
|
2377
|
-
}
|
|
2378
|
-
}, {
|
|
2379
|
-
key: "getArcs",
|
|
2380
|
-
value: function getArcs(position, params) {
|
|
2381
|
-
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2382
|
-
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2383
|
-
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2384
|
-
}
|
|
2385
|
-
}]);
|
|
2386
|
-
|
|
2387
|
-
return ShadowedPointSymbol;
|
|
2388
|
-
}(Point.PointSymbol);
|
|
2389
|
-
|
|
2390
|
-
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2391
|
-
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2392
|
-
|
|
2393
|
-
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2394
|
-
|
|
2395
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2396
|
-
function ShadowedPolySymbol(options) {
|
|
2397
|
-
_classCallCheck(this, ShadowedPolySymbol);
|
|
2398
|
-
|
|
2399
|
-
return _super.call(this, options);
|
|
2400
|
-
}
|
|
2401
|
-
|
|
2402
|
-
_createClass(ShadowedPolySymbol, [{
|
|
2403
|
-
key: "renderFunction",
|
|
2404
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2405
|
-
if (!(feature instanceof Poly$1.Poly)) return [];
|
|
2406
|
-
|
|
2407
|
-
const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
|
|
2408
|
-
|
|
2409
|
-
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2410
|
-
const shadowRender = this.getShadow(coordinates, feature);
|
|
2411
|
-
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2412
|
-
let renders = [polyRender];
|
|
2413
|
-
|
|
2414
|
-
if (shadowRender) {
|
|
2415
|
-
renders = [shadowRender, polyRender];
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
|
-
if (vertexRenders) {
|
|
2419
|
-
renders = renders.concat(vertexRenders);
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
return renders;
|
|
2423
|
-
}
|
|
2424
|
-
}, {
|
|
2425
|
-
key: "getShadow",
|
|
2426
|
-
value: function getShadow(coordinates, _feature) {
|
|
2427
|
-
return new Poly.PolyRender(coordinates, {
|
|
2428
|
-
fillStyle: Poly.FillStyle.None,
|
|
2429
|
-
enclosed: this.enclose,
|
|
2430
|
-
strokeColor: this.shadowColor,
|
|
2431
|
-
strokeWidth: this.shadowSize,
|
|
2432
|
-
lineDash: this.lineDash
|
|
2433
|
-
});
|
|
2434
|
-
}
|
|
2435
|
-
}, {
|
|
2436
|
-
key: "getPolyRender",
|
|
2437
|
-
value: function getPolyRender(coordinates, _feature) {
|
|
2438
|
-
return new Poly.PolyRender(coordinates, {
|
|
2439
|
-
fillStyle: this.enclose ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
2440
|
-
enclosed: this.enclose,
|
|
2441
|
-
fillColor: this.fillColor,
|
|
2442
|
-
strokeColor: this.strokeColor,
|
|
2443
|
-
strokeWidth: this.strokeWidth,
|
|
2444
|
-
lineDash: this.lineDash
|
|
2445
|
-
});
|
|
2446
|
-
}
|
|
2447
|
-
}, {
|
|
2448
|
-
key: "getVertexRenders",
|
|
2449
|
-
value: function getVertexRenders(coordinates) {
|
|
2450
|
-
if (!this.showVertex) return;
|
|
2451
|
-
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2452
|
-
return acc.concat(curr);
|
|
2453
|
-
}, []);
|
|
2454
|
-
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2455
|
-
size: 6,
|
|
2456
|
-
strokeWidth: 2,
|
|
2457
|
-
shadowColor: this.shadowColor,
|
|
2458
|
-
strokeColor: this.strokeColor,
|
|
2459
|
-
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2460
|
-
fillColor: '#ffffff'
|
|
2461
|
-
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2462
|
-
}
|
|
2463
|
-
}]);
|
|
2464
|
-
|
|
2465
|
-
return ShadowedPolySymbol;
|
|
2466
|
-
}(PolylineSymbol.PolylineSymbol);
|
|
2467
|
-
const polySymbolParams = {
|
|
2468
|
-
strokeWidth: 2,
|
|
2469
|
-
strokeColor: '#e33600',
|
|
2470
|
-
shadowSize: 8,
|
|
2471
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)'
|
|
2472
|
-
};
|
|
2473
|
-
const measureSymbolParams = {
|
|
2474
|
-
strokeColor: '#ff6933',
|
|
2475
|
-
shadowSize: 0,
|
|
2476
|
-
vertexShadowSize: 0
|
|
2477
|
-
};
|
|
2478
|
-
const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2479
|
-
enclose: false,
|
|
2480
|
-
showVertex: true
|
|
2481
|
-
}));
|
|
2482
|
-
const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2483
|
-
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2484
|
-
enclose: true,
|
|
2485
|
-
showVertex: true
|
|
2486
|
-
}));
|
|
2487
|
-
const snapSymbolParams = {
|
|
2488
|
-
size: 10,
|
|
2489
|
-
strokeWidth: 2,
|
|
2490
|
-
strokeColor: '#e33600',
|
|
2491
|
-
fillColor: '#ffffff',
|
|
2492
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2493
|
-
shadowSize: 3
|
|
2494
|
-
};
|
|
2495
|
-
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2496
|
-
strokeColor: '#ff6933',
|
|
2497
|
-
shadowSize: 0
|
|
2498
|
-
}));
|
|
2499
|
-
|
|
2500
|
-
let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
|
|
2501
|
-
_inherits(SelectedPointSymbol, _ShadowedPointSymbol);
|
|
2502
|
-
|
|
2503
|
-
var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
|
|
2504
|
-
|
|
2505
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2506
|
-
function SelectedPointSymbol(props) {
|
|
2507
|
-
_classCallCheck(this, SelectedPointSymbol);
|
|
2508
|
-
|
|
2509
|
-
return _super.call(this, props);
|
|
2510
|
-
}
|
|
2511
|
-
|
|
2512
|
-
_createClass(SelectedPointSymbol, [{
|
|
2513
|
-
key: "getShadow",
|
|
2514
|
-
value: function getShadow(position, feature) {
|
|
2515
|
-
if (feature.isSelected) {
|
|
2516
|
-
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2517
|
-
}
|
|
2518
|
-
}
|
|
2519
|
-
}, {
|
|
2520
|
-
key: "getPoint",
|
|
2521
|
-
value: function getPoint(position, feature) {
|
|
2522
|
-
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2523
|
-
|
|
2524
|
-
if (feature.isSelected) {
|
|
2525
|
-
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2526
|
-
pointRender.fillColor = this.selectedFillColor;
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
return pointRender;
|
|
2530
|
-
}
|
|
2531
|
-
}]);
|
|
2532
|
-
|
|
2533
|
-
return SelectedPointSymbol;
|
|
2534
|
-
}(ShadowedPointSymbol);
|
|
2535
|
-
|
|
2536
|
-
let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
|
|
2537
|
-
_inherits(SelectedPolySymbol, _ShadowedPolySymbol);
|
|
2538
|
-
|
|
2539
|
-
var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
|
|
2540
|
-
|
|
2541
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2542
|
-
function SelectedPolySymbol(props) {
|
|
2543
|
-
_classCallCheck(this, SelectedPolySymbol);
|
|
2544
|
-
|
|
2545
|
-
return _super.call(this, props);
|
|
2546
|
-
}
|
|
2547
|
-
|
|
2548
|
-
_createClass(SelectedPolySymbol, [{
|
|
2549
|
-
key: "getShadow",
|
|
2550
|
-
value: function getShadow(coordinates, feature) {
|
|
2551
|
-
if (feature.isSelected) {
|
|
2552
|
-
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
}, {
|
|
2556
|
-
key: "getPolyRender",
|
|
2557
|
-
value: function getPolyRender(coordinates, feature) {
|
|
2558
|
-
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2559
|
-
|
|
2560
|
-
if (feature.isSelected) {
|
|
2561
|
-
polyRender.fillColor = this.selectedFillColor;
|
|
2562
|
-
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2563
|
-
|
|
2564
|
-
if (this.selectedStrokeWidth !== void 0) {
|
|
2565
|
-
polyRender.strokeWidth = this.selectedStrokeWidth;
|
|
2566
|
-
}
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
return polyRender;
|
|
2570
|
-
}
|
|
2571
|
-
}]);
|
|
2572
|
-
|
|
2573
|
-
return SelectedPolySymbol;
|
|
2574
|
-
}(ShadowedPolySymbol);
|
|
2575
|
-
|
|
2576
|
-
const selectedPoint = /*#__PURE__*/new SelectedPointSymbol({
|
|
2577
|
-
size: 8,
|
|
2578
|
-
strokeWidth: 2,
|
|
2579
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2580
|
-
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2581
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2582
|
-
shadowSize: 3,
|
|
2583
|
-
selectedStrokeColor: '#ff5722',
|
|
2584
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2585
|
-
});
|
|
2586
|
-
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2587
|
-
strokeWidth: 6,
|
|
2588
|
-
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2589
|
-
shadowSize: 8,
|
|
2590
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2591
|
-
selectedStrokeColor: '#ff5722',
|
|
2592
|
-
selectedStrokeWidth: 2
|
|
2593
|
-
});
|
|
2594
|
-
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2595
|
-
strokeWidth: 2,
|
|
2596
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2597
|
-
shadowSize: 8,
|
|
2598
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2599
|
-
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2600
|
-
enclose: true,
|
|
2601
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2602
|
-
selectedStrokeColor: '#ff5722'
|
|
2603
|
-
});
|
|
2604
|
-
|
|
2605
|
-
const defaultPathStyles = {
|
|
2606
|
-
strokeWidth: 2,
|
|
2607
|
-
strokeColor: 'rgb(0, 163, 245)',
|
|
2608
|
-
fillStyle: Poly.FillStyle.None
|
|
2609
|
-
};
|
|
2610
|
-
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2611
|
-
_inherits(SVGPoly, _Symbol);
|
|
2612
|
-
|
|
2613
|
-
var _super = /*#__PURE__*/_createSuper(SVGPoly);
|
|
2614
|
-
|
|
2615
|
-
function SVGPoly(_temp) {
|
|
2616
|
-
var _this;
|
|
2617
|
-
|
|
2618
|
-
let {
|
|
2619
|
-
redrawFeatureNode,
|
|
2620
|
-
pathStyles,
|
|
2621
|
-
circle,
|
|
2622
|
-
className,
|
|
2623
|
-
appendToSvg
|
|
2624
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2625
|
-
|
|
2626
|
-
_classCallCheck(this, SVGPoly);
|
|
2627
|
-
|
|
2628
|
-
_this = _super.call(this);
|
|
2629
|
-
_this.container = document.createElement('div');
|
|
2630
|
-
_this.container.style.position = 'absolute';
|
|
2631
|
-
_this.redrawFeatureNode = redrawFeatureNode;
|
|
2632
|
-
_this.pathStyles = _extends({
|
|
2633
|
-
center: [0, 0],
|
|
2634
|
-
fillColor: 'none'
|
|
2635
|
-
}, pathStyles);
|
|
2636
|
-
_this.circle = circle;
|
|
2637
|
-
_this.className = className;
|
|
2638
|
-
_this.appendToSvg = appendToSvg;
|
|
2639
|
-
return _this;
|
|
2640
|
-
}
|
|
2641
|
-
|
|
2642
|
-
_createClass(SVGPoly, [{
|
|
2643
|
-
key: "renderFunction",
|
|
2644
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2645
|
-
const coordinates = feature instanceof Poly$1.Poly ? new PolylineSymbol.PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2646
|
-
this.setCirclePxRaius(crs);
|
|
2647
|
-
this.container.innerHTML = '';
|
|
2648
|
-
const svg = this.setSvg(coordinates);
|
|
2649
|
-
svg && this.container.append(svg);
|
|
2650
|
-
feature.__dynamicSymbolRender = new Render.DynamicRender({
|
|
2651
|
-
node: this.container,
|
|
2652
|
-
update: (bbox, resolution) => this.update({
|
|
2653
|
-
bbox,
|
|
2654
|
-
resolution,
|
|
2655
|
-
feature,
|
|
2656
|
-
crs
|
|
2657
|
-
}),
|
|
2658
|
-
redraw: () => {
|
|
2659
|
-
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2660
|
-
}
|
|
2661
|
-
});
|
|
2662
|
-
|
|
2663
|
-
this._setEventListeners(feature);
|
|
2664
|
-
|
|
2665
|
-
return [feature.__dynamicSymbolRender];
|
|
2666
|
-
}
|
|
2667
|
-
}, {
|
|
2668
|
-
key: "setCirclePxRaius",
|
|
2669
|
-
value: function setCirclePxRaius(crs) {
|
|
2670
|
-
if (this.circle && this.pathStyles) {
|
|
2671
|
-
var _this$circle;
|
|
2672
|
-
|
|
2673
|
-
this.pathStyles.radius = metersToPixels(this.circle.radius, {
|
|
2674
|
-
painter: this.circle.painter,
|
|
2675
|
-
crs
|
|
2676
|
-
}) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
|
-
}, {
|
|
2680
|
-
key: "update",
|
|
2681
|
-
value: function update(_ref) {
|
|
2682
|
-
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2683
|
-
|
|
2684
|
-
let {
|
|
2685
|
-
bbox,
|
|
2686
|
-
resolution,
|
|
2687
|
-
feature,
|
|
2688
|
-
crs
|
|
2689
|
-
} = _ref;
|
|
2690
|
-
if (!feature) return;
|
|
2691
|
-
if (!bbox) bbox = feature.__lastBbox;
|
|
2692
|
-
if (!resolution) resolution = feature.__lastResolution;
|
|
2693
|
-
if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
|
|
2694
|
-
|
|
2695
|
-
if (feature.__lastResolution && resolution !== feature.__lastResolution) {
|
|
2696
|
-
const newCoordinates = feature instanceof Poly$1.Poly ? new PolylineSymbol.PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2697
|
-
this.setCirclePxRaius(crs);
|
|
2698
|
-
this.container.innerHTML = '';
|
|
2699
|
-
const svg = this.setSvg(newCoordinates);
|
|
2700
|
-
svg && this.container.append(svg);
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
const polygon = feature.projectTo(bbox.crs);
|
|
2704
|
-
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;
|
|
2705
|
-
const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
|
|
2706
|
-
const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
|
|
2707
|
-
this.container.style.left = dx.toString() + "px";
|
|
2708
|
-
this.container.style.top = dy.toString() + "px";
|
|
2709
|
-
feature.__lastBbox = bbox;
|
|
2710
|
-
feature.__lastResolution = resolution;
|
|
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;
|
|
2338
|
+
|
|
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
|
+
}
|
|
2346
|
+
|
|
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;
|
|
2711
2355
|
}
|
|
2712
2356
|
}, {
|
|
2713
2357
|
key: "setSvg",
|
|
@@ -3176,7 +2820,7 @@ function evaluateCondition(condition$1, attributes) {
|
|
|
3176
2820
|
}
|
|
3177
2821
|
|
|
3178
2822
|
function getAttributeValue(attributes, attributeName) {
|
|
3179
|
-
const attributeMeta = attributes.find(_ref => {
|
|
2823
|
+
const attributeMeta = attributes.find((_ref) => {
|
|
3180
2824
|
let {
|
|
3181
2825
|
name
|
|
3182
2826
|
} = _ref;
|
|
@@ -3190,7 +2834,7 @@ const getAttributeNameFromClassified = values => values.length > 0 ? getAttribut
|
|
|
3190
2834
|
|
|
3191
2835
|
function findFeatureValue(parameterValues, _ref2) {
|
|
3192
2836
|
let [name, value] = _ref2;
|
|
3193
|
-
return value !== null ? parameterValues.find(_ref3 => {
|
|
2837
|
+
return value !== null ? parameterValues.find((_ref3) => {
|
|
3194
2838
|
let {
|
|
3195
2839
|
condition
|
|
3196
2840
|
} = _ref3;
|
|
@@ -3230,7 +2874,7 @@ function evaluateFeatureSymbol(attributes) {
|
|
|
3230
2874
|
}
|
|
3231
2875
|
|
|
3232
2876
|
function findChildFeatureStyle(childStyles, attributes) {
|
|
3233
|
-
return (childStyles || []).find(_ref5 => {
|
|
2877
|
+
return (childStyles || []).find((_ref5) => {
|
|
3234
2878
|
let {
|
|
3235
2879
|
condition
|
|
3236
2880
|
} = _ref5;
|
|
@@ -3291,7 +2935,7 @@ let EvergisLayer = /*#__PURE__*/function () {
|
|
|
3291
2935
|
feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
|
|
3292
2936
|
feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
|
|
3293
2937
|
feature.layerAlias = this.alias;
|
|
3294
|
-
const titleAttribute = (feature.attributes || []).find(_ref => {
|
|
2938
|
+
const titleAttribute = (feature.attributes || []).find((_ref) => {
|
|
3295
2939
|
let {
|
|
3296
2940
|
name
|
|
3297
2941
|
} = _ref;
|
|
@@ -3314,7 +2958,7 @@ const evaluateFeature = layers => feature => {
|
|
|
3314
2958
|
};
|
|
3315
2959
|
|
|
3316
2960
|
const OTHERS_TITLE = 'Другое';
|
|
3317
|
-
const createLegendItem = _ref => {
|
|
2961
|
+
const createLegendItem = (_ref) => {
|
|
3318
2962
|
let {
|
|
3319
2963
|
attributes,
|
|
3320
2964
|
renderTitle,
|
|
@@ -3360,7 +3004,7 @@ function createStyleLegend(style, config) {
|
|
|
3360
3004
|
classificationManager,
|
|
3361
3005
|
symbol
|
|
3362
3006
|
} = style;
|
|
3363
|
-
const items = classificationManager.filter(_ref => {
|
|
3007
|
+
const items = classificationManager.filter((_ref) => {
|
|
3364
3008
|
let {
|
|
3365
3009
|
parameter
|
|
3366
3010
|
} = _ref;
|
|
@@ -3476,7 +3120,7 @@ const useMapLegend = (layer, config) => {
|
|
|
3476
3120
|
};
|
|
3477
3121
|
|
|
3478
3122
|
const LEGEND_SYMBOL_MAX_SIZE = 32;
|
|
3479
|
-
const useLegendValueSymbol = _ref => {
|
|
3123
|
+
const useLegendValueSymbol = (_ref) => {
|
|
3480
3124
|
let {
|
|
3481
3125
|
parameter,
|
|
3482
3126
|
parameterValue
|
|
@@ -3723,11 +3367,10 @@ function useFeatureLayer(_ref) {
|
|
|
3723
3367
|
}),
|
|
3724
3368
|
destructor: layer => map.indexOf(layer) !== -1 && map.removeLayer(layer),
|
|
3725
3369
|
update: (layer, _ref2) => {
|
|
3726
|
-
let [features
|
|
3370
|
+
let [features] = _ref2;
|
|
3727
3371
|
layer.features = features;
|
|
3728
|
-
layer.opacity = opacity != null ? opacity : 1;
|
|
3729
3372
|
}
|
|
3730
|
-
}, [features
|
|
3373
|
+
}, [features]);
|
|
3731
3374
|
useLayerOrder(layer, zIndex);
|
|
3732
3375
|
useLayerVisibility(layer, isDisplayed);
|
|
3733
3376
|
useLayerOpacity(layer, opacity);
|
|
@@ -3884,7 +3527,7 @@ function useMapWrapper() {
|
|
|
3884
3527
|
return wrapperRef;
|
|
3885
3528
|
}
|
|
3886
3529
|
|
|
3887
|
-
const byScale = scale => _ref => {
|
|
3530
|
+
const byScale = scale => (_ref) => {
|
|
3888
3531
|
let {
|
|
3889
3532
|
zIndex
|
|
3890
3533
|
} = _ref;
|
|
@@ -4083,7 +3726,7 @@ const useTooltip = function useTooltip(zIndex) {
|
|
|
4083
3726
|
|
|
4084
3727
|
return reset;
|
|
4085
3728
|
}, [reset, map, layer, zIndex]);
|
|
4086
|
-
const onSetLabelFeature = React.useCallback(_ref => {
|
|
3729
|
+
const onSetLabelFeature = React.useCallback((_ref) => {
|
|
4087
3730
|
let {
|
|
4088
3731
|
point,
|
|
4089
3732
|
position,
|
|
@@ -4247,7 +3890,7 @@ function useClusterLayer(_ref) {
|
|
|
4247
3890
|
}
|
|
4248
3891
|
|
|
4249
3892
|
const INIT_FEATURES = [];
|
|
4250
|
-
const useEvergisSelect = _ref => {
|
|
3893
|
+
const useEvergisSelect = (_ref) => {
|
|
4251
3894
|
let {
|
|
4252
3895
|
onPick,
|
|
4253
3896
|
onFeatures
|
|
@@ -4280,7 +3923,7 @@ function none() {
|
|
|
4280
3923
|
return;
|
|
4281
3924
|
}
|
|
4282
3925
|
|
|
4283
|
-
const useDraggableMarker = _ref => {
|
|
3926
|
+
const useDraggableMarker = (_ref) => {
|
|
4284
3927
|
let {
|
|
4285
3928
|
position,
|
|
4286
3929
|
onChange,
|
|
@@ -4402,7 +4045,7 @@ const useToggle = initial => {
|
|
|
4402
4045
|
return [state, toggle, setState];
|
|
4403
4046
|
};
|
|
4404
4047
|
|
|
4405
|
-
const Symbol = _ref => {
|
|
4048
|
+
const Symbol = (_ref) => {
|
|
4406
4049
|
let {
|
|
4407
4050
|
symbol,
|
|
4408
4051
|
size,
|
|
@@ -4423,19 +4066,19 @@ const Symbol = _ref => {
|
|
|
4423
4066
|
};
|
|
4424
4067
|
|
|
4425
4068
|
var _templateObject, _templateObject2;
|
|
4426
|
-
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) => {
|
|
4427
4070
|
let {
|
|
4428
4071
|
geometryType,
|
|
4429
4072
|
icons
|
|
4430
4073
|
} = _ref;
|
|
4431
4074
|
return "url(" + icons[geometryType] + ") center center / " + (geometryType === api.GeometryType.Polyline ? '2rem 1.3rem' : 'auto 1rem') + " no-repeat";
|
|
4432
4075
|
});
|
|
4433
|
-
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) => {
|
|
4434
4077
|
let {
|
|
4435
4078
|
color
|
|
4436
4079
|
} = _ref2;
|
|
4437
4080
|
return color;
|
|
4438
|
-
}, _ref3 => {
|
|
4081
|
+
}, (_ref3) => {
|
|
4439
4082
|
let {
|
|
4440
4083
|
color
|
|
4441
4084
|
} = _ref3;
|
|
@@ -4443,7 +4086,7 @@ const ClusterSymbol = /*#__PURE__*/styled__default.div(_templateObject2 || (_tem
|
|
|
4443
4086
|
});
|
|
4444
4087
|
|
|
4445
4088
|
const MAX_SIZE = 32;
|
|
4446
|
-
const StyleSymbol = _ref => {
|
|
4089
|
+
const StyleSymbol = (_ref) => {
|
|
4447
4090
|
let {
|
|
4448
4091
|
symbol,
|
|
4449
4092
|
size = MAX_SIZE,
|
|
@@ -4500,7 +4143,7 @@ const AttributeValueContainer = /*#__PURE__*/styled__default.div(_templateObject
|
|
|
4500
4143
|
const SimpleAttribute = /*#__PURE__*/styled__default.div(_templateObject15 || (_templateObject15 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
|
|
4501
4144
|
const ValueLink = /*#__PURE__*/styled__default.a(_templateObject16 || (_templateObject16 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 0 0.25rem;\n color: #1fb3aa;\n text-decoration: none;\n"])));
|
|
4502
4145
|
|
|
4503
|
-
const MailValue = _ref => {
|
|
4146
|
+
const MailValue = (_ref) => {
|
|
4504
4147
|
let {
|
|
4505
4148
|
mail
|
|
4506
4149
|
} = _ref;
|
|
@@ -4511,7 +4154,7 @@ const MailValue = _ref => {
|
|
|
4511
4154
|
}, mail);
|
|
4512
4155
|
};
|
|
4513
4156
|
|
|
4514
|
-
const PhoneValue = _ref => {
|
|
4157
|
+
const PhoneValue = (_ref) => {
|
|
4515
4158
|
let {
|
|
4516
4159
|
phone
|
|
4517
4160
|
} = _ref;
|
|
@@ -4522,7 +4165,7 @@ const PhoneValue = _ref => {
|
|
|
4522
4165
|
}, phone);
|
|
4523
4166
|
};
|
|
4524
4167
|
|
|
4525
|
-
const UrlValue = _ref => {
|
|
4168
|
+
const UrlValue = (_ref) => {
|
|
4526
4169
|
let {
|
|
4527
4170
|
url
|
|
4528
4171
|
} = _ref;
|
|
@@ -4533,7 +4176,7 @@ const UrlValue = _ref => {
|
|
|
4533
4176
|
}, url);
|
|
4534
4177
|
};
|
|
4535
4178
|
|
|
4536
|
-
const AttributeValue = _ref => {
|
|
4179
|
+
const AttributeValue = (_ref) => {
|
|
4537
4180
|
let {
|
|
4538
4181
|
attribute
|
|
4539
4182
|
} = _ref;
|
|
@@ -4547,29 +4190,29 @@ const AttributeValue = _ref => {
|
|
|
4547
4190
|
if (attributeValue.type === 2
|
|
4548
4191
|
/* Url */
|
|
4549
4192
|
) {
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4193
|
+
return React__default.createElement(UrlValue, {
|
|
4194
|
+
key: key,
|
|
4195
|
+
url: punycodeDecode(value)
|
|
4196
|
+
});
|
|
4197
|
+
}
|
|
4555
4198
|
|
|
4556
4199
|
if (attributeValue.type === 3
|
|
4557
4200
|
/* Mail */
|
|
4558
4201
|
) {
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4202
|
+
return React__default.createElement(MailValue, {
|
|
4203
|
+
key: key,
|
|
4204
|
+
mail: value
|
|
4205
|
+
});
|
|
4206
|
+
}
|
|
4564
4207
|
|
|
4565
4208
|
if (attributeValue.type === 1
|
|
4566
4209
|
/* Phone */
|
|
4567
4210
|
) {
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4211
|
+
return React__default.createElement(PhoneValue, {
|
|
4212
|
+
key: key,
|
|
4213
|
+
phone: value
|
|
4214
|
+
});
|
|
4215
|
+
}
|
|
4573
4216
|
|
|
4574
4217
|
return React__default.createElement(SimpleAttribute, {
|
|
4575
4218
|
key: value
|
|
@@ -4585,7 +4228,7 @@ function punycodeDecode(domains) {
|
|
|
4585
4228
|
}
|
|
4586
4229
|
}
|
|
4587
4230
|
|
|
4588
|
-
const EvergisCardAttribute = _ref => {
|
|
4231
|
+
const EvergisCardAttribute = (_ref) => {
|
|
4589
4232
|
let {
|
|
4590
4233
|
attribute,
|
|
4591
4234
|
className
|
|
@@ -4597,7 +4240,7 @@ const EvergisCardAttribute = _ref => {
|
|
|
4597
4240
|
}));
|
|
4598
4241
|
};
|
|
4599
4242
|
|
|
4600
|
-
const StyledCard = _ref => {
|
|
4243
|
+
const StyledCard = (_ref) => {
|
|
4601
4244
|
let {
|
|
4602
4245
|
features = [],
|
|
4603
4246
|
className,
|
|
@@ -4643,7 +4286,7 @@ const StyledCard = _ref => {
|
|
|
4643
4286
|
};
|
|
4644
4287
|
|
|
4645
4288
|
const _excluded$1 = ["renderCard", "className", "children"];
|
|
4646
|
-
const EvergisCard = _ref => {
|
|
4289
|
+
const EvergisCard = (_ref) => {
|
|
4647
4290
|
let {
|
|
4648
4291
|
renderCard,
|
|
4649
4292
|
className,
|
|
@@ -4695,7 +4338,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
|
|
|
4695
4338
|
|
|
4696
4339
|
const useSGisFeatures = (features, currentIndex) => React.useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
|
|
4697
4340
|
|
|
4698
|
-
const EvergisSelectLayer = _ref => {
|
|
4341
|
+
const EvergisSelectLayer = (_ref) => {
|
|
4699
4342
|
let {
|
|
4700
4343
|
features,
|
|
4701
4344
|
zIndex,
|
|
@@ -4740,7 +4383,7 @@ const TileLayer = props => {
|
|
|
4740
4383
|
};
|
|
4741
4384
|
|
|
4742
4385
|
const defaultZIndex = 200;
|
|
4743
|
-
const EvergisSelect = _ref => {
|
|
4386
|
+
const EvergisSelect = (_ref) => {
|
|
4744
4387
|
let {
|
|
4745
4388
|
onPick,
|
|
4746
4389
|
className,
|
|
@@ -4775,7 +4418,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled__default.p(_templateObject3$1 || (
|
|
|
4775
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);
|
|
4776
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"])));
|
|
4777
4420
|
|
|
4778
|
-
const LegendSection = _ref => {
|
|
4421
|
+
const LegendSection = (_ref) => {
|
|
4779
4422
|
let {
|
|
4780
4423
|
item,
|
|
4781
4424
|
renderLegendTitle,
|
|
@@ -4789,7 +4432,7 @@ var _templateObject$3, _templateObject2$3;
|
|
|
4789
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"])));
|
|
4790
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"])));
|
|
4791
4434
|
|
|
4792
|
-
const SearchInput = _ref => {
|
|
4435
|
+
const SearchInput = (_ref) => {
|
|
4793
4436
|
let {
|
|
4794
4437
|
onChange
|
|
4795
4438
|
} = _ref;
|
|
@@ -4798,7 +4441,7 @@ const SearchInput = _ref => {
|
|
|
4798
4441
|
}));
|
|
4799
4442
|
};
|
|
4800
4443
|
|
|
4801
|
-
const LegendSymbol = _ref => {
|
|
4444
|
+
const LegendSymbol = (_ref) => {
|
|
4802
4445
|
let {
|
|
4803
4446
|
parameter,
|
|
4804
4447
|
parameterValue,
|
|
@@ -4816,7 +4459,7 @@ const LegendSymbol = _ref => {
|
|
|
4816
4459
|
return React__default.createElement(React__default.Fragment, null, children(symbol));
|
|
4817
4460
|
};
|
|
4818
4461
|
|
|
4819
|
-
const LegendValue = _ref => {
|
|
4462
|
+
const LegendValue = (_ref) => {
|
|
4820
4463
|
let {
|
|
4821
4464
|
value,
|
|
4822
4465
|
parameter,
|
|
@@ -4838,7 +4481,7 @@ const getNumberParam = (parameterValue, param) => {
|
|
|
4838
4481
|
return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
|
|
4839
4482
|
};
|
|
4840
4483
|
|
|
4841
|
-
const getSymbolSize = _ref => {
|
|
4484
|
+
const getSymbolSize = (_ref) => {
|
|
4842
4485
|
let {
|
|
4843
4486
|
parameterValue,
|
|
4844
4487
|
maxSize
|
|
@@ -4863,7 +4506,7 @@ const getSymbolSize = _ref => {
|
|
|
4863
4506
|
}
|
|
4864
4507
|
};
|
|
4865
4508
|
|
|
4866
|
-
const Legend = _ref => {
|
|
4509
|
+
const Legend = (_ref) => {
|
|
4867
4510
|
let {
|
|
4868
4511
|
layer,
|
|
4869
4512
|
children,
|
|
@@ -4891,13 +4534,13 @@ const Legend = _ref => {
|
|
|
4891
4534
|
className: className
|
|
4892
4535
|
}, searchable && searchLayer && React__default.createElement(SearchInput, {
|
|
4893
4536
|
onChange: searchLayer
|
|
4894
|
-
}), renderCustomLegend && layer ? renderCustomLegend(layer) : children ? legend && children(legend) : legend && legend.items.map(legendItem => React__default.createElement(LegendSection, {
|
|
4537
|
+
}), renderCustomLegend && layer ? renderCustomLegend(layer) : children ? legend && children(legend) : legend && legend.items.map((legendItem, index) => React__default.createElement(LegendSection, {
|
|
4895
4538
|
key: legendItem.attribute + "-" + legendItem.parameter,
|
|
4896
4539
|
item: legendItem,
|
|
4897
4540
|
hideTitle: (layer == null ? void 0 : layer.alias) === legendItem.title,
|
|
4898
4541
|
renderLegendTitle: config && config.renderLegendTitle
|
|
4899
4542
|
}, legendValue => React__default.createElement(LegendValue, {
|
|
4900
|
-
key: legendValue.title,
|
|
4543
|
+
key: legendValue.title + "-" + index,
|
|
4901
4544
|
value: legendValue,
|
|
4902
4545
|
parameter: legendItem.parameter,
|
|
4903
4546
|
maxSize: getSymbolSize({
|
|
@@ -4907,275 +4550,663 @@ const Legend = _ref => {
|
|
|
4907
4550
|
})))));
|
|
4908
4551
|
};
|
|
4909
4552
|
|
|
4910
|
-
const Map = _ref => {
|
|
4553
|
+
const Map = (_ref) => {
|
|
4554
|
+
let {
|
|
4555
|
+
className,
|
|
4556
|
+
position,
|
|
4557
|
+
resolution,
|
|
4558
|
+
minScale,
|
|
4559
|
+
maxScale,
|
|
4560
|
+
children,
|
|
4561
|
+
onBboxChange,
|
|
4562
|
+
style
|
|
4563
|
+
} = _ref;
|
|
4564
|
+
const wrapperRef = useMapWrapper();
|
|
4565
|
+
const {
|
|
4566
|
+
map
|
|
4567
|
+
} = useMapContext();
|
|
4568
|
+
const handleBboxChange = React.useCallback(state => {
|
|
4569
|
+
if (onBboxChange && shouldUpdateMapState(map, {
|
|
4570
|
+
position,
|
|
4571
|
+
resolution
|
|
4572
|
+
})) {
|
|
4573
|
+
onBboxChange(state);
|
|
4574
|
+
}
|
|
4575
|
+
}, [map, onBboxChange, position, resolution]);
|
|
4576
|
+
useUpdateMapView({
|
|
4577
|
+
position,
|
|
4578
|
+
resolution
|
|
4579
|
+
});
|
|
4580
|
+
useMaxMinScale(minScale, maxScale, position, resolution);
|
|
4581
|
+
useMapBboxChange(handleBboxChange);
|
|
4582
|
+
return React__default.createElement("div", {
|
|
4583
|
+
className: className,
|
|
4584
|
+
ref: wrapperRef,
|
|
4585
|
+
style: style
|
|
4586
|
+
}, children);
|
|
4587
|
+
};
|
|
4588
|
+
|
|
4589
|
+
var _templateObject$4, _templateObject2$4, _templateObject3$2, _templateObject4$2, _templateObject5$2;
|
|
4590
|
+
|
|
4591
|
+
const topLeft = distance => styled.css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4592
|
+
|
|
4593
|
+
const topRight = distance => styled.css(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n right: ", ";\n"])), distance, distance);
|
|
4594
|
+
|
|
4595
|
+
const bottomLeft = distance => styled.css(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4596
|
+
|
|
4597
|
+
const bottomRight = distance => styled.css(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n right: ", ";\n"])), distance, distance);
|
|
4598
|
+
|
|
4599
|
+
const placementMixin = function placementMixin(placement, distance) {
|
|
4600
|
+
if (placement === void 0) {
|
|
4601
|
+
placement = 'bottom-left';
|
|
4602
|
+
}
|
|
4603
|
+
|
|
4604
|
+
if (distance === void 0) {
|
|
4605
|
+
distance = '1rem';
|
|
4606
|
+
}
|
|
4607
|
+
|
|
4608
|
+
return styled.css(_templateObject5$2 || (_templateObject5$2 = _taggedTemplateLiteralLoose(["\n ", "\n ", "\n ", "\n ", "\n"])), placement === 'top-left' && topLeft(distance), placement === 'top-right' && topRight(distance), placement === 'bottom-left' && bottomLeft(distance), placement === 'bottom-right' && bottomRight(distance));
|
|
4609
|
+
};
|
|
4610
|
+
|
|
4611
|
+
var _templateObject$5, _templateObject2$5, _templateObject3$3, _templateObject4$3, _templateObject5$3, _templateObject6$1, _templateObject7$1, _templateObject8$1;
|
|
4612
|
+
const mapControlBtnMixin = /*#__PURE__*/styled.css(_templateObject$5 || (_templateObject$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 2rem;\n height: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: #fff;\n"])));
|
|
4613
|
+
const ZoomInBtn = /*#__PURE__*/styled__default(icons.Icon)(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin); // ZoomInBtn.defaultProps = { kind: "plus" };
|
|
4614
|
+
|
|
4615
|
+
const ZoomOutBtn = /*#__PURE__*/styled__default(icons.Icon)(_templateObject3$3 || (_templateObject3$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin); // ZoomOutBtn.defaultProps = { kind: "minus" };
|
|
4616
|
+
|
|
4617
|
+
const SearchBtn = /*#__PURE__*/styled__default(icons.Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin); // SearchBtn.defaultProps = { kind: "search" };
|
|
4618
|
+
// TODO not exists in fonts
|
|
4619
|
+
|
|
4620
|
+
const FullscreenBtn = /*#__PURE__*/styled__default(icons.Icon)(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin); // FullscreenBtn.defaultProps = { kind: "maximize" };
|
|
4621
|
+
|
|
4622
|
+
const MeasureBtn = /*#__PURE__*/styled__default(icons.Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin); // MeasureBtn.defaultProps = { kind: "measure_length" };
|
|
4623
|
+
|
|
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"])));
|
|
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) => {
|
|
4626
|
+
let {
|
|
4627
|
+
vertical
|
|
4628
|
+
} = _ref;
|
|
4629
|
+
return vertical ? 'column' : 'row';
|
|
4630
|
+
}, (_ref2) => {
|
|
4631
|
+
let {
|
|
4632
|
+
placement
|
|
4633
|
+
} = _ref2;
|
|
4634
|
+
return placementMixin(placement);
|
|
4635
|
+
}, MapControl, (_ref3) => {
|
|
4636
|
+
let {
|
|
4637
|
+
vertical
|
|
4638
|
+
} = _ref3;
|
|
4639
|
+
return vertical ? '0.5rem' : '0';
|
|
4640
|
+
}, (_ref4) => {
|
|
4641
|
+
let {
|
|
4642
|
+
vertical
|
|
4643
|
+
} = _ref4;
|
|
4644
|
+
return vertical ? '0' : '0.5rem';
|
|
4645
|
+
}, (_ref5) => {
|
|
4646
|
+
let {
|
|
4647
|
+
vertical
|
|
4648
|
+
} = _ref5;
|
|
4649
|
+
return vertical ? 'column' : 'row';
|
|
4650
|
+
});
|
|
4651
|
+
|
|
4652
|
+
const Measure = () => {
|
|
4653
|
+
return React__default.createElement(MapControl, null, React__default.createElement(MeasureBtn, {
|
|
4654
|
+
onClick: () => {}
|
|
4655
|
+
}));
|
|
4656
|
+
};
|
|
4657
|
+
|
|
4658
|
+
const Search = () => {
|
|
4659
|
+
return React__default.createElement(MapControl, null, React__default.createElement(SearchBtn, {
|
|
4660
|
+
onClick: () => {}
|
|
4661
|
+
}));
|
|
4662
|
+
};
|
|
4663
|
+
|
|
4664
|
+
const Fullscreen = () => {
|
|
4665
|
+
return React__default.createElement(MapControl, null, React__default.createElement(FullscreenBtn, {
|
|
4666
|
+
onClick: () => {}
|
|
4667
|
+
}));
|
|
4668
|
+
};
|
|
4669
|
+
|
|
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"])));
|
|
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"])));
|
|
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"])));
|
|
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"])));
|
|
4685
|
+
const MinimizedLegendContainer = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n :not(:first-child) {\n margin-top: 1rem;\n }\n"])));
|
|
4686
|
+
const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject6$2 || (_templateObject6$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n min-height: 1rem;\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
|
|
4687
|
+
|
|
4688
|
+
const SizeLegendItemMixin = function SizeLegendItemMixin(value) {
|
|
4689
|
+
if (value === void 0) {
|
|
4690
|
+
value = 0;
|
|
4691
|
+
}
|
|
4692
|
+
|
|
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) => {
|
|
4911
4871
|
let {
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
resolution,
|
|
4915
|
-
minScale,
|
|
4916
|
-
maxScale,
|
|
4917
|
-
children,
|
|
4918
|
-
onBboxChange,
|
|
4919
|
-
style
|
|
4872
|
+
value,
|
|
4873
|
+
parameter
|
|
4920
4874
|
} = _ref;
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
onBboxChange(state);
|
|
4931
|
-
}
|
|
4932
|
-
}, [map, onBboxChange, position, resolution]);
|
|
4933
|
-
useUpdateMapView({
|
|
4934
|
-
position,
|
|
4935
|
-
resolution
|
|
4936
|
-
});
|
|
4937
|
-
useMaxMinScale(minScale, maxScale, position, resolution);
|
|
4938
|
-
useMapBboxChange(handleBboxChange);
|
|
4939
|
-
return React__default.createElement("div", {
|
|
4940
|
-
className: className,
|
|
4941
|
-
ref: wrapperRef,
|
|
4942
|
-
style: style
|
|
4943
|
-
}, children);
|
|
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
|
+
}));
|
|
4944
4884
|
};
|
|
4945
4885
|
|
|
4946
|
-
|
|
4886
|
+
const DEFAULT_FORMATTERS = {
|
|
4887
|
+
polygon: formatPolygonMeasure,
|
|
4888
|
+
length: formatLength
|
|
4889
|
+
};
|
|
4947
4890
|
|
|
4948
|
-
const
|
|
4891
|
+
const COORD_FRACTION = 6;
|
|
4892
|
+
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
4893
|
+
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
4894
|
+
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
4949
4895
|
|
|
4950
|
-
|
|
4896
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
4951
4897
|
|
|
4952
|
-
|
|
4898
|
+
function BaseMeasureToolCreator(map, painter, params) {
|
|
4899
|
+
var _this;
|
|
4953
4900
|
|
|
4954
|
-
|
|
4901
|
+
_classCallCheck(this, BaseMeasureToolCreator);
|
|
4955
4902
|
|
|
4956
|
-
|
|
4957
|
-
if (placement === void 0) {
|
|
4958
|
-
placement = 'bottom-left';
|
|
4959
|
-
}
|
|
4903
|
+
_this = _super.call(this, map, params);
|
|
4960
4904
|
|
|
4961
|
-
|
|
4962
|
-
|
|
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;
|
|
4963
4920
|
}
|
|
4964
4921
|
|
|
4965
|
-
|
|
4966
|
-
|
|
4922
|
+
_createClass(BaseMeasureToolCreator, [{
|
|
4923
|
+
key: "_handleMousemove",
|
|
4924
|
+
value: function _handleMousemove(event) {
|
|
4925
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_handleMousemove", this).call(this, event);
|
|
4967
4926
|
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4927
|
+
this.drawPointOnMouseMove(event);
|
|
4928
|
+
}
|
|
4929
|
+
}, {
|
|
4930
|
+
key: "_activate",
|
|
4931
|
+
value: function _activate() {
|
|
4932
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_activate", this).call(this);
|
|
4971
4933
|
|
|
4972
|
-
|
|
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);
|
|
4973
4941
|
|
|
4974
|
-
|
|
4975
|
-
|
|
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;
|
|
4976
4957
|
|
|
4977
|
-
|
|
4958
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4959
|
+
this.finishDrawing();
|
|
4960
|
+
this.fire(new Control.DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
4961
|
+
return;
|
|
4962
|
+
}
|
|
4978
4963
|
|
|
4979
|
-
|
|
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
|
+
}
|
|
4980
4982
|
|
|
4981
|
-
const
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
}
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
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);
|
|
5008
5022
|
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
}
|
|
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
|
+
}
|
|
5014
5031
|
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
}
|
|
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;
|
|
5020
5110
|
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
};
|
|
5111
|
+
if (wrapper && typeof wrapper !== 'string') {
|
|
5112
|
+
wrapper.style.cursor = cursor;
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
}]);
|
|
5026
5116
|
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
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"])));
|
|
5030
|
-
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"])));
|
|
5031
|
-
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"])));
|
|
5032
|
-
const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n min-height: 1rem;\n margin-bottom: 0.5rem;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
|
|
5033
|
-
const MapLegendItem = /*#__PURE__*/styled__default.div(_templateObject6$2 || (_templateObject6$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n height: 1rem;\n background: ", ";\n border: 1px rgba(48, 69, 79, 0.1) solid;\n margin-right: -1px;\n \n ", "\n"])), _ref => {
|
|
5034
|
-
let {
|
|
5035
|
-
value
|
|
5036
|
-
} = _ref;
|
|
5037
|
-
return typeof value === "number" ? "none" : value;
|
|
5038
|
-
}, _ref2 => {
|
|
5039
|
-
let {
|
|
5040
|
-
value
|
|
5041
|
-
} = _ref2;
|
|
5042
|
-
return !!value && typeof value === "number" && SizeLegendMixin(value);
|
|
5043
|
-
});
|
|
5044
|
-
const MapLegendOther = /*#__PURE__*/styled__default(MapLegendItem)(_templateObject7$2 || (_templateObject7$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: none;\n width: 1rem;\n margin-left: 0.25rem;\n border-radius: 0.125rem;\n"])));
|
|
5045
|
-
const SizeOverlayLegendMixin = /*#__PURE__*/styled.css(_templateObject8$2 || (_templateObject8$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 2rem;\n height: 2rem;\n margin: 0 auto;\n \n ", ", ", " {\n flex: none;\n position: absolute;\n top: 0;\n left: 50%;\n width: inherit;\n height: inherit;\n margin-left: -1rem;\n \n :after {\n top: 0;\n margin-top: 0;\n }\n }\n"])), MapLegendItem, MapLegendOther);
|
|
5046
|
-
const SizeMinimizedLegend = /*#__PURE__*/styled__default.div(_templateObject9$1 || (_templateObject9$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n margin-top: 0.5rem;\n \n ", " {\n margin: 0 auto;\n }\n"])), MapLegendItem);
|
|
5047
|
-
const SizeMinimizedLegendSymbol = /*#__PURE__*/styled__default.div(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n"])));
|
|
5048
|
-
const SizeMinimizedLegendLabel = /*#__PURE__*/styled__default.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
|
|
5049
|
-
const SizeMinimizedLegendDown = /*#__PURE__*/styled__default.div(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.28;\n"])));
|
|
5050
|
-
const SizeMinimizedLegendUp = /*#__PURE__*/styled__default.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: white;\n opacity: 0.65;\n"])));
|
|
5051
|
-
const MapLegendItems = /*#__PURE__*/styled__default.div(_templateObject14$1 || (_templateObject14$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n"])), _ref3 => {
|
|
5052
|
-
let {
|
|
5053
|
-
overlay
|
|
5054
|
-
} = _ref3;
|
|
5055
|
-
return overlay && SizeOverlayLegendMixin;
|
|
5056
|
-
});
|
|
5117
|
+
return BaseMeasureToolCreator;
|
|
5118
|
+
}(PolylineControl.PolylineControl);
|
|
5057
5119
|
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
value = 0;
|
|
5061
|
-
}
|
|
5120
|
+
let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
|
|
5121
|
+
_inherits(BaseMeasureToolEditor, _PolyEditor);
|
|
5062
5122
|
|
|
5063
|
-
|
|
5064
|
-
};
|
|
5123
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
|
|
5065
5124
|
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
const MapLegendValuesOther = /*#__PURE__*/styled__default(MapLegendOther)(_templateObject18 || (_templateObject18 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
|
|
5069
|
-
const MapLegendExpandButton = /*#__PURE__*/styled__default.div(_templateObject19 || (_templateObject19 = /*#__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;
|
|
5070
5127
|
|
|
5071
|
-
|
|
5072
|
-
let {
|
|
5073
|
-
isSize
|
|
5074
|
-
} = _ref;
|
|
5075
|
-
return React__default.createElement(MapLegendDescriptionContainer, null, isSize ? "Размер знака" : "Цвет символа");
|
|
5076
|
-
};
|
|
5128
|
+
_classCallCheck(this, BaseMeasureToolEditor);
|
|
5077
5129
|
|
|
5078
|
-
|
|
5079
|
-
var _title$split;
|
|
5130
|
+
_this = _super.call(this, map, params);
|
|
5080
5131
|
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
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
|
+
};
|
|
5085
5150
|
|
|
5086
|
-
|
|
5087
|
-
|
|
5151
|
+
_this.removeFeature = () => {
|
|
5152
|
+
_this.fire('remove');
|
|
5153
|
+
};
|
|
5088
5154
|
|
|
5089
|
-
|
|
5090
|
-
|
|
5155
|
+
_this.painter = painter;
|
|
5156
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
5157
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
5091
5158
|
|
|
5092
|
-
|
|
5093
|
-
values,
|
|
5094
|
-
title,
|
|
5095
|
-
isSize
|
|
5096
|
-
} = _ref;
|
|
5097
|
-
const currentValues = [...values];
|
|
5098
|
-
const other = currentValues.pop();
|
|
5099
|
-
return React__default.createElement(React__default.Fragment, null, !!title && React__default.createElement(MapLegendValueDescr, null, title), React__default.createElement(MapLegendDescription, {
|
|
5100
|
-
isSize: isSize
|
|
5101
|
-
}), isSize ? React__default.createElement(React__default.Fragment, null, React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendItems, {
|
|
5102
|
-
overlay: true
|
|
5103
|
-
}, currentValues.map(value => React__default.createElement(MapLegendItem, {
|
|
5104
|
-
key: value.title,
|
|
5105
|
-
title: value.title,
|
|
5106
|
-
value: value.parameterValue
|
|
5107
|
-
})))), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendDown, null, (_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title), React__default.createElement(SizeMinimizedLegendUp, null, (_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title))), React__default.createElement(SizeMinimizedLegend, null, React__default.createElement(SizeMinimizedLegendSymbol, null, React__default.createElement(MapLegendOther, {
|
|
5108
|
-
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
5109
|
-
value: other == null ? void 0 : other.parameterValue
|
|
5110
|
-
})), React__default.createElement(SizeMinimizedLegendLabel, null, React__default.createElement(SizeMinimizedLegendUp, null, "\u0414\u0440\u0443\u0433\u043E\u0435")))) : React__default.createElement(MapLegendItems, {
|
|
5111
|
-
overlay: isSize
|
|
5112
|
-
}, currentValues.map(value => React__default.createElement(MapLegendItem, {
|
|
5113
|
-
key: value.title,
|
|
5114
|
-
title: value.title,
|
|
5115
|
-
value: value.parameterValue
|
|
5116
|
-
})), React__default.createElement(MapLegendOther, {
|
|
5117
|
-
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
5118
|
-
value: other == null ? void 0 : other.parameterValue
|
|
5119
|
-
})), typeof (other == null ? void 0 : other.parameterValue) === "string" && React__default.createElement(MapLegendValues, null, React__default.createElement(MapLegendValuesRange, null, React__default.createElement("div", null, getValueFromLegendTitle((_currentValues$2 = currentValues[0]) == null ? void 0 : _currentValues$2.title, "max")), React__default.createElement("div", null, getValueFromLegendTitle((_currentValues2 = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues2.title, "min"))), React__default.createElement(MapLegendValuesOther, null, "-")));
|
|
5120
|
-
};
|
|
5159
|
+
_this.on('change', _this.updateMeasureResult);
|
|
5121
5160
|
|
|
5122
|
-
|
|
5123
|
-
let {
|
|
5124
|
-
layer,
|
|
5125
|
-
config,
|
|
5126
|
-
className,
|
|
5127
|
-
hideTitle
|
|
5128
|
-
} = _ref;
|
|
5129
|
-
const legend = useMapLegend(layer, config);
|
|
5130
|
-
const [isExpanded, toggleExpanded] = useToggle();
|
|
5161
|
+
_this.on('edit', _this.updateMeasureResult);
|
|
5131
5162
|
|
|
5132
|
-
|
|
5133
|
-
return null;
|
|
5163
|
+
return _this;
|
|
5134
5164
|
}
|
|
5135
5165
|
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
return React__default.createElement(LegendProvider, {
|
|
5141
|
-
symbol: symbol
|
|
5142
|
-
}, React__default.createElement(MapLegendControl, {
|
|
5143
|
-
className: className
|
|
5144
|
-
}, !hideTitle && React__default.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), !!items.length && React__default.createElement(MapLegendContainer, null, isExpanded ? React__default.createElement(Legend, {
|
|
5145
|
-
layer: layer,
|
|
5146
|
-
config: config
|
|
5147
|
-
}) : React__default.createElement(React__default.Fragment, null, items.map(item => {
|
|
5148
|
-
var _symbol$fill;
|
|
5166
|
+
_createClass(BaseMeasureToolEditor, [{
|
|
5167
|
+
key: "_activate",
|
|
5168
|
+
value: function _activate() {
|
|
5169
|
+
_get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
|
|
5149
5170
|
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
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
|
+
}]);
|
|
5162
5207
|
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
let {
|
|
5166
|
-
value,
|
|
5167
|
-
parameter
|
|
5168
|
-
} = _ref;
|
|
5169
|
-
return React__default.createElement(LegendSymbol, {
|
|
5170
|
-
key: value.title,
|
|
5171
|
-
parameter: parameter,
|
|
5172
|
-
parameterValue: value.parameterValue
|
|
5173
|
-
}, symbol => React__default.createElement(Symbol, {
|
|
5174
|
-
render: getMapLegendSymbolRenders,
|
|
5175
|
-
symbol: symbol,
|
|
5176
|
-
size: MAX_SIZE$2
|
|
5177
|
-
}));
|
|
5178
|
-
};
|
|
5208
|
+
return BaseMeasureToolEditor;
|
|
5209
|
+
}(PolyEditor.PolyEditor);
|
|
5179
5210
|
|
|
5180
5211
|
let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
5181
5212
|
_inherits(MeasureTool, _React$Component);
|
|
@@ -5365,7 +5396,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
|
5365
5396
|
}(React__default.Component);
|
|
5366
5397
|
|
|
5367
5398
|
const _excluded$3 = ["isActive"];
|
|
5368
|
-
const Measurer = _ref => {
|
|
5399
|
+
const Measurer = (_ref) => {
|
|
5369
5400
|
let {
|
|
5370
5401
|
isActive
|
|
5371
5402
|
} = _ref,
|
|
@@ -5383,18 +5414,18 @@ const Measurer = _ref => {
|
|
|
5383
5414
|
|
|
5384
5415
|
var _templateObject$7, _templateObject2$7, _templateObject3$5;
|
|
5385
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"])));
|
|
5386
|
-
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) => {
|
|
5387
5418
|
let {
|
|
5388
5419
|
width
|
|
5389
5420
|
} = _ref;
|
|
5390
5421
|
return width + "px";
|
|
5391
5422
|
});
|
|
5392
|
-
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) => {
|
|
5393
5424
|
let {
|
|
5394
5425
|
alignEnd
|
|
5395
5426
|
} = _ref2;
|
|
5396
5427
|
return alignEnd ? 'flex-end' : 'center';
|
|
5397
|
-
}, _ref3 => {
|
|
5428
|
+
}, (_ref3) => {
|
|
5398
5429
|
let {
|
|
5399
5430
|
width
|
|
5400
5431
|
} = _ref3;
|
|
@@ -5419,7 +5450,7 @@ const ScaleRuler = () => {
|
|
|
5419
5450
|
}, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
|
|
5420
5451
|
};
|
|
5421
5452
|
|
|
5422
|
-
const Zoom = _ref => {
|
|
5453
|
+
const Zoom = (_ref) => {
|
|
5423
5454
|
let {
|
|
5424
5455
|
children
|
|
5425
5456
|
} = _ref;
|
|
@@ -5468,7 +5499,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
|
|
|
5468
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));
|
|
5469
5500
|
};
|
|
5470
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"])));
|
|
5471
|
-
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) => {
|
|
5472
5503
|
let {
|
|
5473
5504
|
placement,
|
|
5474
5505
|
distance = '0.5rem',
|
|
@@ -5476,7 +5507,7 @@ const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$2 ||
|
|
|
5476
5507
|
cornerSize = '0.25rem'
|
|
5477
5508
|
} = _ref;
|
|
5478
5509
|
return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
|
|
5479
|
-
}, _ref2 => {
|
|
5510
|
+
}, (_ref2) => {
|
|
5480
5511
|
let {
|
|
5481
5512
|
withArrow
|
|
5482
5513
|
} = _ref2;
|
|
@@ -5490,7 +5521,7 @@ const {
|
|
|
5490
5521
|
Consumer
|
|
5491
5522
|
} = /*#__PURE__*/React.createContext([]); // TODO I just cant read that
|
|
5492
5523
|
|
|
5493
|
-
const Tooltip = _ref => {
|
|
5524
|
+
const Tooltip = (_ref) => {
|
|
5494
5525
|
let {
|
|
5495
5526
|
features = [],
|
|
5496
5527
|
map,
|
|
@@ -5529,7 +5560,7 @@ const Noop = () => React__default.createElement("div", {
|
|
|
5529
5560
|
}
|
|
5530
5561
|
});
|
|
5531
5562
|
|
|
5532
|
-
const DraggableMarker = _ref => {
|
|
5563
|
+
const DraggableMarker = (_ref) => {
|
|
5533
5564
|
let {
|
|
5534
5565
|
position,
|
|
5535
5566
|
onChange,
|
|
@@ -5543,6 +5574,21 @@ const DraggableMarker = _ref => {
|
|
|
5543
5574
|
return React__default.createElement(React.Fragment, null);
|
|
5544
5575
|
};
|
|
5545
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
|
+
|
|
5546
5592
|
exports.ArrowLineMiterRender = ArrowLineMiterRender;
|
|
5547
5593
|
exports.BaseMeasureToolCreator = BaseMeasureToolCreator;
|
|
5548
5594
|
exports.BaseMeasureToolEditor = BaseMeasureToolEditor;
|