@evergis/react 2.0.71 → 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/core/classification/types.d.ts +2 -2
- package/dist/react.cjs.development.js +1900 -1905
- 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 +1901 -1906
- package/dist/react.esm.js.map +1 -1
- package/package.json +10 -10
|
@@ -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;
|
|
@@ -969,30 +961,33 @@ const unClassify = symbol => Object.entries(symbol).reduce((flatSymbol, _ref) =>
|
|
|
969
961
|
}, {});
|
|
970
962
|
|
|
971
963
|
const printRangeClass = (value, index) => {
|
|
972
|
-
|
|
964
|
+
var _value$attribute, _value$attribute2;
|
|
965
|
+
|
|
966
|
+
const isDouble = Boolean(((_value$attribute = value.attribute) == null ? void 0 : _value$attribute.type) === 'Double');
|
|
967
|
+
const isDate = Boolean(((_value$attribute2 = value.attribute) == null ? void 0 : _value$attribute2.type) === 'DateTime');
|
|
973
968
|
const {
|
|
974
969
|
from,
|
|
975
970
|
to
|
|
976
|
-
} = getRangeValues(value, isDouble, index);
|
|
971
|
+
} = getRangeValues(value, isDouble, isDate, index);
|
|
977
972
|
|
|
978
973
|
if (from === null) {
|
|
979
|
-
return to + "
|
|
974
|
+
return to + " " + (isDate ? 'и до' : 'и менее');
|
|
980
975
|
}
|
|
981
976
|
|
|
982
977
|
if (to === null) {
|
|
983
|
-
return "
|
|
978
|
+
return (isDate ? 'после' : 'более') + " " + from;
|
|
984
979
|
}
|
|
985
980
|
|
|
986
981
|
return from === to ? "" + from : from + " - " + to;
|
|
987
982
|
};
|
|
988
983
|
|
|
989
|
-
function getRangeValues(_ref, isDouble, index) {
|
|
984
|
+
function getRangeValues(_ref, isDouble, isDate, index) {
|
|
990
985
|
let {
|
|
991
986
|
from,
|
|
992
987
|
to
|
|
993
988
|
} = _ref;
|
|
994
989
|
return {
|
|
995
|
-
from: from !== null && index !== 0 ? isDouble ? +from : +from + 1 : from,
|
|
990
|
+
from: from !== null && index !== 0 ? isDate ? from : isDouble ? +from : +from + 1 : from,
|
|
996
991
|
to
|
|
997
992
|
};
|
|
998
993
|
}
|
|
@@ -1038,7 +1033,7 @@ const getFeatureAttributeType = attributeValue => {
|
|
|
1038
1033
|
};
|
|
1039
1034
|
const getLayerAttributes = layerDefinition => {
|
|
1040
1035
|
const attributes = layerDefinition && layerDefinition.attributes || {};
|
|
1041
|
-
return Object.entries(attributes).map(_ref => {
|
|
1036
|
+
return Object.entries(attributes).map((_ref) => {
|
|
1042
1037
|
let [name, definition] = _ref;
|
|
1043
1038
|
return _extends({
|
|
1044
1039
|
name
|
|
@@ -1046,7 +1041,7 @@ const getLayerAttributes = layerDefinition => {
|
|
|
1046
1041
|
});
|
|
1047
1042
|
};
|
|
1048
1043
|
const getFeatureAttributes = attributes => {
|
|
1049
|
-
return attributes ? Object.entries(attributes).map(_ref2 => {
|
|
1044
|
+
return attributes ? Object.entries(attributes).map((_ref2) => {
|
|
1050
1045
|
let [name, value] = _ref2;
|
|
1051
1046
|
return {
|
|
1052
1047
|
name,
|
|
@@ -1064,7 +1059,7 @@ const getClassificationAttribute = (attributeName, attributes) => {
|
|
|
1064
1059
|
return attribute ? _extends({}, attrNamePart, attribute) : attrNamePart;
|
|
1065
1060
|
};
|
|
1066
1061
|
const mergeAttributes = (attributes1, attributes2) => {
|
|
1067
|
-
return attributes1.map(attribute => _extends({}, attribute, attributes2.find(_ref3 => {
|
|
1062
|
+
return attributes1.map(attribute => _extends({}, attribute, attributes2.find((_ref3) => {
|
|
1068
1063
|
let {
|
|
1069
1064
|
name
|
|
1070
1065
|
} = _ref3;
|
|
@@ -1479,7 +1474,7 @@ let SGisPolygonSymbol = /*#__PURE__*/function (_sPolygonSymbol) {
|
|
|
1479
1474
|
const adaptMiterRings = (rings, resolution, fromCrs, toCrs) => {
|
|
1480
1475
|
const projected = geotools.projectRings(rings, fromCrs, toCrs);
|
|
1481
1476
|
return math.simplifyCoordinates(projected.map(ring => // @ts-ignore
|
|
1482
|
-
ring.map(_ref => {
|
|
1477
|
+
ring.map((_ref) => {
|
|
1483
1478
|
let [x, y] = _ref;
|
|
1484
1479
|
return [x / resolution, y / -resolution];
|
|
1485
1480
|
})), 1);
|
|
@@ -1571,1965 +1566,1625 @@ let ArrowLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
|
1571
1566
|
return ArrowLineMiterRender;
|
|
1572
1567
|
}(LineMiterRender);
|
|
1573
1568
|
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
length: formatLength
|
|
1577
|
-
};
|
|
1578
|
-
|
|
1579
|
-
const COORD_FRACTION = 6;
|
|
1580
|
-
const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
|
|
1581
|
-
let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
|
|
1582
|
-
_inherits(BaseMeasureToolCreator, _PolylineControl);
|
|
1583
|
-
|
|
1584
|
-
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
|
|
1569
|
+
let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1570
|
+
_inherits(CircleLineMiterRender, _LineMiterRender);
|
|
1585
1571
|
|
|
1586
|
-
|
|
1587
|
-
var _this;
|
|
1572
|
+
var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
|
|
1588
1573
|
|
|
1589
|
-
|
|
1574
|
+
function CircleLineMiterRender() {
|
|
1575
|
+
_classCallCheck(this, CircleLineMiterRender);
|
|
1590
1576
|
|
|
1591
|
-
|
|
1577
|
+
return _super.apply(this, arguments);
|
|
1578
|
+
}
|
|
1592
1579
|
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
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
|
+
}]);
|
|
1596
1603
|
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
1600
|
-
_this.areaSymbol = params.areaSymbol;
|
|
1604
|
+
return CircleLineMiterRender;
|
|
1605
|
+
}(LineMiterRender);
|
|
1601
1606
|
|
|
1602
|
-
|
|
1607
|
+
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1608
|
+
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1603
1609
|
|
|
1610
|
+
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1604
1611
|
|
|
1605
|
-
|
|
1612
|
+
function SquareLineMiterRender() {
|
|
1613
|
+
_classCallCheck(this, SquareLineMiterRender);
|
|
1606
1614
|
|
|
1607
|
-
return
|
|
1615
|
+
return _super.apply(this, arguments);
|
|
1608
1616
|
}
|
|
1609
1617
|
|
|
1610
|
-
_createClass(
|
|
1611
|
-
key: "
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
this.drawPointOnMouseMove(event);
|
|
1618
|
+
_createClass(SquareLineMiterRender, [{
|
|
1619
|
+
key: "usageSize",
|
|
1620
|
+
get: function get() {
|
|
1621
|
+
return this.miterSize + this.strokeWidth;
|
|
1616
1622
|
}
|
|
1617
1623
|
}, {
|
|
1618
|
-
key: "
|
|
1619
|
-
value: function
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
this.addTempLabel();
|
|
1623
|
-
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]]];
|
|
1624
1628
|
}
|
|
1625
1629
|
}, {
|
|
1626
|
-
key: "
|
|
1627
|
-
value: function
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
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
|
+
});
|
|
1635
1642
|
}
|
|
1636
|
-
}
|
|
1637
|
-
key: "handlePointAdd",
|
|
1638
|
-
value: function handlePointAdd() {
|
|
1639
|
-
const feature = this.activeFeature;
|
|
1640
|
-
if (!feature) return;
|
|
1641
|
-
const {
|
|
1642
|
-
rings,
|
|
1643
|
-
crs
|
|
1644
|
-
} = feature;
|
|
1643
|
+
}]);
|
|
1645
1644
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
this.fire(new Control.DrawingFinishEvent(feature, new MouseEvent('mouseup')));
|
|
1649
|
-
return;
|
|
1650
|
-
}
|
|
1645
|
+
return SquareLineMiterRender;
|
|
1646
|
+
}(LineMiterRender);
|
|
1651
1647
|
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
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]];
|
|
1663
1675
|
}
|
|
1664
|
-
}, {
|
|
1665
|
-
key: "polygonPreview",
|
|
1666
|
-
value: function polygonPreview() {
|
|
1667
|
-
if (this.tempPolygon) {
|
|
1668
|
-
this._tempLayer && this._tempLayer.remove(this.tempPolygon);
|
|
1669
|
-
}
|
|
1670
1676
|
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
crs
|
|
1676
|
-
} = feature;
|
|
1677
|
-
const polygonRings = [...rings[0]];
|
|
1678
|
-
polygonRings.shift();
|
|
1679
|
-
this.tempPolygon = new Polygon.Polygon(polygonRings, {
|
|
1680
|
-
crs
|
|
1681
|
-
});
|
|
1682
|
-
this.tempPolygon.symbol = this.areaSymbol || measureAreaSymbol;
|
|
1683
|
-
this.activeFeature && this.activeFeature.hide();
|
|
1684
|
-
this._tempLayer && this._tempLayer.add(this.tempPolygon);
|
|
1677
|
+
const nextCoordinates = reversedRing[i - 1];
|
|
1678
|
+
|
|
1679
|
+
if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
|
|
1680
|
+
reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
|
|
1685
1681
|
}
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1682
|
+
}
|
|
1683
|
+
|
|
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]];
|
|
1693
1695
|
}
|
|
1694
|
-
}, {
|
|
1695
|
-
key: "updateDistance",
|
|
1696
|
-
value: function updateDistance(event) {
|
|
1697
|
-
const feature = this.activeFeature;
|
|
1698
|
-
const {
|
|
1699
|
-
ringIndex,
|
|
1700
|
-
pointIndex
|
|
1701
|
-
} = event;
|
|
1702
|
-
if (!feature || ringIndex === null || pointIndex === null) return;
|
|
1703
|
-
const {
|
|
1704
|
-
rings,
|
|
1705
|
-
crs
|
|
1706
|
-
} = feature;
|
|
1707
|
-
const position = rings[ringIndex][pointIndex];
|
|
1708
|
-
const length = geotools.length(rings, crs);
|
|
1709
|
-
let content = this.formatters.length(length);
|
|
1710
1696
|
|
|
1711
|
-
|
|
1712
|
-
this.polygonPreview();
|
|
1713
|
-
const area = geotools.area(rings, crs);
|
|
1714
|
-
content = this.formatters.polygon(area, length);
|
|
1715
|
-
} else if (this.tempPolygon) {
|
|
1716
|
-
feature.show();
|
|
1717
|
-
this.removeTempPolygon();
|
|
1718
|
-
}
|
|
1697
|
+
const prevCoordinates = newRing[i - 1];
|
|
1719
1698
|
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
this.measureResultLabel.content = content;
|
|
1723
|
-
}
|
|
1699
|
+
if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
|
|
1700
|
+
newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
|
|
1724
1701
|
}
|
|
1725
|
-
}
|
|
1726
|
-
key: "addTempLabel",
|
|
1727
|
-
value: function addTempLabel() {
|
|
1728
|
-
this.tempLabel = new Label.LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
1729
|
-
content: 'Нажмите на карту, чтобы начать измерение',
|
|
1730
|
-
crs: this.map.crs,
|
|
1731
|
-
symbol: createLabelSymbol({
|
|
1732
|
-
renderLabel: this.renderLabelSymbol
|
|
1733
|
-
})
|
|
1734
|
-
});
|
|
1735
|
-
this._tempLayer && this._tempLayer.add(this.tempLabel);
|
|
1736
|
-
}
|
|
1737
|
-
}, {
|
|
1738
|
-
key: "addCoordLabel",
|
|
1739
|
-
value: function addCoordLabel(content, position) {
|
|
1740
|
-
this.coordLabel = new Label.LabelFeature(position, {
|
|
1741
|
-
content,
|
|
1742
|
-
crs: this.map.crs,
|
|
1743
|
-
symbol: createLabelSymbol({
|
|
1744
|
-
renderLabel: this.renderLabelSymbol,
|
|
1745
|
-
onClose: this.cancel
|
|
1746
|
-
})
|
|
1747
|
-
});
|
|
1748
|
-
this._tempLayer && this.coordLabel && this._tempLayer.add(this.coordLabel);
|
|
1749
|
-
}
|
|
1750
|
-
}, {
|
|
1751
|
-
key: "addMeasureResultLabel",
|
|
1752
|
-
value: function addMeasureResultLabel() {
|
|
1753
|
-
this.measureResultLabel = new Label.LabelFeature(DEFAULT_LABEL_POSITION, {
|
|
1754
|
-
crs: this.map.crs,
|
|
1755
|
-
symbol: createLabelSymbol({
|
|
1756
|
-
renderLabel: this.renderLabelSymbol
|
|
1757
|
-
})
|
|
1758
|
-
});
|
|
1759
|
-
this._tempLayer && this.measureResultLabel && this._tempLayer.add(this.measureResultLabel);
|
|
1760
|
-
}
|
|
1761
|
-
}, {
|
|
1762
|
-
key: "removeTempLabel",
|
|
1763
|
-
value: function removeTempLabel() {
|
|
1764
|
-
if (this.tempLabel) {
|
|
1765
|
-
this._tempLayer && this._tempLayer.remove(this.tempLabel);
|
|
1766
|
-
delete this.tempLabel;
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
}, {
|
|
1770
|
-
key: "removeCoordLabel",
|
|
1771
|
-
value: function removeCoordLabel() {
|
|
1772
|
-
if (this.coordLabel) {
|
|
1773
|
-
this._tempLayer && this._tempLayer.remove(this.coordLabel);
|
|
1774
|
-
delete this.coordLabel;
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
}, {
|
|
1778
|
-
key: "removeMeasureLabel",
|
|
1779
|
-
value: function removeMeasureLabel() {
|
|
1780
|
-
if (this.measureResultLabel) {
|
|
1781
|
-
this._tempLayer && this._tempLayer.remove(this.measureResultLabel);
|
|
1782
|
-
delete this.measureResultLabel;
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
}, {
|
|
1786
|
-
key: "drawPointOnMouseMove",
|
|
1787
|
-
value: function drawPointOnMouseMove(event) {
|
|
1788
|
-
if (this.tempLabel) {
|
|
1789
|
-
this.tempLabel.position = event.point.position;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
}, {
|
|
1793
|
-
key: "setCursor",
|
|
1794
|
-
value: function setCursor(cursor) {
|
|
1795
|
-
const {
|
|
1796
|
-
wrapper
|
|
1797
|
-
} = this.painter;
|
|
1702
|
+
}
|
|
1798
1703
|
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1704
|
+
return newRing;
|
|
1705
|
+
};
|
|
1706
|
+
|
|
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);
|
|
1802
1715
|
}
|
|
1803
|
-
}
|
|
1716
|
+
});
|
|
1717
|
+
};
|
|
1804
1718
|
|
|
1805
|
-
|
|
1806
|
-
|
|
1719
|
+
const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
|
|
1720
|
+
let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
|
|
1721
|
+
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
1807
1722
|
|
|
1808
|
-
|
|
1809
|
-
_inherits(BaseMeasureToolEditor, _PolyEditor);
|
|
1723
|
+
var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
|
|
1810
1724
|
|
|
1811
|
-
|
|
1725
|
+
function SGisPolylineSymbol(originalSymbol) {
|
|
1726
|
+
var _originalSymbol$strok, _originalSymbol$strok2;
|
|
1812
1727
|
|
|
1813
|
-
function BaseMeasureToolEditor(map, painter, params) {
|
|
1814
1728
|
var _this;
|
|
1815
1729
|
|
|
1816
|
-
_classCallCheck(this,
|
|
1730
|
+
_classCallCheck(this, SGisPolylineSymbol);
|
|
1817
1731
|
|
|
1818
|
-
_this = _super.call(this,
|
|
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
|
+
}
|
|
1819
1745
|
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
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);
|
|
1823
1750
|
const {
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
const
|
|
1830
|
-
const
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
position
|
|
1836
|
-
|
|
1837
|
-
|
|
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
|
|
1766
|
+
});
|
|
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
|
|
1775
|
+
});
|
|
1838
1776
|
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
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);
|
|
1782
|
+
}
|
|
1842
1783
|
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
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: линия должна быть в начале чтобы быть под митерами
|
|
1846
1790
|
|
|
1847
|
-
_this.on('change', _this.updateMeasureResult);
|
|
1848
1791
|
|
|
1849
|
-
|
|
1792
|
+
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
1793
|
+
return renders;
|
|
1794
|
+
}
|
|
1795
|
+
}, {
|
|
1796
|
+
key: "clone",
|
|
1797
|
+
value: function clone() {
|
|
1798
|
+
return new SGisPolylineSymbol(this.originalSymbol);
|
|
1799
|
+
}
|
|
1800
|
+
}]);
|
|
1801
|
+
|
|
1802
|
+
return SGisPolylineSymbol;
|
|
1803
|
+
}(PolylineSymbol.PolylineSymbol);
|
|
1804
|
+
|
|
1805
|
+
let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
|
|
1806
|
+
_inherits(LabelSymbol, _DynamicPointSymbol);
|
|
1807
|
+
|
|
1808
|
+
var _super = /*#__PURE__*/_createSuper(LabelSymbol);
|
|
1809
|
+
|
|
1810
|
+
function LabelSymbol(_temp) {
|
|
1811
|
+
var _this;
|
|
1812
|
+
|
|
1813
|
+
let {
|
|
1814
|
+
component,
|
|
1815
|
+
offset
|
|
1816
|
+
} = _temp === void 0 ? {} : _temp;
|
|
1817
|
+
|
|
1818
|
+
_classCallCheck(this, LabelSymbol);
|
|
1850
1819
|
|
|
1820
|
+
_this = _super.call(this, {
|
|
1821
|
+
offset
|
|
1822
|
+
});
|
|
1823
|
+
_this.component = component;
|
|
1851
1824
|
return _this;
|
|
1852
1825
|
}
|
|
1853
1826
|
|
|
1854
|
-
_createClass(
|
|
1855
|
-
key: "
|
|
1856
|
-
value: function
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
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;
|
|
1860
1833
|
}
|
|
1861
1834
|
}, {
|
|
1862
|
-
key: "
|
|
1863
|
-
value: function
|
|
1864
|
-
|
|
1865
|
-
if (measureResult === null) return;
|
|
1866
|
-
const {
|
|
1867
|
-
content,
|
|
1868
|
-
position
|
|
1869
|
-
} = measureResult;
|
|
1870
|
-
this.measureResultLabel = new Label.LabelFeature(position, {
|
|
1871
|
-
content,
|
|
1872
|
-
crs: this.map.crs,
|
|
1873
|
-
symbol: createLabelSymbol({
|
|
1874
|
-
onClose: this.removeFeature,
|
|
1875
|
-
renderLabel: this.renderLabelSymbol
|
|
1876
|
-
})
|
|
1877
|
-
});
|
|
1878
|
-
this._tempLayer && this._tempLayer.add(this.measureResultLabel);
|
|
1835
|
+
key: "_updateFeatureNode",
|
|
1836
|
+
value: function _updateFeatureNode(feature) {
|
|
1837
|
+
this.renderDom(feature.content, this.getNode(feature));
|
|
1879
1838
|
}
|
|
1880
1839
|
}, {
|
|
1881
|
-
key: "
|
|
1882
|
-
value: function
|
|
1883
|
-
if (
|
|
1884
|
-
|
|
1885
|
-
if (measureResult === null) return;
|
|
1886
|
-
const {
|
|
1887
|
-
content,
|
|
1888
|
-
position
|
|
1889
|
-
} = measureResult;
|
|
1890
|
-
this.measureResultLabel.content = content;
|
|
1891
|
-
this.measureResultLabel.position = position;
|
|
1840
|
+
key: "renderDom",
|
|
1841
|
+
value: function renderDom(content, node) {
|
|
1842
|
+
if (!node) {
|
|
1843
|
+
return;
|
|
1892
1844
|
}
|
|
1893
|
-
}
|
|
1894
|
-
}]);
|
|
1895
1845
|
|
|
1896
|
-
|
|
1897
|
-
}(PolyEditor.PolyEditor);
|
|
1898
|
-
|
|
1899
|
-
const metersToPixels = (meters, _ref) => {
|
|
1900
|
-
let {
|
|
1901
|
-
painter,
|
|
1902
|
-
crs = Crs.geo
|
|
1903
|
-
} = _ref;
|
|
1904
|
-
const {
|
|
1905
|
-
width
|
|
1906
|
-
} = painter;
|
|
1907
|
-
const zeroPoint = painter.getPointFromPxPosition(0, 0).projectTo(crs);
|
|
1908
|
-
const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
|
|
1909
|
-
const widthDistance = geotools.distance(zeroPoint, maxWidthPoint);
|
|
1910
|
-
const pxK = width / (widthDistance || 1);
|
|
1911
|
-
return Math.round(meters * pxK);
|
|
1912
|
-
};
|
|
1846
|
+
const Component = this.component;
|
|
1913
1847
|
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1848
|
+
if (Component) {
|
|
1849
|
+
ReactDOM.render(React__default.createElement(Component, {
|
|
1850
|
+
content: content
|
|
1851
|
+
}), node);
|
|
1852
|
+
} else {
|
|
1853
|
+
node.innerText = content;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
}]);
|
|
1921
1857
|
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
}
|
|
1858
|
+
return LabelSymbol;
|
|
1859
|
+
}(_Symbol.DynamicPointSymbol);
|
|
1925
1860
|
|
|
1926
|
-
|
|
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
|
+
});
|
|
1927
1885
|
};
|
|
1928
1886
|
|
|
1929
|
-
|
|
1930
|
-
|
|
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
|
+
}
|
|
1931
1924
|
|
|
1932
|
-
|
|
1925
|
+
let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
|
|
1926
|
+
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
1933
1927
|
|
|
1934
|
-
|
|
1935
|
-
_classCallCheck(this, CircleLineMiterRender);
|
|
1928
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
|
|
1936
1929
|
|
|
1937
|
-
|
|
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);
|
|
1938
1935
|
}
|
|
1939
1936
|
|
|
1940
|
-
_createClass(
|
|
1941
|
-
key: "
|
|
1942
|
-
|
|
1943
|
-
|
|
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];
|
|
1944
1948
|
}
|
|
1945
1949
|
}, {
|
|
1946
|
-
key: "
|
|
1947
|
-
value: function
|
|
1948
|
-
|
|
1949
|
-
return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
|
|
1950
|
+
key: "getShadow",
|
|
1951
|
+
value: function getShadow(position, _feature) {
|
|
1952
|
+
return ShadowedPointSymbol.getShadowArc(position, this);
|
|
1950
1953
|
}
|
|
1951
1954
|
}, {
|
|
1952
|
-
key: "
|
|
1953
|
-
value: function
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
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,
|
|
1959
1972
|
enclosed: true
|
|
1960
1973
|
});
|
|
1961
1974
|
}
|
|
1962
|
-
}]);
|
|
1963
|
-
|
|
1964
|
-
return CircleLineMiterRender;
|
|
1965
|
-
}(LineMiterRender);
|
|
1966
|
-
|
|
1967
|
-
let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
|
|
1968
|
-
_inherits(SquareLineMiterRender, _LineMiterRender);
|
|
1969
|
-
|
|
1970
|
-
var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
|
|
1971
|
-
|
|
1972
|
-
function SquareLineMiterRender() {
|
|
1973
|
-
_classCallCheck(this, SquareLineMiterRender);
|
|
1974
|
-
|
|
1975
|
-
return _super.apply(this, arguments);
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1978
|
-
_createClass(SquareLineMiterRender, [{
|
|
1979
|
-
key: "usageSize",
|
|
1980
|
-
get: function get() {
|
|
1981
|
-
return this.miterSize + this.strokeWidth;
|
|
1982
|
-
}
|
|
1983
1975
|
}, {
|
|
1984
|
-
key: "
|
|
1985
|
-
value: function
|
|
1986
|
-
let
|
|
1987
|
-
|
|
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
|
+
});
|
|
1988
1990
|
}
|
|
1989
1991
|
}, {
|
|
1990
|
-
key: "
|
|
1991
|
-
value: function
|
|
1992
|
-
const
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
fillColor: isFilled ? this.color : void 0,
|
|
1996
|
-
fillStyle: isFilled ? Poly.FillStyle.Color : Poly.FillStyle.None,
|
|
1997
|
-
lineCap: 'square',
|
|
1998
|
-
lineJoin: 'miter',
|
|
1999
|
-
strokeColor: this.color,
|
|
2000
|
-
strokeWidth: this.strokeWidth
|
|
2001
|
-
});
|
|
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];
|
|
2002
1997
|
}
|
|
2003
1998
|
}]);
|
|
2004
1999
|
|
|
2005
|
-
return
|
|
2006
|
-
}(
|
|
2000
|
+
return ShadowedPointSymbol;
|
|
2001
|
+
}(Point.PointSymbol);
|
|
2007
2002
|
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
case exports.LineMiterKind.Arrow:
|
|
2011
|
-
case exports.LineMiterKind.FilledArrow:
|
|
2012
|
-
return new ArrowLineMiterRender(options);
|
|
2003
|
+
let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
|
|
2004
|
+
_inherits(ShadowedPolySymbol, _PolylineSymbol);
|
|
2013
2005
|
|
|
2014
|
-
|
|
2015
|
-
case exports.LineMiterKind.FilledSquare:
|
|
2016
|
-
return new SquareLineMiterRender(options);
|
|
2006
|
+
var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
|
|
2017
2007
|
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2008
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2009
|
+
function ShadowedPolySymbol(options) {
|
|
2010
|
+
_classCallCheck(this, ShadowedPolySymbol);
|
|
2021
2011
|
|
|
2022
|
-
|
|
2023
|
-
return null;
|
|
2012
|
+
return _super.call(this, options);
|
|
2024
2013
|
}
|
|
2025
|
-
};
|
|
2026
2014
|
|
|
2027
|
-
|
|
2028
|
-
|
|
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];
|
|
2029
2024
|
|
|
2030
|
-
|
|
2031
|
-
|
|
2025
|
+
if (shadowRender) {
|
|
2026
|
+
renders = [shadowRender, polyRender];
|
|
2027
|
+
}
|
|
2032
2028
|
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
const nextCoordinates = reversedRing[i - 1];
|
|
2029
|
+
if (vertexRenders) {
|
|
2030
|
+
renders = renders.concat(vertexRenders);
|
|
2031
|
+
}
|
|
2038
2032
|
|
|
2039
|
-
|
|
2040
|
-
reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
|
|
2033
|
+
return renders;
|
|
2041
2034
|
}
|
|
2042
|
-
}
|
|
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
|
+
});
|
|
2045
|
+
}
|
|
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
|
+
});
|
|
2057
|
+
}
|
|
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
|
+
}]);
|
|
2043
2075
|
|
|
2044
|
-
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)'
|
|
2045
2083
|
};
|
|
2084
|
+
const measureSymbolParams = {
|
|
2085
|
+
strokeColor: '#ff6933',
|
|
2086
|
+
shadowSize: 0,
|
|
2087
|
+
vertexShadowSize: 0
|
|
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
|
+
}));
|
|
2046
2110
|
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
for (let i = 0; i < newRing.length; i++) {
|
|
2051
|
-
const coordinates = newRing[i];
|
|
2111
|
+
let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
|
|
2112
|
+
_inherits(SelectedPointSymbol, _ShadowedPointSymbol);
|
|
2052
2113
|
|
|
2053
|
-
|
|
2054
|
-
newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
|
|
2055
|
-
}
|
|
2114
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
|
|
2056
2115
|
|
|
2057
|
-
|
|
2116
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2117
|
+
function SelectedPointSymbol(props) {
|
|
2118
|
+
_classCallCheck(this, SelectedPointSymbol);
|
|
2058
2119
|
|
|
2059
|
-
|
|
2060
|
-
newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
|
|
2061
|
-
}
|
|
2120
|
+
return _super.call(this, props);
|
|
2062
2121
|
}
|
|
2063
2122
|
|
|
2064
|
-
|
|
2065
|
-
|
|
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);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
}, {
|
|
2131
|
+
key: "getPoint",
|
|
2132
|
+
value: function getPoint(position, feature) {
|
|
2133
|
+
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2066
2134
|
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
|
|
2135
|
+
if (feature.isSelected) {
|
|
2136
|
+
pointRender.strokeColor = this.selectedStrokeColor;
|
|
2137
|
+
pointRender.fillColor = this.selectedFillColor;
|
|
2138
|
+
}
|
|
2072
2139
|
|
|
2073
|
-
|
|
2074
|
-
return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
|
|
2140
|
+
return pointRender;
|
|
2075
2141
|
}
|
|
2076
|
-
});
|
|
2077
|
-
};
|
|
2078
|
-
|
|
2079
|
-
const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
|
|
2080
|
-
let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
|
|
2081
|
-
_inherits(SGisPolylineSymbol, _sPolylineSymbol);
|
|
2142
|
+
}]);
|
|
2082
2143
|
|
|
2083
|
-
|
|
2144
|
+
return SelectedPointSymbol;
|
|
2145
|
+
}(ShadowedPointSymbol);
|
|
2084
2146
|
|
|
2085
|
-
|
|
2086
|
-
|
|
2147
|
+
let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
|
|
2148
|
+
_inherits(SelectedPolySymbol, _ShadowedPolySymbol);
|
|
2087
2149
|
|
|
2088
|
-
|
|
2150
|
+
var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
|
|
2089
2151
|
|
|
2090
|
-
|
|
2152
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
2153
|
+
function SelectedPolySymbol(props) {
|
|
2154
|
+
_classCallCheck(this, SelectedPolySymbol);
|
|
2091
2155
|
|
|
2092
|
-
|
|
2093
|
-
// @ts-ignore
|
|
2094
|
-
strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
|
|
2095
|
-
strokeWidth: clamp( // @ts-ignore
|
|
2096
|
-
getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
|
|
2097
|
-
// @ts-ignore
|
|
2098
|
-
lineDash: getLineDash(originalSymbol.stroke),
|
|
2099
|
-
// @ts-ignore
|
|
2100
|
-
lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
|
|
2101
|
-
});
|
|
2102
|
-
_this.originalSymbol = originalSymbol;
|
|
2103
|
-
return _this;
|
|
2156
|
+
return _super.call(this, props);
|
|
2104
2157
|
}
|
|
2105
2158
|
|
|
2106
|
-
_createClass(
|
|
2107
|
-
key: "
|
|
2108
|
-
value: function
|
|
2109
|
-
if (
|
|
2110
|
-
|
|
2111
|
-
ending,
|
|
2112
|
-
beginningSize,
|
|
2113
|
-
beginning,
|
|
2114
|
-
endingSize
|
|
2115
|
-
} = this.originalSymbol;
|
|
2116
|
-
const renders = [];
|
|
2117
|
-
const featureCopy = feature.clone();
|
|
2118
|
-
const beginningMiterRender = getLineMiterRender({
|
|
2119
|
-
color: this.strokeColor,
|
|
2120
|
-
// @ts-ignore
|
|
2121
|
-
kind: beginning,
|
|
2122
|
-
position: 'left',
|
|
2123
|
-
// @ts-ignore
|
|
2124
|
-
size: beginningSize,
|
|
2125
|
-
strokeWidth: this.strokeWidth
|
|
2126
|
-
});
|
|
2127
|
-
const endingMiterRender = getLineMiterRender({
|
|
2128
|
-
color: this.strokeColor,
|
|
2129
|
-
// @ts-ignore
|
|
2130
|
-
kind: ending,
|
|
2131
|
-
position: 'right',
|
|
2132
|
-
// @ts-ignore
|
|
2133
|
-
size: endingSize,
|
|
2134
|
-
strokeWidth: this.strokeWidth
|
|
2135
|
-
});
|
|
2136
|
-
|
|
2137
|
-
if (beginningMiterRender) {
|
|
2138
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
|
|
2139
|
-
const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2140
|
-
featureCopy.rings = updatedRings;
|
|
2141
|
-
renders.push(render);
|
|
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);
|
|
2142
2164
|
}
|
|
2143
|
-
|
|
2144
|
-
if (endingMiterRender) {
|
|
2145
|
-
const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
|
|
2146
|
-
const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
|
|
2147
|
-
featureCopy.rings = updatedRings;
|
|
2148
|
-
renders.push(render);
|
|
2149
|
-
} // NOTE: линия должна быть в начале чтобы быть под митерами
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
|
|
2153
|
-
return renders;
|
|
2154
2165
|
}
|
|
2155
2166
|
}, {
|
|
2156
|
-
key: "
|
|
2157
|
-
value: function
|
|
2158
|
-
|
|
2159
|
-
}
|
|
2160
|
-
}]);
|
|
2161
|
-
|
|
2162
|
-
return SGisPolylineSymbol;
|
|
2163
|
-
}(PolylineSymbol.PolylineSymbol);
|
|
2164
|
-
|
|
2165
|
-
let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
|
|
2166
|
-
_inherits(LabelSymbol, _DynamicPointSymbol);
|
|
2167
|
-
|
|
2168
|
-
var _super = /*#__PURE__*/_createSuper(LabelSymbol);
|
|
2167
|
+
key: "getPolyRender",
|
|
2168
|
+
value: function getPolyRender(coordinates, feature) {
|
|
2169
|
+
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2169
2170
|
|
|
2170
|
-
|
|
2171
|
-
|
|
2171
|
+
if (feature.isSelected) {
|
|
2172
|
+
polyRender.fillColor = this.selectedFillColor;
|
|
2173
|
+
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2172
2174
|
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2175
|
+
if (this.selectedStrokeWidth !== void 0) {
|
|
2176
|
+
polyRender.strokeWidth = this.selectedStrokeWidth;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2177
2179
|
|
|
2178
|
-
|
|
2180
|
+
return polyRender;
|
|
2181
|
+
}
|
|
2182
|
+
}]);
|
|
2179
2183
|
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
});
|
|
2183
|
-
_this.component = component;
|
|
2184
|
-
return _this;
|
|
2185
|
-
}
|
|
2184
|
+
return SelectedPolySymbol;
|
|
2185
|
+
}(ShadowedPolySymbol);
|
|
2186
2186
|
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
}
|
|
2216
|
-
}]);
|
|
2217
|
-
|
|
2218
|
-
return LabelSymbol;
|
|
2219
|
-
}(_Symbol.DynamicPointSymbol);
|
|
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
|
+
});
|
|
2220
2215
|
|
|
2221
|
-
const
|
|
2222
|
-
|
|
2216
|
+
const metersToPixels = (meters, _ref) => {
|
|
2217
|
+
let {
|
|
2218
|
+
painter,
|
|
2219
|
+
crs = Crs.geo
|
|
2220
|
+
} = _ref;
|
|
2223
2221
|
const {
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
onClose = undefined
|
|
2232
|
-
} = props || {};
|
|
2233
|
-
return new LabelSymbol({
|
|
2234
|
-
offset,
|
|
2235
|
-
component: _ref2 => {
|
|
2236
|
-
let {
|
|
2237
|
-
content
|
|
2238
|
-
} = _ref2;
|
|
2239
|
-
return renderLabel({
|
|
2240
|
-
content,
|
|
2241
|
-
onClose
|
|
2242
|
-
});
|
|
2243
|
-
}
|
|
2244
|
-
});
|
|
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);
|
|
2245
2229
|
};
|
|
2246
2230
|
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
const shadowDiameter = size + strokeWidth + shadowSize;
|
|
2255
|
-
return new Poly.PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
|
|
2256
|
-
fillColor: 'transparent',
|
|
2257
|
-
strokeColor: shadowColor,
|
|
2258
|
-
strokeWidth: shadowSize,
|
|
2259
|
-
enclosed: true
|
|
2260
|
-
});
|
|
2261
|
-
}
|
|
2262
|
-
function getEditorPointRenderer(position, _ref2) {
|
|
2263
|
-
let {
|
|
2264
|
-
strokeColor,
|
|
2265
|
-
strokeWidth,
|
|
2266
|
-
shadowColor,
|
|
2267
|
-
fillColor,
|
|
2268
|
-
shadowSize,
|
|
2269
|
-
size = 0
|
|
2270
|
-
} = _ref2;
|
|
2271
|
-
return [createShadowRender(position, {
|
|
2272
|
-
strokeWidth,
|
|
2273
|
-
strokeColor,
|
|
2274
|
-
shadowSize,
|
|
2275
|
-
shadowColor,
|
|
2276
|
-
size
|
|
2277
|
-
}), new Poly.PolyRender(polygonCircleFromPoint(position, size), {
|
|
2278
|
-
fillColor,
|
|
2279
|
-
strokeColor,
|
|
2280
|
-
strokeWidth,
|
|
2281
|
-
enclosed: true
|
|
2282
|
-
})];
|
|
2283
|
-
}
|
|
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);
|
|
2284
2238
|
|
|
2285
|
-
|
|
2286
|
-
_inherits(ShadowedPointSymbol, _PointSymbol);
|
|
2239
|
+
var _super = /*#__PURE__*/_createSuper(SVGPoly);
|
|
2287
2240
|
|
|
2288
|
-
|
|
2241
|
+
function SVGPoly(_temp) {
|
|
2242
|
+
var _this;
|
|
2289
2243
|
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2244
|
+
let {
|
|
2245
|
+
redrawFeatureNode,
|
|
2246
|
+
pathStyles,
|
|
2247
|
+
circle,
|
|
2248
|
+
className,
|
|
2249
|
+
appendToSvg
|
|
2250
|
+
} = _temp === void 0 ? {} : _temp;
|
|
2293
2251
|
|
|
2294
|
-
|
|
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;
|
|
2295
2266
|
}
|
|
2296
2267
|
|
|
2297
|
-
_createClass(
|
|
2268
|
+
_createClass(SVGPoly, [{
|
|
2298
2269
|
key: "renderFunction",
|
|
2299
2270
|
value: function renderFunction(feature, resolution, crs) {
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
value: function getPoint(position, _feature) {
|
|
2317
|
-
return ShadowedPointSymbol.getPointArc(position, this);
|
|
2318
|
-
}
|
|
2319
|
-
}], [{
|
|
2320
|
-
key: "getShadowArc",
|
|
2321
|
-
value: function getShadowArc(position, _ref) {
|
|
2322
|
-
let {
|
|
2323
|
-
strokeWidth = 2,
|
|
2324
|
-
shadowColor,
|
|
2325
|
-
shadowSize,
|
|
2326
|
-
size = 6
|
|
2327
|
-
} = _ref;
|
|
2328
|
-
return new Poly.PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
|
|
2329
|
-
fillColor: 'transparent',
|
|
2330
|
-
strokeColor: shadowColor,
|
|
2331
|
-
strokeWidth: shadowSize,
|
|
2332
|
-
enclosed: true
|
|
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
|
+
}
|
|
2333
2287
|
});
|
|
2288
|
+
|
|
2289
|
+
this._setEventListeners(feature);
|
|
2290
|
+
|
|
2291
|
+
return [feature.__dynamicSymbolRender];
|
|
2334
2292
|
}
|
|
2335
2293
|
}, {
|
|
2336
|
-
key: "
|
|
2337
|
-
value: function
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
strokeColor,
|
|
2347
|
-
strokeWidth,
|
|
2348
|
-
enclosed: true
|
|
2349
|
-
});
|
|
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
|
+
}
|
|
2350
2304
|
}
|
|
2351
2305
|
}, {
|
|
2352
|
-
key: "
|
|
2353
|
-
value: function
|
|
2354
|
-
|
|
2355
|
-
const pointRender = ShadowedPointSymbol.getPointArc(position, params);
|
|
2356
|
-
return shadowRender ? [shadowRender, pointRender] : [pointRender];
|
|
2357
|
-
}
|
|
2358
|
-
}]);
|
|
2306
|
+
key: "update",
|
|
2307
|
+
value: function update(_ref) {
|
|
2308
|
+
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2359
2309
|
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
_classCallCheck(this, ShadowedPolySymbol);
|
|
2310
|
+
let {
|
|
2311
|
+
bbox,
|
|
2312
|
+
resolution,
|
|
2313
|
+
feature,
|
|
2314
|
+
crs
|
|
2315
|
+
} = _ref;
|
|
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;
|
|
2371
2320
|
|
|
2372
|
-
|
|
2373
|
-
|
|
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
|
+
}
|
|
2374
2328
|
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
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
|
+
}
|
|
2338
|
+
}, {
|
|
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));
|
|
2384
2353
|
|
|
2385
|
-
if (
|
|
2386
|
-
|
|
2354
|
+
if (this.circle) {
|
|
2355
|
+
svgRender._setArcNode();
|
|
2356
|
+
} else {
|
|
2357
|
+
svgRender._setPolyNode();
|
|
2387
2358
|
}
|
|
2388
2359
|
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
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');
|
|
2392
2365
|
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
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
|
+
}
|
|
2404
2376
|
});
|
|
2377
|
+
return svgElement;
|
|
2405
2378
|
}
|
|
2406
2379
|
}, {
|
|
2407
|
-
key: "
|
|
2408
|
-
value: function
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
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
|
+
}
|
|
2416
2395
|
});
|
|
2417
2396
|
}
|
|
2418
|
-
}, {
|
|
2419
|
-
key: "getVertexRenders",
|
|
2420
|
-
value: function getVertexRenders(coordinates) {
|
|
2421
|
-
if (!this.showVertex) return;
|
|
2422
|
-
const vertexCoordinates = coordinates.reduce((acc, curr) => {
|
|
2423
|
-
return acc.concat(curr);
|
|
2424
|
-
}, []);
|
|
2425
|
-
return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
|
|
2426
|
-
size: 6,
|
|
2427
|
-
strokeWidth: 2,
|
|
2428
|
-
shadowColor: this.shadowColor,
|
|
2429
|
-
strokeColor: this.strokeColor,
|
|
2430
|
-
shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
|
|
2431
|
-
fillColor: '#ffffff'
|
|
2432
|
-
})).reduce((acc, curr) => acc.concat(curr), []);
|
|
2433
|
-
}
|
|
2434
2397
|
}]);
|
|
2435
2398
|
|
|
2436
|
-
return
|
|
2437
|
-
}(
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2399
|
+
return SVGPoly;
|
|
2400
|
+
}(_Symbol.Symbol);
|
|
2401
|
+
|
|
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
|
+
}
|
|
2414
|
+
|
|
2415
|
+
/**
|
|
2416
|
+
* Моки фич для отображения превью символа
|
|
2417
|
+
* http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
|
|
2418
|
+
*/
|
|
2419
|
+
|
|
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
|
|
2443
2441
|
};
|
|
2444
|
-
const
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
vertexShadowSize: 0
|
|
2442
|
+
const LEGEND_FEATURES = {
|
|
2443
|
+
polyline: lineLegendFeature,
|
|
2444
|
+
polygon: polygonLegendFeature
|
|
2448
2445
|
};
|
|
2449
|
-
const
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
|
|
2454
|
-
fillColor: 'rgba(255, 105, 51, 0.25)',
|
|
2455
|
-
enclose: true,
|
|
2456
|
-
showVertex: true
|
|
2457
|
-
}));
|
|
2458
|
-
const snapSymbolParams = {
|
|
2459
|
-
size: 10,
|
|
2460
|
-
strokeWidth: 2,
|
|
2461
|
-
strokeColor: '#e33600',
|
|
2462
|
-
fillColor: '#ffffff',
|
|
2463
|
-
shadowColor: 'rgba(227, 54, 0, 0.3)',
|
|
2464
|
-
shadowSize: 3
|
|
2446
|
+
const MOCK_FEATURES = {
|
|
2447
|
+
point: pointFeature,
|
|
2448
|
+
polyline: lineFeature,
|
|
2449
|
+
polygon: polygonFeature
|
|
2465
2450
|
};
|
|
2466
|
-
const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
|
|
2467
|
-
strokeColor: '#ff6933',
|
|
2468
|
-
shadowSize: 0
|
|
2469
|
-
}));
|
|
2470
2451
|
|
|
2471
|
-
|
|
2472
|
-
|
|
2452
|
+
function getSymbolRenders(symbol, size, features) {
|
|
2453
|
+
if (size === void 0) {
|
|
2454
|
+
size = viewBoxSize;
|
|
2455
|
+
}
|
|
2473
2456
|
|
|
2474
|
-
|
|
2457
|
+
if (features === void 0) {
|
|
2458
|
+
features = {};
|
|
2459
|
+
}
|
|
2475
2460
|
|
|
2476
|
-
|
|
2477
|
-
function SelectedPointSymbol(props) {
|
|
2478
|
-
_classCallCheck(this, SelectedPointSymbol);
|
|
2461
|
+
const resolution = viewBoxSize / size;
|
|
2479
2462
|
|
|
2480
|
-
|
|
2463
|
+
const featuresToRender = _extends({}, MOCK_FEATURES, features);
|
|
2464
|
+
|
|
2465
|
+
if (isSGisPolygonSymbol(symbol)) {
|
|
2466
|
+
return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, Crs.plain);
|
|
2481
2467
|
}
|
|
2482
2468
|
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
if (feature.isSelected) {
|
|
2487
|
-
return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
|
|
2488
|
-
}
|
|
2489
|
-
}
|
|
2490
|
-
}, {
|
|
2491
|
-
key: "getPoint",
|
|
2492
|
-
value: function getPoint(position, feature) {
|
|
2493
|
-
const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
|
|
2469
|
+
if (isSGisPolylineSymbol(symbol)) {
|
|
2470
|
+
return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, Crs.plain);
|
|
2471
|
+
}
|
|
2494
2472
|
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
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
|
+
}
|
|
2499
2479
|
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2480
|
+
return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
|
|
2481
|
+
};
|
|
2482
|
+
const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
|
|
2483
|
+
if (size === void 0) {
|
|
2484
|
+
size = viewBoxSize;
|
|
2485
|
+
}
|
|
2503
2486
|
|
|
2504
|
-
return
|
|
2505
|
-
}
|
|
2487
|
+
return getSymbolRenders(symbol, size, LEGEND_FEATURES);
|
|
2488
|
+
};
|
|
2506
2489
|
|
|
2507
|
-
|
|
2508
|
-
|
|
2490
|
+
function renderSymbolToCanvas(renders, canvas) {
|
|
2491
|
+
renders.forEach(render => {
|
|
2492
|
+
canvas.draw(render);
|
|
2493
|
+
});
|
|
2494
|
+
}
|
|
2509
2495
|
|
|
2510
|
-
|
|
2496
|
+
function deserializeSymbol(symbol) {
|
|
2497
|
+
switch (symbol.type) {
|
|
2498
|
+
case 'circlePointSymbol':
|
|
2499
|
+
return deserializePointSymbol(symbol);
|
|
2511
2500
|
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
_classCallCheck(this, SelectedPolySymbol);
|
|
2501
|
+
case 'squarePointSymbol':
|
|
2502
|
+
return deserializeSquareSymbol(symbol);
|
|
2515
2503
|
|
|
2516
|
-
|
|
2517
|
-
|
|
2504
|
+
case 'maskedImagePointSymbol':
|
|
2505
|
+
return deserializeMaskedImageSymbol(symbol);
|
|
2518
2506
|
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
value: function getShadow(coordinates, feature) {
|
|
2522
|
-
if (feature.isSelected) {
|
|
2523
|
-
return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
|
|
2524
|
-
}
|
|
2525
|
-
}
|
|
2526
|
-
}, {
|
|
2527
|
-
key: "getPolyRender",
|
|
2528
|
-
value: function getPolyRender(coordinates, feature) {
|
|
2529
|
-
const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
|
|
2507
|
+
case 'imagePointSymbol':
|
|
2508
|
+
return deserializeImagePointSymbol(symbol);
|
|
2530
2509
|
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
polyRender.strokeColor = this.selectedStrokeColor;
|
|
2510
|
+
case 'polygonSymbol':
|
|
2511
|
+
return deserializePolygonSymbol(symbol);
|
|
2534
2512
|
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
}
|
|
2513
|
+
case 'simplePolylineSymbol':
|
|
2514
|
+
case 'polylineSymbol':
|
|
2515
|
+
return deserializePolylineSymbol(symbol);
|
|
2539
2516
|
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
}
|
|
2517
|
+
default:
|
|
2518
|
+
return null;
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2543
2521
|
|
|
2544
|
-
|
|
2545
|
-
|
|
2522
|
+
function deserializePointSymbol(symbol) {
|
|
2523
|
+
// @ts-ignore
|
|
2524
|
+
return new Point.PointSymbol(deserializePointSymbolParams(symbol));
|
|
2525
|
+
}
|
|
2546
2526
|
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
shadowSize: 3,
|
|
2554
|
-
selectedStrokeColor: '#ff5722',
|
|
2555
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.65)'
|
|
2556
|
-
});
|
|
2557
|
-
const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
|
|
2558
|
-
strokeWidth: 6,
|
|
2559
|
-
strokeColor: 'rgba(255, 87, 34, 0.2)',
|
|
2560
|
-
shadowSize: 8,
|
|
2561
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2562
|
-
selectedStrokeColor: '#ff5722',
|
|
2563
|
-
selectedStrokeWidth: 2
|
|
2564
|
-
});
|
|
2565
|
-
const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
|
|
2566
|
-
strokeWidth: 2,
|
|
2567
|
-
strokeColor: 'rgba(255, 87, 34, 0.3)',
|
|
2568
|
-
shadowSize: 8,
|
|
2569
|
-
shadowColor: 'rgba(255, 87, 34, 0.3)',
|
|
2570
|
-
fillColor: 'rgba(255, 255, 255, 0.36)',
|
|
2571
|
-
enclose: true,
|
|
2572
|
-
selectedFillColor: 'rgba(255, 255, 255, 0.56)',
|
|
2573
|
-
selectedStrokeColor: '#ff5722'
|
|
2574
|
-
});
|
|
2527
|
+
function deserializeSquareSymbol(symbol) {
|
|
2528
|
+
return new Square.SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
|
|
2529
|
+
// @ts-ignore
|
|
2530
|
+
angle: getParameterValue(symbol.angle)
|
|
2531
|
+
}));
|
|
2532
|
+
}
|
|
2575
2533
|
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
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
|
+
}
|
|
2583
2552
|
|
|
2584
|
-
|
|
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
|
+
}
|
|
2585
2567
|
|
|
2586
|
-
|
|
2587
|
-
|
|
2568
|
+
function deserializePolygonSymbol(symbol) {
|
|
2569
|
+
if (isPolygonHasPatternBrush(symbol)) {
|
|
2570
|
+
return new SGisImageFill(symbol);
|
|
2571
|
+
}
|
|
2588
2572
|
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
circle,
|
|
2593
|
-
className,
|
|
2594
|
-
appendToSvg
|
|
2595
|
-
} = _temp === void 0 ? {} : _temp;
|
|
2573
|
+
if (isPolygonHasHatchBrush(symbol)) {
|
|
2574
|
+
return new SGisBrushFill(symbol);
|
|
2575
|
+
}
|
|
2596
2576
|
|
|
2597
|
-
|
|
2577
|
+
return new SGisPolygonSymbol(symbol);
|
|
2578
|
+
}
|
|
2598
2579
|
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
_this.redrawFeatureNode = redrawFeatureNode;
|
|
2603
|
-
_this.pathStyles = _extends({
|
|
2604
|
-
center: [0, 0],
|
|
2605
|
-
fillColor: 'none'
|
|
2606
|
-
}, pathStyles);
|
|
2607
|
-
_this.circle = circle;
|
|
2608
|
-
_this.className = className;
|
|
2609
|
-
_this.appendToSvg = appendToSvg;
|
|
2610
|
-
return _this;
|
|
2611
|
-
}
|
|
2580
|
+
function deserializePolylineSymbol(symbol) {
|
|
2581
|
+
return new SGisPolylineSymbol(symbol);
|
|
2582
|
+
}
|
|
2612
2583
|
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
redraw: () => {
|
|
2630
|
-
this.redrawFeatureNode && this.redrawFeatureNode(feature);
|
|
2631
|
-
}
|
|
2632
|
-
});
|
|
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
|
+
}
|
|
2633
2600
|
|
|
2634
|
-
|
|
2601
|
+
function deserializeBase64(base) {
|
|
2602
|
+
return "data:image/png;base64," + base;
|
|
2603
|
+
}
|
|
2635
2604
|
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
value: function setCirclePxRaius(crs) {
|
|
2641
|
-
if (this.circle && this.pathStyles) {
|
|
2642
|
-
var _this$circle;
|
|
2605
|
+
function deserializeAnchor(offset) {
|
|
2606
|
+
// @ts-ignore
|
|
2607
|
+
return offset.map(getParameterValue);
|
|
2608
|
+
}
|
|
2643
2609
|
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
}) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
}, {
|
|
2651
|
-
key: "update",
|
|
2652
|
-
value: function update(_ref) {
|
|
2653
|
-
var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
|
|
2610
|
+
function deserializeColor(color$1) {
|
|
2611
|
+
return color$1 ? new color.Color(color$1).toString() : null;
|
|
2612
|
+
}
|
|
2654
2613
|
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
if (!bbox) bbox = feature.__lastBbox;
|
|
2663
|
-
if (!resolution) resolution = feature.__lastResolution;
|
|
2664
|
-
if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
|
|
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
|
+
}
|
|
2665
2621
|
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
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
|
+
}
|
|
2673
2630
|
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
}
|
|
2683
|
-
}, {
|
|
2684
|
-
key: "setSvg",
|
|
2685
|
-
value: function setSvg(coordinates) {
|
|
2686
|
-
const {
|
|
2687
|
-
lineCap,
|
|
2688
|
-
lineJoin,
|
|
2689
|
-
miterLimit,
|
|
2690
|
-
lineDash,
|
|
2691
|
-
dashOffset
|
|
2692
|
-
} = this.pathStyles || {};
|
|
2693
|
-
const svgRender = new SvgRender.SvgRender(_extends({
|
|
2694
|
-
coordinates
|
|
2695
|
-
}, defaultPathStyles, {
|
|
2696
|
-
appendToSvg: this.appendToSvg
|
|
2697
|
-
}, this.pathStyles));
|
|
2631
|
+
return symbol;
|
|
2632
|
+
}
|
|
2633
|
+
const adjustSymbol = (symbol, _ref) => {
|
|
2634
|
+
let {
|
|
2635
|
+
size
|
|
2636
|
+
} = _ref;
|
|
2637
|
+
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
2638
|
+
};
|
|
2698
2639
|
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
svgRender._setPolyNode();
|
|
2703
|
-
}
|
|
2640
|
+
let EvergisFeature = /*#__PURE__*/function () {
|
|
2641
|
+
function EvergisFeature(feature) {
|
|
2642
|
+
_classCallCheck(this, EvergisFeature);
|
|
2704
2643
|
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
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
|
+
}
|
|
2710
2658
|
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2659
|
+
_createClass(EvergisFeature, [{
|
|
2660
|
+
key: "sGisFeature",
|
|
2661
|
+
value: function sGisFeature() {
|
|
2662
|
+
if (!this.geometry || !this.symbol) {
|
|
2663
|
+
return null;
|
|
2664
|
+
} // @ts-ignore
|
|
2716
2665
|
|
|
2717
|
-
if (this.circle) {
|
|
2718
|
-
path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
|
|
2719
|
-
}
|
|
2720
|
-
}
|
|
2721
|
-
});
|
|
2722
|
-
return svgElement;
|
|
2723
|
-
}
|
|
2724
|
-
}, {
|
|
2725
|
-
key: "_setEventListeners",
|
|
2726
|
-
value: function _setEventListeners(dynamicFeature) {
|
|
2727
|
-
var _dynamicFeature$__dyn;
|
|
2728
2666
|
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
node: svgNode,
|
|
2736
|
-
browserEvent: event
|
|
2737
|
-
});
|
|
2738
|
-
});
|
|
2739
|
-
}
|
|
2740
|
-
});
|
|
2741
|
-
}
|
|
2742
|
-
}]);
|
|
2667
|
+
const {
|
|
2668
|
+
type,
|
|
2669
|
+
coordinates,
|
|
2670
|
+
sr
|
|
2671
|
+
} = this.geometry;
|
|
2672
|
+
const crs = CRS_MAP[sr];
|
|
2743
2673
|
|
|
2744
|
-
|
|
2745
|
-
|
|
2674
|
+
if (!crs) {
|
|
2675
|
+
return null;
|
|
2676
|
+
}
|
|
2746
2677
|
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
}
|
|
2753
|
-
function isSGisPolygonSymbol(symbol) {
|
|
2754
|
-
return symbol instanceof Simple.PolygonSymbol || symbol instanceof BrushFill.BrushFill || symbol instanceof ImageFill.ImageFill;
|
|
2755
|
-
}
|
|
2756
|
-
function isSGisPolylineSymbol(symbol) {
|
|
2757
|
-
return symbol instanceof PolylineSymbol.PolylineSymbol;
|
|
2758
|
-
}
|
|
2678
|
+
switch (type) {
|
|
2679
|
+
case api.GeometryType.Point:
|
|
2680
|
+
return new PointFeature.PointFeature(coordinates, {
|
|
2681
|
+
symbol: selectedPoint,
|
|
2682
|
+
crs
|
|
2683
|
+
});
|
|
2759
2684
|
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2685
|
+
case api.GeometryType.Multipoint:
|
|
2686
|
+
return new MultiPoint.MultiPoint(coordinates, {
|
|
2687
|
+
symbol: selectedPoint,
|
|
2688
|
+
crs
|
|
2689
|
+
});
|
|
2764
2690
|
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
crs: Crs.plain
|
|
2771
|
-
});
|
|
2772
|
-
const polygonFeature = /*#__PURE__*/new Polygon.Polygon([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
|
|
2773
|
-
crs: Crs.plain
|
|
2774
|
-
});
|
|
2775
|
-
const lineLegendFeature = /*#__PURE__*/new Polyline.Polyline([[0, -50], [100, -50]], {
|
|
2776
|
-
crs: Crs.plain
|
|
2777
|
-
});
|
|
2778
|
-
const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
|
|
2779
|
-
crs: Crs.plain
|
|
2780
|
-
});
|
|
2781
|
-
const polygonMapLegendFeature = /*#__PURE__*/new Polygon.Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
|
|
2782
|
-
crs: Crs.plain
|
|
2783
|
-
});
|
|
2784
|
-
const MAP_LEGEND_FEATURES = {
|
|
2785
|
-
polygon: polygonMapLegendFeature
|
|
2786
|
-
};
|
|
2787
|
-
const LEGEND_FEATURES = {
|
|
2788
|
-
polyline: lineLegendFeature,
|
|
2789
|
-
polygon: polygonLegendFeature
|
|
2790
|
-
};
|
|
2791
|
-
const MOCK_FEATURES = {
|
|
2792
|
-
point: pointFeature,
|
|
2793
|
-
polyline: lineFeature,
|
|
2794
|
-
polygon: polygonFeature
|
|
2795
|
-
};
|
|
2691
|
+
case api.GeometryType.Polyline:
|
|
2692
|
+
return new Polyline.Polyline(coordinates, {
|
|
2693
|
+
symbol: selectedPolyline,
|
|
2694
|
+
crs
|
|
2695
|
+
});
|
|
2796
2696
|
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2697
|
+
case api.GeometryType.Polygon:
|
|
2698
|
+
return new Polygon.Polygon(coordinates, {
|
|
2699
|
+
symbol: selectedPolygon,
|
|
2700
|
+
crs
|
|
2701
|
+
});
|
|
2801
2702
|
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
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
|
+
}]);
|
|
2805
2714
|
|
|
2806
|
-
|
|
2715
|
+
return EvergisFeature;
|
|
2716
|
+
}();
|
|
2807
2717
|
|
|
2808
|
-
|
|
2718
|
+
function evaluateCondition(condition$1, attributes) {
|
|
2719
|
+
try {
|
|
2720
|
+
const evaluator = new condition.ConditionEvaluator(attributes);
|
|
2721
|
+
const result = evaluator.evaluate(condition$1);
|
|
2809
2722
|
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2723
|
+
if (result instanceof Error) {
|
|
2724
|
+
return null;
|
|
2725
|
+
}
|
|
2813
2726
|
|
|
2814
|
-
|
|
2815
|
-
|
|
2727
|
+
return result;
|
|
2728
|
+
} catch (_unused) {
|
|
2729
|
+
return null;
|
|
2816
2730
|
}
|
|
2731
|
+
}
|
|
2817
2732
|
|
|
2818
|
-
|
|
2733
|
+
function getAttributeValue(attributes, attributeName) {
|
|
2734
|
+
const attributeMeta = attributes.find((_ref) => {
|
|
2735
|
+
let {
|
|
2736
|
+
name
|
|
2737
|
+
} = _ref;
|
|
2738
|
+
return name === attributeName;
|
|
2739
|
+
});
|
|
2740
|
+
return attributeMeta ? attributeMeta.value : null;
|
|
2819
2741
|
}
|
|
2820
|
-
const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
|
|
2821
|
-
if (size === void 0) {
|
|
2822
|
-
size = viewBoxSize;
|
|
2823
|
-
}
|
|
2824
2742
|
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
|
|
2828
|
-
if (size === void 0) {
|
|
2829
|
-
size = viewBoxSize;
|
|
2830
|
-
}
|
|
2743
|
+
const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
|
|
2744
|
+
const getAttributeNameFromClassified = values => values.length > 0 ? getAttributeNameFromCondition(values[0].condition) : null;
|
|
2831
2745
|
|
|
2832
|
-
|
|
2833
|
-
|
|
2746
|
+
function findFeatureValue(parameterValues, _ref2) {
|
|
2747
|
+
let [name, value] = _ref2;
|
|
2748
|
+
return value !== null ? parameterValues.find((_ref3) => {
|
|
2749
|
+
let {
|
|
2750
|
+
condition
|
|
2751
|
+
} = _ref3;
|
|
2752
|
+
return value !== undefined && evaluateCondition(condition, {
|
|
2753
|
+
[name]: value
|
|
2754
|
+
});
|
|
2755
|
+
}) : null;
|
|
2756
|
+
}
|
|
2834
2757
|
|
|
2835
|
-
function
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2758
|
+
function extractValuesAttribute(parameterValues, attributes) {
|
|
2759
|
+
const name = getAttributeNameFromClassified(parameterValues) || '';
|
|
2760
|
+
const value = name && getAttributeValue(attributes, name);
|
|
2761
|
+
return [name, value];
|
|
2839
2762
|
}
|
|
2840
2763
|
|
|
2841
|
-
function
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2764
|
+
function evaluateFeatureSymbol(attributes) {
|
|
2765
|
+
// @ts-ignore
|
|
2766
|
+
function calc(result, _ref4) {
|
|
2767
|
+
let [parameterName, parameterValue] = _ref4;
|
|
2768
|
+
let newParameterValue;
|
|
2845
2769
|
|
|
2846
|
-
|
|
2847
|
-
|
|
2770
|
+
if (isParameterByAttribute(parameterValue)) {
|
|
2771
|
+
const [attributeName, attributeValue] = extractValuesAttribute(parameterValue.values, attributes);
|
|
2772
|
+
const featureValue = findFeatureValue(parameterValue.values, [attributeName, attributeValue]);
|
|
2773
|
+
newParameterValue = featureValue ? featureValue.value : parameterValue.defaultValue;
|
|
2774
|
+
} else if (isObject(parameterValue)) {
|
|
2775
|
+
// @ts-ignore
|
|
2776
|
+
newParameterValue = Object.entries(parameterValue).reduce(calc, parameterValue);
|
|
2777
|
+
}
|
|
2848
2778
|
|
|
2849
|
-
|
|
2850
|
-
|
|
2779
|
+
return newParameterValue !== undefined ? _extends({}, result, {
|
|
2780
|
+
[parameterName]: newParameterValue
|
|
2781
|
+
}) : result;
|
|
2782
|
+
}
|
|
2851
2783
|
|
|
2852
|
-
|
|
2853
|
-
|
|
2784
|
+
return calc;
|
|
2785
|
+
}
|
|
2854
2786
|
|
|
2855
|
-
|
|
2856
|
-
|
|
2787
|
+
function findChildFeatureStyle(childStyles, attributes) {
|
|
2788
|
+
return (childStyles || []).find((_ref5) => {
|
|
2789
|
+
let {
|
|
2790
|
+
condition
|
|
2791
|
+
} = _ref5;
|
|
2792
|
+
const attributeName = condition && getAttributeNameFromCondition(condition);
|
|
2793
|
+
const attributeValue = attributeName && getAttributeValue(attributes, attributeName);
|
|
2857
2794
|
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2795
|
+
if (condition && attributeName && attributeValue !== undefined) {
|
|
2796
|
+
return evaluateCondition(condition, {
|
|
2797
|
+
[attributeName]: attributeValue
|
|
2798
|
+
});
|
|
2799
|
+
}
|
|
2861
2800
|
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
}
|
|
2801
|
+
return false;
|
|
2802
|
+
}) || null;
|
|
2865
2803
|
}
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
return new Point.PointSymbol(deserializePointSymbolParams(symbol));
|
|
2804
|
+
function findChildFeatureSymbol(childStyles, attributes) {
|
|
2805
|
+
const featureStyle = findChildFeatureStyle(childStyles, attributes);
|
|
2806
|
+
return featureStyle ? featureStyle.symbol : null;
|
|
2870
2807
|
}
|
|
2808
|
+
function getFeatureSymbol(style, attributes) {
|
|
2809
|
+
if (!style || !style.symbol) {
|
|
2810
|
+
return null;
|
|
2811
|
+
}
|
|
2871
2812
|
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
angle: getParameterValue(symbol.angle)
|
|
2876
|
-
}));
|
|
2877
|
-
}
|
|
2813
|
+
if (style.children !== null) {
|
|
2814
|
+
return findChildFeatureSymbol(style.children, attributes) || style.symbol;
|
|
2815
|
+
}
|
|
2878
2816
|
|
|
2879
|
-
|
|
2880
|
-
return new MaskedImage.MaskedImage(_extends({}, symbol, {
|
|
2881
|
-
// @ts-ignore
|
|
2882
|
-
angle: getParameterValue(symbol.angle),
|
|
2883
|
-
// @ts-ignore
|
|
2884
|
-
width: getParameterValue(symbol.width),
|
|
2885
|
-
// @ts-ignore
|
|
2886
|
-
height: getParameterValue(symbol.height),
|
|
2887
|
-
// @ts-ignore
|
|
2888
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2889
|
-
// @ts-ignore
|
|
2890
|
-
imageSource: deserializeBase64(symbol.image),
|
|
2891
|
-
// @ts-ignore
|
|
2892
|
-
maskSource: deserializeBase64(symbol.imageMask),
|
|
2893
|
-
// @ts-ignore
|
|
2894
|
-
maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
|
|
2895
|
-
}));
|
|
2817
|
+
return Object.entries(style.symbol).reduce(evaluateFeatureSymbol(attributes), style.symbol);
|
|
2896
2818
|
}
|
|
2897
2819
|
|
|
2898
|
-
function
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
angle: getParameterValue(symbol.angle),
|
|
2902
|
-
// @ts-ignore
|
|
2903
|
-
width: getParameterValue(symbol.width),
|
|
2904
|
-
// @ts-ignore
|
|
2905
|
-
height: getParameterValue(symbol.height),
|
|
2906
|
-
// @ts-ignore
|
|
2907
|
-
anchorPoint: deserializeAnchor(symbol.offset),
|
|
2908
|
-
// @ts-ignore
|
|
2909
|
-
source: deserializeBase64(symbol.image)
|
|
2910
|
-
}));
|
|
2911
|
-
}
|
|
2820
|
+
let EvergisLayer = /*#__PURE__*/function () {
|
|
2821
|
+
function EvergisLayer(service) {
|
|
2822
|
+
_classCallCheck(this, EvergisLayer);
|
|
2912
2823
|
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2824
|
+
this.name = null;
|
|
2825
|
+
this.titleAttribute = null;
|
|
2826
|
+
this.alias = null;
|
|
2827
|
+
this.attributes = null;
|
|
2828
|
+
this.style = null;
|
|
2829
|
+
const evergisService = service;
|
|
2830
|
+
const {
|
|
2831
|
+
name,
|
|
2832
|
+
alias,
|
|
2833
|
+
style,
|
|
2834
|
+
layerDefinition
|
|
2835
|
+
} = evergisService;
|
|
2836
|
+
this.name = name;
|
|
2837
|
+
this.alias = alias || name;
|
|
2838
|
+
this.attributes = getLayerAttributes(layerDefinition);
|
|
2839
|
+
this.style = style && new EvergisStyle(style) || null;
|
|
2840
|
+
this.titleAttribute = layerDefinition && layerDefinition.titleAttribute || null;
|
|
2916
2841
|
}
|
|
2917
2842
|
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2843
|
+
_createClass(EvergisLayer, [{
|
|
2844
|
+
key: "evaluateFeature",
|
|
2845
|
+
value: function evaluateFeature(feature) {
|
|
2846
|
+
feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
|
|
2847
|
+
feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
|
|
2848
|
+
feature.layerAlias = this.alias;
|
|
2849
|
+
const titleAttribute = (feature.attributes || []).find((_ref) => {
|
|
2850
|
+
let {
|
|
2851
|
+
name
|
|
2852
|
+
} = _ref;
|
|
2853
|
+
return name === this.titleAttribute;
|
|
2854
|
+
});
|
|
2855
|
+
const displayName = titleAttribute && formatAttributeValue(titleAttribute)[0].value || feature.id;
|
|
2856
|
+
feature.displayName = displayName ? "" + displayName : feature.id;
|
|
2857
|
+
return feature;
|
|
2858
|
+
}
|
|
2859
|
+
}]);
|
|
2921
2860
|
|
|
2922
|
-
return
|
|
2923
|
-
}
|
|
2861
|
+
return EvergisLayer;
|
|
2862
|
+
}();
|
|
2924
2863
|
|
|
2925
|
-
|
|
2926
|
-
return new SGisPolylineSymbol(symbol);
|
|
2927
|
-
}
|
|
2864
|
+
const findFeatureLayer = feature => layer => layer.name === feature.layerName;
|
|
2928
2865
|
|
|
2929
|
-
|
|
2866
|
+
const evaluateFeature = layers => feature => {
|
|
2867
|
+
const featureLayer = layers.find(findFeatureLayer(feature));
|
|
2868
|
+
return featureLayer ? featureLayer.evaluateFeature(feature) : feature;
|
|
2869
|
+
};
|
|
2870
|
+
|
|
2871
|
+
const OTHERS_TITLE = 'Другое';
|
|
2872
|
+
const createLegendItem = (_ref) => {
|
|
2930
2873
|
let {
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
fillColor
|
|
2874
|
+
attributes,
|
|
2875
|
+
renderTitle,
|
|
2876
|
+
skipDefaultValue,
|
|
2877
|
+
reverse
|
|
2936
2878
|
} = _ref;
|
|
2937
|
-
return {
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2879
|
+
return classification => {
|
|
2880
|
+
const {
|
|
2881
|
+
defaultTitle,
|
|
2882
|
+
defaultValue,
|
|
2883
|
+
values,
|
|
2884
|
+
attribute: attributeName,
|
|
2885
|
+
parameter
|
|
2886
|
+
} = classification;
|
|
2887
|
+
const attribute = attributeName && attributes ? getClassificationAttribute(attributeName, attributes) : undefined;
|
|
2888
|
+
const defaultLegendValue = {
|
|
2889
|
+
title: defaultTitle || OTHERS_TITLE,
|
|
2890
|
+
parameterValue: defaultValue
|
|
2891
|
+
};
|
|
2892
|
+
const legendValues = values.map((value, index) => ({
|
|
2893
|
+
title: renderTitle && renderTitle(_extends({}, value, {
|
|
2894
|
+
attribute
|
|
2895
|
+
}), index),
|
|
2896
|
+
parameterValue: value.parameterValue
|
|
2897
|
+
}));
|
|
2898
|
+
const withDefault = skipDefaultValue ? legendValues : [...legendValues, defaultLegendValue];
|
|
2899
|
+
const reversedValues = reverse ? [...withDefault].reverse() : withDefault;
|
|
2900
|
+
return {
|
|
2901
|
+
title: attribute && attribute.alias || attributeName,
|
|
2902
|
+
attribute,
|
|
2903
|
+
parameter,
|
|
2904
|
+
values: reversedValues
|
|
2905
|
+
};
|
|
2943
2906
|
};
|
|
2944
|
-
}
|
|
2907
|
+
};
|
|
2945
2908
|
|
|
2946
|
-
function
|
|
2947
|
-
|
|
2948
|
-
|
|
2909
|
+
function createStyleLegend(style, config) {
|
|
2910
|
+
const {
|
|
2911
|
+
classificationManager,
|
|
2912
|
+
symbol
|
|
2913
|
+
} = style;
|
|
2914
|
+
const items = classificationManager.filter((_ref) => {
|
|
2915
|
+
let {
|
|
2916
|
+
parameter
|
|
2917
|
+
} = _ref;
|
|
2918
|
+
return config.parameters && parameter ? config.parameters.includes(parameter) : true;
|
|
2919
|
+
});
|
|
2949
2920
|
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
}
|
|
2921
|
+
if (items.length === 0) {
|
|
2922
|
+
return null;
|
|
2923
|
+
}
|
|
2954
2924
|
|
|
2955
|
-
|
|
2956
|
-
|
|
2925
|
+
return {
|
|
2926
|
+
symbol: unClassify(symbol),
|
|
2927
|
+
items: items.map(createLegendItem(config))
|
|
2928
|
+
};
|
|
2957
2929
|
}
|
|
2958
2930
|
|
|
2959
|
-
|
|
2960
|
-
if (
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
}
|
|
2931
|
+
function createValueTitle(value, index) {
|
|
2932
|
+
if (value.title) return value.title;
|
|
2933
|
+
if (isRangeClass(value)) return printRangeClass(value, index);
|
|
2934
|
+
if (isUniqueClass(value)) return value.uniqueValue;
|
|
2935
|
+
return '';
|
|
2936
|
+
}
|
|
2966
2937
|
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2938
|
+
function formatArea(num) {
|
|
2939
|
+
let result = num;
|
|
2940
|
+
let measure = 'м²';
|
|
2941
|
+
|
|
2942
|
+
if (num >= 10000000) {
|
|
2943
|
+
result = num / 1000000;
|
|
2944
|
+
measure = 'км²';
|
|
2945
|
+
} else if (num >= 10000) {
|
|
2946
|
+
result = num / 10000;
|
|
2947
|
+
measure = 'га';
|
|
2974
2948
|
}
|
|
2975
2949
|
|
|
2976
|
-
return
|
|
2950
|
+
return numberWithSpaces(result) + " " + measure;
|
|
2977
2951
|
}
|
|
2978
|
-
|
|
2979
|
-
let
|
|
2980
|
-
|
|
2981
|
-
} = _ref;
|
|
2982
|
-
return centerAlignSymbol(clampSymbol(symbol, 0, size));
|
|
2983
|
-
};
|
|
2952
|
+
function formatLength(num) {
|
|
2953
|
+
let result = num;
|
|
2954
|
+
let measure = 'м';
|
|
2984
2955
|
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2956
|
+
if (num > 10000) {
|
|
2957
|
+
result = num / 1000;
|
|
2958
|
+
measure = 'км';
|
|
2959
|
+
}
|
|
2988
2960
|
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
this.displayName = feature.id;
|
|
2998
|
-
this.geometry = feature.geometry;
|
|
2999
|
-
this.layerName = feature.layer;
|
|
3000
|
-
this.layerAlias = feature.layer;
|
|
3001
|
-
this.attributes = getFeatureAttributes(feature.attributes);
|
|
2961
|
+
return numberWithSpaces(result) + " " + measure;
|
|
2962
|
+
}
|
|
2963
|
+
function formatPolygonMeasure(area, perimiter) {
|
|
2964
|
+
return "S : " + formatArea(area) + " P : " + formatLength(perimiter);
|
|
2965
|
+
}
|
|
2966
|
+
function isPolylineLikePolygon(rings, resolution) {
|
|
2967
|
+
if (rings[0].length <= 3) {
|
|
2968
|
+
return false;
|
|
3002
2969
|
}
|
|
3003
2970
|
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
2971
|
+
const coords = rings[0];
|
|
2972
|
+
const firstPoint = coords[0];
|
|
2973
|
+
const lastPoint = coords[coords.length - 1];
|
|
2974
|
+
const distance = resolution * 2;
|
|
2975
|
+
return math.softEquals(firstPoint[0], lastPoint[0], distance) && math.softEquals(firstPoint[1], lastPoint[1], distance);
|
|
2976
|
+
}
|
|
3010
2977
|
|
|
2978
|
+
function getScale(scale) {
|
|
2979
|
+
const scales = [1, 2, 5];
|
|
3011
2980
|
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
sr
|
|
3016
|
-
} = this.geometry;
|
|
3017
|
-
const crs = CRS_MAP[sr];
|
|
2981
|
+
for (let x = 0; x < 21; x++) {
|
|
2982
|
+
for (let y = 0; y < scales.length; y++) {
|
|
2983
|
+
const result = Math.pow(10, x) * scales[y];
|
|
3018
2984
|
|
|
3019
|
-
if (
|
|
3020
|
-
return
|
|
2985
|
+
if (result > scale) {
|
|
2986
|
+
return result;
|
|
3021
2987
|
}
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
3022
2990
|
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
return new PointFeature.PointFeature(coordinates, {
|
|
3026
|
-
symbol: selectedPoint,
|
|
3027
|
-
crs
|
|
3028
|
-
});
|
|
2991
|
+
return 1;
|
|
2992
|
+
}
|
|
3029
2993
|
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
});
|
|
2994
|
+
const useLegend = (style, config) => React.useMemo(() => {
|
|
2995
|
+
if (!style || !(config && config.attributes)) return null;
|
|
2996
|
+
return createStyleLegend(style, config);
|
|
2997
|
+
}, [style, config]);
|
|
3035
2998
|
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
2999
|
+
const DEFAULT_LEGEND_CONFIG = {
|
|
3000
|
+
renderTitle: createValueTitle
|
|
3001
|
+
};
|
|
3002
|
+
const useLayerLegend = (layer, config) => {
|
|
3003
|
+
const {
|
|
3004
|
+
style,
|
|
3005
|
+
layerDefinition
|
|
3006
|
+
} = layer || {};
|
|
3007
|
+
const {
|
|
3008
|
+
attributes
|
|
3009
|
+
} = layerDefinition || {};
|
|
3010
|
+
const styleProxy = style && new EvergisStyle(style);
|
|
3011
|
+
return useLegend(styleProxy, _extends({
|
|
3012
|
+
attributes: attributes
|
|
3013
|
+
}, DEFAULT_LEGEND_CONFIG, config));
|
|
3014
|
+
};
|
|
3041
3015
|
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
symbol: selectedPolygon,
|
|
3045
|
-
crs
|
|
3046
|
-
});
|
|
3016
|
+
const useMapLegend = (layer, config) => {
|
|
3017
|
+
const legend = useLayerLegend(layer, config);
|
|
3047
3018
|
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
}
|
|
3052
|
-
}, {
|
|
3053
|
-
key: "extent",
|
|
3054
|
-
value: function extent() {
|
|
3055
|
-
const feature = this.sGisFeature();
|
|
3056
|
-
return feature && feature.bbox;
|
|
3057
|
-
}
|
|
3058
|
-
}]);
|
|
3019
|
+
if (!legend) {
|
|
3020
|
+
return null;
|
|
3021
|
+
}
|
|
3059
3022
|
|
|
3060
|
-
|
|
3061
|
-
|
|
3023
|
+
const firstLegend = legend.items[0];
|
|
3024
|
+
return {
|
|
3025
|
+
symbol: legend.symbol,
|
|
3026
|
+
item: firstLegend
|
|
3027
|
+
};
|
|
3028
|
+
};
|
|
3029
|
+
|
|
3030
|
+
const LEGEND_SYMBOL_MAX_SIZE = 32;
|
|
3031
|
+
const useLegendValueSymbol = (_ref) => {
|
|
3032
|
+
let {
|
|
3033
|
+
parameter,
|
|
3034
|
+
parameterValue
|
|
3035
|
+
} = _ref;
|
|
3036
|
+
const symbol = useLegendContext();
|
|
3037
|
+
const valueSymbol = // @ts-ignore
|
|
3038
|
+
symbol && applyParameterValue(symbol, parameter, parameterValue);
|
|
3039
|
+
let sGisSymbol = null;
|
|
3062
3040
|
|
|
3063
|
-
function evaluateCondition(condition$1, attributes) {
|
|
3064
3041
|
try {
|
|
3065
|
-
|
|
3066
|
-
|
|
3042
|
+
sGisSymbol = valueSymbol && deserializeSymbol(valueSymbol);
|
|
3043
|
+
} catch (e) {}
|
|
3067
3044
|
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3045
|
+
return sGisSymbol && adjustSymbol(sGisSymbol, {
|
|
3046
|
+
size: LEGEND_SYMBOL_MAX_SIZE - 1
|
|
3047
|
+
});
|
|
3048
|
+
};
|
|
3071
3049
|
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3050
|
+
const DEFAULT_SYMBOL_SIZE = 16;
|
|
3051
|
+
function useSymbol(_ref, canvasRef) {
|
|
3052
|
+
let {
|
|
3053
|
+
symbol,
|
|
3054
|
+
size = DEFAULT_SYMBOL_SIZE,
|
|
3055
|
+
render = getSymbolRenders,
|
|
3056
|
+
maxWidth
|
|
3057
|
+
} = _ref;
|
|
3058
|
+
React.useEffect(() => {
|
|
3059
|
+
if (canvasRef.current !== null && symbol !== undefined) {
|
|
3060
|
+
const canvas = canvasRef.current;
|
|
3061
|
+
setCanvasSize(canvas, size, maxWidth);
|
|
3062
|
+
render(symbol, size).then(renders => {
|
|
3063
|
+
renderSymbolToCanvas(renders, canvas);
|
|
3064
|
+
});
|
|
3065
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3077
3066
|
|
|
3078
|
-
|
|
3079
|
-
const attributeMeta = attributes.find(_ref => {
|
|
3080
|
-
let {
|
|
3081
|
-
name
|
|
3082
|
-
} = _ref;
|
|
3083
|
-
return name === attributeName;
|
|
3084
|
-
});
|
|
3085
|
-
return attributeMeta ? attributeMeta.value : null;
|
|
3067
|
+
}, [symbol, size, maxWidth]);
|
|
3086
3068
|
}
|
|
3087
3069
|
|
|
3088
|
-
|
|
3089
|
-
|
|
3070
|
+
function setCanvasSize(canvas, size, maxWidth) {
|
|
3071
|
+
canvas.node.height = size;
|
|
3072
|
+
canvas.node.width = maxWidth ? Math.min(size, maxWidth) : size;
|
|
3073
|
+
}
|
|
3090
3074
|
|
|
3091
|
-
function
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3075
|
+
function useCanvas() {
|
|
3076
|
+
const canvas = React.useRef(null);
|
|
3077
|
+
const ref = React.useCallback(node => {
|
|
3078
|
+
if (node !== null) {
|
|
3079
|
+
canvas.current = new Canvas.Canvas(node);
|
|
3080
|
+
} else {
|
|
3081
|
+
canvas.current = null;
|
|
3082
|
+
}
|
|
3083
|
+
}, []);
|
|
3084
|
+
return {
|
|
3085
|
+
canvas,
|
|
3086
|
+
ref
|
|
3087
|
+
};
|
|
3101
3088
|
}
|
|
3102
3089
|
|
|
3103
|
-
function
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3090
|
+
function useMount(_ref) {
|
|
3091
|
+
let {
|
|
3092
|
+
onMount,
|
|
3093
|
+
onUnmount
|
|
3094
|
+
} = _ref;
|
|
3095
|
+
React.useEffect(() => {
|
|
3096
|
+
onMount && onMount();
|
|
3097
|
+
return onUnmount; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3098
|
+
}, []);
|
|
3107
3099
|
}
|
|
3108
3100
|
|
|
3109
|
-
function
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
if (isParameterByAttribute(parameterValue)) {
|
|
3116
|
-
const [attributeName, attributeValue] = extractValuesAttribute(parameterValue.values, attributes);
|
|
3117
|
-
const featureValue = findFeatureValue(parameterValue.values, [attributeName, attributeValue]);
|
|
3118
|
-
newParameterValue = featureValue ? featureValue.value : parameterValue.defaultValue;
|
|
3119
|
-
} else if (isObject(parameterValue)) {
|
|
3120
|
-
// @ts-ignore
|
|
3121
|
-
newParameterValue = Object.entries(parameterValue).reduce(calc, parameterValue);
|
|
3122
|
-
}
|
|
3101
|
+
function useProperty(_ref, deps) {
|
|
3102
|
+
let {
|
|
3103
|
+
factory,
|
|
3104
|
+
destructor,
|
|
3105
|
+
update
|
|
3106
|
+
} = _ref;
|
|
3123
3107
|
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
}) : result;
|
|
3108
|
+
if (deps === void 0) {
|
|
3109
|
+
deps = [];
|
|
3127
3110
|
}
|
|
3128
3111
|
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
condition
|
|
3136
|
-
} = _ref5;
|
|
3137
|
-
const attributeName = condition && getAttributeNameFromCondition(condition);
|
|
3138
|
-
const attributeValue = attributeName && getAttributeValue(attributes, attributeName);
|
|
3139
|
-
|
|
3140
|
-
if (condition && attributeName && attributeValue !== undefined) {
|
|
3141
|
-
return evaluateCondition(condition, {
|
|
3142
|
-
[attributeName]: attributeValue
|
|
3143
|
-
});
|
|
3112
|
+
const propRef = React.useRef();
|
|
3113
|
+
useMount({
|
|
3114
|
+
onUnmount() {
|
|
3115
|
+
if (propRef.current && destructor) {
|
|
3116
|
+
destructor(propRef.current);
|
|
3117
|
+
}
|
|
3144
3118
|
}
|
|
3145
3119
|
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
return Object.entries(style.symbol).reduce(evaluateFeatureSymbol(attributes), style.symbol);
|
|
3163
|
-
}
|
|
3164
|
-
|
|
3165
|
-
let EvergisLayer = /*#__PURE__*/function () {
|
|
3166
|
-
function EvergisLayer(service) {
|
|
3167
|
-
_classCallCheck(this, EvergisLayer);
|
|
3168
|
-
|
|
3169
|
-
this.name = null;
|
|
3170
|
-
this.titleAttribute = null;
|
|
3171
|
-
this.alias = null;
|
|
3172
|
-
this.attributes = null;
|
|
3173
|
-
this.style = null;
|
|
3174
|
-
const evergisService = service;
|
|
3175
|
-
const {
|
|
3176
|
-
name,
|
|
3177
|
-
alias,
|
|
3178
|
-
style,
|
|
3179
|
-
layerDefinition
|
|
3180
|
-
} = evergisService;
|
|
3181
|
-
this.name = name;
|
|
3182
|
-
this.alias = alias || name;
|
|
3183
|
-
this.attributes = getLayerAttributes(layerDefinition);
|
|
3184
|
-
this.style = style && new EvergisStyle(style) || null;
|
|
3185
|
-
this.titleAttribute = layerDefinition && layerDefinition.titleAttribute || null;
|
|
3186
|
-
}
|
|
3187
|
-
|
|
3188
|
-
_createClass(EvergisLayer, [{
|
|
3189
|
-
key: "evaluateFeature",
|
|
3190
|
-
value: function evaluateFeature(feature) {
|
|
3191
|
-
feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
|
|
3192
|
-
feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
|
|
3193
|
-
feature.layerAlias = this.alias;
|
|
3194
|
-
const titleAttribute = (feature.attributes || []).find(_ref => {
|
|
3195
|
-
let {
|
|
3196
|
-
name
|
|
3197
|
-
} = _ref;
|
|
3198
|
-
return name === this.titleAttribute;
|
|
3199
|
-
});
|
|
3200
|
-
const displayName = titleAttribute && formatAttributeValue(titleAttribute)[0].value || feature.id;
|
|
3201
|
-
feature.displayName = displayName ? "" + displayName : feature.id;
|
|
3202
|
-
return feature;
|
|
3120
|
+
});
|
|
3121
|
+
return React.useMemo(() => {
|
|
3122
|
+
if (propRef.current) {
|
|
3123
|
+
if (update) {
|
|
3124
|
+
const newProp = update(propRef.current, deps, {
|
|
3125
|
+
factory,
|
|
3126
|
+
destructor
|
|
3127
|
+
});
|
|
3128
|
+
if (newProp) propRef.current = newProp;
|
|
3129
|
+
} else if (destructor) {
|
|
3130
|
+
destructor(propRef.current);
|
|
3131
|
+
}
|
|
3132
|
+
} else {
|
|
3133
|
+
if (!update || !propRef.current) {
|
|
3134
|
+
propRef.current = factory(deps);
|
|
3135
|
+
}
|
|
3203
3136
|
}
|
|
3204
|
-
}]);
|
|
3205
|
-
|
|
3206
|
-
return EvergisLayer;
|
|
3207
|
-
}();
|
|
3208
|
-
|
|
3209
|
-
const findFeatureLayer = feature => layer => layer.name === feature.layerName;
|
|
3210
3137
|
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
};
|
|
3138
|
+
return propRef.current; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3139
|
+
}, deps);
|
|
3140
|
+
}
|
|
3215
3141
|
|
|
3216
|
-
|
|
3217
|
-
const createLegendItem = _ref => {
|
|
3142
|
+
function useUpdate(_ref) {
|
|
3218
3143
|
let {
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
reverse
|
|
3144
|
+
onUpdate,
|
|
3145
|
+
shouldUpdate,
|
|
3146
|
+
deps
|
|
3223
3147
|
} = _ref;
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
values,
|
|
3229
|
-
attribute: attributeName,
|
|
3230
|
-
parameter
|
|
3231
|
-
} = classification;
|
|
3232
|
-
const attribute = attributeName && attributes ? getClassificationAttribute(attributeName, attributes) : undefined;
|
|
3233
|
-
const defaultLegendValue = {
|
|
3234
|
-
title: defaultTitle || OTHERS_TITLE,
|
|
3235
|
-
parameterValue: defaultValue
|
|
3236
|
-
};
|
|
3237
|
-
const legendValues = values.map((value, index) => ({
|
|
3238
|
-
title: renderTitle && renderTitle(_extends({}, value, {
|
|
3239
|
-
attribute
|
|
3240
|
-
}), index),
|
|
3241
|
-
parameterValue: value.parameterValue
|
|
3242
|
-
}));
|
|
3243
|
-
const withDefault = skipDefaultValue ? legendValues : [...legendValues, defaultLegendValue];
|
|
3244
|
-
const reversedValues = reverse ? [...withDefault].reverse() : withDefault;
|
|
3245
|
-
return {
|
|
3246
|
-
title: attribute && attribute.alias || attributeName,
|
|
3247
|
-
attribute,
|
|
3248
|
-
parameter,
|
|
3249
|
-
values: reversedValues
|
|
3250
|
-
};
|
|
3251
|
-
};
|
|
3252
|
-
};
|
|
3253
|
-
|
|
3254
|
-
function createStyleLegend(style, config) {
|
|
3255
|
-
const {
|
|
3256
|
-
classificationManager,
|
|
3257
|
-
symbol
|
|
3258
|
-
} = style;
|
|
3259
|
-
const items = classificationManager.filter(_ref => {
|
|
3260
|
-
let {
|
|
3261
|
-
parameter
|
|
3262
|
-
} = _ref;
|
|
3263
|
-
return config.parameters && parameter ? config.parameters.includes(parameter) : true;
|
|
3264
|
-
});
|
|
3265
|
-
|
|
3266
|
-
if (items.length === 0) {
|
|
3267
|
-
return null;
|
|
3268
|
-
}
|
|
3148
|
+
React.useEffect(() => {
|
|
3149
|
+
if (!shouldUpdate || shouldUpdate()) {
|
|
3150
|
+
onUpdate();
|
|
3151
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3269
3152
|
|
|
3270
|
-
|
|
3271
|
-
symbol: unClassify(symbol),
|
|
3272
|
-
items: items.map(createLegendItem(config))
|
|
3273
|
-
};
|
|
3153
|
+
}, deps);
|
|
3274
3154
|
}
|
|
3275
3155
|
|
|
3276
|
-
function
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3156
|
+
function useLayerOrder(layer, zIndex) {
|
|
3157
|
+
const {
|
|
3158
|
+
map
|
|
3159
|
+
} = useMapContext();
|
|
3160
|
+
useUpdate({
|
|
3161
|
+
onUpdate: () => map.insertLayer(layer, zIndex),
|
|
3162
|
+
deps: [zIndex, layer]
|
|
3163
|
+
});
|
|
3281
3164
|
}
|
|
3282
3165
|
|
|
3283
|
-
function
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
if (num >= 10000000) {
|
|
3288
|
-
result = num / 1000000;
|
|
3289
|
-
measure = 'км²';
|
|
3290
|
-
} else if (num >= 10000) {
|
|
3291
|
-
result = num / 10000;
|
|
3292
|
-
measure = 'га';
|
|
3166
|
+
function useLayerVisibility(layer, isDisplayed) {
|
|
3167
|
+
if (isDisplayed === void 0) {
|
|
3168
|
+
isDisplayed = true;
|
|
3293
3169
|
}
|
|
3294
3170
|
|
|
3295
|
-
|
|
3171
|
+
useUpdate({
|
|
3172
|
+
shouldUpdate: () => layer.isDisplayed !== isDisplayed,
|
|
3173
|
+
onUpdate: () => layer.isDisplayed = isDisplayed,
|
|
3174
|
+
deps: [isDisplayed, layer]
|
|
3175
|
+
});
|
|
3296
3176
|
}
|
|
3297
|
-
function formatLength(num) {
|
|
3298
|
-
let result = num;
|
|
3299
|
-
let measure = 'м';
|
|
3300
3177
|
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
|
-
return numberWithSpaces(result) + " " + measure;
|
|
3307
|
-
}
|
|
3308
|
-
function formatPolygonMeasure(area, perimiter) {
|
|
3309
|
-
return "S : " + formatArea(area) + " P : " + formatLength(perimiter);
|
|
3310
|
-
}
|
|
3311
|
-
function isPolylineLikePolygon(rings, resolution) {
|
|
3312
|
-
if (rings[0].length <= 3) {
|
|
3313
|
-
return false;
|
|
3178
|
+
function useLayerOpacity(layer, opacity) {
|
|
3179
|
+
if (opacity === void 0) {
|
|
3180
|
+
opacity = 1;
|
|
3314
3181
|
}
|
|
3315
3182
|
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
}
|
|
3322
|
-
|
|
3323
|
-
function getScale(scale) {
|
|
3324
|
-
const scales = [1, 2, 5];
|
|
3325
|
-
|
|
3326
|
-
for (let x = 0; x < 21; x++) {
|
|
3327
|
-
for (let y = 0; y < scales.length; y++) {
|
|
3328
|
-
const result = Math.pow(10, x) * scales[y];
|
|
3329
|
-
|
|
3330
|
-
if (result > scale) {
|
|
3331
|
-
return result;
|
|
3332
|
-
}
|
|
3333
|
-
}
|
|
3334
|
-
}
|
|
3335
|
-
|
|
3336
|
-
return 1;
|
|
3337
|
-
}
|
|
3338
|
-
|
|
3339
|
-
const useLegend = (style, config) => React.useMemo(() => {
|
|
3340
|
-
if (!style || !(config && config.attributes)) return null;
|
|
3341
|
-
return createStyleLegend(style, config);
|
|
3342
|
-
}, [style, config]);
|
|
3343
|
-
|
|
3344
|
-
const DEFAULT_LEGEND_CONFIG = {
|
|
3345
|
-
renderTitle: createValueTitle
|
|
3346
|
-
};
|
|
3347
|
-
const useLayerLegend = (layer, config) => {
|
|
3348
|
-
const {
|
|
3349
|
-
style,
|
|
3350
|
-
layerDefinition
|
|
3351
|
-
} = layer || {};
|
|
3352
|
-
const {
|
|
3353
|
-
attributes
|
|
3354
|
-
} = layerDefinition || {};
|
|
3355
|
-
const styleProxy = style && new EvergisStyle(style);
|
|
3356
|
-
return useLegend(styleProxy, _extends({
|
|
3357
|
-
attributes: attributes
|
|
3358
|
-
}, DEFAULT_LEGEND_CONFIG, config));
|
|
3359
|
-
};
|
|
3360
|
-
|
|
3361
|
-
const useMapLegend = (layer, config) => {
|
|
3362
|
-
const legend = useLayerLegend(layer, config);
|
|
3363
|
-
|
|
3364
|
-
if (!legend) {
|
|
3365
|
-
return null;
|
|
3366
|
-
}
|
|
3367
|
-
|
|
3368
|
-
const firstLegend = legend.items[0];
|
|
3369
|
-
return {
|
|
3370
|
-
symbol: legend.symbol,
|
|
3371
|
-
item: firstLegend
|
|
3372
|
-
};
|
|
3373
|
-
};
|
|
3374
|
-
|
|
3375
|
-
const LEGEND_SYMBOL_MAX_SIZE = 32;
|
|
3376
|
-
const useLegendValueSymbol = _ref => {
|
|
3377
|
-
let {
|
|
3378
|
-
parameter,
|
|
3379
|
-
parameterValue
|
|
3380
|
-
} = _ref;
|
|
3381
|
-
const symbol = useLegendContext();
|
|
3382
|
-
const valueSymbol = // @ts-ignore
|
|
3383
|
-
symbol && applyParameterValue(symbol, parameter, parameterValue);
|
|
3384
|
-
let sGisSymbol = null;
|
|
3385
|
-
|
|
3386
|
-
try {
|
|
3387
|
-
sGisSymbol = valueSymbol && deserializeSymbol(valueSymbol);
|
|
3388
|
-
} catch (e) {}
|
|
3389
|
-
|
|
3390
|
-
return sGisSymbol && adjustSymbol(sGisSymbol, {
|
|
3391
|
-
size: LEGEND_SYMBOL_MAX_SIZE - 1
|
|
3392
|
-
});
|
|
3393
|
-
};
|
|
3394
|
-
|
|
3395
|
-
const DEFAULT_SYMBOL_SIZE = 16;
|
|
3396
|
-
function useSymbol(_ref, canvasRef) {
|
|
3397
|
-
let {
|
|
3398
|
-
symbol,
|
|
3399
|
-
size = DEFAULT_SYMBOL_SIZE,
|
|
3400
|
-
render = getSymbolRenders,
|
|
3401
|
-
maxWidth
|
|
3402
|
-
} = _ref;
|
|
3403
|
-
React.useEffect(() => {
|
|
3404
|
-
if (canvasRef.current !== null && symbol !== undefined) {
|
|
3405
|
-
const canvas = canvasRef.current;
|
|
3406
|
-
setCanvasSize(canvas, size, maxWidth);
|
|
3407
|
-
render(symbol, size).then(renders => {
|
|
3408
|
-
renderSymbolToCanvas(renders, canvas);
|
|
3409
|
-
});
|
|
3410
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3411
|
-
|
|
3412
|
-
}, [symbol, size, maxWidth]);
|
|
3413
|
-
}
|
|
3414
|
-
|
|
3415
|
-
function setCanvasSize(canvas, size, maxWidth) {
|
|
3416
|
-
canvas.node.height = size;
|
|
3417
|
-
canvas.node.width = maxWidth ? Math.min(size, maxWidth) : size;
|
|
3418
|
-
}
|
|
3419
|
-
|
|
3420
|
-
function useCanvas() {
|
|
3421
|
-
const canvas = React.useRef(null);
|
|
3422
|
-
const ref = React.useCallback(node => {
|
|
3423
|
-
if (node !== null) {
|
|
3424
|
-
canvas.current = new Canvas.Canvas(node);
|
|
3425
|
-
} else {
|
|
3426
|
-
canvas.current = null;
|
|
3427
|
-
}
|
|
3428
|
-
}, []);
|
|
3429
|
-
return {
|
|
3430
|
-
canvas,
|
|
3431
|
-
ref
|
|
3432
|
-
};
|
|
3433
|
-
}
|
|
3434
|
-
|
|
3435
|
-
function useMount(_ref) {
|
|
3436
|
-
let {
|
|
3437
|
-
onMount,
|
|
3438
|
-
onUnmount
|
|
3439
|
-
} = _ref;
|
|
3440
|
-
React.useEffect(() => {
|
|
3441
|
-
onMount && onMount();
|
|
3442
|
-
return onUnmount; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3443
|
-
}, []);
|
|
3444
|
-
}
|
|
3445
|
-
|
|
3446
|
-
function useProperty(_ref, deps) {
|
|
3447
|
-
let {
|
|
3448
|
-
factory,
|
|
3449
|
-
destructor,
|
|
3450
|
-
update
|
|
3451
|
-
} = _ref;
|
|
3452
|
-
|
|
3453
|
-
if (deps === void 0) {
|
|
3454
|
-
deps = [];
|
|
3455
|
-
}
|
|
3456
|
-
|
|
3457
|
-
const propRef = React.useRef();
|
|
3458
|
-
useMount({
|
|
3459
|
-
onUnmount() {
|
|
3460
|
-
if (propRef.current && destructor) {
|
|
3461
|
-
destructor(propRef.current);
|
|
3462
|
-
}
|
|
3463
|
-
}
|
|
3464
|
-
|
|
3465
|
-
});
|
|
3466
|
-
return React.useMemo(() => {
|
|
3467
|
-
if (propRef.current) {
|
|
3468
|
-
if (update) {
|
|
3469
|
-
const newProp = update(propRef.current, deps, {
|
|
3470
|
-
factory,
|
|
3471
|
-
destructor
|
|
3472
|
-
});
|
|
3473
|
-
if (newProp) propRef.current = newProp;
|
|
3474
|
-
} else if (destructor) {
|
|
3475
|
-
destructor(propRef.current);
|
|
3476
|
-
}
|
|
3477
|
-
} else {
|
|
3478
|
-
if (!update || !propRef.current) {
|
|
3479
|
-
propRef.current = factory(deps);
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
|
|
3483
|
-
return propRef.current; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3484
|
-
}, deps);
|
|
3485
|
-
}
|
|
3486
|
-
|
|
3487
|
-
function useUpdate(_ref) {
|
|
3488
|
-
let {
|
|
3489
|
-
onUpdate,
|
|
3490
|
-
shouldUpdate,
|
|
3491
|
-
deps
|
|
3492
|
-
} = _ref;
|
|
3493
|
-
React.useEffect(() => {
|
|
3494
|
-
if (!shouldUpdate || shouldUpdate()) {
|
|
3495
|
-
onUpdate();
|
|
3496
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3497
|
-
|
|
3498
|
-
}, deps);
|
|
3499
|
-
}
|
|
3500
|
-
|
|
3501
|
-
function useLayerOrder(layer, zIndex) {
|
|
3502
|
-
const {
|
|
3503
|
-
map
|
|
3504
|
-
} = useMapContext();
|
|
3505
|
-
useUpdate({
|
|
3506
|
-
onUpdate: () => map.insertLayer(layer, zIndex),
|
|
3507
|
-
deps: [zIndex, layer]
|
|
3508
|
-
});
|
|
3509
|
-
}
|
|
3510
|
-
|
|
3511
|
-
function useLayerVisibility(layer, isDisplayed) {
|
|
3512
|
-
if (isDisplayed === void 0) {
|
|
3513
|
-
isDisplayed = true;
|
|
3514
|
-
}
|
|
3515
|
-
|
|
3516
|
-
useUpdate({
|
|
3517
|
-
shouldUpdate: () => layer.isDisplayed !== isDisplayed,
|
|
3518
|
-
onUpdate: () => layer.isDisplayed = isDisplayed,
|
|
3519
|
-
deps: [isDisplayed, layer]
|
|
3520
|
-
});
|
|
3521
|
-
}
|
|
3522
|
-
|
|
3523
|
-
function useLayerOpacity(layer, opacity) {
|
|
3524
|
-
if (opacity === void 0) {
|
|
3525
|
-
opacity = 1;
|
|
3526
|
-
}
|
|
3527
|
-
|
|
3528
|
-
useUpdate({
|
|
3529
|
-
shouldUpdate: () => layer.opacity !== opacity,
|
|
3530
|
-
onUpdate: () => layer.opacity = opacity,
|
|
3531
|
-
deps: [opacity, layer]
|
|
3532
|
-
});
|
|
3183
|
+
useUpdate({
|
|
3184
|
+
shouldUpdate: () => layer.opacity !== opacity,
|
|
3185
|
+
onUpdate: () => layer.opacity = opacity,
|
|
3186
|
+
deps: [opacity, layer]
|
|
3187
|
+
});
|
|
3533
3188
|
}
|
|
3534
3189
|
|
|
3535
3190
|
function useEvergisDynamicLayer(_ref) {
|
|
@@ -3751,7 +3406,7 @@ function useMapWrapper() {
|
|
|
3751
3406
|
return wrapperRef;
|
|
3752
3407
|
}
|
|
3753
3408
|
|
|
3754
|
-
const byScale = scale => _ref => {
|
|
3409
|
+
const byScale = scale => (_ref) => {
|
|
3755
3410
|
let {
|
|
3756
3411
|
zIndex
|
|
3757
3412
|
} = _ref;
|
|
@@ -3950,7 +3605,7 @@ const useTooltip = function useTooltip(zIndex) {
|
|
|
3950
3605
|
|
|
3951
3606
|
return reset;
|
|
3952
3607
|
}, [reset, map, layer, zIndex]);
|
|
3953
|
-
const onSetLabelFeature = React.useCallback(_ref => {
|
|
3608
|
+
const onSetLabelFeature = React.useCallback((_ref) => {
|
|
3954
3609
|
let {
|
|
3955
3610
|
point,
|
|
3956
3611
|
position,
|
|
@@ -4114,7 +3769,7 @@ function useClusterLayer(_ref) {
|
|
|
4114
3769
|
}
|
|
4115
3770
|
|
|
4116
3771
|
const INIT_FEATURES = [];
|
|
4117
|
-
const useEvergisSelect = _ref => {
|
|
3772
|
+
const useEvergisSelect = (_ref) => {
|
|
4118
3773
|
let {
|
|
4119
3774
|
onPick,
|
|
4120
3775
|
onFeatures
|
|
@@ -4147,7 +3802,7 @@ function none() {
|
|
|
4147
3802
|
return;
|
|
4148
3803
|
}
|
|
4149
3804
|
|
|
4150
|
-
const useDraggableMarker = _ref => {
|
|
3805
|
+
const useDraggableMarker = (_ref) => {
|
|
4151
3806
|
let {
|
|
4152
3807
|
position,
|
|
4153
3808
|
onChange,
|
|
@@ -4263,7 +3918,7 @@ const useDebouncedCallback = interval => {
|
|
|
4263
3918
|
}, interval), [interval]);
|
|
4264
3919
|
};
|
|
4265
3920
|
|
|
4266
|
-
const Symbol = _ref => {
|
|
3921
|
+
const Symbol = (_ref) => {
|
|
4267
3922
|
let {
|
|
4268
3923
|
symbol,
|
|
4269
3924
|
size,
|
|
@@ -4284,7 +3939,7 @@ const Symbol = _ref => {
|
|
|
4284
3939
|
};
|
|
4285
3940
|
|
|
4286
3941
|
var _templateObject;
|
|
4287
|
-
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) => {
|
|
4288
3943
|
let {
|
|
4289
3944
|
geometryType,
|
|
4290
3945
|
icons
|
|
@@ -4293,7 +3948,7 @@ const CompoundIcon = /*#__PURE__*/styled__default.div(_templateObject || (_templ
|
|
|
4293
3948
|
});
|
|
4294
3949
|
|
|
4295
3950
|
const MAX_SIZE = 32;
|
|
4296
|
-
const StyleSymbol = _ref => {
|
|
3951
|
+
const StyleSymbol = (_ref) => {
|
|
4297
3952
|
let {
|
|
4298
3953
|
symbol,
|
|
4299
3954
|
size = MAX_SIZE,
|
|
@@ -4338,7 +3993,7 @@ const CloseIcon = /*#__PURE__*/styled__default(ui.Icon)(_templateObject20 || (_t
|
|
|
4338
3993
|
const PrevIcon = /*#__PURE__*/styled__default(ui.Icon)(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
|
|
4339
3994
|
const NextIcon = /*#__PURE__*/styled__default(ui.Icon)(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), featureCardIconMixin);
|
|
4340
3995
|
|
|
4341
|
-
const MailValue = _ref => {
|
|
3996
|
+
const MailValue = (_ref) => {
|
|
4342
3997
|
let {
|
|
4343
3998
|
mail
|
|
4344
3999
|
} = _ref;
|
|
@@ -4349,7 +4004,7 @@ const MailValue = _ref => {
|
|
|
4349
4004
|
}, mail);
|
|
4350
4005
|
};
|
|
4351
4006
|
|
|
4352
|
-
const PhoneValue = _ref => {
|
|
4007
|
+
const PhoneValue = (_ref) => {
|
|
4353
4008
|
let {
|
|
4354
4009
|
phone
|
|
4355
4010
|
} = _ref;
|
|
@@ -4360,7 +4015,7 @@ const PhoneValue = _ref => {
|
|
|
4360
4015
|
}, phone);
|
|
4361
4016
|
};
|
|
4362
4017
|
|
|
4363
|
-
const UrlValue = _ref => {
|
|
4018
|
+
const UrlValue = (_ref) => {
|
|
4364
4019
|
let {
|
|
4365
4020
|
url
|
|
4366
4021
|
} = _ref;
|
|
@@ -4371,7 +4026,7 @@ const UrlValue = _ref => {
|
|
|
4371
4026
|
}, url);
|
|
4372
4027
|
};
|
|
4373
4028
|
|
|
4374
|
-
const AttributeValue = _ref => {
|
|
4029
|
+
const AttributeValue = (_ref) => {
|
|
4375
4030
|
let {
|
|
4376
4031
|
attribute
|
|
4377
4032
|
} = _ref;
|
|
@@ -4385,29 +4040,29 @@ const AttributeValue = _ref => {
|
|
|
4385
4040
|
if (attributeValue.type === 2
|
|
4386
4041
|
/* Url */
|
|
4387
4042
|
) {
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4043
|
+
return React__default.createElement(UrlValue, {
|
|
4044
|
+
key: key,
|
|
4045
|
+
url: punycodeDecode(value)
|
|
4046
|
+
});
|
|
4047
|
+
}
|
|
4393
4048
|
|
|
4394
4049
|
if (attributeValue.type === 3
|
|
4395
4050
|
/* Mail */
|
|
4396
4051
|
) {
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4052
|
+
return React__default.createElement(MailValue, {
|
|
4053
|
+
key: key,
|
|
4054
|
+
mail: value
|
|
4055
|
+
});
|
|
4056
|
+
}
|
|
4402
4057
|
|
|
4403
4058
|
if (attributeValue.type === 1
|
|
4404
4059
|
/* Phone */
|
|
4405
4060
|
) {
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4061
|
+
return React__default.createElement(PhoneValue, {
|
|
4062
|
+
key: key,
|
|
4063
|
+
phone: value
|
|
4064
|
+
});
|
|
4065
|
+
}
|
|
4411
4066
|
|
|
4412
4067
|
return React__default.createElement(SimpleAttribute, {
|
|
4413
4068
|
key: value
|
|
@@ -4423,7 +4078,7 @@ function punycodeDecode(domains) {
|
|
|
4423
4078
|
}
|
|
4424
4079
|
}
|
|
4425
4080
|
|
|
4426
|
-
const EvergisCardAttribute = _ref => {
|
|
4081
|
+
const EvergisCardAttribute = (_ref) => {
|
|
4427
4082
|
let {
|
|
4428
4083
|
attribute,
|
|
4429
4084
|
className
|
|
@@ -4435,7 +4090,7 @@ const EvergisCardAttribute = _ref => {
|
|
|
4435
4090
|
}));
|
|
4436
4091
|
};
|
|
4437
4092
|
|
|
4438
|
-
const StyledCard = _ref => {
|
|
4093
|
+
const StyledCard = (_ref) => {
|
|
4439
4094
|
let {
|
|
4440
4095
|
features = [],
|
|
4441
4096
|
className,
|
|
@@ -4486,7 +4141,7 @@ const StyledCard = _ref => {
|
|
|
4486
4141
|
};
|
|
4487
4142
|
|
|
4488
4143
|
const _excluded$1 = ["renderCard", "className", "children"];
|
|
4489
|
-
const EvergisCard = _ref => {
|
|
4144
|
+
const EvergisCard = (_ref) => {
|
|
4490
4145
|
let {
|
|
4491
4146
|
renderCard,
|
|
4492
4147
|
className,
|
|
@@ -4538,7 +4193,7 @@ const toSgis = feature => feature.sGisFeature(); // TODO inner hooks???
|
|
|
4538
4193
|
|
|
4539
4194
|
const useSGisFeatures = (features, currentIndex) => React.useMemo(() => features.map(toSgis).filter(truthly).map(setSelected(currentIndex)), [features, currentIndex]);
|
|
4540
4195
|
|
|
4541
|
-
const EvergisSelectLayer = _ref => {
|
|
4196
|
+
const EvergisSelectLayer = (_ref) => {
|
|
4542
4197
|
let {
|
|
4543
4198
|
features,
|
|
4544
4199
|
zIndex,
|
|
@@ -4583,7 +4238,7 @@ const TileLayer = props => {
|
|
|
4583
4238
|
};
|
|
4584
4239
|
|
|
4585
4240
|
const defaultZIndex = 200;
|
|
4586
|
-
const EvergisSelect = _ref => {
|
|
4241
|
+
const EvergisSelect = (_ref) => {
|
|
4587
4242
|
let {
|
|
4588
4243
|
onPick,
|
|
4589
4244
|
className,
|
|
@@ -4618,7 +4273,7 @@ const LegendSymbolTitle = /*#__PURE__*/styled__default.p(_templateObject3$1 || (
|
|
|
4618
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);
|
|
4619
4274
|
const LegendSectionHeader = /*#__PURE__*/styled__default.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])));
|
|
4620
4275
|
|
|
4621
|
-
const LegendSection = _ref => {
|
|
4276
|
+
const LegendSection = (_ref) => {
|
|
4622
4277
|
let {
|
|
4623
4278
|
item,
|
|
4624
4279
|
renderLegendTitle,
|
|
@@ -4635,7 +4290,7 @@ SearchPrefix.defaultProps = {
|
|
|
4635
4290
|
kind: "search"
|
|
4636
4291
|
};
|
|
4637
4292
|
|
|
4638
|
-
const SearchInput = _ref => {
|
|
4293
|
+
const SearchInput = (_ref) => {
|
|
4639
4294
|
let {
|
|
4640
4295
|
onChange
|
|
4641
4296
|
} = _ref;
|
|
@@ -4644,7 +4299,7 @@ const SearchInput = _ref => {
|
|
|
4644
4299
|
}));
|
|
4645
4300
|
};
|
|
4646
4301
|
|
|
4647
|
-
const LegendSymbol = _ref => {
|
|
4302
|
+
const LegendSymbol = (_ref) => {
|
|
4648
4303
|
let {
|
|
4649
4304
|
parameter,
|
|
4650
4305
|
parameterValue,
|
|
@@ -4662,7 +4317,7 @@ const LegendSymbol = _ref => {
|
|
|
4662
4317
|
return React__default.createElement(React__default.Fragment, null, children(symbol));
|
|
4663
4318
|
};
|
|
4664
4319
|
|
|
4665
|
-
const LegendValue = _ref => {
|
|
4320
|
+
const LegendValue = (_ref) => {
|
|
4666
4321
|
let {
|
|
4667
4322
|
value,
|
|
4668
4323
|
parameter,
|
|
@@ -4684,7 +4339,7 @@ const getNumberParam = (parameterValue, param) => {
|
|
|
4684
4339
|
return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
|
|
4685
4340
|
};
|
|
4686
4341
|
|
|
4687
|
-
const getSymbolSize = _ref => {
|
|
4342
|
+
const getSymbolSize = (_ref) => {
|
|
4688
4343
|
let {
|
|
4689
4344
|
parameterValue,
|
|
4690
4345
|
maxSize
|
|
@@ -4709,7 +4364,7 @@ const getSymbolSize = _ref => {
|
|
|
4709
4364
|
}
|
|
4710
4365
|
};
|
|
4711
4366
|
|
|
4712
|
-
const Legend = _ref => {
|
|
4367
|
+
const Legend = (_ref) => {
|
|
4713
4368
|
let {
|
|
4714
4369
|
layer,
|
|
4715
4370
|
children,
|
|
@@ -4752,7 +4407,7 @@ const Legend = _ref => {
|
|
|
4752
4407
|
})))));
|
|
4753
4408
|
};
|
|
4754
4409
|
|
|
4755
|
-
const Map = _ref => {
|
|
4410
|
+
const Map = (_ref) => {
|
|
4756
4411
|
let {
|
|
4757
4412
|
className,
|
|
4758
4413
|
position,
|
|
@@ -4774,163 +4429,488 @@ const Map = _ref => {
|
|
|
4774
4429
|
})) {
|
|
4775
4430
|
onBboxChange(state);
|
|
4776
4431
|
}
|
|
4777
|
-
}, [map, onBboxChange, position, resolution]);
|
|
4778
|
-
useUpdateMapView({
|
|
4779
|
-
position,
|
|
4780
|
-
resolution
|
|
4781
|
-
});
|
|
4782
|
-
useMaxMinScale(minScale, maxScale, position, resolution);
|
|
4783
|
-
useMapBboxChange(handleBboxChange);
|
|
4784
|
-
return React__default.createElement("div", {
|
|
4785
|
-
className: className,
|
|
4786
|
-
ref: wrapperRef,
|
|
4787
|
-
style: style
|
|
4788
|
-
}, children);
|
|
4789
|
-
};
|
|
4790
|
-
|
|
4791
|
-
var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2;
|
|
4792
|
-
|
|
4793
|
-
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;
|
|
4794
4814
|
|
|
4795
|
-
|
|
4815
|
+
if (wrapper && typeof wrapper !== 'string') {
|
|
4816
|
+
wrapper.style.cursor = cursor;
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
}]);
|
|
4796
4820
|
|
|
4797
|
-
|
|
4821
|
+
return BaseMeasureToolCreator;
|
|
4822
|
+
}(PolylineControl.PolylineControl);
|
|
4798
4823
|
|
|
4799
|
-
|
|
4824
|
+
let BaseMeasureToolEditor = /*#__PURE__*/function (_PolyEditor) {
|
|
4825
|
+
_inherits(BaseMeasureToolEditor, _PolyEditor);
|
|
4800
4826
|
|
|
4801
|
-
|
|
4802
|
-
if (placement === void 0) {
|
|
4803
|
-
placement = 'bottom-left';
|
|
4804
|
-
}
|
|
4827
|
+
var _super = /*#__PURE__*/_createSuper(BaseMeasureToolEditor);
|
|
4805
4828
|
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
}
|
|
4829
|
+
function BaseMeasureToolEditor(map, painter, params) {
|
|
4830
|
+
var _this;
|
|
4809
4831
|
|
|
4810
|
-
|
|
4811
|
-
};
|
|
4832
|
+
_classCallCheck(this, BaseMeasureToolEditor);
|
|
4812
4833
|
|
|
4813
|
-
|
|
4814
|
-
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"])));
|
|
4815
|
-
const ZoomInBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4816
|
-
ZoomInBtn.defaultProps = {
|
|
4817
|
-
kind: "plus"
|
|
4818
|
-
};
|
|
4819
|
-
const ZoomOutBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject3$4 || (_templateObject3$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4820
|
-
ZoomOutBtn.defaultProps = {
|
|
4821
|
-
kind: "minus"
|
|
4822
|
-
};
|
|
4823
|
-
const SearchBtn = /*#__PURE__*/styled__default(ui.Icon)(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", "\n"])), mapControlBtnMixin);
|
|
4824
|
-
SearchBtn.defaultProps = {
|
|
4825
|
-
kind: "search"
|
|
4826
|
-
}; // TODO not exists in fonts
|
|
4834
|
+
_this = _super.call(this, map, params);
|
|
4827
4835
|
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
};
|
|
4836
|
-
const
|
|
4837
|
-
const
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
return placementMixin(placement);
|
|
4847
|
-
}, MapControl, _ref3 => {
|
|
4848
|
-
let {
|
|
4849
|
-
vertical
|
|
4850
|
-
} = _ref3;
|
|
4851
|
-
return vertical ? '0.5rem' : '0';
|
|
4852
|
-
}, _ref4 => {
|
|
4853
|
-
let {
|
|
4854
|
-
vertical
|
|
4855
|
-
} = _ref4;
|
|
4856
|
-
return vertical ? '0' : '0.5rem';
|
|
4857
|
-
}, _ref5 => {
|
|
4858
|
-
let {
|
|
4859
|
-
vertical
|
|
4860
|
-
} = _ref5;
|
|
4861
|
-
return vertical ? 'column' : 'row';
|
|
4862
|
-
});
|
|
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
|
+
};
|
|
4863
4854
|
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
}));
|
|
4868
|
-
};
|
|
4855
|
+
_this.removeFeature = () => {
|
|
4856
|
+
_this.fire('remove');
|
|
4857
|
+
};
|
|
4869
4858
|
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
}));
|
|
4874
|
-
};
|
|
4859
|
+
_this.painter = painter;
|
|
4860
|
+
_this.renderLabelSymbol = params.renderLabelSymbol;
|
|
4861
|
+
_this.formatters = params.formatters || DEFAULT_FORMATTERS;
|
|
4875
4862
|
|
|
4876
|
-
|
|
4877
|
-
return React__default.createElement(MapControl, null, React__default.createElement(FullscreenBtn, {
|
|
4878
|
-
onClick: () => {}
|
|
4879
|
-
}));
|
|
4880
|
-
};
|
|
4863
|
+
_this.on('change', _this.updateMeasureResult);
|
|
4881
4864
|
|
|
4882
|
-
|
|
4883
|
-
const MapLegendControl = /*#__PURE__*/styled__default(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4884
|
-
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"])));
|
|
4885
|
-
const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n"])));
|
|
4886
|
-
const MapLegendSection = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n"])));
|
|
4887
|
-
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);
|
|
4888
4866
|
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
let {
|
|
4892
|
-
value,
|
|
4893
|
-
parameter
|
|
4894
|
-
} = _ref;
|
|
4895
|
-
return React__default.createElement(LegendSymbol, {
|
|
4896
|
-
key: value.title,
|
|
4897
|
-
parameter: parameter,
|
|
4898
|
-
parameterValue: value.parameterValue
|
|
4899
|
-
}, symbol => React__default.createElement(Symbol, {
|
|
4900
|
-
render: getMapLegendSymbolRenders,
|
|
4901
|
-
symbol: symbol,
|
|
4902
|
-
size: MAX_SIZE$2
|
|
4903
|
-
}));
|
|
4904
|
-
};
|
|
4867
|
+
return _this;
|
|
4868
|
+
}
|
|
4905
4869
|
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
config,
|
|
4911
|
-
fromToTitle = DEFAULT_FROM_TO,
|
|
4912
|
-
className
|
|
4913
|
-
} = _ref;
|
|
4914
|
-
const legend = useMapLegend(layer, config);
|
|
4870
|
+
_createClass(BaseMeasureToolEditor, [{
|
|
4871
|
+
key: "_activate",
|
|
4872
|
+
value: function _activate() {
|
|
4873
|
+
_get(_getPrototypeOf(BaseMeasureToolEditor.prototype), "_activate", this).call(this);
|
|
4915
4874
|
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
}
|
|
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
|
+
}]);
|
|
4919
4911
|
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
item
|
|
4923
|
-
} = legend;
|
|
4924
|
-
return React__default.createElement(LegendProvider, {
|
|
4925
|
-
symbol: symbol
|
|
4926
|
-
}, React__default.createElement(MapLegendControl, {
|
|
4927
|
-
className: className
|
|
4928
|
-
}, 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, {
|
|
4929
|
-
key: value.title,
|
|
4930
|
-
value: value,
|
|
4931
|
-
parameter: item.parameter
|
|
4932
|
-
})), React__default.createElement(MapLegendValueDescr, null, fromToTitle[1])))));
|
|
4933
|
-
};
|
|
4912
|
+
return BaseMeasureToolEditor;
|
|
4913
|
+
}(PolyEditor.PolyEditor);
|
|
4934
4914
|
|
|
4935
4915
|
let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
4936
4916
|
_inherits(MeasureTool, _React$Component);
|
|
@@ -5120,7 +5100,7 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
|
|
|
5120
5100
|
}(React__default.Component);
|
|
5121
5101
|
|
|
5122
5102
|
const _excluded$3 = ["isActive"];
|
|
5123
|
-
const Measurer = _ref => {
|
|
5103
|
+
const Measurer = (_ref) => {
|
|
5124
5104
|
let {
|
|
5125
5105
|
isActive
|
|
5126
5106
|
} = _ref,
|
|
@@ -5138,18 +5118,18 @@ const Measurer = _ref => {
|
|
|
5138
5118
|
|
|
5139
5119
|
var _templateObject$7, _templateObject2$6, _templateObject3$6;
|
|
5140
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"])));
|
|
5141
|
-
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) => {
|
|
5142
5122
|
let {
|
|
5143
5123
|
width
|
|
5144
5124
|
} = _ref;
|
|
5145
5125
|
return width + "px";
|
|
5146
5126
|
});
|
|
5147
|
-
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) => {
|
|
5148
5128
|
let {
|
|
5149
5129
|
alignEnd
|
|
5150
5130
|
} = _ref2;
|
|
5151
5131
|
return alignEnd ? 'flex-end' : 'center';
|
|
5152
|
-
}, _ref3 => {
|
|
5132
|
+
}, (_ref3) => {
|
|
5153
5133
|
let {
|
|
5154
5134
|
width
|
|
5155
5135
|
} = _ref3;
|
|
@@ -5174,7 +5154,7 @@ const ScaleRuler = () => {
|
|
|
5174
5154
|
}, currentScale >= 1000 ? currentScale / 1000 + "km" : currentScale + "m")));
|
|
5175
5155
|
};
|
|
5176
5156
|
|
|
5177
|
-
const Zoom = _ref => {
|
|
5157
|
+
const Zoom = (_ref) => {
|
|
5178
5158
|
let {
|
|
5179
5159
|
children
|
|
5180
5160
|
} = _ref;
|
|
@@ -5223,7 +5203,7 @@ const placementMixin$1 = function placementMixin(placement, distance, cornerSize
|
|
|
5223
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));
|
|
5224
5204
|
};
|
|
5225
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"])));
|
|
5226
|
-
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) => {
|
|
5227
5207
|
let {
|
|
5228
5208
|
placement,
|
|
5229
5209
|
distance = '0.5rem',
|
|
@@ -5231,7 +5211,7 @@ const TooltipComponent = /*#__PURE__*/styled__default.div(_templateObject11$1 ||
|
|
|
5231
5211
|
cornerSize = '0.25rem'
|
|
5232
5212
|
} = _ref;
|
|
5233
5213
|
return placementMixin$1(placement, distance, withArrow ? cornerSize : null);
|
|
5234
|
-
}, _ref2 => {
|
|
5214
|
+
}, (_ref2) => {
|
|
5235
5215
|
let {
|
|
5236
5216
|
withArrow
|
|
5237
5217
|
} = _ref2;
|
|
@@ -5245,7 +5225,7 @@ const {
|
|
|
5245
5225
|
Consumer
|
|
5246
5226
|
} = /*#__PURE__*/React.createContext([]); // TODO I just cant read that
|
|
5247
5227
|
|
|
5248
|
-
const Tooltip = _ref => {
|
|
5228
|
+
const Tooltip = (_ref) => {
|
|
5249
5229
|
let {
|
|
5250
5230
|
features = [],
|
|
5251
5231
|
map,
|
|
@@ -5284,7 +5264,7 @@ const Noop = () => React__default.createElement("div", {
|
|
|
5284
5264
|
}
|
|
5285
5265
|
});
|
|
5286
5266
|
|
|
5287
|
-
const DraggableMarker = _ref => {
|
|
5267
|
+
const DraggableMarker = (_ref) => {
|
|
5288
5268
|
let {
|
|
5289
5269
|
position,
|
|
5290
5270
|
onChange,
|
|
@@ -5298,6 +5278,21 @@ const DraggableMarker = _ref => {
|
|
|
5298
5278
|
return React__default.createElement(React.Fragment, null);
|
|
5299
5279
|
};
|
|
5300
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
|
+
|
|
5301
5296
|
exports.ArrowLineMiterRender = ArrowLineMiterRender;
|
|
5302
5297
|
exports.BaseMeasureToolCreator = BaseMeasureToolCreator;
|
|
5303
5298
|
exports.BaseMeasureToolEditor = BaseMeasureToolEditor;
|