@evergis/react 2.0.111 → 2.0.112
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/react.cjs.development.js +1528 -1536
- 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 +1529 -1537
- 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
|
|
@@ -3792,7 +3444,7 @@ function useMapWrapper() {
|
|
|
3792
3444
|
return wrapperRef;
|
|
3793
3445
|
}
|
|
3794
3446
|
|
|
3795
|
-
const byScale = scale => _ref => {
|
|
3447
|
+
const byScale = scale => (_ref) => {
|
|
3796
3448
|
let {
|
|
3797
3449
|
zIndex
|
|
3798
3450
|
} = _ref;
|
|
@@ -3991,7 +3643,7 @@ const useTooltip = function useTooltip(zIndex) {
|
|
|
3991
3643
|
|
|
3992
3644
|
return reset;
|
|
3993
3645
|
}, [reset, map, layer, zIndex]);
|
|
3994
|
-
const onSetLabelFeature = React.useCallback(_ref => {
|
|
3646
|
+
const onSetLabelFeature = React.useCallback((_ref) => {
|
|
3995
3647
|
let {
|
|
3996
3648
|
point,
|
|
3997
3649
|
position,
|
|
@@ -4155,7 +3807,7 @@ function useClusterLayer(_ref) {
|
|
|
4155
3807
|
}
|
|
4156
3808
|
|
|
4157
3809
|
const INIT_FEATURES = [];
|
|
4158
|
-
const useEvergisSelect = _ref => {
|
|
3810
|
+
const useEvergisSelect = (_ref) => {
|
|
4159
3811
|
let {
|
|
4160
3812
|
onPick,
|
|
4161
3813
|
onFeatures
|
|
@@ -4188,7 +3840,7 @@ function none() {
|
|
|
4188
3840
|
return;
|
|
4189
3841
|
}
|
|
4190
3842
|
|
|
4191
|
-
const useDraggableMarker = _ref => {
|
|
3843
|
+
const useDraggableMarker = (_ref) => {
|
|
4192
3844
|
let {
|
|
4193
3845
|
position,
|
|
4194
3846
|
onChange,
|
|
@@ -4304,7 +3956,7 @@ const useDebouncedCallback = interval => {
|
|
|
4304
3956
|
}, interval), [interval]);
|
|
4305
3957
|
};
|
|
4306
3958
|
|
|
4307
|
-
const Symbol = _ref => {
|
|
3959
|
+
const Symbol = (_ref) => {
|
|
4308
3960
|
let {
|
|
4309
3961
|
symbol,
|
|
4310
3962
|
size,
|
|
@@ -4325,7 +3977,7 @@ const Symbol = _ref => {
|
|
|
4325
3977
|
};
|
|
4326
3978
|
|
|
4327
3979
|
var _templateObject;
|
|
4328
|
-
const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), _ref => {
|
|
3980
|
+
const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), (_ref) => {
|
|
4329
3981
|
let {
|
|
4330
3982
|
geometryType,
|
|
4331
3983
|
icons
|
|
@@ -4334,7 +3986,7 @@ const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templ
|
|
|
4334
3986
|
});
|
|
4335
3987
|
|
|
4336
3988
|
const MAX_SIZE = 32;
|
|
4337
|
-
const StyleSymbol = _ref => {
|
|
3989
|
+
const StyleSymbol = (_ref) => {
|
|
4338
3990
|
let {
|
|
4339
3991
|
symbol,
|
|
4340
3992
|
size = MAX_SIZE,
|
|
@@ -4379,7 +4031,7 @@ const CloseIcon = /*#__PURE__*/styled__default(ui.Icon)(_templateObject20 || (_t
|
|
|
4379
4031
|
const PrevIcon = /*#__PURE__*/styled__default(ui.Icon)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
|
|
4380
4032
|
const NextIcon = /*#__PURE__*/styled__default(ui.Icon)(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
|
|
4381
4033
|
|
|
4382
|
-
const MailValue = _ref => {
|
|
4034
|
+
const MailValue = (_ref) => {
|
|
4383
4035
|
let {
|
|
4384
4036
|
mail
|
|
4385
4037
|
} = _ref;
|
|
@@ -4390,7 +4042,7 @@ const MailValue = _ref => {
|
|
|
4390
4042
|
}, mail);
|
|
4391
4043
|
};
|
|
4392
4044
|
|
|
4393
|
-
const PhoneValue = _ref => {
|
|
4045
|
+
const PhoneValue = (_ref) => {
|
|
4394
4046
|
let {
|
|
4395
4047
|
phone
|
|
4396
4048
|
} = _ref;
|
|
@@ -4401,7 +4053,7 @@ const PhoneValue = _ref => {
|
|
|
4401
4053
|
}, phone);
|
|
4402
4054
|
};
|
|
4403
4055
|
|
|
4404
|
-
const UrlValue = _ref => {
|
|
4056
|
+
const UrlValue = (_ref) => {
|
|
4405
4057
|
let {
|
|
4406
4058
|
url
|
|
4407
4059
|
} = _ref;
|
|
@@ -4412,7 +4064,7 @@ const UrlValue = _ref => {
|
|
|
4412
4064
|
}, url);
|
|
4413
4065
|
};
|
|
4414
4066
|
|
|
4415
|
-
const AttributeValue = _ref => {
|
|
4067
|
+
const AttributeValue = (_ref) => {
|
|
4416
4068
|
let {
|
|
4417
4069
|
attribute
|
|
4418
4070
|
} = _ref;
|
|
@@ -4426,29 +4078,29 @@ const AttributeValue = _ref => {
|
|
|
4426
4078
|
if (attributeValue.type === 2
|
|
4427
4079
|
/* Url */
|
|
4428
4080
|
) {
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4081
|
+
return React__default.createElement(UrlValue, {
|
|
4082
|
+
key: key,
|
|
4083
|
+
url: punycodeDecode(value)
|
|
4084
|
+
});
|
|
4085
|
+
}
|
|
4434
4086
|
|
|
4435
4087
|
if (attributeValue.type === 3
|
|
4436
4088
|
/* Mail */
|
|
4437
4089
|
) {
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4090
|
+
return React__default.createElement(MailValue, {
|
|
4091
|
+
key: key,
|
|
4092
|
+
mail: value
|
|
4093
|
+
});
|
|
4094
|
+
}
|
|
4443
4095
|
|
|
4444
4096
|
if (attributeValue.type === 1
|
|
4445
4097
|
/* Phone */
|
|
4446
4098
|
) {
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4099
|
+
return React__default.createElement(PhoneValue, {
|
|
4100
|
+
key: key,
|
|
4101
|
+
phone: value
|
|
4102
|
+
});
|
|
4103
|
+
}
|
|
4452
4104
|
|
|
4453
4105
|
return React__default.createElement(SimpleAttribute, {
|
|
4454
4106
|
key: value
|
|
@@ -4464,7 +4116,7 @@ function punycodeDecode(domains) {
|
|
|
4464
4116
|
}
|
|
4465
4117
|
}
|
|
4466
4118
|
|
|
4467
|
-
const EvergisCardAttribute = _ref => {
|
|
4119
|
+
const EvergisCardAttribute = (_ref) => {
|
|
4468
4120
|
let {
|
|
4469
4121
|
attribute,
|
|
4470
4122
|
className
|
|
@@ -4476,7 +4128,7 @@ const EvergisCardAttribute = _ref => {
|
|
|
4476
4128
|
}));
|
|
4477
4129
|
};
|
|
4478
4130
|
|
|
4479
|
-
const StyledCard = _ref => {
|
|
4131
|
+
const StyledCard = (_ref) => {
|
|
4480
4132
|
let {
|
|
4481
4133
|
features = [],
|
|
4482
4134
|
className,
|
|
@@ -4527,7 +4179,7 @@ const StyledCard = _ref => {
|
|
|
4527
4179
|
};
|
|
4528
4180
|
|
|
4529
4181
|
const _excluded$1 = ["renderCard", "className", "children"];
|
|
4530
|
-
const EvergisCard = _ref => {
|
|
4182
|
+
const EvergisCard = (_ref) => {
|
|
4531
4183
|
let {
|
|
4532
4184
|
renderCard,
|
|
4533
4185
|
className,
|
|
@@ -4579,7 +4231,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
|
|
|
4579
4231
|
|
|
4580
4232
|
const useSGisFeatures = (features, currentIndex) => React.useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
|
|
4581
4233
|
|
|
4582
|
-
const EvergisSelectLayer = _ref => {
|
|
4234
|
+
const EvergisSelectLayer = (_ref) => {
|
|
4583
4235
|
let {
|
|
4584
4236
|
features,
|
|
4585
4237
|
zIndex,
|
|
@@ -4624,7 +4276,7 @@ const TileLayer = props => {
|
|
|
4624
4276
|
};
|
|
4625
4277
|
|
|
4626
4278
|
const defaultZIndex = 200;
|
|
4627
|
-
const EvergisSelect = _ref => {
|
|
4279
|
+
const EvergisSelect = (_ref) => {
|
|
4628
4280
|
let {
|
|
4629
4281
|
onPick,
|
|
4630
4282
|
className,
|
|
@@ -4659,7 +4311,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled__default.p(_templateObject3$1 || (
|
|
|
4659
4311
|
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);
|
|
4660
4312
|
const LegendSectionHeader = /*#__PURE__*/styled__default.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])));
|
|
4661
4313
|
|
|
4662
|
-
const LegendSection = _ref => {
|
|
4314
|
+
const LegendSection = (_ref) => {
|
|
4663
4315
|
let {
|
|
4664
4316
|
item,
|
|
4665
4317
|
renderLegendTitle,
|
|
@@ -4676,7 +4328,7 @@ SearchPrefix.defaultProps = {
|
|
|
4676
4328
|
kind: "search"
|
|
4677
4329
|
};
|
|
4678
4330
|
|
|
4679
|
-
const SearchInput = _ref => {
|
|
4331
|
+
const SearchInput = (_ref) => {
|
|
4680
4332
|
let {
|
|
4681
4333
|
onChange
|
|
4682
4334
|
} = _ref;
|
|
@@ -4685,7 +4337,7 @@ const SearchInput = _ref => {
|
|
|
4685
4337
|
}));
|
|
4686
4338
|
};
|
|
4687
4339
|
|
|
4688
|
-
const LegendSymbol = _ref => {
|
|
4340
|
+
const LegendSymbol = (_ref) => {
|
|
4689
4341
|
let {
|
|
4690
4342
|
parameter,
|
|
4691
4343
|
parameterValue,
|
|
@@ -4703,7 +4355,7 @@ const LegendSymbol = _ref => {
|
|
|
4703
4355
|
return React__default.createElement(React__default.Fragment, null, children(symbol));
|
|
4704
4356
|
};
|
|
4705
4357
|
|
|
4706
|
-
const LegendValue = _ref => {
|
|
4358
|
+
const LegendValue = (_ref) => {
|
|
4707
4359
|
let {
|
|
4708
4360
|
value,
|
|
4709
4361
|
parameter,
|
|
@@ -4725,7 +4377,7 @@ const getNumberParam = (parameterValue, param) => {
|
|
|
4725
4377
|
return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
|
|
4726
4378
|
};
|
|
4727
4379
|
|
|
4728
|
-
const getSymbolSize = _ref => {
|
|
4380
|
+
const getSymbolSize = (_ref) => {
|
|
4729
4381
|
let {
|
|
4730
4382
|
parameterValue,
|
|
4731
4383
|
maxSize
|
|
@@ -4750,7 +4402,7 @@ const getSymbolSize = _ref => {
|
|
|
4750
4402
|
}
|
|
4751
4403
|
};
|
|
4752
4404
|
|
|
4753
|
-
const Legend = _ref => {
|
|
4405
|
+
const Legend = (_ref) => {
|
|
4754
4406
|
let {
|
|
4755
4407
|
layer,
|
|
4756
4408
|
children,
|
|
@@ -4793,7 +4445,7 @@ const Legend = _ref => {
|
|
|
4793
4445
|
})))));
|
|
4794
4446
|
};
|
|
4795
4447
|
|
|
4796
|
-
const Map = _ref => {
|
|
4448
|
+
const Map = (_ref) => {
|
|
4797
4449
|
let {
|
|
4798
4450
|
className,
|
|
4799
4451
|
position,
|
|
@@ -4815,163 +4467,488 @@ const Map = _ref => {
|
|
|
4815
4467
|
})) {
|
|
4816
4468
|
onBboxChange(state);
|
|
4817
4469
|
}
|
|
4818
|
-
}, [map, onBboxChange, position, resolution]);
|
|
4819
|
-
useUpdateMapView({
|
|
4820
|
-
position,
|
|
4821
|
-
resolution
|
|
4822
|
-
});
|
|
4823
|
-
useMaxMinScale(minScale, maxScale, position, resolution);
|
|
4824
|
-
useMapBboxChange(handleBboxChange);
|
|
4825
|
-
return React__default.createElement("div", {
|
|
4826
|
-
className: className,
|
|
4827
|
-
ref: wrapperRef,
|
|
4828
|
-
style: style
|
|
4829
|
-
}, children);
|
|
4830
|
-
};
|
|
4831
|
-
|
|
4832
|
-
var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
|
|
4833
|
-
|
|
4834
|
-
const topLeft = distance => styled.css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4470
|
+
}, [map, onBboxChange, position, resolution]);
|
|
4471
|
+
useUpdateMapView({
|
|
4472
|
+
position,
|
|
4473
|
+
resolution
|
|
4474
|
+
});
|
|
4475
|
+
useMaxMinScale(minScale, maxScale, position, resolution);
|
|
4476
|
+
useMapBboxChange(handleBboxChange);
|
|
4477
|
+
return React__default.createElement("div", {
|
|
4478
|
+
className: className,
|
|
4479
|
+
ref: wrapperRef,
|
|
4480
|
+
style: style
|
|
4481
|
+
}, children);
|
|
4482
|
+
};
|
|
4483
|
+
|
|
4484
|
+
var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
|
|
4485
|
+
|
|
4486
|
+
const topLeft = distance => styled.css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4487
|
+
|
|
4488
|
+
const topRight = distance => styled.css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n top: ", ";\n right: ", ";\n"])), distance, distance);
|
|
4489
|
+
|
|
4490
|
+
const bottomLeft = distance => styled.css(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4491
|
+
|
|
4492
|
+
const bottomRight = distance => styled.css(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n right: ", ";\n"])), distance, distance);
|
|
4493
|
+
|
|
4494
|
+
const placementMixin = function placementMixin(placement, distance) {
|
|
4495
|
+
if (placement === void 0) {
|
|
4496
|
+
placement = 'bottom-left';
|
|
4497
|
+
}
|
|
4498
|
+
|
|
4499
|
+
if (distance === void 0) {
|
|
4500
|
+
distance = '1rem';
|
|
4501
|
+
}
|
|
4502
|
+
|
|
4503
|
+
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));
|
|
4504
|
+
};
|
|
4505
|
+
|
|
4506
|
+
var _templateObject$5, _templateObject2$4, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$1, _templateObject7$1, _templateObject8$1;
|
|
4507
|
+
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"])));
|
|
4508
|
+
const ZoomInBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4509
|
+
ZoomInBtn.defaultProps = {
|
|
4510
|
+
kind: "plus"
|
|
4511
|
+
};
|
|
4512
|
+
const ZoomOutBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4513
|
+
ZoomOutBtn.defaultProps = {
|
|
4514
|
+
kind: "minus"
|
|
4515
|
+
};
|
|
4516
|
+
const SearchBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4517
|
+
SearchBtn.defaultProps = {
|
|
4518
|
+
kind: "search"
|
|
4519
|
+
}; // TODO not exists in fonts
|
|
4520
|
+
|
|
4521
|
+
const FullscreenBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4522
|
+
FullscreenBtn.defaultProps = {
|
|
4523
|
+
kind: "maximize"
|
|
4524
|
+
};
|
|
4525
|
+
const MeasureBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4526
|
+
MeasureBtn.defaultProps = {
|
|
4527
|
+
kind: "measure_length"
|
|
4528
|
+
};
|
|
4529
|
+
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"])));
|
|
4530
|
+
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) => {
|
|
4531
|
+
let {
|
|
4532
|
+
vertical
|
|
4533
|
+
} = _ref;
|
|
4534
|
+
return vertical ? 'column' : 'row';
|
|
4535
|
+
}, (_ref2) => {
|
|
4536
|
+
let {
|
|
4537
|
+
placement
|
|
4538
|
+
} = _ref2;
|
|
4539
|
+
return placementMixin(placement);
|
|
4540
|
+
}, MapControl, (_ref3) => {
|
|
4541
|
+
let {
|
|
4542
|
+
vertical
|
|
4543
|
+
} = _ref3;
|
|
4544
|
+
return vertical ? '0.5rem' : '0';
|
|
4545
|
+
}, (_ref4) => {
|
|
4546
|
+
let {
|
|
4547
|
+
vertical
|
|
4548
|
+
} = _ref4;
|
|
4549
|
+
return vertical ? '0' : '0.5rem';
|
|
4550
|
+
}, (_ref5) => {
|
|
4551
|
+
let {
|
|
4552
|
+
vertical
|
|
4553
|
+
} = _ref5;
|
|
4554
|
+
return vertical ? 'column' : 'row';
|
|
4555
|
+
});
|
|
4556
|
+
|
|
4557
|
+
const Measure = () => {
|
|
4558
|
+
return React__default.createElement(MapControl, null, React__default.createElement(MeasureBtn, {
|
|
4559
|
+
onClick: () => {}
|
|
4560
|
+
}));
|
|
4561
|
+
};
|
|
4562
|
+
|
|
4563
|
+
const Search = () => {
|
|
4564
|
+
return React__default.createElement(MapControl, null, React__default.createElement(SearchBtn, {
|
|
4565
|
+
onClick: () => {}
|
|
4566
|
+
}));
|
|
4567
|
+
};
|
|
4568
|
+
|
|
4569
|
+
const Fullscreen = () => {
|
|
4570
|
+
return React__default.createElement(MapControl, null, React__default.createElement(FullscreenBtn, {
|
|
4571
|
+
onClick: () => {}
|
|
4572
|
+
}));
|
|
4573
|
+
};
|
|
4574
|
+
|
|
4575
|
+
var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4;
|
|
4576
|
+
const MapLegendControl = /*#__PURE__*/styled__default(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4577
|
+
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"])));
|
|
4578
|
+
const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
|
|
4579
|
+
const MapLegendSection = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
|
|
4580
|
+
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"])));
|
|
4581
|
+
|
|
4582
|
+
const MAX_SIZE$2 = 100;
|
|
4583
|
+
const MapLegendSymbol = (_ref) => {
|
|
4584
|
+
let {
|
|
4585
|
+
value,
|
|
4586
|
+
parameter
|
|
4587
|
+
} = _ref;
|
|
4588
|
+
return React__default.createElement(LegendSymbol, {
|
|
4589
|
+
key: value.title,
|
|
4590
|
+
parameter: parameter,
|
|
4591
|
+
parameterValue: value.parameterValue
|
|
4592
|
+
}, symbol => React__default.createElement(Symbol, {
|
|
4593
|
+
render: getMapLegendSymbolRenders,
|
|
4594
|
+
symbol: symbol,
|
|
4595
|
+
size: MAX_SIZE$2
|
|
4596
|
+
}));
|
|
4597
|
+
};
|
|
4598
|
+
|
|
4599
|
+
const DEFAULT_FROM_TO = ['Выше', 'Ниже'];
|
|
4600
|
+
const MapLegend = (_ref) => {
|
|
4601
|
+
let {
|
|
4602
|
+
layer,
|
|
4603
|
+
config,
|
|
4604
|
+
fromToTitle = DEFAULT_FROM_TO,
|
|
4605
|
+
className
|
|
4606
|
+
} = _ref;
|
|
4607
|
+
const legend = useMapLegend(layer, config);
|
|
4608
|
+
|
|
4609
|
+
if (!legend) {
|
|
4610
|
+
return null;
|
|
4611
|
+
}
|
|
4612
|
+
|
|
4613
|
+
const {
|
|
4614
|
+
symbol,
|
|
4615
|
+
item
|
|
4616
|
+
} = legend;
|
|
4617
|
+
return React__default.createElement(LegendProvider, {
|
|
4618
|
+
symbol: symbol
|
|
4619
|
+
}, React__default.createElement(MapLegendControl, {
|
|
4620
|
+
className: className
|
|
4621
|
+
}, 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, {
|
|
4622
|
+
key: value.title,
|
|
4623
|
+
value: value,
|
|
4624
|
+
parameter: item.parameter
|
|
4625
|
+
})), React__default.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
|
|
4626
|
+
};
|
|
4627
|
+
|
|
4628
|
+
const DEFAULT_FORMATTERS = {
|
|
4629
|
+
polygon: formatPolygonMeasure,
|
|
4630
|
+
length: formatLength
|
|
4631
|
+
};
|
|
4632
|
+
|
|
4633
|
+
const COORD_FRACTION = 6;
|
|
4634
|
+
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
4635
|
+
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
4636
|
+
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
4637
|
+
|
|
4638
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
4639
|
+
|
|
4640
|
+
function BaseMeasureToolCreator(map, painter, params) {
|
|
4641
|
+
var _this;
|
|
4642
|
+
|
|
4643
|
+
_classCallCheck(this, BaseMeasureToolCreator);
|
|
4644
|
+
|
|
4645
|
+
_this = _super.call(this, map, params);
|
|
4646
|
+
|
|
4647
|
+
_this.cancel = () => {
|
|
4648
|
+
_this.fire('cancel');
|
|
4649
|
+
};
|
|
4650
|
+
|
|
4651
|
+
_this.painter = painter;
|
|
4652
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4653
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4654
|
+
_this.areaSymbol = params.areaSymbol;
|
|
4655
|
+
|
|
4656
|
+
_this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
|
|
4657
|
+
|
|
4658
|
+
|
|
4659
|
+
_this.on('change', _this.updateDistance);
|
|
4660
|
+
|
|
4661
|
+
return _this;
|
|
4662
|
+
}
|
|
4663
|
+
|
|
4664
|
+
_createClass(BaseMeasureToolCreator, [{
|
|
4665
|
+
key: "_handleMousemove",
|
|
4666
|
+
value: function _handleMousemove(event) {
|
|
4667
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_handleMousemove", this).call(this, event);
|
|
4668
|
+
|
|
4669
|
+
this.drawPointOnMouseMove(event);
|
|
4670
|
+
}
|
|
4671
|
+
}, {
|
|
4672
|
+
key: "_activate",
|
|
4673
|
+
value: function _activate() {
|
|
4674
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_activate", this).call(this);
|
|
4675
|
+
|
|
4676
|
+
this.addTempLabel();
|
|
4677
|
+
this.setCursor('pointer');
|
|
4678
|
+
}
|
|
4679
|
+
}, {
|
|
4680
|
+
key: "_deactivate",
|
|
4681
|
+
value: function _deactivate() {
|
|
4682
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_deactivate", this).call(this);
|
|
4683
|
+
|
|
4684
|
+
this.removeCoordLabel();
|
|
4685
|
+
this.removeTempLabel();
|
|
4686
|
+
this.removeMeasureLabel();
|
|
4687
|
+
this.removeTempPolygon();
|
|
4688
|
+
this.setCursor('default');
|
|
4689
|
+
}
|
|
4690
|
+
}, {
|
|
4691
|
+
key: "handlePointAdd",
|
|
4692
|
+
value: function handlePointAdd() {
|
|
4693
|
+
const feature = this.activeFeature;
|
|
4694
|
+
if (!feature) return;
|
|
4695
|
+
const {
|
|
4696
|
+
rings,
|
|
4697
|
+
crs
|
|
4698
|
+
} = feature;
|
|
4699
|
+
|
|
4700
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4701
|
+
this.finishDrawing();
|
|
4702
|
+
this.fire(new Control.DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
4703
|
+
return;
|
|
4704
|
+
}
|
|
4705
|
+
|
|
4706
|
+
if (rings[0].length === 2) {
|
|
4707
|
+
const projection = crs.projectionTo(Crs.geo);
|
|
4708
|
+
const point = rings[0][0];
|
|
4709
|
+
if (!projection) return;
|
|
4710
|
+
const [lat, long] = projection(point);
|
|
4711
|
+
this.removeTempLabel();
|
|
4712
|
+
this.addMeasureResultLabel();
|
|
4713
|
+
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
4714
|
+
} else {
|
|
4715
|
+
this.removeCoordLabel();
|
|
4716
|
+
}
|
|
4717
|
+
}
|
|
4718
|
+
}, {
|
|
4719
|
+
key: "polygonPreview",
|
|
4720
|
+
value: function polygonPreview() {
|
|
4721
|
+
if (this.tempPolygon) {
|
|
4722
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
4723
|
+
}
|
|
4724
|
+
|
|
4725
|
+
const feature = this.activeFeature;
|
|
4726
|
+
if (!feature) return;
|
|
4727
|
+
const {
|
|
4728
|
+
rings,
|
|
4729
|
+
crs
|
|
4730
|
+
} = feature;
|
|
4731
|
+
const polygonRings = [...rings[0]];
|
|
4732
|
+
polygonRings.shift();
|
|
4733
|
+
this.tempPolygon = new Polygon.Polygon(polygonRings, {
|
|
4734
|
+
crs
|
|
4735
|
+
});
|
|
4736
|
+
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
4737
|
+
this.activeFeature && this.activeFeature.hide();
|
|
4738
|
+
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
4739
|
+
}
|
|
4740
|
+
}, {
|
|
4741
|
+
key: "removeTempPolygon",
|
|
4742
|
+
value: function removeTempPolygon() {
|
|
4743
|
+
if (this.tempPolygon) {
|
|
4744
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
4745
|
+
delete this.tempPolygon;
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4748
|
+
}, {
|
|
4749
|
+
key: "updateDistance",
|
|
4750
|
+
value: function updateDistance(event) {
|
|
4751
|
+
const feature = this.activeFeature;
|
|
4752
|
+
const {
|
|
4753
|
+
ringIndex,
|
|
4754
|
+
pointIndex
|
|
4755
|
+
} = event;
|
|
4756
|
+
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
4757
|
+
const {
|
|
4758
|
+
rings,
|
|
4759
|
+
crs
|
|
4760
|
+
} = feature;
|
|
4761
|
+
const position = rings[ringIndex][pointIndex];
|
|
4762
|
+
const length = geotools.length(rings, crs);
|
|
4763
|
+
let content = this.formatters.length(length);
|
|
4764
|
+
|
|
4765
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4766
|
+
this.polygonPreview();
|
|
4767
|
+
const area = geotools.area(rings, crs);
|
|
4768
|
+
content = this.formatters.polygon(area, length);
|
|
4769
|
+
} else if (this.tempPolygon) {
|
|
4770
|
+
feature.show();
|
|
4771
|
+
this.removeTempPolygon();
|
|
4772
|
+
}
|
|
4773
|
+
|
|
4774
|
+
if (this.measureResultLabel) {
|
|
4775
|
+
this.measureResultLabel.position = position;
|
|
4776
|
+
this.measureResultLabel.content = content;
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
}, {
|
|
4780
|
+
key: "addTempLabel",
|
|
4781
|
+
value: function addTempLabel() {
|
|
4782
|
+
this.tempLabel = new Label.LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
4783
|
+
content: 'Нажмите на карту, чтобы начать измерение',
|
|
4784
|
+
crs: this.map.crs,
|
|
4785
|
+
symbol: createLabelSymbol({
|
|
4786
|
+
renderLabel: this.renderLabelSymbol
|
|
4787
|
+
})
|
|
4788
|
+
});
|
|
4789
|
+
this._tempLayer && this._tempLayer.add(this.tempLabel);
|
|
4790
|
+
}
|
|
4791
|
+
}, {
|
|
4792
|
+
key: "addCoordLabel",
|
|
4793
|
+
value: function addCoordLabel(content, position) {
|
|
4794
|
+
this.coordLabel = new Label.LabelFeature(position, {
|
|
4795
|
+
content,
|
|
4796
|
+
crs: this.map.crs,
|
|
4797
|
+
symbol: createLabelSymbol({
|
|
4798
|
+
renderLabel: this.renderLabelSymbol,
|
|
4799
|
+
onClose: this.cancel
|
|
4800
|
+
})
|
|
4801
|
+
});
|
|
4802
|
+
this._tempLayer && this.coordLabel && this._tempLayer.add(this.coordLabel);
|
|
4803
|
+
}
|
|
4804
|
+
}, {
|
|
4805
|
+
key: "addMeasureResultLabel",
|
|
4806
|
+
value: function addMeasureResultLabel() {
|
|
4807
|
+
this.measureResultLabel = new Label.LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
4808
|
+
crs: this.map.crs,
|
|
4809
|
+
symbol: createLabelSymbol({
|
|
4810
|
+
renderLabel: this.renderLabelSymbol
|
|
4811
|
+
})
|
|
4812
|
+
});
|
|
4813
|
+
this._tempLayer && this.measureResultLabel && this._tempLayer.add(this.measureResultLabel);
|
|
4814
|
+
}
|
|
4815
|
+
}, {
|
|
4816
|
+
key: "removeTempLabel",
|
|
4817
|
+
value: function removeTempLabel() {
|
|
4818
|
+
if (this.tempLabel) {
|
|
4819
|
+
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
4820
|
+
delete this.tempLabel;
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4823
|
+
}, {
|
|
4824
|
+
key: "removeCoordLabel",
|
|
4825
|
+
value: function removeCoordLabel() {
|
|
4826
|
+
if (this.coordLabel) {
|
|
4827
|
+
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
4828
|
+
delete this.coordLabel;
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4831
|
+
}, {
|
|
4832
|
+
key: "removeMeasureLabel",
|
|
4833
|
+
value: function removeMeasureLabel() {
|
|
4834
|
+
if (this.measureResultLabel) {
|
|
4835
|
+
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
4836
|
+
delete this.measureResultLabel;
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4839
|
+
}, {
|
|
4840
|
+
key: "drawPointOnMouseMove",
|
|
4841
|
+
value: function drawPointOnMouseMove(event) {
|
|
4842
|
+
if (this.tempLabel) {
|
|
4843
|
+
this.tempLabel.position = event.point.position;
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
}, {
|
|
4847
|
+
key: "setCursor",
|
|
4848
|
+
value: function setCursor(cursor) {
|
|
4849
|
+
const {
|
|
4850
|
+
wrapper
|
|
4851
|
+
} = this.painter;
|
|
4835
4852
|
|
|
4836
|
-
|
|
4853
|
+
if (wrapper && typeof wrapper !== 'string') {
|
|
4854
|
+
wrapper.style.cursor = cursor;
|
|
4855
|
+
}
|
|
4856
|
+
}
|
|
4857
|
+
}]);
|
|
4837
4858
|
|
|
4838
|
-
|
|
4859
|
+
return BaseMeasureToolCreator;
|
|
4860
|
+
}(PolylineControl.PolylineControl);
|
|
4839
4861
|
|
|
4840
|
-
|
|
4862
|
+
let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
|
|
4863
|
+
_inherits(BaseMeasureToolEditor, _PolyEditor);
|
|
4841
4864
|
|
|
4842
|
-
|
|
4843
|
-
if (placement === void 0) {
|
|
4844
|
-
placement = 'bottom-left';
|
|
4845
|
-
}
|
|
4865
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
|
|
4846
4866
|
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
}
|
|
4867
|
+
function BaseMeasureToolEditor(map, painter, params) {
|
|
4868
|
+
var _this;
|
|
4850
4869
|
|
|
4851
|
-
|
|
4852
|
-
};
|
|
4870
|
+
_classCallCheck(this, BaseMeasureToolEditor);
|
|
4853
4871
|
|
|
4854
|
-
|
|
4855
|
-
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"])));
|
|
4856
|
-
const ZoomInBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4857
|
-
ZoomInBtn.defaultProps = {
|
|
4858
|
-
kind: "plus"
|
|
4859
|
-
};
|
|
4860
|
-
const ZoomOutBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4861
|
-
ZoomOutBtn.defaultProps = {
|
|
4862
|
-
kind: "minus"
|
|
4863
|
-
};
|
|
4864
|
-
const SearchBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4865
|
-
SearchBtn.defaultProps = {
|
|
4866
|
-
kind: "search"
|
|
4867
|
-
}; // TODO not exists in fonts
|
|
4872
|
+
_this = _super.call(this, map, params);
|
|
4868
4873
|
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
};
|
|
4877
|
-
const
|
|
4878
|
-
const
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
return placementMixin(placement);
|
|
4888
|
-
}, MapControl, _ref3 => {
|
|
4889
|
-
let {
|
|
4890
|
-
vertical
|
|
4891
|
-
} = _ref3;
|
|
4892
|
-
return vertical ? '0.5rem' : '0';
|
|
4893
|
-
}, _ref4 => {
|
|
4894
|
-
let {
|
|
4895
|
-
vertical
|
|
4896
|
-
} = _ref4;
|
|
4897
|
-
return vertical ? '0' : '0.5rem';
|
|
4898
|
-
}, _ref5 => {
|
|
4899
|
-
let {
|
|
4900
|
-
vertical
|
|
4901
|
-
} = _ref5;
|
|
4902
|
-
return vertical ? 'column' : 'row';
|
|
4903
|
-
});
|
|
4874
|
+
_this.measureResult = () => {
|
|
4875
|
+
const feature = _this.activeFeature;
|
|
4876
|
+
if (!feature) return null;
|
|
4877
|
+
const {
|
|
4878
|
+
rings,
|
|
4879
|
+
isEnclosed,
|
|
4880
|
+
crs
|
|
4881
|
+
} = feature;
|
|
4882
|
+
const pointsCount = rings[0].length;
|
|
4883
|
+
const position = rings[0][pointsCount - 1];
|
|
4884
|
+
const area = geotools.area(rings, crs);
|
|
4885
|
+
const length = geotools.length(rings, crs, isEnclosed);
|
|
4886
|
+
const content = isEnclosed ? _this.formatters.polygon(area, length) : _this.formatters.length(length);
|
|
4887
|
+
return {
|
|
4888
|
+
content,
|
|
4889
|
+
position
|
|
4890
|
+
};
|
|
4891
|
+
};
|
|
4904
4892
|
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
}));
|
|
4909
|
-
};
|
|
4893
|
+
_this.removeFeature = () => {
|
|
4894
|
+
_this.fire('remove');
|
|
4895
|
+
};
|
|
4910
4896
|
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
}));
|
|
4915
|
-
};
|
|
4897
|
+
_this.painter = painter;
|
|
4898
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4899
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4916
4900
|
|
|
4917
|
-
|
|
4918
|
-
return React__default.createElement(MapControl, null, React__default.createElement(FullscreenBtn, {
|
|
4919
|
-
onClick: () => {}
|
|
4920
|
-
}));
|
|
4921
|
-
};
|
|
4901
|
+
_this.on('change', _this.updateMeasureResult);
|
|
4922
4902
|
|
|
4923
|
-
|
|
4924
|
-
const MapLegendControl = /*#__PURE__*/styled__default(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4925
|
-
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"])));
|
|
4926
|
-
const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
|
|
4927
|
-
const MapLegendSection = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
|
|
4928
|
-
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"])));
|
|
4903
|
+
_this.on('edit', _this.updateMeasureResult);
|
|
4929
4904
|
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
let {
|
|
4933
|
-
value,
|
|
4934
|
-
parameter
|
|
4935
|
-
} = _ref;
|
|
4936
|
-
return React__default.createElement(LegendSymbol, {
|
|
4937
|
-
key: value.title,
|
|
4938
|
-
parameter: parameter,
|
|
4939
|
-
parameterValue: value.parameterValue
|
|
4940
|
-
}, symbol => React__default.createElement(Symbol, {
|
|
4941
|
-
render: getMapLegendSymbolRenders,
|
|
4942
|
-
symbol: symbol,
|
|
4943
|
-
size: MAX_SIZE$2
|
|
4944
|
-
}));
|
|
4945
|
-
};
|
|
4905
|
+
return _this;
|
|
4906
|
+
}
|
|
4946
4907
|
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
config,
|
|
4952
|
-
fromToTitle = DEFAULT_FROM_TO,
|
|
4953
|
-
className
|
|
4954
|
-
} = _ref;
|
|
4955
|
-
const legend = useMapLegend(layer, config);
|
|
4908
|
+
_createClass(BaseMeasureToolEditor, [{
|
|
4909
|
+
key: "_activate",
|
|
4910
|
+
value: function _activate() {
|
|
4911
|
+
_get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
|
|
4956
4912
|
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
}
|
|
4913
|
+
this.addMeasureResultLabel();
|
|
4914
|
+
}
|
|
4915
|
+
}, {
|
|
4916
|
+
key: "addMeasureResultLabel",
|
|
4917
|
+
value: function addMeasureResultLabel() {
|
|
4918
|
+
const measureResult = this.measureResult();
|
|
4919
|
+
if (measureResult === null) return;
|
|
4920
|
+
const {
|
|
4921
|
+
content,
|
|
4922
|
+
position
|
|
4923
|
+
} = measureResult;
|
|
4924
|
+
this.measureResultLabel = new Label.LabelFeature(position, {
|
|
4925
|
+
content,
|
|
4926
|
+
crs: this.map.crs,
|
|
4927
|
+
symbol: createLabelSymbol({
|
|
4928
|
+
onClose: this.removeFeature,
|
|
4929
|
+
renderLabel: this.renderLabelSymbol
|
|
4930
|
+
})
|
|
4931
|
+
});
|
|
4932
|
+
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
4933
|
+
}
|
|
4934
|
+
}, {
|
|
4935
|
+
key: "updateMeasureResult",
|
|
4936
|
+
value: function updateMeasureResult() {
|
|
4937
|
+
if (this.measureResultLabel) {
|
|
4938
|
+
const measureResult = this.measureResult();
|
|
4939
|
+
if (measureResult === null) return;
|
|
4940
|
+
const {
|
|
4941
|
+
content,
|
|
4942
|
+
position
|
|
4943
|
+
} = measureResult;
|
|
4944
|
+
this.measureResultLabel.content = content;
|
|
4945
|
+
this.measureResultLabel.position = position;
|
|
4946
|
+
}
|
|
4947
|
+
}
|
|
4948
|
+
}]);
|
|
4960
4949
|
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
item
|
|
4964
|
-
} = legend;
|
|
4965
|
-
return React__default.createElement(LegendProvider, {
|
|
4966
|
-
symbol: symbol
|
|
4967
|
-
}, React__default.createElement(MapLegendControl, {
|
|
4968
|
-
className: className
|
|
4969
|
-
}, 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, {
|
|
4970
|
-
key: value.title,
|
|
4971
|
-
value: value,
|
|
4972
|
-
parameter: item.parameter
|
|
4973
|
-
})), React__default.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
|
|
4974
|
-
};
|
|
4950
|
+
return BaseMeasureToolEditor;
|
|
4951
|
+
}(PolyEditor.PolyEditor);
|
|
4975
4952
|
|
|
4976
4953
|
let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
4977
4954
|
_inherits(MeasureTool, _React$Component);
|
|
@@ -5161,7 +5138,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
|
5161
5138
|
}(React__default.Component);
|
|
5162
5139
|
|
|
5163
5140
|
const _excluded$3 = ["isActive"];
|
|
5164
|
-
const Measurer = _ref => {
|
|
5141
|
+
const Measurer = (_ref) => {
|
|
5165
5142
|
let {
|
|
5166
5143
|
isActive
|
|
5167
5144
|
} = _ref,
|
|
@@ -5179,18 +5156,18 @@ const Measurer = _ref => {
|
|
|
5179
5156
|
|
|
5180
5157
|
var _templateObject$7, _templateObject2$6, _templateObject3$6;
|
|
5181
5158
|
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"])));
|
|
5182
|
-
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 => {
|
|
5159
|
+
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) => {
|
|
5183
5160
|
let {
|
|
5184
5161
|
width
|
|
5185
5162
|
} = _ref;
|
|
5186
5163
|
return width + "px";
|
|
5187
5164
|
});
|
|
5188
|
-
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 => {
|
|
5165
|
+
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) => {
|
|
5189
5166
|
let {
|
|
5190
5167
|
alignEnd
|
|
5191
5168
|
} = _ref2;
|
|
5192
5169
|
return alignEnd ? 'flex-end' : 'center';
|
|
5193
|
-
}, _ref3 => {
|
|
5170
|
+
}, (_ref3) => {
|
|
5194
5171
|
let {
|
|
5195
5172
|
width
|
|
5196
5173
|
} = _ref3;
|
|
@@ -5215,7 +5192,7 @@ const ScaleRuler = () => {
|
|
|
5215
5192
|
}, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
|
|
5216
5193
|
};
|
|
5217
5194
|
|
|
5218
|
-
const Zoom = _ref => {
|
|
5195
|
+
const Zoom = (_ref) => {
|
|
5219
5196
|
let {
|
|
5220
5197
|
children
|
|
5221
5198
|
} = _ref;
|
|
@@ -5264,7 +5241,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
|
|
|
5264
5241
|
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));
|
|
5265
5242
|
};
|
|
5266
5243
|
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"])));
|
|
5267
|
-
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 => {
|
|
5244
|
+
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) => {
|
|
5268
5245
|
let {
|
|
5269
5246
|
placement,
|
|
5270
5247
|
distance = '0.5rem',
|
|
@@ -5272,7 +5249,7 @@ const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$1 ||
|
|
|
5272
5249
|
cornerSize = '0.25rem'
|
|
5273
5250
|
} = _ref;
|
|
5274
5251
|
return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
|
|
5275
|
-
}, _ref2 => {
|
|
5252
|
+
}, (_ref2) => {
|
|
5276
5253
|
let {
|
|
5277
5254
|
withArrow
|
|
5278
5255
|
} = _ref2;
|
|
@@ -5286,7 +5263,7 @@ const {
|
|
|
5286
5263
|
Consumer
|
|
5287
5264
|
} = /*#__PURE__*/React.createContext([]); // TODO I just cant read that
|
|
5288
5265
|
|
|
5289
|
-
const Tooltip = _ref => {
|
|
5266
|
+
const Tooltip = (_ref) => {
|
|
5290
5267
|
let {
|
|
5291
5268
|
features = [],
|
|
5292
5269
|
map,
|
|
@@ -5325,7 +5302,7 @@ const Noop = () => React__default.createElement("div", {
|
|
|
5325
5302
|
}
|
|
5326
5303
|
});
|
|
5327
5304
|
|
|
5328
|
-
const DraggableMarker = _ref => {
|
|
5305
|
+
const DraggableMarker = (_ref) => {
|
|
5329
5306
|
let {
|
|
5330
5307
|
position,
|
|
5331
5308
|
onChange,
|
|
@@ -5339,6 +5316,21 @@ const DraggableMarker = _ref => {
|
|
|
5339
5316
|
return React__default.createElement(React.Fragment, null);
|
|
5340
5317
|
};
|
|
5341
5318
|
|
|
5319
|
+
const polygonCircleFromPoint = (center, diameter) => {
|
|
5320
|
+
const coordinates = [];
|
|
5321
|
+
const radius = diameter / 2;
|
|
5322
|
+
const endAngle = Math.PI * 2;
|
|
5323
|
+
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
5324
|
+
let start = 0;
|
|
5325
|
+
let end = endAngle;
|
|
5326
|
+
|
|
5327
|
+
for (let ang = start; ang < end; ang += step) {
|
|
5328
|
+
coordinates.push([Math.cos(ang) * radius + center[0], Math.sin(ang) * radius + center[1]]);
|
|
5329
|
+
}
|
|
5330
|
+
|
|
5331
|
+
return [coordinates];
|
|
5332
|
+
};
|
|
5333
|
+
|
|
5342
5334
|
exports.ArrowLineMiterRender = ArrowLineMiterRender;
|
|
5343
5335
|
exports.BaseMeasureToolCreator = BaseMeasureToolCreator;
|
|
5344
5336
|
exports.BaseMeasureToolEditor = BaseMeasureToolEditor;
|