@evergis/react 2.0.111 → 2.0.113
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 +1513 -1519
- 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 +1514 -1520
- package/dist/react.esm.js.map +1 -1
- package/package.json +5 -5
package/dist/react.esm.js
CHANGED
|
@@ -17,12 +17,8 @@ import { ImageFill } from '@evergis/sgis/es/symbols/polygon/ImageFill';
|
|
|
17
17
|
import { PolygonSymbol } from '@evergis/sgis/es/symbols/polygon/Simple';
|
|
18
18
|
import { PolylineSymbol } from '@evergis/sgis/es/symbols/PolylineSymbol';
|
|
19
19
|
import { PolyRender, FillStyle } from '@evergis/sgis/es/renders/Poly';
|
|
20
|
-
import { projectRings, length, area
|
|
20
|
+
import { projectRings, distance, length, area } from '@evergis/sgis/es/geotools';
|
|
21
21
|
import { simplifyCoordinates, softEquals } from '@evergis/sgis/es/utils/math';
|
|
22
|
-
import { PolylineControl } from '@evergis/sgis/es/controls/PolylineControl';
|
|
23
|
-
import { LabelFeature } from '@evergis/sgis/es/features/Label';
|
|
24
|
-
import { DrawingFinishEvent } from '@evergis/sgis/es/controls/Control';
|
|
25
|
-
import { PolyEditor } from '@evergis/sgis/es/controls/PolyEditor';
|
|
26
22
|
import ReactDOM from 'react-dom';
|
|
27
23
|
import { DynamicPointSymbol, Symbol as Symbol$1 } from '@evergis/sgis/es/symbols/Symbol';
|
|
28
24
|
import { Poly } from '@evergis/sgis/es/features/Poly';
|
|
@@ -35,6 +31,7 @@ import { SquareSymbol } from '@evergis/sgis/es/symbols/point/Square';
|
|
|
35
31
|
import { MaskedImage } from '@evergis/sgis/es/symbols/point/MaskedImage';
|
|
36
32
|
import { Canvas } from '@evergis/sgis/es/painters/DomPainter/Canvas';
|
|
37
33
|
import { sGisClickEvent } from '@evergis/sgis/es/commonEvents';
|
|
34
|
+
import { LabelFeature } from '@evergis/sgis/es/features/Label';
|
|
38
35
|
import { ClusterLayer as ClusterLayer$1 } from '@evergis/sgis/es/layers/ClusterLayer';
|
|
39
36
|
import { GridClusterProvider } from '@evergis/sgis/es/layers/clusterProviders/GridClusterProvider';
|
|
40
37
|
import { PointEditor } from '@evergis/sgis/es/controls/PointEditor';
|
|
@@ -43,6 +40,9 @@ import styled, { css } from 'styled-components';
|
|
|
43
40
|
import { Icon } from '@evergis/ui';
|
|
44
41
|
import punycode from 'punycode';
|
|
45
42
|
import { TileLayer as TileLayer$1 } from '@evergis/sgis/es/layers/TileLayer';
|
|
43
|
+
import { PolylineControl } from '@evergis/sgis/es/controls/PolylineControl';
|
|
44
|
+
import { DrawingFinishEvent } from '@evergis/sgis/es/controls/Control';
|
|
45
|
+
import { PolyEditor } from '@evergis/sgis/es/controls/PolyEditor';
|
|
46
46
|
|
|
47
47
|
function _classCallCheck(instance, Constructor) {
|
|
48
48
|
if (!(instance instanceof Constructor)) {
|
|
@@ -63,9 +63,6 @@ function _defineProperties(target, props) {
|
|
|
63
63
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
64
64
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
65
65
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
66
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
67
|
-
writable: false
|
|
68
|
-
});
|
|
69
66
|
return Constructor;
|
|
70
67
|
}
|
|
71
68
|
|
|
@@ -99,9 +96,6 @@ function _inherits(subClass, superClass) {
|
|
|
99
96
|
configurable: true
|
|
100
97
|
}
|
|
101
98
|
});
|
|
102
|
-
Object.defineProperty(subClass, "prototype", {
|
|
103
|
-
writable: false
|
|
104
|
-
});
|
|
105
99
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
106
100
|
}
|
|
107
101
|
|
|
@@ -160,8 +154,6 @@ function _assertThisInitialized(self) {
|
|
|
160
154
|
function _possibleConstructorReturn(self, call) {
|
|
161
155
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
162
156
|
return call;
|
|
163
|
-
} else if (call !== void 0) {
|
|
164
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
165
157
|
}
|
|
166
158
|
|
|
167
159
|
return _assertThisInitialized(self);
|
|
@@ -195,7 +187,7 @@ function _superPropBase(object, property) {
|
|
|
195
187
|
return object;
|
|
196
188
|
}
|
|
197
189
|
|
|
198
|
-
function _get() {
|
|
190
|
+
function _get(target, property, receiver) {
|
|
199
191
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
200
192
|
_get = Reflect.get;
|
|
201
193
|
} else {
|
|
@@ -206,14 +198,14 @@ function _get() {
|
|
|
206
198
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
207
199
|
|
|
208
200
|
if (desc.get) {
|
|
209
|
-
return desc.get.call(
|
|
201
|
+
return desc.get.call(receiver);
|
|
210
202
|
}
|
|
211
203
|
|
|
212
204
|
return desc.value;
|
|
213
205
|
};
|
|
214
206
|
}
|
|
215
207
|
|
|
216
|
-
return _get
|
|
208
|
+
return _get(target, property, receiver || target);
|
|
217
209
|
}
|
|
218
210
|
|
|
219
211
|
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
@@ -242,7 +234,7 @@ const defaultApi = /*#__PURE__*/new Api({
|
|
|
242
234
|
url: BASE_URL
|
|
243
235
|
});
|
|
244
236
|
const evergisContext = /*#__PURE__*/createContext(defaultApi);
|
|
245
|
-
const EvergisProvider = _ref => {
|
|
237
|
+
const EvergisProvider = (_ref) => {
|
|
246
238
|
let {
|
|
247
239
|
api,
|
|
248
240
|
children
|
|
@@ -260,7 +252,7 @@ const mapContext = /*#__PURE__*/createContext({
|
|
|
260
252
|
map: defaultMap,
|
|
261
253
|
painter: defaultPainter
|
|
262
254
|
});
|
|
263
|
-
const MapProvider = _ref => {
|
|
255
|
+
const MapProvider = (_ref) => {
|
|
264
256
|
let {
|
|
265
257
|
map,
|
|
266
258
|
painter,
|
|
@@ -282,7 +274,7 @@ const tooltipContext = /*#__PURE__*/createContext({
|
|
|
282
274
|
layer: defaultLayer,
|
|
283
275
|
popupLayer: defaultPopupLayer
|
|
284
276
|
});
|
|
285
|
-
const TooltipProvider = _ref => {
|
|
277
|
+
const TooltipProvider = (_ref) => {
|
|
286
278
|
let {
|
|
287
279
|
layer,
|
|
288
280
|
popupLayer,
|
|
@@ -299,7 +291,7 @@ const TooltipProvider = _ref => {
|
|
|
299
291
|
const useTooltipContext = () => useContext(tooltipContext);
|
|
300
292
|
|
|
301
293
|
const LegendContext = /*#__PURE__*/createContext(null);
|
|
302
|
-
const LegendProvider = _ref => {
|
|
294
|
+
const LegendProvider = (_ref) => {
|
|
303
295
|
let {
|
|
304
296
|
symbol,
|
|
305
297
|
children
|
|
@@ -311,7 +303,7 @@ const LegendProvider = _ref => {
|
|
|
311
303
|
const useLegendContext = () => useContext(LegendContext);
|
|
312
304
|
|
|
313
305
|
const evergisSelectContext = /*#__PURE__*/createContext([]);
|
|
314
|
-
const EvergisSelectProvider = _ref => {
|
|
306
|
+
const EvergisSelectProvider = (_ref) => {
|
|
315
307
|
let {
|
|
316
308
|
layers,
|
|
317
309
|
children
|
|
@@ -356,7 +348,7 @@ function useMapViewActions() {
|
|
|
356
348
|
}, [map]);
|
|
357
349
|
const zoomIn = useCallback(() => zoomTo(1), [zoomTo]);
|
|
358
350
|
const zoomOut = useCallback(() => zoomTo(-1), [zoomTo]);
|
|
359
|
-
const animateTo = useCallback(_ref => {
|
|
351
|
+
const animateTo = useCallback((_ref) => {
|
|
360
352
|
let {
|
|
361
353
|
position,
|
|
362
354
|
resolution,
|
|
@@ -386,7 +378,7 @@ function useMapViewActions() {
|
|
|
386
378
|
const {
|
|
387
379
|
tileScheme
|
|
388
380
|
} = map;
|
|
389
|
-
let tileLevel = tileScheme.levels.find(_ref2 => {
|
|
381
|
+
let tileLevel = tileScheme.levels.find((_ref2) => {
|
|
390
382
|
let {
|
|
391
383
|
zIndex
|
|
392
384
|
} = _ref2;
|
|
@@ -562,7 +554,7 @@ const formatStringAttribute = value => {
|
|
|
562
554
|
|
|
563
555
|
const attributeValues = value.split(/[\s|]/).map(convertStringAttribute);
|
|
564
556
|
|
|
565
|
-
if (attributeValues.every(_ref => {
|
|
557
|
+
if (attributeValues.every((_ref) => {
|
|
566
558
|
let {
|
|
567
559
|
type
|
|
568
560
|
} = _ref;
|
|
@@ -570,7 +562,7 @@ const formatStringAttribute = value => {
|
|
|
570
562
|
}
|
|
571
563
|
/* String */
|
|
572
564
|
)) {
|
|
573
|
-
return [stringAttribute(attributeValues.map(_ref2 => {
|
|
565
|
+
return [stringAttribute(attributeValues.map((_ref2) => {
|
|
574
566
|
let {
|
|
575
567
|
value
|
|
576
568
|
} = _ref2;
|
|
@@ -1053,7 +1045,7 @@ const getFeatureAttributeType = attributeValue => {
|
|
|
1053
1045
|
};
|
|
1054
1046
|
const getLayerAttributes = layerDefinition => {
|
|
1055
1047
|
const attributes = layerDefinition && layerDefinition.attributes || {};
|
|
1056
|
-
return Object.entries(attributes).map(_ref => {
|
|
1048
|
+
return Object.entries(attributes).map((_ref) => {
|
|
1057
1049
|
let [name, definition] = _ref;
|
|
1058
1050
|
return _extends({
|
|
1059
1051
|
name
|
|
@@ -1061,7 +1053,7 @@ const getLayerAttributes = layerDefinition => {
|
|
|
1061
1053
|
});
|
|
1062
1054
|
};
|
|
1063
1055
|
const getFeatureAttributes = attributes => {
|
|
1064
|
-
return attributes ? Object.entries(attributes).map(_ref2 => {
|
|
1056
|
+
return attributes ? Object.entries(attributes).map((_ref2) => {
|
|
1065
1057
|
let [name, value] = _ref2;
|
|
1066
1058
|
return {
|
|
1067
1059
|
name,
|
|
@@ -1079,7 +1071,7 @@ const getClassificationAttribute = (attributeName, attributes) => {
|
|
|
1079
1071
|
return attribute ? _extends({}, attrNamePart, attribute) : attrNamePart;
|
|
1080
1072
|
};
|
|
1081
1073
|
const mergeAttributes = (attributes1, attributes2) => {
|
|
1082
|
-
return attributes1.map(attribute => _extends({}, attribute, attributes2.find(_ref3 => {
|
|
1074
|
+
return attributes1.map(attribute => _extends({}, attribute, attributes2.find((_ref3) => {
|
|
1083
1075
|
let {
|
|
1084
1076
|
name
|
|
1085
1077
|
} = _ref3;
|
|
@@ -1494,7 +1486,7 @@ let SGisPolygonSymbol = /*#__PURE__*/function (_sPolygonSymbol) {
|
|
|
1494
1486
|
const adaptMiterRings = (rings, resolution, fromCrs, toCrs) => {
|
|
1495
1487
|
const projected = projectRings(rings, fromCrs, toCrs);
|
|
1496
1488
|
return simplifyCoordinates(projected.map(ring => // @ts-ignore
|
|
1497
|
-
ring.map(_ref => {
|
|
1489
|
+
ring.map((_ref) => {
|
|
1498
1490
|
let [x, y] = _ref;
|
|
1499
1491
|
return [x / resolution, y / -resolution];
|
|
1500
1492
|
})), 1);
|
|
@@ -1586,1503 +1578,1165 @@ let ArrowLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
|
1586
1578
|
return ArrowLineMiterRender;
|
|
1587
1579
|
}(LineMiterRender);
|
|
1588
1580
|
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
length: formatLength
|
|
1592
|
-
};
|
|
1593
|
-
|
|
1594
|
-
const COORD_FRACTION = 6;
|
|
1595
|
-
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
1596
|
-
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
1597
|
-
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
1598
|
-
|
|
1599
|
-
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
1581
|
+
let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1582
|
+
_inherits(CircleLineMiterRender, _LineMiterRender);
|
|
1600
1583
|
|
|
1601
|
-
|
|
1602
|
-
var _this;
|
|
1584
|
+
var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
|
|
1603
1585
|
|
|
1604
|
-
|
|
1586
|
+
function CircleLineMiterRender() {
|
|
1587
|
+
_classCallCheck(this, CircleLineMiterRender);
|
|
1605
1588
|
|
|
1606
|
-
|
|
1589
|
+
return _super.apply(this, arguments);
|
|
1590
|
+
}
|
|
1607
1591
|
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1592
|
+
_createClass(CircleLineMiterRender, [{
|
|
1593
|
+
key: "usageSize",
|
|
1594
|
+
get: function get() {
|
|
1595
|
+
return this.miterSize + this.strokeWidth * 3;
|
|
1596
|
+
}
|
|
1597
|
+
}, {
|
|
1598
|
+
key: "createRings",
|
|
1599
|
+
value: function createRings(_ref, xMultiplier) {
|
|
1600
|
+
let [x, y] = _ref;
|
|
1601
|
+
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1602
|
+
}
|
|
1603
|
+
}, {
|
|
1604
|
+
key: "createRender",
|
|
1605
|
+
value: function createRender(miterRings) {
|
|
1606
|
+
const isFilled = this.kind === LineMiterKind.FilledCircle;
|
|
1607
|
+
return new PolyRender(polygonCircleFromPoint(miterRings[0][0], this.miterSize), {
|
|
1608
|
+
fillColor: isFilled ? this.color : 'transparent',
|
|
1609
|
+
strokeColor: this.color,
|
|
1610
|
+
strokeWidth: this.strokeWidth,
|
|
1611
|
+
enclosed: true
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
}]);
|
|
1611
1615
|
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1615
|
-
_this.areaSymbol = params.areaSymbol;
|
|
1616
|
+
return CircleLineMiterRender;
|
|
1617
|
+
}(LineMiterRender);
|
|
1616
1618
|
|
|
1617
|
-
|
|
1619
|
+
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1620
|
+
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1618
1621
|
|
|
1622
|
+
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1619
1623
|
|
|
1620
|
-
|
|
1624
|
+
function SquareLineMiterRender() {
|
|
1625
|
+
_classCallCheck(this, SquareLineMiterRender);
|
|
1621
1626
|
|
|
1622
|
-
return
|
|
1627
|
+
return _super.apply(this, arguments);
|
|
1623
1628
|
}
|
|
1624
1629
|
|
|
1625
|
-
_createClass(
|
|
1626
|
-
key: "
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
this.drawPointOnMouseMove(event);
|
|
1630
|
+
_createClass(SquareLineMiterRender, [{
|
|
1631
|
+
key: "usageSize",
|
|
1632
|
+
get: function get() {
|
|
1633
|
+
return this.miterSize + this.strokeWidth;
|
|
1631
1634
|
}
|
|
1632
1635
|
}, {
|
|
1633
|
-
key: "
|
|
1634
|
-
value: function
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
this.addTempLabel();
|
|
1638
|
-
this.setCursor('pointer');
|
|
1636
|
+
key: "createRings",
|
|
1637
|
+
value: function createRings(_ref, xMultiplier) {
|
|
1638
|
+
let [x, y] = _ref;
|
|
1639
|
+
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]]];
|
|
1639
1640
|
}
|
|
1640
1641
|
}, {
|
|
1641
|
-
key: "
|
|
1642
|
-
value: function
|
|
1643
|
-
|
|
1642
|
+
key: "createRender",
|
|
1643
|
+
value: function createRender(miterRings) {
|
|
1644
|
+
const isFilled = this.kind === LineMiterKind.FilledSquare;
|
|
1645
|
+
return new PolyRender(miterRings, {
|
|
1646
|
+
enclosed: true,
|
|
1647
|
+
fillColor: isFilled ? this.color : void 0,
|
|
1648
|
+
fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
|
|
1649
|
+
lineCap: 'square',
|
|
1650
|
+
lineJoin: 'miter',
|
|
1651
|
+
strokeColor: this.color,
|
|
1652
|
+
strokeWidth: this.strokeWidth
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
}]);
|
|
1644
1656
|
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1657
|
+
return SquareLineMiterRender;
|
|
1658
|
+
}(LineMiterRender);
|
|
1659
|
+
|
|
1660
|
+
const getLineMiterRender = options => {
|
|
1661
|
+
switch (options.kind) {
|
|
1662
|
+
case LineMiterKind.Arrow:
|
|
1663
|
+
case LineMiterKind.FilledArrow:
|
|
1664
|
+
return new ArrowLineMiterRender(options);
|
|
1665
|
+
|
|
1666
|
+
case LineMiterKind.Square:
|
|
1667
|
+
case LineMiterKind.FilledSquare:
|
|
1668
|
+
return new SquareLineMiterRender(options);
|
|
1669
|
+
|
|
1670
|
+
case LineMiterKind.Circle:
|
|
1671
|
+
case LineMiterKind.FilledCircle:
|
|
1672
|
+
return new CircleLineMiterRender(options);
|
|
1673
|
+
|
|
1674
|
+
default:
|
|
1675
|
+
return null;
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
|
|
1679
|
+
const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
|
|
1680
|
+
const reversedRing = ring.slice().reverse();
|
|
1681
|
+
|
|
1682
|
+
for (let i = 0; i < reversedRing.length; i++) {
|
|
1683
|
+
const coordinates = reversedRing[i];
|
|
1684
|
+
|
|
1685
|
+
if (isLastRing && i === 0) {
|
|
1686
|
+
reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
|
|
1650
1687
|
}
|
|
1651
|
-
}, {
|
|
1652
|
-
key: "handlePointAdd",
|
|
1653
|
-
value: function handlePointAdd() {
|
|
1654
|
-
const feature = this.activeFeature;
|
|
1655
|
-
if (!feature) return;
|
|
1656
|
-
const {
|
|
1657
|
-
rings,
|
|
1658
|
-
crs
|
|
1659
|
-
} = feature;
|
|
1660
1688
|
|
|
1661
|
-
|
|
1662
|
-
this.finishDrawing();
|
|
1663
|
-
this.fire(new DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
1664
|
-
return;
|
|
1665
|
-
}
|
|
1689
|
+
const nextCoordinates = reversedRing[i - 1];
|
|
1666
1690
|
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
const point = rings[0][0];
|
|
1670
|
-
if (!projection) return;
|
|
1671
|
-
const [lat, long] = projection(point);
|
|
1672
|
-
this.removeTempLabel();
|
|
1673
|
-
this.addMeasureResultLabel();
|
|
1674
|
-
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
1675
|
-
} else {
|
|
1676
|
-
this.removeCoordLabel();
|
|
1677
|
-
}
|
|
1691
|
+
if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
|
|
1692
|
+
reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
|
|
1678
1693
|
}
|
|
1679
|
-
}
|
|
1680
|
-
key: "polygonPreview",
|
|
1681
|
-
value: function polygonPreview() {
|
|
1682
|
-
if (this.tempPolygon) {
|
|
1683
|
-
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
1684
|
-
}
|
|
1694
|
+
}
|
|
1685
1695
|
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
1698
|
-
this.activeFeature && this.activeFeature.hide();
|
|
1699
|
-
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
1696
|
+
return reversedRing.reverse();
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1699
|
+
const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
|
|
1700
|
+
const newRing = ring.slice();
|
|
1701
|
+
|
|
1702
|
+
for (let i = 0; i < newRing.length; i++) {
|
|
1703
|
+
const coordinates = newRing[i];
|
|
1704
|
+
|
|
1705
|
+
if (i === 0 && isFirstRing) {
|
|
1706
|
+
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
1700
1707
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
delete this.tempPolygon;
|
|
1707
|
-
}
|
|
1708
|
+
|
|
1709
|
+
const prevCoordinates = newRing[i - 1];
|
|
1710
|
+
|
|
1711
|
+
if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
|
|
1712
|
+
newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
|
|
1708
1713
|
}
|
|
1709
|
-
}
|
|
1710
|
-
key: "updateDistance",
|
|
1711
|
-
value: function updateDistance(event) {
|
|
1712
|
-
const feature = this.activeFeature;
|
|
1713
|
-
const {
|
|
1714
|
-
ringIndex,
|
|
1715
|
-
pointIndex
|
|
1716
|
-
} = event;
|
|
1717
|
-
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
1718
|
-
const {
|
|
1719
|
-
rings,
|
|
1720
|
-
crs
|
|
1721
|
-
} = feature;
|
|
1722
|
-
const position = rings[ringIndex][pointIndex];
|
|
1723
|
-
const length$1 = length(rings, crs);
|
|
1724
|
-
let content = this.formatters.length(length$1);
|
|
1714
|
+
}
|
|
1725
1715
|
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
const area$1 = area(rings, crs);
|
|
1729
|
-
content = this.formatters.polygon(area$1, length$1);
|
|
1730
|
-
} else if (this.tempPolygon) {
|
|
1731
|
-
feature.show();
|
|
1732
|
-
this.removeTempPolygon();
|
|
1733
|
-
}
|
|
1716
|
+
return newRing;
|
|
1717
|
+
};
|
|
1734
1718
|
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1719
|
+
const updateRingsForMiter = (rings, position, miterSize) => {
|
|
1720
|
+
return rings.map((ring, ringIndex) => {
|
|
1721
|
+
switch (position) {
|
|
1722
|
+
case 'right':
|
|
1723
|
+
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
1724
|
+
|
|
1725
|
+
default:
|
|
1726
|
+
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
1739
1727
|
}
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1728
|
+
});
|
|
1729
|
+
};
|
|
1730
|
+
|
|
1731
|
+
const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
|
|
1732
|
+
let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
|
|
1733
|
+
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
1734
|
+
|
|
1735
|
+
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
1736
|
+
|
|
1737
|
+
function SGisPolylineSymbol(originalSymbol) {
|
|
1738
|
+
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
1739
|
+
|
|
1740
|
+
var _this;
|
|
1741
|
+
|
|
1742
|
+
_classCallCheck(this, SGisPolylineSymbol);
|
|
1743
|
+
|
|
1744
|
+
_this = _super.call(this, {
|
|
1745
|
+
// @ts-ignore
|
|
1746
|
+
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
1747
|
+
strokeWidth: clamp( // @ts-ignore
|
|
1748
|
+
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
1749
|
+
// @ts-ignore
|
|
1750
|
+
lineDash: getLineDash(originalSymbol.stroke),
|
|
1751
|
+
// @ts-ignore
|
|
1752
|
+
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
1753
|
+
});
|
|
1754
|
+
_this.originalSymbol = originalSymbol;
|
|
1755
|
+
return _this;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
_createClass(SGisPolylineSymbol, [{
|
|
1759
|
+
key: "renderFunction",
|
|
1760
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
1761
|
+
if (!isSimplePolylineSymbol(this.originalSymbol)) return _get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, feature, resolution, crs);
|
|
1762
|
+
const {
|
|
1763
|
+
ending,
|
|
1764
|
+
beginningSize,
|
|
1765
|
+
beginning,
|
|
1766
|
+
endingSize
|
|
1767
|
+
} = this.originalSymbol;
|
|
1768
|
+
const renders = [];
|
|
1769
|
+
const featureCopy = feature.clone();
|
|
1770
|
+
const beginningMiterRender = getLineMiterRender({
|
|
1771
|
+
color: this.strokeColor,
|
|
1772
|
+
// @ts-ignore
|
|
1773
|
+
kind: beginning,
|
|
1774
|
+
position: 'left',
|
|
1775
|
+
// @ts-ignore
|
|
1776
|
+
size: beginningSize,
|
|
1777
|
+
strokeWidth: this.strokeWidth
|
|
1762
1778
|
});
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
renderLabel: this.renderLabelSymbol
|
|
1772
|
-
})
|
|
1779
|
+
const endingMiterRender = getLineMiterRender({
|
|
1780
|
+
color: this.strokeColor,
|
|
1781
|
+
// @ts-ignore
|
|
1782
|
+
kind: ending,
|
|
1783
|
+
position: 'right',
|
|
1784
|
+
// @ts-ignore
|
|
1785
|
+
size: endingSize,
|
|
1786
|
+
strokeWidth: this.strokeWidth
|
|
1773
1787
|
});
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
1781
|
-
delete this.tempLabel;
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
}, {
|
|
1785
|
-
key: "removeCoordLabel",
|
|
1786
|
-
value: function removeCoordLabel() {
|
|
1787
|
-
if (this.coordLabel) {
|
|
1788
|
-
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
1789
|
-
delete this.coordLabel;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
}, {
|
|
1793
|
-
key: "removeMeasureLabel",
|
|
1794
|
-
value: function removeMeasureLabel() {
|
|
1795
|
-
if (this.measureResultLabel) {
|
|
1796
|
-
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
1797
|
-
delete this.measureResultLabel;
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
}, {
|
|
1801
|
-
key: "drawPointOnMouseMove",
|
|
1802
|
-
value: function drawPointOnMouseMove(event) {
|
|
1803
|
-
if (this.tempLabel) {
|
|
1804
|
-
this.tempLabel.position = event.point.position;
|
|
1788
|
+
|
|
1789
|
+
if (beginningMiterRender) {
|
|
1790
|
+
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
1791
|
+
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
1792
|
+
featureCopy.rings = updatedRings;
|
|
1793
|
+
renders.push(render);
|
|
1805
1794
|
}
|
|
1795
|
+
|
|
1796
|
+
if (endingMiterRender) {
|
|
1797
|
+
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
1798
|
+
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
1799
|
+
featureCopy.rings = updatedRings;
|
|
1800
|
+
renders.push(render);
|
|
1801
|
+
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
1802
|
+
|
|
1803
|
+
|
|
1804
|
+
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
1805
|
+
return renders;
|
|
1806
1806
|
}
|
|
1807
1807
|
}, {
|
|
1808
|
-
key: "
|
|
1809
|
-
value: function
|
|
1810
|
-
|
|
1811
|
-
wrapper
|
|
1812
|
-
} = this.painter;
|
|
1813
|
-
|
|
1814
|
-
if (wrapper && typeof wrapper !== 'string') {
|
|
1815
|
-
wrapper.style.cursor = cursor;
|
|
1816
|
-
}
|
|
1808
|
+
key: "clone",
|
|
1809
|
+
value: function clone() {
|
|
1810
|
+
return new SGisPolylineSymbol(this.originalSymbol);
|
|
1817
1811
|
}
|
|
1818
1812
|
}]);
|
|
1819
1813
|
|
|
1820
|
-
return
|
|
1821
|
-
}(
|
|
1814
|
+
return SGisPolylineSymbol;
|
|
1815
|
+
}(PolylineSymbol);
|
|
1822
1816
|
|
|
1823
|
-
let
|
|
1824
|
-
_inherits(
|
|
1817
|
+
let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
|
|
1818
|
+
_inherits(LabelSymbol, _DynamicPointSymbol);
|
|
1825
1819
|
|
|
1826
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
1820
|
+
var _super = /*#__PURE__*/_createSuper(LabelSymbol);
|
|
1827
1821
|
|
|
1828
|
-
function
|
|
1822
|
+
function LabelSymbol(_temp) {
|
|
1829
1823
|
var _this;
|
|
1830
1824
|
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
_this.measureResult = () => {
|
|
1836
|
-
const feature = _this.activeFeature;
|
|
1837
|
-
if (!feature) return null;
|
|
1838
|
-
const {
|
|
1839
|
-
rings,
|
|
1840
|
-
isEnclosed,
|
|
1841
|
-
crs
|
|
1842
|
-
} = feature;
|
|
1843
|
-
const pointsCount = rings[0].length;
|
|
1844
|
-
const position = rings[0][pointsCount - 1];
|
|
1845
|
-
const area$1 = area(rings, crs);
|
|
1846
|
-
const length$1 = length(rings, crs, isEnclosed);
|
|
1847
|
-
const content = isEnclosed ? _this.formatters.polygon(area$1, length$1) : _this.formatters.length(length$1);
|
|
1848
|
-
return {
|
|
1849
|
-
content,
|
|
1850
|
-
position
|
|
1851
|
-
};
|
|
1852
|
-
};
|
|
1853
|
-
|
|
1854
|
-
_this.removeFeature = () => {
|
|
1855
|
-
_this.fire('remove');
|
|
1856
|
-
};
|
|
1857
|
-
|
|
1858
|
-
_this.painter = painter;
|
|
1859
|
-
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
1860
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1861
|
-
|
|
1862
|
-
_this.on('change', _this.updateMeasureResult);
|
|
1825
|
+
let {
|
|
1826
|
+
component,
|
|
1827
|
+
offset
|
|
1828
|
+
} = _temp === void 0 ? {} : _temp;
|
|
1863
1829
|
|
|
1864
|
-
|
|
1830
|
+
_classCallCheck(this, LabelSymbol);
|
|
1865
1831
|
|
|
1832
|
+
_this = _super.call(this, {
|
|
1833
|
+
offset
|
|
1834
|
+
});
|
|
1835
|
+
_this.component = component;
|
|
1866
1836
|
return _this;
|
|
1867
1837
|
}
|
|
1868
1838
|
|
|
1869
|
-
_createClass(
|
|
1870
|
-
key: "
|
|
1871
|
-
value: function
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1839
|
+
_createClass(LabelSymbol, [{
|
|
1840
|
+
key: "_getFeatureNode",
|
|
1841
|
+
value: function _getFeatureNode(feature) {
|
|
1842
|
+
const node = document.createElement('div');
|
|
1843
|
+
this.renderDom(feature.content, node);
|
|
1844
|
+
return node;
|
|
1875
1845
|
}
|
|
1876
1846
|
}, {
|
|
1877
|
-
key: "
|
|
1878
|
-
value: function
|
|
1879
|
-
|
|
1880
|
-
if (measureResult === null) return;
|
|
1881
|
-
const {
|
|
1882
|
-
content,
|
|
1883
|
-
position
|
|
1884
|
-
} = measureResult;
|
|
1885
|
-
this.measureResultLabel = new LabelFeature(position, {
|
|
1886
|
-
content,
|
|
1887
|
-
crs: this.map.crs,
|
|
1888
|
-
symbol: createLabelSymbol({
|
|
1889
|
-
onClose: this.removeFeature,
|
|
1890
|
-
renderLabel: this.renderLabelSymbol
|
|
1891
|
-
})
|
|
1892
|
-
});
|
|
1893
|
-
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
1847
|
+
key: "_updateFeatureNode",
|
|
1848
|
+
value: function _updateFeatureNode(feature) {
|
|
1849
|
+
this.renderDom(feature.content, this.getNode(feature));
|
|
1894
1850
|
}
|
|
1895
1851
|
}, {
|
|
1896
|
-
key: "
|
|
1897
|
-
value: function
|
|
1898
|
-
if (
|
|
1899
|
-
|
|
1900
|
-
if (measureResult === null) return;
|
|
1901
|
-
const {
|
|
1902
|
-
content,
|
|
1903
|
-
position
|
|
1904
|
-
} = measureResult;
|
|
1905
|
-
this.measureResultLabel.content = content;
|
|
1906
|
-
this.measureResultLabel.position = position;
|
|
1852
|
+
key: "renderDom",
|
|
1853
|
+
value: function renderDom(content, node) {
|
|
1854
|
+
if (!node) {
|
|
1855
|
+
return;
|
|
1907
1856
|
}
|
|
1908
|
-
}
|
|
1909
|
-
}]);
|
|
1910
1857
|
|
|
1911
|
-
|
|
1912
|
-
}(PolyEditor);
|
|
1858
|
+
const Component = this.component;
|
|
1913
1859
|
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
|
|
1924
|
-
const widthDistance = distance(zeroPoint, maxWidthPoint);
|
|
1925
|
-
const pxK = width / (widthDistance || 1);
|
|
1926
|
-
return Math.round(meters * pxK);
|
|
1927
|
-
};
|
|
1928
|
-
|
|
1929
|
-
const polygonCircleFromPoint = (center, diameter) => {
|
|
1930
|
-
const coordinates = [];
|
|
1931
|
-
const radius = diameter / 2;
|
|
1932
|
-
const endAngle = Math.PI * 2;
|
|
1933
|
-
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
1934
|
-
let start = 0;
|
|
1935
|
-
let end = endAngle;
|
|
1860
|
+
if (Component) {
|
|
1861
|
+
ReactDOM.render(React.createElement(Component, {
|
|
1862
|
+
content: content
|
|
1863
|
+
}), node);
|
|
1864
|
+
} else {
|
|
1865
|
+
node.innerText = content;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
}]);
|
|
1936
1869
|
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
}
|
|
1870
|
+
return LabelSymbol;
|
|
1871
|
+
}(DynamicPointSymbol);
|
|
1940
1872
|
|
|
1941
|
-
|
|
1873
|
+
const defaultOffset = [8, -16];
|
|
1874
|
+
const createLabelSymbol = props => {
|
|
1875
|
+
const {
|
|
1876
|
+
offset = defaultOffset,
|
|
1877
|
+
renderLabel = (_ref) => {
|
|
1878
|
+
let {
|
|
1879
|
+
content
|
|
1880
|
+
} = _ref;
|
|
1881
|
+
return React.createElement("div", null, content);
|
|
1882
|
+
},
|
|
1883
|
+
onClose = undefined
|
|
1884
|
+
} = props || {};
|
|
1885
|
+
return new LabelSymbol({
|
|
1886
|
+
offset,
|
|
1887
|
+
component: (_ref2) => {
|
|
1888
|
+
let {
|
|
1889
|
+
content
|
|
1890
|
+
} = _ref2;
|
|
1891
|
+
return renderLabel({
|
|
1892
|
+
content,
|
|
1893
|
+
onClose
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
});
|
|
1942
1897
|
};
|
|
1943
1898
|
|
|
1944
|
-
|
|
1945
|
-
|
|
1899
|
+
function createShadowRender(position, _ref) {
|
|
1900
|
+
let {
|
|
1901
|
+
strokeWidth = 2,
|
|
1902
|
+
shadowColor,
|
|
1903
|
+
shadowSize,
|
|
1904
|
+
size = 6
|
|
1905
|
+
} = _ref;
|
|
1906
|
+
const shadowDiameter = size + strokeWidth + shadowSize;
|
|
1907
|
+
return new PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
|
|
1908
|
+
fillColor: 'transparent',
|
|
1909
|
+
strokeColor: shadowColor,
|
|
1910
|
+
strokeWidth: shadowSize,
|
|
1911
|
+
enclosed: true
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
function getEditorPointRenderer(position, _ref2) {
|
|
1915
|
+
let {
|
|
1916
|
+
strokeColor,
|
|
1917
|
+
strokeWidth,
|
|
1918
|
+
shadowColor,
|
|
1919
|
+
fillColor,
|
|
1920
|
+
shadowSize,
|
|
1921
|
+
size = 0
|
|
1922
|
+
} = _ref2;
|
|
1923
|
+
return [createShadowRender(position, {
|
|
1924
|
+
strokeWidth,
|
|
1925
|
+
strokeColor,
|
|
1926
|
+
shadowSize,
|
|
1927
|
+
shadowColor,
|
|
1928
|
+
size
|
|
1929
|
+
}), new PolyRender(polygonCircleFromPoint(position, size), {
|
|
1930
|
+
fillColor,
|
|
1931
|
+
strokeColor,
|
|
1932
|
+
strokeWidth,
|
|
1933
|
+
enclosed: true
|
|
1934
|
+
})];
|
|
1935
|
+
}
|
|
1946
1936
|
|
|
1947
|
-
|
|
1937
|
+
let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
|
|
1938
|
+
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
1948
1939
|
|
|
1949
|
-
|
|
1950
|
-
_classCallCheck(this, CircleLineMiterRender);
|
|
1940
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
|
|
1951
1941
|
|
|
1952
|
-
|
|
1942
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
1943
|
+
function ShadowedPointSymbol(options) {
|
|
1944
|
+
_classCallCheck(this, ShadowedPointSymbol);
|
|
1945
|
+
|
|
1946
|
+
return _super.call(this, options);
|
|
1953
1947
|
}
|
|
1954
1948
|
|
|
1955
|
-
_createClass(
|
|
1956
|
-
key: "
|
|
1957
|
-
|
|
1958
|
-
|
|
1949
|
+
_createClass(ShadowedPointSymbol, [{
|
|
1950
|
+
key: "renderFunction",
|
|
1951
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
1952
|
+
if (!(feature instanceof PointFeature)) return [];
|
|
1953
|
+
const {
|
|
1954
|
+
position
|
|
1955
|
+
} = feature.projectTo(crs);
|
|
1956
|
+
const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
|
|
1957
|
+
const shadowRender = this.getShadow(pxPosition, feature);
|
|
1958
|
+
const pointArc = this.getPoint(pxPosition, feature);
|
|
1959
|
+
return shadowRender ? [shadowRender, pointArc] : [pointArc];
|
|
1959
1960
|
}
|
|
1960
1961
|
}, {
|
|
1961
|
-
key: "
|
|
1962
|
-
value: function
|
|
1963
|
-
|
|
1964
|
-
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1962
|
+
key: "getShadow",
|
|
1963
|
+
value: function getShadow(position, _feature) {
|
|
1964
|
+
return ShadowedPointSymbol.getShadowArc(position, this);
|
|
1965
1965
|
}
|
|
1966
1966
|
}, {
|
|
1967
|
-
key: "
|
|
1968
|
-
value: function
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1967
|
+
key: "getPoint",
|
|
1968
|
+
value: function getPoint(position, _feature) {
|
|
1969
|
+
return ShadowedPointSymbol.getPointArc(position, this);
|
|
1970
|
+
}
|
|
1971
|
+
}], [{
|
|
1972
|
+
key: "getShadowArc",
|
|
1973
|
+
value: function getShadowArc(position, _ref) {
|
|
1974
|
+
let {
|
|
1975
|
+
strokeWidth = 2,
|
|
1976
|
+
shadowColor,
|
|
1977
|
+
shadowSize,
|
|
1978
|
+
size = 6
|
|
1979
|
+
} = _ref;
|
|
1980
|
+
return new PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
|
|
1981
|
+
fillColor: 'transparent',
|
|
1982
|
+
strokeColor: shadowColor,
|
|
1983
|
+
strokeWidth: shadowSize,
|
|
1974
1984
|
enclosed: true
|
|
1975
1985
|
});
|
|
1976
1986
|
}
|
|
1977
|
-
}]);
|
|
1978
|
-
|
|
1979
|
-
return CircleLineMiterRender;
|
|
1980
|
-
}(LineMiterRender);
|
|
1981
|
-
|
|
1982
|
-
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1983
|
-
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1984
|
-
|
|
1985
|
-
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1986
|
-
|
|
1987
|
-
function SquareLineMiterRender() {
|
|
1988
|
-
_classCallCheck(this, SquareLineMiterRender);
|
|
1989
|
-
|
|
1990
|
-
return _super.apply(this, arguments);
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
|
-
_createClass(SquareLineMiterRender, [{
|
|
1994
|
-
key: "usageSize",
|
|
1995
|
-
get: function get() {
|
|
1996
|
-
return this.miterSize + this.strokeWidth;
|
|
1997
|
-
}
|
|
1998
1987
|
}, {
|
|
1999
|
-
key: "
|
|
2000
|
-
value: function
|
|
2001
|
-
let
|
|
2002
|
-
|
|
1988
|
+
key: "getPointArc",
|
|
1989
|
+
value: function getPointArc(position, _ref2) {
|
|
1990
|
+
let {
|
|
1991
|
+
strokeWidth,
|
|
1992
|
+
fillColor,
|
|
1993
|
+
strokeColor,
|
|
1994
|
+
size = 6
|
|
1995
|
+
} = _ref2;
|
|
1996
|
+
return new PolyRender(polygonCircleFromPoint(position, size), {
|
|
1997
|
+
fillColor,
|
|
1998
|
+
strokeColor,
|
|
1999
|
+
strokeWidth,
|
|
2000
|
+
enclosed: true
|
|
2001
|
+
});
|
|
2003
2002
|
}
|
|
2004
2003
|
}, {
|
|
2005
|
-
key: "
|
|
2006
|
-
value: function
|
|
2007
|
-
const
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
fillColor: isFilled ? this.color : void 0,
|
|
2011
|
-
fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
|
|
2012
|
-
lineCap: 'square',
|
|
2013
|
-
lineJoin: 'miter',
|
|
2014
|
-
strokeColor: this.color,
|
|
2015
|
-
strokeWidth: this.strokeWidth
|
|
2016
|
-
});
|
|
2004
|
+
key: "getArcs",
|
|
2005
|
+
value: function getArcs(position, params) {
|
|
2006
|
+
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2007
|
+
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2008
|
+
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2017
2009
|
}
|
|
2018
2010
|
}]);
|
|
2019
2011
|
|
|
2020
|
-
return
|
|
2021
|
-
}(
|
|
2012
|
+
return ShadowedPointSymbol;
|
|
2013
|
+
}(PointSymbol);
|
|
2022
2014
|
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
case LineMiterKind.Arrow:
|
|
2026
|
-
case LineMiterKind.FilledArrow:
|
|
2027
|
-
return new ArrowLineMiterRender(options);
|
|
2015
|
+
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2016
|
+
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2028
2017
|
|
|
2029
|
-
|
|
2030
|
-
case LineMiterKind.FilledSquare:
|
|
2031
|
-
return new SquareLineMiterRender(options);
|
|
2018
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2032
2019
|
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2020
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2021
|
+
function ShadowedPolySymbol(options) {
|
|
2022
|
+
_classCallCheck(this, ShadowedPolySymbol);
|
|
2036
2023
|
|
|
2037
|
-
|
|
2038
|
-
return null;
|
|
2024
|
+
return _super.call(this, options);
|
|
2039
2025
|
}
|
|
2040
|
-
};
|
|
2041
2026
|
|
|
2042
|
-
|
|
2043
|
-
|
|
2027
|
+
_createClass(ShadowedPolySymbol, [{
|
|
2028
|
+
key: "renderFunction",
|
|
2029
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
2030
|
+
if (!(feature instanceof Poly)) return [];
|
|
2044
2031
|
|
|
2045
|
-
|
|
2046
|
-
const coordinates = reversedRing[i];
|
|
2032
|
+
const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
|
|
2047
2033
|
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2034
|
+
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2035
|
+
const shadowRender = this.getShadow(coordinates, feature);
|
|
2036
|
+
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2037
|
+
let renders = [polyRender];
|
|
2051
2038
|
|
|
2052
|
-
|
|
2039
|
+
if (shadowRender) {
|
|
2040
|
+
renders = [shadowRender, polyRender];
|
|
2041
|
+
}
|
|
2053
2042
|
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
return reversedRing.reverse();
|
|
2060
|
-
};
|
|
2061
|
-
|
|
2062
|
-
const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
|
|
2063
|
-
const newRing = ring.slice();
|
|
2064
|
-
|
|
2065
|
-
for (let i = 0; i < newRing.length; i++) {
|
|
2066
|
-
const coordinates = newRing[i];
|
|
2043
|
+
if (vertexRenders) {
|
|
2044
|
+
renders = renders.concat(vertexRenders);
|
|
2045
|
+
}
|
|
2067
2046
|
|
|
2068
|
-
|
|
2069
|
-
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
2047
|
+
return renders;
|
|
2070
2048
|
}
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2049
|
+
}, {
|
|
2050
|
+
key: "getShadow",
|
|
2051
|
+
value: function getShadow(coordinates, _feature) {
|
|
2052
|
+
return new PolyRender(coordinates, {
|
|
2053
|
+
fillStyle: FillStyle.None,
|
|
2054
|
+
enclosed: this.enclose,
|
|
2055
|
+
strokeColor: this.shadowColor,
|
|
2056
|
+
strokeWidth: this.shadowSize,
|
|
2057
|
+
lineDash: this.lineDash
|
|
2058
|
+
});
|
|
2076
2059
|
}
|
|
2077
|
-
}
|
|
2060
|
+
}, {
|
|
2061
|
+
key: "getPolyRender",
|
|
2062
|
+
value: function getPolyRender(coordinates, _feature) {
|
|
2063
|
+
return new PolyRender(coordinates, {
|
|
2064
|
+
fillStyle: this.enclose ? FillStyle.Color : FillStyle.None,
|
|
2065
|
+
enclosed: this.enclose,
|
|
2066
|
+
fillColor: this.fillColor,
|
|
2067
|
+
strokeColor: this.strokeColor,
|
|
2068
|
+
strokeWidth: this.strokeWidth,
|
|
2069
|
+
lineDash: this.lineDash
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
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
|
+
}]);
|
|
2078
2089
|
|
|
2079
|
-
return
|
|
2090
|
+
return ShadowedPolySymbol;
|
|
2091
|
+
}(PolylineSymbol);
|
|
2092
|
+
const polySymbolParams = {
|
|
2093
|
+
strokeWidth: 2,
|
|
2094
|
+
strokeColor: '#e33600',
|
|
2095
|
+
shadowSize: 8,
|
|
2096
|
+
shadowColor: 'rgba(227, 54, 0, 0.3)'
|
|
2080
2097
|
};
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
case 'right':
|
|
2086
|
-
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
2087
|
-
|
|
2088
|
-
default:
|
|
2089
|
-
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
2090
|
-
}
|
|
2091
|
-
});
|
|
2098
|
+
const measureSymbolParams = {
|
|
2099
|
+
strokeColor: '#ff6933',
|
|
2100
|
+
shadowSize: 0,
|
|
2101
|
+
vertexShadowSize: 0
|
|
2092
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
|
+
}));
|
|
2093
2124
|
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
2097
|
-
|
|
2098
|
-
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
2099
|
-
|
|
2100
|
-
function SGisPolylineSymbol(originalSymbol) {
|
|
2101
|
-
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
2125
|
+
let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
|
|
2126
|
+
_inherits(SelectedPointSymbol, _ShadowedPointSymbol);
|
|
2102
2127
|
|
|
2103
|
-
|
|
2128
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
|
|
2104
2129
|
|
|
2105
|
-
|
|
2130
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2131
|
+
function SelectedPointSymbol(props) {
|
|
2132
|
+
_classCallCheck(this, SelectedPointSymbol);
|
|
2106
2133
|
|
|
2107
|
-
|
|
2108
|
-
// @ts-ignore
|
|
2109
|
-
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
2110
|
-
strokeWidth: clamp( // @ts-ignore
|
|
2111
|
-
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
2112
|
-
// @ts-ignore
|
|
2113
|
-
lineDash: getLineDash(originalSymbol.stroke),
|
|
2114
|
-
// @ts-ignore
|
|
2115
|
-
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
2116
|
-
});
|
|
2117
|
-
_this.originalSymbol = originalSymbol;
|
|
2118
|
-
return _this;
|
|
2134
|
+
return _super.call(this, props);
|
|
2119
2135
|
}
|
|
2120
2136
|
|
|
2121
|
-
_createClass(
|
|
2122
|
-
key: "
|
|
2123
|
-
value: function
|
|
2124
|
-
if (
|
|
2125
|
-
|
|
2126
|
-
ending,
|
|
2127
|
-
beginningSize,
|
|
2128
|
-
beginning,
|
|
2129
|
-
endingSize
|
|
2130
|
-
} = this.originalSymbol;
|
|
2131
|
-
const renders = [];
|
|
2132
|
-
const featureCopy = feature.clone();
|
|
2133
|
-
const beginningMiterRender = getLineMiterRender({
|
|
2134
|
-
color: this.strokeColor,
|
|
2135
|
-
// @ts-ignore
|
|
2136
|
-
kind: beginning,
|
|
2137
|
-
position: 'left',
|
|
2138
|
-
// @ts-ignore
|
|
2139
|
-
size: beginningSize,
|
|
2140
|
-
strokeWidth: this.strokeWidth
|
|
2141
|
-
});
|
|
2142
|
-
const endingMiterRender = getLineMiterRender({
|
|
2143
|
-
color: this.strokeColor,
|
|
2144
|
-
// @ts-ignore
|
|
2145
|
-
kind: ending,
|
|
2146
|
-
position: 'right',
|
|
2147
|
-
// @ts-ignore
|
|
2148
|
-
size: endingSize,
|
|
2149
|
-
strokeWidth: this.strokeWidth
|
|
2150
|
-
});
|
|
2151
|
-
|
|
2152
|
-
if (beginningMiterRender) {
|
|
2153
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
2154
|
-
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2155
|
-
featureCopy.rings = updatedRings;
|
|
2156
|
-
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);
|
|
2157
2142
|
}
|
|
2158
|
-
|
|
2159
|
-
if (endingMiterRender) {
|
|
2160
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
2161
|
-
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2162
|
-
featureCopy.rings = updatedRings;
|
|
2163
|
-
renders.push(render);
|
|
2164
|
-
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
2168
|
-
return renders;
|
|
2169
2143
|
}
|
|
2170
2144
|
}, {
|
|
2171
|
-
key: "
|
|
2172
|
-
value: function
|
|
2173
|
-
|
|
2174
|
-
}
|
|
2175
|
-
}]);
|
|
2145
|
+
key: "getPoint",
|
|
2146
|
+
value: function getPoint(position, feature) {
|
|
2147
|
+
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2176
2148
|
|
|
2177
|
-
|
|
2178
|
-
|
|
2149
|
+
if (feature.isSelected) {
|
|
2150
|
+
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2151
|
+
pointRender.fillColor = this.selectedFillColor;
|
|
2152
|
+
}
|
|
2179
2153
|
|
|
2180
|
-
|
|
2181
|
-
|
|
2154
|
+
return pointRender;
|
|
2155
|
+
}
|
|
2156
|
+
}]);
|
|
2182
2157
|
|
|
2183
|
-
|
|
2158
|
+
return SelectedPointSymbol;
|
|
2159
|
+
}(ShadowedPointSymbol);
|
|
2184
2160
|
|
|
2185
|
-
|
|
2186
|
-
|
|
2161
|
+
let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
|
|
2162
|
+
_inherits(SelectedPolySymbol, _ShadowedPolySymbol);
|
|
2187
2163
|
|
|
2188
|
-
|
|
2189
|
-
component,
|
|
2190
|
-
offset
|
|
2191
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2164
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
|
|
2192
2165
|
|
|
2193
|
-
|
|
2166
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2167
|
+
function SelectedPolySymbol(props) {
|
|
2168
|
+
_classCallCheck(this, SelectedPolySymbol);
|
|
2194
2169
|
|
|
2195
|
-
|
|
2196
|
-
offset
|
|
2197
|
-
});
|
|
2198
|
-
_this.component = component;
|
|
2199
|
-
return _this;
|
|
2170
|
+
return _super.call(this, props);
|
|
2200
2171
|
}
|
|
2201
2172
|
|
|
2202
|
-
_createClass(
|
|
2203
|
-
key: "
|
|
2204
|
-
value: function
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
}
|
|
2209
|
-
}, {
|
|
2210
|
-
key: "_updateFeatureNode",
|
|
2211
|
-
value: function _updateFeatureNode(feature) {
|
|
2212
|
-
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
|
+
}
|
|
2213
2179
|
}
|
|
2214
2180
|
}, {
|
|
2215
|
-
key: "
|
|
2216
|
-
value: function
|
|
2217
|
-
|
|
2218
|
-
return;
|
|
2219
|
-
}
|
|
2181
|
+
key: "getPolyRender",
|
|
2182
|
+
value: function getPolyRender(coordinates, feature) {
|
|
2183
|
+
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2220
2184
|
|
|
2221
|
-
|
|
2185
|
+
if (feature.isSelected) {
|
|
2186
|
+
polyRender.fillColor = this.selectedFillColor;
|
|
2187
|
+
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2222
2188
|
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
}), node);
|
|
2227
|
-
} else {
|
|
2228
|
-
node.innerText = content;
|
|
2189
|
+
if (this.selectedStrokeWidth !== void 0) {
|
|
2190
|
+
polyRender.strokeWidth = this.selectedStrokeWidth;
|
|
2191
|
+
}
|
|
2229
2192
|
}
|
|
2193
|
+
|
|
2194
|
+
return polyRender;
|
|
2230
2195
|
}
|
|
2231
2196
|
}]);
|
|
2232
2197
|
|
|
2233
|
-
return
|
|
2234
|
-
}(
|
|
2198
|
+
return SelectedPolySymbol;
|
|
2199
|
+
}(ShadowedPolySymbol);
|
|
2235
2200
|
|
|
2236
|
-
const
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
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
|
+
});
|
|
2261
2229
|
|
|
2262
|
-
|
|
2230
|
+
const metersToPixels = (meters, _ref) => {
|
|
2263
2231
|
let {
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
shadowSize,
|
|
2267
|
-
size = 6
|
|
2232
|
+
painter,
|
|
2233
|
+
crs = geo
|
|
2268
2234
|
} = _ref;
|
|
2269
|
-
const
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
let {
|
|
2279
|
-
strokeColor,
|
|
2280
|
-
strokeWidth,
|
|
2281
|
-
shadowColor,
|
|
2282
|
-
fillColor,
|
|
2283
|
-
shadowSize,
|
|
2284
|
-
size = 0
|
|
2285
|
-
} = _ref2;
|
|
2286
|
-
return [createShadowRender(position, {
|
|
2287
|
-
strokeWidth,
|
|
2288
|
-
strokeColor,
|
|
2289
|
-
shadowSize,
|
|
2290
|
-
shadowColor,
|
|
2291
|
-
size
|
|
2292
|
-
}), new PolyRender(polygonCircleFromPoint(position, size), {
|
|
2293
|
-
fillColor,
|
|
2294
|
-
strokeColor,
|
|
2295
|
-
strokeWidth,
|
|
2296
|
-
enclosed: true
|
|
2297
|
-
})];
|
|
2298
|
-
}
|
|
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 = distance(zeroPoint, maxWidthPoint);
|
|
2241
|
+
const pxK = width / (widthDistance || 1);
|
|
2242
|
+
return Math.round(meters * pxK);
|
|
2243
|
+
};
|
|
2299
2244
|
|
|
2300
|
-
|
|
2301
|
-
|
|
2245
|
+
const defaultPathStyles = {
|
|
2246
|
+
strokeWidth: 2,
|
|
2247
|
+
strokeColor: 'rgb(0, 163, 245)',
|
|
2248
|
+
fillStyle: FillStyle.None
|
|
2249
|
+
};
|
|
2250
|
+
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2251
|
+
_inherits(SVGPoly, _Symbol);
|
|
2302
2252
|
|
|
2303
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
2253
|
+
var _super = /*#__PURE__*/_createSuper(SVGPoly);
|
|
2304
2254
|
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
_classCallCheck(this, ShadowedPointSymbol);
|
|
2255
|
+
function SVGPoly(_temp) {
|
|
2256
|
+
var _this;
|
|
2308
2257
|
|
|
2309
|
-
|
|
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;
|
|
2310
2280
|
}
|
|
2311
2281
|
|
|
2312
|
-
_createClass(
|
|
2282
|
+
_createClass(SVGPoly, [{
|
|
2313
2283
|
key: "renderFunction",
|
|
2314
2284
|
value: function renderFunction(feature, resolution, crs) {
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2285
|
+
const coordinates = feature instanceof Poly ? new 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 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];
|
|
2323
2306
|
}
|
|
2324
2307
|
}, {
|
|
2325
|
-
key: "
|
|
2326
|
-
value: function
|
|
2327
|
-
|
|
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
|
+
}
|
|
2328
2318
|
}
|
|
2329
2319
|
}, {
|
|
2330
|
-
key: "
|
|
2331
|
-
value: function
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
}], [{
|
|
2335
|
-
key: "getShadowArc",
|
|
2336
|
-
value: function getShadowArc(position, _ref) {
|
|
2320
|
+
key: "update",
|
|
2321
|
+
value: function update(_ref) {
|
|
2322
|
+
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2323
|
+
|
|
2337
2324
|
let {
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2325
|
+
bbox,
|
|
2326
|
+
resolution,
|
|
2327
|
+
feature,
|
|
2328
|
+
crs
|
|
2342
2329
|
} = _ref;
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
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 ? new 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;
|
|
2349
2351
|
}
|
|
2350
2352
|
}, {
|
|
2351
|
-
key: "
|
|
2352
|
-
value: function
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
});
|
|
2365
|
-
}
|
|
2366
|
-
}, {
|
|
2367
|
-
key: "getArcs",
|
|
2368
|
-
value: function getArcs(position, params) {
|
|
2369
|
-
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2370
|
-
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2371
|
-
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2372
|
-
}
|
|
2373
|
-
}]);
|
|
2374
|
-
|
|
2375
|
-
return ShadowedPointSymbol;
|
|
2376
|
-
}(PointSymbol);
|
|
2377
|
-
|
|
2378
|
-
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2379
|
-
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2380
|
-
|
|
2381
|
-
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2382
|
-
|
|
2383
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2384
|
-
function ShadowedPolySymbol(options) {
|
|
2385
|
-
_classCallCheck(this, ShadowedPolySymbol);
|
|
2386
|
-
|
|
2387
|
-
return _super.call(this, options);
|
|
2388
|
-
}
|
|
2389
|
-
|
|
2390
|
-
_createClass(ShadowedPolySymbol, [{
|
|
2391
|
-
key: "renderFunction",
|
|
2392
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2393
|
-
if (!(feature instanceof Poly)) return [];
|
|
2394
|
-
const coordinates = PolylineSymbol.getRenderedCoordinates(feature, resolution, crs);
|
|
2395
|
-
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2396
|
-
const shadowRender = this.getShadow(coordinates, feature);
|
|
2397
|
-
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2398
|
-
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(_extends({
|
|
2363
|
+
coordinates
|
|
2364
|
+
}, defaultPathStyles, {
|
|
2365
|
+
appendToSvg: this.appendToSvg
|
|
2366
|
+
}, this.pathStyles));
|
|
2399
2367
|
|
|
2400
|
-
if (
|
|
2401
|
-
|
|
2368
|
+
if (this.circle) {
|
|
2369
|
+
svgRender._setArcNode();
|
|
2370
|
+
} else {
|
|
2371
|
+
svgRender._setPolyNode();
|
|
2402
2372
|
}
|
|
2403
2373
|
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
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');
|
|
2407
2379
|
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
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
|
+
}
|
|
2419
2390
|
});
|
|
2391
|
+
return svgElement;
|
|
2420
2392
|
}
|
|
2421
2393
|
}, {
|
|
2422
|
-
key: "
|
|
2423
|
-
value: function
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2394
|
+
key: "_setEventListeners",
|
|
2395
|
+
value: function _setEventListeners(dynamicFeature) {
|
|
2396
|
+
var _dynamicFeature$__dyn;
|
|
2397
|
+
|
|
2398
|
+
if (dynamicFeature.eventFlags === 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(mouseEvents).forEach(eventName => {
|
|
2401
|
+
if (dynamicFeature.eventFlags & mouseEvents[eventName].flag) {
|
|
2402
|
+
listenDomEvent(svgNode, mouseEvents[eventName].type, event => {
|
|
2403
|
+
dynamicFeature.fire(mouseEvents[eventName].type, {
|
|
2404
|
+
node: svgNode,
|
|
2405
|
+
browserEvent: event
|
|
2406
|
+
});
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2431
2409
|
});
|
|
2432
2410
|
}
|
|
2433
|
-
}, {
|
|
2434
|
-
key: "getVertexRenders",
|
|
2435
|
-
value: function getVertexRenders(coordinates) {
|
|
2436
|
-
if (!this.showVertex) return;
|
|
2437
|
-
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2438
|
-
return acc.concat(curr);
|
|
2439
|
-
}, []);
|
|
2440
|
-
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2441
|
-
size: 6,
|
|
2442
|
-
strokeWidth: 2,
|
|
2443
|
-
shadowColor: this.shadowColor,
|
|
2444
|
-
strokeColor: this.strokeColor,
|
|
2445
|
-
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2446
|
-
fillColor: '#ffffff'
|
|
2447
|
-
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2448
|
-
}
|
|
2449
2411
|
}]);
|
|
2450
2412
|
|
|
2451
|
-
return
|
|
2452
|
-
}(
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2413
|
+
return SVGPoly;
|
|
2414
|
+
}(Symbol$1);
|
|
2415
|
+
|
|
2416
|
+
function isSGisPointSymbol(symbol) {
|
|
2417
|
+
return symbol instanceof PointSymbol || symbol instanceof StaticImageSymbol || symbol instanceof SquareSymbol || symbol instanceof MaskedImage;
|
|
2418
|
+
}
|
|
2419
|
+
function isSGisImageSymbol(symbol) {
|
|
2420
|
+
return symbol instanceof StaticImageSymbol || symbol instanceof MaskedImage;
|
|
2421
|
+
}
|
|
2422
|
+
function isSGisPolygonSymbol(symbol) {
|
|
2423
|
+
return symbol instanceof PolygonSymbol || symbol instanceof BrushFill || symbol instanceof ImageFill;
|
|
2424
|
+
}
|
|
2425
|
+
function isSGisPolylineSymbol(symbol) {
|
|
2426
|
+
return symbol instanceof PolylineSymbol;
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
/**
|
|
2430
|
+
* Моки фич для отображения превью символа
|
|
2431
|
+
* http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
|
|
2432
|
+
*/
|
|
2433
|
+
|
|
2434
|
+
const viewBoxSize = 100;
|
|
2435
|
+
const pointFeature = /*#__PURE__*/new PointFeature([50, -50], {
|
|
2436
|
+
crs: plain
|
|
2437
|
+
});
|
|
2438
|
+
const lineFeature = /*#__PURE__*/new Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2439
|
+
crs: plain
|
|
2440
|
+
});
|
|
2441
|
+
const polygonFeature = /*#__PURE__*/new Polygon([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2442
|
+
crs: plain
|
|
2443
|
+
});
|
|
2444
|
+
const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
|
|
2445
|
+
crs: plain
|
|
2446
|
+
});
|
|
2447
|
+
const polygonLegendFeature = /*#__PURE__*/new Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
|
|
2448
|
+
crs: plain
|
|
2449
|
+
});
|
|
2450
|
+
const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2451
|
+
crs: plain
|
|
2452
|
+
});
|
|
2453
|
+
const MAP_LEGEND_FEATURES = {
|
|
2454
|
+
polygon: polygonMapLegendFeature
|
|
2458
2455
|
};
|
|
2459
|
-
const
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
vertexShadowSize: 0
|
|
2456
|
+
const LEGEND_FEATURES = {
|
|
2457
|
+
polyline: lineLegendFeature,
|
|
2458
|
+
polygon: polygonLegendFeature
|
|
2463
2459
|
};
|
|
2464
|
-
const
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2469
|
-
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2470
|
-
enclose: true,
|
|
2471
|
-
showVertex: true
|
|
2472
|
-
}));
|
|
2473
|
-
const snapSymbolParams = {
|
|
2474
|
-
size: 10,
|
|
2475
|
-
strokeWidth: 2,
|
|
2476
|
-
strokeColor: '#e33600',
|
|
2477
|
-
fillColor: '#ffffff',
|
|
2478
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2479
|
-
shadowSize: 3
|
|
2460
|
+
const MOCK_FEATURES = {
|
|
2461
|
+
point: pointFeature,
|
|
2462
|
+
polyline: lineFeature,
|
|
2463
|
+
polygon: polygonFeature
|
|
2480
2464
|
};
|
|
2481
|
-
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2482
|
-
strokeColor: '#ff6933',
|
|
2483
|
-
shadowSize: 0
|
|
2484
|
-
}));
|
|
2485
|
-
|
|
2486
|
-
let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
|
|
2487
|
-
_inherits(SelectedPointSymbol, _ShadowedPointSymbol);
|
|
2488
|
-
|
|
2489
|
-
var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
|
|
2490
2465
|
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2466
|
+
function getSymbolRenders(symbol, size, features) {
|
|
2467
|
+
if (size === void 0) {
|
|
2468
|
+
size = viewBoxSize;
|
|
2469
|
+
}
|
|
2494
2470
|
|
|
2495
|
-
|
|
2471
|
+
if (features === void 0) {
|
|
2472
|
+
features = {};
|
|
2496
2473
|
}
|
|
2497
2474
|
|
|
2498
|
-
|
|
2499
|
-
key: "getShadow",
|
|
2500
|
-
value: function getShadow(position, feature) {
|
|
2501
|
-
if (feature.isSelected) {
|
|
2502
|
-
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2503
|
-
}
|
|
2504
|
-
}
|
|
2505
|
-
}, {
|
|
2506
|
-
key: "getPoint",
|
|
2507
|
-
value: function getPoint(position, feature) {
|
|
2508
|
-
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2475
|
+
const resolution = viewBoxSize / size;
|
|
2509
2476
|
|
|
2510
|
-
|
|
2511
|
-
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2512
|
-
pointRender.fillColor = this.selectedFillColor;
|
|
2513
|
-
}
|
|
2477
|
+
const featuresToRender = _extends({}, MOCK_FEATURES, features);
|
|
2514
2478
|
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
}
|
|
2479
|
+
if (isSGisPolygonSymbol(symbol)) {
|
|
2480
|
+
return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, plain);
|
|
2481
|
+
}
|
|
2518
2482
|
|
|
2519
|
-
|
|
2520
|
-
|
|
2483
|
+
if (isSGisPolylineSymbol(symbol)) {
|
|
2484
|
+
return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, plain);
|
|
2485
|
+
}
|
|
2521
2486
|
|
|
2522
|
-
|
|
2523
|
-
|
|
2487
|
+
return symbol.renderFunctionAsync(featuresToRender.point, resolution, plain);
|
|
2488
|
+
}
|
|
2489
|
+
const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
|
|
2490
|
+
if (size === void 0) {
|
|
2491
|
+
size = viewBoxSize;
|
|
2492
|
+
}
|
|
2524
2493
|
|
|
2525
|
-
|
|
2494
|
+
return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
|
|
2495
|
+
};
|
|
2496
|
+
const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
|
|
2497
|
+
if (size === void 0) {
|
|
2498
|
+
size = viewBoxSize;
|
|
2499
|
+
}
|
|
2526
2500
|
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
_classCallCheck(this, SelectedPolySymbol);
|
|
2501
|
+
return getSymbolRenders(symbol, size, LEGEND_FEATURES);
|
|
2502
|
+
};
|
|
2530
2503
|
|
|
2531
|
-
|
|
2532
|
-
|
|
2504
|
+
function renderSymbolToCanvas(renders, canvas) {
|
|
2505
|
+
renders.forEach(render => {
|
|
2506
|
+
canvas.draw(render);
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2533
2509
|
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2539
|
-
}
|
|
2540
|
-
}
|
|
2541
|
-
}, {
|
|
2542
|
-
key: "getPolyRender",
|
|
2543
|
-
value: function getPolyRender(coordinates, feature) {
|
|
2544
|
-
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2510
|
+
function deserializeSymbol(symbol) {
|
|
2511
|
+
switch (symbol.type) {
|
|
2512
|
+
case 'circlePointSymbol':
|
|
2513
|
+
return deserializePointSymbol(symbol);
|
|
2545
2514
|
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2515
|
+
case 'squarePointSymbol':
|
|
2516
|
+
return deserializeSquareSymbol(symbol);
|
|
2549
2517
|
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2518
|
+
case 'maskedImagePointSymbol':
|
|
2519
|
+
return deserializeMaskedImageSymbol(symbol);
|
|
2554
2520
|
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
}]);
|
|
2521
|
+
case 'imagePointSymbol':
|
|
2522
|
+
return deserializeImagePointSymbol(symbol);
|
|
2558
2523
|
|
|
2559
|
-
|
|
2560
|
-
|
|
2524
|
+
case 'polygonSymbol':
|
|
2525
|
+
return deserializePolygonSymbol(symbol);
|
|
2561
2526
|
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2566
|
-
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2567
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2568
|
-
shadowSize: 3,
|
|
2569
|
-
selectedStrokeColor: '#ff5722',
|
|
2570
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2571
|
-
});
|
|
2572
|
-
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2573
|
-
strokeWidth: 6,
|
|
2574
|
-
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2575
|
-
shadowSize: 8,
|
|
2576
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2577
|
-
selectedStrokeColor: '#ff5722',
|
|
2578
|
-
selectedStrokeWidth: 2
|
|
2579
|
-
});
|
|
2580
|
-
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2581
|
-
strokeWidth: 2,
|
|
2582
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2583
|
-
shadowSize: 8,
|
|
2584
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2585
|
-
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2586
|
-
enclose: true,
|
|
2587
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2588
|
-
selectedStrokeColor: '#ff5722'
|
|
2589
|
-
});
|
|
2527
|
+
case 'simplePolylineSymbol':
|
|
2528
|
+
case 'polylineSymbol':
|
|
2529
|
+
return deserializePolylineSymbol(symbol);
|
|
2590
2530
|
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
};
|
|
2596
|
-
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2597
|
-
_inherits(SVGPoly, _Symbol);
|
|
2531
|
+
default:
|
|
2532
|
+
return null;
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2598
2535
|
|
|
2599
|
-
|
|
2536
|
+
function deserializePointSymbol(symbol) {
|
|
2537
|
+
// @ts-ignore
|
|
2538
|
+
return new PointSymbol(deserializePointSymbolParams(symbol));
|
|
2539
|
+
}
|
|
2600
2540
|
|
|
2601
|
-
|
|
2602
|
-
|
|
2541
|
+
function deserializeSquareSymbol(symbol) {
|
|
2542
|
+
return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
|
|
2543
|
+
// @ts-ignore
|
|
2544
|
+
angle: getParameterValue(symbol.angle)
|
|
2545
|
+
}));
|
|
2546
|
+
}
|
|
2603
2547
|
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2548
|
+
function deserializeMaskedImageSymbol(symbol) {
|
|
2549
|
+
return new 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
|
+
}
|
|
2611
2566
|
|
|
2612
|
-
|
|
2567
|
+
function deserializeImagePointSymbol(symbol) {
|
|
2568
|
+
return new 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
|
+
}
|
|
2613
2581
|
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
_this.redrawFeatureNode = redrawFeatureNode;
|
|
2618
|
-
_this.pathStyles = _extends({
|
|
2619
|
-
center: [0, 0],
|
|
2620
|
-
fillColor: 'none'
|
|
2621
|
-
}, pathStyles);
|
|
2622
|
-
_this.circle = circle;
|
|
2623
|
-
_this.className = className;
|
|
2624
|
-
_this.appendToSvg = appendToSvg;
|
|
2625
|
-
return _this;
|
|
2582
|
+
function deserializePolygonSymbol(symbol) {
|
|
2583
|
+
if (isPolygonHasPatternBrush(symbol)) {
|
|
2584
|
+
return new SGisImageFill(symbol);
|
|
2626
2585
|
}
|
|
2627
2586
|
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
const coordinates = feature instanceof Poly ? PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2632
|
-
this.setCirclePxRaius(crs);
|
|
2633
|
-
this.container.innerHTML = '';
|
|
2634
|
-
const svg = this.setSvg(coordinates);
|
|
2635
|
-
svg && this.container.append(svg);
|
|
2636
|
-
feature.__dynamicSymbolRender = new DynamicRender({
|
|
2637
|
-
node: this.container,
|
|
2638
|
-
update: (bbox, resolution) => this.update({
|
|
2639
|
-
bbox,
|
|
2640
|
-
resolution,
|
|
2641
|
-
feature,
|
|
2642
|
-
crs
|
|
2643
|
-
}),
|
|
2644
|
-
redraw: () => {
|
|
2645
|
-
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2646
|
-
}
|
|
2647
|
-
});
|
|
2587
|
+
if (isPolygonHasHatchBrush(symbol)) {
|
|
2588
|
+
return new SGisBrushFill(symbol);
|
|
2589
|
+
}
|
|
2648
2590
|
|
|
2649
|
-
|
|
2591
|
+
return new SGisPolygonSymbol(symbol);
|
|
2592
|
+
}
|
|
2650
2593
|
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
key: "setCirclePxRaius",
|
|
2655
|
-
value: function setCirclePxRaius(crs) {
|
|
2656
|
-
if (this.circle && this.pathStyles) {
|
|
2657
|
-
var _this$circle;
|
|
2594
|
+
function deserializePolylineSymbol(symbol) {
|
|
2595
|
+
return new SGisPolylineSymbol(symbol);
|
|
2596
|
+
}
|
|
2658
2597
|
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
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
|
+
}
|
|
2669
2614
|
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
feature,
|
|
2674
|
-
crs
|
|
2675
|
-
} = _ref;
|
|
2676
|
-
if (!feature) return;
|
|
2677
|
-
if (!bbox) bbox = feature.__lastBbox;
|
|
2678
|
-
if (!resolution) resolution = feature.__lastResolution;
|
|
2679
|
-
if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
|
|
2615
|
+
function deserializeBase64(base) {
|
|
2616
|
+
return "data:image/png;base64," + base;
|
|
2617
|
+
}
|
|
2680
2618
|
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
const svg = this.setSvg(newCoordinates);
|
|
2686
|
-
svg && this.container.append(svg);
|
|
2687
|
-
}
|
|
2619
|
+
function deserializeAnchor(offset) {
|
|
2620
|
+
// @ts-ignore
|
|
2621
|
+
return offset.map(getParameterValue);
|
|
2622
|
+
}
|
|
2688
2623
|
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
|
|
2692
|
-
const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
|
|
2693
|
-
this.container.style.left = dx.toString() + "px";
|
|
2694
|
-
this.container.style.top = dy.toString() + "px";
|
|
2695
|
-
feature.__lastBbox = bbox;
|
|
2696
|
-
feature.__lastResolution = resolution;
|
|
2697
|
-
}
|
|
2698
|
-
}, {
|
|
2699
|
-
key: "setSvg",
|
|
2700
|
-
value: function setSvg(coordinates) {
|
|
2701
|
-
const {
|
|
2702
|
-
lineCap,
|
|
2703
|
-
lineJoin,
|
|
2704
|
-
miterLimit,
|
|
2705
|
-
lineDash,
|
|
2706
|
-
dashOffset
|
|
2707
|
-
} = this.pathStyles || {};
|
|
2708
|
-
const svgRender = new SvgRender(_extends({
|
|
2709
|
-
coordinates
|
|
2710
|
-
}, defaultPathStyles, {
|
|
2711
|
-
appendToSvg: this.appendToSvg
|
|
2712
|
-
}, this.pathStyles));
|
|
2713
|
-
|
|
2714
|
-
if (this.circle) {
|
|
2715
|
-
svgRender._setArcNode();
|
|
2716
|
-
} else {
|
|
2717
|
-
svgRender._setPolyNode();
|
|
2718
|
-
}
|
|
2719
|
-
|
|
2720
|
-
let svgElement;
|
|
2721
|
-
svgRender.getNode((_, svg) => {
|
|
2722
|
-
svgElement = svg;
|
|
2723
|
-
this.className && svgElement.classList.add(this.className);
|
|
2724
|
-
const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
|
|
2725
|
-
|
|
2726
|
-
if (path) {
|
|
2727
|
-
path.setAttribute('stroke-linecap', lineCap || 'round');
|
|
2728
|
-
path.setAttribute('stroke-linejoin', lineJoin || 'round');
|
|
2729
|
-
path.setAttribute('stroke-miterlimit', (miterLimit || 10).toString());
|
|
2730
|
-
path.setAttribute('stroke-dashoffset', (dashOffset || 0).toString());
|
|
2731
|
-
|
|
2732
|
-
if (this.circle) {
|
|
2733
|
-
path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
|
|
2734
|
-
}
|
|
2735
|
-
}
|
|
2736
|
-
});
|
|
2737
|
-
return svgElement;
|
|
2738
|
-
}
|
|
2739
|
-
}, {
|
|
2740
|
-
key: "_setEventListeners",
|
|
2741
|
-
value: function _setEventListeners(dynamicFeature) {
|
|
2742
|
-
var _dynamicFeature$__dyn;
|
|
2743
|
-
|
|
2744
|
-
if (dynamicFeature.eventFlags === MouseEventFlags.None) return;
|
|
2745
|
-
const svgNode = dynamicFeature == null ? void 0 : (_dynamicFeature$__dyn = dynamicFeature.__dynamicSymbolRender) == null ? void 0 : _dynamicFeature$__dyn.node.querySelector(this.circle ? 'circle' : 'path');
|
|
2746
|
-
Object.keys(mouseEvents).forEach(eventName => {
|
|
2747
|
-
if (dynamicFeature.eventFlags & mouseEvents[eventName].flag) {
|
|
2748
|
-
listenDomEvent(svgNode, mouseEvents[eventName].type, event => {
|
|
2749
|
-
dynamicFeature.fire(mouseEvents[eventName].type, {
|
|
2750
|
-
node: svgNode,
|
|
2751
|
-
browserEvent: event
|
|
2752
|
-
});
|
|
2753
|
-
});
|
|
2754
|
-
}
|
|
2755
|
-
});
|
|
2756
|
-
}
|
|
2757
|
-
}]);
|
|
2758
|
-
|
|
2759
|
-
return SVGPoly;
|
|
2760
|
-
}(Symbol$1);
|
|
2761
|
-
|
|
2762
|
-
function isSGisPointSymbol(symbol) {
|
|
2763
|
-
return symbol instanceof PointSymbol || symbol instanceof StaticImageSymbol || symbol instanceof SquareSymbol || symbol instanceof MaskedImage;
|
|
2764
|
-
}
|
|
2765
|
-
function isSGisImageSymbol(symbol) {
|
|
2766
|
-
return symbol instanceof StaticImageSymbol || symbol instanceof MaskedImage;
|
|
2767
|
-
}
|
|
2768
|
-
function isSGisPolygonSymbol(symbol) {
|
|
2769
|
-
return symbol instanceof PolygonSymbol || symbol instanceof BrushFill || symbol instanceof ImageFill;
|
|
2770
|
-
}
|
|
2771
|
-
function isSGisPolylineSymbol(symbol) {
|
|
2772
|
-
return symbol instanceof PolylineSymbol;
|
|
2624
|
+
function deserializeColor(color) {
|
|
2625
|
+
return color ? new Color(color).toString() : null;
|
|
2773
2626
|
}
|
|
2774
2627
|
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
const pointFeature = /*#__PURE__*/new PointFeature([50, -50], {
|
|
2782
|
-
crs: plain
|
|
2783
|
-
});
|
|
2784
|
-
const lineFeature = /*#__PURE__*/new Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2785
|
-
crs: plain
|
|
2786
|
-
});
|
|
2787
|
-
const polygonFeature = /*#__PURE__*/new Polygon([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2788
|
-
crs: plain
|
|
2789
|
-
});
|
|
2790
|
-
const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
|
|
2791
|
-
crs: plain
|
|
2792
|
-
});
|
|
2793
|
-
const polygonLegendFeature = /*#__PURE__*/new Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
|
|
2794
|
-
crs: plain
|
|
2795
|
-
});
|
|
2796
|
-
const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2797
|
-
crs: plain
|
|
2798
|
-
});
|
|
2799
|
-
const MAP_LEGEND_FEATURES = {
|
|
2800
|
-
polygon: polygonMapLegendFeature
|
|
2801
|
-
};
|
|
2802
|
-
const LEGEND_FEATURES = {
|
|
2803
|
-
polyline: lineLegendFeature,
|
|
2804
|
-
polygon: polygonLegendFeature
|
|
2805
|
-
};
|
|
2806
|
-
const MOCK_FEATURES = {
|
|
2807
|
-
point: pointFeature,
|
|
2808
|
-
polyline: lineFeature,
|
|
2809
|
-
polygon: polygonFeature
|
|
2810
|
-
};
|
|
2811
|
-
|
|
2812
|
-
function getSymbolRenders(symbol, size, features) {
|
|
2813
|
-
if (size === void 0) {
|
|
2814
|
-
size = viewBoxSize;
|
|
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);
|
|
2815
2634
|
}
|
|
2816
2635
|
|
|
2817
|
-
|
|
2818
|
-
|
|
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];
|
|
2819
2643
|
}
|
|
2820
2644
|
|
|
2821
|
-
|
|
2645
|
+
return symbol;
|
|
2646
|
+
}
|
|
2647
|
+
const adjustSymbol = (symbol, _ref) => {
|
|
2648
|
+
let {
|
|
2649
|
+
size
|
|
2650
|
+
} = _ref;
|
|
2651
|
+
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
2652
|
+
};
|
|
2822
2653
|
|
|
2823
|
-
|
|
2654
|
+
let EvergisFeature = /*#__PURE__*/function () {
|
|
2655
|
+
function EvergisFeature(feature) {
|
|
2656
|
+
_classCallCheck(this, EvergisFeature);
|
|
2824
2657
|
|
|
2825
|
-
|
|
2826
|
-
|
|
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);
|
|
2827
2671
|
}
|
|
2828
2672
|
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2673
|
+
_createClass(EvergisFeature, [{
|
|
2674
|
+
key: "sGisFeature",
|
|
2675
|
+
value: function sGisFeature() {
|
|
2676
|
+
if (!this.geometry || !this.symbol) {
|
|
2677
|
+
return null;
|
|
2678
|
+
} // @ts-ignore
|
|
2832
2679
|
|
|
2833
|
-
return symbol.renderFunctionAsync(featuresToRender.point, resolution, plain);
|
|
2834
|
-
}
|
|
2835
|
-
const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
|
|
2836
|
-
if (size === void 0) {
|
|
2837
|
-
size = viewBoxSize;
|
|
2838
|
-
}
|
|
2839
2680
|
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2681
|
+
const {
|
|
2682
|
+
type,
|
|
2683
|
+
coordinates,
|
|
2684
|
+
sr
|
|
2685
|
+
} = this.geometry;
|
|
2686
|
+
const crs = CRS_MAP[sr];
|
|
2846
2687
|
|
|
2847
|
-
|
|
2848
|
-
|
|
2688
|
+
if (!crs) {
|
|
2689
|
+
return null;
|
|
2690
|
+
}
|
|
2849
2691
|
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2692
|
+
switch (type) {
|
|
2693
|
+
case GeometryType.Point:
|
|
2694
|
+
return new PointFeature(coordinates, {
|
|
2695
|
+
symbol: selectedPoint,
|
|
2696
|
+
crs
|
|
2697
|
+
});
|
|
2855
2698
|
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2699
|
+
case GeometryType.Multipoint:
|
|
2700
|
+
return new MultiPoint(coordinates, {
|
|
2701
|
+
symbol: selectedPoint,
|
|
2702
|
+
crs
|
|
2703
|
+
});
|
|
2860
2704
|
|
|
2861
|
-
|
|
2862
|
-
|
|
2705
|
+
case GeometryType.Polyline:
|
|
2706
|
+
return new Polyline(coordinates, {
|
|
2707
|
+
symbol: selectedPolyline,
|
|
2708
|
+
crs
|
|
2709
|
+
});
|
|
2863
2710
|
|
|
2864
|
-
|
|
2865
|
-
|
|
2711
|
+
case GeometryType.Polygon:
|
|
2712
|
+
return new Polygon(coordinates, {
|
|
2713
|
+
symbol: selectedPolygon,
|
|
2714
|
+
crs
|
|
2715
|
+
});
|
|
2866
2716
|
|
|
2867
|
-
|
|
2868
|
-
|
|
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
|
+
}]);
|
|
2869
2728
|
|
|
2870
|
-
|
|
2871
|
-
|
|
2729
|
+
return EvergisFeature;
|
|
2730
|
+
}();
|
|
2872
2731
|
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2732
|
+
function evaluateCondition(condition, attributes) {
|
|
2733
|
+
try {
|
|
2734
|
+
const evaluator = new ConditionEvaluator(attributes);
|
|
2735
|
+
const result = evaluator.evaluate(condition);
|
|
2876
2736
|
|
|
2877
|
-
|
|
2737
|
+
if (result instanceof Error) {
|
|
2878
2738
|
return null;
|
|
2879
|
-
|
|
2880
|
-
}
|
|
2881
|
-
|
|
2882
|
-
function deserializePointSymbol(symbol) {
|
|
2883
|
-
// @ts-ignore
|
|
2884
|
-
return new PointSymbol(deserializePointSymbolParams(symbol));
|
|
2885
|
-
}
|
|
2886
|
-
|
|
2887
|
-
function deserializeSquareSymbol(symbol) {
|
|
2888
|
-
return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
|
|
2889
|
-
// @ts-ignore
|
|
2890
|
-
angle: getParameterValue(symbol.angle)
|
|
2891
|
-
}));
|
|
2892
|
-
}
|
|
2893
|
-
|
|
2894
|
-
function deserializeMaskedImageSymbol(symbol) {
|
|
2895
|
-
return new MaskedImage(_extends({}, symbol, {
|
|
2896
|
-
// @ts-ignore
|
|
2897
|
-
angle: getParameterValue(symbol.angle),
|
|
2898
|
-
// @ts-ignore
|
|
2899
|
-
width: getParameterValue(symbol.width),
|
|
2900
|
-
// @ts-ignore
|
|
2901
|
-
height: getParameterValue(symbol.height),
|
|
2902
|
-
// @ts-ignore
|
|
2903
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2904
|
-
// @ts-ignore
|
|
2905
|
-
imageSource: deserializeBase64(symbol.image),
|
|
2906
|
-
// @ts-ignore
|
|
2907
|
-
maskSource: deserializeBase64(symbol.imageMask),
|
|
2908
|
-
// @ts-ignore
|
|
2909
|
-
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2910
|
-
}));
|
|
2911
|
-
}
|
|
2912
|
-
|
|
2913
|
-
function deserializeImagePointSymbol(symbol) {
|
|
2914
|
-
return new StaticImageSymbol(_extends({}, symbol, {
|
|
2915
|
-
// @ts-ignore
|
|
2916
|
-
angle: getParameterValue(symbol.angle),
|
|
2917
|
-
// @ts-ignore
|
|
2918
|
-
width: getParameterValue(symbol.width),
|
|
2919
|
-
// @ts-ignore
|
|
2920
|
-
height: getParameterValue(symbol.height),
|
|
2921
|
-
// @ts-ignore
|
|
2922
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2923
|
-
// @ts-ignore
|
|
2924
|
-
source: deserializeBase64(symbol.image)
|
|
2925
|
-
}));
|
|
2926
|
-
}
|
|
2927
|
-
|
|
2928
|
-
function deserializePolygonSymbol(symbol) {
|
|
2929
|
-
if (isPolygonHasPatternBrush(symbol)) {
|
|
2930
|
-
return new SGisImageFill(symbol);
|
|
2931
|
-
}
|
|
2932
|
-
|
|
2933
|
-
if (isPolygonHasHatchBrush(symbol)) {
|
|
2934
|
-
return new SGisBrushFill(symbol);
|
|
2935
|
-
}
|
|
2936
|
-
|
|
2937
|
-
return new SGisPolygonSymbol(symbol);
|
|
2938
|
-
}
|
|
2939
|
-
|
|
2940
|
-
function deserializePolylineSymbol(symbol) {
|
|
2941
|
-
return new SGisPolylineSymbol(symbol);
|
|
2942
|
-
}
|
|
2943
|
-
|
|
2944
|
-
function deserializePointSymbolParams(_ref) {
|
|
2945
|
-
let {
|
|
2946
|
-
size,
|
|
2947
|
-
offset,
|
|
2948
|
-
strokeColor,
|
|
2949
|
-
strokeWidth,
|
|
2950
|
-
fillColor
|
|
2951
|
-
} = _ref;
|
|
2952
|
-
return {
|
|
2953
|
-
size: getParameterValue(size),
|
|
2954
|
-
offset: deserializeAnchor(offset),
|
|
2955
|
-
strokeWidth: getParameterValue(strokeWidth),
|
|
2956
|
-
strokeColor: deserializeColor(getParameterValue(strokeColor)),
|
|
2957
|
-
fillColor: deserializeColor(getParameterValue(fillColor))
|
|
2958
|
-
};
|
|
2959
|
-
}
|
|
2960
|
-
|
|
2961
|
-
function deserializeBase64(base) {
|
|
2962
|
-
return "data:image/png;base64," + base;
|
|
2963
|
-
}
|
|
2964
|
-
|
|
2965
|
-
function deserializeAnchor(offset) {
|
|
2966
|
-
// @ts-ignore
|
|
2967
|
-
return offset.map(getParameterValue);
|
|
2968
|
-
}
|
|
2969
|
-
|
|
2970
|
-
function deserializeColor(color) {
|
|
2971
|
-
return color ? new Color(color).toString() : null;
|
|
2972
|
-
}
|
|
2973
|
-
|
|
2974
|
-
const clampSymbol = (symbol, min, max) => {
|
|
2975
|
-
if (isSGisImageSymbol(symbol)) {
|
|
2976
|
-
symbol.width = clamp(symbol.width, min, max);
|
|
2977
|
-
symbol.height = clamp(symbol.height, min, max);
|
|
2978
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
2979
|
-
symbol.size = clamp(symbol.size, min, max);
|
|
2980
|
-
}
|
|
2981
|
-
|
|
2982
|
-
return symbol;
|
|
2983
|
-
};
|
|
2984
|
-
function centerAlignSymbol(symbol) {
|
|
2985
|
-
if (isSGisImageSymbol(symbol)) {
|
|
2986
|
-
symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
|
|
2987
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
2988
|
-
symbol.offset = [0, 0];
|
|
2989
|
-
}
|
|
2990
|
-
|
|
2991
|
-
return symbol;
|
|
2992
|
-
}
|
|
2993
|
-
const adjustSymbol = (symbol, _ref) => {
|
|
2994
|
-
let {
|
|
2995
|
-
size
|
|
2996
|
-
} = _ref;
|
|
2997
|
-
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
2998
|
-
};
|
|
2999
|
-
|
|
3000
|
-
let EvergisFeature = /*#__PURE__*/function () {
|
|
3001
|
-
function EvergisFeature(feature) {
|
|
3002
|
-
_classCallCheck(this, EvergisFeature);
|
|
3003
|
-
|
|
3004
|
-
this.id = null;
|
|
3005
|
-
this.displayName = null;
|
|
3006
|
-
this.geometry = null;
|
|
3007
|
-
this.layerName = null;
|
|
3008
|
-
this.layerAlias = null;
|
|
3009
|
-
this.attributes = null;
|
|
3010
|
-
this.symbol = null;
|
|
3011
|
-
this.id = feature.id;
|
|
3012
|
-
this.displayName = feature.id;
|
|
3013
|
-
this.geometry = feature.geometry;
|
|
3014
|
-
this.layerName = feature.layer;
|
|
3015
|
-
this.layerAlias = feature.layer;
|
|
3016
|
-
this.attributes = getFeatureAttributes(feature.attributes);
|
|
3017
|
-
}
|
|
3018
|
-
|
|
3019
|
-
_createClass(EvergisFeature, [{
|
|
3020
|
-
key: "sGisFeature",
|
|
3021
|
-
value: function sGisFeature() {
|
|
3022
|
-
if (!this.geometry || !this.symbol) {
|
|
3023
|
-
return null;
|
|
3024
|
-
} // @ts-ignore
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
const {
|
|
3028
|
-
type,
|
|
3029
|
-
coordinates,
|
|
3030
|
-
sr
|
|
3031
|
-
} = this.geometry;
|
|
3032
|
-
const crs = CRS_MAP[sr];
|
|
3033
|
-
|
|
3034
|
-
if (!crs) {
|
|
3035
|
-
return null;
|
|
3036
|
-
}
|
|
3037
|
-
|
|
3038
|
-
switch (type) {
|
|
3039
|
-
case GeometryType.Point:
|
|
3040
|
-
return new PointFeature(coordinates, {
|
|
3041
|
-
symbol: selectedPoint,
|
|
3042
|
-
crs
|
|
3043
|
-
});
|
|
3044
|
-
|
|
3045
|
-
case GeometryType.Multipoint:
|
|
3046
|
-
return new MultiPoint(coordinates, {
|
|
3047
|
-
symbol: selectedPoint,
|
|
3048
|
-
crs
|
|
3049
|
-
});
|
|
3050
|
-
|
|
3051
|
-
case GeometryType.Polyline:
|
|
3052
|
-
return new Polyline(coordinates, {
|
|
3053
|
-
symbol: selectedPolyline,
|
|
3054
|
-
crs
|
|
3055
|
-
});
|
|
3056
|
-
|
|
3057
|
-
case GeometryType.Polygon:
|
|
3058
|
-
return new Polygon(coordinates, {
|
|
3059
|
-
symbol: selectedPolygon,
|
|
3060
|
-
crs
|
|
3061
|
-
});
|
|
3062
|
-
|
|
3063
|
-
default:
|
|
3064
|
-
return null;
|
|
3065
|
-
}
|
|
3066
|
-
}
|
|
3067
|
-
}, {
|
|
3068
|
-
key: "extent",
|
|
3069
|
-
value: function extent() {
|
|
3070
|
-
const feature = this.sGisFeature();
|
|
3071
|
-
return feature && feature.bbox;
|
|
3072
|
-
}
|
|
3073
|
-
}]);
|
|
3074
|
-
|
|
3075
|
-
return EvergisFeature;
|
|
3076
|
-
}();
|
|
3077
|
-
|
|
3078
|
-
function evaluateCondition(condition, attributes) {
|
|
3079
|
-
try {
|
|
3080
|
-
const evaluator = new ConditionEvaluator(attributes);
|
|
3081
|
-
const result = evaluator.evaluate(condition);
|
|
3082
|
-
|
|
3083
|
-
if (result instanceof Error) {
|
|
3084
|
-
return null;
|
|
3085
|
-
}
|
|
2739
|
+
}
|
|
3086
2740
|
|
|
3087
2741
|
return result;
|
|
3088
2742
|
} catch (_unused) {
|
|
@@ -3091,7 +2745,7 @@ function evaluateCondition(condition, attributes) {
|
|
|
3091
2745
|
}
|
|
3092
2746
|
|
|
3093
2747
|
function getAttributeValue(attributes, attributeName) {
|
|
3094
|
-
const attributeMeta = attributes.find(_ref => {
|
|
2748
|
+
const attributeMeta = attributes.find((_ref) => {
|
|
3095
2749
|
let {
|
|
3096
2750
|
name
|
|
3097
2751
|
} = _ref;
|
|
@@ -3105,7 +2759,7 @@ const getAttributeNameFromClassified = values => values.length > 0 ? getAttribut
|
|
|
3105
2759
|
|
|
3106
2760
|
function findFeatureValue(parameterValues, _ref2) {
|
|
3107
2761
|
let [name, value] = _ref2;
|
|
3108
|
-
return value !== null ? parameterValues.find(_ref3 => {
|
|
2762
|
+
return value !== null ? parameterValues.find((_ref3) => {
|
|
3109
2763
|
let {
|
|
3110
2764
|
condition
|
|
3111
2765
|
} = _ref3;
|
|
@@ -3145,7 +2799,7 @@ function evaluateFeatureSymbol(attributes) {
|
|
|
3145
2799
|
}
|
|
3146
2800
|
|
|
3147
2801
|
function findChildFeatureStyle(childStyles, attributes) {
|
|
3148
|
-
return (childStyles || []).find(_ref5 => {
|
|
2802
|
+
return (childStyles || []).find((_ref5) => {
|
|
3149
2803
|
let {
|
|
3150
2804
|
condition
|
|
3151
2805
|
} = _ref5;
|
|
@@ -3206,7 +2860,7 @@ let EvergisLayer = /*#__PURE__*/function () {
|
|
|
3206
2860
|
feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
|
|
3207
2861
|
feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
|
|
3208
2862
|
feature.layerAlias = this.alias;
|
|
3209
|
-
const titleAttribute = (feature.attributes || []).find(_ref => {
|
|
2863
|
+
const titleAttribute = (feature.attributes || []).find((_ref) => {
|
|
3210
2864
|
let {
|
|
3211
2865
|
name
|
|
3212
2866
|
} = _ref;
|
|
@@ -3229,7 +2883,7 @@ const evaluateFeature = layers => feature => {
|
|
|
3229
2883
|
};
|
|
3230
2884
|
|
|
3231
2885
|
const OTHERS_TITLE = 'Другое';
|
|
3232
|
-
const createLegendItem = _ref => {
|
|
2886
|
+
const createLegendItem = (_ref) => {
|
|
3233
2887
|
let {
|
|
3234
2888
|
attributes,
|
|
3235
2889
|
renderTitle,
|
|
@@ -3271,7 +2925,7 @@ function createStyleLegend(style, config) {
|
|
|
3271
2925
|
classificationManager,
|
|
3272
2926
|
symbol
|
|
3273
2927
|
} = style;
|
|
3274
|
-
const items = classificationManager.filter(_ref => {
|
|
2928
|
+
const items = classificationManager.filter((_ref) => {
|
|
3275
2929
|
let {
|
|
3276
2930
|
parameter
|
|
3277
2931
|
} = _ref;
|
|
@@ -3388,7 +3042,7 @@ const useMapLegend = (layer, config) => {
|
|
|
3388
3042
|
};
|
|
3389
3043
|
|
|
3390
3044
|
const LEGEND_SYMBOL_MAX_SIZE = 32;
|
|
3391
|
-
const useLegendValueSymbol = _ref => {
|
|
3045
|
+
const useLegendValueSymbol = (_ref) => {
|
|
3392
3046
|
let {
|
|
3393
3047
|
parameter,
|
|
3394
3048
|
parameterValue
|
|
@@ -3790,7 +3444,7 @@ function useMapWrapper() {
|
|
|
3790
3444
|
return wrapperRef;
|
|
3791
3445
|
}
|
|
3792
3446
|
|
|
3793
|
-
const byScale = scale => _ref => {
|
|
3447
|
+
const byScale = scale => (_ref) => {
|
|
3794
3448
|
let {
|
|
3795
3449
|
zIndex
|
|
3796
3450
|
} = _ref;
|
|
@@ -3989,7 +3643,7 @@ const useTooltip = function useTooltip(zIndex) {
|
|
|
3989
3643
|
|
|
3990
3644
|
return reset;
|
|
3991
3645
|
}, [reset, map, layer, zIndex]);
|
|
3992
|
-
const onSetLabelFeature = useCallback(_ref => {
|
|
3646
|
+
const onSetLabelFeature = useCallback((_ref) => {
|
|
3993
3647
|
let {
|
|
3994
3648
|
point,
|
|
3995
3649
|
position,
|
|
@@ -4153,7 +3807,7 @@ function useClusterLayer(_ref) {
|
|
|
4153
3807
|
}
|
|
4154
3808
|
|
|
4155
3809
|
const INIT_FEATURES = [];
|
|
4156
|
-
const useEvergisSelect = _ref => {
|
|
3810
|
+
const useEvergisSelect = (_ref) => {
|
|
4157
3811
|
let {
|
|
4158
3812
|
onPick,
|
|
4159
3813
|
onFeatures
|
|
@@ -4186,7 +3840,7 @@ function none() {
|
|
|
4186
3840
|
return;
|
|
4187
3841
|
}
|
|
4188
3842
|
|
|
4189
|
-
const useDraggableMarker = _ref => {
|
|
3843
|
+
const useDraggableMarker = (_ref) => {
|
|
4190
3844
|
let {
|
|
4191
3845
|
position,
|
|
4192
3846
|
onChange,
|
|
@@ -4302,7 +3956,7 @@ const useDebouncedCallback = interval => {
|
|
|
4302
3956
|
}, interval), [interval]);
|
|
4303
3957
|
};
|
|
4304
3958
|
|
|
4305
|
-
const Symbol = _ref => {
|
|
3959
|
+
const Symbol = (_ref) => {
|
|
4306
3960
|
let {
|
|
4307
3961
|
symbol,
|
|
4308
3962
|
size,
|
|
@@ -4323,7 +3977,7 @@ const Symbol = _ref => {
|
|
|
4323
3977
|
};
|
|
4324
3978
|
|
|
4325
3979
|
var _templateObject;
|
|
4326
|
-
const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), _ref => {
|
|
3980
|
+
const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), (_ref) => {
|
|
4327
3981
|
let {
|
|
4328
3982
|
geometryType,
|
|
4329
3983
|
icons
|
|
@@ -4332,7 +3986,7 @@ const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject
|
|
|
4332
3986
|
});
|
|
4333
3987
|
|
|
4334
3988
|
const MAX_SIZE = 32;
|
|
4335
|
-
const StyleSymbol = _ref => {
|
|
3989
|
+
const StyleSymbol = (_ref) => {
|
|
4336
3990
|
let {
|
|
4337
3991
|
symbol,
|
|
4338
3992
|
size = MAX_SIZE,
|
|
@@ -4377,7 +4031,7 @@ const CloseIcon = /*#__PURE__*/styled(Icon)(_templateObject20 || (_templateObjec
|
|
|
4377
4031
|
const PrevIcon = /*#__PURE__*/styled(Icon)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
|
|
4378
4032
|
const NextIcon = /*#__PURE__*/styled(Icon)(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
|
|
4379
4033
|
|
|
4380
|
-
const MailValue = _ref => {
|
|
4034
|
+
const MailValue = (_ref) => {
|
|
4381
4035
|
let {
|
|
4382
4036
|
mail
|
|
4383
4037
|
} = _ref;
|
|
@@ -4388,7 +4042,7 @@ const MailValue = _ref => {
|
|
|
4388
4042
|
}, mail);
|
|
4389
4043
|
};
|
|
4390
4044
|
|
|
4391
|
-
const PhoneValue = _ref => {
|
|
4045
|
+
const PhoneValue = (_ref) => {
|
|
4392
4046
|
let {
|
|
4393
4047
|
phone
|
|
4394
4048
|
} = _ref;
|
|
@@ -4399,7 +4053,7 @@ const PhoneValue = _ref => {
|
|
|
4399
4053
|
}, phone);
|
|
4400
4054
|
};
|
|
4401
4055
|
|
|
4402
|
-
const UrlValue = _ref => {
|
|
4056
|
+
const UrlValue = (_ref) => {
|
|
4403
4057
|
let {
|
|
4404
4058
|
url
|
|
4405
4059
|
} = _ref;
|
|
@@ -4410,7 +4064,7 @@ const UrlValue = _ref => {
|
|
|
4410
4064
|
}, url);
|
|
4411
4065
|
};
|
|
4412
4066
|
|
|
4413
|
-
const AttributeValue = _ref => {
|
|
4067
|
+
const AttributeValue = (_ref) => {
|
|
4414
4068
|
let {
|
|
4415
4069
|
attribute
|
|
4416
4070
|
} = _ref;
|
|
@@ -4424,29 +4078,29 @@ const AttributeValue = _ref => {
|
|
|
4424
4078
|
if (attributeValue.type === 2
|
|
4425
4079
|
/* Url */
|
|
4426
4080
|
) {
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4081
|
+
return React.createElement(UrlValue, {
|
|
4082
|
+
key: key,
|
|
4083
|
+
url: punycodeDecode(value)
|
|
4084
|
+
});
|
|
4085
|
+
}
|
|
4432
4086
|
|
|
4433
4087
|
if (attributeValue.type === 3
|
|
4434
4088
|
/* Mail */
|
|
4435
4089
|
) {
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4090
|
+
return React.createElement(MailValue, {
|
|
4091
|
+
key: key,
|
|
4092
|
+
mail: value
|
|
4093
|
+
});
|
|
4094
|
+
}
|
|
4441
4095
|
|
|
4442
4096
|
if (attributeValue.type === 1
|
|
4443
4097
|
/* Phone */
|
|
4444
4098
|
) {
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4099
|
+
return React.createElement(PhoneValue, {
|
|
4100
|
+
key: key,
|
|
4101
|
+
phone: value
|
|
4102
|
+
});
|
|
4103
|
+
}
|
|
4450
4104
|
|
|
4451
4105
|
return React.createElement(SimpleAttribute, {
|
|
4452
4106
|
key: value
|
|
@@ -4462,7 +4116,7 @@ function punycodeDecode(domains) {
|
|
|
4462
4116
|
}
|
|
4463
4117
|
}
|
|
4464
4118
|
|
|
4465
|
-
const EvergisCardAttribute = _ref => {
|
|
4119
|
+
const EvergisCardAttribute = (_ref) => {
|
|
4466
4120
|
let {
|
|
4467
4121
|
attribute,
|
|
4468
4122
|
className
|
|
@@ -4474,7 +4128,7 @@ const EvergisCardAttribute = _ref => {
|
|
|
4474
4128
|
}));
|
|
4475
4129
|
};
|
|
4476
4130
|
|
|
4477
|
-
const StyledCard = _ref => {
|
|
4131
|
+
const StyledCard = (_ref) => {
|
|
4478
4132
|
let {
|
|
4479
4133
|
features = [],
|
|
4480
4134
|
className,
|
|
@@ -4525,7 +4179,7 @@ const StyledCard = _ref => {
|
|
|
4525
4179
|
};
|
|
4526
4180
|
|
|
4527
4181
|
const _excluded$1 = ["renderCard", "className", "children"];
|
|
4528
|
-
const EvergisCard = _ref => {
|
|
4182
|
+
const EvergisCard = (_ref) => {
|
|
4529
4183
|
let {
|
|
4530
4184
|
renderCard,
|
|
4531
4185
|
className,
|
|
@@ -4577,7 +4231,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
|
|
|
4577
4231
|
|
|
4578
4232
|
const useSGisFeatures = (features, currentIndex) => useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
|
|
4579
4233
|
|
|
4580
|
-
const EvergisSelectLayer = _ref => {
|
|
4234
|
+
const EvergisSelectLayer = (_ref) => {
|
|
4581
4235
|
let {
|
|
4582
4236
|
features,
|
|
4583
4237
|
zIndex,
|
|
@@ -4622,7 +4276,7 @@ const TileLayer = props => {
|
|
|
4622
4276
|
};
|
|
4623
4277
|
|
|
4624
4278
|
const defaultZIndex = 200;
|
|
4625
|
-
const EvergisSelect = _ref => {
|
|
4279
|
+
const EvergisSelect = (_ref) => {
|
|
4626
4280
|
let {
|
|
4627
4281
|
onPick,
|
|
4628
4282
|
className,
|
|
@@ -4657,7 +4311,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled.p(_templateObject3$1 || (_template
|
|
|
4657
4311
|
const LegendValueContainer = /*#__PURE__*/styled.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);
|
|
4658
4312
|
const LegendSectionHeader = /*#__PURE__*/styled.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])));
|
|
4659
4313
|
|
|
4660
|
-
const LegendSection = _ref => {
|
|
4314
|
+
const LegendSection = (_ref) => {
|
|
4661
4315
|
let {
|
|
4662
4316
|
item,
|
|
4663
4317
|
renderLegendTitle,
|
|
@@ -4674,7 +4328,7 @@ SearchPrefix.defaultProps = {
|
|
|
4674
4328
|
kind: "search"
|
|
4675
4329
|
};
|
|
4676
4330
|
|
|
4677
|
-
const SearchInput = _ref => {
|
|
4331
|
+
const SearchInput = (_ref) => {
|
|
4678
4332
|
let {
|
|
4679
4333
|
onChange
|
|
4680
4334
|
} = _ref;
|
|
@@ -4683,7 +4337,7 @@ const SearchInput = _ref => {
|
|
|
4683
4337
|
}));
|
|
4684
4338
|
};
|
|
4685
4339
|
|
|
4686
|
-
const LegendSymbol = _ref => {
|
|
4340
|
+
const LegendSymbol = (_ref) => {
|
|
4687
4341
|
let {
|
|
4688
4342
|
parameter,
|
|
4689
4343
|
parameterValue,
|
|
@@ -4701,7 +4355,7 @@ const LegendSymbol = _ref => {
|
|
|
4701
4355
|
return React.createElement(React.Fragment, null, children(symbol));
|
|
4702
4356
|
};
|
|
4703
4357
|
|
|
4704
|
-
const LegendValue = _ref => {
|
|
4358
|
+
const LegendValue = (_ref) => {
|
|
4705
4359
|
let {
|
|
4706
4360
|
value,
|
|
4707
4361
|
parameter,
|
|
@@ -4723,7 +4377,7 @@ const getNumberParam = (parameterValue, param) => {
|
|
|
4723
4377
|
return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
|
|
4724
4378
|
};
|
|
4725
4379
|
|
|
4726
|
-
const getSymbolSize = _ref => {
|
|
4380
|
+
const getSymbolSize = (_ref) => {
|
|
4727
4381
|
let {
|
|
4728
4382
|
parameterValue,
|
|
4729
4383
|
maxSize
|
|
@@ -4748,7 +4402,7 @@ const getSymbolSize = _ref => {
|
|
|
4748
4402
|
}
|
|
4749
4403
|
};
|
|
4750
4404
|
|
|
4751
|
-
const Legend = _ref => {
|
|
4405
|
+
const Legend = (_ref) => {
|
|
4752
4406
|
let {
|
|
4753
4407
|
layer,
|
|
4754
4408
|
children,
|
|
@@ -4791,7 +4445,7 @@ const Legend = _ref => {
|
|
|
4791
4445
|
})))));
|
|
4792
4446
|
};
|
|
4793
4447
|
|
|
4794
|
-
const Map = _ref => {
|
|
4448
|
+
const Map = (_ref) => {
|
|
4795
4449
|
let {
|
|
4796
4450
|
className,
|
|
4797
4451
|
position,
|
|
@@ -4813,163 +4467,488 @@ const Map = _ref => {
|
|
|
4813
4467
|
})) {
|
|
4814
4468
|
onBboxChange(state);
|
|
4815
4469
|
}
|
|
4816
|
-
}, [map, onBboxChange, position, resolution]);
|
|
4817
|
-
useUpdateMapView({
|
|
4818
|
-
position,
|
|
4819
|
-
resolution
|
|
4820
|
-
});
|
|
4821
|
-
useMaxMinScale(minScale, maxScale, position, resolution);
|
|
4822
|
-
useMapBboxChange(handleBboxChange);
|
|
4823
|
-
return React.createElement("div", {
|
|
4824
|
-
className: className,
|
|
4825
|
-
ref: wrapperRef,
|
|
4826
|
-
style: style
|
|
4827
|
-
}, children);
|
|
4828
|
-
};
|
|
4829
|
-
|
|
4830
|
-
var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
|
|
4831
|
-
|
|
4832
|
-
const topLeft = distance => 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.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 => css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4487
|
+
|
|
4488
|
+
const topRight = distance => css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n top: ", ";\n right: ", ";\n"])), distance, distance);
|
|
4489
|
+
|
|
4490
|
+
const bottomLeft = distance => css(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4491
|
+
|
|
4492
|
+
const bottomRight = distance => 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 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__*/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(Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4509
|
+
ZoomInBtn.defaultProps = {
|
|
4510
|
+
kind: "plus"
|
|
4511
|
+
};
|
|
4512
|
+
const ZoomOutBtn = /*#__PURE__*/styled(Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4513
|
+
ZoomOutBtn.defaultProps = {
|
|
4514
|
+
kind: "minus"
|
|
4515
|
+
};
|
|
4516
|
+
const SearchBtn = /*#__PURE__*/styled(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(Icon)(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4522
|
+
FullscreenBtn.defaultProps = {
|
|
4523
|
+
kind: "maximize"
|
|
4524
|
+
};
|
|
4525
|
+
const MeasureBtn = /*#__PURE__*/styled(Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4526
|
+
MeasureBtn.defaultProps = {
|
|
4527
|
+
kind: "measure_length"
|
|
4528
|
+
};
|
|
4529
|
+
const MapControl = /*#__PURE__*/styled.div(_templateObject7$1 || (_templateObject7$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-radius: 0.15rem;\n background: rgba(28, 33, 48, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n font-size: 1.5rem;\n cursor: pointer;\n height: auto;\n width: auto;\n padding: 0.25rem;\n"])));
|
|
4530
|
+
const MapControls = /*#__PURE__*/styled.div(_templateObject8$1 || (_templateObject8$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n display: flex;\n flex-direction: ", ";\n\n ", "\n\n ", " {\n margin-bottom: ", ";\n margin-right: ", ";\n flex-direction: ", ";\n }\n"])), (_ref) => {
|
|
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.createElement(MapControl, null, React.createElement(MeasureBtn, {
|
|
4559
|
+
onClick: () => {}
|
|
4560
|
+
}));
|
|
4561
|
+
};
|
|
4562
|
+
|
|
4563
|
+
const Search = () => {
|
|
4564
|
+
return React.createElement(MapControl, null, React.createElement(SearchBtn, {
|
|
4565
|
+
onClick: () => {}
|
|
4566
|
+
}));
|
|
4567
|
+
};
|
|
4568
|
+
|
|
4569
|
+
const Fullscreen = () => {
|
|
4570
|
+
return React.createElement(MapControl, null, React.createElement(FullscreenBtn, {
|
|
4571
|
+
onClick: () => {}
|
|
4572
|
+
}));
|
|
4573
|
+
};
|
|
4574
|
+
|
|
4575
|
+
var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4;
|
|
4576
|
+
const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4577
|
+
const MapLegendContainer = /*#__PURE__*/styled.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(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
|
|
4579
|
+
const MapLegendSection = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
|
|
4580
|
+
const MapLegendValueDescr = /*#__PURE__*/styled.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.createElement(LegendSymbol, {
|
|
4589
|
+
key: value.title,
|
|
4590
|
+
parameter: parameter,
|
|
4591
|
+
parameterValue: value.parameterValue
|
|
4592
|
+
}, symbol => React.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.createElement(LegendProvider, {
|
|
4618
|
+
symbol: symbol
|
|
4619
|
+
}, React.createElement(MapLegendControl, {
|
|
4620
|
+
className: className
|
|
4621
|
+
}, React.createElement(MapLegendContainer, null, React.createElement(MapLegendHeader, null, item.title), React.createElement(MapLegendSection, null, React.createElement(MapLegendValueDescr, null, fromToTitle[0]), item.values.map(value => React.createElement(MapLegendSymbol, {
|
|
4622
|
+
key: value.title,
|
|
4623
|
+
value: value,
|
|
4624
|
+
parameter: item.parameter
|
|
4625
|
+
})), React.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 DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
4703
|
+
return;
|
|
4704
|
+
}
|
|
4705
|
+
|
|
4706
|
+
if (rings[0].length === 2) {
|
|
4707
|
+
const projection = crs.projectionTo(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(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$1 = length(rings, crs);
|
|
4763
|
+
let content = this.formatters.length(length$1);
|
|
4764
|
+
|
|
4765
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4766
|
+
this.polygonPreview();
|
|
4767
|
+
const area$1 = area(rings, crs);
|
|
4768
|
+
content = this.formatters.polygon(area$1, length$1);
|
|
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 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 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 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;
|
|
4833
4852
|
|
|
4834
|
-
|
|
4853
|
+
if (wrapper && typeof wrapper !== 'string') {
|
|
4854
|
+
wrapper.style.cursor = cursor;
|
|
4855
|
+
}
|
|
4856
|
+
}
|
|
4857
|
+
}]);
|
|
4835
4858
|
|
|
4836
|
-
|
|
4859
|
+
return BaseMeasureToolCreator;
|
|
4860
|
+
}(PolylineControl);
|
|
4837
4861
|
|
|
4838
|
-
|
|
4862
|
+
let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
|
|
4863
|
+
_inherits(BaseMeasureToolEditor, _PolyEditor);
|
|
4839
4864
|
|
|
4840
|
-
|
|
4841
|
-
if (placement === void 0) {
|
|
4842
|
-
placement = 'bottom-left';
|
|
4843
|
-
}
|
|
4865
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
|
|
4844
4866
|
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
}
|
|
4867
|
+
function BaseMeasureToolEditor(map, painter, params) {
|
|
4868
|
+
var _this;
|
|
4848
4869
|
|
|
4849
|
-
|
|
4850
|
-
};
|
|
4870
|
+
_classCallCheck(this, BaseMeasureToolEditor);
|
|
4851
4871
|
|
|
4852
|
-
|
|
4853
|
-
const mapControlBtnMixin = /*#__PURE__*/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"])));
|
|
4854
|
-
const ZoomInBtn = /*#__PURE__*/styled(Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4855
|
-
ZoomInBtn.defaultProps = {
|
|
4856
|
-
kind: "plus"
|
|
4857
|
-
};
|
|
4858
|
-
const ZoomOutBtn = /*#__PURE__*/styled(Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4859
|
-
ZoomOutBtn.defaultProps = {
|
|
4860
|
-
kind: "minus"
|
|
4861
|
-
};
|
|
4862
|
-
const SearchBtn = /*#__PURE__*/styled(Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4863
|
-
SearchBtn.defaultProps = {
|
|
4864
|
-
kind: "search"
|
|
4865
|
-
}; // TODO not exists in fonts
|
|
4872
|
+
_this = _super.call(this, map, params);
|
|
4866
4873
|
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
};
|
|
4875
|
-
const
|
|
4876
|
-
const
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
return placementMixin(placement);
|
|
4886
|
-
}, MapControl, _ref3 => {
|
|
4887
|
-
let {
|
|
4888
|
-
vertical
|
|
4889
|
-
} = _ref3;
|
|
4890
|
-
return vertical ? '0.5rem' : '0';
|
|
4891
|
-
}, _ref4 => {
|
|
4892
|
-
let {
|
|
4893
|
-
vertical
|
|
4894
|
-
} = _ref4;
|
|
4895
|
-
return vertical ? '0' : '0.5rem';
|
|
4896
|
-
}, _ref5 => {
|
|
4897
|
-
let {
|
|
4898
|
-
vertical
|
|
4899
|
-
} = _ref5;
|
|
4900
|
-
return vertical ? 'column' : 'row';
|
|
4901
|
-
});
|
|
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$1 = area(rings, crs);
|
|
4885
|
+
const length$1 = length(rings, crs, isEnclosed);
|
|
4886
|
+
const content = isEnclosed ? _this.formatters.polygon(area$1, length$1) : _this.formatters.length(length$1);
|
|
4887
|
+
return {
|
|
4888
|
+
content,
|
|
4889
|
+
position
|
|
4890
|
+
};
|
|
4891
|
+
};
|
|
4902
4892
|
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
}));
|
|
4907
|
-
};
|
|
4893
|
+
_this.removeFeature = () => {
|
|
4894
|
+
_this.fire('remove');
|
|
4895
|
+
};
|
|
4908
4896
|
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
}));
|
|
4913
|
-
};
|
|
4897
|
+
_this.painter = painter;
|
|
4898
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4899
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4914
4900
|
|
|
4915
|
-
|
|
4916
|
-
return React.createElement(MapControl, null, React.createElement(FullscreenBtn, {
|
|
4917
|
-
onClick: () => {}
|
|
4918
|
-
}));
|
|
4919
|
-
};
|
|
4901
|
+
_this.on('change', _this.updateMeasureResult);
|
|
4920
4902
|
|
|
4921
|
-
|
|
4922
|
-
const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4923
|
-
const MapLegendContainer = /*#__PURE__*/styled.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"])));
|
|
4924
|
-
const MapLegendHeader = /*#__PURE__*/styled(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
|
|
4925
|
-
const MapLegendSection = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
|
|
4926
|
-
const MapLegendValueDescr = /*#__PURE__*/styled.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);
|
|
4927
4904
|
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
let {
|
|
4931
|
-
value,
|
|
4932
|
-
parameter
|
|
4933
|
-
} = _ref;
|
|
4934
|
-
return React.createElement(LegendSymbol, {
|
|
4935
|
-
key: value.title,
|
|
4936
|
-
parameter: parameter,
|
|
4937
|
-
parameterValue: value.parameterValue
|
|
4938
|
-
}, symbol => React.createElement(Symbol, {
|
|
4939
|
-
render: getMapLegendSymbolRenders,
|
|
4940
|
-
symbol: symbol,
|
|
4941
|
-
size: MAX_SIZE$2
|
|
4942
|
-
}));
|
|
4943
|
-
};
|
|
4905
|
+
return _this;
|
|
4906
|
+
}
|
|
4944
4907
|
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
config,
|
|
4950
|
-
fromToTitle = DEFAULT_FROM_TO,
|
|
4951
|
-
className
|
|
4952
|
-
} = _ref;
|
|
4953
|
-
const legend = useMapLegend(layer, config);
|
|
4908
|
+
_createClass(BaseMeasureToolEditor, [{
|
|
4909
|
+
key: "_activate",
|
|
4910
|
+
value: function _activate() {
|
|
4911
|
+
_get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
|
|
4954
4912
|
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
}
|
|
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 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
|
+
}]);
|
|
4958
4949
|
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
item
|
|
4962
|
-
} = legend;
|
|
4963
|
-
return React.createElement(LegendProvider, {
|
|
4964
|
-
symbol: symbol
|
|
4965
|
-
}, React.createElement(MapLegendControl, {
|
|
4966
|
-
className: className
|
|
4967
|
-
}, React.createElement(MapLegendContainer, null, React.createElement(MapLegendHeader, null, item.title), React.createElement(MapLegendSection, null, React.createElement(MapLegendValueDescr, null, fromToTitle[0]), item.values.map(value => React.createElement(MapLegendSymbol, {
|
|
4968
|
-
key: value.title,
|
|
4969
|
-
value: value,
|
|
4970
|
-
parameter: item.parameter
|
|
4971
|
-
})), React.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
|
|
4972
|
-
};
|
|
4950
|
+
return BaseMeasureToolEditor;
|
|
4951
|
+
}(PolyEditor);
|
|
4973
4952
|
|
|
4974
4953
|
let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
4975
4954
|
_inherits(MeasureTool, _React$Component);
|
|
@@ -5071,7 +5050,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
|
5071
5050
|
snappingSymbol: snapSymbol || measurePolygonSnapSymbol,
|
|
5072
5051
|
symbol: lengthSymbol || measureLengthSymbol,
|
|
5073
5052
|
renderLabelSymbol,
|
|
5074
|
-
formatters
|
|
5053
|
+
formatters
|
|
5075
5054
|
});
|
|
5076
5055
|
this.editorControl.featureDragAllowed = false;
|
|
5077
5056
|
this.editorControl.on('remove', this.removeFeature);
|
|
@@ -5159,7 +5138,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
|
5159
5138
|
}(React.Component);
|
|
5160
5139
|
|
|
5161
5140
|
const _excluded$3 = ["isActive"];
|
|
5162
|
-
const Measurer = _ref => {
|
|
5141
|
+
const Measurer = (_ref) => {
|
|
5163
5142
|
let {
|
|
5164
5143
|
isActive
|
|
5165
5144
|
} = _ref,
|
|
@@ -5177,18 +5156,18 @@ const Measurer = _ref => {
|
|
|
5177
5156
|
|
|
5178
5157
|
var _templateObject$7, _templateObject2$6, _templateObject3$6;
|
|
5179
5158
|
const ScaleRulerContainer = /*#__PURE__*/styled.div(_templateObject$7 || (_templateObject$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: 2rem;\n cursor: default;\n display: flex;\n align-items: flex-end;\n padding: 0 0.5rem 0.5rem;\n box-sizing: border-box;\n"])));
|
|
5180
|
-
const ScaleRulerBlock = /*#__PURE__*/styled.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.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) => {
|
|
5181
5160
|
let {
|
|
5182
5161
|
width
|
|
5183
5162
|
} = _ref;
|
|
5184
5163
|
return width + "px";
|
|
5185
5164
|
});
|
|
5186
|
-
const TextContainer = /*#__PURE__*/styled.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.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) => {
|
|
5187
5166
|
let {
|
|
5188
5167
|
alignEnd
|
|
5189
5168
|
} = _ref2;
|
|
5190
5169
|
return alignEnd ? 'flex-end' : 'center';
|
|
5191
|
-
}, _ref3 => {
|
|
5170
|
+
}, (_ref3) => {
|
|
5192
5171
|
let {
|
|
5193
5172
|
width
|
|
5194
5173
|
} = _ref3;
|
|
@@ -5213,7 +5192,7 @@ const ScaleRuler = () => {
|
|
|
5213
5192
|
}, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
|
|
5214
5193
|
};
|
|
5215
5194
|
|
|
5216
|
-
const Zoom = _ref => {
|
|
5195
|
+
const Zoom = (_ref) => {
|
|
5217
5196
|
let {
|
|
5218
5197
|
children
|
|
5219
5198
|
} = _ref;
|
|
@@ -5262,7 +5241,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
|
|
|
5262
5241
|
return 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));
|
|
5263
5242
|
};
|
|
5264
5243
|
const corner = /*#__PURE__*/css(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n &:before {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n }\n"])));
|
|
5265
|
-
const TooltipComponent = /*#__PURE__*/styled.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.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) => {
|
|
5266
5245
|
let {
|
|
5267
5246
|
placement,
|
|
5268
5247
|
distance = '0.5rem',
|
|
@@ -5270,7 +5249,7 @@ const TooltipComponent = /*#__PURE__*/styled.div(_templateObject11$1 || (_templa
|
|
|
5270
5249
|
cornerSize = '0.25rem'
|
|
5271
5250
|
} = _ref;
|
|
5272
5251
|
return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
|
|
5273
|
-
}, _ref2 => {
|
|
5252
|
+
}, (_ref2) => {
|
|
5274
5253
|
let {
|
|
5275
5254
|
withArrow
|
|
5276
5255
|
} = _ref2;
|
|
@@ -5284,7 +5263,7 @@ const {
|
|
|
5284
5263
|
Consumer
|
|
5285
5264
|
} = /*#__PURE__*/createContext([]); // TODO I just cant read that
|
|
5286
5265
|
|
|
5287
|
-
const Tooltip = _ref => {
|
|
5266
|
+
const Tooltip = (_ref) => {
|
|
5288
5267
|
let {
|
|
5289
5268
|
features = [],
|
|
5290
5269
|
map,
|
|
@@ -5323,7 +5302,7 @@ const Noop = () => React.createElement("div", {
|
|
|
5323
5302
|
}
|
|
5324
5303
|
});
|
|
5325
5304
|
|
|
5326
|
-
const DraggableMarker = _ref => {
|
|
5305
|
+
const DraggableMarker = (_ref) => {
|
|
5327
5306
|
let {
|
|
5328
5307
|
position,
|
|
5329
5308
|
onChange,
|
|
@@ -5337,5 +5316,20 @@ const DraggableMarker = _ref => {
|
|
|
5337
5316
|
return React.createElement(Fragment, null);
|
|
5338
5317
|
};
|
|
5339
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
|
+
|
|
5340
5334
|
export { ArrowLineMiterRender, BaseMeasureToolCreator, BaseMeasureToolEditor, CRS_MAP, CardAttributes, CardHeader, CircleLineMiterRender, ClassificationCondition, ClassificationManager, ClusterLayer, CompoundIcon, DEFAULT_CRS, DEFAULT_SRID, DEFAULT_SYMBOL_SIZE, DraggableMarker, EvergisCard, EvergisCardAttribute, AttributeContainer as EvergisCardAttributeContainer, AttributeTitle as EvergisCardAttributeTitle, AttributeValueContainer as EvergisCardAttributeValueContainer, CardControls as EvergisCardCardControls, CardTitle as EvergisCardCardTitle, CloseIcon as EvergisCardCloseIcon, EvergisCardContainer, CurrentFeatureIndex as EvergisCardCurrentFeatureIndex, FeatureName as EvergisCardFeatureName, LayerName as EvergisCardLayerName, NextIcon as EvergisCardNextIcon, CardPagination as EvergisCardPagination, PaginationDescription as EvergisCardPaginationDescription, PrevIcon as EvergisCardPrevIcon, SimpleAttribute as EvergisCardSimpleValue, StickyHeader as EvergisCardStickyHeader, ValueLink as EvergisCardValueLink, ZoomIcon as EvergisCardZoomIcon, EvergisDynamicLayer, EvergisFeature, EvergisLayer, EvergisProvider, EvergisSelect, EvergisSelectLayer, EvergisSelectProvider, EvergisStyle, EvergisTileLayer, FeatureLayer, Fullscreen, LabelSymbol, Legend, LegendContainer, LegendProvider, LegendSection, LegendSectionContainer, LegendSymbol, LegendValue, LegendValueContainer, LineMiterKind, LineMiterRender, Map, MapControl, MapControls, MapLegend, MapLegendContainer, MapLegendHeader, MapLegendSection, MapLegendSymbol, MapProvider, Measure, MeasureTool, Measurer, NO_CONTENT_VALUE, Noop, PREVIEW_LIMITS, SGisBrushFill, SGisImageFill, SGisPolygonSymbol, SGisPolylineSymbol, SOLID_INTERVALS, SVGPoly, ScaleRuler, ScaleRulerBlock, ScaleRulerContainer, Search, SelectedPointSymbol, SelectedPolySymbol, ShadowedPointSymbol, ShadowedPolySymbol, SquareLineMiterRender, SrId, StyleSymbol, Symbol, TextContainer, TileLayer, Tooltip, TooltipComponent, TooltipProvider, Zoom, ZoomLevel, adjustSymbol, applyParameterValue, clamp, copyRings, createCompositeSymbol, createLabelSymbol, createStyleLegend, createValueTitle, defaultOffset, defineStrokeStylePreset, deserializeSymbol, evaluateFeature, extractStyle, extractSymbol, findChildFeatureStyle, findChildFeatureSymbol, formatArea, formatAttributeValue, formatLength, formatPolygonMeasure, getAttributeNameFromClassified, getAttributeNameFromCondition, getChildSymbols, getCrs, getDashStylePreset, getFeatureSymbol, getLegendSymbolRenders, getLineDash, getLineMiterRender, getMapLegendSymbolRenders, getMapState, getParameterValue, getScale, getSymbolRenders, isArrowLineMiter, isCalculatedParameter, isCircleLineMiter, isCompositeSymbol, isDashedBrush, isFilledLineMitter, isHatchBrush, isImageSymbol, isLabelSymbol, isMaskedImageSymbol, isMiterExist, isParameterByAttribute, isParameterValueSimple, isParameterValueSymbol, isPatternBrush, isPointLabelSymbol, isPointSymbol, isPolygonHasHatchBrush, isPolygonHasPatternBrush, isPolygonLabelSymbol, isPolygonSymbol, isPolylineLabelSymbol, isPolylineLikePolygon, isPolylineSymbol, isPolylineSymbols, isRangeClass, isRasterSymbol, isSGisImageSymbol, isSGisPointSymbol, isSGisPolygonSymbol, isSGisPolylineSymbol, isScalablePolylineSymbol, isSimpleOffset, isSimplePolylineSymbol, isSimpleSymbol, isSizableSymbol, isSolidBrush, isSquareLineMiter, isSquareSymbol, isStaticImageSymbol, isStringParameterValue, isStrokeStyledSymbol, isStyle, isSymbolWithOffset, isTwoDimensionalSymbol, isUniqueClass, measureAreaSymbol, measureLengthSymbol, measurePolygonSnapSymbol, metersToPixels, numberWithSpaces, packStyle, polygonCircleFromPoint, printRangeClass, renderSymbolToCanvas, selectedPoint, selectedPolygon, selectedPolyline, setDefaultParameterValue, setParameterValue, shouldUpdateMapState, solidStrokeStylePreset, strokeStylePresets, symbolParameterWalker, symbolTypeGuard, toIntervals, toLineDash, unClassify, updateMapResolution, useCanvas, useClusterLayer, useCrs, useDebouncedCallback, useDraggableMarker, useEventPoint, useEvergisContext, useEvergisDynamicLayer, useEvergisSelect, useEvergisSelectContext, useEvergisTileLayer, useFeatureLayer, useLayerLegend, useLayerOrder, useLayerVisibility, useLegend, useLegendContext, useLegendValueSymbol, useMapBboxChange, useMapContext, useMapLegend, useMapLevel, useMapPick, useMapResize, useMapState, useMapView, useMapViewActions, useMapWrapper, useMaxMinScale, useMetersToPixels, useMetersToPixelsCb, useMount, useProperty, useScale, useSymbol, useTooltip, useTooltipContext, useUpdate, useUpdateMapView };
|
|
5341
5335
|
//# sourceMappingURL=react.esm.js.map
|