@evergis/react 2.0.101 → 2.0.102
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 +29 -29
- package/dist/hooks/useEvergisTileLayer.d.ts +1 -1
- package/dist/react.cjs.development.js +1533 -1539
- 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 +1534 -1540
- package/dist/react.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -26,10 +26,6 @@ var PolylineSymbol = require('@evergis/sgis/es/symbols/PolylineSymbol');
|
|
|
26
26
|
var Poly = require('@evergis/sgis/es/renders/Poly');
|
|
27
27
|
var geotools = require('@evergis/sgis/es/geotools');
|
|
28
28
|
var math = require('@evergis/sgis/es/utils/math');
|
|
29
|
-
var PolylineControl = require('@evergis/sgis/es/controls/PolylineControl');
|
|
30
|
-
var Label = require('@evergis/sgis/es/features/Label');
|
|
31
|
-
var Control = require('@evergis/sgis/es/controls/Control');
|
|
32
|
-
var PolyEditor = require('@evergis/sgis/es/controls/PolyEditor');
|
|
33
29
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
34
30
|
var _Symbol = require('@evergis/sgis/es/symbols/Symbol');
|
|
35
31
|
var Poly$1 = require('@evergis/sgis/es/features/Poly');
|
|
@@ -42,6 +38,7 @@ var Square = require('@evergis/sgis/es/symbols/point/Square');
|
|
|
42
38
|
var MaskedImage = require('@evergis/sgis/es/symbols/point/MaskedImage');
|
|
43
39
|
var Canvas = require('@evergis/sgis/es/painters/DomPainter/Canvas');
|
|
44
40
|
var commonEvents = require('@evergis/sgis/es/commonEvents');
|
|
41
|
+
var Label = require('@evergis/sgis/es/features/Label');
|
|
45
42
|
var ClusterLayer$1 = require('@evergis/sgis/es/layers/ClusterLayer');
|
|
46
43
|
var GridClusterProvider = require('@evergis/sgis/es/layers/clusterProviders/GridClusterProvider');
|
|
47
44
|
var PointEditor = require('@evergis/sgis/es/controls/PointEditor');
|
|
@@ -51,6 +48,9 @@ var styled__default = _interopDefault(styled);
|
|
|
51
48
|
var ui = require('@evergis/ui');
|
|
52
49
|
var punycode = _interopDefault(require('punycode'));
|
|
53
50
|
var TileLayer$1 = require('@evergis/sgis/es/layers/TileLayer');
|
|
51
|
+
var PolylineControl = require('@evergis/sgis/es/controls/PolylineControl');
|
|
52
|
+
var Control = require('@evergis/sgis/es/controls/Control');
|
|
53
|
+
var PolyEditor = require('@evergis/sgis/es/controls/PolyEditor');
|
|
54
54
|
|
|
55
55
|
function _classCallCheck(instance, Constructor) {
|
|
56
56
|
if (!(instance instanceof Constructor)) {
|
|
@@ -71,9 +71,6 @@ function _defineProperties(target, props) {
|
|
|
71
71
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
72
72
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
73
73
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
74
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
75
|
-
writable: false
|
|
76
|
-
});
|
|
77
74
|
return Constructor;
|
|
78
75
|
}
|
|
79
76
|
|
|
@@ -107,9 +104,6 @@ function _inherits(subClass, superClass) {
|
|
|
107
104
|
configurable: true
|
|
108
105
|
}
|
|
109
106
|
});
|
|
110
|
-
Object.defineProperty(subClass, "prototype", {
|
|
111
|
-
writable: false
|
|
112
|
-
});
|
|
113
107
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
114
108
|
}
|
|
115
109
|
|
|
@@ -168,8 +162,6 @@ function _assertThisInitialized(self) {
|
|
|
168
162
|
function _possibleConstructorReturn(self, call) {
|
|
169
163
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
170
164
|
return call;
|
|
171
|
-
} else if (call !== void 0) {
|
|
172
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
173
165
|
}
|
|
174
166
|
|
|
175
167
|
return _assertThisInitialized(self);
|
|
@@ -203,7 +195,7 @@ function _superPropBase(object, property) {
|
|
|
203
195
|
return object;
|
|
204
196
|
}
|
|
205
197
|
|
|
206
|
-
function _get() {
|
|
198
|
+
function _get(target, property, receiver) {
|
|
207
199
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
208
200
|
_get = Reflect.get;
|
|
209
201
|
} else {
|
|
@@ -214,14 +206,14 @@ function _get() {
|
|
|
214
206
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
215
207
|
|
|
216
208
|
if (desc.get) {
|
|
217
|
-
return desc.get.call(
|
|
209
|
+
return desc.get.call(receiver);
|
|
218
210
|
}
|
|
219
211
|
|
|
220
212
|
return desc.value;
|
|
221
213
|
};
|
|
222
214
|
}
|
|
223
215
|
|
|
224
|
-
return _get
|
|
216
|
+
return _get(target, property, receiver || target);
|
|
225
217
|
}
|
|
226
218
|
|
|
227
219
|
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
@@ -250,7 +242,7 @@ const defaultApi = /*#__PURE__*/new api.Api({
|
|
|
250
242
|
url: BASE_URL
|
|
251
243
|
});
|
|
252
244
|
const evergisContext = /*#__PURE__*/React.createContext(defaultApi);
|
|
253
|
-
const EvergisProvider = _ref => {
|
|
245
|
+
const EvergisProvider = (_ref) => {
|
|
254
246
|
let {
|
|
255
247
|
api,
|
|
256
248
|
children
|
|
@@ -268,7 +260,7 @@ const mapContext = /*#__PURE__*/React.createContext({
|
|
|
268
260
|
map: defaultMap,
|
|
269
261
|
painter: defaultPainter
|
|
270
262
|
});
|
|
271
|
-
const MapProvider = _ref => {
|
|
263
|
+
const MapProvider = (_ref) => {
|
|
272
264
|
let {
|
|
273
265
|
map,
|
|
274
266
|
painter,
|
|
@@ -290,7 +282,7 @@ const tooltipContext = /*#__PURE__*/React.createContext({
|
|
|
290
282
|
layer: defaultLayer,
|
|
291
283
|
popupLayer: defaultPopupLayer
|
|
292
284
|
});
|
|
293
|
-
const TooltipProvider = _ref => {
|
|
285
|
+
const TooltipProvider = (_ref) => {
|
|
294
286
|
let {
|
|
295
287
|
layer,
|
|
296
288
|
popupLayer,
|
|
@@ -307,7 +299,7 @@ const TooltipProvider = _ref => {
|
|
|
307
299
|
const useTooltipContext = () => React.useContext(tooltipContext);
|
|
308
300
|
|
|
309
301
|
const LegendContext = /*#__PURE__*/React.createContext(null);
|
|
310
|
-
const LegendProvider = _ref => {
|
|
302
|
+
const LegendProvider = (_ref) => {
|
|
311
303
|
let {
|
|
312
304
|
symbol,
|
|
313
305
|
children
|
|
@@ -319,7 +311,7 @@ const LegendProvider = _ref => {
|
|
|
319
311
|
const useLegendContext = () => React.useContext(LegendContext);
|
|
320
312
|
|
|
321
313
|
const evergisSelectContext = /*#__PURE__*/React.createContext([]);
|
|
322
|
-
const EvergisSelectProvider = _ref => {
|
|
314
|
+
const EvergisSelectProvider = (_ref) => {
|
|
323
315
|
let {
|
|
324
316
|
layers,
|
|
325
317
|
children
|
|
@@ -364,7 +356,7 @@ function useMapViewActions() {
|
|
|
364
356
|
}, [map]);
|
|
365
357
|
const zoomIn = React.useCallback(() => zoomTo(1), [zoomTo]);
|
|
366
358
|
const zoomOut = React.useCallback(() => zoomTo(-1), [zoomTo]);
|
|
367
|
-
const animateTo = React.useCallback(_ref => {
|
|
359
|
+
const animateTo = React.useCallback((_ref) => {
|
|
368
360
|
let {
|
|
369
361
|
position,
|
|
370
362
|
resolution,
|
|
@@ -394,7 +386,7 @@ function useMapViewActions() {
|
|
|
394
386
|
const {
|
|
395
387
|
tileScheme
|
|
396
388
|
} = map;
|
|
397
|
-
let tileLevel = tileScheme.levels.find(_ref2 => {
|
|
389
|
+
let tileLevel = tileScheme.levels.find((_ref2) => {
|
|
398
390
|
let {
|
|
399
391
|
zIndex
|
|
400
392
|
} = _ref2;
|
|
@@ -570,7 +562,7 @@ const formatStringAttribute = value => {
|
|
|
570
562
|
|
|
571
563
|
const attributeValues = value.split(/[\s|]/).map(convertStringAttribute);
|
|
572
564
|
|
|
573
|
-
if (attributeValues.every(_ref => {
|
|
565
|
+
if (attributeValues.every((_ref) => {
|
|
574
566
|
let {
|
|
575
567
|
type
|
|
576
568
|
} = _ref;
|
|
@@ -578,7 +570,7 @@ const formatStringAttribute = value => {
|
|
|
578
570
|
}
|
|
579
571
|
/* String */
|
|
580
572
|
)) {
|
|
581
|
-
return [stringAttribute(attributeValues.map(_ref2 => {
|
|
573
|
+
return [stringAttribute(attributeValues.map((_ref2) => {
|
|
582
574
|
let {
|
|
583
575
|
value
|
|
584
576
|
} = _ref2;
|
|
@@ -1055,7 +1047,7 @@ const getFeatureAttributeType = attributeValue => {
|
|
|
1055
1047
|
};
|
|
1056
1048
|
const getLayerAttributes = layerDefinition => {
|
|
1057
1049
|
const attributes = layerDefinition && layerDefinition.attributes || {};
|
|
1058
|
-
return Object.entries(attributes).map(_ref => {
|
|
1050
|
+
return Object.entries(attributes).map((_ref) => {
|
|
1059
1051
|
let [name, definition] = _ref;
|
|
1060
1052
|
return _extends({
|
|
1061
1053
|
name
|
|
@@ -1063,7 +1055,7 @@ const getLayerAttributes = layerDefinition => {
|
|
|
1063
1055
|
});
|
|
1064
1056
|
};
|
|
1065
1057
|
const getFeatureAttributes = attributes => {
|
|
1066
|
-
return attributes ? Object.entries(attributes).map(_ref2 => {
|
|
1058
|
+
return attributes ? Object.entries(attributes).map((_ref2) => {
|
|
1067
1059
|
let [name, value] = _ref2;
|
|
1068
1060
|
return {
|
|
1069
1061
|
name,
|
|
@@ -1081,7 +1073,7 @@ const getClassificationAttribute = (attributeName, attributes) => {
|
|
|
1081
1073
|
return attribute ? _extends({}, attrNamePart, attribute) : attrNamePart;
|
|
1082
1074
|
};
|
|
1083
1075
|
const mergeAttributes = (attributes1, attributes2) => {
|
|
1084
|
-
return attributes1.map(attribute => _extends({}, attribute, attributes2.find(_ref3 => {
|
|
1076
|
+
return attributes1.map(attribute => _extends({}, attribute, attributes2.find((_ref3) => {
|
|
1085
1077
|
let {
|
|
1086
1078
|
name
|
|
1087
1079
|
} = _ref3;
|
|
@@ -1496,7 +1488,7 @@ let SGisPolygonSymbol = /*#__PURE__*/function (_sPolygonSymbol) {
|
|
|
1496
1488
|
const adaptMiterRings = (rings, resolution, fromCrs, toCrs) => {
|
|
1497
1489
|
const projected = geotools.projectRings(rings, fromCrs, toCrs);
|
|
1498
1490
|
return math.simplifyCoordinates(projected.map(ring => // @ts-ignore
|
|
1499
|
-
ring.map(_ref => {
|
|
1491
|
+
ring.map((_ref) => {
|
|
1500
1492
|
let [x, y] = _ref;
|
|
1501
1493
|
return [x / resolution, y / -resolution];
|
|
1502
1494
|
})), 1);
|
|
@@ -1588,1518 +1580,1178 @@ let ArrowLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
|
1588
1580
|
return ArrowLineMiterRender;
|
|
1589
1581
|
}(LineMiterRender);
|
|
1590
1582
|
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
length: formatLength
|
|
1594
|
-
};
|
|
1595
|
-
|
|
1596
|
-
const COORD_FRACTION = 6;
|
|
1597
|
-
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
1598
|
-
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
1599
|
-
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
1600
|
-
|
|
1601
|
-
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
1583
|
+
let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1584
|
+
_inherits(CircleLineMiterRender, _LineMiterRender);
|
|
1602
1585
|
|
|
1603
|
-
|
|
1604
|
-
var _this;
|
|
1586
|
+
var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
|
|
1605
1587
|
|
|
1606
|
-
|
|
1588
|
+
function CircleLineMiterRender() {
|
|
1589
|
+
_classCallCheck(this, CircleLineMiterRender);
|
|
1607
1590
|
|
|
1608
|
-
|
|
1591
|
+
return _super.apply(this, arguments);
|
|
1592
|
+
}
|
|
1609
1593
|
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1594
|
+
_createClass(CircleLineMiterRender, [{
|
|
1595
|
+
key: "usageSize",
|
|
1596
|
+
get: function get() {
|
|
1597
|
+
return this.miterSize + this.strokeWidth * 3;
|
|
1598
|
+
}
|
|
1599
|
+
}, {
|
|
1600
|
+
key: "createRings",
|
|
1601
|
+
value: function createRings(_ref, xMultiplier) {
|
|
1602
|
+
let [x, y] = _ref;
|
|
1603
|
+
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1604
|
+
}
|
|
1605
|
+
}, {
|
|
1606
|
+
key: "createRender",
|
|
1607
|
+
value: function createRender(miterRings) {
|
|
1608
|
+
const isFilled = this.kind === exports.LineMiterKind.FilledCircle;
|
|
1609
|
+
return new Poly.PolyRender(polygonCircleFromPoint(miterRings[0][0], this.miterSize), {
|
|
1610
|
+
fillColor: isFilled ? this.color : 'transparent',
|
|
1611
|
+
strokeColor: this.color,
|
|
1612
|
+
strokeWidth: this.strokeWidth,
|
|
1613
|
+
enclosed: true
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
}]);
|
|
1613
1617
|
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1617
|
-
_this.areaSymbol = params.areaSymbol;
|
|
1618
|
+
return CircleLineMiterRender;
|
|
1619
|
+
}(LineMiterRender);
|
|
1618
1620
|
|
|
1619
|
-
|
|
1621
|
+
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1622
|
+
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1620
1623
|
|
|
1624
|
+
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1621
1625
|
|
|
1622
|
-
|
|
1626
|
+
function SquareLineMiterRender() {
|
|
1627
|
+
_classCallCheck(this, SquareLineMiterRender);
|
|
1623
1628
|
|
|
1624
|
-
return
|
|
1629
|
+
return _super.apply(this, arguments);
|
|
1625
1630
|
}
|
|
1626
1631
|
|
|
1627
|
-
_createClass(
|
|
1628
|
-
key: "
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
this.drawPointOnMouseMove(event);
|
|
1632
|
+
_createClass(SquareLineMiterRender, [{
|
|
1633
|
+
key: "usageSize",
|
|
1634
|
+
get: function get() {
|
|
1635
|
+
return this.miterSize + this.strokeWidth;
|
|
1633
1636
|
}
|
|
1634
1637
|
}, {
|
|
1635
|
-
key: "
|
|
1636
|
-
value: function
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
this.addTempLabel();
|
|
1640
|
-
this.setCursor('pointer');
|
|
1638
|
+
key: "createRings",
|
|
1639
|
+
value: function createRings(_ref, xMultiplier) {
|
|
1640
|
+
let [x, y] = _ref;
|
|
1641
|
+
return [[[x, y + this.miterSize / 2], [x, y - this.miterSize / 2], [x + this.miterSize * xMultiplier, y - this.miterSize / 2], [x + this.miterSize * xMultiplier, y + this.miterSize / 2]]];
|
|
1641
1642
|
}
|
|
1642
1643
|
}, {
|
|
1643
|
-
key: "
|
|
1644
|
-
value: function
|
|
1645
|
-
|
|
1644
|
+
key: "createRender",
|
|
1645
|
+
value: function createRender(miterRings) {
|
|
1646
|
+
const isFilled = this.kind === exports.LineMiterKind.FilledSquare;
|
|
1647
|
+
return new Poly.PolyRender(miterRings, {
|
|
1648
|
+
enclosed: true,
|
|
1649
|
+
fillColor: isFilled ? this.color : void 0,
|
|
1650
|
+
fillStyle: isFilled ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
1651
|
+
lineCap: 'square',
|
|
1652
|
+
lineJoin: 'miter',
|
|
1653
|
+
strokeColor: this.color,
|
|
1654
|
+
strokeWidth: this.strokeWidth
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
}]);
|
|
1646
1658
|
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1659
|
+
return SquareLineMiterRender;
|
|
1660
|
+
}(LineMiterRender);
|
|
1661
|
+
|
|
1662
|
+
const getLineMiterRender = options => {
|
|
1663
|
+
switch (options.kind) {
|
|
1664
|
+
case exports.LineMiterKind.Arrow:
|
|
1665
|
+
case exports.LineMiterKind.FilledArrow:
|
|
1666
|
+
return new ArrowLineMiterRender(options);
|
|
1667
|
+
|
|
1668
|
+
case exports.LineMiterKind.Square:
|
|
1669
|
+
case exports.LineMiterKind.FilledSquare:
|
|
1670
|
+
return new SquareLineMiterRender(options);
|
|
1671
|
+
|
|
1672
|
+
case exports.LineMiterKind.Circle:
|
|
1673
|
+
case exports.LineMiterKind.FilledCircle:
|
|
1674
|
+
return new CircleLineMiterRender(options);
|
|
1675
|
+
|
|
1676
|
+
default:
|
|
1677
|
+
return null;
|
|
1678
|
+
}
|
|
1679
|
+
};
|
|
1680
|
+
|
|
1681
|
+
const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
|
|
1682
|
+
const reversedRing = ring.slice().reverse();
|
|
1683
|
+
|
|
1684
|
+
for (let i = 0; i < reversedRing.length; i++) {
|
|
1685
|
+
const coordinates = reversedRing[i];
|
|
1686
|
+
|
|
1687
|
+
if (isLastRing && i === 0) {
|
|
1688
|
+
reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
|
|
1652
1689
|
}
|
|
1653
|
-
}, {
|
|
1654
|
-
key: "handlePointAdd",
|
|
1655
|
-
value: function handlePointAdd() {
|
|
1656
|
-
const feature = this.activeFeature;
|
|
1657
|
-
if (!feature) return;
|
|
1658
|
-
const {
|
|
1659
|
-
rings,
|
|
1660
|
-
crs
|
|
1661
|
-
} = feature;
|
|
1662
1690
|
|
|
1663
|
-
|
|
1664
|
-
this.finishDrawing();
|
|
1665
|
-
this.fire(new Control.DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
1666
|
-
return;
|
|
1667
|
-
}
|
|
1691
|
+
const nextCoordinates = reversedRing[i - 1];
|
|
1668
1692
|
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
const point = rings[0][0];
|
|
1672
|
-
if (!projection) return;
|
|
1673
|
-
const [lat, long] = projection(point);
|
|
1674
|
-
this.removeTempLabel();
|
|
1675
|
-
this.addMeasureResultLabel();
|
|
1676
|
-
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
1677
|
-
} else {
|
|
1678
|
-
this.removeCoordLabel();
|
|
1679
|
-
}
|
|
1693
|
+
if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
|
|
1694
|
+
reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
|
|
1680
1695
|
}
|
|
1681
|
-
}
|
|
1682
|
-
key: "polygonPreview",
|
|
1683
|
-
value: function polygonPreview() {
|
|
1684
|
-
if (this.tempPolygon) {
|
|
1685
|
-
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
1686
|
-
}
|
|
1696
|
+
}
|
|
1687
1697
|
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
1700
|
-
this.activeFeature && this.activeFeature.hide();
|
|
1701
|
-
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
1698
|
+
return reversedRing.reverse();
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1701
|
+
const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
|
|
1702
|
+
const newRing = ring.slice();
|
|
1703
|
+
|
|
1704
|
+
for (let i = 0; i < newRing.length; i++) {
|
|
1705
|
+
const coordinates = newRing[i];
|
|
1706
|
+
|
|
1707
|
+
if (i === 0 && isFirstRing) {
|
|
1708
|
+
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
1702
1709
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
delete this.tempPolygon;
|
|
1709
|
-
}
|
|
1710
|
+
|
|
1711
|
+
const prevCoordinates = newRing[i - 1];
|
|
1712
|
+
|
|
1713
|
+
if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
|
|
1714
|
+
newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
|
|
1710
1715
|
}
|
|
1711
|
-
}
|
|
1712
|
-
key: "updateDistance",
|
|
1713
|
-
value: function updateDistance(event) {
|
|
1714
|
-
const feature = this.activeFeature;
|
|
1715
|
-
const {
|
|
1716
|
-
ringIndex,
|
|
1717
|
-
pointIndex
|
|
1718
|
-
} = event;
|
|
1719
|
-
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
1720
|
-
const {
|
|
1721
|
-
rings,
|
|
1722
|
-
crs
|
|
1723
|
-
} = feature;
|
|
1724
|
-
const position = rings[ringIndex][pointIndex];
|
|
1725
|
-
const length = geotools.length(rings, crs);
|
|
1726
|
-
let content = this.formatters.length(length);
|
|
1716
|
+
}
|
|
1727
1717
|
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
const area = geotools.area(rings, crs);
|
|
1731
|
-
content = this.formatters.polygon(area, length);
|
|
1732
|
-
} else if (this.tempPolygon) {
|
|
1733
|
-
feature.show();
|
|
1734
|
-
this.removeTempPolygon();
|
|
1735
|
-
}
|
|
1718
|
+
return newRing;
|
|
1719
|
+
};
|
|
1736
1720
|
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1721
|
+
const updateRingsForMiter = (rings, position, miterSize) => {
|
|
1722
|
+
return rings.map((ring, ringIndex) => {
|
|
1723
|
+
switch (position) {
|
|
1724
|
+
case 'right':
|
|
1725
|
+
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
1726
|
+
|
|
1727
|
+
default:
|
|
1728
|
+
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
1741
1729
|
}
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1730
|
+
});
|
|
1731
|
+
};
|
|
1732
|
+
|
|
1733
|
+
const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
|
|
1734
|
+
let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
|
|
1735
|
+
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
1736
|
+
|
|
1737
|
+
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
1738
|
+
|
|
1739
|
+
function SGisPolylineSymbol(originalSymbol) {
|
|
1740
|
+
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
1741
|
+
|
|
1742
|
+
var _this;
|
|
1743
|
+
|
|
1744
|
+
_classCallCheck(this, SGisPolylineSymbol);
|
|
1745
|
+
|
|
1746
|
+
_this = _super.call(this, {
|
|
1747
|
+
// @ts-ignore
|
|
1748
|
+
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
1749
|
+
strokeWidth: clamp( // @ts-ignore
|
|
1750
|
+
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
1751
|
+
// @ts-ignore
|
|
1752
|
+
lineDash: getLineDash(originalSymbol.stroke),
|
|
1753
|
+
// @ts-ignore
|
|
1754
|
+
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
1755
|
+
});
|
|
1756
|
+
_this.originalSymbol = originalSymbol;
|
|
1757
|
+
return _this;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
_createClass(SGisPolylineSymbol, [{
|
|
1761
|
+
key: "renderFunction",
|
|
1762
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
1763
|
+
if (!isSimplePolylineSymbol(this.originalSymbol)) return _get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, feature, resolution, crs);
|
|
1764
|
+
const {
|
|
1765
|
+
ending,
|
|
1766
|
+
beginningSize,
|
|
1767
|
+
beginning,
|
|
1768
|
+
endingSize
|
|
1769
|
+
} = this.originalSymbol;
|
|
1770
|
+
const renders = [];
|
|
1771
|
+
const featureCopy = feature.clone();
|
|
1772
|
+
const beginningMiterRender = getLineMiterRender({
|
|
1773
|
+
color: this.strokeColor,
|
|
1774
|
+
// @ts-ignore
|
|
1775
|
+
kind: beginning,
|
|
1776
|
+
position: 'left',
|
|
1777
|
+
// @ts-ignore
|
|
1778
|
+
size: beginningSize,
|
|
1779
|
+
strokeWidth: this.strokeWidth
|
|
1764
1780
|
});
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
renderLabel: this.renderLabelSymbol
|
|
1774
|
-
})
|
|
1781
|
+
const endingMiterRender = getLineMiterRender({
|
|
1782
|
+
color: this.strokeColor,
|
|
1783
|
+
// @ts-ignore
|
|
1784
|
+
kind: ending,
|
|
1785
|
+
position: 'right',
|
|
1786
|
+
// @ts-ignore
|
|
1787
|
+
size: endingSize,
|
|
1788
|
+
strokeWidth: this.strokeWidth
|
|
1775
1789
|
});
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
1783
|
-
delete this.tempLabel;
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
}, {
|
|
1787
|
-
key: "removeCoordLabel",
|
|
1788
|
-
value: function removeCoordLabel() {
|
|
1789
|
-
if (this.coordLabel) {
|
|
1790
|
-
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
1791
|
-
delete this.coordLabel;
|
|
1792
|
-
}
|
|
1793
|
-
}
|
|
1794
|
-
}, {
|
|
1795
|
-
key: "removeMeasureLabel",
|
|
1796
|
-
value: function removeMeasureLabel() {
|
|
1797
|
-
if (this.measureResultLabel) {
|
|
1798
|
-
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
1799
|
-
delete this.measureResultLabel;
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
}, {
|
|
1803
|
-
key: "drawPointOnMouseMove",
|
|
1804
|
-
value: function drawPointOnMouseMove(event) {
|
|
1805
|
-
if (this.tempLabel) {
|
|
1806
|
-
this.tempLabel.position = event.point.position;
|
|
1790
|
+
|
|
1791
|
+
if (beginningMiterRender) {
|
|
1792
|
+
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
1793
|
+
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
1794
|
+
featureCopy.rings = updatedRings;
|
|
1795
|
+
renders.push(render);
|
|
1807
1796
|
}
|
|
1797
|
+
|
|
1798
|
+
if (endingMiterRender) {
|
|
1799
|
+
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
1800
|
+
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
1801
|
+
featureCopy.rings = updatedRings;
|
|
1802
|
+
renders.push(render);
|
|
1803
|
+
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
1804
|
+
|
|
1805
|
+
|
|
1806
|
+
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
1807
|
+
return renders;
|
|
1808
1808
|
}
|
|
1809
1809
|
}, {
|
|
1810
|
-
key: "
|
|
1811
|
-
value: function
|
|
1812
|
-
|
|
1813
|
-
wrapper
|
|
1814
|
-
} = this.painter;
|
|
1815
|
-
|
|
1816
|
-
if (wrapper && typeof wrapper !== 'string') {
|
|
1817
|
-
wrapper.style.cursor = cursor;
|
|
1818
|
-
}
|
|
1810
|
+
key: "clone",
|
|
1811
|
+
value: function clone() {
|
|
1812
|
+
return new SGisPolylineSymbol(this.originalSymbol);
|
|
1819
1813
|
}
|
|
1820
1814
|
}]);
|
|
1821
1815
|
|
|
1822
|
-
return
|
|
1823
|
-
}(
|
|
1816
|
+
return SGisPolylineSymbol;
|
|
1817
|
+
}(PolylineSymbol.PolylineSymbol);
|
|
1824
1818
|
|
|
1825
|
-
let
|
|
1826
|
-
_inherits(
|
|
1819
|
+
let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
|
|
1820
|
+
_inherits(LabelSymbol, _DynamicPointSymbol);
|
|
1827
1821
|
|
|
1828
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
1822
|
+
var _super = /*#__PURE__*/_createSuper(LabelSymbol);
|
|
1829
1823
|
|
|
1830
|
-
function
|
|
1824
|
+
function LabelSymbol(_temp) {
|
|
1831
1825
|
var _this;
|
|
1832
1826
|
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
_this.measureResult = () => {
|
|
1838
|
-
const feature = _this.activeFeature;
|
|
1839
|
-
if (!feature) return null;
|
|
1840
|
-
const {
|
|
1841
|
-
rings,
|
|
1842
|
-
isEnclosed,
|
|
1843
|
-
crs
|
|
1844
|
-
} = feature;
|
|
1845
|
-
const pointsCount = rings[0].length;
|
|
1846
|
-
const position = rings[0][pointsCount - 1];
|
|
1847
|
-
const area = geotools.area(rings, crs);
|
|
1848
|
-
const length = geotools.length(rings, crs, isEnclosed);
|
|
1849
|
-
const content = isEnclosed ? _this.formatters.polygon(area, length) : _this.formatters.length(length);
|
|
1850
|
-
return {
|
|
1851
|
-
content,
|
|
1852
|
-
position
|
|
1853
|
-
};
|
|
1854
|
-
};
|
|
1855
|
-
|
|
1856
|
-
_this.removeFeature = () => {
|
|
1857
|
-
_this.fire('remove');
|
|
1858
|
-
};
|
|
1859
|
-
|
|
1860
|
-
_this.painter = painter;
|
|
1861
|
-
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
1862
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1863
|
-
|
|
1864
|
-
_this.on('change', _this.updateMeasureResult);
|
|
1827
|
+
let {
|
|
1828
|
+
component,
|
|
1829
|
+
offset
|
|
1830
|
+
} = _temp === void 0 ? {} : _temp;
|
|
1865
1831
|
|
|
1866
|
-
|
|
1832
|
+
_classCallCheck(this, LabelSymbol);
|
|
1867
1833
|
|
|
1834
|
+
_this = _super.call(this, {
|
|
1835
|
+
offset
|
|
1836
|
+
});
|
|
1837
|
+
_this.component = component;
|
|
1868
1838
|
return _this;
|
|
1869
1839
|
}
|
|
1870
1840
|
|
|
1871
|
-
_createClass(
|
|
1872
|
-
key: "
|
|
1873
|
-
value: function
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1841
|
+
_createClass(LabelSymbol, [{
|
|
1842
|
+
key: "_getFeatureNode",
|
|
1843
|
+
value: function _getFeatureNode(feature) {
|
|
1844
|
+
const node = document.createElement('div');
|
|
1845
|
+
this.renderDom(feature.content, node);
|
|
1846
|
+
return node;
|
|
1877
1847
|
}
|
|
1878
1848
|
}, {
|
|
1879
|
-
key: "
|
|
1880
|
-
value: function
|
|
1881
|
-
|
|
1882
|
-
if (measureResult === null) return;
|
|
1883
|
-
const {
|
|
1884
|
-
content,
|
|
1885
|
-
position
|
|
1886
|
-
} = measureResult;
|
|
1887
|
-
this.measureResultLabel = new Label.LabelFeature(position, {
|
|
1888
|
-
content,
|
|
1889
|
-
crs: this.map.crs,
|
|
1890
|
-
symbol: createLabelSymbol({
|
|
1891
|
-
onClose: this.removeFeature,
|
|
1892
|
-
renderLabel: this.renderLabelSymbol
|
|
1893
|
-
})
|
|
1894
|
-
});
|
|
1895
|
-
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
1849
|
+
key: "_updateFeatureNode",
|
|
1850
|
+
value: function _updateFeatureNode(feature) {
|
|
1851
|
+
this.renderDom(feature.content, this.getNode(feature));
|
|
1896
1852
|
}
|
|
1897
1853
|
}, {
|
|
1898
|
-
key: "
|
|
1899
|
-
value: function
|
|
1900
|
-
if (
|
|
1901
|
-
|
|
1902
|
-
if (measureResult === null) return;
|
|
1903
|
-
const {
|
|
1904
|
-
content,
|
|
1905
|
-
position
|
|
1906
|
-
} = measureResult;
|
|
1907
|
-
this.measureResultLabel.content = content;
|
|
1908
|
-
this.measureResultLabel.position = position;
|
|
1854
|
+
key: "renderDom",
|
|
1855
|
+
value: function renderDom(content, node) {
|
|
1856
|
+
if (!node) {
|
|
1857
|
+
return;
|
|
1909
1858
|
}
|
|
1910
|
-
}
|
|
1911
|
-
}]);
|
|
1912
1859
|
|
|
1913
|
-
|
|
1914
|
-
}(PolyEditor.PolyEditor);
|
|
1860
|
+
const Component = this.component;
|
|
1915
1861
|
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
|
|
1926
|
-
const widthDistance = geotools.distance(zeroPoint, maxWidthPoint);
|
|
1927
|
-
const pxK = width / (widthDistance || 1);
|
|
1928
|
-
return Math.round(meters * pxK);
|
|
1929
|
-
};
|
|
1930
|
-
|
|
1931
|
-
const polygonCircleFromPoint = (center, diameter) => {
|
|
1932
|
-
const coordinates = [];
|
|
1933
|
-
const radius = diameter / 2;
|
|
1934
|
-
const endAngle = Math.PI * 2;
|
|
1935
|
-
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
1936
|
-
let start = 0;
|
|
1937
|
-
let end = endAngle;
|
|
1862
|
+
if (Component) {
|
|
1863
|
+
ReactDOM.render(React__default.createElement(Component, {
|
|
1864
|
+
content: content
|
|
1865
|
+
}), node);
|
|
1866
|
+
} else {
|
|
1867
|
+
node.innerText = content;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
}]);
|
|
1938
1871
|
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
}
|
|
1872
|
+
return LabelSymbol;
|
|
1873
|
+
}(_Symbol.DynamicPointSymbol);
|
|
1942
1874
|
|
|
1943
|
-
|
|
1875
|
+
const defaultOffset = [8, -16];
|
|
1876
|
+
const createLabelSymbol = props => {
|
|
1877
|
+
const {
|
|
1878
|
+
offset = defaultOffset,
|
|
1879
|
+
renderLabel = (_ref) => {
|
|
1880
|
+
let {
|
|
1881
|
+
content
|
|
1882
|
+
} = _ref;
|
|
1883
|
+
return React__default.createElement("div", null, content);
|
|
1884
|
+
},
|
|
1885
|
+
onClose = undefined
|
|
1886
|
+
} = props || {};
|
|
1887
|
+
return new LabelSymbol({
|
|
1888
|
+
offset,
|
|
1889
|
+
component: (_ref2) => {
|
|
1890
|
+
let {
|
|
1891
|
+
content
|
|
1892
|
+
} = _ref2;
|
|
1893
|
+
return renderLabel({
|
|
1894
|
+
content,
|
|
1895
|
+
onClose
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
});
|
|
1944
1899
|
};
|
|
1945
1900
|
|
|
1946
|
-
|
|
1947
|
-
|
|
1901
|
+
function createShadowRender(position, _ref) {
|
|
1902
|
+
let {
|
|
1903
|
+
strokeWidth = 2,
|
|
1904
|
+
shadowColor,
|
|
1905
|
+
shadowSize,
|
|
1906
|
+
size = 6
|
|
1907
|
+
} = _ref;
|
|
1908
|
+
const shadowDiameter = size + strokeWidth + shadowSize;
|
|
1909
|
+
return new Poly.PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
|
|
1910
|
+
fillColor: 'transparent',
|
|
1911
|
+
strokeColor: shadowColor,
|
|
1912
|
+
strokeWidth: shadowSize,
|
|
1913
|
+
enclosed: true
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
function getEditorPointRenderer(position, _ref2) {
|
|
1917
|
+
let {
|
|
1918
|
+
strokeColor,
|
|
1919
|
+
strokeWidth,
|
|
1920
|
+
shadowColor,
|
|
1921
|
+
fillColor,
|
|
1922
|
+
shadowSize,
|
|
1923
|
+
size = 0
|
|
1924
|
+
} = _ref2;
|
|
1925
|
+
return [createShadowRender(position, {
|
|
1926
|
+
strokeWidth,
|
|
1927
|
+
strokeColor,
|
|
1928
|
+
shadowSize,
|
|
1929
|
+
shadowColor,
|
|
1930
|
+
size
|
|
1931
|
+
}), new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
1932
|
+
fillColor,
|
|
1933
|
+
strokeColor,
|
|
1934
|
+
strokeWidth,
|
|
1935
|
+
enclosed: true
|
|
1936
|
+
})];
|
|
1937
|
+
}
|
|
1948
1938
|
|
|
1949
|
-
|
|
1939
|
+
let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
|
|
1940
|
+
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
1950
1941
|
|
|
1951
|
-
|
|
1952
|
-
_classCallCheck(this, CircleLineMiterRender);
|
|
1942
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
|
|
1953
1943
|
|
|
1954
|
-
|
|
1944
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
1945
|
+
function ShadowedPointSymbol(options) {
|
|
1946
|
+
_classCallCheck(this, ShadowedPointSymbol);
|
|
1947
|
+
|
|
1948
|
+
return _super.call(this, options);
|
|
1955
1949
|
}
|
|
1956
1950
|
|
|
1957
|
-
_createClass(
|
|
1958
|
-
key: "
|
|
1959
|
-
|
|
1960
|
-
|
|
1951
|
+
_createClass(ShadowedPointSymbol, [{
|
|
1952
|
+
key: "renderFunction",
|
|
1953
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
1954
|
+
if (!(feature instanceof PointFeature.PointFeature)) return [];
|
|
1955
|
+
const {
|
|
1956
|
+
position
|
|
1957
|
+
} = feature.projectTo(crs);
|
|
1958
|
+
const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
|
|
1959
|
+
const shadowRender = this.getShadow(pxPosition, feature);
|
|
1960
|
+
const pointArc = this.getPoint(pxPosition, feature);
|
|
1961
|
+
return shadowRender ? [shadowRender, pointArc] : [pointArc];
|
|
1961
1962
|
}
|
|
1962
1963
|
}, {
|
|
1963
|
-
key: "
|
|
1964
|
-
value: function
|
|
1965
|
-
|
|
1966
|
-
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1964
|
+
key: "getShadow",
|
|
1965
|
+
value: function getShadow(position, _feature) {
|
|
1966
|
+
return ShadowedPointSymbol.getShadowArc(position, this);
|
|
1967
1967
|
}
|
|
1968
1968
|
}, {
|
|
1969
|
-
key: "
|
|
1970
|
-
value: function
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1969
|
+
key: "getPoint",
|
|
1970
|
+
value: function getPoint(position, _feature) {
|
|
1971
|
+
return ShadowedPointSymbol.getPointArc(position, this);
|
|
1972
|
+
}
|
|
1973
|
+
}], [{
|
|
1974
|
+
key: "getShadowArc",
|
|
1975
|
+
value: function getShadowArc(position, _ref) {
|
|
1976
|
+
let {
|
|
1977
|
+
strokeWidth = 2,
|
|
1978
|
+
shadowColor,
|
|
1979
|
+
shadowSize,
|
|
1980
|
+
size = 6
|
|
1981
|
+
} = _ref;
|
|
1982
|
+
return new Poly.PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
|
|
1983
|
+
fillColor: 'transparent',
|
|
1984
|
+
strokeColor: shadowColor,
|
|
1985
|
+
strokeWidth: shadowSize,
|
|
1976
1986
|
enclosed: true
|
|
1977
1987
|
});
|
|
1978
1988
|
}
|
|
1979
|
-
}]);
|
|
1980
|
-
|
|
1981
|
-
return CircleLineMiterRender;
|
|
1982
|
-
}(LineMiterRender);
|
|
1983
|
-
|
|
1984
|
-
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1985
|
-
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1986
|
-
|
|
1987
|
-
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1988
|
-
|
|
1989
|
-
function SquareLineMiterRender() {
|
|
1990
|
-
_classCallCheck(this, SquareLineMiterRender);
|
|
1991
|
-
|
|
1992
|
-
return _super.apply(this, arguments);
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
_createClass(SquareLineMiterRender, [{
|
|
1996
|
-
key: "usageSize",
|
|
1997
|
-
get: function get() {
|
|
1998
|
-
return this.miterSize + this.strokeWidth;
|
|
1999
|
-
}
|
|
2000
1989
|
}, {
|
|
2001
|
-
key: "
|
|
2002
|
-
value: function
|
|
2003
|
-
let
|
|
2004
|
-
|
|
1990
|
+
key: "getPointArc",
|
|
1991
|
+
value: function getPointArc(position, _ref2) {
|
|
1992
|
+
let {
|
|
1993
|
+
strokeWidth,
|
|
1994
|
+
fillColor,
|
|
1995
|
+
strokeColor,
|
|
1996
|
+
size = 6
|
|
1997
|
+
} = _ref2;
|
|
1998
|
+
return new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
1999
|
+
fillColor,
|
|
2000
|
+
strokeColor,
|
|
2001
|
+
strokeWidth,
|
|
2002
|
+
enclosed: true
|
|
2003
|
+
});
|
|
2005
2004
|
}
|
|
2006
2005
|
}, {
|
|
2007
|
-
key: "
|
|
2008
|
-
value: function
|
|
2009
|
-
const
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
fillColor: isFilled ? this.color : void 0,
|
|
2013
|
-
fillStyle: isFilled ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
2014
|
-
lineCap: 'square',
|
|
2015
|
-
lineJoin: 'miter',
|
|
2016
|
-
strokeColor: this.color,
|
|
2017
|
-
strokeWidth: this.strokeWidth
|
|
2018
|
-
});
|
|
2006
|
+
key: "getArcs",
|
|
2007
|
+
value: function getArcs(position, params) {
|
|
2008
|
+
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2009
|
+
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2010
|
+
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2019
2011
|
}
|
|
2020
2012
|
}]);
|
|
2021
2013
|
|
|
2022
|
-
return
|
|
2023
|
-
}(
|
|
2014
|
+
return ShadowedPointSymbol;
|
|
2015
|
+
}(Point.PointSymbol);
|
|
2024
2016
|
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
case exports.LineMiterKind.Arrow:
|
|
2028
|
-
case exports.LineMiterKind.FilledArrow:
|
|
2029
|
-
return new ArrowLineMiterRender(options);
|
|
2017
|
+
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2018
|
+
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2030
2019
|
|
|
2031
|
-
|
|
2032
|
-
case exports.LineMiterKind.FilledSquare:
|
|
2033
|
-
return new SquareLineMiterRender(options);
|
|
2020
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2034
2021
|
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2022
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2023
|
+
function ShadowedPolySymbol(options) {
|
|
2024
|
+
_classCallCheck(this, ShadowedPolySymbol);
|
|
2038
2025
|
|
|
2039
|
-
|
|
2040
|
-
return null;
|
|
2026
|
+
return _super.call(this, options);
|
|
2041
2027
|
}
|
|
2042
|
-
};
|
|
2043
2028
|
|
|
2044
|
-
|
|
2045
|
-
|
|
2029
|
+
_createClass(ShadowedPolySymbol, [{
|
|
2030
|
+
key: "renderFunction",
|
|
2031
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
2032
|
+
if (!(feature instanceof Poly$1.Poly)) return [];
|
|
2033
|
+
const coordinates = PolylineSymbol.PolylineSymbol.getRenderedCoordinates(feature, resolution, crs);
|
|
2034
|
+
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2035
|
+
const shadowRender = this.getShadow(coordinates, feature);
|
|
2036
|
+
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2037
|
+
let renders = [polyRender];
|
|
2046
2038
|
|
|
2047
|
-
|
|
2048
|
-
|
|
2039
|
+
if (shadowRender) {
|
|
2040
|
+
renders = [shadowRender, polyRender];
|
|
2041
|
+
}
|
|
2049
2042
|
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
const nextCoordinates = reversedRing[i - 1];
|
|
2043
|
+
if (vertexRenders) {
|
|
2044
|
+
renders = renders.concat(vertexRenders);
|
|
2045
|
+
}
|
|
2055
2046
|
|
|
2056
|
-
|
|
2057
|
-
reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
|
|
2047
|
+
return renders;
|
|
2058
2048
|
}
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
if (i === 0 && isFirstRing) {
|
|
2071
|
-
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
2049
|
+
}, {
|
|
2050
|
+
key: "getShadow",
|
|
2051
|
+
value: function getShadow(coordinates, _feature) {
|
|
2052
|
+
return new Poly.PolyRender(coordinates, {
|
|
2053
|
+
fillStyle: Poly.FillStyle.None,
|
|
2054
|
+
enclosed: this.enclose,
|
|
2055
|
+
strokeColor: this.shadowColor,
|
|
2056
|
+
strokeWidth: this.shadowSize,
|
|
2057
|
+
lineDash: this.lineDash
|
|
2058
|
+
});
|
|
2072
2059
|
}
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2060
|
+
}, {
|
|
2061
|
+
key: "getPolyRender",
|
|
2062
|
+
value: function getPolyRender(coordinates, _feature) {
|
|
2063
|
+
return new Poly.PolyRender(coordinates, {
|
|
2064
|
+
fillStyle: this.enclose ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
2065
|
+
enclosed: this.enclose,
|
|
2066
|
+
fillColor: this.fillColor,
|
|
2067
|
+
strokeColor: this.strokeColor,
|
|
2068
|
+
strokeWidth: this.strokeWidth,
|
|
2069
|
+
lineDash: this.lineDash
|
|
2070
|
+
});
|
|
2078
2071
|
}
|
|
2079
|
-
}
|
|
2072
|
+
}, {
|
|
2073
|
+
key: "getVertexRenders",
|
|
2074
|
+
value: function getVertexRenders(coordinates) {
|
|
2075
|
+
if (!this.showVertex) return;
|
|
2076
|
+
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2077
|
+
return acc.concat(curr);
|
|
2078
|
+
}, []);
|
|
2079
|
+
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2080
|
+
size: 6,
|
|
2081
|
+
strokeWidth: 2,
|
|
2082
|
+
shadowColor: this.shadowColor,
|
|
2083
|
+
strokeColor: this.strokeColor,
|
|
2084
|
+
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2085
|
+
fillColor: '#ffffff'
|
|
2086
|
+
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2087
|
+
}
|
|
2088
|
+
}]);
|
|
2080
2089
|
|
|
2081
|
-
return
|
|
2090
|
+
return ShadowedPolySymbol;
|
|
2091
|
+
}(PolylineSymbol.PolylineSymbol);
|
|
2092
|
+
const polySymbolParams = {
|
|
2093
|
+
strokeWidth: 2,
|
|
2094
|
+
strokeColor: '#e33600',
|
|
2095
|
+
shadowSize: 8,
|
|
2096
|
+
shadowColor: 'rgba(227, 54, 0, 0.3)'
|
|
2082
2097
|
};
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
case 'right':
|
|
2088
|
-
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
2089
|
-
|
|
2090
|
-
default:
|
|
2091
|
-
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
2092
|
-
}
|
|
2093
|
-
});
|
|
2098
|
+
const measureSymbolParams = {
|
|
2099
|
+
strokeColor: '#ff6933',
|
|
2100
|
+
shadowSize: 0,
|
|
2101
|
+
vertexShadowSize: 0
|
|
2094
2102
|
};
|
|
2103
|
+
const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2104
|
+
enclose: false,
|
|
2105
|
+
showVertex: true
|
|
2106
|
+
}));
|
|
2107
|
+
const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2108
|
+
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2109
|
+
enclose: true,
|
|
2110
|
+
showVertex: true
|
|
2111
|
+
}));
|
|
2112
|
+
const snapSymbolParams = {
|
|
2113
|
+
size: 10,
|
|
2114
|
+
strokeWidth: 2,
|
|
2115
|
+
strokeColor: '#e33600',
|
|
2116
|
+
fillColor: '#ffffff',
|
|
2117
|
+
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2118
|
+
shadowSize: 3
|
|
2119
|
+
};
|
|
2120
|
+
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2121
|
+
strokeColor: '#ff6933',
|
|
2122
|
+
shadowSize: 0
|
|
2123
|
+
}));
|
|
2095
2124
|
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
2099
|
-
|
|
2100
|
-
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
2101
|
-
|
|
2102
|
-
function SGisPolylineSymbol(originalSymbol) {
|
|
2103
|
-
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
2125
|
+
let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
|
|
2126
|
+
_inherits(SelectedPointSymbol, _ShadowedPointSymbol);
|
|
2104
2127
|
|
|
2105
|
-
|
|
2128
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
|
|
2106
2129
|
|
|
2107
|
-
|
|
2130
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2131
|
+
function SelectedPointSymbol(props) {
|
|
2132
|
+
_classCallCheck(this, SelectedPointSymbol);
|
|
2108
2133
|
|
|
2109
|
-
|
|
2110
|
-
// @ts-ignore
|
|
2111
|
-
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
2112
|
-
strokeWidth: clamp( // @ts-ignore
|
|
2113
|
-
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
2114
|
-
// @ts-ignore
|
|
2115
|
-
lineDash: getLineDash(originalSymbol.stroke),
|
|
2116
|
-
// @ts-ignore
|
|
2117
|
-
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
2118
|
-
});
|
|
2119
|
-
_this.originalSymbol = originalSymbol;
|
|
2120
|
-
return _this;
|
|
2134
|
+
return _super.call(this, props);
|
|
2121
2135
|
}
|
|
2122
2136
|
|
|
2123
|
-
_createClass(
|
|
2124
|
-
key: "
|
|
2125
|
-
value: function
|
|
2126
|
-
if (
|
|
2127
|
-
|
|
2128
|
-
ending,
|
|
2129
|
-
beginningSize,
|
|
2130
|
-
beginning,
|
|
2131
|
-
endingSize
|
|
2132
|
-
} = this.originalSymbol;
|
|
2133
|
-
const renders = [];
|
|
2134
|
-
const featureCopy = feature.clone();
|
|
2135
|
-
const beginningMiterRender = getLineMiterRender({
|
|
2136
|
-
color: this.strokeColor,
|
|
2137
|
-
// @ts-ignore
|
|
2138
|
-
kind: beginning,
|
|
2139
|
-
position: 'left',
|
|
2140
|
-
// @ts-ignore
|
|
2141
|
-
size: beginningSize,
|
|
2142
|
-
strokeWidth: this.strokeWidth
|
|
2143
|
-
});
|
|
2144
|
-
const endingMiterRender = getLineMiterRender({
|
|
2145
|
-
color: this.strokeColor,
|
|
2146
|
-
// @ts-ignore
|
|
2147
|
-
kind: ending,
|
|
2148
|
-
position: 'right',
|
|
2149
|
-
// @ts-ignore
|
|
2150
|
-
size: endingSize,
|
|
2151
|
-
strokeWidth: this.strokeWidth
|
|
2152
|
-
});
|
|
2153
|
-
|
|
2154
|
-
if (beginningMiterRender) {
|
|
2155
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
2156
|
-
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2157
|
-
featureCopy.rings = updatedRings;
|
|
2158
|
-
renders.push(render);
|
|
2137
|
+
_createClass(SelectedPointSymbol, [{
|
|
2138
|
+
key: "getShadow",
|
|
2139
|
+
value: function getShadow(position, feature) {
|
|
2140
|
+
if (feature.isSelected) {
|
|
2141
|
+
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2159
2142
|
}
|
|
2160
|
-
|
|
2161
|
-
if (endingMiterRender) {
|
|
2162
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
2163
|
-
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2164
|
-
featureCopy.rings = updatedRings;
|
|
2165
|
-
renders.push(render);
|
|
2166
|
-
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
2170
|
-
return renders;
|
|
2171
2143
|
}
|
|
2172
2144
|
}, {
|
|
2173
|
-
key: "
|
|
2174
|
-
value: function
|
|
2175
|
-
|
|
2176
|
-
}
|
|
2177
|
-
}]);
|
|
2145
|
+
key: "getPoint",
|
|
2146
|
+
value: function getPoint(position, feature) {
|
|
2147
|
+
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2178
2148
|
|
|
2179
|
-
|
|
2180
|
-
|
|
2149
|
+
if (feature.isSelected) {
|
|
2150
|
+
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2151
|
+
pointRender.fillColor = this.selectedFillColor;
|
|
2152
|
+
}
|
|
2181
2153
|
|
|
2182
|
-
|
|
2183
|
-
|
|
2154
|
+
return pointRender;
|
|
2155
|
+
}
|
|
2156
|
+
}]);
|
|
2184
2157
|
|
|
2185
|
-
|
|
2158
|
+
return SelectedPointSymbol;
|
|
2159
|
+
}(ShadowedPointSymbol);
|
|
2186
2160
|
|
|
2187
|
-
|
|
2188
|
-
|
|
2161
|
+
let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
|
|
2162
|
+
_inherits(SelectedPolySymbol, _ShadowedPolySymbol);
|
|
2189
2163
|
|
|
2190
|
-
|
|
2191
|
-
component,
|
|
2192
|
-
offset
|
|
2193
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2164
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
|
|
2194
2165
|
|
|
2195
|
-
|
|
2166
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2167
|
+
function SelectedPolySymbol(props) {
|
|
2168
|
+
_classCallCheck(this, SelectedPolySymbol);
|
|
2196
2169
|
|
|
2197
|
-
|
|
2198
|
-
offset
|
|
2199
|
-
});
|
|
2200
|
-
_this.component = component;
|
|
2201
|
-
return _this;
|
|
2170
|
+
return _super.call(this, props);
|
|
2202
2171
|
}
|
|
2203
2172
|
|
|
2204
|
-
_createClass(
|
|
2205
|
-
key: "
|
|
2206
|
-
value: function
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
}
|
|
2211
|
-
}, {
|
|
2212
|
-
key: "_updateFeatureNode",
|
|
2213
|
-
value: function _updateFeatureNode(feature) {
|
|
2214
|
-
this.renderDom(feature.content, this.getNode(feature));
|
|
2173
|
+
_createClass(SelectedPolySymbol, [{
|
|
2174
|
+
key: "getShadow",
|
|
2175
|
+
value: function getShadow(coordinates, feature) {
|
|
2176
|
+
if (feature.isSelected) {
|
|
2177
|
+
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2178
|
+
}
|
|
2215
2179
|
}
|
|
2216
2180
|
}, {
|
|
2217
|
-
key: "
|
|
2218
|
-
value: function
|
|
2219
|
-
|
|
2220
|
-
return;
|
|
2221
|
-
}
|
|
2181
|
+
key: "getPolyRender",
|
|
2182
|
+
value: function getPolyRender(coordinates, feature) {
|
|
2183
|
+
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2222
2184
|
|
|
2223
|
-
|
|
2185
|
+
if (feature.isSelected) {
|
|
2186
|
+
polyRender.fillColor = this.selectedFillColor;
|
|
2187
|
+
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2224
2188
|
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
}), node);
|
|
2229
|
-
} else {
|
|
2230
|
-
node.innerText = content;
|
|
2189
|
+
if (this.selectedStrokeWidth !== void 0) {
|
|
2190
|
+
polyRender.strokeWidth = this.selectedStrokeWidth;
|
|
2191
|
+
}
|
|
2231
2192
|
}
|
|
2193
|
+
|
|
2194
|
+
return polyRender;
|
|
2232
2195
|
}
|
|
2233
2196
|
}]);
|
|
2234
2197
|
|
|
2235
|
-
return
|
|
2236
|
-
}(
|
|
2198
|
+
return SelectedPolySymbol;
|
|
2199
|
+
}(ShadowedPolySymbol);
|
|
2237
2200
|
|
|
2238
|
-
const
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2201
|
+
const selectedPoint = /*#__PURE__*/new SelectedPointSymbol({
|
|
2202
|
+
size: 8,
|
|
2203
|
+
strokeWidth: 2,
|
|
2204
|
+
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2205
|
+
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2206
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2207
|
+
shadowSize: 3,
|
|
2208
|
+
selectedStrokeColor: '#ff5722',
|
|
2209
|
+
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2210
|
+
});
|
|
2211
|
+
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2212
|
+
strokeWidth: 6,
|
|
2213
|
+
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2214
|
+
shadowSize: 8,
|
|
2215
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2216
|
+
selectedStrokeColor: '#ff5722',
|
|
2217
|
+
selectedStrokeWidth: 2
|
|
2218
|
+
});
|
|
2219
|
+
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2220
|
+
strokeWidth: 2,
|
|
2221
|
+
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2222
|
+
shadowSize: 8,
|
|
2223
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2224
|
+
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2225
|
+
enclose: true,
|
|
2226
|
+
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2227
|
+
selectedStrokeColor: '#ff5722'
|
|
2228
|
+
});
|
|
2263
2229
|
|
|
2264
|
-
|
|
2230
|
+
const metersToPixels = (meters, _ref) => {
|
|
2265
2231
|
let {
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
shadowSize,
|
|
2269
|
-
size = 6
|
|
2232
|
+
painter,
|
|
2233
|
+
crs = Crs.geo
|
|
2270
2234
|
} = _ref;
|
|
2271
|
-
const
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
let {
|
|
2281
|
-
strokeColor,
|
|
2282
|
-
strokeWidth,
|
|
2283
|
-
shadowColor,
|
|
2284
|
-
fillColor,
|
|
2285
|
-
shadowSize,
|
|
2286
|
-
size = 0
|
|
2287
|
-
} = _ref2;
|
|
2288
|
-
return [createShadowRender(position, {
|
|
2289
|
-
strokeWidth,
|
|
2290
|
-
strokeColor,
|
|
2291
|
-
shadowSize,
|
|
2292
|
-
shadowColor,
|
|
2293
|
-
size
|
|
2294
|
-
}), new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
2295
|
-
fillColor,
|
|
2296
|
-
strokeColor,
|
|
2297
|
-
strokeWidth,
|
|
2298
|
-
enclosed: true
|
|
2299
|
-
})];
|
|
2300
|
-
}
|
|
2235
|
+
const {
|
|
2236
|
+
width
|
|
2237
|
+
} = painter;
|
|
2238
|
+
const zeroPoint = painter.getPointFromPxPosition(0, 0).projectTo(crs);
|
|
2239
|
+
const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
|
|
2240
|
+
const widthDistance = geotools.distance(zeroPoint, maxWidthPoint);
|
|
2241
|
+
const pxK = width / (widthDistance || 1);
|
|
2242
|
+
return Math.round(meters * pxK);
|
|
2243
|
+
};
|
|
2301
2244
|
|
|
2302
|
-
|
|
2303
|
-
|
|
2245
|
+
const defaultPathStyles = {
|
|
2246
|
+
strokeWidth: 2,
|
|
2247
|
+
strokeColor: 'rgb(0, 163, 245)',
|
|
2248
|
+
fillStyle: Poly.FillStyle.None
|
|
2249
|
+
};
|
|
2250
|
+
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2251
|
+
_inherits(SVGPoly, _Symbol);
|
|
2304
2252
|
|
|
2305
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
2253
|
+
var _super = /*#__PURE__*/_createSuper(SVGPoly);
|
|
2306
2254
|
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
_classCallCheck(this, ShadowedPointSymbol);
|
|
2255
|
+
function SVGPoly(_temp) {
|
|
2256
|
+
var _this;
|
|
2310
2257
|
|
|
2311
|
-
|
|
2258
|
+
let {
|
|
2259
|
+
redrawFeatureNode,
|
|
2260
|
+
pathStyles,
|
|
2261
|
+
circle,
|
|
2262
|
+
className,
|
|
2263
|
+
appendToSvg
|
|
2264
|
+
} = _temp === void 0 ? {} : _temp;
|
|
2265
|
+
|
|
2266
|
+
_classCallCheck(this, SVGPoly);
|
|
2267
|
+
|
|
2268
|
+
_this = _super.call(this);
|
|
2269
|
+
_this.container = document.createElement('div');
|
|
2270
|
+
_this.container.style.position = 'absolute';
|
|
2271
|
+
_this.redrawFeatureNode = redrawFeatureNode;
|
|
2272
|
+
_this.pathStyles = _extends({
|
|
2273
|
+
center: [0, 0],
|
|
2274
|
+
fillColor: 'none'
|
|
2275
|
+
}, pathStyles);
|
|
2276
|
+
_this.circle = circle;
|
|
2277
|
+
_this.className = className;
|
|
2278
|
+
_this.appendToSvg = appendToSvg;
|
|
2279
|
+
return _this;
|
|
2312
2280
|
}
|
|
2313
2281
|
|
|
2314
|
-
_createClass(
|
|
2282
|
+
_createClass(SVGPoly, [{
|
|
2315
2283
|
key: "renderFunction",
|
|
2316
2284
|
value: function renderFunction(feature, resolution, crs) {
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2285
|
+
const coordinates = feature instanceof Poly$1.Poly ? PolylineSymbol.PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2286
|
+
this.setCirclePxRaius(crs);
|
|
2287
|
+
this.container.innerHTML = '';
|
|
2288
|
+
const svg = this.setSvg(coordinates);
|
|
2289
|
+
svg && this.container.append(svg);
|
|
2290
|
+
feature.__dynamicSymbolRender = new Render.DynamicRender({
|
|
2291
|
+
node: this.container,
|
|
2292
|
+
update: (bbox, resolution) => this.update({
|
|
2293
|
+
bbox,
|
|
2294
|
+
resolution,
|
|
2295
|
+
feature,
|
|
2296
|
+
crs
|
|
2297
|
+
}),
|
|
2298
|
+
redraw: () => {
|
|
2299
|
+
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2300
|
+
}
|
|
2301
|
+
});
|
|
2302
|
+
|
|
2303
|
+
this._setEventListeners(feature);
|
|
2304
|
+
|
|
2305
|
+
return [feature.__dynamicSymbolRender];
|
|
2325
2306
|
}
|
|
2326
2307
|
}, {
|
|
2327
|
-
key: "
|
|
2328
|
-
value: function
|
|
2329
|
-
|
|
2308
|
+
key: "setCirclePxRaius",
|
|
2309
|
+
value: function setCirclePxRaius(crs) {
|
|
2310
|
+
if (this.circle && this.pathStyles) {
|
|
2311
|
+
var _this$circle;
|
|
2312
|
+
|
|
2313
|
+
this.pathStyles.radius = metersToPixels(this.circle.radius, {
|
|
2314
|
+
painter: this.circle.painter,
|
|
2315
|
+
crs
|
|
2316
|
+
}) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
|
|
2317
|
+
}
|
|
2330
2318
|
}
|
|
2331
2319
|
}, {
|
|
2332
|
-
key: "
|
|
2333
|
-
value: function
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
}], [{
|
|
2337
|
-
key: "getShadowArc",
|
|
2338
|
-
value: function getShadowArc(position, _ref) {
|
|
2320
|
+
key: "update",
|
|
2321
|
+
value: function update(_ref) {
|
|
2322
|
+
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2323
|
+
|
|
2339
2324
|
let {
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2325
|
+
bbox,
|
|
2326
|
+
resolution,
|
|
2327
|
+
feature,
|
|
2328
|
+
crs
|
|
2344
2329
|
} = _ref;
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2330
|
+
if (!feature) return;
|
|
2331
|
+
if (!bbox) bbox = feature.__lastBbox;
|
|
2332
|
+
if (!resolution) resolution = feature.__lastResolution;
|
|
2333
|
+
if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
|
|
2334
|
+
|
|
2335
|
+
if (feature.__lastResolution && resolution !== feature.__lastResolution) {
|
|
2336
|
+
const newCoordinates = feature instanceof Poly$1.Poly ? PolylineSymbol.PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2337
|
+
this.setCirclePxRaius(crs);
|
|
2338
|
+
this.container.innerHTML = '';
|
|
2339
|
+
const svg = this.setSvg(newCoordinates);
|
|
2340
|
+
svg && this.container.append(svg);
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
const polygon = feature.projectTo(bbox.crs);
|
|
2344
|
+
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;
|
|
2345
|
+
const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
|
|
2346
|
+
const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
|
|
2347
|
+
this.container.style.left = dx.toString() + "px";
|
|
2348
|
+
this.container.style.top = dy.toString() + "px";
|
|
2349
|
+
feature.__lastBbox = bbox;
|
|
2350
|
+
feature.__lastResolution = resolution;
|
|
2351
2351
|
}
|
|
2352
2352
|
}, {
|
|
2353
|
-
key: "
|
|
2354
|
-
value: function
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
});
|
|
2367
|
-
}
|
|
2368
|
-
}, {
|
|
2369
|
-
key: "getArcs",
|
|
2370
|
-
value: function getArcs(position, params) {
|
|
2371
|
-
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2372
|
-
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2373
|
-
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2374
|
-
}
|
|
2375
|
-
}]);
|
|
2376
|
-
|
|
2377
|
-
return ShadowedPointSymbol;
|
|
2378
|
-
}(Point.PointSymbol);
|
|
2379
|
-
|
|
2380
|
-
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2381
|
-
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2382
|
-
|
|
2383
|
-
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2384
|
-
|
|
2385
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2386
|
-
function ShadowedPolySymbol(options) {
|
|
2387
|
-
_classCallCheck(this, ShadowedPolySymbol);
|
|
2388
|
-
|
|
2389
|
-
return _super.call(this, options);
|
|
2390
|
-
}
|
|
2391
|
-
|
|
2392
|
-
_createClass(ShadowedPolySymbol, [{
|
|
2393
|
-
key: "renderFunction",
|
|
2394
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2395
|
-
if (!(feature instanceof Poly$1.Poly)) return [];
|
|
2396
|
-
const coordinates = PolylineSymbol.PolylineSymbol.getRenderedCoordinates(feature, resolution, crs);
|
|
2397
|
-
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2398
|
-
const shadowRender = this.getShadow(coordinates, feature);
|
|
2399
|
-
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2400
|
-
let renders = [polyRender];
|
|
2353
|
+
key: "setSvg",
|
|
2354
|
+
value: function setSvg(coordinates) {
|
|
2355
|
+
const {
|
|
2356
|
+
lineCap,
|
|
2357
|
+
lineJoin,
|
|
2358
|
+
miterLimit,
|
|
2359
|
+
lineDash,
|
|
2360
|
+
dashOffset
|
|
2361
|
+
} = this.pathStyles || {};
|
|
2362
|
+
const svgRender = new SvgRender.SvgRender(_extends({
|
|
2363
|
+
coordinates
|
|
2364
|
+
}, defaultPathStyles, {
|
|
2365
|
+
appendToSvg: this.appendToSvg
|
|
2366
|
+
}, this.pathStyles));
|
|
2401
2367
|
|
|
2402
|
-
if (
|
|
2403
|
-
|
|
2368
|
+
if (this.circle) {
|
|
2369
|
+
svgRender._setArcNode();
|
|
2370
|
+
} else {
|
|
2371
|
+
svgRender._setPolyNode();
|
|
2404
2372
|
}
|
|
2405
2373
|
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2374
|
+
let svgElement;
|
|
2375
|
+
svgRender.getNode((_, svg) => {
|
|
2376
|
+
svgElement = svg;
|
|
2377
|
+
this.className && svgElement.classList.add(this.className);
|
|
2378
|
+
const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
|
|
2409
2379
|
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
lineDash: this.lineDash
|
|
2380
|
+
if (path) {
|
|
2381
|
+
path.setAttribute('stroke-linecap', lineCap || 'round');
|
|
2382
|
+
path.setAttribute('stroke-linejoin', lineJoin || 'round');
|
|
2383
|
+
path.setAttribute('stroke-miterlimit', (miterLimit || 10).toString());
|
|
2384
|
+
path.setAttribute('stroke-dashoffset', (dashOffset || 0).toString());
|
|
2385
|
+
|
|
2386
|
+
if (this.circle) {
|
|
2387
|
+
path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2421
2390
|
});
|
|
2391
|
+
return svgElement;
|
|
2422
2392
|
}
|
|
2423
2393
|
}, {
|
|
2424
|
-
key: "
|
|
2425
|
-
value: function
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2394
|
+
key: "_setEventListeners",
|
|
2395
|
+
value: function _setEventListeners(dynamicFeature) {
|
|
2396
|
+
var _dynamicFeature$__dyn;
|
|
2397
|
+
|
|
2398
|
+
if (dynamicFeature.eventFlags === EventHandler.MouseEventFlags.None) return;
|
|
2399
|
+
const svgNode = dynamicFeature == null ? void 0 : (_dynamicFeature$__dyn = dynamicFeature.__dynamicSymbolRender) == null ? void 0 : _dynamicFeature$__dyn.node.querySelector(this.circle ? 'circle' : 'path');
|
|
2400
|
+
Object.keys(EventHandler.mouseEvents).forEach(eventName => {
|
|
2401
|
+
if (dynamicFeature.eventFlags & EventHandler.mouseEvents[eventName].flag) {
|
|
2402
|
+
domEvent.listenDomEvent(svgNode, EventHandler.mouseEvents[eventName].type, event => {
|
|
2403
|
+
dynamicFeature.fire(EventHandler.mouseEvents[eventName].type, {
|
|
2404
|
+
node: svgNode,
|
|
2405
|
+
browserEvent: event
|
|
2406
|
+
});
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2433
2409
|
});
|
|
2434
2410
|
}
|
|
2435
|
-
}, {
|
|
2436
|
-
key: "getVertexRenders",
|
|
2437
|
-
value: function getVertexRenders(coordinates) {
|
|
2438
|
-
if (!this.showVertex) return;
|
|
2439
|
-
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2440
|
-
return acc.concat(curr);
|
|
2441
|
-
}, []);
|
|
2442
|
-
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2443
|
-
size: 6,
|
|
2444
|
-
strokeWidth: 2,
|
|
2445
|
-
shadowColor: this.shadowColor,
|
|
2446
|
-
strokeColor: this.strokeColor,
|
|
2447
|
-
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2448
|
-
fillColor: '#ffffff'
|
|
2449
|
-
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2450
|
-
}
|
|
2451
2411
|
}]);
|
|
2452
2412
|
|
|
2453
|
-
return
|
|
2454
|
-
}(
|
|
2455
|
-
const polySymbolParams = {
|
|
2456
|
-
strokeWidth: 2,
|
|
2457
|
-
strokeColor: '#e33600',
|
|
2458
|
-
shadowSize: 8,
|
|
2459
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)'
|
|
2460
|
-
};
|
|
2461
|
-
const measureSymbolParams = {
|
|
2462
|
-
strokeColor: '#ff6933',
|
|
2463
|
-
shadowSize: 0,
|
|
2464
|
-
vertexShadowSize: 0
|
|
2465
|
-
};
|
|
2466
|
-
const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2467
|
-
enclose: false,
|
|
2468
|
-
showVertex: true
|
|
2469
|
-
}));
|
|
2470
|
-
const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2471
|
-
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2472
|
-
enclose: true,
|
|
2473
|
-
showVertex: true
|
|
2474
|
-
}));
|
|
2475
|
-
const snapSymbolParams = {
|
|
2476
|
-
size: 10,
|
|
2477
|
-
strokeWidth: 2,
|
|
2478
|
-
strokeColor: '#e33600',
|
|
2479
|
-
fillColor: '#ffffff',
|
|
2480
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2481
|
-
shadowSize: 3
|
|
2482
|
-
};
|
|
2483
|
-
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2484
|
-
strokeColor: '#ff6933',
|
|
2485
|
-
shadowSize: 0
|
|
2486
|
-
}));
|
|
2413
|
+
return SVGPoly;
|
|
2414
|
+
}(_Symbol.Symbol);
|
|
2487
2415
|
|
|
2488
|
-
|
|
2489
|
-
|
|
2416
|
+
function isSGisPointSymbol(symbol) {
|
|
2417
|
+
return symbol instanceof Point.PointSymbol || symbol instanceof StaticImageSymbol.StaticImageSymbol || symbol instanceof Square.SquareSymbol || symbol instanceof MaskedImage.MaskedImage;
|
|
2418
|
+
}
|
|
2419
|
+
function isSGisImageSymbol(symbol) {
|
|
2420
|
+
return symbol instanceof StaticImageSymbol.StaticImageSymbol || symbol instanceof MaskedImage.MaskedImage;
|
|
2421
|
+
}
|
|
2422
|
+
function isSGisPolygonSymbol(symbol) {
|
|
2423
|
+
return symbol instanceof Simple.PolygonSymbol || symbol instanceof BrushFill.BrushFill || symbol instanceof ImageFill.ImageFill;
|
|
2424
|
+
}
|
|
2425
|
+
function isSGisPolylineSymbol(symbol) {
|
|
2426
|
+
return symbol instanceof PolylineSymbol.PolylineSymbol;
|
|
2427
|
+
}
|
|
2490
2428
|
|
|
2491
|
-
|
|
2429
|
+
/**
|
|
2430
|
+
* Моки фич для отображения превью символа
|
|
2431
|
+
* http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
|
|
2432
|
+
*/
|
|
2492
2433
|
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2434
|
+
const viewBoxSize = 100;
|
|
2435
|
+
const pointFeature = /*#__PURE__*/new PointFeature.PointFeature([50, -50], {
|
|
2436
|
+
crs: Crs.plain
|
|
2437
|
+
});
|
|
2438
|
+
const lineFeature = /*#__PURE__*/new Polyline.Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2439
|
+
crs: Crs.plain
|
|
2440
|
+
});
|
|
2441
|
+
const polygonFeature = /*#__PURE__*/new Polygon.Polygon([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2442
|
+
crs: Crs.plain
|
|
2443
|
+
});
|
|
2444
|
+
const lineLegendFeature = /*#__PURE__*/new Polyline.Polyline([[0, -50], [100, -50]], {
|
|
2445
|
+
crs: Crs.plain
|
|
2446
|
+
});
|
|
2447
|
+
const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
|
|
2448
|
+
crs: Crs.plain
|
|
2449
|
+
});
|
|
2450
|
+
const polygonMapLegendFeature = /*#__PURE__*/new Polygon.Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2451
|
+
crs: Crs.plain
|
|
2452
|
+
});
|
|
2453
|
+
const MAP_LEGEND_FEATURES = {
|
|
2454
|
+
polygon: polygonMapLegendFeature
|
|
2455
|
+
};
|
|
2456
|
+
const LEGEND_FEATURES = {
|
|
2457
|
+
polyline: lineLegendFeature,
|
|
2458
|
+
polygon: polygonLegendFeature
|
|
2459
|
+
};
|
|
2460
|
+
const MOCK_FEATURES = {
|
|
2461
|
+
point: pointFeature,
|
|
2462
|
+
polyline: lineFeature,
|
|
2463
|
+
polygon: polygonFeature
|
|
2464
|
+
};
|
|
2496
2465
|
|
|
2497
|
-
|
|
2466
|
+
function getSymbolRenders(symbol, size, features) {
|
|
2467
|
+
if (size === void 0) {
|
|
2468
|
+
size = viewBoxSize;
|
|
2498
2469
|
}
|
|
2499
2470
|
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
if (feature.isSelected) {
|
|
2504
|
-
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2505
|
-
}
|
|
2506
|
-
}
|
|
2507
|
-
}, {
|
|
2508
|
-
key: "getPoint",
|
|
2509
|
-
value: function getPoint(position, feature) {
|
|
2510
|
-
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2511
|
-
|
|
2512
|
-
if (feature.isSelected) {
|
|
2513
|
-
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2514
|
-
pointRender.fillColor = this.selectedFillColor;
|
|
2515
|
-
}
|
|
2471
|
+
if (features === void 0) {
|
|
2472
|
+
features = {};
|
|
2473
|
+
}
|
|
2516
2474
|
|
|
2517
|
-
|
|
2518
|
-
}
|
|
2519
|
-
}]);
|
|
2475
|
+
const resolution = viewBoxSize / size;
|
|
2520
2476
|
|
|
2521
|
-
|
|
2522
|
-
}(ShadowedPointSymbol);
|
|
2477
|
+
const featuresToRender = _extends({}, MOCK_FEATURES, features);
|
|
2523
2478
|
|
|
2524
|
-
|
|
2525
|
-
|
|
2479
|
+
if (isSGisPolygonSymbol(symbol)) {
|
|
2480
|
+
return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, Crs.plain);
|
|
2481
|
+
}
|
|
2526
2482
|
|
|
2527
|
-
|
|
2483
|
+
if (isSGisPolylineSymbol(symbol)) {
|
|
2484
|
+
return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, Crs.plain);
|
|
2485
|
+
}
|
|
2528
2486
|
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2487
|
+
return symbol.renderFunctionAsync(featuresToRender.point, resolution, Crs.plain);
|
|
2488
|
+
}
|
|
2489
|
+
const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
|
|
2490
|
+
if (size === void 0) {
|
|
2491
|
+
size = viewBoxSize;
|
|
2492
|
+
}
|
|
2532
2493
|
|
|
2533
|
-
|
|
2494
|
+
return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
|
|
2495
|
+
};
|
|
2496
|
+
const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
|
|
2497
|
+
if (size === void 0) {
|
|
2498
|
+
size = viewBoxSize;
|
|
2534
2499
|
}
|
|
2535
2500
|
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
value: function getShadow(coordinates, feature) {
|
|
2539
|
-
if (feature.isSelected) {
|
|
2540
|
-
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2541
|
-
}
|
|
2542
|
-
}
|
|
2543
|
-
}, {
|
|
2544
|
-
key: "getPolyRender",
|
|
2545
|
-
value: function getPolyRender(coordinates, feature) {
|
|
2546
|
-
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2501
|
+
return getSymbolRenders(symbol, size, LEGEND_FEATURES);
|
|
2502
|
+
};
|
|
2547
2503
|
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2504
|
+
function renderSymbolToCanvas(renders, canvas) {
|
|
2505
|
+
renders.forEach(render => {
|
|
2506
|
+
canvas.draw(render);
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2551
2509
|
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2510
|
+
function deserializeSymbol(symbol) {
|
|
2511
|
+
switch (symbol.type) {
|
|
2512
|
+
case 'circlePointSymbol':
|
|
2513
|
+
return deserializePointSymbol(symbol);
|
|
2556
2514
|
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
}]);
|
|
2515
|
+
case 'squarePointSymbol':
|
|
2516
|
+
return deserializeSquareSymbol(symbol);
|
|
2560
2517
|
|
|
2561
|
-
|
|
2562
|
-
|
|
2518
|
+
case 'maskedImagePointSymbol':
|
|
2519
|
+
return deserializeMaskedImageSymbol(symbol);
|
|
2563
2520
|
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
strokeWidth: 2,
|
|
2567
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2568
|
-
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2569
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2570
|
-
shadowSize: 3,
|
|
2571
|
-
selectedStrokeColor: '#ff5722',
|
|
2572
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2573
|
-
});
|
|
2574
|
-
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2575
|
-
strokeWidth: 6,
|
|
2576
|
-
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2577
|
-
shadowSize: 8,
|
|
2578
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2579
|
-
selectedStrokeColor: '#ff5722',
|
|
2580
|
-
selectedStrokeWidth: 2
|
|
2581
|
-
});
|
|
2582
|
-
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2583
|
-
strokeWidth: 2,
|
|
2584
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2585
|
-
shadowSize: 8,
|
|
2586
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2587
|
-
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2588
|
-
enclose: true,
|
|
2589
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2590
|
-
selectedStrokeColor: '#ff5722'
|
|
2591
|
-
});
|
|
2521
|
+
case 'imagePointSymbol':
|
|
2522
|
+
return deserializeImagePointSymbol(symbol);
|
|
2592
2523
|
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
strokeColor: 'rgb(0, 163, 245)',
|
|
2596
|
-
fillStyle: Poly.FillStyle.None
|
|
2597
|
-
};
|
|
2598
|
-
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2599
|
-
_inherits(SVGPoly, _Symbol);
|
|
2524
|
+
case 'polygonSymbol':
|
|
2525
|
+
return deserializePolygonSymbol(symbol);
|
|
2600
2526
|
|
|
2601
|
-
|
|
2527
|
+
case 'simplePolylineSymbol':
|
|
2528
|
+
case 'polylineSymbol':
|
|
2529
|
+
return deserializePolylineSymbol(symbol);
|
|
2602
2530
|
|
|
2603
|
-
|
|
2604
|
-
|
|
2531
|
+
default:
|
|
2532
|
+
return null;
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2605
2535
|
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
className,
|
|
2611
|
-
appendToSvg
|
|
2612
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2536
|
+
function deserializePointSymbol(symbol) {
|
|
2537
|
+
// @ts-ignore
|
|
2538
|
+
return new Point.PointSymbol(deserializePointSymbolParams(symbol));
|
|
2539
|
+
}
|
|
2613
2540
|
|
|
2614
|
-
|
|
2541
|
+
function deserializeSquareSymbol(symbol) {
|
|
2542
|
+
return new Square.SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
|
|
2543
|
+
// @ts-ignore
|
|
2544
|
+
angle: getParameterValue(symbol.angle)
|
|
2545
|
+
}));
|
|
2546
|
+
}
|
|
2615
2547
|
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2548
|
+
function deserializeMaskedImageSymbol(symbol) {
|
|
2549
|
+
return new MaskedImage.MaskedImage(_extends({}, symbol, {
|
|
2550
|
+
// @ts-ignore
|
|
2551
|
+
angle: getParameterValue(symbol.angle),
|
|
2552
|
+
// @ts-ignore
|
|
2553
|
+
width: getParameterValue(symbol.width),
|
|
2554
|
+
// @ts-ignore
|
|
2555
|
+
height: getParameterValue(symbol.height),
|
|
2556
|
+
// @ts-ignore
|
|
2557
|
+
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2558
|
+
// @ts-ignore
|
|
2559
|
+
imageSource: deserializeBase64(symbol.image),
|
|
2560
|
+
// @ts-ignore
|
|
2561
|
+
maskSource: deserializeBase64(symbol.imageMask),
|
|
2562
|
+
// @ts-ignore
|
|
2563
|
+
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2564
|
+
}));
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
function deserializeImagePointSymbol(symbol) {
|
|
2568
|
+
return new StaticImageSymbol.StaticImageSymbol(_extends({}, symbol, {
|
|
2569
|
+
// @ts-ignore
|
|
2570
|
+
angle: getParameterValue(symbol.angle),
|
|
2571
|
+
// @ts-ignore
|
|
2572
|
+
width: getParameterValue(symbol.width),
|
|
2573
|
+
// @ts-ignore
|
|
2574
|
+
height: getParameterValue(symbol.height),
|
|
2575
|
+
// @ts-ignore
|
|
2576
|
+
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2577
|
+
// @ts-ignore
|
|
2578
|
+
source: deserializeBase64(symbol.image)
|
|
2579
|
+
}));
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
function deserializePolygonSymbol(symbol) {
|
|
2583
|
+
if (isPolygonHasPatternBrush(symbol)) {
|
|
2584
|
+
return new SGisImageFill(symbol);
|
|
2628
2585
|
}
|
|
2629
2586
|
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
const coordinates = feature instanceof Poly$1.Poly ? PolylineSymbol.PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2634
|
-
this.setCirclePxRaius(crs);
|
|
2635
|
-
this.container.innerHTML = '';
|
|
2636
|
-
const svg = this.setSvg(coordinates);
|
|
2637
|
-
svg && this.container.append(svg);
|
|
2638
|
-
feature.__dynamicSymbolRender = new Render.DynamicRender({
|
|
2639
|
-
node: this.container,
|
|
2640
|
-
update: (bbox, resolution) => this.update({
|
|
2641
|
-
bbox,
|
|
2642
|
-
resolution,
|
|
2643
|
-
feature,
|
|
2644
|
-
crs
|
|
2645
|
-
}),
|
|
2646
|
-
redraw: () => {
|
|
2647
|
-
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2648
|
-
}
|
|
2649
|
-
});
|
|
2587
|
+
if (isPolygonHasHatchBrush(symbol)) {
|
|
2588
|
+
return new SGisBrushFill(symbol);
|
|
2589
|
+
}
|
|
2650
2590
|
|
|
2651
|
-
|
|
2591
|
+
return new SGisPolygonSymbol(symbol);
|
|
2592
|
+
}
|
|
2652
2593
|
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
key: "setCirclePxRaius",
|
|
2657
|
-
value: function setCirclePxRaius(crs) {
|
|
2658
|
-
if (this.circle && this.pathStyles) {
|
|
2659
|
-
var _this$circle;
|
|
2594
|
+
function deserializePolylineSymbol(symbol) {
|
|
2595
|
+
return new SGisPolylineSymbol(symbol);
|
|
2596
|
+
}
|
|
2660
2597
|
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2598
|
+
function deserializePointSymbolParams(_ref) {
|
|
2599
|
+
let {
|
|
2600
|
+
size,
|
|
2601
|
+
offset,
|
|
2602
|
+
strokeColor,
|
|
2603
|
+
strokeWidth,
|
|
2604
|
+
fillColor
|
|
2605
|
+
} = _ref;
|
|
2606
|
+
return {
|
|
2607
|
+
size: getParameterValue(size),
|
|
2608
|
+
offset: deserializeAnchor(offset),
|
|
2609
|
+
strokeWidth: getParameterValue(strokeWidth),
|
|
2610
|
+
strokeColor: deserializeColor(getParameterValue(strokeColor)),
|
|
2611
|
+
fillColor: deserializeColor(getParameterValue(fillColor))
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2671
2614
|
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
feature,
|
|
2676
|
-
crs
|
|
2677
|
-
} = _ref;
|
|
2678
|
-
if (!feature) return;
|
|
2679
|
-
if (!bbox) bbox = feature.__lastBbox;
|
|
2680
|
-
if (!resolution) resolution = feature.__lastResolution;
|
|
2681
|
-
if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
|
|
2615
|
+
function deserializeBase64(base) {
|
|
2616
|
+
return "data:image/png;base64," + base;
|
|
2617
|
+
}
|
|
2682
2618
|
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
const svg = this.setSvg(newCoordinates);
|
|
2688
|
-
svg && this.container.append(svg);
|
|
2689
|
-
}
|
|
2619
|
+
function deserializeAnchor(offset) {
|
|
2620
|
+
// @ts-ignore
|
|
2621
|
+
return offset.map(getParameterValue);
|
|
2622
|
+
}
|
|
2690
2623
|
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
|
|
2695
|
-
this.container.style.left = dx.toString() + "px";
|
|
2696
|
-
this.container.style.top = dy.toString() + "px";
|
|
2697
|
-
feature.__lastBbox = bbox;
|
|
2698
|
-
feature.__lastResolution = resolution;
|
|
2699
|
-
}
|
|
2700
|
-
}, {
|
|
2701
|
-
key: "setSvg",
|
|
2702
|
-
value: function setSvg(coordinates) {
|
|
2703
|
-
const {
|
|
2704
|
-
lineCap,
|
|
2705
|
-
lineJoin,
|
|
2706
|
-
miterLimit,
|
|
2707
|
-
lineDash,
|
|
2708
|
-
dashOffset
|
|
2709
|
-
} = this.pathStyles || {};
|
|
2710
|
-
const svgRender = new SvgRender.SvgRender(_extends({
|
|
2711
|
-
coordinates
|
|
2712
|
-
}, defaultPathStyles, {
|
|
2713
|
-
appendToSvg: this.appendToSvg
|
|
2714
|
-
}, this.pathStyles));
|
|
2624
|
+
function deserializeColor(color$1) {
|
|
2625
|
+
return color$1 ? new color.Color(color$1).toString() : null;
|
|
2626
|
+
}
|
|
2715
2627
|
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2628
|
+
const clampSymbol = (symbol, min, max) => {
|
|
2629
|
+
if (isSGisImageSymbol(symbol)) {
|
|
2630
|
+
symbol.width = clamp(symbol.width, min, max);
|
|
2631
|
+
symbol.height = clamp(symbol.height, min, max);
|
|
2632
|
+
} else if (isSGisPointSymbol(symbol)) {
|
|
2633
|
+
symbol.size = clamp(symbol.size, min, max);
|
|
2634
|
+
}
|
|
2721
2635
|
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2636
|
+
return symbol;
|
|
2637
|
+
};
|
|
2638
|
+
function centerAlignSymbol(symbol) {
|
|
2639
|
+
if (isSGisImageSymbol(symbol)) {
|
|
2640
|
+
symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
|
|
2641
|
+
} else if (isSGisPointSymbol(symbol)) {
|
|
2642
|
+
symbol.offset = [0, 0];
|
|
2643
|
+
}
|
|
2727
2644
|
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2645
|
+
return symbol;
|
|
2646
|
+
}
|
|
2647
|
+
const adjustSymbol = (symbol, _ref) => {
|
|
2648
|
+
let {
|
|
2649
|
+
size
|
|
2650
|
+
} = _ref;
|
|
2651
|
+
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
2652
|
+
};
|
|
2733
2653
|
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
}
|
|
2738
|
-
});
|
|
2739
|
-
return svgElement;
|
|
2740
|
-
}
|
|
2741
|
-
}, {
|
|
2742
|
-
key: "_setEventListeners",
|
|
2743
|
-
value: function _setEventListeners(dynamicFeature) {
|
|
2744
|
-
var _dynamicFeature$__dyn;
|
|
2654
|
+
let EvergisFeature = /*#__PURE__*/function () {
|
|
2655
|
+
function EvergisFeature(feature) {
|
|
2656
|
+
_classCallCheck(this, EvergisFeature);
|
|
2745
2657
|
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
}
|
|
2658
|
+
this.id = null;
|
|
2659
|
+
this.displayName = null;
|
|
2660
|
+
this.geometry = null;
|
|
2661
|
+
this.layerName = null;
|
|
2662
|
+
this.layerAlias = null;
|
|
2663
|
+
this.attributes = null;
|
|
2664
|
+
this.symbol = null;
|
|
2665
|
+
this.id = feature.id;
|
|
2666
|
+
this.displayName = feature.id;
|
|
2667
|
+
this.geometry = feature.geometry;
|
|
2668
|
+
this.layerName = feature.layer;
|
|
2669
|
+
this.layerAlias = feature.layer;
|
|
2670
|
+
this.attributes = getFeatureAttributes(feature.attributes);
|
|
2671
|
+
}
|
|
2760
2672
|
|
|
2761
|
-
|
|
2762
|
-
|
|
2673
|
+
_createClass(EvergisFeature, [{
|
|
2674
|
+
key: "sGisFeature",
|
|
2675
|
+
value: function sGisFeature() {
|
|
2676
|
+
if (!this.geometry || !this.symbol) {
|
|
2677
|
+
return null;
|
|
2678
|
+
} // @ts-ignore
|
|
2763
2679
|
|
|
2764
|
-
function isSGisPointSymbol(symbol) {
|
|
2765
|
-
return symbol instanceof Point.PointSymbol || symbol instanceof StaticImageSymbol.StaticImageSymbol || symbol instanceof Square.SquareSymbol || symbol instanceof MaskedImage.MaskedImage;
|
|
2766
|
-
}
|
|
2767
|
-
function isSGisImageSymbol(symbol) {
|
|
2768
|
-
return symbol instanceof StaticImageSymbol.StaticImageSymbol || symbol instanceof MaskedImage.MaskedImage;
|
|
2769
|
-
}
|
|
2770
|
-
function isSGisPolygonSymbol(symbol) {
|
|
2771
|
-
return symbol instanceof Simple.PolygonSymbol || symbol instanceof BrushFill.BrushFill || symbol instanceof ImageFill.ImageFill;
|
|
2772
|
-
}
|
|
2773
|
-
function isSGisPolylineSymbol(symbol) {
|
|
2774
|
-
return symbol instanceof PolylineSymbol.PolylineSymbol;
|
|
2775
|
-
}
|
|
2776
2680
|
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2681
|
+
const {
|
|
2682
|
+
type,
|
|
2683
|
+
coordinates,
|
|
2684
|
+
sr
|
|
2685
|
+
} = this.geometry;
|
|
2686
|
+
const crs = CRS_MAP[sr];
|
|
2781
2687
|
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
});
|
|
2786
|
-
const lineFeature = /*#__PURE__*/new Polyline.Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2787
|
-
crs: Crs.plain
|
|
2788
|
-
});
|
|
2789
|
-
const polygonFeature = /*#__PURE__*/new Polygon.Polygon([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2790
|
-
crs: Crs.plain
|
|
2791
|
-
});
|
|
2792
|
-
const lineLegendFeature = /*#__PURE__*/new Polyline.Polyline([[0, -50], [100, -50]], {
|
|
2793
|
-
crs: Crs.plain
|
|
2794
|
-
});
|
|
2795
|
-
const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
|
|
2796
|
-
crs: Crs.plain
|
|
2797
|
-
});
|
|
2798
|
-
const polygonMapLegendFeature = /*#__PURE__*/new Polygon.Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2799
|
-
crs: Crs.plain
|
|
2800
|
-
});
|
|
2801
|
-
const MAP_LEGEND_FEATURES = {
|
|
2802
|
-
polygon: polygonMapLegendFeature
|
|
2803
|
-
};
|
|
2804
|
-
const LEGEND_FEATURES = {
|
|
2805
|
-
polyline: lineLegendFeature,
|
|
2806
|
-
polygon: polygonLegendFeature
|
|
2807
|
-
};
|
|
2808
|
-
const MOCK_FEATURES = {
|
|
2809
|
-
point: pointFeature,
|
|
2810
|
-
polyline: lineFeature,
|
|
2811
|
-
polygon: polygonFeature
|
|
2812
|
-
};
|
|
2688
|
+
if (!crs) {
|
|
2689
|
+
return null;
|
|
2690
|
+
}
|
|
2813
2691
|
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2692
|
+
switch (type) {
|
|
2693
|
+
case api.GeometryType.Point:
|
|
2694
|
+
return new PointFeature.PointFeature(coordinates, {
|
|
2695
|
+
symbol: selectedPoint,
|
|
2696
|
+
crs
|
|
2697
|
+
});
|
|
2818
2698
|
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2699
|
+
case api.GeometryType.Multipoint:
|
|
2700
|
+
return new MultiPoint.MultiPoint(coordinates, {
|
|
2701
|
+
symbol: selectedPoint,
|
|
2702
|
+
crs
|
|
2703
|
+
});
|
|
2822
2704
|
|
|
2823
|
-
|
|
2705
|
+
case api.GeometryType.Polyline:
|
|
2706
|
+
return new Polyline.Polyline(coordinates, {
|
|
2707
|
+
symbol: selectedPolyline,
|
|
2708
|
+
crs
|
|
2709
|
+
});
|
|
2824
2710
|
|
|
2825
|
-
|
|
2711
|
+
case api.GeometryType.Polygon:
|
|
2712
|
+
return new Polygon.Polygon(coordinates, {
|
|
2713
|
+
symbol: selectedPolygon,
|
|
2714
|
+
crs
|
|
2715
|
+
});
|
|
2826
2716
|
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2717
|
+
default:
|
|
2718
|
+
return null;
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
}, {
|
|
2722
|
+
key: "extent",
|
|
2723
|
+
value: function extent() {
|
|
2724
|
+
const feature = this.sGisFeature();
|
|
2725
|
+
return feature && feature.bbox;
|
|
2726
|
+
}
|
|
2727
|
+
}]);
|
|
2830
2728
|
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
}
|
|
2729
|
+
return EvergisFeature;
|
|
2730
|
+
}();
|
|
2834
2731
|
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
const
|
|
2838
|
-
|
|
2839
|
-
size = viewBoxSize;
|
|
2840
|
-
}
|
|
2732
|
+
function evaluateCondition(condition$1, attributes) {
|
|
2733
|
+
try {
|
|
2734
|
+
const evaluator = new condition.ConditionEvaluator(attributes);
|
|
2735
|
+
const result = evaluator.evaluate(condition$1);
|
|
2841
2736
|
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
if (size === void 0) {
|
|
2846
|
-
size = viewBoxSize;
|
|
2847
|
-
}
|
|
2737
|
+
if (result instanceof Error) {
|
|
2738
|
+
return null;
|
|
2739
|
+
}
|
|
2848
2740
|
|
|
2849
|
-
|
|
2850
|
-
}
|
|
2741
|
+
return result;
|
|
2742
|
+
} catch (_unused) {
|
|
2743
|
+
return null;
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2851
2746
|
|
|
2852
|
-
function
|
|
2853
|
-
|
|
2854
|
-
|
|
2747
|
+
function getAttributeValue(attributes, attributeName) {
|
|
2748
|
+
const attributeMeta = attributes.find((_ref) => {
|
|
2749
|
+
let {
|
|
2750
|
+
name
|
|
2751
|
+
} = _ref;
|
|
2752
|
+
return name === attributeName;
|
|
2855
2753
|
});
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
function deserializeSymbol(symbol) {
|
|
2859
|
-
switch (symbol.type) {
|
|
2860
|
-
case 'circlePointSymbol':
|
|
2861
|
-
return deserializePointSymbol(symbol);
|
|
2862
|
-
|
|
2863
|
-
case 'squarePointSymbol':
|
|
2864
|
-
return deserializeSquareSymbol(symbol);
|
|
2865
|
-
|
|
2866
|
-
case 'maskedImagePointSymbol':
|
|
2867
|
-
return deserializeMaskedImageSymbol(symbol);
|
|
2868
|
-
|
|
2869
|
-
case 'imagePointSymbol':
|
|
2870
|
-
return deserializeImagePointSymbol(symbol);
|
|
2871
|
-
|
|
2872
|
-
case 'polygonSymbol':
|
|
2873
|
-
return deserializePolygonSymbol(symbol);
|
|
2874
|
-
|
|
2875
|
-
case 'simplePolylineSymbol':
|
|
2876
|
-
case 'polylineSymbol':
|
|
2877
|
-
return deserializePolylineSymbol(symbol);
|
|
2878
|
-
|
|
2879
|
-
default:
|
|
2880
|
-
return null;
|
|
2881
|
-
}
|
|
2882
|
-
}
|
|
2883
|
-
|
|
2884
|
-
function deserializePointSymbol(symbol) {
|
|
2885
|
-
// @ts-ignore
|
|
2886
|
-
return new Point.PointSymbol(deserializePointSymbolParams(symbol));
|
|
2887
|
-
}
|
|
2888
|
-
|
|
2889
|
-
function deserializeSquareSymbol(symbol) {
|
|
2890
|
-
return new Square.SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
|
|
2891
|
-
// @ts-ignore
|
|
2892
|
-
angle: getParameterValue(symbol.angle)
|
|
2893
|
-
}));
|
|
2894
|
-
}
|
|
2895
|
-
|
|
2896
|
-
function deserializeMaskedImageSymbol(symbol) {
|
|
2897
|
-
return new MaskedImage.MaskedImage(_extends({}, symbol, {
|
|
2898
|
-
// @ts-ignore
|
|
2899
|
-
angle: getParameterValue(symbol.angle),
|
|
2900
|
-
// @ts-ignore
|
|
2901
|
-
width: getParameterValue(symbol.width),
|
|
2902
|
-
// @ts-ignore
|
|
2903
|
-
height: getParameterValue(symbol.height),
|
|
2904
|
-
// @ts-ignore
|
|
2905
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2906
|
-
// @ts-ignore
|
|
2907
|
-
imageSource: deserializeBase64(symbol.image),
|
|
2908
|
-
// @ts-ignore
|
|
2909
|
-
maskSource: deserializeBase64(symbol.imageMask),
|
|
2910
|
-
// @ts-ignore
|
|
2911
|
-
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2912
|
-
}));
|
|
2913
|
-
}
|
|
2914
|
-
|
|
2915
|
-
function deserializeImagePointSymbol(symbol) {
|
|
2916
|
-
return new StaticImageSymbol.StaticImageSymbol(_extends({}, symbol, {
|
|
2917
|
-
// @ts-ignore
|
|
2918
|
-
angle: getParameterValue(symbol.angle),
|
|
2919
|
-
// @ts-ignore
|
|
2920
|
-
width: getParameterValue(symbol.width),
|
|
2921
|
-
// @ts-ignore
|
|
2922
|
-
height: getParameterValue(symbol.height),
|
|
2923
|
-
// @ts-ignore
|
|
2924
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2925
|
-
// @ts-ignore
|
|
2926
|
-
source: deserializeBase64(symbol.image)
|
|
2927
|
-
}));
|
|
2928
|
-
}
|
|
2929
|
-
|
|
2930
|
-
function deserializePolygonSymbol(symbol) {
|
|
2931
|
-
if (isPolygonHasPatternBrush(symbol)) {
|
|
2932
|
-
return new SGisImageFill(symbol);
|
|
2933
|
-
}
|
|
2934
|
-
|
|
2935
|
-
if (isPolygonHasHatchBrush(symbol)) {
|
|
2936
|
-
return new SGisBrushFill(symbol);
|
|
2937
|
-
}
|
|
2938
|
-
|
|
2939
|
-
return new SGisPolygonSymbol(symbol);
|
|
2940
|
-
}
|
|
2941
|
-
|
|
2942
|
-
function deserializePolylineSymbol(symbol) {
|
|
2943
|
-
return new SGisPolylineSymbol(symbol);
|
|
2944
|
-
}
|
|
2945
|
-
|
|
2946
|
-
function deserializePointSymbolParams(_ref) {
|
|
2947
|
-
let {
|
|
2948
|
-
size,
|
|
2949
|
-
offset,
|
|
2950
|
-
strokeColor,
|
|
2951
|
-
strokeWidth,
|
|
2952
|
-
fillColor
|
|
2953
|
-
} = _ref;
|
|
2954
|
-
return {
|
|
2955
|
-
size: getParameterValue(size),
|
|
2956
|
-
offset: deserializeAnchor(offset),
|
|
2957
|
-
strokeWidth: getParameterValue(strokeWidth),
|
|
2958
|
-
strokeColor: deserializeColor(getParameterValue(strokeColor)),
|
|
2959
|
-
fillColor: deserializeColor(getParameterValue(fillColor))
|
|
2960
|
-
};
|
|
2961
|
-
}
|
|
2962
|
-
|
|
2963
|
-
function deserializeBase64(base) {
|
|
2964
|
-
return "data:image/png;base64," + base;
|
|
2965
|
-
}
|
|
2966
|
-
|
|
2967
|
-
function deserializeAnchor(offset) {
|
|
2968
|
-
// @ts-ignore
|
|
2969
|
-
return offset.map(getParameterValue);
|
|
2970
|
-
}
|
|
2971
|
-
|
|
2972
|
-
function deserializeColor(color$1) {
|
|
2973
|
-
return color$1 ? new color.Color(color$1).toString() : null;
|
|
2974
|
-
}
|
|
2975
|
-
|
|
2976
|
-
const clampSymbol = (symbol, min, max) => {
|
|
2977
|
-
if (isSGisImageSymbol(symbol)) {
|
|
2978
|
-
symbol.width = clamp(symbol.width, min, max);
|
|
2979
|
-
symbol.height = clamp(symbol.height, min, max);
|
|
2980
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
2981
|
-
symbol.size = clamp(symbol.size, min, max);
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
|
-
return symbol;
|
|
2985
|
-
};
|
|
2986
|
-
function centerAlignSymbol(symbol) {
|
|
2987
|
-
if (isSGisImageSymbol(symbol)) {
|
|
2988
|
-
symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
|
|
2989
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
2990
|
-
symbol.offset = [0, 0];
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
|
-
return symbol;
|
|
2994
|
-
}
|
|
2995
|
-
const adjustSymbol = (symbol, _ref) => {
|
|
2996
|
-
let {
|
|
2997
|
-
size
|
|
2998
|
-
} = _ref;
|
|
2999
|
-
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
3000
|
-
};
|
|
3001
|
-
|
|
3002
|
-
let EvergisFeature = /*#__PURE__*/function () {
|
|
3003
|
-
function EvergisFeature(feature) {
|
|
3004
|
-
_classCallCheck(this, EvergisFeature);
|
|
3005
|
-
|
|
3006
|
-
this.id = null;
|
|
3007
|
-
this.displayName = null;
|
|
3008
|
-
this.geometry = null;
|
|
3009
|
-
this.layerName = null;
|
|
3010
|
-
this.layerAlias = null;
|
|
3011
|
-
this.attributes = null;
|
|
3012
|
-
this.symbol = null;
|
|
3013
|
-
this.id = feature.id;
|
|
3014
|
-
this.displayName = feature.id;
|
|
3015
|
-
this.geometry = feature.geometry;
|
|
3016
|
-
this.layerName = feature.layer;
|
|
3017
|
-
this.layerAlias = feature.layer;
|
|
3018
|
-
this.attributes = getFeatureAttributes(feature.attributes);
|
|
3019
|
-
}
|
|
3020
|
-
|
|
3021
|
-
_createClass(EvergisFeature, [{
|
|
3022
|
-
key: "sGisFeature",
|
|
3023
|
-
value: function sGisFeature() {
|
|
3024
|
-
if (!this.geometry || !this.symbol) {
|
|
3025
|
-
return null;
|
|
3026
|
-
} // @ts-ignore
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
const {
|
|
3030
|
-
type,
|
|
3031
|
-
coordinates,
|
|
3032
|
-
sr
|
|
3033
|
-
} = this.geometry;
|
|
3034
|
-
const crs = CRS_MAP[sr];
|
|
3035
|
-
|
|
3036
|
-
if (!crs) {
|
|
3037
|
-
return null;
|
|
3038
|
-
}
|
|
3039
|
-
|
|
3040
|
-
switch (type) {
|
|
3041
|
-
case api.GeometryType.Point:
|
|
3042
|
-
return new PointFeature.PointFeature(coordinates, {
|
|
3043
|
-
symbol: selectedPoint,
|
|
3044
|
-
crs
|
|
3045
|
-
});
|
|
3046
|
-
|
|
3047
|
-
case api.GeometryType.Multipoint:
|
|
3048
|
-
return new MultiPoint.MultiPoint(coordinates, {
|
|
3049
|
-
symbol: selectedPoint,
|
|
3050
|
-
crs
|
|
3051
|
-
});
|
|
3052
|
-
|
|
3053
|
-
case api.GeometryType.Polyline:
|
|
3054
|
-
return new Polyline.Polyline(coordinates, {
|
|
3055
|
-
symbol: selectedPolyline,
|
|
3056
|
-
crs
|
|
3057
|
-
});
|
|
3058
|
-
|
|
3059
|
-
case api.GeometryType.Polygon:
|
|
3060
|
-
return new Polygon.Polygon(coordinates, {
|
|
3061
|
-
symbol: selectedPolygon,
|
|
3062
|
-
crs
|
|
3063
|
-
});
|
|
3064
|
-
|
|
3065
|
-
default:
|
|
3066
|
-
return null;
|
|
3067
|
-
}
|
|
3068
|
-
}
|
|
3069
|
-
}, {
|
|
3070
|
-
key: "extent",
|
|
3071
|
-
value: function extent() {
|
|
3072
|
-
const feature = this.sGisFeature();
|
|
3073
|
-
return feature && feature.bbox;
|
|
3074
|
-
}
|
|
3075
|
-
}]);
|
|
3076
|
-
|
|
3077
|
-
return EvergisFeature;
|
|
3078
|
-
}();
|
|
3079
|
-
|
|
3080
|
-
function evaluateCondition(condition$1, attributes) {
|
|
3081
|
-
try {
|
|
3082
|
-
const evaluator = new condition.ConditionEvaluator(attributes);
|
|
3083
|
-
const result = evaluator.evaluate(condition$1);
|
|
3084
|
-
|
|
3085
|
-
if (result instanceof Error) {
|
|
3086
|
-
return null;
|
|
3087
|
-
}
|
|
3088
|
-
|
|
3089
|
-
return result;
|
|
3090
|
-
} catch (_unused) {
|
|
3091
|
-
return null;
|
|
3092
|
-
}
|
|
3093
|
-
}
|
|
3094
|
-
|
|
3095
|
-
function getAttributeValue(attributes, attributeName) {
|
|
3096
|
-
const attributeMeta = attributes.find(_ref => {
|
|
3097
|
-
let {
|
|
3098
|
-
name
|
|
3099
|
-
} = _ref;
|
|
3100
|
-
return name === attributeName;
|
|
3101
|
-
});
|
|
3102
|
-
return attributeMeta ? attributeMeta.value : null;
|
|
2754
|
+
return attributeMeta ? attributeMeta.value : null;
|
|
3103
2755
|
}
|
|
3104
2756
|
|
|
3105
2757
|
const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
|
|
@@ -3107,7 +2759,7 @@ const getAttributeNameFromClassified = values => values.length > 0 ? getAttribut
|
|
|
3107
2759
|
|
|
3108
2760
|
function findFeatureValue(parameterValues, _ref2) {
|
|
3109
2761
|
let [name, value] = _ref2;
|
|
3110
|
-
return value !== null ? parameterValues.find(_ref3 => {
|
|
2762
|
+
return value !== null ? parameterValues.find((_ref3) => {
|
|
3111
2763
|
let {
|
|
3112
2764
|
condition
|
|
3113
2765
|
} = _ref3;
|
|
@@ -3147,7 +2799,7 @@ function evaluateFeatureSymbol(attributes) {
|
|
|
3147
2799
|
}
|
|
3148
2800
|
|
|
3149
2801
|
function findChildFeatureStyle(childStyles, attributes) {
|
|
3150
|
-
return (childStyles || []).find(_ref5 => {
|
|
2802
|
+
return (childStyles || []).find((_ref5) => {
|
|
3151
2803
|
let {
|
|
3152
2804
|
condition
|
|
3153
2805
|
} = _ref5;
|
|
@@ -3208,7 +2860,7 @@ let EvergisLayer = /*#__PURE__*/function () {
|
|
|
3208
2860
|
feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
|
|
3209
2861
|
feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
|
|
3210
2862
|
feature.layerAlias = this.alias;
|
|
3211
|
-
const titleAttribute = (feature.attributes || []).find(_ref => {
|
|
2863
|
+
const titleAttribute = (feature.attributes || []).find((_ref) => {
|
|
3212
2864
|
let {
|
|
3213
2865
|
name
|
|
3214
2866
|
} = _ref;
|
|
@@ -3231,7 +2883,7 @@ const evaluateFeature = layers => feature => {
|
|
|
3231
2883
|
};
|
|
3232
2884
|
|
|
3233
2885
|
const OTHERS_TITLE = 'Другое';
|
|
3234
|
-
const createLegendItem = _ref => {
|
|
2886
|
+
const createLegendItem = (_ref) => {
|
|
3235
2887
|
let {
|
|
3236
2888
|
attributes,
|
|
3237
2889
|
renderTitle,
|
|
@@ -3273,7 +2925,7 @@ function createStyleLegend(style, config) {
|
|
|
3273
2925
|
classificationManager,
|
|
3274
2926
|
symbol
|
|
3275
2927
|
} = style;
|
|
3276
|
-
const items = classificationManager.filter(_ref => {
|
|
2928
|
+
const items = classificationManager.filter((_ref) => {
|
|
3277
2929
|
let {
|
|
3278
2930
|
parameter
|
|
3279
2931
|
} = _ref;
|
|
@@ -3390,7 +3042,7 @@ const useMapLegend = (layer, config) => {
|
|
|
3390
3042
|
};
|
|
3391
3043
|
|
|
3392
3044
|
const LEGEND_SYMBOL_MAX_SIZE = 32;
|
|
3393
|
-
const useLegendValueSymbol = _ref => {
|
|
3045
|
+
const useLegendValueSymbol = (_ref) => {
|
|
3394
3046
|
let {
|
|
3395
3047
|
parameter,
|
|
3396
3048
|
parameterValue
|
|
@@ -3588,7 +3240,8 @@ function useEvergisTileLayer(_ref) {
|
|
|
3588
3240
|
subDomains,
|
|
3589
3241
|
zIndex,
|
|
3590
3242
|
isDisplayed,
|
|
3591
|
-
crs
|
|
3243
|
+
crs,
|
|
3244
|
+
opacity
|
|
3592
3245
|
} = _ref;
|
|
3593
3246
|
const api$1 = useEvergisContext();
|
|
3594
3247
|
const {
|
|
@@ -3597,9 +3250,10 @@ function useEvergisTileLayer(_ref) {
|
|
|
3597
3250
|
const layer = React.useMemo(() => new api.EvergisTileLayer({
|
|
3598
3251
|
name,
|
|
3599
3252
|
subDomains,
|
|
3600
|
-
crs
|
|
3253
|
+
crs,
|
|
3254
|
+
opacity
|
|
3601
3255
|
}, api$1), // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3602
|
-
[name, subDomains, crs]);
|
|
3256
|
+
[name, subDomains, crs, opacity]);
|
|
3603
3257
|
React.useEffect(() => () => {
|
|
3604
3258
|
map.indexOf(layer) !== -1 && map.removeLayer(layer);
|
|
3605
3259
|
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -3783,7 +3437,7 @@ function useMapWrapper() {
|
|
|
3783
3437
|
return wrapperRef;
|
|
3784
3438
|
}
|
|
3785
3439
|
|
|
3786
|
-
const byScale = scale => _ref => {
|
|
3440
|
+
const byScale = scale => (_ref) => {
|
|
3787
3441
|
let {
|
|
3788
3442
|
zIndex
|
|
3789
3443
|
} = _ref;
|
|
@@ -3982,7 +3636,7 @@ const useTooltip = function useTooltip(zIndex) {
|
|
|
3982
3636
|
|
|
3983
3637
|
return reset;
|
|
3984
3638
|
}, [reset, map, layer, zIndex]);
|
|
3985
|
-
const onSetLabelFeature = React.useCallback(_ref => {
|
|
3639
|
+
const onSetLabelFeature = React.useCallback((_ref) => {
|
|
3986
3640
|
let {
|
|
3987
3641
|
point,
|
|
3988
3642
|
position,
|
|
@@ -4146,7 +3800,7 @@ function useClusterLayer(_ref) {
|
|
|
4146
3800
|
}
|
|
4147
3801
|
|
|
4148
3802
|
const INIT_FEATURES = [];
|
|
4149
|
-
const useEvergisSelect = _ref => {
|
|
3803
|
+
const useEvergisSelect = (_ref) => {
|
|
4150
3804
|
let {
|
|
4151
3805
|
onPick,
|
|
4152
3806
|
onFeatures
|
|
@@ -4179,7 +3833,7 @@ function none() {
|
|
|
4179
3833
|
return;
|
|
4180
3834
|
}
|
|
4181
3835
|
|
|
4182
|
-
const useDraggableMarker = _ref => {
|
|
3836
|
+
const useDraggableMarker = (_ref) => {
|
|
4183
3837
|
let {
|
|
4184
3838
|
position,
|
|
4185
3839
|
onChange,
|
|
@@ -4295,7 +3949,7 @@ const useDebouncedCallback = interval => {
|
|
|
4295
3949
|
}, interval), [interval]);
|
|
4296
3950
|
};
|
|
4297
3951
|
|
|
4298
|
-
const Symbol = _ref => {
|
|
3952
|
+
const Symbol = (_ref) => {
|
|
4299
3953
|
let {
|
|
4300
3954
|
symbol,
|
|
4301
3955
|
size,
|
|
@@ -4316,7 +3970,7 @@ const Symbol = _ref => {
|
|
|
4316
3970
|
};
|
|
4317
3971
|
|
|
4318
3972
|
var _templateObject;
|
|
4319
|
-
const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), _ref => {
|
|
3973
|
+
const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), (_ref) => {
|
|
4320
3974
|
let {
|
|
4321
3975
|
geometryType,
|
|
4322
3976
|
icons
|
|
@@ -4325,7 +3979,7 @@ const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templ
|
|
|
4325
3979
|
});
|
|
4326
3980
|
|
|
4327
3981
|
const MAX_SIZE = 32;
|
|
4328
|
-
const StyleSymbol = _ref => {
|
|
3982
|
+
const StyleSymbol = (_ref) => {
|
|
4329
3983
|
let {
|
|
4330
3984
|
symbol,
|
|
4331
3985
|
size = MAX_SIZE,
|
|
@@ -4370,7 +4024,7 @@ const CloseIcon = /*#__PURE__*/styled__default(ui.Icon)(_templateObject20 || (_t
|
|
|
4370
4024
|
const PrevIcon = /*#__PURE__*/styled__default(ui.Icon)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
|
|
4371
4025
|
const NextIcon = /*#__PURE__*/styled__default(ui.Icon)(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
|
|
4372
4026
|
|
|
4373
|
-
const MailValue = _ref => {
|
|
4027
|
+
const MailValue = (_ref) => {
|
|
4374
4028
|
let {
|
|
4375
4029
|
mail
|
|
4376
4030
|
} = _ref;
|
|
@@ -4381,7 +4035,7 @@ const MailValue = _ref => {
|
|
|
4381
4035
|
}, mail);
|
|
4382
4036
|
};
|
|
4383
4037
|
|
|
4384
|
-
const PhoneValue = _ref => {
|
|
4038
|
+
const PhoneValue = (_ref) => {
|
|
4385
4039
|
let {
|
|
4386
4040
|
phone
|
|
4387
4041
|
} = _ref;
|
|
@@ -4392,7 +4046,7 @@ const PhoneValue = _ref => {
|
|
|
4392
4046
|
}, phone);
|
|
4393
4047
|
};
|
|
4394
4048
|
|
|
4395
|
-
const UrlValue = _ref => {
|
|
4049
|
+
const UrlValue = (_ref) => {
|
|
4396
4050
|
let {
|
|
4397
4051
|
url
|
|
4398
4052
|
} = _ref;
|
|
@@ -4403,7 +4057,7 @@ const UrlValue = _ref => {
|
|
|
4403
4057
|
}, url);
|
|
4404
4058
|
};
|
|
4405
4059
|
|
|
4406
|
-
const AttributeValue = _ref => {
|
|
4060
|
+
const AttributeValue = (_ref) => {
|
|
4407
4061
|
let {
|
|
4408
4062
|
attribute
|
|
4409
4063
|
} = _ref;
|
|
@@ -4417,29 +4071,29 @@ const AttributeValue = _ref => {
|
|
|
4417
4071
|
if (attributeValue.type === 2
|
|
4418
4072
|
/* Url */
|
|
4419
4073
|
) {
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4074
|
+
return React__default.createElement(UrlValue, {
|
|
4075
|
+
key: key,
|
|
4076
|
+
url: punycodeDecode(value)
|
|
4077
|
+
});
|
|
4078
|
+
}
|
|
4425
4079
|
|
|
4426
4080
|
if (attributeValue.type === 3
|
|
4427
4081
|
/* Mail */
|
|
4428
4082
|
) {
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4083
|
+
return React__default.createElement(MailValue, {
|
|
4084
|
+
key: key,
|
|
4085
|
+
mail: value
|
|
4086
|
+
});
|
|
4087
|
+
}
|
|
4434
4088
|
|
|
4435
4089
|
if (attributeValue.type === 1
|
|
4436
4090
|
/* Phone */
|
|
4437
4091
|
) {
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4092
|
+
return React__default.createElement(PhoneValue, {
|
|
4093
|
+
key: key,
|
|
4094
|
+
phone: value
|
|
4095
|
+
});
|
|
4096
|
+
}
|
|
4443
4097
|
|
|
4444
4098
|
return React__default.createElement(SimpleAttribute, {
|
|
4445
4099
|
key: value
|
|
@@ -4455,7 +4109,7 @@ function punycodeDecode(domains) {
|
|
|
4455
4109
|
}
|
|
4456
4110
|
}
|
|
4457
4111
|
|
|
4458
|
-
const EvergisCardAttribute = _ref => {
|
|
4112
|
+
const EvergisCardAttribute = (_ref) => {
|
|
4459
4113
|
let {
|
|
4460
4114
|
attribute,
|
|
4461
4115
|
className
|
|
@@ -4467,7 +4121,7 @@ const EvergisCardAttribute = _ref => {
|
|
|
4467
4121
|
}));
|
|
4468
4122
|
};
|
|
4469
4123
|
|
|
4470
|
-
const StyledCard = _ref => {
|
|
4124
|
+
const StyledCard = (_ref) => {
|
|
4471
4125
|
let {
|
|
4472
4126
|
features = [],
|
|
4473
4127
|
className,
|
|
@@ -4518,7 +4172,7 @@ const StyledCard = _ref => {
|
|
|
4518
4172
|
};
|
|
4519
4173
|
|
|
4520
4174
|
const _excluded$1 = ["renderCard", "className", "children"];
|
|
4521
|
-
const EvergisCard = _ref => {
|
|
4175
|
+
const EvergisCard = (_ref) => {
|
|
4522
4176
|
let {
|
|
4523
4177
|
renderCard,
|
|
4524
4178
|
className,
|
|
@@ -4570,7 +4224,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
|
|
|
4570
4224
|
|
|
4571
4225
|
const useSGisFeatures = (features, currentIndex) => React.useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
|
|
4572
4226
|
|
|
4573
|
-
const EvergisSelectLayer = _ref => {
|
|
4227
|
+
const EvergisSelectLayer = (_ref) => {
|
|
4574
4228
|
let {
|
|
4575
4229
|
features,
|
|
4576
4230
|
zIndex,
|
|
@@ -4615,7 +4269,7 @@ const TileLayer = props => {
|
|
|
4615
4269
|
};
|
|
4616
4270
|
|
|
4617
4271
|
const defaultZIndex = 200;
|
|
4618
|
-
const EvergisSelect = _ref => {
|
|
4272
|
+
const EvergisSelect = (_ref) => {
|
|
4619
4273
|
let {
|
|
4620
4274
|
onPick,
|
|
4621
4275
|
className,
|
|
@@ -4650,7 +4304,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled__default.p(_templateObject3$1 || (
|
|
|
4650
4304
|
const LegendValueContainer = /*#__PURE__*/styled__default.div(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n font-size: 0.625rem;\n padding: 0.125rem 0;\n\n ", " {\n padding-left: 0.5rem;\n }\n"])), LegendSymbolTitle);
|
|
4651
4305
|
const LegendSectionHeader = /*#__PURE__*/styled__default.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])));
|
|
4652
4306
|
|
|
4653
|
-
const LegendSection = _ref => {
|
|
4307
|
+
const LegendSection = (_ref) => {
|
|
4654
4308
|
let {
|
|
4655
4309
|
item,
|
|
4656
4310
|
renderLegendTitle,
|
|
@@ -4667,7 +4321,7 @@ SearchPrefix.defaultProps = {
|
|
|
4667
4321
|
kind: "search"
|
|
4668
4322
|
};
|
|
4669
4323
|
|
|
4670
|
-
const SearchInput = _ref => {
|
|
4324
|
+
const SearchInput = (_ref) => {
|
|
4671
4325
|
let {
|
|
4672
4326
|
onChange
|
|
4673
4327
|
} = _ref;
|
|
@@ -4676,7 +4330,7 @@ const SearchInput = _ref => {
|
|
|
4676
4330
|
}));
|
|
4677
4331
|
};
|
|
4678
4332
|
|
|
4679
|
-
const LegendSymbol = _ref => {
|
|
4333
|
+
const LegendSymbol = (_ref) => {
|
|
4680
4334
|
let {
|
|
4681
4335
|
parameter,
|
|
4682
4336
|
parameterValue,
|
|
@@ -4694,7 +4348,7 @@ const LegendSymbol = _ref => {
|
|
|
4694
4348
|
return React__default.createElement(React__default.Fragment, null, children(symbol));
|
|
4695
4349
|
};
|
|
4696
4350
|
|
|
4697
|
-
const LegendValue = _ref => {
|
|
4351
|
+
const LegendValue = (_ref) => {
|
|
4698
4352
|
let {
|
|
4699
4353
|
value,
|
|
4700
4354
|
parameter,
|
|
@@ -4716,7 +4370,7 @@ const getNumberParam = (parameterValue, param) => {
|
|
|
4716
4370
|
return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
|
|
4717
4371
|
};
|
|
4718
4372
|
|
|
4719
|
-
const getSymbolSize = _ref => {
|
|
4373
|
+
const getSymbolSize = (_ref) => {
|
|
4720
4374
|
let {
|
|
4721
4375
|
parameterValue,
|
|
4722
4376
|
maxSize
|
|
@@ -4741,7 +4395,7 @@ const getSymbolSize = _ref => {
|
|
|
4741
4395
|
}
|
|
4742
4396
|
};
|
|
4743
4397
|
|
|
4744
|
-
const Legend = _ref => {
|
|
4398
|
+
const Legend = (_ref) => {
|
|
4745
4399
|
let {
|
|
4746
4400
|
layer,
|
|
4747
4401
|
children,
|
|
@@ -4784,7 +4438,7 @@ const Legend = _ref => {
|
|
|
4784
4438
|
})))));
|
|
4785
4439
|
};
|
|
4786
4440
|
|
|
4787
|
-
const Map = _ref => {
|
|
4441
|
+
const Map = (_ref) => {
|
|
4788
4442
|
let {
|
|
4789
4443
|
className,
|
|
4790
4444
|
position,
|
|
@@ -4806,163 +4460,488 @@ const Map = _ref => {
|
|
|
4806
4460
|
})) {
|
|
4807
4461
|
onBboxChange(state);
|
|
4808
4462
|
}
|
|
4809
|
-
}, [map, onBboxChange, position, resolution]);
|
|
4810
|
-
useUpdateMapView({
|
|
4811
|
-
position,
|
|
4812
|
-
resolution
|
|
4813
|
-
});
|
|
4814
|
-
useMaxMinScale(minScale, maxScale, position, resolution);
|
|
4815
|
-
useMapBboxChange(handleBboxChange);
|
|
4816
|
-
return React__default.createElement("div", {
|
|
4817
|
-
className: className,
|
|
4818
|
-
ref: wrapperRef,
|
|
4819
|
-
style: style
|
|
4820
|
-
}, children);
|
|
4821
|
-
};
|
|
4822
|
-
|
|
4823
|
-
var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
|
|
4824
|
-
|
|
4825
|
-
const topLeft = distance => styled.css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4463
|
+
}, [map, onBboxChange, position, resolution]);
|
|
4464
|
+
useUpdateMapView({
|
|
4465
|
+
position,
|
|
4466
|
+
resolution
|
|
4467
|
+
});
|
|
4468
|
+
useMaxMinScale(minScale, maxScale, position, resolution);
|
|
4469
|
+
useMapBboxChange(handleBboxChange);
|
|
4470
|
+
return React__default.createElement("div", {
|
|
4471
|
+
className: className,
|
|
4472
|
+
ref: wrapperRef,
|
|
4473
|
+
style: style
|
|
4474
|
+
}, children);
|
|
4475
|
+
};
|
|
4476
|
+
|
|
4477
|
+
var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
|
|
4478
|
+
|
|
4479
|
+
const topLeft = distance => styled.css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4480
|
+
|
|
4481
|
+
const topRight = distance => styled.css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n top: ", ";\n right: ", ";\n"])), distance, distance);
|
|
4482
|
+
|
|
4483
|
+
const bottomLeft = distance => styled.css(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4484
|
+
|
|
4485
|
+
const bottomRight = distance => styled.css(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n right: ", ";\n"])), distance, distance);
|
|
4486
|
+
|
|
4487
|
+
const placementMixin = function placementMixin(placement, distance) {
|
|
4488
|
+
if (placement === void 0) {
|
|
4489
|
+
placement = 'bottom-left';
|
|
4490
|
+
}
|
|
4491
|
+
|
|
4492
|
+
if (distance === void 0) {
|
|
4493
|
+
distance = '1rem';
|
|
4494
|
+
}
|
|
4495
|
+
|
|
4496
|
+
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));
|
|
4497
|
+
};
|
|
4498
|
+
|
|
4499
|
+
var _templateObject$5, _templateObject2$4, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$1, _templateObject7$1, _templateObject8$1;
|
|
4500
|
+
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"])));
|
|
4501
|
+
const ZoomInBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4502
|
+
ZoomInBtn.defaultProps = {
|
|
4503
|
+
kind: "plus"
|
|
4504
|
+
};
|
|
4505
|
+
const ZoomOutBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4506
|
+
ZoomOutBtn.defaultProps = {
|
|
4507
|
+
kind: "minus"
|
|
4508
|
+
};
|
|
4509
|
+
const SearchBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4510
|
+
SearchBtn.defaultProps = {
|
|
4511
|
+
kind: "search"
|
|
4512
|
+
}; // TODO not exists in fonts
|
|
4513
|
+
|
|
4514
|
+
const FullscreenBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4515
|
+
FullscreenBtn.defaultProps = {
|
|
4516
|
+
kind: "maximize"
|
|
4517
|
+
};
|
|
4518
|
+
const MeasureBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4519
|
+
MeasureBtn.defaultProps = {
|
|
4520
|
+
kind: "measure_length"
|
|
4521
|
+
};
|
|
4522
|
+
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"])));
|
|
4523
|
+
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) => {
|
|
4524
|
+
let {
|
|
4525
|
+
vertical
|
|
4526
|
+
} = _ref;
|
|
4527
|
+
return vertical ? 'column' : 'row';
|
|
4528
|
+
}, (_ref2) => {
|
|
4529
|
+
let {
|
|
4530
|
+
placement
|
|
4531
|
+
} = _ref2;
|
|
4532
|
+
return placementMixin(placement);
|
|
4533
|
+
}, MapControl, (_ref3) => {
|
|
4534
|
+
let {
|
|
4535
|
+
vertical
|
|
4536
|
+
} = _ref3;
|
|
4537
|
+
return vertical ? '0.5rem' : '0';
|
|
4538
|
+
}, (_ref4) => {
|
|
4539
|
+
let {
|
|
4540
|
+
vertical
|
|
4541
|
+
} = _ref4;
|
|
4542
|
+
return vertical ? '0' : '0.5rem';
|
|
4543
|
+
}, (_ref5) => {
|
|
4544
|
+
let {
|
|
4545
|
+
vertical
|
|
4546
|
+
} = _ref5;
|
|
4547
|
+
return vertical ? 'column' : 'row';
|
|
4548
|
+
});
|
|
4549
|
+
|
|
4550
|
+
const Measure = () => {
|
|
4551
|
+
return React__default.createElement(MapControl, null, React__default.createElement(MeasureBtn, {
|
|
4552
|
+
onClick: () => {}
|
|
4553
|
+
}));
|
|
4554
|
+
};
|
|
4555
|
+
|
|
4556
|
+
const Search = () => {
|
|
4557
|
+
return React__default.createElement(MapControl, null, React__default.createElement(SearchBtn, {
|
|
4558
|
+
onClick: () => {}
|
|
4559
|
+
}));
|
|
4560
|
+
};
|
|
4561
|
+
|
|
4562
|
+
const Fullscreen = () => {
|
|
4563
|
+
return React__default.createElement(MapControl, null, React__default.createElement(FullscreenBtn, {
|
|
4564
|
+
onClick: () => {}
|
|
4565
|
+
}));
|
|
4566
|
+
};
|
|
4567
|
+
|
|
4568
|
+
var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4;
|
|
4569
|
+
const MapLegendControl = /*#__PURE__*/styled__default(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4570
|
+
const MapLegendContainer = /*#__PURE__*/styled__default.div(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 16.5rem;\n height: 3.875rem;\n align-items: center;\n padding: 0.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1rem;\n width: 0.835rem;\n }\n"])));
|
|
4571
|
+
const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
|
|
4572
|
+
const MapLegendSection = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
|
|
4573
|
+
const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0.5rem;\n font-size: 0.625rem;\n opacity: 0.65;\n"])));
|
|
4574
|
+
|
|
4575
|
+
const MAX_SIZE$2 = 100;
|
|
4576
|
+
const MapLegendSymbol = (_ref) => {
|
|
4577
|
+
let {
|
|
4578
|
+
value,
|
|
4579
|
+
parameter
|
|
4580
|
+
} = _ref;
|
|
4581
|
+
return React__default.createElement(LegendSymbol, {
|
|
4582
|
+
key: value.title,
|
|
4583
|
+
parameter: parameter,
|
|
4584
|
+
parameterValue: value.parameterValue
|
|
4585
|
+
}, symbol => React__default.createElement(Symbol, {
|
|
4586
|
+
render: getMapLegendSymbolRenders,
|
|
4587
|
+
symbol: symbol,
|
|
4588
|
+
size: MAX_SIZE$2
|
|
4589
|
+
}));
|
|
4590
|
+
};
|
|
4591
|
+
|
|
4592
|
+
const DEFAULT_FROM_TO = ['Выше', 'Ниже'];
|
|
4593
|
+
const MapLegend = (_ref) => {
|
|
4594
|
+
let {
|
|
4595
|
+
layer,
|
|
4596
|
+
config,
|
|
4597
|
+
fromToTitle = DEFAULT_FROM_TO,
|
|
4598
|
+
className
|
|
4599
|
+
} = _ref;
|
|
4600
|
+
const legend = useMapLegend(layer, config);
|
|
4601
|
+
|
|
4602
|
+
if (!legend) {
|
|
4603
|
+
return null;
|
|
4604
|
+
}
|
|
4605
|
+
|
|
4606
|
+
const {
|
|
4607
|
+
symbol,
|
|
4608
|
+
item
|
|
4609
|
+
} = legend;
|
|
4610
|
+
return React__default.createElement(LegendProvider, {
|
|
4611
|
+
symbol: symbol
|
|
4612
|
+
}, React__default.createElement(MapLegendControl, {
|
|
4613
|
+
className: className
|
|
4614
|
+
}, React__default.createElement(MapLegendContainer, null, React__default.createElement(MapLegendHeader, null, item.title), React__default.createElement(MapLegendSection, null, React__default.createElement(MapLegendValueDescr, null, fromToTitle[0]), item.values.map(value => React__default.createElement(MapLegendSymbol, {
|
|
4615
|
+
key: value.title,
|
|
4616
|
+
value: value,
|
|
4617
|
+
parameter: item.parameter
|
|
4618
|
+
})), React__default.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
|
|
4619
|
+
};
|
|
4620
|
+
|
|
4621
|
+
const DEFAULT_FORMATTERS = {
|
|
4622
|
+
polygon: formatPolygonMeasure,
|
|
4623
|
+
length: formatLength
|
|
4624
|
+
};
|
|
4625
|
+
|
|
4626
|
+
const COORD_FRACTION = 6;
|
|
4627
|
+
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
4628
|
+
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
4629
|
+
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
4630
|
+
|
|
4631
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
4632
|
+
|
|
4633
|
+
function BaseMeasureToolCreator(map, painter, params) {
|
|
4634
|
+
var _this;
|
|
4635
|
+
|
|
4636
|
+
_classCallCheck(this, BaseMeasureToolCreator);
|
|
4637
|
+
|
|
4638
|
+
_this = _super.call(this, map, params);
|
|
4639
|
+
|
|
4640
|
+
_this.cancel = () => {
|
|
4641
|
+
_this.fire('cancel');
|
|
4642
|
+
};
|
|
4643
|
+
|
|
4644
|
+
_this.painter = painter;
|
|
4645
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4646
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4647
|
+
_this.areaSymbol = params.areaSymbol;
|
|
4648
|
+
|
|
4649
|
+
_this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
|
|
4650
|
+
|
|
4651
|
+
|
|
4652
|
+
_this.on('change', _this.updateDistance);
|
|
4653
|
+
|
|
4654
|
+
return _this;
|
|
4655
|
+
}
|
|
4656
|
+
|
|
4657
|
+
_createClass(BaseMeasureToolCreator, [{
|
|
4658
|
+
key: "_handleMousemove",
|
|
4659
|
+
value: function _handleMousemove(event) {
|
|
4660
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_handleMousemove", this).call(this, event);
|
|
4661
|
+
|
|
4662
|
+
this.drawPointOnMouseMove(event);
|
|
4663
|
+
}
|
|
4664
|
+
}, {
|
|
4665
|
+
key: "_activate",
|
|
4666
|
+
value: function _activate() {
|
|
4667
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_activate", this).call(this);
|
|
4668
|
+
|
|
4669
|
+
this.addTempLabel();
|
|
4670
|
+
this.setCursor('pointer');
|
|
4671
|
+
}
|
|
4672
|
+
}, {
|
|
4673
|
+
key: "_deactivate",
|
|
4674
|
+
value: function _deactivate() {
|
|
4675
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_deactivate", this).call(this);
|
|
4676
|
+
|
|
4677
|
+
this.removeCoordLabel();
|
|
4678
|
+
this.removeTempLabel();
|
|
4679
|
+
this.removeMeasureLabel();
|
|
4680
|
+
this.removeTempPolygon();
|
|
4681
|
+
this.setCursor('default');
|
|
4682
|
+
}
|
|
4683
|
+
}, {
|
|
4684
|
+
key: "handlePointAdd",
|
|
4685
|
+
value: function handlePointAdd() {
|
|
4686
|
+
const feature = this.activeFeature;
|
|
4687
|
+
if (!feature) return;
|
|
4688
|
+
const {
|
|
4689
|
+
rings,
|
|
4690
|
+
crs
|
|
4691
|
+
} = feature;
|
|
4692
|
+
|
|
4693
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4694
|
+
this.finishDrawing();
|
|
4695
|
+
this.fire(new Control.DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
4696
|
+
return;
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
if (rings[0].length === 2) {
|
|
4700
|
+
const projection = crs.projectionTo(Crs.geo);
|
|
4701
|
+
const point = rings[0][0];
|
|
4702
|
+
if (!projection) return;
|
|
4703
|
+
const [lat, long] = projection(point);
|
|
4704
|
+
this.removeTempLabel();
|
|
4705
|
+
this.addMeasureResultLabel();
|
|
4706
|
+
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
4707
|
+
} else {
|
|
4708
|
+
this.removeCoordLabel();
|
|
4709
|
+
}
|
|
4710
|
+
}
|
|
4711
|
+
}, {
|
|
4712
|
+
key: "polygonPreview",
|
|
4713
|
+
value: function polygonPreview() {
|
|
4714
|
+
if (this.tempPolygon) {
|
|
4715
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
4716
|
+
}
|
|
4717
|
+
|
|
4718
|
+
const feature = this.activeFeature;
|
|
4719
|
+
if (!feature) return;
|
|
4720
|
+
const {
|
|
4721
|
+
rings,
|
|
4722
|
+
crs
|
|
4723
|
+
} = feature;
|
|
4724
|
+
const polygonRings = [...rings[0]];
|
|
4725
|
+
polygonRings.shift();
|
|
4726
|
+
this.tempPolygon = new Polygon.Polygon(polygonRings, {
|
|
4727
|
+
crs
|
|
4728
|
+
});
|
|
4729
|
+
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
4730
|
+
this.activeFeature && this.activeFeature.hide();
|
|
4731
|
+
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
4732
|
+
}
|
|
4733
|
+
}, {
|
|
4734
|
+
key: "removeTempPolygon",
|
|
4735
|
+
value: function removeTempPolygon() {
|
|
4736
|
+
if (this.tempPolygon) {
|
|
4737
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
4738
|
+
delete this.tempPolygon;
|
|
4739
|
+
}
|
|
4740
|
+
}
|
|
4741
|
+
}, {
|
|
4742
|
+
key: "updateDistance",
|
|
4743
|
+
value: function updateDistance(event) {
|
|
4744
|
+
const feature = this.activeFeature;
|
|
4745
|
+
const {
|
|
4746
|
+
ringIndex,
|
|
4747
|
+
pointIndex
|
|
4748
|
+
} = event;
|
|
4749
|
+
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
4750
|
+
const {
|
|
4751
|
+
rings,
|
|
4752
|
+
crs
|
|
4753
|
+
} = feature;
|
|
4754
|
+
const position = rings[ringIndex][pointIndex];
|
|
4755
|
+
const length = geotools.length(rings, crs);
|
|
4756
|
+
let content = this.formatters.length(length);
|
|
4757
|
+
|
|
4758
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4759
|
+
this.polygonPreview();
|
|
4760
|
+
const area = geotools.area(rings, crs);
|
|
4761
|
+
content = this.formatters.polygon(area, length);
|
|
4762
|
+
} else if (this.tempPolygon) {
|
|
4763
|
+
feature.show();
|
|
4764
|
+
this.removeTempPolygon();
|
|
4765
|
+
}
|
|
4766
|
+
|
|
4767
|
+
if (this.measureResultLabel) {
|
|
4768
|
+
this.measureResultLabel.position = position;
|
|
4769
|
+
this.measureResultLabel.content = content;
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4772
|
+
}, {
|
|
4773
|
+
key: "addTempLabel",
|
|
4774
|
+
value: function addTempLabel() {
|
|
4775
|
+
this.tempLabel = new Label.LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
4776
|
+
content: 'Нажмите на карту, чтобы начать измерение',
|
|
4777
|
+
crs: this.map.crs,
|
|
4778
|
+
symbol: createLabelSymbol({
|
|
4779
|
+
renderLabel: this.renderLabelSymbol
|
|
4780
|
+
})
|
|
4781
|
+
});
|
|
4782
|
+
this._tempLayer && this._tempLayer.add(this.tempLabel);
|
|
4783
|
+
}
|
|
4784
|
+
}, {
|
|
4785
|
+
key: "addCoordLabel",
|
|
4786
|
+
value: function addCoordLabel(content, position) {
|
|
4787
|
+
this.coordLabel = new Label.LabelFeature(position, {
|
|
4788
|
+
content,
|
|
4789
|
+
crs: this.map.crs,
|
|
4790
|
+
symbol: createLabelSymbol({
|
|
4791
|
+
renderLabel: this.renderLabelSymbol,
|
|
4792
|
+
onClose: this.cancel
|
|
4793
|
+
})
|
|
4794
|
+
});
|
|
4795
|
+
this._tempLayer && this.coordLabel && this._tempLayer.add(this.coordLabel);
|
|
4796
|
+
}
|
|
4797
|
+
}, {
|
|
4798
|
+
key: "addMeasureResultLabel",
|
|
4799
|
+
value: function addMeasureResultLabel() {
|
|
4800
|
+
this.measureResultLabel = new Label.LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
4801
|
+
crs: this.map.crs,
|
|
4802
|
+
symbol: createLabelSymbol({
|
|
4803
|
+
renderLabel: this.renderLabelSymbol
|
|
4804
|
+
})
|
|
4805
|
+
});
|
|
4806
|
+
this._tempLayer && this.measureResultLabel && this._tempLayer.add(this.measureResultLabel);
|
|
4807
|
+
}
|
|
4808
|
+
}, {
|
|
4809
|
+
key: "removeTempLabel",
|
|
4810
|
+
value: function removeTempLabel() {
|
|
4811
|
+
if (this.tempLabel) {
|
|
4812
|
+
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
4813
|
+
delete this.tempLabel;
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4816
|
+
}, {
|
|
4817
|
+
key: "removeCoordLabel",
|
|
4818
|
+
value: function removeCoordLabel() {
|
|
4819
|
+
if (this.coordLabel) {
|
|
4820
|
+
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
4821
|
+
delete this.coordLabel;
|
|
4822
|
+
}
|
|
4823
|
+
}
|
|
4824
|
+
}, {
|
|
4825
|
+
key: "removeMeasureLabel",
|
|
4826
|
+
value: function removeMeasureLabel() {
|
|
4827
|
+
if (this.measureResultLabel) {
|
|
4828
|
+
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
4829
|
+
delete this.measureResultLabel;
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
}, {
|
|
4833
|
+
key: "drawPointOnMouseMove",
|
|
4834
|
+
value: function drawPointOnMouseMove(event) {
|
|
4835
|
+
if (this.tempLabel) {
|
|
4836
|
+
this.tempLabel.position = event.point.position;
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4839
|
+
}, {
|
|
4840
|
+
key: "setCursor",
|
|
4841
|
+
value: function setCursor(cursor) {
|
|
4842
|
+
const {
|
|
4843
|
+
wrapper
|
|
4844
|
+
} = this.painter;
|
|
4826
4845
|
|
|
4827
|
-
|
|
4846
|
+
if (wrapper && typeof wrapper !== 'string') {
|
|
4847
|
+
wrapper.style.cursor = cursor;
|
|
4848
|
+
}
|
|
4849
|
+
}
|
|
4850
|
+
}]);
|
|
4828
4851
|
|
|
4829
|
-
|
|
4852
|
+
return BaseMeasureToolCreator;
|
|
4853
|
+
}(PolylineControl.PolylineControl);
|
|
4830
4854
|
|
|
4831
|
-
|
|
4855
|
+
let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
|
|
4856
|
+
_inherits(BaseMeasureToolEditor, _PolyEditor);
|
|
4832
4857
|
|
|
4833
|
-
|
|
4834
|
-
if (placement === void 0) {
|
|
4835
|
-
placement = 'bottom-left';
|
|
4836
|
-
}
|
|
4858
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
|
|
4837
4859
|
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
}
|
|
4860
|
+
function BaseMeasureToolEditor(map, painter, params) {
|
|
4861
|
+
var _this;
|
|
4841
4862
|
|
|
4842
|
-
|
|
4843
|
-
};
|
|
4863
|
+
_classCallCheck(this, BaseMeasureToolEditor);
|
|
4844
4864
|
|
|
4845
|
-
|
|
4846
|
-
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"])));
|
|
4847
|
-
const ZoomInBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4848
|
-
ZoomInBtn.defaultProps = {
|
|
4849
|
-
kind: "plus"
|
|
4850
|
-
};
|
|
4851
|
-
const ZoomOutBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4852
|
-
ZoomOutBtn.defaultProps = {
|
|
4853
|
-
kind: "minus"
|
|
4854
|
-
};
|
|
4855
|
-
const SearchBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4856
|
-
SearchBtn.defaultProps = {
|
|
4857
|
-
kind: "search"
|
|
4858
|
-
}; // TODO not exists in fonts
|
|
4865
|
+
_this = _super.call(this, map, params);
|
|
4859
4866
|
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
};
|
|
4868
|
-
const
|
|
4869
|
-
const
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
return placementMixin(placement);
|
|
4879
|
-
}, MapControl, _ref3 => {
|
|
4880
|
-
let {
|
|
4881
|
-
vertical
|
|
4882
|
-
} = _ref3;
|
|
4883
|
-
return vertical ? '0.5rem' : '0';
|
|
4884
|
-
}, _ref4 => {
|
|
4885
|
-
let {
|
|
4886
|
-
vertical
|
|
4887
|
-
} = _ref4;
|
|
4888
|
-
return vertical ? '0' : '0.5rem';
|
|
4889
|
-
}, _ref5 => {
|
|
4890
|
-
let {
|
|
4891
|
-
vertical
|
|
4892
|
-
} = _ref5;
|
|
4893
|
-
return vertical ? 'column' : 'row';
|
|
4894
|
-
});
|
|
4867
|
+
_this.measureResult = () => {
|
|
4868
|
+
const feature = _this.activeFeature;
|
|
4869
|
+
if (!feature) return null;
|
|
4870
|
+
const {
|
|
4871
|
+
rings,
|
|
4872
|
+
isEnclosed,
|
|
4873
|
+
crs
|
|
4874
|
+
} = feature;
|
|
4875
|
+
const pointsCount = rings[0].length;
|
|
4876
|
+
const position = rings[0][pointsCount - 1];
|
|
4877
|
+
const area = geotools.area(rings, crs);
|
|
4878
|
+
const length = geotools.length(rings, crs, isEnclosed);
|
|
4879
|
+
const content = isEnclosed ? _this.formatters.polygon(area, length) : _this.formatters.length(length);
|
|
4880
|
+
return {
|
|
4881
|
+
content,
|
|
4882
|
+
position
|
|
4883
|
+
};
|
|
4884
|
+
};
|
|
4895
4885
|
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
}));
|
|
4900
|
-
};
|
|
4886
|
+
_this.removeFeature = () => {
|
|
4887
|
+
_this.fire('remove');
|
|
4888
|
+
};
|
|
4901
4889
|
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
}));
|
|
4906
|
-
};
|
|
4890
|
+
_this.painter = painter;
|
|
4891
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4892
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4907
4893
|
|
|
4908
|
-
|
|
4909
|
-
return React__default.createElement(MapControl, null, React__default.createElement(FullscreenBtn, {
|
|
4910
|
-
onClick: () => {}
|
|
4911
|
-
}));
|
|
4912
|
-
};
|
|
4894
|
+
_this.on('change', _this.updateMeasureResult);
|
|
4913
4895
|
|
|
4914
|
-
|
|
4915
|
-
const MapLegendControl = /*#__PURE__*/styled__default(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4916
|
-
const MapLegendContainer = /*#__PURE__*/styled__default.div(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 16.5rem;\n height: 3.875rem;\n align-items: center;\n padding: 0.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1rem;\n width: 0.835rem;\n }\n"])));
|
|
4917
|
-
const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
|
|
4918
|
-
const MapLegendSection = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
|
|
4919
|
-
const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0.5rem;\n font-size: 0.625rem;\n opacity: 0.65;\n"])));
|
|
4896
|
+
_this.on('edit', _this.updateMeasureResult);
|
|
4920
4897
|
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
let {
|
|
4924
|
-
value,
|
|
4925
|
-
parameter
|
|
4926
|
-
} = _ref;
|
|
4927
|
-
return React__default.createElement(LegendSymbol, {
|
|
4928
|
-
key: value.title,
|
|
4929
|
-
parameter: parameter,
|
|
4930
|
-
parameterValue: value.parameterValue
|
|
4931
|
-
}, symbol => React__default.createElement(Symbol, {
|
|
4932
|
-
render: getMapLegendSymbolRenders,
|
|
4933
|
-
symbol: symbol,
|
|
4934
|
-
size: MAX_SIZE$2
|
|
4935
|
-
}));
|
|
4936
|
-
};
|
|
4898
|
+
return _this;
|
|
4899
|
+
}
|
|
4937
4900
|
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
config,
|
|
4943
|
-
fromToTitle = DEFAULT_FROM_TO,
|
|
4944
|
-
className
|
|
4945
|
-
} = _ref;
|
|
4946
|
-
const legend = useMapLegend(layer, config);
|
|
4901
|
+
_createClass(BaseMeasureToolEditor, [{
|
|
4902
|
+
key: "_activate",
|
|
4903
|
+
value: function _activate() {
|
|
4904
|
+
_get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
|
|
4947
4905
|
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
}
|
|
4906
|
+
this.addMeasureResultLabel();
|
|
4907
|
+
}
|
|
4908
|
+
}, {
|
|
4909
|
+
key: "addMeasureResultLabel",
|
|
4910
|
+
value: function addMeasureResultLabel() {
|
|
4911
|
+
const measureResult = this.measureResult();
|
|
4912
|
+
if (measureResult === null) return;
|
|
4913
|
+
const {
|
|
4914
|
+
content,
|
|
4915
|
+
position
|
|
4916
|
+
} = measureResult;
|
|
4917
|
+
this.measureResultLabel = new Label.LabelFeature(position, {
|
|
4918
|
+
content,
|
|
4919
|
+
crs: this.map.crs,
|
|
4920
|
+
symbol: createLabelSymbol({
|
|
4921
|
+
onClose: this.removeFeature,
|
|
4922
|
+
renderLabel: this.renderLabelSymbol
|
|
4923
|
+
})
|
|
4924
|
+
});
|
|
4925
|
+
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
4926
|
+
}
|
|
4927
|
+
}, {
|
|
4928
|
+
key: "updateMeasureResult",
|
|
4929
|
+
value: function updateMeasureResult() {
|
|
4930
|
+
if (this.measureResultLabel) {
|
|
4931
|
+
const measureResult = this.measureResult();
|
|
4932
|
+
if (measureResult === null) return;
|
|
4933
|
+
const {
|
|
4934
|
+
content,
|
|
4935
|
+
position
|
|
4936
|
+
} = measureResult;
|
|
4937
|
+
this.measureResultLabel.content = content;
|
|
4938
|
+
this.measureResultLabel.position = position;
|
|
4939
|
+
}
|
|
4940
|
+
}
|
|
4941
|
+
}]);
|
|
4951
4942
|
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
item
|
|
4955
|
-
} = legend;
|
|
4956
|
-
return React__default.createElement(LegendProvider, {
|
|
4957
|
-
symbol: symbol
|
|
4958
|
-
}, React__default.createElement(MapLegendControl, {
|
|
4959
|
-
className: className
|
|
4960
|
-
}, React__default.createElement(MapLegendContainer, null, React__default.createElement(MapLegendHeader, null, item.title), React__default.createElement(MapLegendSection, null, React__default.createElement(MapLegendValueDescr, null, fromToTitle[0]), item.values.map(value => React__default.createElement(MapLegendSymbol, {
|
|
4961
|
-
key: value.title,
|
|
4962
|
-
value: value,
|
|
4963
|
-
parameter: item.parameter
|
|
4964
|
-
})), React__default.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
|
|
4965
|
-
};
|
|
4943
|
+
return BaseMeasureToolEditor;
|
|
4944
|
+
}(PolyEditor.PolyEditor);
|
|
4966
4945
|
|
|
4967
4946
|
let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
4968
4947
|
_inherits(MeasureTool, _React$Component);
|
|
@@ -5152,7 +5131,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
|
5152
5131
|
}(React__default.Component);
|
|
5153
5132
|
|
|
5154
5133
|
const _excluded$3 = ["isActive"];
|
|
5155
|
-
const Measurer = _ref => {
|
|
5134
|
+
const Measurer = (_ref) => {
|
|
5156
5135
|
let {
|
|
5157
5136
|
isActive
|
|
5158
5137
|
} = _ref,
|
|
@@ -5170,18 +5149,18 @@ const Measurer = _ref => {
|
|
|
5170
5149
|
|
|
5171
5150
|
var _templateObject$7, _templateObject2$6, _templateObject3$6;
|
|
5172
5151
|
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"])));
|
|
5173
|
-
const ScaleRulerBlock = /*#__PURE__*/styled__default.div(_templateObject2$6 || (_templateObject2$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: flex-end;\n justify-content: center;\n width: ", ";\n height: 0.25rem;\n border: 0.0625rem solid white;\n border-top: 0;\n"])), _ref => {
|
|
5152
|
+
const ScaleRulerBlock = /*#__PURE__*/styled__default.div(_templateObject2$6 || (_templateObject2$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: flex-end;\n justify-content: center;\n width: ", ";\n height: 0.25rem;\n border: 0.0625rem solid white;\n border-top: 0;\n"])), (_ref) => {
|
|
5174
5153
|
let {
|
|
5175
5154
|
width
|
|
5176
5155
|
} = _ref;
|
|
5177
5156
|
return width + "px";
|
|
5178
5157
|
});
|
|
5179
|
-
const TextContainer = /*#__PURE__*/styled__default.div(_templateObject3$6 || (_templateObject3$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 2rem;\n display: flex;\n justify-content: center;\n align-items: ", ";\n width: ", ";\n color: #fff;\n font-size: 1rem;\n cursor: default;\n padding: 0 0.5rem;\n"])), _ref2 => {
|
|
5158
|
+
const TextContainer = /*#__PURE__*/styled__default.div(_templateObject3$6 || (_templateObject3$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 2rem;\n display: flex;\n justify-content: center;\n align-items: ", ";\n width: ", ";\n color: #fff;\n font-size: 1rem;\n cursor: default;\n padding: 0 0.5rem;\n"])), (_ref2) => {
|
|
5180
5159
|
let {
|
|
5181
5160
|
alignEnd
|
|
5182
5161
|
} = _ref2;
|
|
5183
5162
|
return alignEnd ? 'flex-end' : 'center';
|
|
5184
|
-
}, _ref3 => {
|
|
5163
|
+
}, (_ref3) => {
|
|
5185
5164
|
let {
|
|
5186
5165
|
width
|
|
5187
5166
|
} = _ref3;
|
|
@@ -5206,7 +5185,7 @@ const ScaleRuler = () => {
|
|
|
5206
5185
|
}, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
|
|
5207
5186
|
};
|
|
5208
5187
|
|
|
5209
|
-
const Zoom = _ref => {
|
|
5188
|
+
const Zoom = (_ref) => {
|
|
5210
5189
|
let {
|
|
5211
5190
|
children
|
|
5212
5191
|
} = _ref;
|
|
@@ -5255,7 +5234,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
|
|
|
5255
5234
|
return styled.css(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n ", "\n ", "\n ", "\n ", "\n"])), placement === 'top' && top(distance, cornerSize), placement === 'right' && right(distance, cornerSize), placement === 'left' && left(distance, cornerSize), placement === 'bottom' && bottom(distance, cornerSize));
|
|
5256
5235
|
};
|
|
5257
5236
|
const corner = /*#__PURE__*/styled.css(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n &:before {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n }\n"])));
|
|
5258
|
-
const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 999;\n display: flex;\n font-size: 0.625rem;\n color: #fff;\n background-color: rgba(28, 33, 48, 0.8);\n padding: 0.4em 0.6em;\n border-radius: 2px;\n user-select: none;\n box-sizing: border-box;\n white-space: pre;\n ", "\n ", "\n"])), _ref => {
|
|
5237
|
+
const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 999;\n display: flex;\n font-size: 0.625rem;\n color: #fff;\n background-color: rgba(28, 33, 48, 0.8);\n padding: 0.4em 0.6em;\n border-radius: 2px;\n user-select: none;\n box-sizing: border-box;\n white-space: pre;\n ", "\n ", "\n"])), (_ref) => {
|
|
5259
5238
|
let {
|
|
5260
5239
|
placement,
|
|
5261
5240
|
distance = '0.5rem',
|
|
@@ -5263,7 +5242,7 @@ const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$1 ||
|
|
|
5263
5242
|
cornerSize = '0.25rem'
|
|
5264
5243
|
} = _ref;
|
|
5265
5244
|
return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
|
|
5266
|
-
}, _ref2 => {
|
|
5245
|
+
}, (_ref2) => {
|
|
5267
5246
|
let {
|
|
5268
5247
|
withArrow
|
|
5269
5248
|
} = _ref2;
|
|
@@ -5277,7 +5256,7 @@ const {
|
|
|
5277
5256
|
Consumer
|
|
5278
5257
|
} = /*#__PURE__*/React.createContext([]); // TODO I just cant read that
|
|
5279
5258
|
|
|
5280
|
-
const Tooltip = _ref => {
|
|
5259
|
+
const Tooltip = (_ref) => {
|
|
5281
5260
|
let {
|
|
5282
5261
|
features = [],
|
|
5283
5262
|
map,
|
|
@@ -5316,7 +5295,7 @@ const Noop = () => React__default.createElement("div", {
|
|
|
5316
5295
|
}
|
|
5317
5296
|
});
|
|
5318
5297
|
|
|
5319
|
-
const DraggableMarker = _ref => {
|
|
5298
|
+
const DraggableMarker = (_ref) => {
|
|
5320
5299
|
let {
|
|
5321
5300
|
position,
|
|
5322
5301
|
onChange,
|
|
@@ -5330,6 +5309,21 @@ const DraggableMarker = _ref => {
|
|
|
5330
5309
|
return React__default.createElement(React.Fragment, null);
|
|
5331
5310
|
};
|
|
5332
5311
|
|
|
5312
|
+
const polygonCircleFromPoint = (center, diameter) => {
|
|
5313
|
+
const coordinates = [];
|
|
5314
|
+
const radius = diameter / 2;
|
|
5315
|
+
const endAngle = Math.PI * 2;
|
|
5316
|
+
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
5317
|
+
let start = 0;
|
|
5318
|
+
let end = endAngle;
|
|
5319
|
+
|
|
5320
|
+
for (let ang = start; ang < end; ang += step) {
|
|
5321
|
+
coordinates.push([Math.cos(ang) * radius + center[0], Math.sin(ang) * radius + center[1]]);
|
|
5322
|
+
}
|
|
5323
|
+
|
|
5324
|
+
return [coordinates];
|
|
5325
|
+
};
|
|
5326
|
+
|
|
5333
5327
|
exports.ArrowLineMiterRender = ArrowLineMiterRender;
|
|
5334
5328
|
exports.BaseMeasureToolCreator = BaseMeasureToolCreator;
|
|
5335
5329
|
exports.BaseMeasureToolEditor = BaseMeasureToolEditor;
|