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