@evergis/react 2.0.73 → 2.0.76
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/components/EvergisCard/MailValue.d.ts +1 -0
- package/dist/components/EvergisCard/PhoneValue.d.ts +1 -0
- package/dist/components/EvergisCard/UrlValue.d.ts +1 -0
- package/dist/components/MapControls/Fullscreen.d.ts +1 -0
- package/dist/components/MapControls/Measure.d.ts +1 -0
- package/dist/components/MapControls/Search.d.ts +1 -0
- package/dist/components/Noop/index.d.ts +1 -0
- package/dist/react.cjs.development.js +1527 -1535
- 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 +1528 -1536
- package/dist/react.esm.js.map +1 -1
- package/package.json +4 -4
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,
|
|
@@ -548,7 +540,7 @@ const formatStringAttribute = value => {
|
|
|
548
540
|
|
|
549
541
|
const attributeValues = value.split(/[\s|]/).map(convertStringAttribute);
|
|
550
542
|
|
|
551
|
-
if (attributeValues.every(_ref => {
|
|
543
|
+
if (attributeValues.every((_ref) => {
|
|
552
544
|
let {
|
|
553
545
|
type
|
|
554
546
|
} = _ref;
|
|
@@ -556,7 +548,7 @@ const formatStringAttribute = value => {
|
|
|
556
548
|
}
|
|
557
549
|
/* String */
|
|
558
550
|
)) {
|
|
559
|
-
return [stringAttribute(attributeValues.map(_ref2 => {
|
|
551
|
+
return [stringAttribute(attributeValues.map((_ref2) => {
|
|
560
552
|
let {
|
|
561
553
|
value
|
|
562
554
|
} = _ref2;
|
|
@@ -1039,7 +1031,7 @@ const getFeatureAttributeType = attributeValue => {
|
|
|
1039
1031
|
};
|
|
1040
1032
|
const getLayerAttributes = layerDefinition => {
|
|
1041
1033
|
const attributes = layerDefinition && layerDefinition.attributes || {};
|
|
1042
|
-
return Object.entries(attributes).map(_ref => {
|
|
1034
|
+
return Object.entries(attributes).map((_ref) => {
|
|
1043
1035
|
let [name, definition] = _ref;
|
|
1044
1036
|
return _extends({
|
|
1045
1037
|
name
|
|
@@ -1047,7 +1039,7 @@ const getLayerAttributes = layerDefinition => {
|
|
|
1047
1039
|
});
|
|
1048
1040
|
};
|
|
1049
1041
|
const getFeatureAttributes = attributes => {
|
|
1050
|
-
return attributes ? Object.entries(attributes).map(_ref2 => {
|
|
1042
|
+
return attributes ? Object.entries(attributes).map((_ref2) => {
|
|
1051
1043
|
let [name, value] = _ref2;
|
|
1052
1044
|
return {
|
|
1053
1045
|
name,
|
|
@@ -1065,7 +1057,7 @@ const getClassificationAttribute = (attributeName, attributes) => {
|
|
|
1065
1057
|
return attribute ? _extends({}, attrNamePart, attribute) : attrNamePart;
|
|
1066
1058
|
};
|
|
1067
1059
|
const mergeAttributes = (attributes1, attributes2) => {
|
|
1068
|
-
return attributes1.map(attribute => _extends({}, attribute, attributes2.find(_ref3 => {
|
|
1060
|
+
return attributes1.map(attribute => _extends({}, attribute, attributes2.find((_ref3) => {
|
|
1069
1061
|
let {
|
|
1070
1062
|
name
|
|
1071
1063
|
} = _ref3;
|
|
@@ -1480,7 +1472,7 @@ let SGisPolygonSymbol = /*#__PURE__*/function (_sPolygonSymbol) {
|
|
|
1480
1472
|
const adaptMiterRings = (rings, resolution, fromCrs, toCrs) => {
|
|
1481
1473
|
const projected = projectRings(rings, fromCrs, toCrs);
|
|
1482
1474
|
return simplifyCoordinates(projected.map(ring => // @ts-ignore
|
|
1483
|
-
ring.map(_ref => {
|
|
1475
|
+
ring.map((_ref) => {
|
|
1484
1476
|
let [x, y] = _ref;
|
|
1485
1477
|
return [x / resolution, y / -resolution];
|
|
1486
1478
|
})), 1);
|
|
@@ -1572,1518 +1564,1178 @@ let ArrowLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
|
1572
1564
|
return ArrowLineMiterRender;
|
|
1573
1565
|
}(LineMiterRender);
|
|
1574
1566
|
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
length: formatLength
|
|
1578
|
-
};
|
|
1579
|
-
|
|
1580
|
-
const COORD_FRACTION = 6;
|
|
1581
|
-
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
1582
|
-
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
1583
|
-
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
1584
|
-
|
|
1585
|
-
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
1567
|
+
let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1568
|
+
_inherits(CircleLineMiterRender, _LineMiterRender);
|
|
1586
1569
|
|
|
1587
|
-
|
|
1588
|
-
var _this;
|
|
1570
|
+
var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
|
|
1589
1571
|
|
|
1590
|
-
|
|
1572
|
+
function CircleLineMiterRender() {
|
|
1573
|
+
_classCallCheck(this, CircleLineMiterRender);
|
|
1591
1574
|
|
|
1592
|
-
|
|
1575
|
+
return _super.apply(this, arguments);
|
|
1576
|
+
}
|
|
1593
1577
|
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1578
|
+
_createClass(CircleLineMiterRender, [{
|
|
1579
|
+
key: "usageSize",
|
|
1580
|
+
get: function get() {
|
|
1581
|
+
return this.miterSize + this.strokeWidth * 3;
|
|
1582
|
+
}
|
|
1583
|
+
}, {
|
|
1584
|
+
key: "createRings",
|
|
1585
|
+
value: function createRings(_ref, xMultiplier) {
|
|
1586
|
+
let [x, y] = _ref;
|
|
1587
|
+
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1588
|
+
}
|
|
1589
|
+
}, {
|
|
1590
|
+
key: "createRender",
|
|
1591
|
+
value: function createRender(miterRings) {
|
|
1592
|
+
const isFilled = this.kind === LineMiterKind.FilledCircle;
|
|
1593
|
+
return new PolyRender(polygonCircleFromPoint(miterRings[0][0], this.miterSize), {
|
|
1594
|
+
fillColor: isFilled ? this.color : 'transparent',
|
|
1595
|
+
strokeColor: this.color,
|
|
1596
|
+
strokeWidth: this.strokeWidth,
|
|
1597
|
+
enclosed: true
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
}]);
|
|
1597
1601
|
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1601
|
-
_this.areaSymbol = params.areaSymbol;
|
|
1602
|
+
return CircleLineMiterRender;
|
|
1603
|
+
}(LineMiterRender);
|
|
1602
1604
|
|
|
1603
|
-
|
|
1605
|
+
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1606
|
+
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1604
1607
|
|
|
1608
|
+
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1605
1609
|
|
|
1606
|
-
|
|
1610
|
+
function SquareLineMiterRender() {
|
|
1611
|
+
_classCallCheck(this, SquareLineMiterRender);
|
|
1607
1612
|
|
|
1608
|
-
return
|
|
1613
|
+
return _super.apply(this, arguments);
|
|
1609
1614
|
}
|
|
1610
1615
|
|
|
1611
|
-
_createClass(
|
|
1612
|
-
key: "
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
this.drawPointOnMouseMove(event);
|
|
1616
|
+
_createClass(SquareLineMiterRender, [{
|
|
1617
|
+
key: "usageSize",
|
|
1618
|
+
get: function get() {
|
|
1619
|
+
return this.miterSize + this.strokeWidth;
|
|
1617
1620
|
}
|
|
1618
1621
|
}, {
|
|
1619
|
-
key: "
|
|
1620
|
-
value: function
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
this.addTempLabel();
|
|
1624
|
-
this.setCursor('pointer');
|
|
1622
|
+
key: "createRings",
|
|
1623
|
+
value: function createRings(_ref, xMultiplier) {
|
|
1624
|
+
let [x, y] = _ref;
|
|
1625
|
+
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]]];
|
|
1625
1626
|
}
|
|
1626
1627
|
}, {
|
|
1627
|
-
key: "
|
|
1628
|
-
value: function
|
|
1629
|
-
|
|
1628
|
+
key: "createRender",
|
|
1629
|
+
value: function createRender(miterRings) {
|
|
1630
|
+
const isFilled = this.kind === LineMiterKind.FilledSquare;
|
|
1631
|
+
return new PolyRender(miterRings, {
|
|
1632
|
+
enclosed: true,
|
|
1633
|
+
fillColor: isFilled ? this.color : void 0,
|
|
1634
|
+
fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
|
|
1635
|
+
lineCap: 'square',
|
|
1636
|
+
lineJoin: 'miter',
|
|
1637
|
+
strokeColor: this.color,
|
|
1638
|
+
strokeWidth: this.strokeWidth
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
}]);
|
|
1630
1642
|
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1643
|
+
return SquareLineMiterRender;
|
|
1644
|
+
}(LineMiterRender);
|
|
1645
|
+
|
|
1646
|
+
const getLineMiterRender = options => {
|
|
1647
|
+
switch (options.kind) {
|
|
1648
|
+
case LineMiterKind.Arrow:
|
|
1649
|
+
case LineMiterKind.FilledArrow:
|
|
1650
|
+
return new ArrowLineMiterRender(options);
|
|
1651
|
+
|
|
1652
|
+
case LineMiterKind.Square:
|
|
1653
|
+
case LineMiterKind.FilledSquare:
|
|
1654
|
+
return new SquareLineMiterRender(options);
|
|
1655
|
+
|
|
1656
|
+
case LineMiterKind.Circle:
|
|
1657
|
+
case LineMiterKind.FilledCircle:
|
|
1658
|
+
return new CircleLineMiterRender(options);
|
|
1659
|
+
|
|
1660
|
+
default:
|
|
1661
|
+
return null;
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
|
|
1665
|
+
const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
|
|
1666
|
+
const reversedRing = ring.slice().reverse();
|
|
1667
|
+
|
|
1668
|
+
for (let i = 0; i < reversedRing.length; i++) {
|
|
1669
|
+
const coordinates = reversedRing[i];
|
|
1670
|
+
|
|
1671
|
+
if (isLastRing && i === 0) {
|
|
1672
|
+
reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
|
|
1636
1673
|
}
|
|
1637
|
-
}, {
|
|
1638
|
-
key: "handlePointAdd",
|
|
1639
|
-
value: function handlePointAdd() {
|
|
1640
|
-
const feature = this.activeFeature;
|
|
1641
|
-
if (!feature) return;
|
|
1642
|
-
const {
|
|
1643
|
-
rings,
|
|
1644
|
-
crs
|
|
1645
|
-
} = feature;
|
|
1646
1674
|
|
|
1647
|
-
|
|
1648
|
-
this.finishDrawing();
|
|
1649
|
-
this.fire(new DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
1650
|
-
return;
|
|
1651
|
-
}
|
|
1675
|
+
const nextCoordinates = reversedRing[i - 1];
|
|
1652
1676
|
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
const point = rings[0][0];
|
|
1656
|
-
if (!projection) return;
|
|
1657
|
-
const [lat, long] = projection(point);
|
|
1658
|
-
this.removeTempLabel();
|
|
1659
|
-
this.addMeasureResultLabel();
|
|
1660
|
-
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
1661
|
-
} else {
|
|
1662
|
-
this.removeCoordLabel();
|
|
1663
|
-
}
|
|
1677
|
+
if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
|
|
1678
|
+
reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
|
|
1664
1679
|
}
|
|
1665
|
-
}
|
|
1666
|
-
key: "polygonPreview",
|
|
1667
|
-
value: function polygonPreview() {
|
|
1668
|
-
if (this.tempPolygon) {
|
|
1669
|
-
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
1670
|
-
}
|
|
1680
|
+
}
|
|
1671
1681
|
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
1684
|
-
this.activeFeature && this.activeFeature.hide();
|
|
1685
|
-
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
1682
|
+
return reversedRing.reverse();
|
|
1683
|
+
};
|
|
1684
|
+
|
|
1685
|
+
const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
|
|
1686
|
+
const newRing = ring.slice();
|
|
1687
|
+
|
|
1688
|
+
for (let i = 0; i < newRing.length; i++) {
|
|
1689
|
+
const coordinates = newRing[i];
|
|
1690
|
+
|
|
1691
|
+
if (i === 0 && isFirstRing) {
|
|
1692
|
+
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
1686
1693
|
}
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
delete this.tempPolygon;
|
|
1693
|
-
}
|
|
1694
|
+
|
|
1695
|
+
const prevCoordinates = newRing[i - 1];
|
|
1696
|
+
|
|
1697
|
+
if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
|
|
1698
|
+
newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
|
|
1694
1699
|
}
|
|
1695
|
-
}
|
|
1696
|
-
key: "updateDistance",
|
|
1697
|
-
value: function updateDistance(event) {
|
|
1698
|
-
const feature = this.activeFeature;
|
|
1699
|
-
const {
|
|
1700
|
-
ringIndex,
|
|
1701
|
-
pointIndex
|
|
1702
|
-
} = event;
|
|
1703
|
-
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
1704
|
-
const {
|
|
1705
|
-
rings,
|
|
1706
|
-
crs
|
|
1707
|
-
} = feature;
|
|
1708
|
-
const position = rings[ringIndex][pointIndex];
|
|
1709
|
-
const length$1 = length(rings, crs);
|
|
1710
|
-
let content = this.formatters.length(length$1);
|
|
1700
|
+
}
|
|
1711
1701
|
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
const area$1 = area(rings, crs);
|
|
1715
|
-
content = this.formatters.polygon(area$1, length$1);
|
|
1716
|
-
} else if (this.tempPolygon) {
|
|
1717
|
-
feature.show();
|
|
1718
|
-
this.removeTempPolygon();
|
|
1719
|
-
}
|
|
1702
|
+
return newRing;
|
|
1703
|
+
};
|
|
1720
1704
|
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1705
|
+
const updateRingsForMiter = (rings, position, miterSize) => {
|
|
1706
|
+
return rings.map((ring, ringIndex) => {
|
|
1707
|
+
switch (position) {
|
|
1708
|
+
case 'right':
|
|
1709
|
+
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
1710
|
+
|
|
1711
|
+
default:
|
|
1712
|
+
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
1725
1713
|
}
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1714
|
+
});
|
|
1715
|
+
};
|
|
1716
|
+
|
|
1717
|
+
const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
|
|
1718
|
+
let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
|
|
1719
|
+
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
1720
|
+
|
|
1721
|
+
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
1722
|
+
|
|
1723
|
+
function SGisPolylineSymbol(originalSymbol) {
|
|
1724
|
+
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
1725
|
+
|
|
1726
|
+
var _this;
|
|
1727
|
+
|
|
1728
|
+
_classCallCheck(this, SGisPolylineSymbol);
|
|
1729
|
+
|
|
1730
|
+
_this = _super.call(this, {
|
|
1731
|
+
// @ts-ignore
|
|
1732
|
+
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
1733
|
+
strokeWidth: clamp( // @ts-ignore
|
|
1734
|
+
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
1735
|
+
// @ts-ignore
|
|
1736
|
+
lineDash: getLineDash(originalSymbol.stroke),
|
|
1737
|
+
// @ts-ignore
|
|
1738
|
+
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
1739
|
+
});
|
|
1740
|
+
_this.originalSymbol = originalSymbol;
|
|
1741
|
+
return _this;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
_createClass(SGisPolylineSymbol, [{
|
|
1745
|
+
key: "renderFunction",
|
|
1746
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
1747
|
+
if (!isSimplePolylineSymbol(this.originalSymbol)) return _get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, feature, resolution, crs);
|
|
1748
|
+
const {
|
|
1749
|
+
ending,
|
|
1750
|
+
beginningSize,
|
|
1751
|
+
beginning,
|
|
1752
|
+
endingSize
|
|
1753
|
+
} = this.originalSymbol;
|
|
1754
|
+
const renders = [];
|
|
1755
|
+
const featureCopy = feature.clone();
|
|
1756
|
+
const beginningMiterRender = getLineMiterRender({
|
|
1757
|
+
color: this.strokeColor,
|
|
1758
|
+
// @ts-ignore
|
|
1759
|
+
kind: beginning,
|
|
1760
|
+
position: 'left',
|
|
1761
|
+
// @ts-ignore
|
|
1762
|
+
size: beginningSize,
|
|
1763
|
+
strokeWidth: this.strokeWidth
|
|
1748
1764
|
});
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
renderLabel: this.renderLabelSymbol
|
|
1758
|
-
})
|
|
1765
|
+
const endingMiterRender = getLineMiterRender({
|
|
1766
|
+
color: this.strokeColor,
|
|
1767
|
+
// @ts-ignore
|
|
1768
|
+
kind: ending,
|
|
1769
|
+
position: 'right',
|
|
1770
|
+
// @ts-ignore
|
|
1771
|
+
size: endingSize,
|
|
1772
|
+
strokeWidth: this.strokeWidth
|
|
1759
1773
|
});
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
1767
|
-
delete this.tempLabel;
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
}, {
|
|
1771
|
-
key: "removeCoordLabel",
|
|
1772
|
-
value: function removeCoordLabel() {
|
|
1773
|
-
if (this.coordLabel) {
|
|
1774
|
-
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
1775
|
-
delete this.coordLabel;
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
}, {
|
|
1779
|
-
key: "removeMeasureLabel",
|
|
1780
|
-
value: function removeMeasureLabel() {
|
|
1781
|
-
if (this.measureResultLabel) {
|
|
1782
|
-
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
1783
|
-
delete this.measureResultLabel;
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
}, {
|
|
1787
|
-
key: "drawPointOnMouseMove",
|
|
1788
|
-
value: function drawPointOnMouseMove(event) {
|
|
1789
|
-
if (this.tempLabel) {
|
|
1790
|
-
this.tempLabel.position = event.point.position;
|
|
1774
|
+
|
|
1775
|
+
if (beginningMiterRender) {
|
|
1776
|
+
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
1777
|
+
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
1778
|
+
featureCopy.rings = updatedRings;
|
|
1779
|
+
renders.push(render);
|
|
1791
1780
|
}
|
|
1781
|
+
|
|
1782
|
+
if (endingMiterRender) {
|
|
1783
|
+
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
1784
|
+
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
1785
|
+
featureCopy.rings = updatedRings;
|
|
1786
|
+
renders.push(render);
|
|
1787
|
+
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
1791
|
+
return renders;
|
|
1792
1792
|
}
|
|
1793
1793
|
}, {
|
|
1794
|
-
key: "
|
|
1795
|
-
value: function
|
|
1796
|
-
|
|
1797
|
-
wrapper
|
|
1798
|
-
} = this.painter;
|
|
1799
|
-
|
|
1800
|
-
if (wrapper && typeof wrapper !== 'string') {
|
|
1801
|
-
wrapper.style.cursor = cursor;
|
|
1802
|
-
}
|
|
1794
|
+
key: "clone",
|
|
1795
|
+
value: function clone() {
|
|
1796
|
+
return new SGisPolylineSymbol(this.originalSymbol);
|
|
1803
1797
|
}
|
|
1804
1798
|
}]);
|
|
1805
1799
|
|
|
1806
|
-
return
|
|
1807
|
-
}(
|
|
1800
|
+
return SGisPolylineSymbol;
|
|
1801
|
+
}(PolylineSymbol);
|
|
1808
1802
|
|
|
1809
|
-
let
|
|
1810
|
-
_inherits(
|
|
1803
|
+
let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
|
|
1804
|
+
_inherits(LabelSymbol, _DynamicPointSymbol);
|
|
1811
1805
|
|
|
1812
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
1806
|
+
var _super = /*#__PURE__*/_createSuper(LabelSymbol);
|
|
1813
1807
|
|
|
1814
|
-
function
|
|
1808
|
+
function LabelSymbol(_temp) {
|
|
1815
1809
|
var _this;
|
|
1816
1810
|
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
_this.measureResult = () => {
|
|
1822
|
-
const feature = _this.activeFeature;
|
|
1823
|
-
if (!feature) return null;
|
|
1824
|
-
const {
|
|
1825
|
-
rings,
|
|
1826
|
-
isEnclosed,
|
|
1827
|
-
crs
|
|
1828
|
-
} = feature;
|
|
1829
|
-
const pointsCount = rings[0].length;
|
|
1830
|
-
const position = rings[0][pointsCount - 1];
|
|
1831
|
-
const area$1 = area(rings, crs);
|
|
1832
|
-
const length$1 = length(rings, crs, isEnclosed);
|
|
1833
|
-
const content = isEnclosed ? _this.formatters.polygon(area$1, length$1) : _this.formatters.length(length$1);
|
|
1834
|
-
return {
|
|
1835
|
-
content,
|
|
1836
|
-
position
|
|
1837
|
-
};
|
|
1838
|
-
};
|
|
1839
|
-
|
|
1840
|
-
_this.removeFeature = () => {
|
|
1841
|
-
_this.fire('remove');
|
|
1842
|
-
};
|
|
1843
|
-
|
|
1844
|
-
_this.painter = painter;
|
|
1845
|
-
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
1846
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1847
|
-
|
|
1848
|
-
_this.on('change', _this.updateMeasureResult);
|
|
1811
|
+
let {
|
|
1812
|
+
component,
|
|
1813
|
+
offset
|
|
1814
|
+
} = _temp === void 0 ? {} : _temp;
|
|
1849
1815
|
|
|
1850
|
-
|
|
1816
|
+
_classCallCheck(this, LabelSymbol);
|
|
1851
1817
|
|
|
1818
|
+
_this = _super.call(this, {
|
|
1819
|
+
offset
|
|
1820
|
+
});
|
|
1821
|
+
_this.component = component;
|
|
1852
1822
|
return _this;
|
|
1853
1823
|
}
|
|
1854
1824
|
|
|
1855
|
-
_createClass(
|
|
1856
|
-
key: "
|
|
1857
|
-
value: function
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1825
|
+
_createClass(LabelSymbol, [{
|
|
1826
|
+
key: "_getFeatureNode",
|
|
1827
|
+
value: function _getFeatureNode(feature) {
|
|
1828
|
+
const node = document.createElement('div');
|
|
1829
|
+
this.renderDom(feature.content, node);
|
|
1830
|
+
return node;
|
|
1861
1831
|
}
|
|
1862
1832
|
}, {
|
|
1863
|
-
key: "
|
|
1864
|
-
value: function
|
|
1865
|
-
|
|
1866
|
-
if (measureResult === null) return;
|
|
1867
|
-
const {
|
|
1868
|
-
content,
|
|
1869
|
-
position
|
|
1870
|
-
} = measureResult;
|
|
1871
|
-
this.measureResultLabel = new LabelFeature(position, {
|
|
1872
|
-
content,
|
|
1873
|
-
crs: this.map.crs,
|
|
1874
|
-
symbol: createLabelSymbol({
|
|
1875
|
-
onClose: this.removeFeature,
|
|
1876
|
-
renderLabel: this.renderLabelSymbol
|
|
1877
|
-
})
|
|
1878
|
-
});
|
|
1879
|
-
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
1833
|
+
key: "_updateFeatureNode",
|
|
1834
|
+
value: function _updateFeatureNode(feature) {
|
|
1835
|
+
this.renderDom(feature.content, this.getNode(feature));
|
|
1880
1836
|
}
|
|
1881
1837
|
}, {
|
|
1882
|
-
key: "
|
|
1883
|
-
value: function
|
|
1884
|
-
if (
|
|
1885
|
-
|
|
1886
|
-
if (measureResult === null) return;
|
|
1887
|
-
const {
|
|
1888
|
-
content,
|
|
1889
|
-
position
|
|
1890
|
-
} = measureResult;
|
|
1891
|
-
this.measureResultLabel.content = content;
|
|
1892
|
-
this.measureResultLabel.position = position;
|
|
1838
|
+
key: "renderDom",
|
|
1839
|
+
value: function renderDom(content, node) {
|
|
1840
|
+
if (!node) {
|
|
1841
|
+
return;
|
|
1893
1842
|
}
|
|
1894
|
-
}
|
|
1895
|
-
}]);
|
|
1896
1843
|
|
|
1897
|
-
|
|
1898
|
-
}(PolyEditor);
|
|
1844
|
+
const Component = this.component;
|
|
1899
1845
|
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
|
|
1910
|
-
const widthDistance = distance(zeroPoint, maxWidthPoint);
|
|
1911
|
-
const pxK = width / (widthDistance || 1);
|
|
1912
|
-
return Math.round(meters * pxK);
|
|
1913
|
-
};
|
|
1914
|
-
|
|
1915
|
-
const polygonCircleFromPoint = (center, diameter) => {
|
|
1916
|
-
const coordinates = [];
|
|
1917
|
-
const radius = diameter / 2;
|
|
1918
|
-
const endAngle = Math.PI * 2;
|
|
1919
|
-
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
1920
|
-
let start = 0;
|
|
1921
|
-
let end = endAngle;
|
|
1846
|
+
if (Component) {
|
|
1847
|
+
ReactDOM.render(React.createElement(Component, {
|
|
1848
|
+
content: content
|
|
1849
|
+
}), node);
|
|
1850
|
+
} else {
|
|
1851
|
+
node.innerText = content;
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
}]);
|
|
1922
1855
|
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
}
|
|
1856
|
+
return LabelSymbol;
|
|
1857
|
+
}(DynamicPointSymbol);
|
|
1926
1858
|
|
|
1927
|
-
|
|
1859
|
+
const defaultOffset = [8, -16];
|
|
1860
|
+
const createLabelSymbol = props => {
|
|
1861
|
+
const {
|
|
1862
|
+
offset = defaultOffset,
|
|
1863
|
+
renderLabel = (_ref) => {
|
|
1864
|
+
let {
|
|
1865
|
+
content
|
|
1866
|
+
} = _ref;
|
|
1867
|
+
return React.createElement("div", null, content);
|
|
1868
|
+
},
|
|
1869
|
+
onClose = undefined
|
|
1870
|
+
} = props || {};
|
|
1871
|
+
return new LabelSymbol({
|
|
1872
|
+
offset,
|
|
1873
|
+
component: (_ref2) => {
|
|
1874
|
+
let {
|
|
1875
|
+
content
|
|
1876
|
+
} = _ref2;
|
|
1877
|
+
return renderLabel({
|
|
1878
|
+
content,
|
|
1879
|
+
onClose
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
});
|
|
1928
1883
|
};
|
|
1929
1884
|
|
|
1930
|
-
|
|
1931
|
-
|
|
1885
|
+
function createShadowRender(position, _ref) {
|
|
1886
|
+
let {
|
|
1887
|
+
strokeWidth = 2,
|
|
1888
|
+
shadowColor,
|
|
1889
|
+
shadowSize,
|
|
1890
|
+
size = 6
|
|
1891
|
+
} = _ref;
|
|
1892
|
+
const shadowDiameter = size + strokeWidth + shadowSize;
|
|
1893
|
+
return new PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
|
|
1894
|
+
fillColor: 'transparent',
|
|
1895
|
+
strokeColor: shadowColor,
|
|
1896
|
+
strokeWidth: shadowSize,
|
|
1897
|
+
enclosed: true
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
function getEditorPointRenderer(position, _ref2) {
|
|
1901
|
+
let {
|
|
1902
|
+
strokeColor,
|
|
1903
|
+
strokeWidth,
|
|
1904
|
+
shadowColor,
|
|
1905
|
+
fillColor,
|
|
1906
|
+
shadowSize,
|
|
1907
|
+
size = 0
|
|
1908
|
+
} = _ref2;
|
|
1909
|
+
return [createShadowRender(position, {
|
|
1910
|
+
strokeWidth,
|
|
1911
|
+
strokeColor,
|
|
1912
|
+
shadowSize,
|
|
1913
|
+
shadowColor,
|
|
1914
|
+
size
|
|
1915
|
+
}), new PolyRender(polygonCircleFromPoint(position, size), {
|
|
1916
|
+
fillColor,
|
|
1917
|
+
strokeColor,
|
|
1918
|
+
strokeWidth,
|
|
1919
|
+
enclosed: true
|
|
1920
|
+
})];
|
|
1921
|
+
}
|
|
1932
1922
|
|
|
1933
|
-
|
|
1923
|
+
let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
|
|
1924
|
+
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
1934
1925
|
|
|
1935
|
-
|
|
1936
|
-
_classCallCheck(this, CircleLineMiterRender);
|
|
1926
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
|
|
1937
1927
|
|
|
1938
|
-
|
|
1928
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
1929
|
+
function ShadowedPointSymbol(options) {
|
|
1930
|
+
_classCallCheck(this, ShadowedPointSymbol);
|
|
1931
|
+
|
|
1932
|
+
return _super.call(this, options);
|
|
1939
1933
|
}
|
|
1940
1934
|
|
|
1941
|
-
_createClass(
|
|
1942
|
-
key: "
|
|
1943
|
-
|
|
1944
|
-
|
|
1935
|
+
_createClass(ShadowedPointSymbol, [{
|
|
1936
|
+
key: "renderFunction",
|
|
1937
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
1938
|
+
if (!(feature instanceof PointFeature)) return [];
|
|
1939
|
+
const {
|
|
1940
|
+
position
|
|
1941
|
+
} = feature.projectTo(crs);
|
|
1942
|
+
const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
|
|
1943
|
+
const shadowRender = this.getShadow(pxPosition, feature);
|
|
1944
|
+
const pointArc = this.getPoint(pxPosition, feature);
|
|
1945
|
+
return shadowRender ? [shadowRender, pointArc] : [pointArc];
|
|
1945
1946
|
}
|
|
1946
1947
|
}, {
|
|
1947
|
-
key: "
|
|
1948
|
-
value: function
|
|
1949
|
-
|
|
1950
|
-
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1948
|
+
key: "getShadow",
|
|
1949
|
+
value: function getShadow(position, _feature) {
|
|
1950
|
+
return ShadowedPointSymbol.getShadowArc(position, this);
|
|
1951
1951
|
}
|
|
1952
1952
|
}, {
|
|
1953
|
-
key: "
|
|
1954
|
-
value: function
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1953
|
+
key: "getPoint",
|
|
1954
|
+
value: function getPoint(position, _feature) {
|
|
1955
|
+
return ShadowedPointSymbol.getPointArc(position, this);
|
|
1956
|
+
}
|
|
1957
|
+
}], [{
|
|
1958
|
+
key: "getShadowArc",
|
|
1959
|
+
value: function getShadowArc(position, _ref) {
|
|
1960
|
+
let {
|
|
1961
|
+
strokeWidth = 2,
|
|
1962
|
+
shadowColor,
|
|
1963
|
+
shadowSize,
|
|
1964
|
+
size = 6
|
|
1965
|
+
} = _ref;
|
|
1966
|
+
return new PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
|
|
1967
|
+
fillColor: 'transparent',
|
|
1968
|
+
strokeColor: shadowColor,
|
|
1969
|
+
strokeWidth: shadowSize,
|
|
1960
1970
|
enclosed: true
|
|
1961
1971
|
});
|
|
1962
1972
|
}
|
|
1963
|
-
}]);
|
|
1964
|
-
|
|
1965
|
-
return CircleLineMiterRender;
|
|
1966
|
-
}(LineMiterRender);
|
|
1967
|
-
|
|
1968
|
-
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1969
|
-
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1970
|
-
|
|
1971
|
-
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1972
|
-
|
|
1973
|
-
function SquareLineMiterRender() {
|
|
1974
|
-
_classCallCheck(this, SquareLineMiterRender);
|
|
1975
|
-
|
|
1976
|
-
return _super.apply(this, arguments);
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
_createClass(SquareLineMiterRender, [{
|
|
1980
|
-
key: "usageSize",
|
|
1981
|
-
get: function get() {
|
|
1982
|
-
return this.miterSize + this.strokeWidth;
|
|
1983
|
-
}
|
|
1984
1973
|
}, {
|
|
1985
|
-
key: "
|
|
1986
|
-
value: function
|
|
1987
|
-
let
|
|
1988
|
-
|
|
1974
|
+
key: "getPointArc",
|
|
1975
|
+
value: function getPointArc(position, _ref2) {
|
|
1976
|
+
let {
|
|
1977
|
+
strokeWidth,
|
|
1978
|
+
fillColor,
|
|
1979
|
+
strokeColor,
|
|
1980
|
+
size = 6
|
|
1981
|
+
} = _ref2;
|
|
1982
|
+
return new PolyRender(polygonCircleFromPoint(position, size), {
|
|
1983
|
+
fillColor,
|
|
1984
|
+
strokeColor,
|
|
1985
|
+
strokeWidth,
|
|
1986
|
+
enclosed: true
|
|
1987
|
+
});
|
|
1989
1988
|
}
|
|
1990
1989
|
}, {
|
|
1991
|
-
key: "
|
|
1992
|
-
value: function
|
|
1993
|
-
const
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
fillColor: isFilled ? this.color : void 0,
|
|
1997
|
-
fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
|
|
1998
|
-
lineCap: 'square',
|
|
1999
|
-
lineJoin: 'miter',
|
|
2000
|
-
strokeColor: this.color,
|
|
2001
|
-
strokeWidth: this.strokeWidth
|
|
2002
|
-
});
|
|
1990
|
+
key: "getArcs",
|
|
1991
|
+
value: function getArcs(position, params) {
|
|
1992
|
+
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
1993
|
+
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
1994
|
+
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2003
1995
|
}
|
|
2004
1996
|
}]);
|
|
2005
1997
|
|
|
2006
|
-
return
|
|
2007
|
-
}(
|
|
1998
|
+
return ShadowedPointSymbol;
|
|
1999
|
+
}(PointSymbol);
|
|
2008
2000
|
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
case LineMiterKind.Arrow:
|
|
2012
|
-
case LineMiterKind.FilledArrow:
|
|
2013
|
-
return new ArrowLineMiterRender(options);
|
|
2001
|
+
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2002
|
+
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2014
2003
|
|
|
2015
|
-
|
|
2016
|
-
case LineMiterKind.FilledSquare:
|
|
2017
|
-
return new SquareLineMiterRender(options);
|
|
2004
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2018
2005
|
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2006
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2007
|
+
function ShadowedPolySymbol(options) {
|
|
2008
|
+
_classCallCheck(this, ShadowedPolySymbol);
|
|
2022
2009
|
|
|
2023
|
-
|
|
2024
|
-
return null;
|
|
2010
|
+
return _super.call(this, options);
|
|
2025
2011
|
}
|
|
2026
|
-
};
|
|
2027
2012
|
|
|
2028
|
-
|
|
2029
|
-
|
|
2013
|
+
_createClass(ShadowedPolySymbol, [{
|
|
2014
|
+
key: "renderFunction",
|
|
2015
|
+
value: function renderFunction(feature, resolution, crs) {
|
|
2016
|
+
if (!(feature instanceof Poly)) return [];
|
|
2017
|
+
const coordinates = PolylineSymbol.getRenderedCoordinates(feature, resolution, crs);
|
|
2018
|
+
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2019
|
+
const shadowRender = this.getShadow(coordinates, feature);
|
|
2020
|
+
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2021
|
+
let renders = [polyRender];
|
|
2030
2022
|
|
|
2031
|
-
|
|
2032
|
-
|
|
2023
|
+
if (shadowRender) {
|
|
2024
|
+
renders = [shadowRender, polyRender];
|
|
2025
|
+
}
|
|
2033
2026
|
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
const nextCoordinates = reversedRing[i - 1];
|
|
2027
|
+
if (vertexRenders) {
|
|
2028
|
+
renders = renders.concat(vertexRenders);
|
|
2029
|
+
}
|
|
2039
2030
|
|
|
2040
|
-
|
|
2041
|
-
reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
|
|
2031
|
+
return renders;
|
|
2042
2032
|
}
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
if (i === 0 && isFirstRing) {
|
|
2055
|
-
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
2033
|
+
}, {
|
|
2034
|
+
key: "getShadow",
|
|
2035
|
+
value: function getShadow(coordinates, _feature) {
|
|
2036
|
+
return new PolyRender(coordinates, {
|
|
2037
|
+
fillStyle: FillStyle.None,
|
|
2038
|
+
enclosed: this.enclose,
|
|
2039
|
+
strokeColor: this.shadowColor,
|
|
2040
|
+
strokeWidth: this.shadowSize,
|
|
2041
|
+
lineDash: this.lineDash
|
|
2042
|
+
});
|
|
2056
2043
|
}
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2044
|
+
}, {
|
|
2045
|
+
key: "getPolyRender",
|
|
2046
|
+
value: function getPolyRender(coordinates, _feature) {
|
|
2047
|
+
return new PolyRender(coordinates, {
|
|
2048
|
+
fillStyle: this.enclose ? FillStyle.Color : FillStyle.None,
|
|
2049
|
+
enclosed: this.enclose,
|
|
2050
|
+
fillColor: this.fillColor,
|
|
2051
|
+
strokeColor: this.strokeColor,
|
|
2052
|
+
strokeWidth: this.strokeWidth,
|
|
2053
|
+
lineDash: this.lineDash
|
|
2054
|
+
});
|
|
2062
2055
|
}
|
|
2063
|
-
}
|
|
2056
|
+
}, {
|
|
2057
|
+
key: "getVertexRenders",
|
|
2058
|
+
value: function getVertexRenders(coordinates) {
|
|
2059
|
+
if (!this.showVertex) return;
|
|
2060
|
+
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2061
|
+
return acc.concat(curr);
|
|
2062
|
+
}, []);
|
|
2063
|
+
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2064
|
+
size: 6,
|
|
2065
|
+
strokeWidth: 2,
|
|
2066
|
+
shadowColor: this.shadowColor,
|
|
2067
|
+
strokeColor: this.strokeColor,
|
|
2068
|
+
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2069
|
+
fillColor: '#ffffff'
|
|
2070
|
+
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2071
|
+
}
|
|
2072
|
+
}]);
|
|
2064
2073
|
|
|
2065
|
-
return
|
|
2074
|
+
return ShadowedPolySymbol;
|
|
2075
|
+
}(PolylineSymbol);
|
|
2076
|
+
const polySymbolParams = {
|
|
2077
|
+
strokeWidth: 2,
|
|
2078
|
+
strokeColor: '#e33600',
|
|
2079
|
+
shadowSize: 8,
|
|
2080
|
+
shadowColor: 'rgba(227, 54, 0, 0.3)'
|
|
2066
2081
|
};
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
case 'right':
|
|
2072
|
-
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
2073
|
-
|
|
2074
|
-
default:
|
|
2075
|
-
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
2076
|
-
}
|
|
2077
|
-
});
|
|
2082
|
+
const measureSymbolParams = {
|
|
2083
|
+
strokeColor: '#ff6933',
|
|
2084
|
+
shadowSize: 0,
|
|
2085
|
+
vertexShadowSize: 0
|
|
2078
2086
|
};
|
|
2087
|
+
const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2088
|
+
enclose: false,
|
|
2089
|
+
showVertex: true
|
|
2090
|
+
}));
|
|
2091
|
+
const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2092
|
+
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2093
|
+
enclose: true,
|
|
2094
|
+
showVertex: true
|
|
2095
|
+
}));
|
|
2096
|
+
const snapSymbolParams = {
|
|
2097
|
+
size: 10,
|
|
2098
|
+
strokeWidth: 2,
|
|
2099
|
+
strokeColor: '#e33600',
|
|
2100
|
+
fillColor: '#ffffff',
|
|
2101
|
+
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2102
|
+
shadowSize: 3
|
|
2103
|
+
};
|
|
2104
|
+
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2105
|
+
strokeColor: '#ff6933',
|
|
2106
|
+
shadowSize: 0
|
|
2107
|
+
}));
|
|
2079
2108
|
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
2083
|
-
|
|
2084
|
-
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
2085
|
-
|
|
2086
|
-
function SGisPolylineSymbol(originalSymbol) {
|
|
2087
|
-
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
2109
|
+
let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
|
|
2110
|
+
_inherits(SelectedPointSymbol, _ShadowedPointSymbol);
|
|
2088
2111
|
|
|
2089
|
-
|
|
2112
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
|
|
2090
2113
|
|
|
2091
|
-
|
|
2114
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2115
|
+
function SelectedPointSymbol(props) {
|
|
2116
|
+
_classCallCheck(this, SelectedPointSymbol);
|
|
2092
2117
|
|
|
2093
|
-
|
|
2094
|
-
// @ts-ignore
|
|
2095
|
-
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
2096
|
-
strokeWidth: clamp( // @ts-ignore
|
|
2097
|
-
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
2098
|
-
// @ts-ignore
|
|
2099
|
-
lineDash: getLineDash(originalSymbol.stroke),
|
|
2100
|
-
// @ts-ignore
|
|
2101
|
-
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
2102
|
-
});
|
|
2103
|
-
_this.originalSymbol = originalSymbol;
|
|
2104
|
-
return _this;
|
|
2118
|
+
return _super.call(this, props);
|
|
2105
2119
|
}
|
|
2106
2120
|
|
|
2107
|
-
_createClass(
|
|
2108
|
-
key: "
|
|
2109
|
-
value: function
|
|
2110
|
-
if (
|
|
2111
|
-
|
|
2112
|
-
ending,
|
|
2113
|
-
beginningSize,
|
|
2114
|
-
beginning,
|
|
2115
|
-
endingSize
|
|
2116
|
-
} = this.originalSymbol;
|
|
2117
|
-
const renders = [];
|
|
2118
|
-
const featureCopy = feature.clone();
|
|
2119
|
-
const beginningMiterRender = getLineMiterRender({
|
|
2120
|
-
color: this.strokeColor,
|
|
2121
|
-
// @ts-ignore
|
|
2122
|
-
kind: beginning,
|
|
2123
|
-
position: 'left',
|
|
2124
|
-
// @ts-ignore
|
|
2125
|
-
size: beginningSize,
|
|
2126
|
-
strokeWidth: this.strokeWidth
|
|
2127
|
-
});
|
|
2128
|
-
const endingMiterRender = getLineMiterRender({
|
|
2129
|
-
color: this.strokeColor,
|
|
2130
|
-
// @ts-ignore
|
|
2131
|
-
kind: ending,
|
|
2132
|
-
position: 'right',
|
|
2133
|
-
// @ts-ignore
|
|
2134
|
-
size: endingSize,
|
|
2135
|
-
strokeWidth: this.strokeWidth
|
|
2136
|
-
});
|
|
2137
|
-
|
|
2138
|
-
if (beginningMiterRender) {
|
|
2139
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
2140
|
-
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2141
|
-
featureCopy.rings = updatedRings;
|
|
2142
|
-
renders.push(render);
|
|
2121
|
+
_createClass(SelectedPointSymbol, [{
|
|
2122
|
+
key: "getShadow",
|
|
2123
|
+
value: function getShadow(position, feature) {
|
|
2124
|
+
if (feature.isSelected) {
|
|
2125
|
+
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2143
2126
|
}
|
|
2144
|
-
|
|
2145
|
-
if (endingMiterRender) {
|
|
2146
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
2147
|
-
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2148
|
-
featureCopy.rings = updatedRings;
|
|
2149
|
-
renders.push(render);
|
|
2150
|
-
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
2154
|
-
return renders;
|
|
2155
2127
|
}
|
|
2156
2128
|
}, {
|
|
2157
|
-
key: "
|
|
2158
|
-
value: function
|
|
2159
|
-
|
|
2160
|
-
}
|
|
2161
|
-
}]);
|
|
2129
|
+
key: "getPoint",
|
|
2130
|
+
value: function getPoint(position, feature) {
|
|
2131
|
+
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2162
2132
|
|
|
2163
|
-
|
|
2164
|
-
|
|
2133
|
+
if (feature.isSelected) {
|
|
2134
|
+
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2135
|
+
pointRender.fillColor = this.selectedFillColor;
|
|
2136
|
+
}
|
|
2165
2137
|
|
|
2166
|
-
|
|
2167
|
-
|
|
2138
|
+
return pointRender;
|
|
2139
|
+
}
|
|
2140
|
+
}]);
|
|
2168
2141
|
|
|
2169
|
-
|
|
2142
|
+
return SelectedPointSymbol;
|
|
2143
|
+
}(ShadowedPointSymbol);
|
|
2170
2144
|
|
|
2171
|
-
|
|
2172
|
-
|
|
2145
|
+
let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
|
|
2146
|
+
_inherits(SelectedPolySymbol, _ShadowedPolySymbol);
|
|
2173
2147
|
|
|
2174
|
-
|
|
2175
|
-
component,
|
|
2176
|
-
offset
|
|
2177
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2148
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
|
|
2178
2149
|
|
|
2179
|
-
|
|
2150
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2151
|
+
function SelectedPolySymbol(props) {
|
|
2152
|
+
_classCallCheck(this, SelectedPolySymbol);
|
|
2180
2153
|
|
|
2181
|
-
|
|
2182
|
-
offset
|
|
2183
|
-
});
|
|
2184
|
-
_this.component = component;
|
|
2185
|
-
return _this;
|
|
2154
|
+
return _super.call(this, props);
|
|
2186
2155
|
}
|
|
2187
2156
|
|
|
2188
|
-
_createClass(
|
|
2189
|
-
key: "
|
|
2190
|
-
value: function
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
}
|
|
2195
|
-
}, {
|
|
2196
|
-
key: "_updateFeatureNode",
|
|
2197
|
-
value: function _updateFeatureNode(feature) {
|
|
2198
|
-
this.renderDom(feature.content, this.getNode(feature));
|
|
2157
|
+
_createClass(SelectedPolySymbol, [{
|
|
2158
|
+
key: "getShadow",
|
|
2159
|
+
value: function getShadow(coordinates, feature) {
|
|
2160
|
+
if (feature.isSelected) {
|
|
2161
|
+
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2162
|
+
}
|
|
2199
2163
|
}
|
|
2200
2164
|
}, {
|
|
2201
|
-
key: "
|
|
2202
|
-
value: function
|
|
2203
|
-
|
|
2204
|
-
return;
|
|
2205
|
-
}
|
|
2165
|
+
key: "getPolyRender",
|
|
2166
|
+
value: function getPolyRender(coordinates, feature) {
|
|
2167
|
+
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2206
2168
|
|
|
2207
|
-
|
|
2169
|
+
if (feature.isSelected) {
|
|
2170
|
+
polyRender.fillColor = this.selectedFillColor;
|
|
2171
|
+
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2208
2172
|
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
}), node);
|
|
2213
|
-
} else {
|
|
2214
|
-
node.innerText = content;
|
|
2173
|
+
if (this.selectedStrokeWidth !== void 0) {
|
|
2174
|
+
polyRender.strokeWidth = this.selectedStrokeWidth;
|
|
2175
|
+
}
|
|
2215
2176
|
}
|
|
2177
|
+
|
|
2178
|
+
return polyRender;
|
|
2216
2179
|
}
|
|
2217
2180
|
}]);
|
|
2218
2181
|
|
|
2219
|
-
return
|
|
2220
|
-
}(
|
|
2182
|
+
return SelectedPolySymbol;
|
|
2183
|
+
}(ShadowedPolySymbol);
|
|
2221
2184
|
|
|
2222
|
-
const
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2185
|
+
const selectedPoint = /*#__PURE__*/new SelectedPointSymbol({
|
|
2186
|
+
size: 8,
|
|
2187
|
+
strokeWidth: 2,
|
|
2188
|
+
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2189
|
+
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2190
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2191
|
+
shadowSize: 3,
|
|
2192
|
+
selectedStrokeColor: '#ff5722',
|
|
2193
|
+
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2194
|
+
});
|
|
2195
|
+
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2196
|
+
strokeWidth: 6,
|
|
2197
|
+
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2198
|
+
shadowSize: 8,
|
|
2199
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2200
|
+
selectedStrokeColor: '#ff5722',
|
|
2201
|
+
selectedStrokeWidth: 2
|
|
2202
|
+
});
|
|
2203
|
+
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2204
|
+
strokeWidth: 2,
|
|
2205
|
+
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2206
|
+
shadowSize: 8,
|
|
2207
|
+
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2208
|
+
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2209
|
+
enclose: true,
|
|
2210
|
+
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2211
|
+
selectedStrokeColor: '#ff5722'
|
|
2212
|
+
});
|
|
2247
2213
|
|
|
2248
|
-
|
|
2214
|
+
const metersToPixels = (meters, _ref) => {
|
|
2249
2215
|
let {
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
shadowSize,
|
|
2253
|
-
size = 6
|
|
2216
|
+
painter,
|
|
2217
|
+
crs = geo
|
|
2254
2218
|
} = _ref;
|
|
2255
|
-
const
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
let {
|
|
2265
|
-
strokeColor,
|
|
2266
|
-
strokeWidth,
|
|
2267
|
-
shadowColor,
|
|
2268
|
-
fillColor,
|
|
2269
|
-
shadowSize,
|
|
2270
|
-
size = 0
|
|
2271
|
-
} = _ref2;
|
|
2272
|
-
return [createShadowRender(position, {
|
|
2273
|
-
strokeWidth,
|
|
2274
|
-
strokeColor,
|
|
2275
|
-
shadowSize,
|
|
2276
|
-
shadowColor,
|
|
2277
|
-
size
|
|
2278
|
-
}), new PolyRender(polygonCircleFromPoint(position, size), {
|
|
2279
|
-
fillColor,
|
|
2280
|
-
strokeColor,
|
|
2281
|
-
strokeWidth,
|
|
2282
|
-
enclosed: true
|
|
2283
|
-
})];
|
|
2284
|
-
}
|
|
2219
|
+
const {
|
|
2220
|
+
width
|
|
2221
|
+
} = painter;
|
|
2222
|
+
const zeroPoint = painter.getPointFromPxPosition(0, 0).projectTo(crs);
|
|
2223
|
+
const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
|
|
2224
|
+
const widthDistance = distance(zeroPoint, maxWidthPoint);
|
|
2225
|
+
const pxK = width / (widthDistance || 1);
|
|
2226
|
+
return Math.round(meters * pxK);
|
|
2227
|
+
};
|
|
2285
2228
|
|
|
2286
|
-
|
|
2287
|
-
|
|
2229
|
+
const defaultPathStyles = {
|
|
2230
|
+
strokeWidth: 2,
|
|
2231
|
+
strokeColor: 'rgb(0, 163, 245)',
|
|
2232
|
+
fillStyle: FillStyle.None
|
|
2233
|
+
};
|
|
2234
|
+
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2235
|
+
_inherits(SVGPoly, _Symbol);
|
|
2288
2236
|
|
|
2289
|
-
var _super = /*#__PURE__*/_createSuper(
|
|
2237
|
+
var _super = /*#__PURE__*/_createSuper(SVGPoly);
|
|
2290
2238
|
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
_classCallCheck(this, ShadowedPointSymbol);
|
|
2239
|
+
function SVGPoly(_temp) {
|
|
2240
|
+
var _this;
|
|
2294
2241
|
|
|
2295
|
-
|
|
2242
|
+
let {
|
|
2243
|
+
redrawFeatureNode,
|
|
2244
|
+
pathStyles,
|
|
2245
|
+
circle,
|
|
2246
|
+
className,
|
|
2247
|
+
appendToSvg
|
|
2248
|
+
} = _temp === void 0 ? {} : _temp;
|
|
2249
|
+
|
|
2250
|
+
_classCallCheck(this, SVGPoly);
|
|
2251
|
+
|
|
2252
|
+
_this = _super.call(this);
|
|
2253
|
+
_this.container = document.createElement('div');
|
|
2254
|
+
_this.container.style.position = 'absolute';
|
|
2255
|
+
_this.redrawFeatureNode = redrawFeatureNode;
|
|
2256
|
+
_this.pathStyles = _extends({
|
|
2257
|
+
center: [0, 0],
|
|
2258
|
+
fillColor: 'none'
|
|
2259
|
+
}, pathStyles);
|
|
2260
|
+
_this.circle = circle;
|
|
2261
|
+
_this.className = className;
|
|
2262
|
+
_this.appendToSvg = appendToSvg;
|
|
2263
|
+
return _this;
|
|
2296
2264
|
}
|
|
2297
2265
|
|
|
2298
|
-
_createClass(
|
|
2266
|
+
_createClass(SVGPoly, [{
|
|
2299
2267
|
key: "renderFunction",
|
|
2300
2268
|
value: function renderFunction(feature, resolution, crs) {
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2269
|
+
const coordinates = feature instanceof Poly ? PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2270
|
+
this.setCirclePxRaius(crs);
|
|
2271
|
+
this.container.innerHTML = '';
|
|
2272
|
+
const svg = this.setSvg(coordinates);
|
|
2273
|
+
svg && this.container.append(svg);
|
|
2274
|
+
feature.__dynamicSymbolRender = new DynamicRender({
|
|
2275
|
+
node: this.container,
|
|
2276
|
+
update: (bbox, resolution) => this.update({
|
|
2277
|
+
bbox,
|
|
2278
|
+
resolution,
|
|
2279
|
+
feature,
|
|
2280
|
+
crs
|
|
2281
|
+
}),
|
|
2282
|
+
redraw: () => {
|
|
2283
|
+
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2284
|
+
}
|
|
2285
|
+
});
|
|
2286
|
+
|
|
2287
|
+
this._setEventListeners(feature);
|
|
2288
|
+
|
|
2289
|
+
return [feature.__dynamicSymbolRender];
|
|
2309
2290
|
}
|
|
2310
2291
|
}, {
|
|
2311
|
-
key: "
|
|
2312
|
-
value: function
|
|
2313
|
-
|
|
2292
|
+
key: "setCirclePxRaius",
|
|
2293
|
+
value: function setCirclePxRaius(crs) {
|
|
2294
|
+
if (this.circle && this.pathStyles) {
|
|
2295
|
+
var _this$circle;
|
|
2296
|
+
|
|
2297
|
+
this.pathStyles.radius = metersToPixels(this.circle.radius, {
|
|
2298
|
+
painter: this.circle.painter,
|
|
2299
|
+
crs
|
|
2300
|
+
}) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
|
|
2301
|
+
}
|
|
2314
2302
|
}
|
|
2315
2303
|
}, {
|
|
2316
|
-
key: "
|
|
2317
|
-
value: function
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
}], [{
|
|
2321
|
-
key: "getShadowArc",
|
|
2322
|
-
value: function getShadowArc(position, _ref) {
|
|
2304
|
+
key: "update",
|
|
2305
|
+
value: function update(_ref) {
|
|
2306
|
+
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2307
|
+
|
|
2323
2308
|
let {
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2309
|
+
bbox,
|
|
2310
|
+
resolution,
|
|
2311
|
+
feature,
|
|
2312
|
+
crs
|
|
2328
2313
|
} = _ref;
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2314
|
+
if (!feature) return;
|
|
2315
|
+
if (!bbox) bbox = feature.__lastBbox;
|
|
2316
|
+
if (!resolution) resolution = feature.__lastResolution;
|
|
2317
|
+
if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
|
|
2318
|
+
|
|
2319
|
+
if (feature.__lastResolution && resolution !== feature.__lastResolution) {
|
|
2320
|
+
const newCoordinates = feature instanceof Poly ? PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2321
|
+
this.setCirclePxRaius(crs);
|
|
2322
|
+
this.container.innerHTML = '';
|
|
2323
|
+
const svg = this.setSvg(newCoordinates);
|
|
2324
|
+
svg && this.container.append(svg);
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
const polygon = feature.projectTo(bbox.crs);
|
|
2328
|
+
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;
|
|
2329
|
+
const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
|
|
2330
|
+
const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
|
|
2331
|
+
this.container.style.left = dx.toString() + "px";
|
|
2332
|
+
this.container.style.top = dy.toString() + "px";
|
|
2333
|
+
feature.__lastBbox = bbox;
|
|
2334
|
+
feature.__lastResolution = resolution;
|
|
2335
2335
|
}
|
|
2336
2336
|
}, {
|
|
2337
|
-
key: "
|
|
2338
|
-
value: function
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
});
|
|
2351
|
-
}
|
|
2352
|
-
}, {
|
|
2353
|
-
key: "getArcs",
|
|
2354
|
-
value: function getArcs(position, params) {
|
|
2355
|
-
const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
|
|
2356
|
-
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2357
|
-
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2358
|
-
}
|
|
2359
|
-
}]);
|
|
2360
|
-
|
|
2361
|
-
return ShadowedPointSymbol;
|
|
2362
|
-
}(PointSymbol);
|
|
2363
|
-
|
|
2364
|
-
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2365
|
-
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2366
|
-
|
|
2367
|
-
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2368
|
-
|
|
2369
|
-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2370
|
-
function ShadowedPolySymbol(options) {
|
|
2371
|
-
_classCallCheck(this, ShadowedPolySymbol);
|
|
2372
|
-
|
|
2373
|
-
return _super.call(this, options);
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
|
-
_createClass(ShadowedPolySymbol, [{
|
|
2377
|
-
key: "renderFunction",
|
|
2378
|
-
value: function renderFunction(feature, resolution, crs) {
|
|
2379
|
-
if (!(feature instanceof Poly)) return [];
|
|
2380
|
-
const coordinates = PolylineSymbol.getRenderedCoordinates(feature, resolution, crs);
|
|
2381
|
-
const polyRender = this.getPolyRender(coordinates, feature);
|
|
2382
|
-
const shadowRender = this.getShadow(coordinates, feature);
|
|
2383
|
-
const vertexRenders = this.getVertexRenders(coordinates);
|
|
2384
|
-
let renders = [polyRender];
|
|
2337
|
+
key: "setSvg",
|
|
2338
|
+
value: function setSvg(coordinates) {
|
|
2339
|
+
const {
|
|
2340
|
+
lineCap,
|
|
2341
|
+
lineJoin,
|
|
2342
|
+
miterLimit,
|
|
2343
|
+
lineDash,
|
|
2344
|
+
dashOffset
|
|
2345
|
+
} = this.pathStyles || {};
|
|
2346
|
+
const svgRender = new SvgRender(_extends({
|
|
2347
|
+
coordinates
|
|
2348
|
+
}, defaultPathStyles, {
|
|
2349
|
+
appendToSvg: this.appendToSvg
|
|
2350
|
+
}, this.pathStyles));
|
|
2385
2351
|
|
|
2386
|
-
if (
|
|
2387
|
-
|
|
2352
|
+
if (this.circle) {
|
|
2353
|
+
svgRender._setArcNode();
|
|
2354
|
+
} else {
|
|
2355
|
+
svgRender._setPolyNode();
|
|
2388
2356
|
}
|
|
2389
2357
|
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2358
|
+
let svgElement;
|
|
2359
|
+
svgRender.getNode((_, svg) => {
|
|
2360
|
+
svgElement = svg;
|
|
2361
|
+
this.className && svgElement.classList.add(this.className);
|
|
2362
|
+
const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
|
|
2393
2363
|
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
lineDash: this.lineDash
|
|
2364
|
+
if (path) {
|
|
2365
|
+
path.setAttribute('stroke-linecap', lineCap || 'round');
|
|
2366
|
+
path.setAttribute('stroke-linejoin', lineJoin || 'round');
|
|
2367
|
+
path.setAttribute('stroke-miterlimit', (miterLimit || 10).toString());
|
|
2368
|
+
path.setAttribute('stroke-dashoffset', (dashOffset || 0).toString());
|
|
2369
|
+
|
|
2370
|
+
if (this.circle) {
|
|
2371
|
+
path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2405
2374
|
});
|
|
2375
|
+
return svgElement;
|
|
2406
2376
|
}
|
|
2407
2377
|
}, {
|
|
2408
|
-
key: "
|
|
2409
|
-
value: function
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2378
|
+
key: "_setEventListeners",
|
|
2379
|
+
value: function _setEventListeners(dynamicFeature) {
|
|
2380
|
+
var _dynamicFeature$__dyn;
|
|
2381
|
+
|
|
2382
|
+
if (dynamicFeature.eventFlags === MouseEventFlags.None) return;
|
|
2383
|
+
const svgNode = dynamicFeature == null ? void 0 : (_dynamicFeature$__dyn = dynamicFeature.__dynamicSymbolRender) == null ? void 0 : _dynamicFeature$__dyn.node.querySelector(this.circle ? 'circle' : 'path');
|
|
2384
|
+
Object.keys(mouseEvents).forEach(eventName => {
|
|
2385
|
+
if (dynamicFeature.eventFlags & mouseEvents[eventName].flag) {
|
|
2386
|
+
listenDomEvent(svgNode, mouseEvents[eventName].type, event => {
|
|
2387
|
+
dynamicFeature.fire(mouseEvents[eventName].type, {
|
|
2388
|
+
node: svgNode,
|
|
2389
|
+
browserEvent: event
|
|
2390
|
+
});
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2417
2393
|
});
|
|
2418
2394
|
}
|
|
2419
|
-
}, {
|
|
2420
|
-
key: "getVertexRenders",
|
|
2421
|
-
value: function getVertexRenders(coordinates) {
|
|
2422
|
-
if (!this.showVertex) return;
|
|
2423
|
-
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2424
|
-
return acc.concat(curr);
|
|
2425
|
-
}, []);
|
|
2426
|
-
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2427
|
-
size: 6,
|
|
2428
|
-
strokeWidth: 2,
|
|
2429
|
-
shadowColor: this.shadowColor,
|
|
2430
|
-
strokeColor: this.strokeColor,
|
|
2431
|
-
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2432
|
-
fillColor: '#ffffff'
|
|
2433
|
-
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2434
|
-
}
|
|
2435
2395
|
}]);
|
|
2436
2396
|
|
|
2437
|
-
return
|
|
2438
|
-
}(
|
|
2439
|
-
const polySymbolParams = {
|
|
2440
|
-
strokeWidth: 2,
|
|
2441
|
-
strokeColor: '#e33600',
|
|
2442
|
-
shadowSize: 8,
|
|
2443
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)'
|
|
2444
|
-
};
|
|
2445
|
-
const measureSymbolParams = {
|
|
2446
|
-
strokeColor: '#ff6933',
|
|
2447
|
-
shadowSize: 0,
|
|
2448
|
-
vertexShadowSize: 0
|
|
2449
|
-
};
|
|
2450
|
-
const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2451
|
-
enclose: false,
|
|
2452
|
-
showVertex: true
|
|
2453
|
-
}));
|
|
2454
|
-
const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2455
|
-
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2456
|
-
enclose: true,
|
|
2457
|
-
showVertex: true
|
|
2458
|
-
}));
|
|
2459
|
-
const snapSymbolParams = {
|
|
2460
|
-
size: 10,
|
|
2461
|
-
strokeWidth: 2,
|
|
2462
|
-
strokeColor: '#e33600',
|
|
2463
|
-
fillColor: '#ffffff',
|
|
2464
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2465
|
-
shadowSize: 3
|
|
2466
|
-
};
|
|
2467
|
-
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2468
|
-
strokeColor: '#ff6933',
|
|
2469
|
-
shadowSize: 0
|
|
2470
|
-
}));
|
|
2397
|
+
return SVGPoly;
|
|
2398
|
+
}(Symbol$1);
|
|
2471
2399
|
|
|
2472
|
-
|
|
2473
|
-
|
|
2400
|
+
function isSGisPointSymbol(symbol) {
|
|
2401
|
+
return symbol instanceof PointSymbol || symbol instanceof StaticImageSymbol || symbol instanceof SquareSymbol || symbol instanceof MaskedImage;
|
|
2402
|
+
}
|
|
2403
|
+
function isSGisImageSymbol(symbol) {
|
|
2404
|
+
return symbol instanceof StaticImageSymbol || symbol instanceof MaskedImage;
|
|
2405
|
+
}
|
|
2406
|
+
function isSGisPolygonSymbol(symbol) {
|
|
2407
|
+
return symbol instanceof PolygonSymbol || symbol instanceof BrushFill || symbol instanceof ImageFill;
|
|
2408
|
+
}
|
|
2409
|
+
function isSGisPolylineSymbol(symbol) {
|
|
2410
|
+
return symbol instanceof PolylineSymbol;
|
|
2411
|
+
}
|
|
2474
2412
|
|
|
2475
|
-
|
|
2413
|
+
/**
|
|
2414
|
+
* Моки фич для отображения превью символа
|
|
2415
|
+
* http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
|
|
2416
|
+
*/
|
|
2476
2417
|
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2418
|
+
const viewBoxSize = 100;
|
|
2419
|
+
const pointFeature = /*#__PURE__*/new PointFeature([50, -50], {
|
|
2420
|
+
crs: plain
|
|
2421
|
+
});
|
|
2422
|
+
const lineFeature = /*#__PURE__*/new Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2423
|
+
crs: plain
|
|
2424
|
+
});
|
|
2425
|
+
const polygonFeature = /*#__PURE__*/new Polygon([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2426
|
+
crs: plain
|
|
2427
|
+
});
|
|
2428
|
+
const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
|
|
2429
|
+
crs: plain
|
|
2430
|
+
});
|
|
2431
|
+
const polygonLegendFeature = /*#__PURE__*/new Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
|
|
2432
|
+
crs: plain
|
|
2433
|
+
});
|
|
2434
|
+
const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2435
|
+
crs: plain
|
|
2436
|
+
});
|
|
2437
|
+
const MAP_LEGEND_FEATURES = {
|
|
2438
|
+
polygon: polygonMapLegendFeature
|
|
2439
|
+
};
|
|
2440
|
+
const LEGEND_FEATURES = {
|
|
2441
|
+
polyline: lineLegendFeature,
|
|
2442
|
+
polygon: polygonLegendFeature
|
|
2443
|
+
};
|
|
2444
|
+
const MOCK_FEATURES = {
|
|
2445
|
+
point: pointFeature,
|
|
2446
|
+
polyline: lineFeature,
|
|
2447
|
+
polygon: polygonFeature
|
|
2448
|
+
};
|
|
2480
2449
|
|
|
2481
|
-
|
|
2450
|
+
function getSymbolRenders(symbol, size, features) {
|
|
2451
|
+
if (size === void 0) {
|
|
2452
|
+
size = viewBoxSize;
|
|
2482
2453
|
}
|
|
2483
2454
|
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
if (feature.isSelected) {
|
|
2488
|
-
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2489
|
-
}
|
|
2490
|
-
}
|
|
2491
|
-
}, {
|
|
2492
|
-
key: "getPoint",
|
|
2493
|
-
value: function getPoint(position, feature) {
|
|
2494
|
-
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2495
|
-
|
|
2496
|
-
if (feature.isSelected) {
|
|
2497
|
-
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2498
|
-
pointRender.fillColor = this.selectedFillColor;
|
|
2499
|
-
}
|
|
2455
|
+
if (features === void 0) {
|
|
2456
|
+
features = {};
|
|
2457
|
+
}
|
|
2500
2458
|
|
|
2501
|
-
|
|
2502
|
-
}
|
|
2503
|
-
}]);
|
|
2459
|
+
const resolution = viewBoxSize / size;
|
|
2504
2460
|
|
|
2505
|
-
|
|
2506
|
-
}(ShadowedPointSymbol);
|
|
2461
|
+
const featuresToRender = _extends({}, MOCK_FEATURES, features);
|
|
2507
2462
|
|
|
2508
|
-
|
|
2509
|
-
|
|
2463
|
+
if (isSGisPolygonSymbol(symbol)) {
|
|
2464
|
+
return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, plain);
|
|
2465
|
+
}
|
|
2510
2466
|
|
|
2511
|
-
|
|
2467
|
+
if (isSGisPolylineSymbol(symbol)) {
|
|
2468
|
+
return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, plain);
|
|
2469
|
+
}
|
|
2512
2470
|
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2471
|
+
return symbol.renderFunctionAsync(featuresToRender.point, resolution, plain);
|
|
2472
|
+
}
|
|
2473
|
+
const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
|
|
2474
|
+
if (size === void 0) {
|
|
2475
|
+
size = viewBoxSize;
|
|
2476
|
+
}
|
|
2516
2477
|
|
|
2517
|
-
|
|
2478
|
+
return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
|
|
2479
|
+
};
|
|
2480
|
+
const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
|
|
2481
|
+
if (size === void 0) {
|
|
2482
|
+
size = viewBoxSize;
|
|
2518
2483
|
}
|
|
2519
2484
|
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
value: function getShadow(coordinates, feature) {
|
|
2523
|
-
if (feature.isSelected) {
|
|
2524
|
-
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
}, {
|
|
2528
|
-
key: "getPolyRender",
|
|
2529
|
-
value: function getPolyRender(coordinates, feature) {
|
|
2530
|
-
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2485
|
+
return getSymbolRenders(symbol, size, LEGEND_FEATURES);
|
|
2486
|
+
};
|
|
2531
2487
|
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2488
|
+
function renderSymbolToCanvas(renders, canvas) {
|
|
2489
|
+
renders.forEach(render => {
|
|
2490
|
+
canvas.draw(render);
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2535
2493
|
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2494
|
+
function deserializeSymbol(symbol) {
|
|
2495
|
+
switch (symbol.type) {
|
|
2496
|
+
case 'circlePointSymbol':
|
|
2497
|
+
return deserializePointSymbol(symbol);
|
|
2540
2498
|
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
}]);
|
|
2499
|
+
case 'squarePointSymbol':
|
|
2500
|
+
return deserializeSquareSymbol(symbol);
|
|
2544
2501
|
|
|
2545
|
-
|
|
2546
|
-
|
|
2502
|
+
case 'maskedImagePointSymbol':
|
|
2503
|
+
return deserializeMaskedImageSymbol(symbol);
|
|
2547
2504
|
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
strokeWidth: 2,
|
|
2551
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2552
|
-
fillColor: 'rgba(255, 255, 255, 0.65)',
|
|
2553
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2554
|
-
shadowSize: 3,
|
|
2555
|
-
selectedStrokeColor: '#ff5722',
|
|
2556
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2557
|
-
});
|
|
2558
|
-
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2559
|
-
strokeWidth: 6,
|
|
2560
|
-
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2561
|
-
shadowSize: 8,
|
|
2562
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2563
|
-
selectedStrokeColor: '#ff5722',
|
|
2564
|
-
selectedStrokeWidth: 2
|
|
2565
|
-
});
|
|
2566
|
-
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2567
|
-
strokeWidth: 2,
|
|
2568
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2569
|
-
shadowSize: 8,
|
|
2570
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2571
|
-
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2572
|
-
enclose: true,
|
|
2573
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2574
|
-
selectedStrokeColor: '#ff5722'
|
|
2575
|
-
});
|
|
2505
|
+
case 'imagePointSymbol':
|
|
2506
|
+
return deserializeImagePointSymbol(symbol);
|
|
2576
2507
|
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
strokeColor: 'rgb(0, 163, 245)',
|
|
2580
|
-
fillStyle: FillStyle.None
|
|
2581
|
-
};
|
|
2582
|
-
let SVGPoly = /*#__PURE__*/function (_Symbol) {
|
|
2583
|
-
_inherits(SVGPoly, _Symbol);
|
|
2508
|
+
case 'polygonSymbol':
|
|
2509
|
+
return deserializePolygonSymbol(symbol);
|
|
2584
2510
|
|
|
2585
|
-
|
|
2511
|
+
case 'simplePolylineSymbol':
|
|
2512
|
+
case 'polylineSymbol':
|
|
2513
|
+
return deserializePolylineSymbol(symbol);
|
|
2586
2514
|
|
|
2587
|
-
|
|
2588
|
-
|
|
2515
|
+
default:
|
|
2516
|
+
return null;
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2589
2519
|
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
className,
|
|
2595
|
-
appendToSvg
|
|
2596
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2520
|
+
function deserializePointSymbol(symbol) {
|
|
2521
|
+
// @ts-ignore
|
|
2522
|
+
return new PointSymbol(deserializePointSymbolParams(symbol));
|
|
2523
|
+
}
|
|
2597
2524
|
|
|
2598
|
-
|
|
2525
|
+
function deserializeSquareSymbol(symbol) {
|
|
2526
|
+
return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
|
|
2527
|
+
// @ts-ignore
|
|
2528
|
+
angle: getParameterValue(symbol.angle)
|
|
2529
|
+
}));
|
|
2530
|
+
}
|
|
2599
2531
|
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2532
|
+
function deserializeMaskedImageSymbol(symbol) {
|
|
2533
|
+
return new MaskedImage(_extends({}, symbol, {
|
|
2534
|
+
// @ts-ignore
|
|
2535
|
+
angle: getParameterValue(symbol.angle),
|
|
2536
|
+
// @ts-ignore
|
|
2537
|
+
width: getParameterValue(symbol.width),
|
|
2538
|
+
// @ts-ignore
|
|
2539
|
+
height: getParameterValue(symbol.height),
|
|
2540
|
+
// @ts-ignore
|
|
2541
|
+
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2542
|
+
// @ts-ignore
|
|
2543
|
+
imageSource: deserializeBase64(symbol.image),
|
|
2544
|
+
// @ts-ignore
|
|
2545
|
+
maskSource: deserializeBase64(symbol.imageMask),
|
|
2546
|
+
// @ts-ignore
|
|
2547
|
+
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2548
|
+
}));
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
function deserializeImagePointSymbol(symbol) {
|
|
2552
|
+
return new StaticImageSymbol(_extends({}, symbol, {
|
|
2553
|
+
// @ts-ignore
|
|
2554
|
+
angle: getParameterValue(symbol.angle),
|
|
2555
|
+
// @ts-ignore
|
|
2556
|
+
width: getParameterValue(symbol.width),
|
|
2557
|
+
// @ts-ignore
|
|
2558
|
+
height: getParameterValue(symbol.height),
|
|
2559
|
+
// @ts-ignore
|
|
2560
|
+
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2561
|
+
// @ts-ignore
|
|
2562
|
+
source: deserializeBase64(symbol.image)
|
|
2563
|
+
}));
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
function deserializePolygonSymbol(symbol) {
|
|
2567
|
+
if (isPolygonHasPatternBrush(symbol)) {
|
|
2568
|
+
return new SGisImageFill(symbol);
|
|
2612
2569
|
}
|
|
2613
2570
|
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
const coordinates = feature instanceof Poly ? PolylineSymbol.getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
|
|
2618
|
-
this.setCirclePxRaius(crs);
|
|
2619
|
-
this.container.innerHTML = '';
|
|
2620
|
-
const svg = this.setSvg(coordinates);
|
|
2621
|
-
svg && this.container.append(svg);
|
|
2622
|
-
feature.__dynamicSymbolRender = new DynamicRender({
|
|
2623
|
-
node: this.container,
|
|
2624
|
-
update: (bbox, resolution) => this.update({
|
|
2625
|
-
bbox,
|
|
2626
|
-
resolution,
|
|
2627
|
-
feature,
|
|
2628
|
-
crs
|
|
2629
|
-
}),
|
|
2630
|
-
redraw: () => {
|
|
2631
|
-
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2632
|
-
}
|
|
2633
|
-
});
|
|
2571
|
+
if (isPolygonHasHatchBrush(symbol)) {
|
|
2572
|
+
return new SGisBrushFill(symbol);
|
|
2573
|
+
}
|
|
2634
2574
|
|
|
2635
|
-
|
|
2575
|
+
return new SGisPolygonSymbol(symbol);
|
|
2576
|
+
}
|
|
2636
2577
|
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
key: "setCirclePxRaius",
|
|
2641
|
-
value: function setCirclePxRaius(crs) {
|
|
2642
|
-
if (this.circle && this.pathStyles) {
|
|
2643
|
-
var _this$circle;
|
|
2578
|
+
function deserializePolylineSymbol(symbol) {
|
|
2579
|
+
return new SGisPolylineSymbol(symbol);
|
|
2580
|
+
}
|
|
2644
2581
|
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2582
|
+
function deserializePointSymbolParams(_ref) {
|
|
2583
|
+
let {
|
|
2584
|
+
size,
|
|
2585
|
+
offset,
|
|
2586
|
+
strokeColor,
|
|
2587
|
+
strokeWidth,
|
|
2588
|
+
fillColor
|
|
2589
|
+
} = _ref;
|
|
2590
|
+
return {
|
|
2591
|
+
size: getParameterValue(size),
|
|
2592
|
+
offset: deserializeAnchor(offset),
|
|
2593
|
+
strokeWidth: getParameterValue(strokeWidth),
|
|
2594
|
+
strokeColor: deserializeColor(getParameterValue(strokeColor)),
|
|
2595
|
+
fillColor: deserializeColor(getParameterValue(fillColor))
|
|
2596
|
+
};
|
|
2597
|
+
}
|
|
2655
2598
|
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
feature,
|
|
2660
|
-
crs
|
|
2661
|
-
} = _ref;
|
|
2662
|
-
if (!feature) return;
|
|
2663
|
-
if (!bbox) bbox = feature.__lastBbox;
|
|
2664
|
-
if (!resolution) resolution = feature.__lastResolution;
|
|
2665
|
-
if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
|
|
2599
|
+
function deserializeBase64(base) {
|
|
2600
|
+
return "data:image/png;base64," + base;
|
|
2601
|
+
}
|
|
2666
2602
|
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
const svg = this.setSvg(newCoordinates);
|
|
2672
|
-
svg && this.container.append(svg);
|
|
2673
|
-
}
|
|
2603
|
+
function deserializeAnchor(offset) {
|
|
2604
|
+
// @ts-ignore
|
|
2605
|
+
return offset.map(getParameterValue);
|
|
2606
|
+
}
|
|
2674
2607
|
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
|
|
2679
|
-
this.container.style.left = dx.toString() + "px";
|
|
2680
|
-
this.container.style.top = dy.toString() + "px";
|
|
2681
|
-
feature.__lastBbox = bbox;
|
|
2682
|
-
feature.__lastResolution = resolution;
|
|
2683
|
-
}
|
|
2684
|
-
}, {
|
|
2685
|
-
key: "setSvg",
|
|
2686
|
-
value: function setSvg(coordinates) {
|
|
2687
|
-
const {
|
|
2688
|
-
lineCap,
|
|
2689
|
-
lineJoin,
|
|
2690
|
-
miterLimit,
|
|
2691
|
-
lineDash,
|
|
2692
|
-
dashOffset
|
|
2693
|
-
} = this.pathStyles || {};
|
|
2694
|
-
const svgRender = new SvgRender(_extends({
|
|
2695
|
-
coordinates
|
|
2696
|
-
}, defaultPathStyles, {
|
|
2697
|
-
appendToSvg: this.appendToSvg
|
|
2698
|
-
}, this.pathStyles));
|
|
2608
|
+
function deserializeColor(color) {
|
|
2609
|
+
return color ? new Color(color).toString() : null;
|
|
2610
|
+
}
|
|
2699
2611
|
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2612
|
+
const clampSymbol = (symbol, min, max) => {
|
|
2613
|
+
if (isSGisImageSymbol(symbol)) {
|
|
2614
|
+
symbol.width = clamp(symbol.width, min, max);
|
|
2615
|
+
symbol.height = clamp(symbol.height, min, max);
|
|
2616
|
+
} else if (isSGisPointSymbol(symbol)) {
|
|
2617
|
+
symbol.size = clamp(symbol.size, min, max);
|
|
2618
|
+
}
|
|
2705
2619
|
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2620
|
+
return symbol;
|
|
2621
|
+
};
|
|
2622
|
+
function centerAlignSymbol(symbol) {
|
|
2623
|
+
if (isSGisImageSymbol(symbol)) {
|
|
2624
|
+
symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
|
|
2625
|
+
} else if (isSGisPointSymbol(symbol)) {
|
|
2626
|
+
symbol.offset = [0, 0];
|
|
2627
|
+
}
|
|
2711
2628
|
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2629
|
+
return symbol;
|
|
2630
|
+
}
|
|
2631
|
+
const adjustSymbol = (symbol, _ref) => {
|
|
2632
|
+
let {
|
|
2633
|
+
size
|
|
2634
|
+
} = _ref;
|
|
2635
|
+
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
2636
|
+
};
|
|
2717
2637
|
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
}
|
|
2722
|
-
});
|
|
2723
|
-
return svgElement;
|
|
2724
|
-
}
|
|
2725
|
-
}, {
|
|
2726
|
-
key: "_setEventListeners",
|
|
2727
|
-
value: function _setEventListeners(dynamicFeature) {
|
|
2728
|
-
var _dynamicFeature$__dyn;
|
|
2638
|
+
let EvergisFeature = /*#__PURE__*/function () {
|
|
2639
|
+
function EvergisFeature(feature) {
|
|
2640
|
+
_classCallCheck(this, EvergisFeature);
|
|
2729
2641
|
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
}
|
|
2642
|
+
this.id = null;
|
|
2643
|
+
this.displayName = null;
|
|
2644
|
+
this.geometry = null;
|
|
2645
|
+
this.layerName = null;
|
|
2646
|
+
this.layerAlias = null;
|
|
2647
|
+
this.attributes = null;
|
|
2648
|
+
this.symbol = null;
|
|
2649
|
+
this.id = feature.id;
|
|
2650
|
+
this.displayName = feature.id;
|
|
2651
|
+
this.geometry = feature.geometry;
|
|
2652
|
+
this.layerName = feature.layer;
|
|
2653
|
+
this.layerAlias = feature.layer;
|
|
2654
|
+
this.attributes = getFeatureAttributes(feature.attributes);
|
|
2655
|
+
}
|
|
2744
2656
|
|
|
2745
|
-
|
|
2746
|
-
|
|
2657
|
+
_createClass(EvergisFeature, [{
|
|
2658
|
+
key: "sGisFeature",
|
|
2659
|
+
value: function sGisFeature() {
|
|
2660
|
+
if (!this.geometry || !this.symbol) {
|
|
2661
|
+
return null;
|
|
2662
|
+
} // @ts-ignore
|
|
2747
2663
|
|
|
2748
|
-
function isSGisPointSymbol(symbol) {
|
|
2749
|
-
return symbol instanceof PointSymbol || symbol instanceof StaticImageSymbol || symbol instanceof SquareSymbol || symbol instanceof MaskedImage;
|
|
2750
|
-
}
|
|
2751
|
-
function isSGisImageSymbol(symbol) {
|
|
2752
|
-
return symbol instanceof StaticImageSymbol || symbol instanceof MaskedImage;
|
|
2753
|
-
}
|
|
2754
|
-
function isSGisPolygonSymbol(symbol) {
|
|
2755
|
-
return symbol instanceof PolygonSymbol || symbol instanceof BrushFill || symbol instanceof ImageFill;
|
|
2756
|
-
}
|
|
2757
|
-
function isSGisPolylineSymbol(symbol) {
|
|
2758
|
-
return symbol instanceof PolylineSymbol;
|
|
2759
|
-
}
|
|
2760
2664
|
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2665
|
+
const {
|
|
2666
|
+
type,
|
|
2667
|
+
coordinates,
|
|
2668
|
+
sr
|
|
2669
|
+
} = this.geometry;
|
|
2670
|
+
const crs = CRS_MAP[sr];
|
|
2765
2671
|
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
});
|
|
2770
|
-
const lineFeature = /*#__PURE__*/new Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
|
|
2771
|
-
crs: plain
|
|
2772
|
-
});
|
|
2773
|
-
const polygonFeature = /*#__PURE__*/new Polygon([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2774
|
-
crs: plain
|
|
2775
|
-
});
|
|
2776
|
-
const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
|
|
2777
|
-
crs: plain
|
|
2778
|
-
});
|
|
2779
|
-
const polygonLegendFeature = /*#__PURE__*/new Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
|
|
2780
|
-
crs: plain
|
|
2781
|
-
});
|
|
2782
|
-
const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2783
|
-
crs: plain
|
|
2784
|
-
});
|
|
2785
|
-
const MAP_LEGEND_FEATURES = {
|
|
2786
|
-
polygon: polygonMapLegendFeature
|
|
2787
|
-
};
|
|
2788
|
-
const LEGEND_FEATURES = {
|
|
2789
|
-
polyline: lineLegendFeature,
|
|
2790
|
-
polygon: polygonLegendFeature
|
|
2791
|
-
};
|
|
2792
|
-
const MOCK_FEATURES = {
|
|
2793
|
-
point: pointFeature,
|
|
2794
|
-
polyline: lineFeature,
|
|
2795
|
-
polygon: polygonFeature
|
|
2796
|
-
};
|
|
2672
|
+
if (!crs) {
|
|
2673
|
+
return null;
|
|
2674
|
+
}
|
|
2797
2675
|
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2676
|
+
switch (type) {
|
|
2677
|
+
case GeometryType.Point:
|
|
2678
|
+
return new PointFeature(coordinates, {
|
|
2679
|
+
symbol: selectedPoint,
|
|
2680
|
+
crs
|
|
2681
|
+
});
|
|
2802
2682
|
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2683
|
+
case GeometryType.Multipoint:
|
|
2684
|
+
return new MultiPoint(coordinates, {
|
|
2685
|
+
symbol: selectedPoint,
|
|
2686
|
+
crs
|
|
2687
|
+
});
|
|
2806
2688
|
|
|
2807
|
-
|
|
2689
|
+
case GeometryType.Polyline:
|
|
2690
|
+
return new Polyline(coordinates, {
|
|
2691
|
+
symbol: selectedPolyline,
|
|
2692
|
+
crs
|
|
2693
|
+
});
|
|
2808
2694
|
|
|
2809
|
-
|
|
2695
|
+
case GeometryType.Polygon:
|
|
2696
|
+
return new Polygon(coordinates, {
|
|
2697
|
+
symbol: selectedPolygon,
|
|
2698
|
+
crs
|
|
2699
|
+
});
|
|
2810
2700
|
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2701
|
+
default:
|
|
2702
|
+
return null;
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
}, {
|
|
2706
|
+
key: "extent",
|
|
2707
|
+
value: function extent() {
|
|
2708
|
+
const feature = this.sGisFeature();
|
|
2709
|
+
return feature && feature.bbox;
|
|
2710
|
+
}
|
|
2711
|
+
}]);
|
|
2814
2712
|
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
}
|
|
2713
|
+
return EvergisFeature;
|
|
2714
|
+
}();
|
|
2818
2715
|
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
const
|
|
2822
|
-
|
|
2823
|
-
size = viewBoxSize;
|
|
2824
|
-
}
|
|
2716
|
+
function evaluateCondition(condition, attributes) {
|
|
2717
|
+
try {
|
|
2718
|
+
const evaluator = new ConditionEvaluator(attributes);
|
|
2719
|
+
const result = evaluator.evaluate(condition);
|
|
2825
2720
|
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
if (size === void 0) {
|
|
2830
|
-
size = viewBoxSize;
|
|
2831
|
-
}
|
|
2721
|
+
if (result instanceof Error) {
|
|
2722
|
+
return null;
|
|
2723
|
+
}
|
|
2832
2724
|
|
|
2833
|
-
|
|
2834
|
-
}
|
|
2725
|
+
return result;
|
|
2726
|
+
} catch (_unused) {
|
|
2727
|
+
return null;
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2835
2730
|
|
|
2836
|
-
function
|
|
2837
|
-
|
|
2838
|
-
|
|
2731
|
+
function getAttributeValue(attributes, attributeName) {
|
|
2732
|
+
const attributeMeta = attributes.find((_ref) => {
|
|
2733
|
+
let {
|
|
2734
|
+
name
|
|
2735
|
+
} = _ref;
|
|
2736
|
+
return name === attributeName;
|
|
2839
2737
|
});
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
function deserializeSymbol(symbol) {
|
|
2843
|
-
switch (symbol.type) {
|
|
2844
|
-
case 'circlePointSymbol':
|
|
2845
|
-
return deserializePointSymbol(symbol);
|
|
2846
|
-
|
|
2847
|
-
case 'squarePointSymbol':
|
|
2848
|
-
return deserializeSquareSymbol(symbol);
|
|
2849
|
-
|
|
2850
|
-
case 'maskedImagePointSymbol':
|
|
2851
|
-
return deserializeMaskedImageSymbol(symbol);
|
|
2852
|
-
|
|
2853
|
-
case 'imagePointSymbol':
|
|
2854
|
-
return deserializeImagePointSymbol(symbol);
|
|
2855
|
-
|
|
2856
|
-
case 'polygonSymbol':
|
|
2857
|
-
return deserializePolygonSymbol(symbol);
|
|
2858
|
-
|
|
2859
|
-
case 'simplePolylineSymbol':
|
|
2860
|
-
case 'polylineSymbol':
|
|
2861
|
-
return deserializePolylineSymbol(symbol);
|
|
2862
|
-
|
|
2863
|
-
default:
|
|
2864
|
-
return null;
|
|
2865
|
-
}
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
|
-
function deserializePointSymbol(symbol) {
|
|
2869
|
-
// @ts-ignore
|
|
2870
|
-
return new PointSymbol(deserializePointSymbolParams(symbol));
|
|
2871
|
-
}
|
|
2872
|
-
|
|
2873
|
-
function deserializeSquareSymbol(symbol) {
|
|
2874
|
-
return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
|
|
2875
|
-
// @ts-ignore
|
|
2876
|
-
angle: getParameterValue(symbol.angle)
|
|
2877
|
-
}));
|
|
2878
|
-
}
|
|
2879
|
-
|
|
2880
|
-
function deserializeMaskedImageSymbol(symbol) {
|
|
2881
|
-
return new MaskedImage(_extends({}, symbol, {
|
|
2882
|
-
// @ts-ignore
|
|
2883
|
-
angle: getParameterValue(symbol.angle),
|
|
2884
|
-
// @ts-ignore
|
|
2885
|
-
width: getParameterValue(symbol.width),
|
|
2886
|
-
// @ts-ignore
|
|
2887
|
-
height: getParameterValue(symbol.height),
|
|
2888
|
-
// @ts-ignore
|
|
2889
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2890
|
-
// @ts-ignore
|
|
2891
|
-
imageSource: deserializeBase64(symbol.image),
|
|
2892
|
-
// @ts-ignore
|
|
2893
|
-
maskSource: deserializeBase64(symbol.imageMask),
|
|
2894
|
-
// @ts-ignore
|
|
2895
|
-
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2896
|
-
}));
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
|
-
function deserializeImagePointSymbol(symbol) {
|
|
2900
|
-
return new StaticImageSymbol(_extends({}, symbol, {
|
|
2901
|
-
// @ts-ignore
|
|
2902
|
-
angle: getParameterValue(symbol.angle),
|
|
2903
|
-
// @ts-ignore
|
|
2904
|
-
width: getParameterValue(symbol.width),
|
|
2905
|
-
// @ts-ignore
|
|
2906
|
-
height: getParameterValue(symbol.height),
|
|
2907
|
-
// @ts-ignore
|
|
2908
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2909
|
-
// @ts-ignore
|
|
2910
|
-
source: deserializeBase64(symbol.image)
|
|
2911
|
-
}));
|
|
2912
|
-
}
|
|
2913
|
-
|
|
2914
|
-
function deserializePolygonSymbol(symbol) {
|
|
2915
|
-
if (isPolygonHasPatternBrush(symbol)) {
|
|
2916
|
-
return new SGisImageFill(symbol);
|
|
2917
|
-
}
|
|
2918
|
-
|
|
2919
|
-
if (isPolygonHasHatchBrush(symbol)) {
|
|
2920
|
-
return new SGisBrushFill(symbol);
|
|
2921
|
-
}
|
|
2922
|
-
|
|
2923
|
-
return new SGisPolygonSymbol(symbol);
|
|
2924
|
-
}
|
|
2925
|
-
|
|
2926
|
-
function deserializePolylineSymbol(symbol) {
|
|
2927
|
-
return new SGisPolylineSymbol(symbol);
|
|
2928
|
-
}
|
|
2929
|
-
|
|
2930
|
-
function deserializePointSymbolParams(_ref) {
|
|
2931
|
-
let {
|
|
2932
|
-
size,
|
|
2933
|
-
offset,
|
|
2934
|
-
strokeColor,
|
|
2935
|
-
strokeWidth,
|
|
2936
|
-
fillColor
|
|
2937
|
-
} = _ref;
|
|
2938
|
-
return {
|
|
2939
|
-
size: getParameterValue(size),
|
|
2940
|
-
offset: deserializeAnchor(offset),
|
|
2941
|
-
strokeWidth: getParameterValue(strokeWidth),
|
|
2942
|
-
strokeColor: deserializeColor(getParameterValue(strokeColor)),
|
|
2943
|
-
fillColor: deserializeColor(getParameterValue(fillColor))
|
|
2944
|
-
};
|
|
2945
|
-
}
|
|
2946
|
-
|
|
2947
|
-
function deserializeBase64(base) {
|
|
2948
|
-
return "data:image/png;base64," + base;
|
|
2949
|
-
}
|
|
2950
|
-
|
|
2951
|
-
function deserializeAnchor(offset) {
|
|
2952
|
-
// @ts-ignore
|
|
2953
|
-
return offset.map(getParameterValue);
|
|
2954
|
-
}
|
|
2955
|
-
|
|
2956
|
-
function deserializeColor(color) {
|
|
2957
|
-
return color ? new Color(color).toString() : null;
|
|
2958
|
-
}
|
|
2959
|
-
|
|
2960
|
-
const clampSymbol = (symbol, min, max) => {
|
|
2961
|
-
if (isSGisImageSymbol(symbol)) {
|
|
2962
|
-
symbol.width = clamp(symbol.width, min, max);
|
|
2963
|
-
symbol.height = clamp(symbol.height, min, max);
|
|
2964
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
2965
|
-
symbol.size = clamp(symbol.size, min, max);
|
|
2966
|
-
}
|
|
2967
|
-
|
|
2968
|
-
return symbol;
|
|
2969
|
-
};
|
|
2970
|
-
function centerAlignSymbol(symbol) {
|
|
2971
|
-
if (isSGisImageSymbol(symbol)) {
|
|
2972
|
-
symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
|
|
2973
|
-
} else if (isSGisPointSymbol(symbol)) {
|
|
2974
|
-
symbol.offset = [0, 0];
|
|
2975
|
-
}
|
|
2976
|
-
|
|
2977
|
-
return symbol;
|
|
2978
|
-
}
|
|
2979
|
-
const adjustSymbol = (symbol, _ref) => {
|
|
2980
|
-
let {
|
|
2981
|
-
size
|
|
2982
|
-
} = _ref;
|
|
2983
|
-
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
2984
|
-
};
|
|
2985
|
-
|
|
2986
|
-
let EvergisFeature = /*#__PURE__*/function () {
|
|
2987
|
-
function EvergisFeature(feature) {
|
|
2988
|
-
_classCallCheck(this, EvergisFeature);
|
|
2989
|
-
|
|
2990
|
-
this.id = null;
|
|
2991
|
-
this.displayName = null;
|
|
2992
|
-
this.geometry = null;
|
|
2993
|
-
this.layerName = null;
|
|
2994
|
-
this.layerAlias = null;
|
|
2995
|
-
this.attributes = null;
|
|
2996
|
-
this.symbol = null;
|
|
2997
|
-
this.id = feature.id;
|
|
2998
|
-
this.displayName = feature.id;
|
|
2999
|
-
this.geometry = feature.geometry;
|
|
3000
|
-
this.layerName = feature.layer;
|
|
3001
|
-
this.layerAlias = feature.layer;
|
|
3002
|
-
this.attributes = getFeatureAttributes(feature.attributes);
|
|
3003
|
-
}
|
|
3004
|
-
|
|
3005
|
-
_createClass(EvergisFeature, [{
|
|
3006
|
-
key: "sGisFeature",
|
|
3007
|
-
value: function sGisFeature() {
|
|
3008
|
-
if (!this.geometry || !this.symbol) {
|
|
3009
|
-
return null;
|
|
3010
|
-
} // @ts-ignore
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
const {
|
|
3014
|
-
type,
|
|
3015
|
-
coordinates,
|
|
3016
|
-
sr
|
|
3017
|
-
} = this.geometry;
|
|
3018
|
-
const crs = CRS_MAP[sr];
|
|
3019
|
-
|
|
3020
|
-
if (!crs) {
|
|
3021
|
-
return null;
|
|
3022
|
-
}
|
|
3023
|
-
|
|
3024
|
-
switch (type) {
|
|
3025
|
-
case GeometryType.Point:
|
|
3026
|
-
return new PointFeature(coordinates, {
|
|
3027
|
-
symbol: selectedPoint,
|
|
3028
|
-
crs
|
|
3029
|
-
});
|
|
3030
|
-
|
|
3031
|
-
case GeometryType.Multipoint:
|
|
3032
|
-
return new MultiPoint(coordinates, {
|
|
3033
|
-
symbol: selectedPoint,
|
|
3034
|
-
crs
|
|
3035
|
-
});
|
|
3036
|
-
|
|
3037
|
-
case GeometryType.Polyline:
|
|
3038
|
-
return new Polyline(coordinates, {
|
|
3039
|
-
symbol: selectedPolyline,
|
|
3040
|
-
crs
|
|
3041
|
-
});
|
|
3042
|
-
|
|
3043
|
-
case GeometryType.Polygon:
|
|
3044
|
-
return new Polygon(coordinates, {
|
|
3045
|
-
symbol: selectedPolygon,
|
|
3046
|
-
crs
|
|
3047
|
-
});
|
|
3048
|
-
|
|
3049
|
-
default:
|
|
3050
|
-
return null;
|
|
3051
|
-
}
|
|
3052
|
-
}
|
|
3053
|
-
}, {
|
|
3054
|
-
key: "extent",
|
|
3055
|
-
value: function extent() {
|
|
3056
|
-
const feature = this.sGisFeature();
|
|
3057
|
-
return feature && feature.bbox;
|
|
3058
|
-
}
|
|
3059
|
-
}]);
|
|
3060
|
-
|
|
3061
|
-
return EvergisFeature;
|
|
3062
|
-
}();
|
|
3063
|
-
|
|
3064
|
-
function evaluateCondition(condition, attributes) {
|
|
3065
|
-
try {
|
|
3066
|
-
const evaluator = new ConditionEvaluator(attributes);
|
|
3067
|
-
const result = evaluator.evaluate(condition);
|
|
3068
|
-
|
|
3069
|
-
if (result instanceof Error) {
|
|
3070
|
-
return null;
|
|
3071
|
-
}
|
|
3072
|
-
|
|
3073
|
-
return result;
|
|
3074
|
-
} catch (_unused) {
|
|
3075
|
-
return null;
|
|
3076
|
-
}
|
|
3077
|
-
}
|
|
3078
|
-
|
|
3079
|
-
function getAttributeValue(attributes, attributeName) {
|
|
3080
|
-
const attributeMeta = attributes.find(_ref => {
|
|
3081
|
-
let {
|
|
3082
|
-
name
|
|
3083
|
-
} = _ref;
|
|
3084
|
-
return name === attributeName;
|
|
3085
|
-
});
|
|
3086
|
-
return attributeMeta ? attributeMeta.value : null;
|
|
2738
|
+
return attributeMeta ? attributeMeta.value : null;
|
|
3087
2739
|
}
|
|
3088
2740
|
|
|
3089
2741
|
const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
|
|
@@ -3091,7 +2743,7 @@ const getAttributeNameFromClassified = values => values.length > 0 ? getAttribut
|
|
|
3091
2743
|
|
|
3092
2744
|
function findFeatureValue(parameterValues, _ref2) {
|
|
3093
2745
|
let [name, value] = _ref2;
|
|
3094
|
-
return value !== null ? parameterValues.find(_ref3 => {
|
|
2746
|
+
return value !== null ? parameterValues.find((_ref3) => {
|
|
3095
2747
|
let {
|
|
3096
2748
|
condition
|
|
3097
2749
|
} = _ref3;
|
|
@@ -3131,7 +2783,7 @@ function evaluateFeatureSymbol(attributes) {
|
|
|
3131
2783
|
}
|
|
3132
2784
|
|
|
3133
2785
|
function findChildFeatureStyle(childStyles, attributes) {
|
|
3134
|
-
return (childStyles || []).find(_ref5 => {
|
|
2786
|
+
return (childStyles || []).find((_ref5) => {
|
|
3135
2787
|
let {
|
|
3136
2788
|
condition
|
|
3137
2789
|
} = _ref5;
|
|
@@ -3192,7 +2844,7 @@ let EvergisLayer = /*#__PURE__*/function () {
|
|
|
3192
2844
|
feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
|
|
3193
2845
|
feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
|
|
3194
2846
|
feature.layerAlias = this.alias;
|
|
3195
|
-
const titleAttribute = (feature.attributes || []).find(_ref => {
|
|
2847
|
+
const titleAttribute = (feature.attributes || []).find((_ref) => {
|
|
3196
2848
|
let {
|
|
3197
2849
|
name
|
|
3198
2850
|
} = _ref;
|
|
@@ -3215,7 +2867,7 @@ const evaluateFeature = layers => feature => {
|
|
|
3215
2867
|
};
|
|
3216
2868
|
|
|
3217
2869
|
const OTHERS_TITLE = 'Другое';
|
|
3218
|
-
const createLegendItem = _ref => {
|
|
2870
|
+
const createLegendItem = (_ref) => {
|
|
3219
2871
|
let {
|
|
3220
2872
|
attributes,
|
|
3221
2873
|
renderTitle,
|
|
@@ -3257,7 +2909,7 @@ function createStyleLegend(style, config) {
|
|
|
3257
2909
|
classificationManager,
|
|
3258
2910
|
symbol
|
|
3259
2911
|
} = style;
|
|
3260
|
-
const items = classificationManager.filter(_ref => {
|
|
2912
|
+
const items = classificationManager.filter((_ref) => {
|
|
3261
2913
|
let {
|
|
3262
2914
|
parameter
|
|
3263
2915
|
} = _ref;
|
|
@@ -3374,7 +3026,7 @@ const useMapLegend = (layer, config) => {
|
|
|
3374
3026
|
};
|
|
3375
3027
|
|
|
3376
3028
|
const LEGEND_SYMBOL_MAX_SIZE = 32;
|
|
3377
|
-
const useLegendValueSymbol = _ref => {
|
|
3029
|
+
const useLegendValueSymbol = (_ref) => {
|
|
3378
3030
|
let {
|
|
3379
3031
|
parameter,
|
|
3380
3032
|
parameterValue
|
|
@@ -3752,7 +3404,7 @@ function useMapWrapper() {
|
|
|
3752
3404
|
return wrapperRef;
|
|
3753
3405
|
}
|
|
3754
3406
|
|
|
3755
|
-
const byScale = scale => _ref => {
|
|
3407
|
+
const byScale = scale => (_ref) => {
|
|
3756
3408
|
let {
|
|
3757
3409
|
zIndex
|
|
3758
3410
|
} = _ref;
|
|
@@ -3951,7 +3603,7 @@ const useTooltip = function useTooltip(zIndex) {
|
|
|
3951
3603
|
|
|
3952
3604
|
return reset;
|
|
3953
3605
|
}, [reset, map, layer, zIndex]);
|
|
3954
|
-
const onSetLabelFeature = useCallback(_ref => {
|
|
3606
|
+
const onSetLabelFeature = useCallback((_ref) => {
|
|
3955
3607
|
let {
|
|
3956
3608
|
point,
|
|
3957
3609
|
position,
|
|
@@ -4115,7 +3767,7 @@ function useClusterLayer(_ref) {
|
|
|
4115
3767
|
}
|
|
4116
3768
|
|
|
4117
3769
|
const INIT_FEATURES = [];
|
|
4118
|
-
const useEvergisSelect = _ref => {
|
|
3770
|
+
const useEvergisSelect = (_ref) => {
|
|
4119
3771
|
let {
|
|
4120
3772
|
onPick,
|
|
4121
3773
|
onFeatures
|
|
@@ -4148,7 +3800,7 @@ function none() {
|
|
|
4148
3800
|
return;
|
|
4149
3801
|
}
|
|
4150
3802
|
|
|
4151
|
-
const useDraggableMarker = _ref => {
|
|
3803
|
+
const useDraggableMarker = (_ref) => {
|
|
4152
3804
|
let {
|
|
4153
3805
|
position,
|
|
4154
3806
|
onChange,
|
|
@@ -4264,7 +3916,7 @@ const useDebouncedCallback = interval => {
|
|
|
4264
3916
|
}, interval), [interval]);
|
|
4265
3917
|
};
|
|
4266
3918
|
|
|
4267
|
-
const Symbol = _ref => {
|
|
3919
|
+
const Symbol = (_ref) => {
|
|
4268
3920
|
let {
|
|
4269
3921
|
symbol,
|
|
4270
3922
|
size,
|
|
@@ -4285,7 +3937,7 @@ const Symbol = _ref => {
|
|
|
4285
3937
|
};
|
|
4286
3938
|
|
|
4287
3939
|
var _templateObject;
|
|
4288
|
-
const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), _ref => {
|
|
3940
|
+
const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), (_ref) => {
|
|
4289
3941
|
let {
|
|
4290
3942
|
geometryType,
|
|
4291
3943
|
icons
|
|
@@ -4294,7 +3946,7 @@ const CompoundIcon = /*#__PURE__*/styled.div(_templateObject || (_templateObject
|
|
|
4294
3946
|
});
|
|
4295
3947
|
|
|
4296
3948
|
const MAX_SIZE = 32;
|
|
4297
|
-
const StyleSymbol = _ref => {
|
|
3949
|
+
const StyleSymbol = (_ref) => {
|
|
4298
3950
|
let {
|
|
4299
3951
|
symbol,
|
|
4300
3952
|
size = MAX_SIZE,
|
|
@@ -4339,7 +3991,7 @@ const CloseIcon = /*#__PURE__*/styled(Icon)(_templateObject20 || (_templateObjec
|
|
|
4339
3991
|
const PrevIcon = /*#__PURE__*/styled(Icon)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
|
|
4340
3992
|
const NextIcon = /*#__PURE__*/styled(Icon)(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
|
|
4341
3993
|
|
|
4342
|
-
const MailValue = _ref => {
|
|
3994
|
+
const MailValue = (_ref) => {
|
|
4343
3995
|
let {
|
|
4344
3996
|
mail
|
|
4345
3997
|
} = _ref;
|
|
@@ -4350,7 +4002,7 @@ const MailValue = _ref => {
|
|
|
4350
4002
|
}, mail);
|
|
4351
4003
|
};
|
|
4352
4004
|
|
|
4353
|
-
const PhoneValue = _ref => {
|
|
4005
|
+
const PhoneValue = (_ref) => {
|
|
4354
4006
|
let {
|
|
4355
4007
|
phone
|
|
4356
4008
|
} = _ref;
|
|
@@ -4361,7 +4013,7 @@ const PhoneValue = _ref => {
|
|
|
4361
4013
|
}, phone);
|
|
4362
4014
|
};
|
|
4363
4015
|
|
|
4364
|
-
const UrlValue = _ref => {
|
|
4016
|
+
const UrlValue = (_ref) => {
|
|
4365
4017
|
let {
|
|
4366
4018
|
url
|
|
4367
4019
|
} = _ref;
|
|
@@ -4372,7 +4024,7 @@ const UrlValue = _ref => {
|
|
|
4372
4024
|
}, url);
|
|
4373
4025
|
};
|
|
4374
4026
|
|
|
4375
|
-
const AttributeValue = _ref => {
|
|
4027
|
+
const AttributeValue = (_ref) => {
|
|
4376
4028
|
let {
|
|
4377
4029
|
attribute
|
|
4378
4030
|
} = _ref;
|
|
@@ -4386,29 +4038,29 @@ const AttributeValue = _ref => {
|
|
|
4386
4038
|
if (attributeValue.type === 2
|
|
4387
4039
|
/* Url */
|
|
4388
4040
|
) {
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4041
|
+
return React.createElement(UrlValue, {
|
|
4042
|
+
key: key,
|
|
4043
|
+
url: punycodeDecode(value)
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4394
4046
|
|
|
4395
4047
|
if (attributeValue.type === 3
|
|
4396
4048
|
/* Mail */
|
|
4397
4049
|
) {
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4050
|
+
return React.createElement(MailValue, {
|
|
4051
|
+
key: key,
|
|
4052
|
+
mail: value
|
|
4053
|
+
});
|
|
4054
|
+
}
|
|
4403
4055
|
|
|
4404
4056
|
if (attributeValue.type === 1
|
|
4405
4057
|
/* Phone */
|
|
4406
4058
|
) {
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4059
|
+
return React.createElement(PhoneValue, {
|
|
4060
|
+
key: key,
|
|
4061
|
+
phone: value
|
|
4062
|
+
});
|
|
4063
|
+
}
|
|
4412
4064
|
|
|
4413
4065
|
return React.createElement(SimpleAttribute, {
|
|
4414
4066
|
key: value
|
|
@@ -4424,7 +4076,7 @@ function punycodeDecode(domains) {
|
|
|
4424
4076
|
}
|
|
4425
4077
|
}
|
|
4426
4078
|
|
|
4427
|
-
const EvergisCardAttribute = _ref => {
|
|
4079
|
+
const EvergisCardAttribute = (_ref) => {
|
|
4428
4080
|
let {
|
|
4429
4081
|
attribute,
|
|
4430
4082
|
className
|
|
@@ -4436,7 +4088,7 @@ const EvergisCardAttribute = _ref => {
|
|
|
4436
4088
|
}));
|
|
4437
4089
|
};
|
|
4438
4090
|
|
|
4439
|
-
const StyledCard = _ref => {
|
|
4091
|
+
const StyledCard = (_ref) => {
|
|
4440
4092
|
let {
|
|
4441
4093
|
features = [],
|
|
4442
4094
|
className,
|
|
@@ -4487,7 +4139,7 @@ const StyledCard = _ref => {
|
|
|
4487
4139
|
};
|
|
4488
4140
|
|
|
4489
4141
|
const _excluded$1 = ["renderCard", "className", "children"];
|
|
4490
|
-
const EvergisCard = _ref => {
|
|
4142
|
+
const EvergisCard = (_ref) => {
|
|
4491
4143
|
let {
|
|
4492
4144
|
renderCard,
|
|
4493
4145
|
className,
|
|
@@ -4539,7 +4191,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
|
|
|
4539
4191
|
|
|
4540
4192
|
const useSGisFeatures = (features, currentIndex) => useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
|
|
4541
4193
|
|
|
4542
|
-
const EvergisSelectLayer = _ref => {
|
|
4194
|
+
const EvergisSelectLayer = (_ref) => {
|
|
4543
4195
|
let {
|
|
4544
4196
|
features,
|
|
4545
4197
|
zIndex,
|
|
@@ -4584,7 +4236,7 @@ const TileLayer = props => {
|
|
|
4584
4236
|
};
|
|
4585
4237
|
|
|
4586
4238
|
const defaultZIndex = 200;
|
|
4587
|
-
const EvergisSelect = _ref => {
|
|
4239
|
+
const EvergisSelect = (_ref) => {
|
|
4588
4240
|
let {
|
|
4589
4241
|
onPick,
|
|
4590
4242
|
className,
|
|
@@ -4619,7 +4271,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled.p(_templateObject3$1 || (_template
|
|
|
4619
4271
|
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);
|
|
4620
4272
|
const LegendSectionHeader = /*#__PURE__*/styled.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])));
|
|
4621
4273
|
|
|
4622
|
-
const LegendSection = _ref => {
|
|
4274
|
+
const LegendSection = (_ref) => {
|
|
4623
4275
|
let {
|
|
4624
4276
|
item,
|
|
4625
4277
|
renderLegendTitle,
|
|
@@ -4636,7 +4288,7 @@ SearchPrefix.defaultProps = {
|
|
|
4636
4288
|
kind: "search"
|
|
4637
4289
|
};
|
|
4638
4290
|
|
|
4639
|
-
const SearchInput = _ref => {
|
|
4291
|
+
const SearchInput = (_ref) => {
|
|
4640
4292
|
let {
|
|
4641
4293
|
onChange
|
|
4642
4294
|
} = _ref;
|
|
@@ -4645,7 +4297,7 @@ const SearchInput = _ref => {
|
|
|
4645
4297
|
}));
|
|
4646
4298
|
};
|
|
4647
4299
|
|
|
4648
|
-
const LegendSymbol = _ref => {
|
|
4300
|
+
const LegendSymbol = (_ref) => {
|
|
4649
4301
|
let {
|
|
4650
4302
|
parameter,
|
|
4651
4303
|
parameterValue,
|
|
@@ -4663,7 +4315,7 @@ const LegendSymbol = _ref => {
|
|
|
4663
4315
|
return React.createElement(React.Fragment, null, children(symbol));
|
|
4664
4316
|
};
|
|
4665
4317
|
|
|
4666
|
-
const LegendValue = _ref => {
|
|
4318
|
+
const LegendValue = (_ref) => {
|
|
4667
4319
|
let {
|
|
4668
4320
|
value,
|
|
4669
4321
|
parameter,
|
|
@@ -4685,7 +4337,7 @@ const getNumberParam = (parameterValue, param) => {
|
|
|
4685
4337
|
return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
|
|
4686
4338
|
};
|
|
4687
4339
|
|
|
4688
|
-
const getSymbolSize = _ref => {
|
|
4340
|
+
const getSymbolSize = (_ref) => {
|
|
4689
4341
|
let {
|
|
4690
4342
|
parameterValue,
|
|
4691
4343
|
maxSize
|
|
@@ -4710,7 +4362,7 @@ const getSymbolSize = _ref => {
|
|
|
4710
4362
|
}
|
|
4711
4363
|
};
|
|
4712
4364
|
|
|
4713
|
-
const Legend = _ref => {
|
|
4365
|
+
const Legend = (_ref) => {
|
|
4714
4366
|
let {
|
|
4715
4367
|
layer,
|
|
4716
4368
|
children,
|
|
@@ -4753,7 +4405,7 @@ const Legend = _ref => {
|
|
|
4753
4405
|
})))));
|
|
4754
4406
|
};
|
|
4755
4407
|
|
|
4756
|
-
const Map = _ref => {
|
|
4408
|
+
const Map = (_ref) => {
|
|
4757
4409
|
let {
|
|
4758
4410
|
className,
|
|
4759
4411
|
position,
|
|
@@ -4775,163 +4427,488 @@ const Map = _ref => {
|
|
|
4775
4427
|
})) {
|
|
4776
4428
|
onBboxChange(state);
|
|
4777
4429
|
}
|
|
4778
|
-
}, [map, onBboxChange, position, resolution]);
|
|
4779
|
-
useUpdateMapView({
|
|
4780
|
-
position,
|
|
4781
|
-
resolution
|
|
4782
|
-
});
|
|
4783
|
-
useMaxMinScale(minScale, maxScale, position, resolution);
|
|
4784
|
-
useMapBboxChange(handleBboxChange);
|
|
4785
|
-
return React.createElement("div", {
|
|
4786
|
-
className: className,
|
|
4787
|
-
ref: wrapperRef,
|
|
4788
|
-
style: style
|
|
4789
|
-
}, children);
|
|
4790
|
-
};
|
|
4791
|
-
|
|
4792
|
-
var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
|
|
4793
|
-
|
|
4794
|
-
const topLeft = distance => css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4430
|
+
}, [map, onBboxChange, position, resolution]);
|
|
4431
|
+
useUpdateMapView({
|
|
4432
|
+
position,
|
|
4433
|
+
resolution
|
|
4434
|
+
});
|
|
4435
|
+
useMaxMinScale(minScale, maxScale, position, resolution);
|
|
4436
|
+
useMapBboxChange(handleBboxChange);
|
|
4437
|
+
return React.createElement("div", {
|
|
4438
|
+
className: className,
|
|
4439
|
+
ref: wrapperRef,
|
|
4440
|
+
style: style
|
|
4441
|
+
}, children);
|
|
4442
|
+
};
|
|
4443
|
+
|
|
4444
|
+
var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
|
|
4445
|
+
|
|
4446
|
+
const topLeft = distance => css(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n top: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4447
|
+
|
|
4448
|
+
const topRight = distance => css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n top: ", ";\n right: ", ";\n"])), distance, distance);
|
|
4449
|
+
|
|
4450
|
+
const bottomLeft = distance => css(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n left: ", ";\n"])), distance, distance);
|
|
4451
|
+
|
|
4452
|
+
const bottomRight = distance => css(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n bottom: ", ";\n right: ", ";\n"])), distance, distance);
|
|
4453
|
+
|
|
4454
|
+
const placementMixin = function placementMixin(placement, distance) {
|
|
4455
|
+
if (placement === void 0) {
|
|
4456
|
+
placement = 'bottom-left';
|
|
4457
|
+
}
|
|
4458
|
+
|
|
4459
|
+
if (distance === void 0) {
|
|
4460
|
+
distance = '1rem';
|
|
4461
|
+
}
|
|
4462
|
+
|
|
4463
|
+
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));
|
|
4464
|
+
};
|
|
4465
|
+
|
|
4466
|
+
var _templateObject$5, _templateObject2$4, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$1, _templateObject7$1, _templateObject8$1;
|
|
4467
|
+
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"])));
|
|
4468
|
+
const ZoomInBtn = /*#__PURE__*/styled(Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4469
|
+
ZoomInBtn.defaultProps = {
|
|
4470
|
+
kind: "plus"
|
|
4471
|
+
};
|
|
4472
|
+
const ZoomOutBtn = /*#__PURE__*/styled(Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4473
|
+
ZoomOutBtn.defaultProps = {
|
|
4474
|
+
kind: "minus"
|
|
4475
|
+
};
|
|
4476
|
+
const SearchBtn = /*#__PURE__*/styled(Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4477
|
+
SearchBtn.defaultProps = {
|
|
4478
|
+
kind: "search"
|
|
4479
|
+
}; // TODO not exists in fonts
|
|
4480
|
+
|
|
4481
|
+
const FullscreenBtn = /*#__PURE__*/styled(Icon)(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4482
|
+
FullscreenBtn.defaultProps = {
|
|
4483
|
+
kind: "maximize"
|
|
4484
|
+
};
|
|
4485
|
+
const MeasureBtn = /*#__PURE__*/styled(Icon)(_templateObject6$1 || (_templateObject6$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4486
|
+
MeasureBtn.defaultProps = {
|
|
4487
|
+
kind: "measure_length"
|
|
4488
|
+
};
|
|
4489
|
+
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"])));
|
|
4490
|
+
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) => {
|
|
4491
|
+
let {
|
|
4492
|
+
vertical
|
|
4493
|
+
} = _ref;
|
|
4494
|
+
return vertical ? 'column' : 'row';
|
|
4495
|
+
}, (_ref2) => {
|
|
4496
|
+
let {
|
|
4497
|
+
placement
|
|
4498
|
+
} = _ref2;
|
|
4499
|
+
return placementMixin(placement);
|
|
4500
|
+
}, MapControl, (_ref3) => {
|
|
4501
|
+
let {
|
|
4502
|
+
vertical
|
|
4503
|
+
} = _ref3;
|
|
4504
|
+
return vertical ? '0.5rem' : '0';
|
|
4505
|
+
}, (_ref4) => {
|
|
4506
|
+
let {
|
|
4507
|
+
vertical
|
|
4508
|
+
} = _ref4;
|
|
4509
|
+
return vertical ? '0' : '0.5rem';
|
|
4510
|
+
}, (_ref5) => {
|
|
4511
|
+
let {
|
|
4512
|
+
vertical
|
|
4513
|
+
} = _ref5;
|
|
4514
|
+
return vertical ? 'column' : 'row';
|
|
4515
|
+
});
|
|
4516
|
+
|
|
4517
|
+
const Measure = () => {
|
|
4518
|
+
return React.createElement(MapControl, null, React.createElement(MeasureBtn, {
|
|
4519
|
+
onClick: () => {}
|
|
4520
|
+
}));
|
|
4521
|
+
};
|
|
4522
|
+
|
|
4523
|
+
const Search = () => {
|
|
4524
|
+
return React.createElement(MapControl, null, React.createElement(SearchBtn, {
|
|
4525
|
+
onClick: () => {}
|
|
4526
|
+
}));
|
|
4527
|
+
};
|
|
4528
|
+
|
|
4529
|
+
const Fullscreen = () => {
|
|
4530
|
+
return React.createElement(MapControl, null, React.createElement(FullscreenBtn, {
|
|
4531
|
+
onClick: () => {}
|
|
4532
|
+
}));
|
|
4533
|
+
};
|
|
4534
|
+
|
|
4535
|
+
var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4;
|
|
4536
|
+
const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4537
|
+
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"])));
|
|
4538
|
+
const MapLegendHeader = /*#__PURE__*/styled(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
|
|
4539
|
+
const MapLegendSection = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
|
|
4540
|
+
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"])));
|
|
4541
|
+
|
|
4542
|
+
const MAX_SIZE$2 = 100;
|
|
4543
|
+
const MapLegendSymbol = (_ref) => {
|
|
4544
|
+
let {
|
|
4545
|
+
value,
|
|
4546
|
+
parameter
|
|
4547
|
+
} = _ref;
|
|
4548
|
+
return React.createElement(LegendSymbol, {
|
|
4549
|
+
key: value.title,
|
|
4550
|
+
parameter: parameter,
|
|
4551
|
+
parameterValue: value.parameterValue
|
|
4552
|
+
}, symbol => React.createElement(Symbol, {
|
|
4553
|
+
render: getMapLegendSymbolRenders,
|
|
4554
|
+
symbol: symbol,
|
|
4555
|
+
size: MAX_SIZE$2
|
|
4556
|
+
}));
|
|
4557
|
+
};
|
|
4558
|
+
|
|
4559
|
+
const DEFAULT_FROM_TO = ['Выше', 'Ниже'];
|
|
4560
|
+
const MapLegend = (_ref) => {
|
|
4561
|
+
let {
|
|
4562
|
+
layer,
|
|
4563
|
+
config,
|
|
4564
|
+
fromToTitle = DEFAULT_FROM_TO,
|
|
4565
|
+
className
|
|
4566
|
+
} = _ref;
|
|
4567
|
+
const legend = useMapLegend(layer, config);
|
|
4568
|
+
|
|
4569
|
+
if (!legend) {
|
|
4570
|
+
return null;
|
|
4571
|
+
}
|
|
4572
|
+
|
|
4573
|
+
const {
|
|
4574
|
+
symbol,
|
|
4575
|
+
item
|
|
4576
|
+
} = legend;
|
|
4577
|
+
return React.createElement(LegendProvider, {
|
|
4578
|
+
symbol: symbol
|
|
4579
|
+
}, React.createElement(MapLegendControl, {
|
|
4580
|
+
className: className
|
|
4581
|
+
}, 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, {
|
|
4582
|
+
key: value.title,
|
|
4583
|
+
value: value,
|
|
4584
|
+
parameter: item.parameter
|
|
4585
|
+
})), React.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
|
|
4586
|
+
};
|
|
4587
|
+
|
|
4588
|
+
const DEFAULT_FORMATTERS = {
|
|
4589
|
+
polygon: formatPolygonMeasure,
|
|
4590
|
+
length: formatLength
|
|
4591
|
+
};
|
|
4592
|
+
|
|
4593
|
+
const COORD_FRACTION = 6;
|
|
4594
|
+
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
4595
|
+
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
4596
|
+
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
4597
|
+
|
|
4598
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
4599
|
+
|
|
4600
|
+
function BaseMeasureToolCreator(map, painter, params) {
|
|
4601
|
+
var _this;
|
|
4602
|
+
|
|
4603
|
+
_classCallCheck(this, BaseMeasureToolCreator);
|
|
4604
|
+
|
|
4605
|
+
_this = _super.call(this, map, params);
|
|
4606
|
+
|
|
4607
|
+
_this.cancel = () => {
|
|
4608
|
+
_this.fire('cancel');
|
|
4609
|
+
};
|
|
4610
|
+
|
|
4611
|
+
_this.painter = painter;
|
|
4612
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4613
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4614
|
+
_this.areaSymbol = params.areaSymbol;
|
|
4615
|
+
|
|
4616
|
+
_this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
|
|
4617
|
+
|
|
4618
|
+
|
|
4619
|
+
_this.on('change', _this.updateDistance);
|
|
4620
|
+
|
|
4621
|
+
return _this;
|
|
4622
|
+
}
|
|
4623
|
+
|
|
4624
|
+
_createClass(BaseMeasureToolCreator, [{
|
|
4625
|
+
key: "_handleMousemove",
|
|
4626
|
+
value: function _handleMousemove(event) {
|
|
4627
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_handleMousemove", this).call(this, event);
|
|
4628
|
+
|
|
4629
|
+
this.drawPointOnMouseMove(event);
|
|
4630
|
+
}
|
|
4631
|
+
}, {
|
|
4632
|
+
key: "_activate",
|
|
4633
|
+
value: function _activate() {
|
|
4634
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_activate", this).call(this);
|
|
4635
|
+
|
|
4636
|
+
this.addTempLabel();
|
|
4637
|
+
this.setCursor('pointer');
|
|
4638
|
+
}
|
|
4639
|
+
}, {
|
|
4640
|
+
key: "_deactivate",
|
|
4641
|
+
value: function _deactivate() {
|
|
4642
|
+
_get(_getPrototypeOf(BaseMeasureToolCreator.prototype), "_deactivate", this).call(this);
|
|
4643
|
+
|
|
4644
|
+
this.removeCoordLabel();
|
|
4645
|
+
this.removeTempLabel();
|
|
4646
|
+
this.removeMeasureLabel();
|
|
4647
|
+
this.removeTempPolygon();
|
|
4648
|
+
this.setCursor('default');
|
|
4649
|
+
}
|
|
4650
|
+
}, {
|
|
4651
|
+
key: "handlePointAdd",
|
|
4652
|
+
value: function handlePointAdd() {
|
|
4653
|
+
const feature = this.activeFeature;
|
|
4654
|
+
if (!feature) return;
|
|
4655
|
+
const {
|
|
4656
|
+
rings,
|
|
4657
|
+
crs
|
|
4658
|
+
} = feature;
|
|
4659
|
+
|
|
4660
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4661
|
+
this.finishDrawing();
|
|
4662
|
+
this.fire(new DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
4663
|
+
return;
|
|
4664
|
+
}
|
|
4665
|
+
|
|
4666
|
+
if (rings[0].length === 2) {
|
|
4667
|
+
const projection = crs.projectionTo(geo);
|
|
4668
|
+
const point = rings[0][0];
|
|
4669
|
+
if (!projection) return;
|
|
4670
|
+
const [lat, long] = projection(point);
|
|
4671
|
+
this.removeTempLabel();
|
|
4672
|
+
this.addMeasureResultLabel();
|
|
4673
|
+
this.addCoordLabel(lat.toFixed(COORD_FRACTION) + ", " + long.toFixed(COORD_FRACTION), point);
|
|
4674
|
+
} else {
|
|
4675
|
+
this.removeCoordLabel();
|
|
4676
|
+
}
|
|
4677
|
+
}
|
|
4678
|
+
}, {
|
|
4679
|
+
key: "polygonPreview",
|
|
4680
|
+
value: function polygonPreview() {
|
|
4681
|
+
if (this.tempPolygon) {
|
|
4682
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
4683
|
+
}
|
|
4684
|
+
|
|
4685
|
+
const feature = this.activeFeature;
|
|
4686
|
+
if (!feature) return;
|
|
4687
|
+
const {
|
|
4688
|
+
rings,
|
|
4689
|
+
crs
|
|
4690
|
+
} = feature;
|
|
4691
|
+
const polygonRings = [...rings[0]];
|
|
4692
|
+
polygonRings.shift();
|
|
4693
|
+
this.tempPolygon = new Polygon(polygonRings, {
|
|
4694
|
+
crs
|
|
4695
|
+
});
|
|
4696
|
+
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
4697
|
+
this.activeFeature && this.activeFeature.hide();
|
|
4698
|
+
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
4699
|
+
}
|
|
4700
|
+
}, {
|
|
4701
|
+
key: "removeTempPolygon",
|
|
4702
|
+
value: function removeTempPolygon() {
|
|
4703
|
+
if (this.tempPolygon) {
|
|
4704
|
+
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
4705
|
+
delete this.tempPolygon;
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
}, {
|
|
4709
|
+
key: "updateDistance",
|
|
4710
|
+
value: function updateDistance(event) {
|
|
4711
|
+
const feature = this.activeFeature;
|
|
4712
|
+
const {
|
|
4713
|
+
ringIndex,
|
|
4714
|
+
pointIndex
|
|
4715
|
+
} = event;
|
|
4716
|
+
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
4717
|
+
const {
|
|
4718
|
+
rings,
|
|
4719
|
+
crs
|
|
4720
|
+
} = feature;
|
|
4721
|
+
const position = rings[ringIndex][pointIndex];
|
|
4722
|
+
const length$1 = length(rings, crs);
|
|
4723
|
+
let content = this.formatters.length(length$1);
|
|
4724
|
+
|
|
4725
|
+
if (isPolylineLikePolygon(rings, this.map.resolution)) {
|
|
4726
|
+
this.polygonPreview();
|
|
4727
|
+
const area$1 = area(rings, crs);
|
|
4728
|
+
content = this.formatters.polygon(area$1, length$1);
|
|
4729
|
+
} else if (this.tempPolygon) {
|
|
4730
|
+
feature.show();
|
|
4731
|
+
this.removeTempPolygon();
|
|
4732
|
+
}
|
|
4733
|
+
|
|
4734
|
+
if (this.measureResultLabel) {
|
|
4735
|
+
this.measureResultLabel.position = position;
|
|
4736
|
+
this.measureResultLabel.content = content;
|
|
4737
|
+
}
|
|
4738
|
+
}
|
|
4739
|
+
}, {
|
|
4740
|
+
key: "addTempLabel",
|
|
4741
|
+
value: function addTempLabel() {
|
|
4742
|
+
this.tempLabel = new LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
4743
|
+
content: 'Нажмите на карту, чтобы начать измерение',
|
|
4744
|
+
crs: this.map.crs,
|
|
4745
|
+
symbol: createLabelSymbol({
|
|
4746
|
+
renderLabel: this.renderLabelSymbol
|
|
4747
|
+
})
|
|
4748
|
+
});
|
|
4749
|
+
this._tempLayer && this._tempLayer.add(this.tempLabel);
|
|
4750
|
+
}
|
|
4751
|
+
}, {
|
|
4752
|
+
key: "addCoordLabel",
|
|
4753
|
+
value: function addCoordLabel(content, position) {
|
|
4754
|
+
this.coordLabel = new LabelFeature(position, {
|
|
4755
|
+
content,
|
|
4756
|
+
crs: this.map.crs,
|
|
4757
|
+
symbol: createLabelSymbol({
|
|
4758
|
+
renderLabel: this.renderLabelSymbol,
|
|
4759
|
+
onClose: this.cancel
|
|
4760
|
+
})
|
|
4761
|
+
});
|
|
4762
|
+
this._tempLayer && this.coordLabel && this._tempLayer.add(this.coordLabel);
|
|
4763
|
+
}
|
|
4764
|
+
}, {
|
|
4765
|
+
key: "addMeasureResultLabel",
|
|
4766
|
+
value: function addMeasureResultLabel() {
|
|
4767
|
+
this.measureResultLabel = new LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
4768
|
+
crs: this.map.crs,
|
|
4769
|
+
symbol: createLabelSymbol({
|
|
4770
|
+
renderLabel: this.renderLabelSymbol
|
|
4771
|
+
})
|
|
4772
|
+
});
|
|
4773
|
+
this._tempLayer && this.measureResultLabel && this._tempLayer.add(this.measureResultLabel);
|
|
4774
|
+
}
|
|
4775
|
+
}, {
|
|
4776
|
+
key: "removeTempLabel",
|
|
4777
|
+
value: function removeTempLabel() {
|
|
4778
|
+
if (this.tempLabel) {
|
|
4779
|
+
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
4780
|
+
delete this.tempLabel;
|
|
4781
|
+
}
|
|
4782
|
+
}
|
|
4783
|
+
}, {
|
|
4784
|
+
key: "removeCoordLabel",
|
|
4785
|
+
value: function removeCoordLabel() {
|
|
4786
|
+
if (this.coordLabel) {
|
|
4787
|
+
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
4788
|
+
delete this.coordLabel;
|
|
4789
|
+
}
|
|
4790
|
+
}
|
|
4791
|
+
}, {
|
|
4792
|
+
key: "removeMeasureLabel",
|
|
4793
|
+
value: function removeMeasureLabel() {
|
|
4794
|
+
if (this.measureResultLabel) {
|
|
4795
|
+
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
4796
|
+
delete this.measureResultLabel;
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
}, {
|
|
4800
|
+
key: "drawPointOnMouseMove",
|
|
4801
|
+
value: function drawPointOnMouseMove(event) {
|
|
4802
|
+
if (this.tempLabel) {
|
|
4803
|
+
this.tempLabel.position = event.point.position;
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
}, {
|
|
4807
|
+
key: "setCursor",
|
|
4808
|
+
value: function setCursor(cursor) {
|
|
4809
|
+
const {
|
|
4810
|
+
wrapper
|
|
4811
|
+
} = this.painter;
|
|
4795
4812
|
|
|
4796
|
-
|
|
4813
|
+
if (wrapper && typeof wrapper !== 'string') {
|
|
4814
|
+
wrapper.style.cursor = cursor;
|
|
4815
|
+
}
|
|
4816
|
+
}
|
|
4817
|
+
}]);
|
|
4797
4818
|
|
|
4798
|
-
|
|
4819
|
+
return BaseMeasureToolCreator;
|
|
4820
|
+
}(PolylineControl);
|
|
4799
4821
|
|
|
4800
|
-
|
|
4822
|
+
let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
|
|
4823
|
+
_inherits(BaseMeasureToolEditor, _PolyEditor);
|
|
4801
4824
|
|
|
4802
|
-
|
|
4803
|
-
if (placement === void 0) {
|
|
4804
|
-
placement = 'bottom-left';
|
|
4805
|
-
}
|
|
4825
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
|
|
4806
4826
|
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
}
|
|
4827
|
+
function BaseMeasureToolEditor(map, painter, params) {
|
|
4828
|
+
var _this;
|
|
4810
4829
|
|
|
4811
|
-
|
|
4812
|
-
};
|
|
4830
|
+
_classCallCheck(this, BaseMeasureToolEditor);
|
|
4813
4831
|
|
|
4814
|
-
|
|
4815
|
-
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"])));
|
|
4816
|
-
const ZoomInBtn = /*#__PURE__*/styled(Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4817
|
-
ZoomInBtn.defaultProps = {
|
|
4818
|
-
kind: "plus"
|
|
4819
|
-
};
|
|
4820
|
-
const ZoomOutBtn = /*#__PURE__*/styled(Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4821
|
-
ZoomOutBtn.defaultProps = {
|
|
4822
|
-
kind: "minus"
|
|
4823
|
-
};
|
|
4824
|
-
const SearchBtn = /*#__PURE__*/styled(Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4825
|
-
SearchBtn.defaultProps = {
|
|
4826
|
-
kind: "search"
|
|
4827
|
-
}; // TODO not exists in fonts
|
|
4832
|
+
_this = _super.call(this, map, params);
|
|
4828
4833
|
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
};
|
|
4837
|
-
const
|
|
4838
|
-
const
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
return placementMixin(placement);
|
|
4848
|
-
}, MapControl, _ref3 => {
|
|
4849
|
-
let {
|
|
4850
|
-
vertical
|
|
4851
|
-
} = _ref3;
|
|
4852
|
-
return vertical ? '0.5rem' : '0';
|
|
4853
|
-
}, _ref4 => {
|
|
4854
|
-
let {
|
|
4855
|
-
vertical
|
|
4856
|
-
} = _ref4;
|
|
4857
|
-
return vertical ? '0' : '0.5rem';
|
|
4858
|
-
}, _ref5 => {
|
|
4859
|
-
let {
|
|
4860
|
-
vertical
|
|
4861
|
-
} = _ref5;
|
|
4862
|
-
return vertical ? 'column' : 'row';
|
|
4863
|
-
});
|
|
4834
|
+
_this.measureResult = () => {
|
|
4835
|
+
const feature = _this.activeFeature;
|
|
4836
|
+
if (!feature) return null;
|
|
4837
|
+
const {
|
|
4838
|
+
rings,
|
|
4839
|
+
isEnclosed,
|
|
4840
|
+
crs
|
|
4841
|
+
} = feature;
|
|
4842
|
+
const pointsCount = rings[0].length;
|
|
4843
|
+
const position = rings[0][pointsCount - 1];
|
|
4844
|
+
const area$1 = area(rings, crs);
|
|
4845
|
+
const length$1 = length(rings, crs, isEnclosed);
|
|
4846
|
+
const content = isEnclosed ? _this.formatters.polygon(area$1, length$1) : _this.formatters.length(length$1);
|
|
4847
|
+
return {
|
|
4848
|
+
content,
|
|
4849
|
+
position
|
|
4850
|
+
};
|
|
4851
|
+
};
|
|
4864
4852
|
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
}));
|
|
4869
|
-
};
|
|
4853
|
+
_this.removeFeature = () => {
|
|
4854
|
+
_this.fire('remove');
|
|
4855
|
+
};
|
|
4870
4856
|
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
}));
|
|
4875
|
-
};
|
|
4857
|
+
_this.painter = painter;
|
|
4858
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4859
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4876
4860
|
|
|
4877
|
-
|
|
4878
|
-
return React.createElement(MapControl, null, React.createElement(FullscreenBtn, {
|
|
4879
|
-
onClick: () => {}
|
|
4880
|
-
}));
|
|
4881
|
-
};
|
|
4861
|
+
_this.on('change', _this.updateMeasureResult);
|
|
4882
4862
|
|
|
4883
|
-
|
|
4884
|
-
const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4885
|
-
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"])));
|
|
4886
|
-
const MapLegendHeader = /*#__PURE__*/styled(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
|
|
4887
|
-
const MapLegendSection = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
|
|
4888
|
-
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"])));
|
|
4863
|
+
_this.on('edit', _this.updateMeasureResult);
|
|
4889
4864
|
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
let {
|
|
4893
|
-
value,
|
|
4894
|
-
parameter
|
|
4895
|
-
} = _ref;
|
|
4896
|
-
return React.createElement(LegendSymbol, {
|
|
4897
|
-
key: value.title,
|
|
4898
|
-
parameter: parameter,
|
|
4899
|
-
parameterValue: value.parameterValue
|
|
4900
|
-
}, symbol => React.createElement(Symbol, {
|
|
4901
|
-
render: getMapLegendSymbolRenders,
|
|
4902
|
-
symbol: symbol,
|
|
4903
|
-
size: MAX_SIZE$2
|
|
4904
|
-
}));
|
|
4905
|
-
};
|
|
4865
|
+
return _this;
|
|
4866
|
+
}
|
|
4906
4867
|
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
config,
|
|
4912
|
-
fromToTitle = DEFAULT_FROM_TO,
|
|
4913
|
-
className
|
|
4914
|
-
} = _ref;
|
|
4915
|
-
const legend = useMapLegend(layer, config);
|
|
4868
|
+
_createClass(BaseMeasureToolEditor, [{
|
|
4869
|
+
key: "_activate",
|
|
4870
|
+
value: function _activate() {
|
|
4871
|
+
_get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
|
|
4916
4872
|
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
}
|
|
4873
|
+
this.addMeasureResultLabel();
|
|
4874
|
+
}
|
|
4875
|
+
}, {
|
|
4876
|
+
key: "addMeasureResultLabel",
|
|
4877
|
+
value: function addMeasureResultLabel() {
|
|
4878
|
+
const measureResult = this.measureResult();
|
|
4879
|
+
if (measureResult === null) return;
|
|
4880
|
+
const {
|
|
4881
|
+
content,
|
|
4882
|
+
position
|
|
4883
|
+
} = measureResult;
|
|
4884
|
+
this.measureResultLabel = new LabelFeature(position, {
|
|
4885
|
+
content,
|
|
4886
|
+
crs: this.map.crs,
|
|
4887
|
+
symbol: createLabelSymbol({
|
|
4888
|
+
onClose: this.removeFeature,
|
|
4889
|
+
renderLabel: this.renderLabelSymbol
|
|
4890
|
+
})
|
|
4891
|
+
});
|
|
4892
|
+
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
4893
|
+
}
|
|
4894
|
+
}, {
|
|
4895
|
+
key: "updateMeasureResult",
|
|
4896
|
+
value: function updateMeasureResult() {
|
|
4897
|
+
if (this.measureResultLabel) {
|
|
4898
|
+
const measureResult = this.measureResult();
|
|
4899
|
+
if (measureResult === null) return;
|
|
4900
|
+
const {
|
|
4901
|
+
content,
|
|
4902
|
+
position
|
|
4903
|
+
} = measureResult;
|
|
4904
|
+
this.measureResultLabel.content = content;
|
|
4905
|
+
this.measureResultLabel.position = position;
|
|
4906
|
+
}
|
|
4907
|
+
}
|
|
4908
|
+
}]);
|
|
4920
4909
|
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
item
|
|
4924
|
-
} = legend;
|
|
4925
|
-
return React.createElement(LegendProvider, {
|
|
4926
|
-
symbol: symbol
|
|
4927
|
-
}, React.createElement(MapLegendControl, {
|
|
4928
|
-
className: className
|
|
4929
|
-
}, 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, {
|
|
4930
|
-
key: value.title,
|
|
4931
|
-
value: value,
|
|
4932
|
-
parameter: item.parameter
|
|
4933
|
-
})), React.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
|
|
4934
|
-
};
|
|
4910
|
+
return BaseMeasureToolEditor;
|
|
4911
|
+
}(PolyEditor);
|
|
4935
4912
|
|
|
4936
4913
|
let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
4937
4914
|
_inherits(MeasureTool, _React$Component);
|
|
@@ -5121,7 +5098,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
|
5121
5098
|
}(React.Component);
|
|
5122
5099
|
|
|
5123
5100
|
const _excluded$3 = ["isActive"];
|
|
5124
|
-
const Measurer = _ref => {
|
|
5101
|
+
const Measurer = (_ref) => {
|
|
5125
5102
|
let {
|
|
5126
5103
|
isActive
|
|
5127
5104
|
} = _ref,
|
|
@@ -5139,18 +5116,18 @@ const Measurer = _ref => {
|
|
|
5139
5116
|
|
|
5140
5117
|
var _templateObject$7, _templateObject2$6, _templateObject3$6;
|
|
5141
5118
|
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"])));
|
|
5142
|
-
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 => {
|
|
5119
|
+
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) => {
|
|
5143
5120
|
let {
|
|
5144
5121
|
width
|
|
5145
5122
|
} = _ref;
|
|
5146
5123
|
return width + "px";
|
|
5147
5124
|
});
|
|
5148
|
-
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 => {
|
|
5125
|
+
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) => {
|
|
5149
5126
|
let {
|
|
5150
5127
|
alignEnd
|
|
5151
5128
|
} = _ref2;
|
|
5152
5129
|
return alignEnd ? 'flex-end' : 'center';
|
|
5153
|
-
}, _ref3 => {
|
|
5130
|
+
}, (_ref3) => {
|
|
5154
5131
|
let {
|
|
5155
5132
|
width
|
|
5156
5133
|
} = _ref3;
|
|
@@ -5175,7 +5152,7 @@ const ScaleRuler = () => {
|
|
|
5175
5152
|
}, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
|
|
5176
5153
|
};
|
|
5177
5154
|
|
|
5178
|
-
const Zoom = _ref => {
|
|
5155
|
+
const Zoom = (_ref) => {
|
|
5179
5156
|
let {
|
|
5180
5157
|
children
|
|
5181
5158
|
} = _ref;
|
|
@@ -5224,7 +5201,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
|
|
|
5224
5201
|
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));
|
|
5225
5202
|
};
|
|
5226
5203
|
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"])));
|
|
5227
|
-
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 => {
|
|
5204
|
+
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) => {
|
|
5228
5205
|
let {
|
|
5229
5206
|
placement,
|
|
5230
5207
|
distance = '0.5rem',
|
|
@@ -5232,7 +5209,7 @@ const TooltipComponent = /*#__PURE__*/styled.div(_templateObject11$1 || (_templa
|
|
|
5232
5209
|
cornerSize = '0.25rem'
|
|
5233
5210
|
} = _ref;
|
|
5234
5211
|
return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
|
|
5235
|
-
}, _ref2 => {
|
|
5212
|
+
}, (_ref2) => {
|
|
5236
5213
|
let {
|
|
5237
5214
|
withArrow
|
|
5238
5215
|
} = _ref2;
|
|
@@ -5246,7 +5223,7 @@ const {
|
|
|
5246
5223
|
Consumer
|
|
5247
5224
|
} = /*#__PURE__*/createContext([]); // TODO I just cant read that
|
|
5248
5225
|
|
|
5249
|
-
const Tooltip = _ref => {
|
|
5226
|
+
const Tooltip = (_ref) => {
|
|
5250
5227
|
let {
|
|
5251
5228
|
features = [],
|
|
5252
5229
|
map,
|
|
@@ -5285,7 +5262,7 @@ const Noop = () => React.createElement("div", {
|
|
|
5285
5262
|
}
|
|
5286
5263
|
});
|
|
5287
5264
|
|
|
5288
|
-
const DraggableMarker = _ref => {
|
|
5265
|
+
const DraggableMarker = (_ref) => {
|
|
5289
5266
|
let {
|
|
5290
5267
|
position,
|
|
5291
5268
|
onChange,
|
|
@@ -5299,5 +5276,20 @@ const DraggableMarker = _ref => {
|
|
|
5299
5276
|
return React.createElement(Fragment, null);
|
|
5300
5277
|
};
|
|
5301
5278
|
|
|
5279
|
+
const polygonCircleFromPoint = (center, diameter) => {
|
|
5280
|
+
const coordinates = [];
|
|
5281
|
+
const radius = diameter / 2;
|
|
5282
|
+
const endAngle = Math.PI * 2;
|
|
5283
|
+
const step = Math.max(Math.PI / 2 / radius, endAngle / 128);
|
|
5284
|
+
let start = 0;
|
|
5285
|
+
let end = endAngle;
|
|
5286
|
+
|
|
5287
|
+
for (let ang = start; ang < end; ang += step) {
|
|
5288
|
+
coordinates.push([Math.cos(ang) * radius + center[0], Math.sin(ang) * radius + center[1]]);
|
|
5289
|
+
}
|
|
5290
|
+
|
|
5291
|
+
return [coordinates];
|
|
5292
|
+
};
|
|
5293
|
+
|
|
5302
5294
|
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, useMapState, useMapView, useMapViewActions, useMapWrapper, useMaxMinScale, useMetersToPixels, useMetersToPixelsCb, useMount, useProperty, useScale, useSymbol, useTooltip, useTooltipContext, useUpdate, useUpdateMapView };
|
|
5303
5295
|
//# sourceMappingURL=react.esm.js.map
|