@evergis/react 3.0.23 → 3.0.25

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.
Files changed (105) hide show
  1. package/dist/core/index.d.ts +0 -4
  2. package/dist/hooks/index.d.ts +0 -2
  3. package/dist/index.d.ts +0 -6
  4. package/dist/react.cjs.development.js +36 -4630
  5. package/dist/react.cjs.development.js.map +1 -1
  6. package/dist/react.cjs.production.min.js +1 -1
  7. package/dist/react.cjs.production.min.js.map +1 -1
  8. package/dist/react.esm.js +38 -4409
  9. package/dist/react.esm.js.map +1 -1
  10. package/package.json +4 -5
  11. package/dist/components/Legend/Legend.d.ts +0 -3
  12. package/dist/components/Legend/components/ClusterSymbolPreview.d.ts +0 -8
  13. package/dist/components/Legend/components/LegendChildren.d.ts +0 -3
  14. package/dist/components/Legend/components/LegendHeaderButtons.d.ts +0 -8
  15. package/dist/components/Legend/components/LegendParameterDescription.d.ts +0 -6
  16. package/dist/components/Legend/components/LegendSection.d.ts +0 -3
  17. package/dist/components/Legend/components/LegendSymbolRenderer.d.ts +0 -6
  18. package/dist/components/Legend/components/MaximizedLegend.d.ts +0 -3
  19. package/dist/components/Legend/components/MinimizedLegend.d.ts +0 -3
  20. package/dist/components/Legend/components/SvgSymbol.d.ts +0 -3
  21. package/dist/components/Legend/components/SymbolByType.d.ts +0 -9
  22. package/dist/components/Legend/components/index.d.ts +0 -9
  23. package/dist/components/Legend/constants.d.ts +0 -44
  24. package/dist/components/Legend/hooks/useSvgSymbol.d.ts +0 -16
  25. package/dist/components/Legend/index.d.ts +0 -6
  26. package/dist/components/Legend/styled.d.ts +0 -54
  27. package/dist/components/Legend/types.d.ts +0 -106
  28. package/dist/components/Legend/utils/getConditionAttribute.d.ts +0 -2
  29. package/dist/components/Legend/utils/getLegendText.d.ts +0 -5
  30. package/dist/components/Legend/utils/isHiddenLegend.d.ts +0 -1
  31. package/dist/components/Symbol/StyleSymbol.d.ts +0 -8
  32. package/dist/components/Symbol/Symbol.d.ts +0 -6
  33. package/dist/components/Symbol/index.d.ts +0 -3
  34. package/dist/components/Symbol/styled.d.ts +0 -9
  35. package/dist/components/index.d.ts +0 -2
  36. package/dist/contexts/LegendContext.d.ts +0 -8
  37. package/dist/contexts/index.d.ts +0 -1
  38. package/dist/core/classification/ClassificationCondition.d.ts +0 -15
  39. package/dist/core/classification/ClassificationManager.d.ts +0 -14
  40. package/dist/core/classification/getClassifications.d.ts +0 -4
  41. package/dist/core/classification/index.d.ts +0 -6
  42. package/dist/core/classification/parameter.d.ts +0 -4
  43. package/dist/core/classification/parameterValue.d.ts +0 -9
  44. package/dist/core/classification/printClass.d.ts +0 -2
  45. package/dist/core/classification/types.d.ts +0 -40
  46. package/dist/core/classification/unClassify.d.ts +0 -2
  47. package/dist/core/feature/evaluateCondition.d.ts +0 -2
  48. package/dist/core/feature/getFeatureSymbol.d.ts +0 -7
  49. package/dist/core/feature/index.d.ts +0 -1
  50. package/dist/core/legend/FilterCondition.d.ts +0 -11
  51. package/dist/core/legend/createCondition.d.ts +0 -8
  52. package/dist/core/legend/createValueTitle.d.ts +0 -2
  53. package/dist/core/legend/index.d.ts +0 -3
  54. package/dist/core/legend/isValidParameter.d.ts +0 -2
  55. package/dist/core/legend/types.d.ts +0 -45
  56. package/dist/core/style/EvergisStyle.d.ts +0 -18
  57. package/dist/core/style/compositeSymbol.d.ts +0 -7
  58. package/dist/core/style/index.d.ts +0 -3
  59. package/dist/core/style/types/brush.d.ts +0 -27
  60. package/dist/core/style/types/index.d.ts +0 -8
  61. package/dist/core/style/types/label.d.ts +0 -19
  62. package/dist/core/style/types/miters.d.ts +0 -47
  63. package/dist/core/style/types/offset.d.ts +0 -7
  64. package/dist/core/style/types/parameterValue.d.ts +0 -29
  65. package/dist/core/style/types/style.d.ts +0 -11
  66. package/dist/core/style/types/symbol.d.ts +0 -78
  67. package/dist/core/style/types/utils.d.ts +0 -32
  68. package/dist/hooks/useCanvas.d.ts +0 -6
  69. package/dist/hooks/useSymbol.d.ts +0 -11
  70. package/dist/symbols/Evergis/SGisBrushFill.d.ts +0 -8
  71. package/dist/symbols/Evergis/SGisImageFill.d.ts +0 -7
  72. package/dist/symbols/Evergis/SGisPolygonSymbol.d.ts +0 -7
  73. package/dist/symbols/Evergis/SGisPolylineSymbol.d.ts +0 -13
  74. package/dist/symbols/Evergis/index.d.ts +0 -4
  75. package/dist/symbols/LineMiters/ArrowLineMiterRender.d.ts +0 -8
  76. package/dist/symbols/LineMiters/CircleLineMiterRender.d.ts +0 -8
  77. package/dist/symbols/LineMiters/LineMiterRender.d.ts +0 -27
  78. package/dist/symbols/LineMiters/SquareLineMiterRender.d.ts +0 -8
  79. package/dist/symbols/LineMiters/getLineMiterRender.d.ts +0 -2
  80. package/dist/symbols/LineMiters/index.d.ts +0 -4
  81. package/dist/symbols/LineMiters/miterStyle.d.ts +0 -7
  82. package/dist/symbols/LineMiters/updateRingsForMiter.d.ts +0 -3
  83. package/dist/symbols/SVGPoly/index.d.ts +0 -25
  84. package/dist/symbols/SVGPoly/types.d.ts +0 -37
  85. package/dist/symbols/Selected/SelectedPointSymbol.d.ts +0 -19
  86. package/dist/symbols/Selected/SelectedPolySymbol.d.ts +0 -21
  87. package/dist/symbols/Selected/index.d.ts +0 -3
  88. package/dist/symbols/Selected/selectedSymbols.d.ts +0 -5
  89. package/dist/symbols/Shadowed/ShadowedPointSymbol.d.ts +0 -22
  90. package/dist/symbols/Shadowed/ShadowedPolySymbol.d.ts +0 -37
  91. package/dist/symbols/Shadowed/getEditorPointRenderer.d.ts +0 -5
  92. package/dist/symbols/Shadowed/index.d.ts +0 -2
  93. package/dist/symbols/adjustSymbol.d.ts +0 -6
  94. package/dist/symbols/deserializeSymbol.d.ts +0 -5
  95. package/dist/symbols/getSymbolRenders.d.ts +0 -5
  96. package/dist/symbols/guards.d.ts +0 -11
  97. package/dist/symbols/index.d.ts +0 -14
  98. package/dist/symbols/mockFeatures.d.ts +0 -35
  99. package/dist/symbols/previewLimits.d.ts +0 -4
  100. package/dist/symbols/renderSymbolToCanvas.d.ts +0 -3
  101. package/dist/symbols/strokeStyle.d.ts +0 -23
  102. package/dist/symbols/types.d.ts +0 -16
  103. package/dist/utils/isParameterType.d.ts +0 -3
  104. package/dist/utils/legend.d.ts +0 -82
  105. package/dist/utils/svg.d.ts +0 -12
package/dist/react.esm.js CHANGED
@@ -1,428 +1,8 @@
1
- import React, { useRef, useMemo, useCallback, memo, useEffect, Fragment, useState, useContext, createContext } from 'react';
2
- import styled, { css } from 'styled-components';
3
- import { IconButton, EverCloudClassificationIcon, EverCloudRefreshIcon } from '@evergis/icons';
4
- import { SVG } from '@svgdotjs/svg.js';
5
- import { Color as Color$1 } from '@evergis/color/es/Color';
6
- import { LineEndingType, GeometryType, AttributeType, unique } from '@evergis/api';
7
1
  import { isValid, toDate, format, parseJSON, parseISO } from 'date-fns';
8
- import { ConditionInterpreter, TokenType, ConditionEvaluator, Char } from '@evergis/condition';
9
- import i18n from 'i18next';
10
- import { initReactI18next, useTranslation } from 'react-i18next';
11
- import LanguageDetector from 'i18next-browser-languagedetector';
12
- import get from 'lodash-es/get';
13
- import { isNil } from 'lodash-es';
14
- import { BrushFill } from '@evergis/sgis/es/symbols/polygon/BrushFill';
2
+ import { useEffect, useState, useCallback } from 'react';
15
3
  import { Color } from '@evergis/color';
16
- import { ImageFill } from '@evergis/sgis/es/symbols/polygon/ImageFill';
17
- import { PolygonSymbol } from '@evergis/sgis/es/symbols/polygon/Simple';
18
- import { PolylineSymbol } from '@evergis/sgis/es/symbols/PolylineSymbol';
19
- import { PolyRender, FillStyle } from '@evergis/sgis/es/renders/Poly';
20
- import { projectRings, distance } from '@evergis/sgis/es/geotools';
21
- import { simplifyCoordinates } from '@evergis/sgis/es/utils/math';
22
- import { Poly } from '@evergis/sgis/es/features/Poly';
23
- import { PointSymbol } from '@evergis/sgis/es/symbols/point/Point';
24
- import { PointFeature } from '@evergis/sgis/es/features/PointFeature';
25
- import { Arc } from '@evergis/sgis/es/renders/Arc';
26
- import { Symbol as Symbol$1 } from '@evergis/sgis/es/symbols/Symbol';
27
- import { DynamicRender } from '@evergis/sgis/es/renders/Render';
28
- import { SvgRender } from '@evergis/sgis/es/painters/DomPainter/SvgRender';
29
- import { listenDomEvent } from '@evergis/sgis/es/utils/domEvent';
30
- import { MouseEventFlags, mouseEvents } from '@evergis/sgis/es/EventHandler';
31
- import { geo, plain } from '@evergis/sgis/es/Crs';
32
- import { StaticImageSymbol } from '@evergis/sgis/es/symbols/point/StaticImageSymbol';
33
- import { SquareSymbol } from '@evergis/sgis/es/symbols/point/Square';
34
- import { MaskedImage } from '@evergis/sgis/es/symbols/point/MaskedImage';
35
- import { H3Symbol } from '@evergis/sgis/es/symbols/H3Symbol';
36
- import { CombinedPolylineSymbol } from '@evergis/sgis/es/symbols/CombinedPolylineSymbol';
37
- import { Polygon } from '@evergis/sgis/es/features/Polygon';
38
- import { Polyline } from '@evergis/sgis/es/features/Polyline';
39
- import { H3Feature } from '@evergis/sgis/es/features/H3Feature';
40
- import { CombinedPolyline } from '@evergis/sgis/es/features/CombinedPolyline';
41
- import { Canvas } from '@evergis/sgis/es/painters/DomPainter/Canvas';
42
-
43
- function _classCallCheck(instance, Constructor) {
44
- if (!(instance instanceof Constructor)) {
45
- throw new TypeError("Cannot call a class as a function");
46
- }
47
- }
48
-
49
- function _defineProperties(target, props) {
50
- for (var i = 0; i < props.length; i++) {
51
- var descriptor = props[i];
52
- descriptor.enumerable = descriptor.enumerable || false;
53
- descriptor.configurable = true;
54
- if ("value" in descriptor) descriptor.writable = true;
55
- Object.defineProperty(target, descriptor.key, descriptor);
56
- }
57
- }
58
-
59
- function _createClass(Constructor, protoProps, staticProps) {
60
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
61
- if (staticProps) _defineProperties(Constructor, staticProps);
62
- return Constructor;
63
- }
64
-
65
- function _extends() {
66
- _extends = Object.assign || function (target) {
67
- for (var i = 1; i < arguments.length; i++) {
68
- var source = arguments[i];
69
-
70
- for (var key in source) {
71
- if (Object.prototype.hasOwnProperty.call(source, key)) {
72
- target[key] = source[key];
73
- }
74
- }
75
- }
76
-
77
- return target;
78
- };
79
-
80
- return _extends.apply(this, arguments);
81
- }
82
-
83
- function _inherits(subClass, superClass) {
84
- if (typeof superClass !== "function" && superClass !== null) {
85
- throw new TypeError("Super expression must either be null or a function");
86
- }
87
-
88
- subClass.prototype = Object.create(superClass && superClass.prototype, {
89
- constructor: {
90
- value: subClass,
91
- writable: true,
92
- configurable: true
93
- }
94
- });
95
- if (superClass) _setPrototypeOf(subClass, superClass);
96
- }
97
-
98
- function _getPrototypeOf(o) {
99
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
100
- return o.__proto__ || Object.getPrototypeOf(o);
101
- };
102
- return _getPrototypeOf(o);
103
- }
104
-
105
- function _setPrototypeOf(o, p) {
106
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
107
- o.__proto__ = p;
108
- return o;
109
- };
110
-
111
- return _setPrototypeOf(o, p);
112
- }
113
-
114
- function _isNativeReflectConstruct() {
115
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
116
- if (Reflect.construct.sham) return false;
117
- if (typeof Proxy === "function") return true;
118
-
119
- try {
120
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
121
- return true;
122
- } catch (e) {
123
- return false;
124
- }
125
- }
126
-
127
- function _objectWithoutPropertiesLoose(source, excluded) {
128
- if (source == null) return {};
129
- var target = {};
130
- var sourceKeys = Object.keys(source);
131
- var key, i;
132
-
133
- for (i = 0; i < sourceKeys.length; i++) {
134
- key = sourceKeys[i];
135
- if (excluded.indexOf(key) >= 0) continue;
136
- target[key] = source[key];
137
- }
138
-
139
- return target;
140
- }
141
-
142
- function _assertThisInitialized(self) {
143
- if (self === void 0) {
144
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
145
- }
146
-
147
- return self;
148
- }
149
-
150
- function _possibleConstructorReturn(self, call) {
151
- if (call && (typeof call === "object" || typeof call === "function")) {
152
- return call;
153
- }
154
-
155
- return _assertThisInitialized(self);
156
- }
157
-
158
- function _createSuper(Derived) {
159
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
160
-
161
- return function _createSuperInternal() {
162
- var Super = _getPrototypeOf(Derived),
163
- result;
164
-
165
- if (hasNativeReflectConstruct) {
166
- var NewTarget = _getPrototypeOf(this).constructor;
167
-
168
- result = Reflect.construct(Super, arguments, NewTarget);
169
- } else {
170
- result = Super.apply(this, arguments);
171
- }
172
-
173
- return _possibleConstructorReturn(this, result);
174
- };
175
- }
176
-
177
- function _superPropBase(object, property) {
178
- while (!Object.prototype.hasOwnProperty.call(object, property)) {
179
- object = _getPrototypeOf(object);
180
- if (object === null) break;
181
- }
182
-
183
- return object;
184
- }
185
-
186
- function _get(target, property, receiver) {
187
- if (typeof Reflect !== "undefined" && Reflect.get) {
188
- _get = Reflect.get;
189
- } else {
190
- _get = function _get(target, property, receiver) {
191
- var base = _superPropBase(target, property);
192
-
193
- if (!base) return;
194
- var desc = Object.getOwnPropertyDescriptor(base, property);
195
-
196
- if (desc.get) {
197
- return desc.get.call(receiver);
198
- }
199
-
200
- return desc.value;
201
- };
202
- }
203
-
204
- return _get(target, property, receiver || target);
205
- }
206
-
207
- function _taggedTemplateLiteralLoose(strings, raw) {
208
- if (!raw) {
209
- raw = strings.slice(0);
210
- }
211
-
212
- strings.raw = raw;
213
- return strings;
214
- }
215
-
216
- const isParameterType = (types, parameter) => {
217
- var _parameter$toLowerCas;
218
-
219
- return (typeof types === 'string' ? parameter == null ? void 0 : (_parameter$toLowerCas = parameter.toLowerCase()) == null ? void 0 : _parameter$toLowerCas.includes(types.toLowerCase()) : types.some(type => {
220
- var _parameter$toLowerCas2;
221
-
222
- return parameter == null ? void 0 : (_parameter$toLowerCas2 = parameter.toLowerCase()) == null ? void 0 : _parameter$toLowerCas2.includes(type.toLowerCase());
223
- })) || false;
224
- };
225
-
226
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38;
227
- const MapLegendDescription = /*#__PURE__*/styled.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
228
- const ItemText = /*#__PURE__*/styled.div(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: calc(100% - 2rem);\n font: ", ";\n"])), (_ref) => {
229
- let {
230
- theme: {
231
- fonts
232
- }
233
- } = _ref;
234
- return fonts.description;
235
- });
236
- const ItemSeparator = /*#__PURE__*/styled.div(_templateObject3 || (_templateObject3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n :after {\n content: '-';\n margin: 0 0.5rem;\n font-size: 0.75rem;\n }\n"])));
237
- const SymbolContainer = /*#__PURE__*/styled('span')(_templateObject4 || (_templateObject4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n min-width: 1.5rem;\n margin-right: 0.5rem;\n"])));
238
- const ClassifiedItem = /*#__PURE__*/styled.div(_templateObject5 || (_templateObject5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n align-items: center;\n cursor: ", ";\n pointer-events: ", ";\n\n :not(:last-of-type) {\n margin-bottom: 0.25rem;\n }\n\n ", ", ", " {\n transition: opacity 150ms;\n }\n\n ", " {\n opacity: ", ";\n }\n\n ", " {\n opacity: ", ";\n }\n\n :hover {\n ", ", ", " {\n opacity: 1;\n }\n }\n\n ", " {\n margin-left: 0.5rem;\n }\n"])), (_ref2) => {
239
- let {
240
- isClusterFillColor
241
- } = _ref2;
242
- return isClusterFillColor ? 'default' : 'pointer';
243
- }, (_ref3) => {
244
- let {
245
- isClusterFillColor
246
- } = _ref3;
247
- return isClusterFillColor ? 'none' : 'auto';
248
- }, ItemText, SymbolContainer, ItemText, (_ref4) => {
249
- let {
250
- isHidden
251
- } = _ref4;
252
- return isHidden ? 0.28 : 0.65;
253
- }, SymbolContainer, (_ref5) => {
254
- let {
255
- isHidden
256
- } = _ref5;
257
- return isHidden ? 0.28 : 1;
258
- }, ItemText, SymbolContainer, IconButton);
259
- const SymbolButtonWithClick = /*#__PURE__*/css(_templateObject6 || (_templateObject6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 3.875rem;\n height: 3.875rem;\n cursor: pointer;\n\n &:hover {\n background-color: ", ";\n }\n"])), (_ref6) => {
260
- let {
261
- theme: {
262
- palette
263
- }
264
- } = _ref6;
265
- return palette.elementDeep;
266
- });
267
- const SymbolButton = /*#__PURE__*/styled.span(_templateObject7 || (_templateObject7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background-color 150ms;\n ", ";\n\n svg {\n max-width: 4rem;\n max-height: 4rem;\n }\n"])), (_ref7) => {
268
- let {
269
- onClick
270
- } = _ref7;
271
- return !!onClick && SymbolButtonWithClick;
272
- });
273
- const MapLegendContainer = /*#__PURE__*/styled.div(_templateObject8 || (_templateObject8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 100%;\n padding-bottom: 1rem;\n box-sizing: border-box;\n\n canvas {\n height: 1.625rem;\n width: 1.625rem;\n }\n"])));
274
- const MapLegendHeader = /*#__PURE__*/styled.div(_templateObject9 || (_templateObject9 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: bold;\n"])));
275
- const MapLegendDescriptionContainer = /*#__PURE__*/styled.div(_templateObject10 || (_templateObject10 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 0.5rem;\n font-weight: 400;\n font-size: 0.625rem;\n color: rgba(48, 69, 79, 0.65);\n"])));
276
- const MapLegendBadge = /*#__PURE__*/styled.span(_templateObject11 || (_templateObject11 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n min-width: 0.5rem;\n height: 0.75rem;\n display: inline-block;\n margin-left: 0.25rem;\n padding: 0.125rem 0.25rem;\n border-radius: ", ";\n background-color: ", ";\n color: ", ";\n text-align: center;\n"])), (_ref8) => {
277
- let {
278
- theme: {
279
- borderRadius
280
- }
281
- } = _ref8;
282
- return borderRadius.xSmall;
283
- }, (_ref9) => {
284
- let {
285
- theme: {
286
- palette
287
- }
288
- } = _ref9;
289
- return palette.element;
290
- }, (_ref10) => {
291
- let {
292
- theme: {
293
- palette
294
- }
295
- } = _ref10;
296
- return palette.textPrimary;
297
- });
298
- const MaximizedLegendContainer = /*#__PURE__*/styled.div(_templateObject12 || (_templateObject12 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: ", ";\n top: 0;\n opacity: ", ";\n visibility: ", ";\n overflow: hidden;\n transition: opacity 0.5s, visibility 0.5s;\n"])), (_ref11) => {
299
- let {
300
- isShown
301
- } = _ref11;
302
- return isShown ? 'relative' : 'absolute';
303
- }, (_ref12) => {
304
- let {
305
- isShown
306
- } = _ref12;
307
- return isShown ? 1 : 0;
308
- }, (_ref13) => {
309
- let {
310
- isShown
311
- } = _ref13;
312
- return isShown ? 'visible' : 'hidden';
313
- });
314
- const MinimizedLegendContainer = /*#__PURE__*/styled(MaximizedLegendContainer)(_templateObject13 || (_templateObject13 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: calc(100% - 1.5rem);\n padding-right: 1.5rem;\n"])));
315
- const LegendHeaderButton = /*#__PURE__*/styled.span(_templateObject14 || (_templateObject14 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
316
- const MapLegendSectionContainer = /*#__PURE__*/styled.div(_templateObject15 || (_templateObject15 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n\n :not(:last-child) {\n margin-bottom: 1rem;\n }\n\n ", " {\n padding-left: 0.75rem;\n visibility: hidden;\n\n :first-child {\n padding-left: 1rem;\n }\n\n :last-child {\n margin-left: 0.75rem;\n border-left: 1px ", " solid;\n }\n }\n \n :hover {\n ", " {\n visibility: visible;\n }\n }\n"])), LegendHeaderButton, (_ref14) => {
317
- let {
318
- theme: {
319
- palette
320
- }
321
- } = _ref14;
322
- return palette.elementDeep;
323
- }, LegendHeaderButton);
324
- const MapLegendSectionItems = /*#__PURE__*/styled.div(_templateObject16 || (_templateObject16 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n height: ", "px;\n overflow: ", ";\n transition: height 0.5s;\n"])), (_ref15) => {
325
- let {
326
- minHeight,
327
- maxHeight,
328
- isExpanded
329
- } = _ref15;
330
- return isExpanded ? (maxHeight || 0) + 4 : minHeight;
331
- }, (_ref16) => {
332
- let {
333
- isExpanded
334
- } = _ref16;
335
- return isExpanded ? 'none' : 'hidden';
336
- });
337
- const MapLegendValueDescr = /*#__PURE__*/styled.div(_templateObject17 || (_templateObject17 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n min-height: 1rem;\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
338
-
339
- const SizeLegendItemMixin = function SizeLegendItemMixin(value) {
340
- if (value === void 0) {
341
- value = 0;
342
- }
343
-
344
- return css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: 0;\n left: 50%;\n display: flex;\n align-items: flex-end;\n flex: none;\n height: inherit;\n width: inherit;\n margin: 0 auto;\n background: none;\n border: none;\n\n :after {\n content: '';\n display: flex;\n border: 1px rgba(48, 69, 79, 0.28) solid;\n border-radius: 50%;\n margin: 0 0 0 -", "px;\n width: ", "px;\n height: ", "px;\n }\n"])), value / 2, value, value);
345
- };
346
-
347
- const StrokeWidthLegendItemMixin = function StrokeWidthLegendItemMixin(value) {
348
- if (value === void 0) {
349
- value = 0;
350
- }
351
-
352
- return css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteralLoose(["\n position: relative;\n background: none;\n border: none;\n display: flex;\n align-items: center;\n flex: none;\n width: calc(100% - 2rem);\n height: ", "px;\n margin: 0 0 0.25rem 0;\n padding-left: 2rem;\n font-size: 0.75rem;\n\n :first-child,\n :last-child {\n height: auto;\n }\n\n :after {\n content: '';\n position: absolute;\n top: 50%;\n left: 0;\n width: 1.5rem;\n height: ", "px;\n margin-top: -", "px;\n background: rgb(224, 224, 224);\n }\n"])), value, value, Math.round(value / 2));
353
- };
354
-
355
- const StrokeColorLegendItemMixin = /*#__PURE__*/css(_templateObject20 || (_templateObject20 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-right: 0.5rem;\n width: 1.5rem;\n"])));
356
- const MapLegendItem = /*#__PURE__*/styled.div(_templateObject21 || (_templateObject21 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n height: ", "rem;\n background: ", ";\n border: 1px rgba(48, 69, 79, 0.1) solid;\n margin-right: -1px;\n color: rgba(48, 69, 79, 0.65);\n opacity: ", ";\n\n ", "\n\n ", "\n"])), (_ref17) => {
357
- let {
358
- parameter
359
- } = _ref17;
360
- return isParameterType(['strokeColor', 'stroke.color'], parameter) ? 0.25 : 1;
361
- }, (_ref18) => {
362
- let {
363
- value
364
- } = _ref18;
365
- return typeof value === 'number' ? 'none' : value;
366
- }, (_ref19) => {
367
- let {
368
- isHidden
369
- } = _ref19;
370
- return isHidden ? 0.28 : 1;
371
- }, (_ref20) => {
372
- let {
373
- value,
374
- parameter
375
- } = _ref20;
376
- return isParameterType('size', parameter) && SizeLegendItemMixin(value);
377
- }, (_ref21) => {
378
- let {
379
- value,
380
- parameter
381
- } = _ref21;
382
- return isParameterType(['strokeWidth', 'stroke.width'], parameter) && StrokeWidthLegendItemMixin(value);
383
- });
384
- const MapLegendOther = /*#__PURE__*/styled(MapLegendItem)(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n flex: none;\n position: relative;\n width: 1rem;\n margin-left: 0.25rem;\n border-radius: 0.125rem;\n"])));
385
- const SizeLegendItemsMixin = /*#__PURE__*/css(_templateObject23 || (_templateObject23 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 2rem;\n height: 2rem;\n margin: 0 auto;\n\n ", " {\n width: auto;\n margin-left: 0;\n }\n"])), MapLegendOther);
386
- const StrokeWidthLegendItemsMixin = /*#__PURE__*/css(_templateObject24 || (_templateObject24 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n flex-direction: column;\n width: auto;\n\n ", " {\n width: calc(100% - 2rem);\n margin-left: 0;\n }\n"])), MapLegendOther);
387
- const SizeMinimizedLegend = /*#__PURE__*/styled.div(_templateObject25 || (_templateObject25 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n margin: 0.5rem 0 0.25rem;\n"])));
388
- const SizeMinimizedLegendSymbol = /*#__PURE__*/styled.div(_templateObject26 || (_templateObject26 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n"])));
389
- const SizeMinimizedLegendLabel = /*#__PURE__*/styled.div(_templateObject27 || (_templateObject27 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 9.75rem;\n font-size: 0.75rem;\n"])));
390
- const SizeMinimizedLegendDown = /*#__PURE__*/styled.div(_templateObject28 || (_templateObject28 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: rgba(48, 69, 79, 0.65);\n"])));
391
- const SizeMinimizedLegendUp = /*#__PURE__*/styled(SizeMinimizedLegendDown)(_templateObject29 || (_templateObject29 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
392
- const SingleSizeLegendItemsMixin = /*#__PURE__*/css(_templateObject30 || (_templateObject30 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n\n ", ":after {\n margin: 0 auto;\n }\n"])), MapLegendItem);
393
- const SingleLegendItemsMixin = /*#__PURE__*/css(_templateObject31 || (_templateObject31 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n justify-content: center;\n width: 2rem;\n height: auto;\n margin: 0;\n ", "\n\n ", " {\n position: relative;\n top: 0;\n left: 0;\n display: flex;\n align-content: center;\n justify-content: center;\n margin: 0;\n height: auto;\n width: auto;\n\n ", "\n }\n"])), (_ref22) => {
394
- let {
395
- isSize
396
- } = _ref22;
397
- return isSize && SingleSizeLegendItemsMixin;
398
- }, MapLegendItem, (_ref23) => {
399
- let {
400
- parameter
401
- } = _ref23;
402
- return isParameterType(['strokeColor', 'stroke.color'], parameter) && StrokeColorLegendItemMixin;
403
- });
404
- const MapLegendItems = /*#__PURE__*/styled.div(_templateObject32 || (_templateObject32 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n ", ";\n ", ";\n"])), (_ref24) => {
405
- let {
406
- isSize
407
- } = _ref24;
408
- return isSize && SizeLegendItemsMixin;
409
- }, (_ref25) => {
410
- let {
411
- isStrokeWidth
412
- } = _ref25;
413
- return isStrokeWidth && StrokeWidthLegendItemsMixin;
414
- }, (_ref26) => {
415
- let {
416
- isSingle
417
- } = _ref26;
418
- return isSingle && SingleLegendItemsMixin;
419
- });
420
- const MapLegendItemsContainer = /*#__PURE__*/styled.div(_templateObject33 || (_templateObject33 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n\n ", " {\n :first-child {\n border-top-left-radius: 0.125rem;\n border-bottom-left-radius: 0.125rem;\n }\n\n :last-child {\n border-top-right-radius: 0.125rem;\n border-bottom-right-radius: 0.125rem;\n }\n }\n"])), MapLegendItem);
421
- const MapLegendValues = /*#__PURE__*/styled.div(_templateObject34 || (_templateObject34 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n margin-top: 0.5rem;\n font-size: 0.75rem;\n color: rgba(48, 69, 79, 0.65);\n"])));
422
- const MapLegendValuesRange = /*#__PURE__*/styled.div(_templateObject35 || (_templateObject35 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: calc(100% - 1.25rem);\n\n div {\n flex: 1;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n\n :first-child {\n margin-right: 0.5rem;\n }\n\n :last-child {\n margin-left: 0.5rem;\n text-align: right;\n }\n }\n"])));
423
- const MapLegendValuesOther = /*#__PURE__*/styled(MapLegendOther)(_templateObject36 || (_templateObject36 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n justify-content: center;\n border: 0;\n overflow: visible;\n"])));
424
- const MapLegendExpandButton = /*#__PURE__*/styled.div(_templateObject37 || (_templateObject37 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin-top: 0.1rem;\n font-size: 0.625rem;\n color: #1fb3aa;\n"])));
425
- const ClusterLegendContainer = /*#__PURE__*/styled.div(_templateObject38 || (_templateObject38 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: -0.9rem;\n transform: scale(0.5);\n"])));
4
+ import { geo } from '@evergis/sgis/es/Crs';
5
+ import { distance } from '@evergis/sgis/es/geotools';
426
6
 
427
7
  const NO_CONTENT_VALUE = '—';
428
8
  var DateFormat;
@@ -645,4006 +225,55 @@ const formatAttributeValue = attribute => {
645
225
  }
646
226
  };
647
227
 
648
- function isRangeClass(value) {
649
- return Boolean(value && 'from' in value);
228
+ function useMount(_ref) {
229
+ let {
230
+ onMount,
231
+ onUnmount
232
+ } = _ref;
233
+ useEffect(() => {
234
+ onMount && onMount();
235
+ return onUnmount; // eslint-disable-next-line react-hooks/exhaustive-deps
236
+ }, []);
650
237
  }
651
- function isUniqueClass(value) {
652
- return Boolean(value && 'uniqueValue' in value);
238
+
239
+ function useNode() {
240
+ const [node, onSetNode] = useState(null);
241
+ const ref = useCallback(onSetNode, [onSetNode]);
242
+ return [ref, node];
653
243
  }
654
244
 
655
- const NULL_EXPRESSION = {
656
- // @ts-ignore TODO
657
- attribute: null,
658
- // @ts-ignore TODO
659
- operation: null,
660
- value: null
245
+ const useToggle = initial => {
246
+ const [state, setState] = useState(initial !== undefined ? initial : false);
247
+ const toggle = useCallback(() => setState(!state), [state]);
248
+ return [state, toggle, setState];
661
249
  };
662
- let ClassificationCondition = /*#__PURE__*/function () {
663
- function ClassificationCondition(condition) {
664
- _classCallCheck(this, ClassificationCondition);
665
-
666
- this.expressions = [];
667
- this.condition = condition;
668
- const conditionResult = new ConditionInterpreter(condition).value;
669
- this.expressions = conditionResult instanceof Error ? [] : conditionResult.expressions;
670
- }
671
-
672
- _createClass(ClassificationCondition, [{
673
- key: "attributeName",
674
- get: function get() {
675
- return this.leftExpression.attribute;
676
- }
677
- }, {
678
- key: "uniqueValue",
679
- get: function get() {
680
- if (this.isUnique()) {
681
- const {
682
- value
683
- } = this.leftExpression;
684
- return typeof value === 'string' ? value : '';
685
- }
686
-
687
- console.warn("Trying to get unique from range condition " + this.condition);
688
- return '';
689
- }
690
- }, {
691
- key: "range",
692
- get: function get() {
693
- if (!this.isRange()) {
694
- console.warn("Trying to get range from unique condition " + this.condition);
695
- return [0, 0];
696
- }
697
-
698
- if (this.expressions.length === 2) {
699
- const {
700
- value: from
701
- } = this.leftExpression;
702
- const {
703
- value: to
704
- } = this.rightExpression;
705
- return [from, to];
706
- }
707
-
708
- if (this.expressions.length === 1) {
709
- const {
710
- operation,
711
- value
712
- } = this.leftExpression;
713
- const isFrom = operation === TokenType.ArGr;
714
- return [isFrom ? value : null, isFrom ? null : value];
715
- }
716
-
717
- return [0, 0];
718
- }
719
- }, {
720
- key: "type",
721
- get: function get() {
722
- return this.isUnique() ? 1
723
- /* Unique */
724
- : 0
725
- /* Range */
726
- ;
727
- }
728
- }, {
729
- key: "isUnique",
730
- value: function isUnique() {
731
- return this.leftExpression.operation === TokenType.ArEq;
732
- }
733
- }, {
734
- key: "isRange",
735
- value: function isRange() {
736
- return [TokenType.ArGr, TokenType.ArGre, TokenType.ArLs, TokenType.ArLse].includes(this.leftExpression.operation);
737
- }
738
- }, {
739
- key: "toString",
740
- value: function toString() {
741
- return this.condition;
742
- }
743
- }, {
744
- key: "leftExpression",
745
- get: function get() {
746
- return this.expressions.length > 0 ? this.expressions[0] : NULL_EXPRESSION;
747
- }
748
- }, {
749
- key: "rightExpression",
750
- get: function get() {
751
- return this.expressions.length > 1 ? this.expressions[1] : NULL_EXPRESSION;
752
- }
753
- }]);
754
250
 
755
- return ClassificationCondition;
756
- }();
251
+ const getHexColor = colorString => colorString ? new Color(colorString).toString('hex') : undefined;
757
252
 
758
- const PARAMETER_SEPARATOR = '.';
759
- const parameterToPaths = parameter => parameter.split(PARAMETER_SEPARATOR);
760
- const pathsToParameter = paths => paths.join(PARAMETER_SEPARATOR);
253
+ const isNumeric = number => !isNaN(parseFloat(number)) && isFinite(number);
761
254
 
762
255
  function isObject(value) {
763
256
  return typeof value === 'object' && value !== null && !Array.isArray(value);
764
257
  }
765
258
 
766
- const isParameterByAttribute = value => Boolean(isObject(value) && (value == null ? void 0 : value.type) === 'byAttribute');
767
- const isCalculatedParameter = value => Boolean(isObject(value) && (value == null ? void 0 : value.type) === 'calculated');
768
- const getParameterValue = value => {
769
- if (isParameterByAttribute(value) || isCalculatedParameter(value)) {
770
- return value.defaultValue;
771
- }
772
-
773
- return value;
774
- };
775
- const symbolParameterWalker = valueModifier => (symbol, parameter) => {
776
- const paths = Array.isArray(parameter) ? parameter : parameterToPaths(parameter);
777
- const [firstKey, ...restKeys] = paths; // @ts-ignore
778
-
779
- const symbolPart = symbol[firstKey];
780
-
781
- if (restKeys.length) {
782
- const goDeeper = symbolParameterWalker(valueModifier);
783
- return _extends({}, symbol, {
784
- [firstKey]: goDeeper(symbolPart, restKeys) || symbolPart
785
- });
786
- }
787
-
788
- return _extends({}, symbol, {
789
- [firstKey]: valueModifier(symbolPart) || symbolPart
790
- });
791
- };
792
- const setDefaultParameterValue = /*#__PURE__*/symbolParameterWalker(getParameterValue);
793
- const setParameterValue = (symbol, path, value) => symbolParameterWalker(() => value)(symbol, path);
794
- function applyParameterValue(symbol, path, value) {
795
- if (path === 'symbol') {
796
- return value;
797
- }
798
-
799
- return setParameterValue(symbol, path, value);
259
+ function clamp(num, min, max) {
260
+ return Math.min(Math.max(num, min), max);
800
261
  }
801
262
 
802
- const symbolTypeGuard = type => symbol => symbol && symbol.type === type;
803
-
804
- const isPointLabelSymbol = /*#__PURE__*/symbolTypeGuard('labelPointSymbol');
805
- const isPolygonLabelSymbol = /*#__PURE__*/symbolTypeGuard('polygonLabelSymbol');
806
- const isPolylineLabelSymbol = /*#__PURE__*/symbolTypeGuard('polylineLabelSymbol');
807
- const isLabelSymbol = symbol => Boolean(symbol && (isPointLabelSymbol(symbol) || isPolygonLabelSymbol(symbol) || isPolylineLabelSymbol(symbol)));
808
-
809
- const _excluded = ["ignoreLabel", "label", "symbol", "raster", "children"];
810
- const createCompositeSymbol = childSymbols => ({
811
- type: 'compositeSymbol',
812
- childSymbols
813
- });
814
- const getChildSymbols = symbol => {
815
- if (!symbol || !isCompositeSymbol(symbol)) return [];
816
- return symbol.childSymbols || [];
817
- };
818
- const extractSymbol = symbol => {
819
- const childSymbols = getChildSymbols(symbol);
820
- return {
821
- // @ts-ignore
822
- symbol: childSymbols.find(isSimpleSymbol),
823
- label: childSymbols.find(isLabelSymbol) || null,
824
- raster: childSymbols.find(isRasterSymbol) || null
825
- };
826
- };
827
- const extractStyle = style => {
828
- // @ts-ignore
829
- if (isCompositeSymbol(style.symbol)) {
830
- return _extends({}, style, extractSymbol(style.symbol), {
831
- // @ts-ignore
832
- children: style.children && style.children.map(extractStyle)
833
- });
834
- } // NOTE: for cases when style is exist style object should have same reference for all extractStyle calls
835
-
836
-
837
- return style || {};
838
- };
839
- const packStyle = style => {
263
+ const metersToPixels = (meters, _ref) => {
264
+ let {
265
+ painter,
266
+ crs = geo
267
+ } = _ref;
840
268
  const {
841
- ignoreLabel,
842
- label,
843
- symbol,
844
- raster,
845
- children
846
- } = style,
847
- styleDc = _objectWithoutPropertiesLoose(style, _excluded);
848
-
849
- const childSymbols = [!ignoreLabel && label, raster].filter(Boolean);
850
- return _extends({}, styleDc, {
851
- symbol: childSymbols.length ? // @ts-ignore
852
- createCompositeSymbol([symbol, ...childSymbols]) : symbol,
853
- // @ts-ignore
854
- children: children ? // @ts-ignore
855
- children.map(childStyle => packStyle(_extends({}, childStyle, {
856
- ignoreLabel,
857
- label
858
- }))) : children
859
- });
860
- };
861
-
862
- const isPointSymbol = /*#__PURE__*/symbolTypeGuard('circlePointSymbol');
863
- const isSquareSymbol = /*#__PURE__*/symbolTypeGuard('squarePointSymbol');
864
- const isMaskedImageSymbol = /*#__PURE__*/symbolTypeGuard('maskedImagePointSymbol');
865
- const isStaticImageSymbol = /*#__PURE__*/symbolTypeGuard('imagePointSymbol');
866
- const isCombinedPolylineSymbol = /*#__PURE__*/symbolTypeGuard("combinedPolylineSymbol");
867
- const isPolygonSymbol = /*#__PURE__*/symbolTypeGuard('polygonSymbol');
868
- const isSimplePolylineSymbol = /*#__PURE__*/symbolTypeGuard('simplePolylineSymbol');
869
- const isPolylineSymbols = symbol => Boolean(symbol && (isCombinedPolylineSymbol(symbol) || isSimplePolylineSymbol(symbol)));
870
- const isCompositeSymbol = /*#__PURE__*/symbolTypeGuard('compositeSymbol');
871
- const isRasterSymbol = /*#__PURE__*/symbolTypeGuard('rasterSymbol');
872
- const isImageSymbol = symbol => Boolean(symbol && (isMaskedImageSymbol(symbol) || isStaticImageSymbol(symbol)));
873
- const isTwoDimensionalSymbol = symbol => Boolean(symbol && 'width' in symbol);
874
- const isSizableSymbol = symbol => Boolean(symbol && 'size' in symbol);
875
- const isStrokeStyledSymbol = symbol => Boolean(symbol && (isPolygonSymbol(symbol) || isPolylineSymbols(symbol)));
876
- const isScalablePolylineSymbol = symbol => symbol.beginning !== null && symbol.ending !== null || symbol.stroke && symbol.stroke.type !== 'solid';
877
- const isSimpleSymbol = symbol => Boolean(symbol && !isLabelSymbol(symbol) && !isCompositeSymbol(symbol) && !isRasterSymbol(symbol));
878
- const isH3GridSymbol = /*#__PURE__*/symbolTypeGuard("h3grid");
879
- const isSvgPointSymbol = /*#__PURE__*/symbolTypeGuard("svgPointSymbol");
880
- const isClusterSymbol = /*#__PURE__*/symbolTypeGuard("cluster");
881
- const isClusterFillColor = (symbol, parameter) => {
882
- return isClusterSymbol(symbol) && parameter === "fillColor";
883
- };
884
- const getExtractedSymbol = function getExtractedSymbol(symbol, extractCluster) {
885
- var _extractSymbol;
886
-
887
- if (extractCluster === void 0) {
888
- extractCluster = false;
889
- }
890
-
891
- const extracted = isCompositeSymbol(symbol) ? (_extractSymbol = extractSymbol(symbol)) == null ? void 0 : _extractSymbol.symbol : symbol;
892
- return extractCluster && isClusterSymbol(extracted) ? extracted.singleObjectSymbol : extracted;
893
- };
894
-
895
- const isHatchBrush = /*#__PURE__*/symbolTypeGuard('hatch');
896
- const isPatternBrush = /*#__PURE__*/symbolTypeGuard('pattern');
897
- const isDashedBrush = /*#__PURE__*/symbolTypeGuard('dashed');
898
- const isSolidBrush = /*#__PURE__*/symbolTypeGuard('solid');
899
- const isPolygonHasPatternBrush = symbol => Boolean(symbol && isPolygonSymbol(symbol) && isPatternBrush(symbol.fill));
900
- const isPolygonHasHatchBrush = symbol => Boolean(symbol && isPolygonSymbol(symbol) && isHatchBrush(symbol.fill));
901
-
902
- const isMiterExist = miter => Boolean(miter && miter.type !== LineEndingType.None);
903
- const isFilledLineMitter = miter => miter.type === LineEndingType.FilledCircle || miter.type === LineEndingType.FilledArrow || miter.type === LineEndingType.FilledSquare;
904
- const isArrowLineMiter = miter => miter.type === LineEndingType.Arrow || miter.type === LineEndingType.FilledArrow;
905
- const isSquareLineMiter = miter => miter.type === LineEndingType.Square || miter.type === LineEndingType.FilledSquare;
906
- const isCircleLineMiter = miter => miter.type === LineEndingType.Circle || miter.type === LineEndingType.FilledCircle;
907
-
908
- const isSimpleOffset = offset => offset && !isParameterByAttribute(offset[0]) && !isParameterByAttribute(offset[1]);
909
- const isSymbolWithOffset = symbol => Boolean(symbol && 'offset' in symbol);
910
-
911
- const isStringParameterValue = parameterValue => typeof parameterValue === 'string';
912
- const isParameterValueSimple = parameterValue => typeof parameterValue === 'number' || typeof parameterValue === 'string';
913
- const isParameterValueSymbol = parameterValue => !isParameterValueSimple(parameterValue);
914
-
915
- const isStyle = value => 'symbol' in value;
916
-
917
- let EvergisStyle = /*#__PURE__*/function () {
918
- function EvergisStyle(style) {
919
- _classCallCheck(this, EvergisStyle);
920
-
921
- this.style = extractStyle(style);
922
- this.classificationManager = new ClassificationManager(this.style);
923
- }
924
-
925
- _createClass(EvergisStyle, [{
926
- key: "serialize",
927
- value: function serialize() {
928
- return packStyle(this.style);
929
- }
930
- }, {
931
- key: "hasRasters",
932
- value: function hasRasters() {
933
- return !!(this.style.raster || (this.style.children || []).some(style => style.raster));
934
- }
935
- }, {
936
- key: "symbol",
937
- get: function get() {
938
- return this.style.symbol;
939
- }
940
- }, {
941
- key: "raster",
942
- get: function get() {
943
- return this.style.raster;
944
- }
945
- }, {
946
- key: "label",
947
- get: function get() {
948
- return this.style.label;
949
- }
950
- }, {
951
- key: "children",
952
- get: function get() {
953
- return this.style.children;
954
- }
955
- }, {
956
- key: "title",
957
- get: function get() {
958
- return this.style.title;
959
- }
960
- }, {
961
- key: "condition",
962
- get: function get() {
963
- return this.style.condition;
964
- }
965
- }, {
966
- key: "ignoreLabel",
967
- get: function get() {
968
- return this.style.ignoreLabel;
969
- }
970
- }, {
971
- key: "resolution",
972
- get: function get() {
973
- const {
974
- minResolution,
975
- maxResolution
976
- } = this.style;
977
- return minResolution === void 0 || maxResolution === void 0 ? null : [minResolution, maxResolution];
978
- }
979
- }]);
980
-
981
- return EvergisStyle;
982
- }();
983
-
984
- const toClassificationClass = (parameterValue, title, condition) => _extends({
985
- parameterValue,
986
- title
987
- }, condition.isUnique() ? {
988
- uniqueValue: condition.uniqueValue
989
- } : {
990
- from: condition.range[0],
991
- to: condition.range[1]
992
- });
993
-
994
- const DEFAULT_EXTRAS = {
995
- defaultTitle: '',
996
- // @ts-ignore
997
- defaultValue: null
998
- };
999
- const toClassification = function toClassification(values, parameter, extras) {
1000
- if (extras === void 0) {
1001
- extras = DEFAULT_EXTRAS;
1002
- }
1003
-
1004
- return (// @ts-ignore
1005
- values.reduce( // @ts-ignore
1006
- (classification, value) => {
1007
- const classificationCondition = new ClassificationCondition(value.condition || '');
1008
- const classificationValue = toClassificationClass(isStyle(value) ? value.symbol : value.value, // @ts-ignore
1009
- value.title, classificationCondition);
1010
- classification.values.push(classificationValue);
1011
- return _extends({}, classification, {
1012
- type: classification.type || classificationCondition.type,
1013
- attribute: classification.attribute || classificationCondition.attributeName
1014
- });
1015
- }, _extends({}, extras, {
1016
- attribute: null,
1017
- parameter,
1018
- type: null,
1019
- values: []
1020
- }))
1021
- );
1022
- };
1023
- const getClassifications = function getClassifications(symbol, pathContext) {
1024
- if (pathContext === void 0) {
1025
- pathContext = [];
1026
- }
1027
-
1028
- return Object.entries(symbol).reduce((classifications, _ref) => {
1029
- let [parameter, parameterValue] = _ref;
1030
- const skipHeight = isTwoDimensionalSymbol(symbol) && parameter === 'height';
1031
- const skip = !isObject(parameterValue) || skipHeight;
1032
-
1033
- if (skip) {
1034
- return classifications;
1035
- }
1036
-
1037
- if (!isParameterByAttribute(parameterValue)) {
1038
- return [...classifications, // @ts-ignore
1039
- ...getClassifications(symbol[parameter], [...pathContext, parameter])];
1040
- }
1041
-
1042
- const classification = toClassification(parameterValue.values, pathsToParameter([...pathContext, parameter]), {
1043
- // @ts-ignore
1044
- defaultTitle: parameterValue.title,
1045
- defaultValue: parameterValue.defaultValue
1046
- });
1047
- return [...classifications, classification];
1048
- }, []);
1049
- };
1050
-
1051
- let ClassificationManager = /*#__PURE__*/function () {
1052
- function ClassificationManager(style) {
1053
- _classCallCheck(this, ClassificationManager);
1054
-
1055
- this.style = style;
1056
- this.classifications = [];
1057
- this.collectClassifications();
1058
- }
1059
-
1060
- _createClass(ClassificationManager, [{
1061
- key: "values",
1062
- get: function get() {
1063
- return this.classifications;
1064
- }
1065
- }, {
1066
- key: "find",
1067
- value: function find(predicate) {
1068
- for (const classification of this.classifications) {
1069
- if (predicate(classification)) {
1070
- return classification;
1071
- }
1072
- }
1073
-
1074
- return null;
1075
- }
1076
- }, {
1077
- key: "filter",
1078
- value: function filter(callback) {
1079
- return this.classifications.filter(callback);
1080
- }
1081
- }, {
1082
- key: "map",
1083
- value: function map(callback) {
1084
- return this.classifications.map(callback);
1085
- }
1086
- }, {
1087
- key: "reduce",
1088
- value: function reduce(callback, initial) {
1089
- return this.classifications.reduce(callback, initial);
1090
- }
1091
- }, {
1092
- key: "hasClassifications",
1093
- value: function hasClassifications() {
1094
- return this.classifications.length > 0;
1095
- }
1096
- }, {
1097
- key: "collectClassifications",
1098
- value: function collectClassifications() {
1099
- if (this.style.children && this.style.children.length) {
1100
- this.classifications.push(toClassification(this.style.children, 'symbol'));
1101
- }
1102
-
1103
- if (this.style.symbol) {
1104
- this.classifications.push(...getClassifications(this.style.symbol));
1105
- }
1106
- }
1107
- }]);
1108
-
1109
- return ClassificationManager;
1110
- }();
1111
-
1112
- const unClassify = symbol => Object.entries(symbol).reduce((flatSymbol, _ref) => {
1113
- let [parameter, parameterValue] = _ref;
1114
- let result = Array.isArray(parameterValue) ? parameterValue.map(getParameterValue) : getParameterValue(parameterValue);
1115
-
1116
- if (isObject(result)) {
1117
- return _extends({}, flatSymbol, {
1118
- [parameter]: unClassify(parameterValue)
1119
- });
1120
- }
1121
-
1122
- return _extends({}, flatSymbol, {
1123
- [parameter]: result
1124
- });
1125
- }, {});
1126
-
1127
- const DEFAULT_LANGUAGE = "ru";
1128
- const resources = {
1129
- en: {},
1130
- ru: {}
1131
- };
1132
- i18n.use(LanguageDetector).use(initReactI18next).init({
1133
- fallbackLng: DEFAULT_LANGUAGE,
1134
- ns: Object.keys(resources[DEFAULT_LANGUAGE]),
1135
- interpolation: {
1136
- escapeValue: false
1137
- },
1138
- resources,
1139
- supportedLngs: Object.keys(resources)
1140
- });
1141
-
1142
- const printRangeClass = (value, index) => {
1143
- var _value$attribute, _value$attribute2;
1144
-
1145
- const isDouble = Boolean(((_value$attribute = value.attribute) == null ? void 0 : _value$attribute.type) === 'Double');
1146
- const isDate = Boolean(((_value$attribute2 = value.attribute) == null ? void 0 : _value$attribute2.type) === 'DateTime');
1147
- const {
1148
- from,
1149
- to
1150
- } = getRangeValues(value, isDouble, isDate, index);
1151
-
1152
- if (from === null) {
1153
- return to + " " + (isDate ? i18n.t("andBefore", {
1154
- ns: "style"
1155
- }) : i18n.t("andLess", {
1156
- ns: "style"
1157
- }));
1158
- }
1159
-
1160
- if (to === null) {
1161
- return (isDate ? i18n.t("after", {
1162
- ns: "style"
1163
- }) : i18n.t("more", {
1164
- ns: "style"
1165
- })) + " " + from;
1166
- }
1167
-
1168
- return from === to ? "" + from : from + " - " + to;
1169
- };
1170
-
1171
- function getRangeValues(_ref, isDouble, isDate, index) {
1172
- let {
1173
- from,
1174
- to
1175
- } = _ref;
1176
- return {
1177
- from: from !== null && index !== 0 ? isDate ? from : isDouble ? +from : +from + 1 : from,
1178
- to
1179
- };
1180
- }
1181
-
1182
- function evaluateCondition(condition, attributes) {
1183
- try {
1184
- const evaluator = new ConditionEvaluator(attributes);
1185
- const result = evaluator.evaluate(condition);
1186
-
1187
- if (result instanceof Error) {
1188
- return null;
1189
- }
1190
-
1191
- return result;
1192
- } catch (_unused) {
1193
- return null;
1194
- }
1195
- }
1196
-
1197
- function getAttributeValue(attributes, attributeName) {
1198
- const attributeMeta = attributes.find((_ref) => {
1199
- let {
1200
- name
1201
- } = _ref;
1202
- return name === attributeName;
1203
- });
1204
- return attributeMeta ? attributeMeta.value : null;
1205
- }
1206
-
1207
- const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
1208
- const getAttributeNameFromClassified = values => values.length > 0 ? getAttributeNameFromCondition(values[0].condition) : null;
1209
-
1210
- function findFeatureValue(parameterValues, _ref2) {
1211
- let [name, value] = _ref2;
1212
- return value !== null ? parameterValues.find((_ref3) => {
1213
- let {
1214
- condition
1215
- } = _ref3;
1216
- return value !== undefined && evaluateCondition(condition, {
1217
- [name]: value
1218
- });
1219
- }) : null;
1220
- }
1221
-
1222
- function extractValuesAttribute(parameterValues, attributes) {
1223
- const name = getAttributeNameFromClassified(parameterValues) || '';
1224
- const value = name && getAttributeValue(attributes, name);
1225
- return [name, value];
1226
- }
1227
-
1228
- function evaluateFeatureSymbol(attributes) {
1229
- // @ts-ignore
1230
- function calc(result, _ref4) {
1231
- let [parameterName, parameterValue] = _ref4;
1232
- let newParameterValue;
1233
-
1234
- if (isParameterByAttribute(parameterValue)) {
1235
- const [attributeName, attributeValue] = extractValuesAttribute(parameterValue.values, attributes);
1236
- const featureValue = findFeatureValue(parameterValue.values, [attributeName, attributeValue]);
1237
- newParameterValue = featureValue ? featureValue.value : parameterValue.defaultValue;
1238
- } else if (isObject(parameterValue)) {
1239
- // @ts-ignore
1240
- newParameterValue = Object.entries(parameterValue).reduce(calc, parameterValue);
1241
- }
1242
-
1243
- return newParameterValue !== undefined ? _extends({}, result, {
1244
- [parameterName]: newParameterValue
1245
- }) : result;
1246
- }
1247
-
1248
- return calc;
1249
- }
1250
-
1251
- function findChildFeatureStyle(childStyles, attributes) {
1252
- return (childStyles || []).find((_ref5) => {
1253
- let {
1254
- condition
1255
- } = _ref5;
1256
- const attributeName = condition && getAttributeNameFromCondition(condition);
1257
- const attributeValue = attributeName && getAttributeValue(attributes, attributeName);
1258
-
1259
- if (condition && attributeName && attributeValue !== undefined) {
1260
- return evaluateCondition(condition, {
1261
- [attributeName]: attributeValue
1262
- });
1263
- }
1264
-
1265
- return false;
1266
- }) || null;
1267
- }
1268
- function findChildFeatureSymbol(childStyles, attributes) {
1269
- const featureStyle = findChildFeatureStyle(childStyles, attributes);
1270
- return featureStyle ? featureStyle.symbol : null;
1271
- }
1272
- function getFeatureSymbol(style, attributes) {
1273
- if (!style || !style.symbol) {
1274
- return null;
1275
- }
1276
-
1277
- if (style.children !== null) {
1278
- return findChildFeatureSymbol(style.children, attributes) || style.symbol;
1279
- }
1280
-
1281
- return Object.entries(style.symbol).reduce(evaluateFeatureSymbol(attributes), style.symbol);
1282
- }
1283
-
1284
- function createValueTitle(value, index) {
1285
- if (value.title) return value.title;
1286
- if (isRangeClass(value)) return printRangeClass(value, index);
1287
- if (isUniqueClass(value)) return value.uniqueValue;
1288
- return '';
1289
- }
1290
-
1291
- function isValidParameter(parameter) {
1292
- return !(parameter != null && parameter.includes("labelSymbol")) && !(parameter != null && parameter.includes("singleObjectSymbol"));
1293
- }
1294
-
1295
- var FilterConditionOperation;
1296
-
1297
- (function (FilterConditionOperation) {
1298
- FilterConditionOperation["AND"] = "&&";
1299
- FilterConditionOperation["OR"] = "||";
1300
- })(FilterConditionOperation || (FilterConditionOperation = {}));
1301
-
1302
- var ComparisonOperator;
1303
-
1304
- (function (ComparisonOperator) {
1305
- /** `==` */
1306
- ComparisonOperator["Equals"] = "Equals";
1307
- /** `!=` */
1308
-
1309
- ComparisonOperator["NotEquals"] = "NotEquals";
1310
- /** `>` */
1311
-
1312
- ComparisonOperator["GreaterThan"] = "GreaterThan";
1313
- /** `<` */
1314
-
1315
- ComparisonOperator["LessThan"] = "LessThan";
1316
- /** `>=` */
1317
-
1318
- ComparisonOperator["GreaterOrEquals"] = "GreaterOrEquals";
1319
- /** `<=` */
1320
-
1321
- ComparisonOperator["LessOrEquals"] = "LessOrEquals";
1322
- ComparisonOperator["Filled"] = "Filled";
1323
- ComparisonOperator["Empty"] = "Empty";
1324
- /** `==` */
1325
-
1326
- ComparisonOperator["Contains"] = "Contains";
1327
- /** `!=` */
1328
-
1329
- ComparisonOperator["NotContains"] = "NotContains";
1330
- ComparisonOperator["StartsWith"] = "StartsWith";
1331
- ComparisonOperator["NotStartsWith"] = "NotStartsWith";
1332
- ComparisonOperator["EndsWith"] = "EndsWith";
1333
- ComparisonOperator["NotEndsWith"] = "NotEndsWith";
1334
- ComparisonOperator["Between"] = "Between";
1335
- ComparisonOperator["Outside"] = "Outside";
1336
- })(ComparisonOperator || (ComparisonOperator = {}));
1337
-
1338
- const DEFAULT_LEGEND_SYMBOL_SIZE = 26;
1339
- const EXTRA_BORDER_SIZE = 4;
1340
- const DEFAULT_SYMBOL_SIZE = 20;
1341
- const DEFAULT_SYMBOL_WITH_BG_SIZE = 24;
1342
- const DEFAULT_SYMBOL_FILL_COLOR = 'rgba(0, 163, 245, 1)';
1343
- const DEFAULT_SYMBOL_STROKE_COLOR = 'rgb(255, 255, 255)';
1344
- const DEFAULT_SYMBOL_OFFSET = [0, 0];
1345
- const DEFAULT_CLUSTER_SVG = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 56 56\" width=\"56px\" height=\"56px\">\n <circle cx=\"28\" cy=\"28\" r=\"22\" fill=\"#00AAFF\" stroke=\"#00AAFF\" stroke-opacity=\"0.28\" stroke-width=\"12\" id=\"symbol-bg\" />\n</svg>\n";
1346
- const SYMBOL_CLASSIFICATION = {
1347
- [GeometryType.Polygon]: ['fill.color', 'stroke.color', 'stroke.width'],
1348
- [GeometryType.Polyline]: ['stroke.color', 'stroke.width'],
1349
- [GeometryType.Point]: ['angle', 'size', 'fill.color', 'fillColor', 'background.fillColor', 'background.strokeColor', 'background.strokeWidth', 'figure.fillColor', 'figure.strokeColor', 'figure.strokeWidth', 'singleObjectSymbol.size', 'singleObjectSymbol.figure.fillColor', 'singleObjectSymbol.figure.strokeColor', 'singleObjectSymbol.figure.strokeWidth', 'singleObjectSymbol.background.fillColor', 'singleObjectSymbol.background.strokeColor', 'singleObjectSymbol.background.strokeWidth']
1350
- };
1351
- const SYMBOL_LIMITS = {
1352
- SIZE_MIN: 1,
1353
- SIZE_MAX: 64,
1354
- SIZE_STEP: 1,
1355
- GRID_SIZE_MIN: 0.1,
1356
- GRID_SIZE_MAX: 120,
1357
- MIN_OBJECTS_COUNT: 2,
1358
- MAX_OBJECTS_COUNT: 10000,
1359
- MIN_CLUSTER_SIZE: 16,
1360
- MAX_CLUSTER_SIZE: 120,
1361
- STROKE_WIDTH_MIN: 0,
1362
- STROKE_WIDTH_MAX: 32,
1363
- STROKE_WIDTH_STEP: 0.25,
1364
- ANGLE_MIN: -360,
1365
- ANGLE_MAX: 360,
1366
- ANGLE_STEP: 1,
1367
- PREVIEW_SIZE_MAX: 32,
1368
- PREVIEW_SIZE_MAX_WIDTH: 26
1369
- };
1370
- const DEFAULT_PARAMETER_INFO = {
1371
- classifyAble: true,
1372
- min: SYMBOL_LIMITS.STROKE_WIDTH_MIN,
1373
- max: SYMBOL_LIMITS.STROKE_WIDTH_MAX,
1374
- step: SYMBOL_LIMITS.STROKE_WIDTH_STEP,
1375
- units: "px"
1376
- /* Pixels */
1377
- ,
1378
- serialize: value => value,
1379
- deserialize: value => value
1380
- };
1381
- const PARAMETER_INFOS = {
1382
- size: /*#__PURE__*/_extends({}, DEFAULT_PARAMETER_INFO, {
1383
- min: SYMBOL_LIMITS.SIZE_MIN,
1384
- max: SYMBOL_LIMITS.SIZE_MAX,
1385
- step: SYMBOL_LIMITS.SIZE_STEP,
1386
- units: "px"
1387
- /* Pixels */
1388
-
1389
- })
1390
- };
1391
- const OPERATOR_CONDITION_REMAP = {
1392
- [ComparisonOperator.Equals]: '==',
1393
- [ComparisonOperator.NotEquals]: '!=',
1394
- [ComparisonOperator.GreaterThan]: '>',
1395
- [ComparisonOperator.GreaterOrEquals]: '>=',
1396
- [ComparisonOperator.LessThan]: '<',
1397
- [ComparisonOperator.LessOrEquals]: '<=',
1398
- [ComparisonOperator.Filled]: '!=',
1399
- [ComparisonOperator.Empty]: '==',
1400
- [ComparisonOperator.Contains]: '==',
1401
- [ComparisonOperator.NotContains]: '!=',
1402
- [ComparisonOperator.StartsWith]: '==',
1403
- [ComparisonOperator.NotStartsWith]: '!=',
1404
- [ComparisonOperator.EndsWith]: '==',
1405
- [ComparisonOperator.NotEndsWith]: '!=',
1406
- [ComparisonOperator.Between]: 'between',
1407
- [ComparisonOperator.Outside]: '!between'
1408
- };
1409
- const BASE_OPERATORS = [ComparisonOperator.Equals, ComparisonOperator.NotEquals];
1410
- const CONTAINS_OPERATORS = [ComparisonOperator.Contains, ComparisonOperator.NotContains];
1411
- const FILLED_OPERATORS = [ComparisonOperator.Filled, ComparisonOperator.Empty];
1412
- const STARTS_WITH_OPERATORS = [ComparisonOperator.StartsWith, ComparisonOperator.NotStartsWith];
1413
- const ENDS_WITH_OPERATORS = [ComparisonOperator.EndsWith, ComparisonOperator.NotEndsWith];
1414
- const RANGE_OPERATORS = [ComparisonOperator.LessThan, ComparisonOperator.LessOrEquals, ComparisonOperator.GreaterThan, ComparisonOperator.GreaterOrEquals];
1415
- const BETWEEN_OPERATORS = [ComparisonOperator.Between, ComparisonOperator.Outside];
1416
- const numberComparisonOperators = [...BASE_OPERATORS, ...RANGE_OPERATORS, ...FILLED_OPERATORS, ...BETWEEN_OPERATORS];
1417
- const dateComparisonOperators = [...BASE_OPERATORS, ...RANGE_OPERATORS, ...FILLED_OPERATORS, ...BETWEEN_OPERATORS];
1418
- const textComparisonOperators = [...BASE_OPERATORS, ...CONTAINS_OPERATORS, ...STARTS_WITH_OPERATORS, ...ENDS_WITH_OPERATORS, ...FILLED_OPERATORS];
1419
-
1420
- var SvgSymbolBg;
1421
-
1422
- (function (SvgSymbolBg) {
1423
- SvgSymbolBg["Rect"] = "rect";
1424
- SvgSymbolBg["Circle"] = "circle";
1425
- })(SvgSymbolBg || (SvgSymbolBg = {}));
1426
-
1427
- const DEFAULT_STROKE_OPACITY = 0.28;
1428
- const convertSvgToBase64 = svg => "data:image/svg+xml;base64," + window.btoa(svg);
1429
- const createSvgGradient = (svg, values) => svg.gradient('linear', add => {
1430
- values == null ? void 0 : values.forEach((_ref, index) => {
1431
- let {
1432
- value
1433
- } = _ref;
1434
- add.stop(index / ((values == null ? void 0 : values.length) - 1), value);
1435
- });
1436
- }).from(0, 0).to(1, 1); // eslint-disable-next-line max-lines-per-function
1437
-
1438
- const manipulateSvgSymbol = (_ref2) => {
1439
- var _$exec2;
1440
-
1441
- let {
1442
- SVGContainer,
1443
- symbol,
1444
- svg,
1445
- bg,
1446
- isClassified
1447
- } = _ref2;
1448
- if (!symbol) return SVGContainer;
1449
- const symbolData = getParameterValue(svg || symbol.data);
1450
- if (!symbolData) return SVGContainer;
1451
- SVGContainer.clear();
1452
- const {
1453
- size,
1454
- angle,
1455
- background,
1456
- figure
1457
- } = symbol;
1458
- const isUploadedFile = !bg && !symbolData.includes('symbol-bg') && !symbolData.includes('symbol-figure');
1459
- const innerSvg = symbolData.replace(/<\?xml[^?]*\?>|<svg[^>]*>|<\/svg>/g, '');
1460
-
1461
- if (isUploadedFile) {
1462
- var _$exec;
1463
-
1464
- SVGContainer.svg(innerSvg);
1465
- const uploadedViewBox = (_$exec = /viewBox="([^"]+)"/g.exec(symbolData)) == null ? void 0 : _$exec[1];
1466
-
1467
- if (uploadedViewBox != null && uploadedViewBox[1]) {
1468
- SVGContainer.viewbox(uploadedViewBox);
1469
- }
1470
-
1471
- SVGContainer.size(size);
1472
- } else {
1473
- const hasBg = bg || (innerSvg == null ? void 0 : innerSvg.includes('symbol-bg'));
1474
- let defaultSize = hasBg ? DEFAULT_SYMBOL_WITH_BG_SIZE : DEFAULT_SYMBOL_SIZE;
1475
- const currentSize = size || defaultSize;
1476
- let viewBox = [0, 0, defaultSize, defaultSize];
1477
- const strokeWidth = getParameterValue(background == null ? void 0 : background.strokeWidth) || (typeof (background == null ? void 0 : background.strokeColor) === 'object' ? 1 : 0);
1478
-
1479
- if (strokeWidth) {
1480
- defaultSize += strokeWidth;
1481
- viewBox = [-strokeWidth / 2, -strokeWidth / 2, defaultSize, defaultSize];
1482
- }
1483
-
1484
- if (hasBg) {
1485
- SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(' '));
1486
- const currentBg = bg || (background == null ? void 0 : background.type);
1487
-
1488
- if (currentBg) {
1489
- const strokeColor = getParameterValue(background == null ? void 0 : background.strokeColor);
1490
- const fillColor = getParameterValue(background == null ? void 0 : background.fillColor);
1491
- SVGContainer.svg(currentBg === SvgSymbolBg.Circle ? "<circle\n id=\"symbol-bg\"\n cx=\"" + DEFAULT_SYMBOL_WITH_BG_SIZE / 2 + "\"\n cy=\"" + DEFAULT_SYMBOL_WITH_BG_SIZE / 2 + "\"\n r=\"" + DEFAULT_SYMBOL_WITH_BG_SIZE / 2 + "\"\n fill=\"" + (fillColor || DEFAULT_SYMBOL_FILL_COLOR) + "\"\n stroke=\"" + (strokeColor || DEFAULT_SYMBOL_STROKE_COLOR) + "\"\n stroke-width=\"" + strokeWidth + "\"\n />" : "<rect\n id=\"symbol-bg\"\n width=\"" + DEFAULT_SYMBOL_WITH_BG_SIZE + "\"\n height=\"" + DEFAULT_SYMBOL_WITH_BG_SIZE + "\"\n rx=\"4\"\n fill=\"" + (fillColor || DEFAULT_SYMBOL_FILL_COLOR) + "\"\n stroke=\"" + (strokeColor || DEFAULT_SYMBOL_STROKE_COLOR) + "\"\n stroke-width=\"" + strokeWidth + "\"\n />");
1492
- SVGContainer.svg(innerSvg);
1493
- SVGContainer.find('#symbol-bg:not(:first-child)').each(item => item.remove());
1494
- SVGContainer.find(':not(#symbol-bg)').each(item => item.center(DEFAULT_SYMBOL_WITH_BG_SIZE / 2, DEFAULT_SYMBOL_WITH_BG_SIZE / 2).fill('white'));
1495
- const symbolBg = SVGContainer.find('#symbol-bg')[0];
1496
-
1497
- if (isClassified) {
1498
- symbolBg == null ? void 0 : symbolBg.stroke({
1499
- opacity: DEFAULT_STROKE_OPACITY
1500
- });
1501
- } // eslint-disable-next-line max-depth
1502
-
1503
-
1504
- if (isParameterByAttribute(background == null ? void 0 : background.fillColor)) {
1505
- var _background$fillColor;
1506
-
1507
- symbolBg == null ? void 0 : symbolBg.fill(createSvgGradient(SVGContainer, background == null ? void 0 : (_background$fillColor = background.fillColor) == null ? void 0 : _background$fillColor.values));
1508
- }
1509
-
1510
- if (isParameterByAttribute(background == null ? void 0 : background.strokeColor)) {
1511
- var _background$strokeCol;
1512
-
1513
- symbolBg == null ? void 0 : symbolBg.stroke({
1514
- color: createSvgGradient(SVGContainer, background == null ? void 0 : (_background$strokeCol = background.strokeColor) == null ? void 0 : _background$strokeCol.values)
1515
- });
1516
- }
1517
- } else {
1518
- SVGContainer.svg(innerSvg);
1519
- }
1520
- } else {
1521
- const strokeColor = getParameterValue(figure == null ? void 0 : figure.strokeColor);
1522
- const strokeWidth = getParameterValue(figure == null ? void 0 : figure.strokeWidth) || (typeof (figure == null ? void 0 : figure.strokeColor) === 'object' ? 1 : 0);
1523
- const fillColor = getParameterValue(figure == null ? void 0 : figure.fillColor);
1524
- SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(' '));
1525
- SVGContainer.svg(innerSvg);
1526
- SVGContainer.find('#symbol-figure').each(item => {
1527
- item.center(DEFAULT_SYMBOL_SIZE / 2, DEFAULT_SYMBOL_SIZE / 2).fill(fillColor || DEFAULT_SYMBOL_FILL_COLOR).stroke({
1528
- color: strokeColor,
1529
- width: strokeWidth
1530
- });
1531
-
1532
- if (isParameterByAttribute(figure == null ? void 0 : figure.fillColor)) {
1533
- var _figure$fillColor;
1534
-
1535
- item == null ? void 0 : item.fill(createSvgGradient(SVGContainer, figure == null ? void 0 : (_figure$fillColor = figure.fillColor) == null ? void 0 : _figure$fillColor.values));
1536
- }
1537
-
1538
- if (isParameterByAttribute(figure == null ? void 0 : figure.strokeColor)) {
1539
- var _figure$strokeColor;
1540
-
1541
- item == null ? void 0 : item.stroke({
1542
- color: createSvgGradient(SVGContainer, figure == null ? void 0 : (_figure$strokeColor = figure.strokeColor) == null ? void 0 : _figure$strokeColor.values)
1543
- });
1544
- }
1545
- });
1546
- }
1547
- }
1548
-
1549
- const rootTransform = (_$exec2 = /<svg[^>]*transform="([^"]+)"/g.exec(symbolData)) == null ? void 0 : _$exec2[1];
1550
-
1551
- if (rootTransform) {
1552
- const transformParts = rootTransform.slice(0, -1).split('(');
1553
- SVGContainer.transform({
1554
- [transformParts[0]]: transformParts[1].split(',')
1555
- });
1556
- }
1557
-
1558
- const rotatedAngle = SVGContainer.transform('rotate');
1559
-
1560
- if (rotatedAngle) {
1561
- SVGContainer.rotate(-rotatedAngle, 0, 0);
1562
- }
1563
-
1564
- if (angle !== undefined) {
1565
- SVGContainer.rotate(angle * (180 / Math.PI), 0, 0);
1566
- }
1567
-
1568
- return SVGContainer;
1569
- };
1570
-
1571
- const isNumeric = number => !isNaN(parseFloat(number)) && isFinite(number);
1572
-
1573
- const comparisonOperatorMapReversed = {
1574
- [TokenType.ArEq]: ComparisonOperator.Equals,
1575
- [TokenType.ArNotEq]: ComparisonOperator.NotEquals,
1576
- [TokenType.ArGr]: ComparisonOperator.GreaterThan,
1577
- [TokenType.ArLs]: ComparisonOperator.LessThan,
1578
- [TokenType.ArGre]: ComparisonOperator.GreaterOrEquals,
1579
- [TokenType.ArLse]: ComparisonOperator.LessOrEquals,
1580
- [TokenType.Between]: ComparisonOperator.Between,
1581
- [TokenType.Outside]: ComparisonOperator.Outside
1582
- };
1583
- const NUMERIC_ATTRIBUTE_TYPES = [AttributeType.Int32, AttributeType.Int64, AttributeType.DateTime, AttributeType.Double];
1584
-
1585
- const formatValue = (value, isDate) => {
1586
- return isDate ? "#'" + formatDate(value, {
1587
- dateFormat: DateFormat.UTC,
1588
- defaultValue: value
1589
- }) + "'" : value ? value.toString() : 0;
1590
- };
1591
-
1592
- function formatCondition(condition) {
1593
- const {
1594
- comparisonOperator,
1595
- value,
1596
- type,
1597
- attribute
1598
- } = condition;
1599
- const operator = OPERATOR_CONDITION_REMAP[comparisonOperator] || comparisonOperator;
1600
- const preparedValue = typeof value === "string" && value.includes(" - ") ? value.split(" - ") : value;
1601
- const isDate = type === AttributeType.DateTime;
1602
- const isBetweenOutside = BETWEEN_OPERATORS.includes(comparisonOperator);
1603
- const escapeValue = !NUMERIC_ATTRIBUTE_TYPES.includes(type) && preparedValue !== null;
1604
-
1605
- if (isBetweenOutside && Array.isArray(preparedValue) && preparedValue[0] !== undefined) {
1606
- return OPERATOR_CONDITION_REMAP[comparisonOperator] + "(" + attribute + ", " + formatValue(preparedValue[0], isDate) + ", " + formatValue(preparedValue[1], isDate) + ")";
1607
- }
1608
-
1609
- const formattedValue = Array.isArray(preparedValue) ? preparedValue.map(val => formatValue(val, isDate)) : formatValue(preparedValue, isDate);
1610
- const nulledValue = isNil(preparedValue) ? "{null}" : formattedValue;
1611
- const valueEscaped = escapeValue && typeof nulledValue === "string" ? "'" + Char.escapeSpecChars(addOperationToValue(nulledValue, comparisonOperator)) + "'" : nulledValue;
1612
- return attribute + " " + operator + " " + valueEscaped;
1613
- }
1614
- function createConditionString(condition) {
1615
- if (Array.isArray(condition)) {
1616
- return "( " + formatCondition(condition[0]) + " " + condition[0].operation + " " + formatCondition(condition[1]) + " )";
1617
- }
1618
-
1619
- return formatCondition(condition);
1620
- }
1621
- function createCondition(_ref) {
1622
- let {
1623
- attribute,
1624
- operation,
1625
- value
1626
- } = _ref;
1627
- const comparisonOperator = comparisonOperatorMapReversed[operation];
1628
- const convertedResult = convertOperatorValue(value, comparisonOperator);
1629
- return _extends({
1630
- attribute
1631
- }, convertedResult);
1632
- }
1633
-
1634
- function convertOperatorValue(value, comparisonOperator) {
1635
- if (typeof value === "string") {
1636
- const operatorIndex = +(comparisonOperator === ComparisonOperator.NotEquals);
1637
-
1638
- if (value.startsWith(Char.PERCENTAGE) && value.endsWith(Char.PERCENTAGE)) {
1639
- return {
1640
- value: value.slice(1, -1),
1641
- comparisonOperator: CONTAINS_OPERATORS[operatorIndex]
1642
- };
1643
- }
1644
-
1645
- if (value.startsWith(Char.PERCENTAGE)) {
1646
- return {
1647
- value: value.slice(1),
1648
- comparisonOperator: ENDS_WITH_OPERATORS[operatorIndex]
1649
- };
1650
- }
1651
-
1652
- if (value.endsWith(Char.PERCENTAGE)) {
1653
- return {
1654
- value: value.slice(0, -1),
1655
- comparisonOperator: STARTS_WITH_OPERATORS[operatorIndex]
1656
- };
1657
- }
1658
- }
1659
-
1660
- return {
1661
- value,
1662
- comparisonOperator
1663
- };
1664
- }
1665
-
1666
- const addContains = value => "%" + value + "%";
1667
-
1668
- const addStartsWith = value => value + "%";
1669
-
1670
- const addEndsWith = value => "%" + value;
1671
-
1672
- function addOperationToValue(value, operator) {
1673
- switch (operator) {
1674
- case ComparisonOperator.Contains:
1675
- case ComparisonOperator.NotContains:
1676
- return addContains(value);
1677
-
1678
- case ComparisonOperator.StartsWith:
1679
- case ComparisonOperator.NotStartsWith:
1680
- return addStartsWith(value);
1681
-
1682
- case ComparisonOperator.EndsWith:
1683
- case ComparisonOperator.NotEndsWith:
1684
- return addEndsWith(value);
1685
-
1686
- case ComparisonOperator.Between:
1687
- return Char.BETWEEN;
1688
-
1689
- case ComparisonOperator.Outside:
1690
- return Char.OUTSIDE;
1691
-
1692
- default:
1693
- return value;
1694
- }
1695
- }
1696
-
1697
- let FilterCondition = /*#__PURE__*/function () {
1698
- function FilterCondition(condition) {
1699
- if (condition === void 0) {
1700
- condition = null;
1701
- }
1702
-
1703
- _classCallCheck(this, FilterCondition);
1704
-
1705
- this.condition = condition;
1706
- this.conditionInterpreter = new ConditionInterpreter(condition);
1707
- }
1708
-
1709
- _createClass(FilterCondition, [{
1710
- key: "conditions",
1711
- get: function get() {
1712
- const {
1713
- value
1714
- } = this.conditionInterpreter;
1715
-
1716
- if (value instanceof Error) {
1717
- // TODO handle errors in client notifications
1718
- console.warn(value.message);
1719
- }
1720
-
1721
- return value instanceof Error ? [] : value.expressions.map(createCondition);
1722
- }
1723
- }, {
1724
- key: "conditionOperation",
1725
- get: function get() {
1726
- const {
1727
- value
1728
- } = this.conditionInterpreter;
1729
-
1730
- if (value instanceof Error) {
1731
- return null;
1732
- }
1733
-
1734
- const isOrCondition = value.boolOperations.includes(TokenType.BoolOr);
1735
- const isAndCondition = value.boolOperations.includes(TokenType.BoolAnd);
1736
-
1737
- if (isOrCondition && isAndCondition) {
1738
- return null;
1739
- }
1740
-
1741
- return isOrCondition ? FilterConditionOperation.OR : isAndCondition ? FilterConditionOperation.AND : null;
1742
- }
1743
- }, {
1744
- key: "isParsingError",
1745
- value: function isParsingError() {
1746
- return this.conditionInterpreter.value instanceof Error;
1747
- }
1748
- }, {
1749
- key: "toString",
1750
- value: function toString() {
1751
- return this.condition;
1752
- }
1753
- }], [{
1754
- key: "from",
1755
- value: function from(conditions, operation) {
1756
- const condition = (conditions == null ? void 0 : conditions.map(createConditionString).join(" " + operation + " ")) || null;
1757
- return new FilterCondition(condition);
1758
- }
1759
- }]);
1760
-
1761
- return FilterCondition;
1762
- }();
1763
-
1764
- const isLayerService = value => isObject(value) && 'name' in value;
1765
- const getAttributeFromCondition = condition => {
1766
- const parts = condition.split(' ');
1767
- return parts[0].startsWith('(') ? parts[0].slice(1) : parts[0];
1768
- };
1769
- const getExprFromCondition = (condition, partIndex) => {
1770
- var _expr;
1771
-
1772
- let expr;
1773
-
1774
- if (partIndex) {
1775
- const parts = condition.split(' && ').map(part => part.slice(1, -1));
1776
- expr = parts[partIndex - 1];
1777
- } else {
1778
- expr = condition;
1779
- }
1780
-
1781
- return (_expr = expr) == null ? void 0 : _expr.split(' ');
1782
- };
1783
- const getSignFromConditionPart = (condition, partIndex) => {
1784
- var _getExprFromCondition;
1785
-
1786
- return (_getExprFromCondition = getExprFromCondition(condition, partIndex)) == null ? void 0 : _getExprFromCondition[1];
1787
- };
1788
- const getValueFromConditionPart = (condition, partIndex) => {
1789
- var _getExprFromCondition2;
1790
-
1791
- return (_getExprFromCondition2 = getExprFromCondition(condition, partIndex)) == null ? void 0 : _getExprFromCondition2[2];
1792
- };
1793
- const isRangeCondition = condition => (condition == null ? void 0 : condition.includes('(')) || false;
1794
- const getSymbolParameterInfo = parameter => {
1795
- return PARAMETER_INFOS[parameter] || DEFAULT_PARAMETER_INFO;
1796
- };
1797
- const formatUniqueClassValue = (value, formatValue) => {
1798
- const {
1799
- attribute,
1800
- uniqueValue
1801
- } = value;
1802
- return attribute && formatValue ? formatValue(attribute.type, uniqueValue, attribute.stringFormat) : uniqueValue;
1803
- };
1804
- const getRangeValues$1 = (_ref, isDouble, isDate, index) => {
1805
- let {
1806
- from,
1807
- to
1808
- } = _ref;
1809
- return {
1810
- from: from !== null && index !== 0 ? isDate ? from : isDouble ? +from : +from + 1 : from,
1811
- to
1812
- };
1813
- };
1814
- const formatRangeClassValue = (value, formatValue, index) => {
1815
- var _value$attribute, _value$attribute2, _value$attribute3, _value$attribute4, _value$attribute5, _value$attribute6;
1816
-
1817
- const isDouble = ((_value$attribute = value.attribute) == null ? void 0 : _value$attribute.type) === 'Double';
1818
- const isDate = ((_value$attribute2 = value.attribute) == null ? void 0 : _value$attribute2.type) === 'DateTime';
1819
- const {
1820
- from,
1821
- to
1822
- } = getRangeValues$1(value, isDouble, isDate, index);
1823
- const formattedFrom = formatValue ? formatValue((_value$attribute3 = value.attribute) == null ? void 0 : _value$attribute3.type, from, (_value$attribute4 = value.attribute) == null ? void 0 : _value$attribute4.stringFormat) : from;
1824
- const formattedTo = formatValue ? formatValue((_value$attribute5 = value.attribute) == null ? void 0 : _value$attribute5.type, to, (_value$attribute6 = value.attribute) == null ? void 0 : _value$attribute6.stringFormat) : to;
1825
-
1826
- if (from === null) {
1827
- return "" + formattedTo + (!isDate ? " " + i18n.t("andLess", {
1828
- ns: "style"
1829
- }) : '');
1830
- }
1831
-
1832
- if (to === null) {
1833
- return "" + (!isDate ? i18n.t("more", {
1834
- ns: "style"
1835
- }) + " " : '') + formattedFrom;
1836
- }
1837
-
1838
- return from === to ? "" + formattedFrom : formattedFrom + " - " + formattedTo;
1839
- };
1840
- const checkLayerHasLegend = layerInfo => {
1841
- var _SYMBOL_CLASSIFICATIO;
1842
-
1843
- return ((_SYMBOL_CLASSIFICATIO = SYMBOL_CLASSIFICATION[layerInfo.geometryType]) == null ? void 0 : _SYMBOL_CLASSIFICATIO.some(param => {
1844
- var _layerInfo$style;
1845
-
1846
- const paramValue = get((_layerInfo$style = layerInfo.style) == null ? void 0 : _layerInfo$style.symbol, param);
1847
- return (paramValue == null ? void 0 : paramValue.type) === 'byAttribute';
1848
- })) || false;
1849
- };
1850
- const getTitleFromCondition = (_ref2) => {
1851
- let {
1852
- condition,
1853
- attribute,
1854
- formatValue
1855
- } = _ref2;
1856
- const parts = condition == null ? void 0 : condition.split(' == ');
1857
- const uniqueValue = parts != null && parts[1] ? parts[1].startsWith("'") && parts[1].endsWith("'") ? parts[1].slice(1, -1) : parts[1] : '';
1858
- return attribute && formatValue ? formatValue(attribute.type, uniqueValue, attribute.stringFormat) : uniqueValue;
1859
- };
1860
- function createValueTitleFromCondition(paramValue, attribute, formatValue, index) {
1861
- if (!attribute) return '';
1862
- if (paramValue.title) return paramValue.title;
1863
- const value = {
1864
- parameterValue: getParameterValue(paramValue.value),
1865
- attribute
1866
- };
1867
- const sign = getSignFromConditionPart(paramValue.condition, 1);
1868
- const isFirstFrom = sign.includes('>');
1869
- value.from = isFirstFrom ? getValueFromConditionPart(paramValue.condition, 1) : null;
1870
- value.to = paramValue.condition.includes(' && ') && isFirstFrom ? getValueFromConditionPart(paramValue.condition, 2) : !isFirstFrom ? getValueFromConditionPart(paramValue.condition, 1) : null;
1871
- if (isRangeClass(value)) return formatRangeClassValue(value, formatValue, index);
1872
- if (isUniqueClass(value)) return formatUniqueClassValue(value, formatValue);
1873
- return '';
1874
- } // Основывается на http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217 ->
1875
- // пункт "Настраиваемые значения параметров символики в системе"
1876
- // Для добавления подготовленных значений размеров символов нужно использовать константу PREPARED_SYMBOL_SIZES
1877
-
1878
- const DEFAULT_LEGEND_STYLES = {
1879
- [0
1880
- /* Point */
1881
- ]: {
1882
- fillColor: '#00000047',
1883
- strokeWidth: 1,
1884
- strokeColor: '#0000001f'
1885
- },
1886
- [1
1887
- /* ImagePoint */
1888
- ]: {
1889
- maskedColor: '#00000047'
1890
- },
1891
- [2
1892
- /* Line */
1893
- ]: {
1894
- stroke: {
1895
- width: 2,
1896
- color: '#00000047'
1897
- }
1898
- },
1899
- [3
1900
- /* Polygon */
1901
- ]: {
1902
- fill: {
1903
- color: '#00000000',
1904
- hatchColor: '#00000000'
1905
- },
1906
- stroke: {
1907
- width: 1,
1908
- color: '#0000001f'
1909
- }
1910
- }
1911
- };
1912
- const SYMBOL_SIZE_PARAMETERS = ['size', 'width', 'height']; // Основывается на http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217 -> пункт "Библиотека символов"
1913
-
1914
- const DEFAULT_LEGEND_SIZES = {
1915
- circlePointSymbol: 8,
1916
- squarePointSymbol: 12,
1917
- imagePointSymbol: 24,
1918
- maskedImagePointSymbol: 24,
1919
- svgPointSymbol: 24
1920
- };
1921
-
1922
- const getNonClassifiedParamValue = (baseSymbol, parameter, classificationsParams, type) => {
1923
- if (classificationsParams.includes(parameter)) {
1924
- const defaultParameterValue = getParameterFromSymbol(DEFAULT_LEGEND_STYLES[type], parameter);
1925
-
1926
- if (defaultParameterValue) {
1927
- return defaultParameterValue;
1928
- }
1929
-
1930
- if (SYMBOL_SIZE_PARAMETERS.includes(parameter) && DEFAULT_LEGEND_SIZES[baseSymbol.type]) {
1931
- return DEFAULT_LEGEND_SIZES[baseSymbol.type];
1932
- }
1933
- }
1934
-
1935
- return getParameterValue(getParameterFromSymbol(baseSymbol, parameter));
1936
- };
1937
-
1938
- const updateSymbolParameter = (symbol, path, value) => symbolParameterWalker(() => value)(symbol, path);
1939
-
1940
- const createPointSymbol = (baseSymbol, parameter, classificationsParams, parameterValue) => {
1941
- return updateSymbolParameter(_extends({}, baseSymbol, {
1942
- fillColor: getNonClassifiedParamValue(baseSymbol, 'fillColor', classificationsParams, 0
1943
- /* Point */
1944
- ),
1945
- strokeColor: getNonClassifiedParamValue(baseSymbol, 'strokeColor', classificationsParams, 0
1946
- /* Point */
1947
- ),
1948
- strokeWidth: getNonClassifiedParamValue(baseSymbol, 'strokeWidth', classificationsParams, 0
1949
- /* Point */
1950
- ),
1951
- size: getNonClassifiedParamValue(baseSymbol, 'size', classificationsParams, 0
1952
- /* Point */
1953
- ),
1954
- offset: [0, 0]
1955
- }), parameter, parameterValue);
1956
- };
1957
-
1958
- function getDimensions(symbol, size) {
1959
- const height = getParameterValue(symbol.height);
1960
- const width = getParameterValue(symbol.width);
1961
-
1962
- if (width === height) {
1963
- return {
1964
- width: size,
1965
- height: size
1966
- };
1967
- }
1968
-
1969
- const ratio = height / width;
1970
-
1971
- if (width < height) {
1972
- return {
1973
- width: size,
1974
- height: height + (size - width) * ratio
1975
- };
1976
- }
1977
-
1978
- return {
1979
- width: width + (size - height) * ratio,
1980
- height: size
1981
- };
1982
- }
1983
-
1984
- const createImagePointSymbol = (baseSymbol, parameter, classificationsParams, parameterValue) => {
1985
- let symbol = _extends({}, baseSymbol);
1986
-
1987
- if (isMaskedImageSymbol(symbol)) {
1988
- symbol.maskedColor = getNonClassifiedParamValue(baseSymbol, 'maskedColor', classificationsParams, 1
1989
- /* ImagePoint */
1990
- );
1991
- }
1992
-
1993
- if (parameter === 'height' || parameter === 'width') {
1994
- const {
1995
- height,
1996
- width
1997
- } = getDimensions(baseSymbol, parameterValue);
1998
- symbol.height = height;
1999
- symbol.width = width;
2000
- } else {
2001
- symbol.width = getNonClassifiedParamValue(baseSymbol, 'width', classificationsParams, 1
2002
- /* ImagePoint */
2003
- );
2004
- symbol.height = symbol.width;
2005
- symbol = updateSymbolParameter(symbol, parameter, parameterValue);
2006
- }
2007
-
2008
- symbol.offset = [getParameterValue(symbol.height) / 2, getParameterValue(symbol.width) / 2];
2009
- return symbol;
2010
- };
2011
-
2012
- const createLineSymbol = (baseSymbol, parameter, classificationsParams, parameterValue) => {
2013
- return updateSymbolParameter(_extends({}, baseSymbol, {
2014
- type: 'simplePolylineSymbol',
2015
- stroke: {
2016
- color: getNonClassifiedParamValue(baseSymbol, 'stroke.color', classificationsParams, 2
2017
- /* Line */
2018
- ),
2019
- width: getNonClassifiedParamValue(baseSymbol, 'stroke.width', classificationsParams, 2
2020
- /* Line */
2021
- )
2022
- }
2023
- }), parameter, parameterValue);
2024
- };
2025
-
2026
- const createPolygonSymbol = (baseSymbol, parameter, classificationsParams, parameterValue) => {
2027
- return updateSymbolParameter(_extends({}, baseSymbol, {
2028
- fill: {
2029
- color: getNonClassifiedParamValue(baseSymbol, 'fill.color', classificationsParams, 3
2030
- /* Polygon */
2031
- ),
2032
- hatchColor: getNonClassifiedParamValue(baseSymbol, 'fill.hatchColor', classificationsParams, 3
2033
- /* Polygon */
2034
- )
2035
- },
2036
- stroke: {
2037
- color: getNonClassifiedParamValue(baseSymbol, 'stroke.color', classificationsParams, 3
2038
- /* Polygon */
2039
- ),
2040
- width: getNonClassifiedParamValue(baseSymbol, 'stroke.width', classificationsParams, 3
2041
- /* Polygon */
2042
- )
2043
- }
2044
- }), parameter, parameterValue);
2045
- };
2046
-
2047
- const createH3Symbol = (baseSymbol, parameter, classificationsParams, parameterValue) => {
2048
- return updateSymbolParameter(_extends({}, baseSymbol, {
2049
- fill: {
2050
- color: getNonClassifiedParamValue(baseSymbol, 'fill.color', classificationsParams, 3
2051
- /* Polygon */
2052
- )
2053
- },
2054
- stroke: {
2055
- color: getNonClassifiedParamValue(baseSymbol, 'stroke.color', classificationsParams, 3
2056
- /* Polygon */
2057
- ),
2058
- width: getNonClassifiedParamValue(baseSymbol, 'stroke.width', classificationsParams, 3
2059
- /* Polygon */
2060
- )
2061
- }
2062
- }), parameter, parameterValue);
2063
- };
2064
-
2065
- const createClusterSymbol = (baseSymbol, parameter, classificationsParams, parameterValue) => {
2066
- return updateSymbolParameter(_extends({}, baseSymbol, {
2067
- fillColor: getNonClassifiedParamValue(baseSymbol, 'fillColor', classificationsParams, 0
2068
- /* Point */
2069
- )
2070
- }), parameter, parameterValue);
2071
- };
2072
-
2073
- const createLegendSymbol = (parameterValue, parameter, classificationsParams, baseSymbol) => {
2074
- if (isParameterValueSymbol(parameterValue)) {
2075
- return parameterValue;
2076
- }
2077
-
2078
- if (isClusterSymbol(baseSymbol)) {
2079
- return createClusterSymbol(baseSymbol, parameter, classificationsParams, parameterValue);
2080
- }
2081
-
2082
- if (isSizableSymbol(baseSymbol)) {
2083
- return createPointSymbol(baseSymbol, parameter, classificationsParams, parameterValue);
2084
- }
2085
-
2086
- if (isTwoDimensionalSymbol(baseSymbol)) {
2087
- return createImagePointSymbol(baseSymbol, parameter, classificationsParams, parameterValue);
2088
- }
2089
-
2090
- if (isPolylineSymbols(baseSymbol)) {
2091
- return createLineSymbol(baseSymbol, parameter, classificationsParams, parameterValue);
2092
- }
2093
-
2094
- if (isPolygonSymbol(baseSymbol)) {
2095
- return createPolygonSymbol(baseSymbol, parameter, classificationsParams, parameterValue);
2096
- }
2097
-
2098
- if (isH3GridSymbol(baseSymbol)) {
2099
- return createH3Symbol(baseSymbol, parameter, classificationsParams, parameterValue);
2100
- }
2101
-
2102
- return null;
2103
- };
2104
- function createHiddenCondition(attributeName, attributeType, value) {
2105
- let newValue;
2106
- let comparisonOperator;
2107
-
2108
- if (isRangeClass(value)) {
2109
- if (value.from && value.to) {
2110
- newValue = [value.from, value.to];
2111
- comparisonOperator = ComparisonOperator.Outside;
2112
- } else if (value.from) {
2113
- newValue = value.from;
2114
- comparisonOperator = ComparisonOperator.LessThan;
2115
- } else if (value.to) {
2116
- newValue = value.to;
2117
- comparisonOperator = ComparisonOperator.GreaterThan;
2118
- }
2119
- } else {
2120
- newValue = value.uniqueValue || value.title;
2121
- comparisonOperator = ComparisonOperator.NotEquals;
2122
- }
2123
-
2124
- return new FilterCondition(createConditionString({
2125
- attribute: attributeName,
2126
- type: attributeType,
2127
- comparisonOperator: comparisonOperator,
2128
- value: newValue
2129
- })).toString();
2130
- }
2131
- const createOtherHiddenCondition = (values, attributeName, attributeType) => {
2132
- const value = values[values.length - 1];
2133
- let hiddenCondition;
2134
-
2135
- if (isRangeClass(value)) {
2136
- hiddenCondition = new FilterCondition(createConditionString({
2137
- attribute: attributeName,
2138
- type: attributeType,
2139
- comparisonOperator: ComparisonOperator.LessOrEquals,
2140
- value: value.to || value.from
2141
- })).toString();
2142
- } else {
2143
- const conditions = values.map(val => new FilterCondition(createConditionString({
2144
- attribute: attributeName,
2145
- type: attributeType,
2146
- comparisonOperator: ComparisonOperator.Equals,
2147
- value: val.uniqueValue
2148
- })).toString());
2149
- hiddenCondition = "( " + conditions.filter(Boolean).join(" " + FilterConditionOperation.OR + " ") + " )";
2150
- }
2151
-
2152
- return hiddenCondition;
2153
- };
2154
- const getMinimizedLegendValues = (attribute, classified, formatValue, index, otherTitle) => {
2155
- const other = {
2156
- title: otherTitle,
2157
- parameterValue: classified.defaultValue,
2158
- hiddenCondition: createOtherHiddenCondition(classified.values.map(val => getClassificationValue(val.value, otherTitle, new ClassificationCondition(val.condition))), attribute.name, attribute.type)
2159
- };
2160
- const items = classified.values.map(paramValue => {
2161
- const parameterValue = getParameterValue(paramValue.value);
2162
- const result = {
2163
- parameterValue,
2164
- attribute
2165
- };
2166
-
2167
- if (isRangeCondition(paramValue.condition)) {
2168
- const from = getValueFromConditionPart(paramValue.condition, 1);
2169
- const to = getValueFromConditionPart(paramValue.condition, 2);
2170
- result.from = from ? isNumeric(from) ? +from : formatDate(from) : null;
2171
- result.to = to ? isNumeric(to) ? +to : formatDate(to) : null;
2172
- result.title = createValueTitleFromCondition(paramValue, attribute, formatValue, index);
2173
- return result;
2174
- }
2175
-
2176
- result.uniqueValue = formatValue ? formatValue(attribute.type, paramValue.value, attribute.stringFormat) : paramValue.value.toString();
2177
- result.title = getTitleFromCondition({
2178
- condition: paramValue.condition
2179
- });
2180
- result.hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.value, result.title, new ClassificationCondition(paramValue.condition)));
2181
- return result;
2182
- });
2183
- return [...items, other];
2184
- };
2185
- const getMaximizedLegendValues = (attribute, param, params, classified, symbol, formatValue, sectionIndex, otherTitle) => {
2186
- const other = {
2187
- title: otherTitle,
2188
- symbol: createLegendSymbol(classified.defaultValue, param, params, symbol),
2189
- hiddenCondition: createOtherHiddenCondition(classified.values.map(val => getClassificationValue(val.value, otherTitle, new ClassificationCondition(val.condition))), attribute.name, attribute.type)
2190
- };
2191
- const items = classified.values.map((paramValue, index) => {
2192
- const result = {
2193
- symbol: createLegendSymbol(paramValue.value, param, params, symbol)
2194
- };
2195
- result.title = isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, sectionIndex) : getTitleFromCondition({
2196
- condition: paramValue.condition
2197
- });
2198
- result.hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.value, result.title, new ClassificationCondition(classified.values[index].condition)));
2199
- return result;
2200
- });
2201
- return [...items, other];
2202
- };
2203
- const classifyParamsReduce = (symbol, classifyParams, index) => {
2204
- return classifyParams == null ? void 0 : classifyParams.reduce((result, classified) => {
2205
- const param = get(symbol, classified);
2206
- return (param == null ? void 0 : param.type) === 'byAttribute' ? _extends({}, result, {
2207
- [classified]: _extends({
2208
- index
2209
- }, param)
2210
- }) : result;
2211
- }, {});
2212
- };
2213
- const getClassified = layerInfo => {
2214
- var _layerInfo$style2, _layerInfo$style2$chi, _layerInfo$style4, _layerInfo$style5;
2215
-
2216
- if (!layerInfo) return undefined;
2217
-
2218
- if ((_layerInfo$style2 = layerInfo.style) != null && (_layerInfo$style2$chi = _layerInfo$style2.children) != null && _layerInfo$style2$chi.length) {
2219
- var _layerInfo$style3;
2220
-
2221
- return {
2222
- symbol: {
2223
- type: 'byAttribute',
2224
- defaultValue: layerInfo.style.symbol,
2225
- title: null,
2226
- values: (_layerInfo$style3 = layerInfo.style) == null ? void 0 : _layerInfo$style3.children
2227
- }
2228
- };
2229
- }
2230
-
2231
- const classifyParams = SYMBOL_CLASSIFICATION[layerInfo.geometryType];
2232
-
2233
- if ((_layerInfo$style4 = layerInfo.style) != null && _layerInfo$style4.symbol && isCombinedPolylineSymbol(layerInfo.style.symbol)) {
2234
- var _layerInfo$style$symb;
2235
-
2236
- if (!((_layerInfo$style$symb = layerInfo.style.symbol.values) != null && _layerInfo$style$symb.length)) return undefined;
2237
- return layerInfo.style.symbol.values.reduce((result, polyline, index) => {
2238
- return _extends({}, result, classifyParamsReduce(polyline, classifyParams, index));
2239
- }, {});
2240
- }
2241
-
2242
- return classifyParamsReduce((_layerInfo$style5 = layerInfo.style) == null ? void 0 : _layerInfo$style5.symbol, classifyParams);
2243
- };
2244
- const getSymbolStrokeWidth = symbol => {
2245
- var _symbol$background;
2246
-
2247
- return isSvgPointSymbol(symbol) ? (_symbol$background = symbol.background) == null ? void 0 : _symbol$background.strokeWidth : symbol.strokeWidth;
2248
- };
2249
- const getParameterFromSymbol = (symbol, parameter) => {
2250
- let parameterFromSymbol = {};
2251
- symbolParameterWalker(parameterValue => {
2252
- parameterFromSymbol = parameterValue;
2253
- })(symbol, parameter);
2254
- return parameterFromSymbol;
2255
- };
2256
- const getLegendSymbolSize = symbol => {
2257
- let size = 0;
2258
-
2259
- if (isSvgPointSymbol(symbol)) {
2260
- size = getParameterValue(symbol.size);
2261
- }
2262
-
2263
- if (isH3GridSymbol(symbol)) {
2264
- size = getParameterValue(symbol.cellSize);
2265
- }
2266
-
2267
- if (isTwoDimensionalSymbol(symbol)) {
2268
- size = Math.max(getParameterValue(symbol.width), getParameterValue(symbol.height));
2269
- }
2270
-
2271
- if (isSizableSymbol(symbol)) {
2272
- const strokeWidth = getSymbolStrokeWidth(symbol);
2273
- size = getParameterValue(symbol.size) + (strokeWidth ? getParameterValue(strokeWidth) + EXTRA_BORDER_SIZE : 0);
2274
- }
2275
-
2276
- if (isPolylineSymbols(symbol)) {
2277
- size = getParameterValue(getParameterFromSymbol(symbol, 'stroke.width'));
2278
- }
2279
-
2280
- return Math.max(DEFAULT_LEGEND_SYMBOL_SIZE, size);
2281
- };
2282
- const serializeSvgPointSymbol = symbol => {
2283
- var _symbol$figure, _symbol$background2, _symbol$background3, _symbol$background4, _symbol$background5, _symbol$figure2, _symbol$figure3;
2284
-
2285
- if (!symbol) return null;
2286
- const figureFillColor = ((_symbol$figure = symbol.figure) == null ? void 0 : _symbol$figure.fillColor) || null;
2287
- const bgFillColor = ((_symbol$background2 = symbol.background) == null ? void 0 : _symbol$background2.fillColor) || null;
2288
- return _extends({
2289
- type: 'svgPointSymbol',
2290
- size: symbol.size,
2291
- offset: symbol.offset,
2292
- angle: symbol.angle
2293
- }, bgFillColor ? {
2294
- background: {
2295
- id: 'symbol-bg',
2296
- fillColor: bgFillColor,
2297
- strokeColor: ((_symbol$background3 = symbol.background) == null ? void 0 : _symbol$background3.strokeColor) || null,
2298
- strokeWidth: ((_symbol$background4 = symbol.background) == null ? void 0 : _symbol$background4.strokeWidth) || null,
2299
- type: ((_symbol$background5 = symbol.background) == null ? void 0 : _symbol$background5.type) || SvgSymbolBg.Circle
2300
- }
2301
- } : {}, figureFillColor ? {
2302
- figure: {
2303
- id: 'symbol-figure',
2304
- fillColor: figureFillColor,
2305
- strokeColor: ((_symbol$figure2 = symbol.figure) == null ? void 0 : _symbol$figure2.strokeColor) || null,
2306
- strokeWidth: ((_symbol$figure3 = symbol.figure) == null ? void 0 : _symbol$figure3.strokeWidth) || null
2307
- }
2308
- } : {});
2309
- };
2310
- const SIZE_PARAMETERS = ['size', 'height', 'strokeWidth', 'stroke.width'];
2311
- const isSizeClassification = parameter => SIZE_PARAMETERS.includes(parameter);
2312
- const getServiceConfiguration = layer => {
2313
- const emptyServiceConfiguration = {
2314
- name: ''
2315
- };
2316
- if (!isLayerService(layer) || !('configuration' in layer)) return emptyServiceConfiguration;
2317
- return _extends({}, emptyServiceConfiguration, layer.configuration || {});
2318
- };
2319
- /** default attribute name which use for geometry info */
2320
-
2321
- const GEOMETRY_ATTRIBUTE = 'geometry';
2322
- /** default attribute name which contains unique id info */
2323
-
2324
- const DEFAULT_ID_ATTRIBUTE_NAME = 'gid';
2325
- const getClassificationValue = (parameterValue, title, condition) => _extends({
2326
- parameterValue,
2327
- title
2328
- }, condition.isUnique() ? {
2329
- uniqueValue: condition.uniqueValue
2330
- } : {
2331
- from: condition.range[0],
2332
- to: condition.range[1]
2333
- });
2334
-
2335
- const getHexColor = colorString => colorString ? new Color(colorString).toString('hex') : undefined;
2336
-
2337
- // TODO reduce
2338
- const PREVIEW_LIMITS = {
2339
- STROKE_WIDTH_MIN: 0.25,
2340
- STROKE_WIDTH_MAX: 6.5
2341
- };
2342
-
2343
- function clamp(num, min, max) {
2344
- return Math.min(Math.max(num, min), max);
2345
- }
2346
-
2347
- /* eslint-disable @typescript-eslint/no-magic-numbers */
2348
- const SOLID_INTERVALS = [];
2349
- const solidStrokeStylePreset = {
2350
- style: 0
2351
- /* Solid */
2352
- ,
2353
- type: 'solid',
2354
- intervals: SOLID_INTERVALS
2355
- };
2356
- const strokeStylePresets = [solidStrokeStylePreset, {
2357
- style: 2
2358
- /* Dot */
2359
- ,
2360
- type: 'dashed',
2361
- intervals: [2, 2]
2362
- }, {
2363
- style: 1
2364
- /* Dash */
2365
- ,
2366
- type: 'dashed',
2367
- intervals: [3, 3, 3, 3]
2368
- }, {
2369
- style: 3
2370
- /* DashDot */
2371
- ,
2372
- type: 'dashed',
2373
- intervals: [5, 2, 1, 2]
2374
- }, {
2375
- style: 4
2376
- /* DashDotDot */
2377
- ,
2378
- type: 'dashed',
2379
- intervals: [5, 2, 1, 1, 1, 2]
2380
- }, {
2381
- style: 5
2382
- /* Custom */
2383
- ,
2384
- type: 'dashed',
2385
- intervals: [5, 4]
2386
- }];
2387
-
2388
- const walkByNumbersGroup = (numbers, offset, walker) => {
2389
- if (!numbers || !numbers.length) return [];
2390
- const newNumbers = [];
2391
-
2392
- for (let i = 0; i < numbers.length; i++) {
2393
- if (i % 2) {
2394
- newNumbers.push(...walker([numbers[i - 1], numbers[i]], offset));
2395
- }
2396
- }
2397
-
2398
- return newNumbers;
2399
- };
2400
-
2401
- const toIntervals = (numbers, width) => walkByNumbersGroup(numbers, clamp(getParameterValue(width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX), (_ref, offset) => {
2402
- let [length, gap] = _ref;
2403
- return [length * offset, gap * offset];
2404
- });
2405
- const toLineDash = (numbers, width) => walkByNumbersGroup(numbers, clamp(getParameterValue(width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX), (_ref2, offset) => {
2406
- let [length, gap] = _ref2;
2407
- return [Math.round(length / Math.max(1, Math.min(offset, 16) / 4)), Math.round(gap + 1 + Math.max(1, Math.min(offset, 16) / 2))];
2408
- });
2409
- const getLineDash = brush => {
2410
- if (!brush || brush.type === 'solid') return []; // @ts-ignore
2411
-
2412
- return toLineDash(brush.intervals, brush.width);
2413
- };
2414
- const defineStrokeStylePreset = intervals => {
2415
- if (!intervals.length) return solidStrokeStylePreset;
2416
- return strokeStylePresets.find(preset => {
2417
- if (preset.intervals.length !== intervals.length) return false;
2418
- const uniqueStrokeWidths = preset.intervals.map((presetInterval, i) => intervals[i] / presetInterval).filter(unique);
2419
- return uniqueStrokeWidths.length === 1;
2420
- });
2421
- };
2422
- const getDashStylePreset = dashStyle => strokeStylePresets.find(preset => preset.style === dashStyle);
2423
-
2424
- const ALPHA_NORMALIZER = 65025;
2425
-
2426
- const sum = numbers => numbers.reduce((result, num) => result + num, 0);
2427
-
2428
- const shouldFillMatrixCell = (matrixSize, hatchAngle, x, y) => {
2429
- const center = Math.round(matrixSize / 2);
2430
-
2431
- if ((hatchAngle === 0 || hatchAngle === Math.PI) && x === center) {
2432
- return true;
2433
- }
2434
-
2435
- if (hatchAngle === Math.PI / 4 && y === x) {
2436
- return true;
2437
- }
2438
-
2439
- if (hatchAngle === Math.PI / 2 && y === center) {
2440
- return true;
2441
- }
2442
-
2443
- return hatchAngle === 3 * Math.PI / 4 && matrixSize - 1 - y === x;
2444
- };
2445
-
2446
- const createEmptyMatrix = size => Array(size).fill(null).map(() => Array(size));
2447
-
2448
- const fillMatrix = (matrix, filler) => {
2449
- const matrixSize = matrix.length;
2450
-
2451
- for (let x = 0; x < matrixSize; x++) {
2452
- for (let y = 0; y < matrixSize; y++) {
2453
- matrix[x][y] = filler(x, y, matrixSize);
2454
- }
2455
- }
2456
- };
2457
-
2458
- const createFillBrushMatrix = (hatchAngle, hatchWidth, scalingFactor) => {
2459
- const matrixSize = Math.max(Math.round(sum([Math.max(...scalingFactor), hatchWidth])), hatchWidth);
2460
- const matrix = createEmptyMatrix(matrixSize);
2461
- fillMatrix(matrix, (x, y, size) => shouldFillMatrixCell(size, hatchAngle, x, y) ? 255 : 0);
2462
- return matrix;
2463
- };
2464
-
2465
- const createSymbolFillBrush = fillBrush => {
2466
- if (fillBrush.type !== 'hatch') return undefined;
2467
- return createFillBrushMatrix( // @ts-ignore
2468
- getParameterValue(fillBrush.hatchAngle), // @ts-ignore
2469
- Math.round(fillBrush.hatchWidth), fillBrush.scalingFactor);
2470
- };
2471
-
2472
- let SGisBrushFill = /*#__PURE__*/function (_sBrushFill) {
2473
- _inherits(SGisBrushFill, _sBrushFill);
2474
-
2475
- var _super = /*#__PURE__*/_createSuper(SGisBrushFill);
2476
-
2477
- function SGisBrushFill(originalSymbol) {
2478
- var _originalSymbol$strok, _originalSymbol$strok2, _originalSymbol$fill, _originalSymbol$fill2;
2479
-
2480
- var _this;
2481
-
2482
- _classCallCheck(this, SGisBrushFill);
2483
-
2484
- _this = _super.call(this, {
2485
- // @ts-ignore
2486
- strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
2487
- // @ts-ignore
2488
- strokeWidth: getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width),
2489
- lineDash: getLineDash(originalSymbol.stroke),
2490
- fillBackground: getHexColor( // @ts-ignore
2491
- getParameterValue((_originalSymbol$fill = originalSymbol.fill) == null ? void 0 : _originalSymbol$fill.color)),
2492
- fillForeground: isHatchBrush(originalSymbol.fill) ? // @ts-ignore
2493
- getHexColor(getParameterValue((_originalSymbol$fill2 = originalSymbol.fill) == null ? void 0 : _originalSymbol$fill2.hatchColor)) : void 0,
2494
- fillBrush: createSymbolFillBrush(originalSymbol.fill),
2495
- lineCap: 'square'
2496
- });
2497
- _this.originalSymbol = originalSymbol;
2498
- return _this;
2499
- }
2500
-
2501
- _createClass(SGisBrushFill, [{
2502
- key: "_updateBrush",
2503
- value: function _updateBrush() {
2504
- // @ts-ignore
2505
- if (!this._initialized) return;
2506
- const canvas = document.createElement('canvas');
2507
- const ctx = canvas.getContext('2d');
2508
-
2509
- if (!ctx) {
2510
- return;
2511
- }
2512
-
2513
- const brush = this.fillBrush;
2514
- const brushSize = brush.length;
2515
- const foreground = new Color(this.fillForeground);
2516
- const background = new Color(this.fillBackground);
2517
- canvas.height = brushSize;
2518
- canvas.width = brushSize;
2519
-
2520
- for (let i = 0; i < brushSize; i++) {
2521
- // eslint-disable-next-line id-length
2522
- for (let j = 0; j < brush[i].length; j++) {
2523
- const srcA = brush[i][j] * foreground.a / ALPHA_NORMALIZER;
2524
- const dstA = background.a / 255 * (1 - srcA);
2525
- const alpha = +Math.min(1, srcA + dstA).toFixed(2);
2526
- const red = Math.round(Math.min(255, background.r * dstA + foreground.r * srcA));
2527
- const green = Math.round(Math.min(255, background.g * dstA + foreground.g * srcA));
2528
- const blue = Math.round(Math.min(255, background.b * dstA + foreground.b * srcA));
2529
- ctx.fillStyle = "rgba(" + red + "," + green + "," + blue + "," + alpha + ")";
2530
- ctx.fillRect(j, i, 1, 1);
2531
- }
2532
- }
2533
-
2534
- this._brush = new Image();
2535
- this._brush.src = canvas.toDataURL();
2536
- }
2537
- }, {
2538
- key: "clone",
2539
- value: function clone() {
2540
- return new SGisBrushFill(this.originalSymbol);
2541
- }
2542
- }]);
2543
-
2544
- return SGisBrushFill;
2545
- }(BrushFill);
2546
-
2547
- let SGisImageFill = /*#__PURE__*/function (_sImageFill) {
2548
- _inherits(SGisImageFill, _sImageFill);
2549
-
2550
- var _super = /*#__PURE__*/_createSuper(SGisImageFill);
2551
-
2552
- function SGisImageFill(originalSymbol) {
2553
- var _originalSymbol$strok, _originalSymbol$strok2;
2554
-
2555
- var _this;
2556
-
2557
- _classCallCheck(this, SGisImageFill);
2558
-
2559
- _this = _super.call(this, {
2560
- // @ts-ignore
2561
- strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
2562
- // @ts-ignore
2563
- strokeWidth: getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width),
2564
- lineDash: getLineDash(originalSymbol.stroke),
2565
- src: "data:image/png;base64," + originalSymbol.fill.pattern,
2566
- lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
2567
- });
2568
- _this.originalSymbol = originalSymbol;
2569
- return _this;
2570
- }
2571
-
2572
- _createClass(SGisImageFill, [{
2573
- key: "clone",
2574
- value: function clone() {
2575
- return new SGisImageFill(this.originalSymbol);
2576
- }
2577
- }]);
2578
-
2579
- return SGisImageFill;
2580
- }(ImageFill);
2581
-
2582
- let SGisPolygonSymbol = /*#__PURE__*/function (_sPolygonSymbol) {
2583
- _inherits(SGisPolygonSymbol, _sPolygonSymbol);
2584
-
2585
- var _super = /*#__PURE__*/_createSuper(SGisPolygonSymbol);
2586
-
2587
- function SGisPolygonSymbol(originalSymbol) {
2588
- var _originalSymbol$strok, _originalSymbol$strok2, _originalSymbol$fill;
2589
-
2590
- var _this;
2591
-
2592
- _classCallCheck(this, SGisPolygonSymbol);
2593
-
2594
- _this = _super.call(this, {
2595
- // @ts-ignore
2596
- strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
2597
- // @ts-ignore
2598
- strokeWidth: getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width),
2599
- lineDash: getLineDash(originalSymbol.stroke),
2600
- // @ts-ignore
2601
- fillColor: getHexColor(getParameterValue((_originalSymbol$fill = originalSymbol.fill) == null ? void 0 : _originalSymbol$fill.color)),
2602
- // TODO?: may be it should be defined by user
2603
- lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
2604
- });
2605
- _this.originalSymbol = originalSymbol;
2606
- return _this;
2607
- }
2608
-
2609
- _createClass(SGisPolygonSymbol, [{
2610
- key: "clone",
2611
- value: function clone() {
2612
- return new SGisPolygonSymbol(this.originalSymbol);
2613
- }
2614
- }]);
2615
-
2616
- return SGisPolygonSymbol;
2617
- }(PolygonSymbol);
2618
-
2619
- const adaptMiterRings = (rings, resolution, fromCrs, toCrs) => {
2620
- const projected = projectRings(rings, fromCrs, toCrs);
2621
- return simplifyCoordinates(projected.map(ring => // @ts-ignore
2622
- ring.map((_ref) => {
2623
- let [x, y] = _ref;
2624
- return [x / resolution, y / -resolution];
2625
- })), 1);
2626
- };
2627
-
2628
- const miterSizeCalcs = {
2629
- ["small"
2630
- /* Small */
2631
- ]: strokeWidth => (strokeWidth + 1) * 3 + 1,
2632
- ["large"
2633
- /* Large */
2634
- ]: strokeWidth => (strokeWidth + 1) * 5 - 1
2635
- };
2636
- let LineMiterRender = /*#__PURE__*/function () {
2637
- function LineMiterRender(baseInfo) {
2638
- _classCallCheck(this, LineMiterRender);
2639
-
2640
- this.getAnchor = rings => {
2641
- if (this.position === 'right') {
2642
- const lastRing = rings[rings.length - 1];
2643
- return lastRing && lastRing[lastRing.length - 1] || null;
2644
- }
2645
-
2646
- const firstRing = rings[0];
2647
- return firstRing && firstRing[0] || null;
2648
- };
2649
-
2650
- Object.assign(this, baseInfo);
2651
- }
2652
-
2653
- _createClass(LineMiterRender, [{
2654
- key: "getRender",
2655
- value: function getRender(anchorRings, anchorCrs, resolution, currentCrs) {
2656
- const xMultiplier = this.position === 'right' ? 1 : -1;
2657
- const miterAnchor = this.getAnchor(anchorRings);
2658
- const miterRings = this.createRings(miterAnchor, xMultiplier);
2659
- const projectedMiterRings = adaptMiterRings(miterRings, resolution, anchorCrs, currentCrs);
2660
- return this.createRender(projectedMiterRings);
2661
- }
2662
- }, {
2663
- key: "miterSize",
2664
- get: function get() {
2665
- const calcMiterSize = miterSizeCalcs[this.size];
2666
- return calcMiterSize ? calcMiterSize(this.strokeWidth) : 1;
2667
- }
2668
- }]);
2669
-
2670
- return LineMiterRender;
2671
- }();
2672
-
2673
- let ArrowLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
2674
- _inherits(ArrowLineMiterRender, _LineMiterRender);
2675
-
2676
- var _super = /*#__PURE__*/_createSuper(ArrowLineMiterRender);
2677
-
2678
- function ArrowLineMiterRender() {
2679
- _classCallCheck(this, ArrowLineMiterRender);
2680
-
2681
- return _super.apply(this, arguments);
2682
- }
2683
-
2684
- _createClass(ArrowLineMiterRender, [{
2685
- key: "usageSize",
2686
- get: function get() {
2687
- return this.miterSize + this.strokeWidth;
2688
- }
2689
- }, {
2690
- key: "createRings",
2691
- value: function createRings(_ref, xMultiplier) {
2692
- let [x, y] = _ref;
2693
- return [[[x, y + this.miterSize / 2], [x + this.miterSize * xMultiplier, y], [x, y - this.miterSize / 2]]];
2694
- }
2695
- }, {
2696
- key: "createRender",
2697
- value: function createRender(miterRings) {
2698
- const isFilled = this.kind === LineEndingType.FilledArrow;
2699
- return new PolyRender(miterRings, {
2700
- enclosed: isFilled,
2701
- fillColor: isFilled ? this.color : void 0,
2702
- fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
2703
- lineCap: 'square',
2704
- lineJoin: 'miter',
2705
- strokeColor: this.color,
2706
- strokeWidth: this.strokeWidth
2707
- });
2708
- }
2709
- }]);
2710
-
2711
- return ArrowLineMiterRender;
2712
- }(LineMiterRender);
2713
-
2714
- let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
2715
- _inherits(CircleLineMiterRender, _LineMiterRender);
2716
-
2717
- var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
2718
-
2719
- function CircleLineMiterRender() {
2720
- _classCallCheck(this, CircleLineMiterRender);
2721
-
2722
- return _super.apply(this, arguments);
2723
- }
2724
-
2725
- _createClass(CircleLineMiterRender, [{
2726
- key: "usageSize",
2727
- get: function get() {
2728
- return this.miterSize + this.strokeWidth * 3;
2729
- }
2730
- }, {
2731
- key: "createRings",
2732
- value: function createRings(_ref, xMultiplier) {
2733
- let [x, y] = _ref;
2734
- return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
2735
- }
2736
- }, {
2737
- key: "createRender",
2738
- value: function createRender(miterRings) {
2739
- const isFilled = this.kind === LineEndingType.FilledCircle;
2740
- return new PolyRender(polygonCircleFromPoint(miterRings[0][0], this.miterSize), {
2741
- fillColor: isFilled ? this.color : 'transparent',
2742
- strokeColor: this.color,
2743
- strokeWidth: this.strokeWidth,
2744
- enclosed: true
2745
- });
2746
- }
2747
- }]);
2748
-
2749
- return CircleLineMiterRender;
2750
- }(LineMiterRender);
2751
-
2752
- let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
2753
- _inherits(SquareLineMiterRender, _LineMiterRender);
2754
-
2755
- var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
2756
-
2757
- function SquareLineMiterRender() {
2758
- _classCallCheck(this, SquareLineMiterRender);
2759
-
2760
- return _super.apply(this, arguments);
2761
- }
2762
-
2763
- _createClass(SquareLineMiterRender, [{
2764
- key: "usageSize",
2765
- get: function get() {
2766
- return this.miterSize + this.strokeWidth;
2767
- }
2768
- }, {
2769
- key: "createRings",
2770
- value: function createRings(_ref, xMultiplier) {
2771
- let [x, y] = _ref;
2772
- 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]]];
2773
- }
2774
- }, {
2775
- key: "createRender",
2776
- value: function createRender(miterRings) {
2777
- const isFilled = this.kind === LineEndingType.FilledSquare;
2778
- return new PolyRender(miterRings, {
2779
- enclosed: true,
2780
- fillColor: isFilled ? this.color : void 0,
2781
- fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
2782
- lineCap: 'square',
2783
- lineJoin: 'miter',
2784
- strokeColor: this.color,
2785
- strokeWidth: this.strokeWidth
2786
- });
2787
- }
2788
- }]);
2789
-
2790
- return SquareLineMiterRender;
2791
- }(LineMiterRender);
2792
-
2793
- const getLineMiterRender = options => {
2794
- switch (options.kind) {
2795
- case LineEndingType.Arrow:
2796
- case LineEndingType.FilledArrow:
2797
- return new ArrowLineMiterRender(options);
2798
-
2799
- case LineEndingType.Square:
2800
- case LineEndingType.FilledSquare:
2801
- return new SquareLineMiterRender(options);
2802
-
2803
- case LineEndingType.Circle:
2804
- case LineEndingType.FilledCircle:
2805
- return new CircleLineMiterRender(options);
2806
-
2807
- default:
2808
- return null;
2809
- }
2810
- };
2811
-
2812
- const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
2813
- const reversedRing = ring.slice().reverse();
2814
-
2815
- for (let i = 0; i < reversedRing.length; i++) {
2816
- const coordinates = reversedRing[i];
2817
-
2818
- if (isLastRing && i === 0) {
2819
- reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
2820
- }
2821
-
2822
- const nextCoordinates = reversedRing[i - 1];
2823
-
2824
- if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
2825
- reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
2826
- }
2827
- }
2828
-
2829
- return reversedRing.reverse();
2830
- };
2831
-
2832
- const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
2833
- const newRing = ring.slice();
2834
-
2835
- for (let i = 0; i < newRing.length; i++) {
2836
- const coordinates = newRing[i];
2837
-
2838
- if (i === 0 && isFirstRing) {
2839
- newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
2840
- }
2841
-
2842
- const prevCoordinates = newRing[i - 1];
2843
-
2844
- if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
2845
- newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
2846
- }
2847
- }
2848
-
2849
- return newRing;
2850
- };
2851
-
2852
- const updateRingsForMiter = (rings, position, miterSize) => {
2853
- return rings.map((ring, ringIndex) => {
2854
- switch (position) {
2855
- case 'right':
2856
- return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
2857
-
2858
- default:
2859
- return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
2860
- }
2861
- });
2862
- };
2863
-
2864
- const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
2865
- let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
2866
- _inherits(SGisPolylineSymbol, _sPolylineSymbol);
2867
-
2868
- var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
2869
-
2870
- function SGisPolylineSymbol(originalSymbol) {
2871
- var _originalSymbol$strok, _originalSymbol$strok2;
2872
-
2873
- var _this;
2874
-
2875
- _classCallCheck(this, SGisPolylineSymbol);
2876
-
2877
- _this = _super.call(this, {
2878
- // @ts-ignore
2879
- strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
2880
- strokeWidth: clamp( // @ts-ignore
2881
- getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
2882
- // @ts-ignore
2883
- lineDash: getLineDash(originalSymbol.stroke),
2884
- // @ts-ignore
2885
- lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
2886
- });
2887
- _this.originalSymbol = originalSymbol;
2888
- return _this;
2889
- }
2890
-
2891
- _createClass(SGisPolylineSymbol, [{
2892
- key: "renderFunction",
2893
- value: function renderFunction(feature, resolution, crs) {
2894
- if (!isSimplePolylineSymbol(this.originalSymbol)) return _get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, feature, resolution, crs);
2895
- const {
2896
- ending,
2897
- beginning
2898
- } = this.originalSymbol;
2899
- const renders = [];
2900
- const featureCopy = feature.clone();
2901
- const beginningMiterRender = getLineMiterRender({
2902
- color: this.strokeColor,
2903
- // @ts-ignore
2904
- kind: beginning.type,
2905
- position: 'left',
2906
- // @ts-ignore
2907
- size: beginning.size,
2908
- strokeWidth: this.strokeWidth
2909
- });
2910
- const endingMiterRender = getLineMiterRender({
2911
- color: this.strokeColor,
2912
- // @ts-ignore
2913
- kind: ending.type,
2914
- position: 'right',
2915
- // @ts-ignore
2916
- size: ending.size,
2917
- strokeWidth: this.strokeWidth
2918
- });
2919
-
2920
- if (beginningMiterRender) {
2921
- const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
2922
- const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
2923
- featureCopy.rings = updatedRings;
2924
- renders.push(render);
2925
- }
2926
-
2927
- if (endingMiterRender) {
2928
- const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
2929
- const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
2930
- featureCopy.rings = updatedRings;
2931
- renders.push(render);
2932
- } // NOTE: линия должна быть в начале чтобы быть под митерами
2933
-
2934
-
2935
- renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
2936
- return renders;
2937
- }
2938
- }, {
2939
- key: "clone",
2940
- value: function clone() {
2941
- return new SGisPolylineSymbol(this.originalSymbol);
2942
- }
2943
- }]);
2944
-
2945
- return SGisPolylineSymbol;
2946
- }(PolylineSymbol);
2947
-
2948
- let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
2949
- _inherits(ShadowedPointSymbol, _PointSymbol);
2950
-
2951
- var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
2952
-
2953
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
2954
- function ShadowedPointSymbol(options) {
2955
- _classCallCheck(this, ShadowedPointSymbol);
2956
-
2957
- return _super.call(this, options);
2958
- }
2959
-
2960
- _createClass(ShadowedPointSymbol, [{
2961
- key: "renderFunction",
2962
- value: function renderFunction(feature, resolution, crs) {
2963
- if (!(feature instanceof PointFeature)) return [];
2964
- const {
2965
- position
2966
- } = feature.projectTo(crs);
2967
- const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
2968
- const shadowRender = this.getShadow(pxPosition, feature, position);
2969
- const pointArc = this.getPoint(pxPosition, feature, position);
2970
- return shadowRender ? [shadowRender, pointArc] : [pointArc];
2971
- }
2972
- }, {
2973
- key: "getShadow",
2974
- value: function getShadow(position, _feature, mapCoordinates) {
2975
- return ShadowedPointSymbol.getShadowArc(position, this, mapCoordinates);
2976
- }
2977
- }, {
2978
- key: "getPoint",
2979
- value: function getPoint(position, _feature, mapCoordinates) {
2980
- return ShadowedPointSymbol.getPointArc(position, this, mapCoordinates);
2981
- }
2982
- }], [{
2983
- key: "getShadowArc",
2984
- value: function getShadowArc(position, _ref, mapCoordinates) {
2985
- let {
2986
- strokeWidth = 2,
2987
- shadowColor,
2988
- shadowSize,
2989
- size = 6
2990
- } = _ref;
2991
- return new Arc(position, {
2992
- fillColor: "transparent",
2993
- strokeColor: shadowColor,
2994
- strokeWidth: shadowSize,
2995
- radius: (size + strokeWidth + shadowSize) / 2,
2996
- mapCoordinates
2997
- });
2998
- }
2999
- }, {
3000
- key: "getPointArc",
3001
- value: function getPointArc(position, _ref2, mapCoordinates) {
3002
- let {
3003
- strokeWidth,
3004
- fillColor,
3005
- strokeColor,
3006
- size = 6
3007
- } = _ref2;
3008
- return new Arc(position, {
3009
- fillColor,
3010
- strokeColor,
3011
- strokeWidth,
3012
- radius: size / 2,
3013
- mapCoordinates
3014
- });
3015
- }
3016
- }]);
3017
-
3018
- return ShadowedPointSymbol;
3019
- }(PointSymbol);
3020
-
3021
- const getSimplifiedPolygonCoordinates = function getSimplifiedPolygonCoordinates(feature, crs, tolerance) {
3022
- if (tolerance === void 0) {
3023
- tolerance = 1;
3024
- }
3025
-
3026
- const projected = feature.crs.equals(crs) ? feature.rings : feature.projectTo(crs).rings;
3027
- return simplifyCoordinates(projected, tolerance);
3028
- };
3029
- function createShadowRender(position, _ref) {
3030
- let {
3031
- strokeWidth = 1,
3032
- shadowColor,
3033
- shadowSize,
3034
- size = 3,
3035
- mapCoordinates
3036
- } = _ref;
3037
- const shadowRadius = (size + strokeWidth + shadowSize) / 2;
3038
- return new Arc(position, {
3039
- fillColor: "transparent",
3040
- strokeColor: shadowColor,
3041
- strokeWidth: shadowSize,
3042
- radius: shadowRadius,
3043
- mapCoordinates
3044
- });
3045
- }
3046
- function createPointRender(position, _ref2) {
3047
- let {
3048
- strokeColor,
3049
- strokeWidth,
3050
- fillColor,
3051
- size = 3,
3052
- mapCoordinates
3053
- } = _ref2;
3054
- const radius = size / 2;
3055
- return new Arc(position, {
3056
- fillColor,
3057
- strokeColor,
3058
- strokeWidth,
3059
- radius,
3060
- mapCoordinates
3061
- });
3062
- }
3063
- let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
3064
- _inherits(ShadowedPolySymbol, _PolylineSymbol);
3065
-
3066
- var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
3067
-
3068
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3069
- function ShadowedPolySymbol(options) {
3070
- _classCallCheck(this, ShadowedPolySymbol);
3071
-
3072
- return _super.call(this, options);
3073
- }
3074
-
3075
- _createClass(ShadowedPolySymbol, [{
3076
- key: "renderFunction",
3077
- value: function renderFunction(feature, resolution, crs) {
3078
- if (!(feature instanceof Poly)) return [];
3079
-
3080
- const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
3081
-
3082
- const simplifiedFeatureCoordinates = getSimplifiedPolygonCoordinates(feature, crs);
3083
- const polyRender = this.getPolyRender(coordinates, feature, simplifiedFeatureCoordinates);
3084
- const shadowRender = this.getShadow(coordinates, feature, simplifiedFeatureCoordinates);
3085
- const vertexRenders = this.getVertexRenders(coordinates, simplifiedFeatureCoordinates);
3086
- let renders = [polyRender];
3087
-
3088
- if (shadowRender) {
3089
- renders = [shadowRender, polyRender];
3090
- }
3091
-
3092
- if (vertexRenders) {
3093
- renders = renders.concat(vertexRenders);
3094
- }
3095
-
3096
- return renders;
3097
- }
3098
- }, {
3099
- key: "getShadow",
3100
- value: function getShadow(coordinates, _feature, mapCoordinates) {
3101
- return new PolyRender(coordinates, {
3102
- fillStyle: FillStyle.None,
3103
- enclosed: this.enclose,
3104
- strokeColor: this.shadowColor,
3105
- strokeWidth: this.shadowSize,
3106
- lineDash: this.lineDash,
3107
- mapCoordinates
3108
- });
3109
- }
3110
- }, {
3111
- key: "getPolyRender",
3112
- value: function getPolyRender(coordinates, _feature, mapCoordinates) {
3113
- return new PolyRender(coordinates, {
3114
- fillStyle: this.enclose ? FillStyle.Color : FillStyle.None,
3115
- enclosed: this.enclose,
3116
- fillColor: this.fillColor,
3117
- strokeColor: this.strokeColor,
3118
- strokeWidth: this.strokeWidth,
3119
- lineDash: this.lineDash,
3120
- mapCoordinates
3121
- });
3122
- }
3123
- }, {
3124
- key: "getVertexRenders",
3125
- value: function getVertexRenders(coordinates, mapCoordinates) {
3126
- if (!this.showVertex) return;
3127
- const pointRenderers = [];
3128
- const shadowRenderers = [];
3129
-
3130
- for (let i = 0; i < coordinates.length; i++) {
3131
- const ring = coordinates[i];
3132
-
3133
- for (let j = 0; j < ring.length; j++) {
3134
- const point = ring[j];
3135
- const featurePoint = mapCoordinates[i][j];
3136
- const shadowRender = createShadowRender(point, {
3137
- size: 6,
3138
- strokeWidth: 2,
3139
- shadowColor: this.shadowColor,
3140
- strokeColor: this.strokeColor,
3141
- shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
3142
- fillColor: 'transparent',
3143
- mapCoordinates: featurePoint
3144
- });
3145
- const pointRender = createPointRender(point, {
3146
- size: 6,
3147
- strokeWidth: 2,
3148
- shadowColor: this.shadowColor,
3149
- strokeColor: this.strokeColor,
3150
- shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
3151
- fillColor: '#ffffff',
3152
- mapCoordinates: featurePoint
3153
- });
3154
- shadowRenderers.push(shadowRender);
3155
- pointRenderers.push(pointRender);
3156
- }
3157
- }
3158
-
3159
- return [...pointRenderers, ...shadowRenderers];
3160
- }
3161
- }]);
3162
-
3163
- return ShadowedPolySymbol;
3164
- }(PolylineSymbol);
3165
- const polySymbolParams = {
3166
- strokeWidth: 2,
3167
- strokeColor: '#e33600',
3168
- shadowSize: 8,
3169
- shadowColor: 'rgba(227, 54, 0, 0.3)'
3170
- };
3171
- const measureSymbolParams = {
3172
- strokeColor: '#ff6933',
3173
- shadowSize: 0,
3174
- vertexShadowSize: 0
3175
- };
3176
- const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
3177
- enclose: false,
3178
- showVertex: true
3179
- }));
3180
- const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
3181
- fillColor: 'rgba(255, 105, 51, 0.25)',
3182
- enclose: true,
3183
- showVertex: true
3184
- }));
3185
- const snapSymbolParams = {
3186
- size: 10,
3187
- strokeWidth: 2,
3188
- strokeColor: '#e33600',
3189
- fillColor: '#ffffff',
3190
- shadowColor: 'rgba(227, 54, 0, 0.3)',
3191
- shadowSize: 3
3192
- };
3193
- const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
3194
- strokeColor: '#ff6933',
3195
- shadowSize: 0
3196
- }));
3197
-
3198
- let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
3199
- _inherits(SelectedPointSymbol, _ShadowedPointSymbol);
3200
-
3201
- var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
3202
-
3203
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3204
- function SelectedPointSymbol(props) {
3205
- _classCallCheck(this, SelectedPointSymbol);
3206
-
3207
- return _super.call(this, props);
3208
- }
3209
-
3210
- _createClass(SelectedPointSymbol, [{
3211
- key: "getShadow",
3212
- value: function getShadow(position, feature, mapCoordinates) {
3213
- if (feature.isSelected) {
3214
- return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature, mapCoordinates);
3215
- }
3216
- }
3217
- }, {
3218
- key: "getPoint",
3219
- value: function getPoint(position, feature, mapCoordinates) {
3220
- const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature, mapCoordinates);
3221
-
3222
- if (feature.isSelected) {
3223
- pointRender.strokeColor = this.selectedStrokeColor;
3224
- pointRender.fillColor = this.selectedFillColor;
3225
- }
3226
-
3227
- return pointRender;
3228
- }
3229
- }]);
3230
-
3231
- return SelectedPointSymbol;
3232
- }(ShadowedPointSymbol);
3233
-
3234
- let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
3235
- _inherits(SelectedPolySymbol, _ShadowedPolySymbol);
3236
-
3237
- var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
3238
-
3239
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3240
- function SelectedPolySymbol(props) {
3241
- _classCallCheck(this, SelectedPolySymbol);
3242
-
3243
- return _super.call(this, props);
3244
- }
3245
-
3246
- _createClass(SelectedPolySymbol, [{
3247
- key: "getShadow",
3248
- value: function getShadow(coordinates, feature, mapCoordinates) {
3249
- if (feature.isSelected) {
3250
- return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature, mapCoordinates);
3251
- }
3252
- }
3253
- }, {
3254
- key: "getPolyRender",
3255
- value: function getPolyRender(coordinates, feature, mapCoordinates) {
3256
- const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature, mapCoordinates);
3257
-
3258
- if (feature.isSelected) {
3259
- polyRender.fillColor = this.selectedFillColor;
3260
- polyRender.strokeColor = this.selectedStrokeColor;
3261
-
3262
- if (this.selectedStrokeWidth !== void 0) {
3263
- polyRender.strokeWidth = this.selectedStrokeWidth;
3264
- }
3265
- }
3266
-
3267
- return polyRender;
3268
- }
3269
- }]);
3270
-
3271
- return SelectedPolySymbol;
3272
- }(ShadowedPolySymbol);
3273
-
3274
- const selectedPoint = /*#__PURE__*/new SelectedPointSymbol({
3275
- size: 8,
3276
- strokeWidth: 2,
3277
- strokeColor: 'rgba(255, 87, 34, 0.3)',
3278
- fillColor: 'rgba(255, 255, 255, 0.65)',
3279
- shadowColor: 'rgba(255, 87, 34, 0.3)',
3280
- shadowSize: 3,
3281
- selectedStrokeColor: '#ff5722',
3282
- selectedFillColor: 'rgba(255, 255, 255, 0.65)'
3283
- });
3284
- const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
3285
- strokeWidth: 6,
3286
- strokeColor: 'rgba(255, 87, 34, 0.2)',
3287
- shadowSize: 8,
3288
- shadowColor: 'rgba(255, 87, 34, 0.3)',
3289
- selectedStrokeColor: '#ff5722',
3290
- selectedStrokeWidth: 2
3291
- });
3292
- const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
3293
- strokeWidth: 2,
3294
- strokeColor: 'rgba(255, 87, 34, 0.3)',
3295
- shadowSize: 8,
3296
- shadowColor: 'rgba(255, 87, 34, 0.3)',
3297
- fillColor: 'rgba(255, 255, 255, 0.36)',
3298
- enclose: true,
3299
- selectedFillColor: 'rgba(255, 255, 255, 0.56)',
3300
- selectedStrokeColor: '#ff5722'
3301
- });
3302
-
3303
- const metersToPixels = (meters, _ref) => {
3304
- let {
3305
- painter,
3306
- crs = geo
3307
- } = _ref;
3308
- const {
3309
- width
3310
- } = painter;
3311
- const zeroPoint = painter.getPointFromPxPosition(0, 0).projectTo(crs);
3312
- const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
3313
- const widthDistance = distance(zeroPoint, maxWidthPoint);
3314
- const pxK = width / (widthDistance || 1);
3315
- return Math.round(meters * pxK);
3316
- };
3317
-
3318
- const defaultPathStyles = {
3319
- strokeWidth: 2,
3320
- strokeColor: 'rgb(0, 163, 245)',
3321
- fillStyle: FillStyle.None
3322
- };
3323
- let SVGPoly = /*#__PURE__*/function (_Symbol) {
3324
- _inherits(SVGPoly, _Symbol);
3325
-
3326
- var _super = /*#__PURE__*/_createSuper(SVGPoly);
3327
-
3328
- function SVGPoly(_temp) {
3329
- var _this;
3330
-
3331
- let {
3332
- redrawFeatureNode,
3333
- pathStyles,
3334
- circle,
3335
- className,
3336
- appendToSvg
3337
- } = _temp === void 0 ? {} : _temp;
3338
-
3339
- _classCallCheck(this, SVGPoly);
3340
-
3341
- _this = _super.call(this);
3342
- _this.container = document.createElement('div');
3343
- _this.container.style.position = 'absolute';
3344
- _this.redrawFeatureNode = redrawFeatureNode;
3345
- _this.pathStyles = _extends({
3346
- center: [0, 0],
3347
- fillColor: 'none'
3348
- }, pathStyles);
3349
- _this.circle = circle;
3350
- _this.className = className;
3351
- _this.appendToSvg = appendToSvg;
3352
- return _this;
3353
- }
3354
-
3355
- _createClass(SVGPoly, [{
3356
- key: "renderFunction",
3357
- value: function renderFunction(feature, resolution, crs) {
3358
- const coordinates = feature instanceof Poly ? new PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
3359
- this.setCirclePxRaius(crs);
3360
- this.container.innerHTML = '';
3361
- const svg = this.setSvg(coordinates);
3362
- svg && this.container.append(svg);
3363
- feature.__dynamicSymbolRender = new DynamicRender({
3364
- node: this.container,
3365
- update: (bbox, resolution) => this.update({
3366
- bbox,
3367
- resolution,
3368
- feature,
3369
- crs
3370
- }),
3371
- redraw: () => {
3372
- this.redrawFeatureNode && this.redrawFeatureNode(feature);
3373
- }
3374
- });
3375
-
3376
- this._setEventListeners(feature);
3377
-
3378
- return [feature.__dynamicSymbolRender];
3379
- }
3380
- }, {
3381
- key: "setCirclePxRaius",
3382
- value: function setCirclePxRaius(crs) {
3383
- if (this.circle && this.pathStyles) {
3384
- var _this$circle;
3385
-
3386
- this.pathStyles.radius = metersToPixels(this.circle.radius, {
3387
- painter: this.circle.painter,
3388
- crs
3389
- }) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
3390
- }
3391
- }
3392
- }, {
3393
- key: "update",
3394
- value: function update(_ref) {
3395
- var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
3396
-
3397
- let {
3398
- bbox,
3399
- resolution,
3400
- feature,
3401
- crs
3402
- } = _ref;
3403
- if (!feature) return;
3404
- if (!bbox) bbox = feature.__lastBbox;
3405
- if (!resolution) resolution = feature.__lastResolution;
3406
- if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
3407
-
3408
- if (feature.__lastResolution && resolution !== feature.__lastResolution) {
3409
- const newCoordinates = feature instanceof Poly ? new PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
3410
- this.setCirclePxRaius(crs);
3411
- this.container.innerHTML = '';
3412
- const svg = this.setSvg(newCoordinates);
3413
- svg && this.container.append(svg);
3414
- }
3415
-
3416
- const polygon = feature.projectTo(bbox.crs);
3417
- 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;
3418
- const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
3419
- const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
3420
- this.container.style.left = dx.toString() + "px";
3421
- this.container.style.top = dy.toString() + "px";
3422
- feature.__lastBbox = bbox;
3423
- feature.__lastResolution = resolution;
3424
- }
3425
- }, {
3426
- key: "setSvg",
3427
- value: function setSvg(coordinates) {
3428
- const {
3429
- lineCap,
3430
- lineJoin,
3431
- miterLimit,
3432
- lineDash,
3433
- dashOffset
3434
- } = this.pathStyles || {};
3435
- const svgRender = new SvgRender(_extends({
3436
- coordinates
3437
- }, defaultPathStyles, {
3438
- appendToSvg: this.appendToSvg
3439
- }, this.pathStyles));
3440
-
3441
- if (this.circle) {
3442
- svgRender._setArcNode();
3443
- } else {
3444
- svgRender._setPolyNode();
3445
- }
3446
-
3447
- let svgElement;
3448
- svgRender.getNode((_, svg) => {
3449
- svgElement = svg;
3450
- this.className && svgElement.classList.add(this.className);
3451
- const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
3452
-
3453
- if (path) {
3454
- path.setAttribute('stroke-linecap', lineCap || 'round');
3455
- path.setAttribute('stroke-linejoin', lineJoin || 'round');
3456
- path.setAttribute('stroke-miterlimit', (miterLimit || 10).toString());
3457
- path.setAttribute('stroke-dashoffset', (dashOffset || 0).toString());
3458
-
3459
- if (this.circle) {
3460
- path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
3461
- }
3462
- }
3463
- });
3464
- return svgElement;
3465
- }
3466
- }, {
3467
- key: "_setEventListeners",
3468
- value: function _setEventListeners(dynamicFeature) {
3469
- var _dynamicFeature$__dyn;
3470
-
3471
- if (dynamicFeature.eventFlags === MouseEventFlags.None) return;
3472
- const svgNode = dynamicFeature == null ? void 0 : (_dynamicFeature$__dyn = dynamicFeature.__dynamicSymbolRender) == null ? void 0 : _dynamicFeature$__dyn.node.querySelector(this.circle ? 'circle' : 'path');
3473
- Object.keys(mouseEvents).forEach(eventName => {
3474
- if (dynamicFeature.eventFlags & mouseEvents[eventName].flag) {
3475
- listenDomEvent(svgNode, mouseEvents[eventName].type, event => {
3476
- dynamicFeature.fire(mouseEvents[eventName].type, {
3477
- node: svgNode,
3478
- browserEvent: event
3479
- });
3480
- });
3481
- }
3482
- });
3483
- }
3484
- }]);
3485
-
3486
- return SVGPoly;
3487
- }(Symbol$1);
3488
-
3489
- function isSGisPointSymbol(symbol) {
3490
- return symbol instanceof PointSymbol || symbol instanceof StaticImageSymbol || symbol instanceof SquareSymbol || symbol instanceof MaskedImage;
3491
- }
3492
- function isSGisImageSymbol(symbol) {
3493
- return symbol instanceof StaticImageSymbol || symbol instanceof MaskedImage;
3494
- }
3495
- function isSGisPolygonSymbol(symbol) {
3496
- return symbol instanceof PolygonSymbol || symbol instanceof BrushFill || symbol instanceof ImageFill;
3497
- }
3498
- function isSGisPolylineSymbol(symbol) {
3499
- return symbol instanceof PolylineSymbol;
3500
- }
3501
- function isSGisH3Symbol(symbol) {
3502
- return symbol instanceof H3Symbol;
3503
- }
3504
- function isSGisCombinedPolylineSymbol(symbol) {
3505
- return symbol instanceof CombinedPolylineSymbol;
3506
- }
3507
- function isSGisClusterSymbol(symbol) {
3508
- return !!symbol.singleObjectSymbol;
3509
- }
3510
-
3511
- /**
3512
- * Моки фич для отображения превью символа
3513
- * http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
3514
- */
3515
-
3516
- const viewBoxSize = 100;
3517
- const pointFeature = /*#__PURE__*/new PointFeature([50, -50], {
3518
- crs: plain
3519
- });
3520
- const lineFeature = /*#__PURE__*/new Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
3521
- crs: plain
3522
- });
3523
- const combinedLineFeature = /*#__PURE__*/new CombinedPolyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
3524
- crs: plain
3525
- });
3526
- const polygonFeature = /*#__PURE__*/new Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
3527
- crs: plain
3528
- });
3529
- const h3gridFeature = /*#__PURE__*/new H3Feature([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
3530
- crs: plain
3531
- });
3532
- const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
3533
- crs: plain
3534
- });
3535
- const polygonLegendFeature = /*#__PURE__*/new Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
3536
- crs: plain
3537
- });
3538
- const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
3539
- crs: plain
3540
- });
3541
- const MAP_LEGEND_FEATURES = {
3542
- polygon: polygonMapLegendFeature
3543
- };
3544
- const LEGEND_FEATURES = {
3545
- point: pointFeature,
3546
- polyline: lineLegendFeature,
3547
- combinedPolyline: combinedLineFeature,
3548
- polygon: polygonLegendFeature,
3549
- h3grid: h3gridFeature
3550
- };
3551
- const MOCK_FEATURES = {
3552
- point: pointFeature,
3553
- polyline: lineFeature,
3554
- combinedPolyline: combinedLineFeature,
3555
- polygon: polygonFeature,
3556
- h3grid: h3gridFeature
3557
- };
3558
-
3559
- function getSymbolRenders(symbol, size, features) {
3560
- if (size === void 0) {
3561
- size = viewBoxSize;
3562
- }
3563
-
3564
- if (features === void 0) {
3565
- features = {};
3566
- }
3567
-
3568
- const resolution = viewBoxSize / size;
3569
-
3570
- const featuresToRender = _extends({}, MOCK_FEATURES, features);
3571
-
3572
- if (isSGisPolygonSymbol(symbol)) {
3573
- return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, plain);
3574
- }
3575
-
3576
- if (isSGisPolylineSymbol(symbol)) {
3577
- return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, plain);
3578
- }
3579
-
3580
- if (isSGisH3Symbol(symbol)) {
3581
- return symbol.renderFunctionAsync(featuresToRender.h3grid, resolution, plain);
3582
- }
3583
-
3584
- if (isSGisCombinedPolylineSymbol(symbol)) {
3585
- return symbol.renderFunctionAsync(featuresToRender.combinedPolyline, resolution, plain);
3586
- }
3587
-
3588
- return symbol.renderFunctionAsync(featuresToRender.point, resolution, plain);
3589
- }
3590
- const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
3591
- if (size === void 0) {
3592
- size = viewBoxSize;
3593
- }
3594
-
3595
- return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
3596
- };
3597
- const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
3598
- if (size === void 0) {
3599
- size = viewBoxSize;
3600
- }
3601
-
3602
- return getSymbolRenders(symbol, size, LEGEND_FEATURES);
3603
- };
3604
-
3605
- function renderSymbolToCanvas(renders, canvas) {
3606
- renders.forEach(render => {
3607
- canvas.draw(render);
3608
- });
3609
- }
3610
-
3611
- function deserializeSymbol(symbol) {
3612
- switch (symbol.type) {
3613
- case "h3grid":
3614
- return deserializeH3Symbol(symbol);
3615
-
3616
- case "svgPointSymbol":
3617
- return deserializeSvgPointSymbol(symbol);
3618
-
3619
- case 'circlePointSymbol':
3620
- return deserializePointSymbol(symbol);
3621
-
3622
- case 'squarePointSymbol':
3623
- return deserializeSquareSymbol(symbol);
3624
-
3625
- case 'maskedImagePointSymbol':
3626
- return deserializeMaskedImageSymbol(symbol);
3627
-
3628
- case 'imagePointSymbol':
3629
- return deserializeImagePointSymbol(symbol);
3630
-
3631
- case 'polygonSymbol':
3632
- return deserializePolygonSymbol(symbol);
3633
-
3634
- case 'simplePolylineSymbol':
3635
- return deserializePolylineSymbol(symbol);
3636
-
3637
- case "clusterSymbol":
3638
- return deserializeSymbol(symbol.singleObjectSymbol);
3639
-
3640
- default:
3641
- return null;
3642
- }
3643
- }
3644
-
3645
- function deserializeH3Symbol(symbol) {
3646
- var _symbol$stroke, _symbol$stroke2, _symbol$fill;
3647
-
3648
- return new H3Symbol(_extends({}, symbol, {
3649
- cellSize: getParameterValue(symbol.cellSize),
3650
- strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
3651
- strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
3652
- fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
3653
- }));
3654
- }
3655
-
3656
- function deserializePointSymbol(symbol) {
3657
- // @ts-ignore
3658
- return new PointSymbol(deserializePointSymbolParams(symbol));
3659
- }
3660
-
3661
- const getOffsetParameterValue = offset => [getParameterValue(offset == null ? void 0 : offset[0]), getParameterValue(offset == null ? void 0 : offset[1])];
3662
-
3663
- function deserializeSvgPointSymbolParams(_ref) {
3664
- let {
3665
- type,
3666
- data,
3667
- size,
3668
- offset,
3669
- angle,
3670
- background,
3671
- figure
3672
- } = _ref;
3673
- return _extends({
3674
- type: getParameterValue(type),
3675
- data: getParameterValue(data),
3676
- size: getParameterValue(size),
3677
- offset: getOffsetParameterValue(offset),
3678
- angle: getParameterValue(angle)
3679
- }, background ? {
3680
- background: _extends({}, background, {
3681
- fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
3682
- strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
3683
- strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
3684
- })
3685
- } : {}, figure ? {
3686
- figure: _extends({}, figure, {
3687
- strokeColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.strokeColor)),
3688
- strokeWidth: getParameterValue(figure == null ? void 0 : figure.strokeWidth),
3689
- fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
3690
- })
3691
- } : {});
3692
- }
3693
-
3694
- function deserializeSvgPointSymbol(symbol) {
3695
- return new PointSymbol(deserializeSvgPointSymbolParams(symbol));
3696
- }
3697
-
3698
- function deserializeSquareSymbol(symbol) {
3699
- return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
3700
- // @ts-ignore
3701
- angle: getParameterValue(symbol.angle)
3702
- }));
3703
- }
3704
-
3705
- function deserializeMaskedImageSymbol(symbol) {
3706
- return new MaskedImage(_extends({}, symbol, {
3707
- // @ts-ignore
3708
- angle: getParameterValue(symbol.angle),
3709
- // @ts-ignore
3710
- width: getParameterValue(symbol.width),
3711
- // @ts-ignore
3712
- height: getParameterValue(symbol.height),
3713
- // @ts-ignore
3714
- anchorPoint: deserializeAnchor(symbol.offset),
3715
- // @ts-ignore
3716
- imageSource: deserializeBase64(symbol.image),
3717
- // @ts-ignore
3718
- maskSource: deserializeBase64(symbol.imageMask),
3719
- // @ts-ignore
3720
- maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
3721
- }));
3722
- }
3723
-
3724
- function deserializeImagePointSymbol(symbol) {
3725
- return new StaticImageSymbol(_extends({}, symbol, {
3726
- // @ts-ignore
3727
- angle: getParameterValue(symbol.angle),
3728
- // @ts-ignore
3729
- width: getParameterValue(symbol.width),
3730
- // @ts-ignore
3731
- height: getParameterValue(symbol.height),
3732
- // @ts-ignore
3733
- anchorPoint: deserializeAnchor(symbol.offset),
3734
- // @ts-ignore
3735
- source: deserializeBase64(symbol.image)
3736
- }));
3737
- }
3738
-
3739
- function deserializePolygonSymbol(symbol) {
3740
- if (isPolygonHasPatternBrush(symbol)) {
3741
- return new SGisImageFill(symbol);
3742
- }
3743
-
3744
- if (isPolygonHasHatchBrush(symbol)) {
3745
- return new SGisBrushFill(symbol);
3746
- }
3747
-
3748
- return new SGisPolygonSymbol(symbol);
3749
- }
3750
-
3751
- function deserializePolylineSymbol(symbol) {
3752
- return new SGisPolylineSymbol(symbol);
3753
- }
3754
-
3755
- function deserializePointSymbolParams(_ref2) {
3756
- let {
3757
- size,
3758
- offset,
3759
- strokeColor,
3760
- strokeWidth,
3761
- fillColor
3762
- } = _ref2;
3763
- return {
3764
- size: getParameterValue(size),
3765
- offset: deserializeAnchor(offset),
3766
- strokeWidth: getParameterValue(strokeWidth),
3767
- strokeColor: deserializeColor(getParameterValue(strokeColor)),
3768
- fillColor: deserializeColor(getParameterValue(fillColor))
3769
- };
3770
- }
3771
-
3772
- function deserializeBase64(base) {
3773
- return "data:image/png;base64," + base;
3774
- }
3775
-
3776
- function deserializeAnchor(offset) {
3777
- // @ts-ignore
3778
- return offset.map(getParameterValue);
3779
- }
3780
-
3781
- function deserializeColor(color) {
3782
- return color ? new Color(color).toString() : null;
3783
- }
3784
-
3785
- const clampSymbol = (symbol, min, max) => {
3786
- if (isSGisImageSymbol(symbol)) {
3787
- symbol.width = clamp(symbol.width, min, max);
3788
- symbol.height = clamp(symbol.height, min, max);
3789
- } else if (isSGisPointSymbol(symbol)) {
3790
- symbol.size = clamp(symbol.size, min, max);
3791
- }
3792
-
3793
- return symbol;
3794
- };
3795
- function centerAlignSymbol(symbol) {
3796
- if (isSGisImageSymbol(symbol)) {
3797
- symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
3798
- } else if (isSGisPointSymbol(symbol)) {
3799
- symbol.offset = [0, 0];
3800
- }
3801
-
3802
- return symbol;
3803
- }
3804
- const adjustSymbol = (symbol, _ref) => {
3805
- let {
3806
- size
3807
- } = _ref;
3808
- return centerAlignSymbol(clampSymbol(symbol, 0, size));
3809
- };
3810
-
3811
- const useSvgSymbol = (symbol, skipOffset, isClassified) => {
3812
- const SVGWrapperRefElement = useRef(null);
3813
- const SVGContainer = useMemo(() => SVG(), []);
3814
- const initSvg = useCallback(() => {
3815
- SVGContainer.addTo(SVGWrapperRefElement.current);
3816
- }, [SVGContainer]);
3817
- const getSvgData = useCallback(() => SVGContainer.svg(), [SVGContainer]);
3818
- const manipulateSvg = useCallback((_ref) => {
3819
- let {
3820
- svg,
3821
- bg,
3822
- newSymbol,
3823
- isClassified
3824
- } = _ref;
3825
- manipulateSvgSymbol({
3826
- SVGContainer,
3827
- symbol: newSymbol || symbol,
3828
- svg,
3829
- bg,
3830
- isClassified
3831
- });
3832
- }, [SVGContainer, symbol]);
3833
- const getUpdatedSvgSymbol = useCallback((field, value) => {
3834
- var _newSymbol$background;
3835
-
3836
- const {
3837
- data,
3838
- offset
3839
- } = symbol;
3840
- const newValue = value instanceof Color$1 ? value.toString('rgba') : value;
3841
-
3842
- const newSymbol = _extends({}, JSON.parse(JSON.stringify(symbol)), {
3843
- offset: skipOffset ? DEFAULT_SYMBOL_OFFSET : isSizeClassification(field) ? getOffsetParameterValue(offset) : offset
3844
- });
3845
-
3846
- if (field.indexOf('.') !== -1) {
3847
- var _newSymbol$parts$;
3848
-
3849
- const parts = field.split('.');
3850
-
3851
- if ((_newSymbol$parts$ = newSymbol[parts[0]]) != null && _newSymbol$parts$[parts[1]]) {
3852
- newSymbol[parts[0]][parts[1]] = newValue;
3853
- } else {
3854
- newSymbol[parts[0]] = _extends({}, newSymbol[parts[0]], {
3855
- [parts[1]]: newValue
3856
- }, parts[0] === 'background' ? {
3857
- type: newSymbol.background.type,
3858
- id: 'symbol-bg'
3859
- } : parts[0] === 'figure' ? {
3860
- id: 'symbol-figure'
3861
- } : {});
3862
- }
3863
- } else {
3864
- newSymbol[field] = newValue;
3865
- }
3866
-
3867
- manipulateSvg({
3868
- svg: getParameterValue(data),
3869
- newSymbol,
3870
- bg: (_newSymbol$background = newSymbol.background) == null ? void 0 : _newSymbol$background.type,
3871
- isClassified
3872
- });
3873
- return _extends({}, newSymbol, {
3874
- data: SVGContainer.svg()
3875
- });
3876
- }, [SVGContainer, manipulateSvg, skipOffset, symbol]);
3877
- return {
3878
- svgRef: SVGWrapperRefElement,
3879
- initSvg,
3880
- getSvgData,
3881
- manipulateSvg,
3882
- getUpdatedSvgSymbol
3883
- };
3884
- };
3885
-
3886
- var _templateObject$1, _templateObject2$1;
3887
- const SvgSymbolContainer = /*#__PURE__*/styled.div(_templateObject$1 || (_templateObject$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n"])));
3888
- const SvgSymbolLabel = /*#__PURE__*/styled.div(_templateObject2$1 || (_templateObject2$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n line-height: 0;\n"])), (_ref) => {
3889
- let {
3890
- fontSettings
3891
- } = _ref;
3892
- return !!(fontSettings != null && fontSettings.fontFamily) && "font-family: " + fontSettings.fontFamily;
3893
- }, (_ref2) => {
3894
- let {
3895
- fontSettings
3896
- } = _ref2;
3897
- return !!(fontSettings != null && fontSettings.fontWeight) && "font-weight: " + fontSettings.fontWeight;
3898
- }, (_ref3) => {
3899
- let {
3900
- fontSettings
3901
- } = _ref3;
3902
- return !!(fontSettings != null && fontSettings.fontStyle) && "font-style: " + fontSettings.fontStyle;
3903
- }, (_ref4) => {
3904
- let {
3905
- fontSettings
3906
- } = _ref4;
3907
- return !!(fontSettings != null && fontSettings.fontColor) && "color: " + fontSettings.fontColor;
3908
- }, (_ref5) => {
3909
- let {
3910
- fontSettings
3911
- } = _ref5;
3912
- return !!(fontSettings != null && fontSettings.fontSize) && "font-size: " + (typeof fontSettings.fontSize === 'string' ? fontSettings.fontSize : fontSettings.fontSize + "px");
3913
- }, (_ref6) => {
3914
- let {
3915
- fontSettings
3916
- } = _ref6;
3917
- return !!(fontSettings != null && fontSettings.haloColor) && !!(fontSettings != null && fontSettings.haloWidth) && "-webkit-text-stroke: " + fontSettings.haloWidth + "px " + fontSettings.haloColor + ";";
3918
- });
3919
- const SvgSymbol = /*#__PURE__*/memo((_ref7) => {
3920
- let {
3921
- svg,
3922
- bg,
3923
- symbol,
3924
- title,
3925
- text,
3926
- fontSettings,
3927
- skipOffset,
3928
- isClassified,
3929
- onClick
3930
- } = _ref7;
3931
- const {
3932
- svgRef,
3933
- initSvg,
3934
- getSvgData,
3935
- manipulateSvg
3936
- } = useSvgSymbol(symbol, skipOffset, isClassified);
3937
- const onSelectSymbol = useCallback(() => {
3938
- onClick == null ? void 0 : onClick(getSvgData(), _extends({}, symbol, bg ? {
3939
- background: _extends({}, symbol.background, {
3940
- type: bg
3941
- })
3942
- } : {}));
3943
- }, [bg, getSvgData, onClick, symbol]);
3944
- const renderSymbol = useMemo(() => React.createElement(SymbolButton, {
3945
- ref: svgRef,
3946
- title: title,
3947
- onClick: onClick ? onSelectSymbol : undefined
3948
- }), [svgRef, title, onClick, onSelectSymbol]);
3949
- useEffect(() => {
3950
- initSvg();
3951
- }, [initSvg]);
3952
- useEffect(() => {
3953
- manipulateSvg({
3954
- svg,
3955
- bg,
3956
- newSymbol: symbol,
3957
- isClassified
3958
- });
3959
- }, [svg, symbol, bg, manipulateSvg, isClassified]);
3960
- return text ? React.createElement(SvgSymbolContainer, null, renderSymbol, React.createElement(SvgSymbolLabel, {
3961
- fontSettings: fontSettings
3962
- }, text), !!(fontSettings != null && fontSettings.haloColor) && !!(fontSettings != null && fontSettings.haloWidth) && React.createElement(SvgSymbolLabel, {
3963
- fontSettings: _extends({}, fontSettings, {
3964
- haloColor: undefined,
3965
- haloWidth: undefined
3966
- })
3967
- }, text)) : renderSymbol;
3968
- });
3969
-
3970
- const ClusterSymbolPreview = (_ref) => {
3971
- var _symbol$fillColor$val, _symbol$labelSymbol;
3972
-
3973
- let {
3974
- symbol,
3975
- index,
3976
- size = 56,
3977
- fontSize = '1.25rem'
3978
- } = _ref;
3979
- const isClassified = isParameterByAttribute(symbol.fillColor);
3980
- const isClassifiedValue = isClassified && index !== undefined;
3981
- const fillColor = isClassifiedValue ? ((_symbol$fillColor$val = symbol.fillColor.values[index]) == null ? void 0 : _symbol$fillColor$val.value) || symbol.fillColor.defaultValue : symbol.fillColor;
3982
- const strokeColor = isClassified ? fillColor : symbol.strokeColor;
3983
- const svgSymbol = {
3984
- type: 'svgPointSymbol',
3985
- size,
3986
- offset: [0, 0],
3987
- angle: 0,
3988
- background: {
3989
- id: 'symbol-bg',
3990
- fillColor,
3991
- strokeColor,
3992
- strokeWidth: 6,
3993
- type: 'circle'
3994
- }
3995
- };
3996
- return React.createElement(SvgSymbol, {
3997
- svg: DEFAULT_CLUSTER_SVG,
3998
- symbol: svgSymbol,
3999
- isClassified: isClassified,
4000
- text: '99',
4001
- fontSettings: _extends({}, symbol.labelSymbol, {
4002
- fontSize: fontSize || ((_symbol$labelSymbol = symbol.labelSymbol) == null ? void 0 : _symbol$labelSymbol.fontSize)
4003
- })
4004
- });
4005
- };
4006
-
4007
- const SymbolByType = (_ref) => {
4008
- let {
4009
- type,
4010
- symbol,
4011
- size,
4012
- svg,
4013
- skipOffset
4014
- } = _ref;
4015
- const defaultSymbol = useMemo(() => React.createElement(Symbol, {
4016
- symbol: symbol,
4017
- size: size
4018
- }), [symbol, size]);
4019
-
4020
- switch (type) {
4021
- case 'svgPointSymbol':
4022
- return svg ? React.createElement(SvgSymbol, {
4023
- svg: svg,
4024
- size: size,
4025
- skipOffset: skipOffset,
4026
- symbol: serializeSvgPointSymbol(symbol)
4027
- }) : defaultSymbol;
4028
-
4029
- default:
4030
- return defaultSymbol;
4031
- }
4032
- };
4033
-
4034
- const LegendSymbolRenderer = /*#__PURE__*/memo((_ref) => {
4035
- let {
4036
- symbol,
4037
- index
4038
- } = _ref;
4039
-
4040
- if (isClusterSymbol(symbol)) {
4041
- return React.createElement(ClusterLegendContainer, null, React.createElement(ClusterSymbolPreview, {
4042
- symbol: symbol,
4043
- index: index
4044
- }));
4045
- }
4046
-
4047
- return React.createElement(SymbolByType, {
4048
- symbol: deserializeSymbol(symbol),
4049
- size: getLegendSymbolSize(symbol) || DEFAULT_LEGEND_SYMBOL_SIZE,
4050
- type: symbol.type,
4051
- svg: getParameterValue(symbol.data),
4052
- skipOffset: true
4053
- });
4054
- });
4055
-
4056
- const LegendHeaderButtons = (_ref) => {
4057
- let {
4058
- layerName,
4059
- hasHiddenLegends,
4060
- isShared,
4061
- clearHiddenLegends,
4062
- goToClassification
4063
- } = _ref;
4064
- return React.createElement(React.Fragment, null, !!goToClassification && !isShared && React.createElement(LegendHeaderButton, null, React.createElement(IconButton, {
4065
- onClick: goToClassification
4066
- }, React.createElement(EverCloudClassificationIcon, null))), !!clearHiddenLegends && React.createElement(LegendHeaderButton, null, React.createElement(IconButton, {
4067
- disabled: !hasHiddenLegends,
4068
- onClick: () => clearHiddenLegends == null ? void 0 : clearHiddenLegends(layerName)
4069
- }, React.createElement(EverCloudRefreshIcon, null))));
4070
- };
4071
-
4072
- const getConditionAttribute = (attributes, condition) => {
4073
- if (!condition) return null;
4074
- const attributeName = getAttributeNameFromCondition(condition);
4075
- let attribute = attributes.find((_ref) => {
4076
- let {
4077
- name
4078
- } = _ref;
4079
- return name === attributeName;
4080
- });
4081
-
4082
- if (!attribute) {
4083
- if (attributeName === 'count') {
4084
- attribute = {
4085
- name: 'count',
4086
- alias: 'Количество',
4087
- type: AttributeType.Int32
4088
- };
4089
- } else {
4090
- return null;
4091
- }
4092
- }
4093
-
4094
- return attribute;
4095
- };
4096
-
4097
- const isHiddenLegend = (hiddenCondition, hiddenLegends) => !!(hiddenLegends != null && hiddenLegends.includes(hiddenCondition));
4098
-
4099
- const renderColumn = (column, index) => {
4100
- const dateTime = column.split(' ');
4101
- return React.createElement(Fragment, {
4102
- key: index
4103
- }, React.createElement(ItemText, {
4104
- title: column
4105
- }, dateTime[0], React.createElement(MapLegendDescription, null, dateTime[1])), index === 0 && React.createElement(ItemSeparator, null));
4106
- };
4107
-
4108
- const getLegendText = (_ref) => {
4109
- let {
4110
- title,
4111
- index,
4112
- isDate
4113
- } = _ref;
4114
-
4115
- if (!title) {
4116
- return React.createElement(ItemText, null, i18n.t("other", {
4117
- ns: "style"
4118
- }));
4119
- }
4120
-
4121
- const columns = title == null ? void 0 : title.split(' - ');
4122
- const isSingleColumn = (columns == null ? void 0 : columns.length) === 1;
4123
-
4124
- if (!isDate || index && isSingleColumn) {
4125
- return React.createElement(ItemText, {
4126
- title: title
4127
- }, title);
4128
- }
4129
-
4130
- if (!index && isSingleColumn) {
4131
- return React.createElement(React.Fragment, null, React.createElement(ItemText, {
4132
- title: "\u221E"
4133
- }, "\u221E"), React.createElement(ItemSeparator, null), renderColumn(title));
4134
- }
4135
-
4136
- return React.createElement(React.Fragment, null, columns.map(renderColumn));
4137
- };
4138
-
4139
- const getLayerAttributes = layerDefinition => {
4140
- const attributes = layerDefinition && layerDefinition.attributes || {};
4141
- return Object.entries(attributes).map((_ref) => {
4142
- let [name, definition] = _ref;
4143
- return _extends({
4144
- name
4145
- }, definition);
4146
- });
4147
- };
4148
-
4149
- const LegendChildren = (_ref) => {
4150
- var _layerInfo$style, _layerInfo$style$chil;
4151
-
4152
- let {
4153
- layerInfo,
4154
- hiddenLegends,
4155
- toggleHiddenLegend,
4156
- clearHiddenLegends,
4157
- formatValue
4158
- } = _ref;
4159
- if (!(layerInfo != null && (_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length)) return null;
4160
- const attributes = getLayerAttributes(layerInfo.layerDefinition);
4161
- return React.createElement(MapLegendContainer, null, layerInfo.style.children.map((paramValue, index) => {
4162
- var _getConditionAttribut;
4163
-
4164
- const attribute = getConditionAttribute(attributes, paramValue.condition);
4165
- if (!attribute) return null;
4166
- const hiddenCondition = createHiddenCondition(attribute.name, attribute.type, getClassificationValue(paramValue.symbol, paramValue.title, new ClassificationCondition(paramValue.condition)));
4167
- const legendText = getLegendText({
4168
- title: isRangeCondition(paramValue.condition) ? createValueTitleFromCondition(paramValue, attribute, formatValue, index) : getTitleFromCondition({
4169
- condition: paramValue.condition,
4170
- attribute,
4171
- formatValue
4172
- }),
4173
- index,
4174
- isDate: ((_getConditionAttribut = getConditionAttribute(attributes, paramValue.condition)) == null ? void 0 : _getConditionAttribut.type) === 'DateTime'
4175
- });
4176
- return React.createElement(ClassifiedItem, {
4177
- key: index,
4178
- isHidden: isHiddenLegend(hiddenCondition, hiddenLegends == null ? void 0 : hiddenLegends[layerInfo.name]),
4179
- onClick: () => toggleHiddenLegend == null ? void 0 : toggleHiddenLegend(layerInfo.name, hiddenCondition)
4180
- }, React.createElement(SymbolContainer, null, React.createElement(LegendSymbolRenderer, {
4181
- symbol: paramValue.symbol
4182
- })), legendText, React.createElement(LegendHeaderButtons, {
4183
- layerName: layerInfo.name,
4184
- clearHiddenLegends: clearHiddenLegends
4185
- }));
4186
- }));
4187
- };
4188
-
4189
- const LegendParameterDescription = (_ref) => {
4190
- let {
4191
- parameter,
4192
- index
4193
- } = _ref;
4194
- const {
4195
- t
4196
- } = useTranslation("style");
4197
- const isSize = isParameterType("size", parameter);
4198
- const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
4199
- const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
4200
- return React.createElement(MapLegendDescriptionContainer, null, isStrokeWidth || isStrokeColor ? isStrokeWidth ? t("strokeWidth") : t("strokeColor") : isSize ? t("symbolSize") : t("symbolColor"), !!index && React.createElement(MapLegendBadge, null, index));
4201
- };
4202
-
4203
- const getValueFromLegendTitle = (title, minOrMax) => {
4204
- if (title.includes(" - ")) {
4205
- const result = title == null ? void 0 : title.split(" - ");
4206
- return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
4207
- }
4208
-
4209
- if (title.includes(",")) {
4210
- const result = title == null ? void 0 : title.split(",");
4211
- return result.join(", ");
4212
- }
4213
-
4214
- return title.split(" ").find(isNumeric) || title || "";
4215
- };
4216
-
4217
- const MinimizedLegend = (_ref) => {
4218
- var _currentValues$, _currentValues, _currentValues$2, _currentValues2;
4219
-
4220
- let {
4221
- innerRef,
4222
- isShown,
4223
- values,
4224
- title,
4225
- parameter,
4226
- hiddenLegends
4227
- } = _ref;
4228
- const {
4229
- t
4230
- } = useTranslation("style");
4231
- const currentValues = [...values];
4232
- const other = currentValues.pop();
4233
- const isSize = isParameterType("size", parameter);
4234
- const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
4235
- const titleMax = getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max");
4236
- const titleMin = getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min");
4237
- const checkIsHidden = useCallback(hiddenCondition => hiddenCondition ? hiddenLegends == null ? void 0 : hiddenLegends.some(condition => hiddenCondition.includes(condition)) : false, [hiddenLegends]);
4238
- return React.createElement(MinimizedLegendContainer, {
4239
- ref: innerRef,
4240
- isShown: isShown
4241
- }, !!title && React.createElement(MapLegendValueDescr, null, title), isSize ? React.createElement(React.Fragment, null, React.createElement(SizeMinimizedLegend, null, React.createElement(SizeMinimizedLegendSymbol, null, React.createElement(MapLegendItems, {
4242
- parameter: parameter,
4243
- isSize: true
4244
- }, currentValues.map((value, index) => React.createElement(MapLegendItem, {
4245
- key: "" + value.title + index,
4246
- title: value.title,
4247
- value: value.parameterValue,
4248
- parameter: parameter,
4249
- isHidden: checkIsHidden(value.hiddenCondition)
4250
- })))), React.createElement(SizeMinimizedLegendLabel, null, React.createElement(SizeMinimizedLegendDown, null, (_currentValues$2 = currentValues[0]) == null ? void 0 : _currentValues$2.title), React.createElement(SizeMinimizedLegendUp, null, (_currentValues2 = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues2.title))), React.createElement(SizeMinimizedLegend, null, React.createElement(SizeMinimizedLegendSymbol, null, React.createElement(MapLegendItems, {
4251
- parameter: parameter,
4252
- isSize: true
4253
- }, React.createElement(MapLegendOther, {
4254
- title: t("other"),
4255
- value: other == null ? void 0 : other.parameterValue,
4256
- parameter: parameter,
4257
- isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
4258
- }))), React.createElement(SizeMinimizedLegendLabel, null, React.createElement(SizeMinimizedLegendUp, null, t("other"))))) : isStrokeWidth ? React.createElement(MapLegendItems, {
4259
- parameter: parameter,
4260
- isStrokeWidth: true
4261
- }, currentValues.map((value, index) => React.createElement(MapLegendItem, {
4262
- key: "" + value.title + index,
4263
- title: value.title,
4264
- value: value.parameterValue,
4265
- parameter: parameter,
4266
- isHidden: checkIsHidden(value.hiddenCondition)
4267
- }, (!index || index === currentValues.length - 1) && value.title)), React.createElement(MapLegendOther, {
4268
- title: t("other"),
4269
- value: other == null ? void 0 : other.parameterValue,
4270
- parameter: parameter,
4271
- isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
4272
- }, t("other"))) : React.createElement(MapLegendItems, {
4273
- parameter: parameter
4274
- }, React.createElement(MapLegendItemsContainer, null, currentValues.map((value, index) => React.createElement(MapLegendItem, {
4275
- key: "" + value.title + index,
4276
- title: value.title,
4277
- value: value.parameterValue,
4278
- parameter: parameter,
4279
- isHidden: checkIsHidden(value.hiddenCondition)
4280
- }))), React.createElement(MapLegendOther, {
4281
- title: t("other"),
4282
- value: other == null ? void 0 : other.parameterValue,
4283
- parameter: parameter,
4284
- isHidden: checkIsHidden(other == null ? void 0 : other.hiddenCondition)
4285
- })), typeof (other == null ? void 0 : other.parameterValue) === "string" && (titleMax || titleMin) && React.createElement(MapLegendValues, null, React.createElement(MapLegendValuesRange, null, React.createElement("div", null, titleMax), React.createElement("div", null, titleMin)), React.createElement(MapLegendValuesOther, null, "-")));
4286
- };
4287
-
4288
- const MaximizedLegend = (_ref) => {
4289
- let {
4290
- innerRef,
4291
- isShown,
4292
- layerName,
4293
- symbol: sectionSymbol,
4294
- parameter,
4295
- values,
4296
- index: sectionIndex,
4297
- attributeType,
4298
- hiddenLegends,
4299
- toggleHiddenLegend
4300
- } = _ref;
4301
- const isDate = attributeType === 'DateTime';
4302
- const isSize = isParameterType('size', parameter);
4303
- const isStrokeWidth = isParameterType(['strokeWidth', 'stroke.width'], parameter);
4304
- const isStrokeColor = isParameterType(['strokeColor', 'stroke.color'], parameter);
4305
- const parameterValue = useMemo(() => get(sectionSymbol, parameter), [sectionSymbol, parameter]);
4306
- const renderLegend = useCallback((_ref2, index) => {
4307
- var _parameterValue$value;
4308
-
4309
- let {
4310
- symbol,
4311
- title,
4312
- hiddenCondition
4313
- } = _ref2;
4314
- if (!symbol) return null;
4315
- const isClusterFillColor$1 = isClusterFillColor(symbol, parameter);
4316
- const value = getParameterValue(parameterValue == null ? void 0 : (_parameterValue$value = parameterValue.values[index]) == null ? void 0 : _parameterValue$value.value) || (parameterValue == null ? void 0 : parameterValue.defaultValue);
4317
- return React.createElement(ClassifiedItem, {
4318
- key: sectionIndex + title + index,
4319
- isHidden: isHiddenLegend(hiddenCondition, hiddenLegends),
4320
- isClusterFillColor: isClusterFillColor$1,
4321
- onClick: () => toggleHiddenLegend == null ? void 0 : toggleHiddenLegend(layerName, hiddenCondition)
4322
- }, isSize || isStrokeWidth || isStrokeColor ? React.createElement(MapLegendItems, {
4323
- parameter: parameter,
4324
- isSize: isSize,
4325
- isStrokeWidth: isStrokeWidth,
4326
- isStrokeColor: isStrokeColor,
4327
- isSingle: true
4328
- }, React.createElement(MapLegendItem, {
4329
- key: "" + title + index,
4330
- title: title,
4331
- value: value,
4332
- parameter: parameter
4333
- })) : React.createElement(SymbolContainer, null, React.createElement(LegendSymbolRenderer, {
4334
- index: index,
4335
- symbol: isClusterFillColor$1 ? sectionSymbol : getExtractedSymbol(symbol, true)
4336
- })), getLegendText({
4337
- title,
4338
- index,
4339
- isDate
4340
- }));
4341
- }, [parameter, sectionIndex, hiddenLegends, isSize, isStrokeWidth, isStrokeColor, parameterValue, sectionSymbol, isDate, toggleHiddenLegend, layerName]);
4342
- return React.createElement(MaximizedLegendContainer, {
4343
- ref: innerRef,
4344
- isShown: isShown
4345
- }, values.map(renderLegend));
4346
- };
4347
-
4348
- function useCanvas() {
4349
- const canvas = useRef(null);
4350
- const ref = useCallback(node => {
4351
- if (node !== null) {
4352
- canvas.current = new Canvas(node);
4353
- } else {
4354
- canvas.current = null;
4355
- }
4356
- }, []);
4357
- return {
4358
- canvas,
4359
- ref
4360
- };
4361
- }
4362
-
4363
- function useMount(_ref) {
4364
- let {
4365
- onMount,
4366
- onUnmount
4367
- } = _ref;
4368
- useEffect(() => {
4369
- onMount && onMount();
4370
- return onUnmount; // eslint-disable-next-line react-hooks/exhaustive-deps
4371
- }, []);
4372
- }
4373
-
4374
- function useNode() {
4375
- const [node, onSetNode] = useState(null);
4376
- const ref = useCallback(onSetNode, [onSetNode]);
4377
- return [ref, node];
4378
- }
4379
-
4380
- const DEFAULT_SYMBOL_SIZE$1 = 26;
4381
- function useSymbol(_ref, canvasRef) {
4382
- let {
4383
- symbol,
4384
- size = DEFAULT_SYMBOL_SIZE$1,
4385
- render = getSymbolRenders,
4386
- maxWidth
4387
- } = _ref;
4388
- useEffect(() => {
4389
- if (canvasRef.current !== null && symbol !== undefined) {
4390
- const canvas = canvasRef.current;
4391
- setCanvasSize(canvas, size, maxWidth);
4392
- render(symbol, size).then(renders => {
4393
- renderSymbolToCanvas(renders, canvas);
4394
- });
4395
- } // eslint-disable-next-line react-hooks/exhaustive-deps
4396
-
4397
- }, [symbol, size, maxWidth]);
4398
- }
4399
-
4400
- function setCanvasSize(canvas, size, maxWidth) {
4401
- canvas.node.height = size;
4402
- canvas.node.width = maxWidth ? Math.min(size, maxWidth) : size;
4403
- }
4404
-
4405
- const useToggle = initial => {
4406
- const [state, setState] = useState(initial !== undefined ? initial : false);
4407
- const toggle = useCallback(() => setState(!state), [state]);
4408
- return [state, toggle, setState];
4409
- };
4410
-
4411
- const LegendSection = (_ref) => {
4412
- var _hiddenLegends$layerN, _hiddenLegends$layerN2;
4413
-
4414
- let {
4415
- layerName,
4416
- symbol,
4417
- parameter,
4418
- parameters,
4419
- classified,
4420
- hiddenLegends,
4421
- toggleHiddenLegend,
4422
- clearHiddenLegends,
4423
- goToClassification,
4424
- attribute,
4425
- formatValue,
4426
- index,
4427
- count,
4428
- isShared
4429
- } = _ref;
4430
- const {
4431
- t
4432
- } = useTranslation("style");
4433
- const [isExpanded, toggleExpanded] = useToggle();
4434
- const [maxRef, maxNode] = useNode();
4435
- const [minRef, minNode] = useNode();
4436
- if (!layerName || !attribute) return null;
4437
- const currentSymbol = isCombinedPolylineSymbol(symbol) ? symbol.values[index] : symbol;
4438
- return React.createElement(MapLegendSectionContainer, {
4439
- hasHiddenLegends: !!(hiddenLegends != null && (_hiddenLegends$layerN = hiddenLegends[layerName]) != null && _hiddenLegends$layerN.length)
4440
- }, React.createElement(MapLegendHeader, null, attribute.alias || attribute.name, React.createElement(LegendHeaderButtons, {
4441
- layerName: layerName,
4442
- hasHiddenLegends: !!(hiddenLegends != null && (_hiddenLegends$layerN2 = hiddenLegends[layerName]) != null && _hiddenLegends$layerN2.length),
4443
- clearHiddenLegends: clearHiddenLegends,
4444
- goToClassification: goToClassification,
4445
- isShared: isShared
4446
- })), React.createElement(LegendParameterDescription, {
4447
- parameter: parameter,
4448
- index: count && index !== undefined ? count - index : 0
4449
- }), React.createElement(MapLegendSectionItems, {
4450
- minHeight: minNode == null ? void 0 : minNode.offsetHeight,
4451
- maxHeight: maxNode == null ? void 0 : maxNode.offsetHeight,
4452
- isExpanded: isExpanded
4453
- }, React.createElement(MaximizedLegend, {
4454
- innerRef: maxRef,
4455
- isShown: isExpanded,
4456
- layerName: layerName,
4457
- symbol: currentSymbol,
4458
- hiddenLegends: hiddenLegends == null ? void 0 : hiddenLegends[layerName],
4459
- toggleHiddenLegend: toggleHiddenLegend,
4460
- parameter: parameter,
4461
- attributeType: attribute.type,
4462
- index: index,
4463
- values: getMaximizedLegendValues(attribute, parameter, parameters, classified, currentSymbol, formatValue, index, t("other"))
4464
- }), React.createElement(MinimizedLegend, {
4465
- innerRef: minRef,
4466
- isShown: !isExpanded,
4467
- hiddenLegends: hiddenLegends == null ? void 0 : hiddenLegends[layerName],
4468
- parameter: parameter,
4469
- values: getMinimizedLegendValues(attribute, classified, formatValue, index, t("other"))
4470
- })), React.createElement(MapLegendExpandButton, {
4471
- onClick: toggleExpanded
4472
- }, isExpanded ? t('hide') : t('show')));
4473
- };
4474
-
4475
- const _excluded$1 = ["layerInfo", "formatValue", "hiddenLegends", "toggleHiddenLegend", "clearHiddenLegends", "goToClassification"];
4476
- const Legend = /*#__PURE__*/memo((_ref) => {
4477
- var _layerInfo$style, _layerInfo$style$chil;
4478
-
4479
- let {
4480
- layerInfo,
4481
- formatValue,
4482
- hiddenLegends,
4483
- toggleHiddenLegend,
4484
- clearHiddenLegends,
4485
- goToClassification
4486
- } = _ref,
4487
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
4488
-
4489
- if (!layerInfo) return null;
4490
-
4491
- if ((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length) {
4492
- return React.createElement(LegendChildren, {
4493
- layerInfo: layerInfo,
4494
- formatValue: formatValue,
4495
- hiddenLegends: hiddenLegends,
4496
- toggleHiddenLegend: toggleHiddenLegend,
4497
- clearHiddenLegends: clearHiddenLegends,
4498
- goToClassification: goToClassification
4499
- });
4500
- }
4501
-
4502
- const attributes = getLayerAttributes(layerInfo.layerDefinition);
4503
- const renderItems = useMemo(() => {
4504
- var _layerInfo$style2, _layerInfo$style3;
4505
-
4506
- const parameters = SYMBOL_CLASSIFICATION[layerInfo.geometryType];
4507
- const props = {
4508
- layerName: layerInfo.name,
4509
- symbol: (_layerInfo$style2 = layerInfo.style) == null ? void 0 : _layerInfo$style2.symbol,
4510
- parameters: parameters,
4511
- formatValue: formatValue,
4512
- hiddenLegends: hiddenLegends,
4513
- toggleHiddenLegend: toggleHiddenLegend,
4514
- clearHiddenLegends: clearHiddenLegends,
4515
- goToClassification: goToClassification
4516
- };
4517
-
4518
- if ((_layerInfo$style3 = layerInfo.style) != null && _layerInfo$style3.symbol && isCombinedPolylineSymbol(layerInfo.style.symbol)) {
4519
- var _layerInfo$style4, _layerInfo$style4$sym, _layerInfo$style4$sym2;
4520
-
4521
- const values = (_layerInfo$style4 = layerInfo.style) == null ? void 0 : (_layerInfo$style4$sym = _layerInfo$style4.symbol) == null ? void 0 : (_layerInfo$style4$sym2 = _layerInfo$style4$sym.values) == null ? void 0 : _layerInfo$style4$sym2.reduce((result, symbol, index) => {
4522
- return [classifyParamsReduce(symbol, parameters, index), ...result];
4523
- }, []);
4524
- return React.createElement(React.Fragment, null, values == null ? void 0 : values.map((value, index) => Object.keys(value).map((param, keyIndex) => {
4525
- var _item$values$;
4526
-
4527
- const item = value[param];
4528
- return React.createElement(LegendSection, Object.assign({
4529
- key: [keyIndex, index].join("-"),
4530
- index: item == null ? void 0 : item.index,
4531
- count: values == null ? void 0 : values.length,
4532
- attribute: getConditionAttribute(attributes, item == null ? void 0 : (_item$values$ = item.values[0]) == null ? void 0 : _item$values$.condition),
4533
- parameter: param,
4534
- classified: item
4535
- }, props, rest));
4536
- })));
4537
- }
4538
-
4539
- const classified = getClassified(layerInfo);
4540
- if (!classified) return null;
4541
- return React.createElement(React.Fragment, null, Object.keys(classified).map((param, keyIndex) => {
4542
- var _item$values$2;
4543
-
4544
- const item = classified[param];
4545
- return React.createElement(LegendSection, Object.assign({
4546
- key: [keyIndex, item.index].join("-"),
4547
- index: item.index,
4548
- attribute: getConditionAttribute(attributes, item == null ? void 0 : (_item$values$2 = item.values[0]) == null ? void 0 : _item$values$2.condition),
4549
- parameter: param,
4550
- classified: item
4551
- }, props, rest));
4552
- }));
4553
- }, [layerInfo, formatValue, hiddenLegends, toggleHiddenLegend, clearHiddenLegends, goToClassification]);
4554
- return React.createElement(MapLegendContainer, null, renderItems);
4555
- });
4556
-
4557
- const Symbol = (_ref) => {
4558
- let {
4559
- symbol,
4560
- size,
4561
- render
4562
- } = _ref;
4563
- const {
4564
- canvas,
4565
- ref
4566
- } = useCanvas();
4567
- useSymbol({
4568
- symbol,
4569
- size,
4570
- render
4571
- }, canvas);
4572
- return React.createElement("canvas", {
4573
- ref: ref
4574
- });
4575
- };
4576
-
4577
- var _templateObject$2, _templateObject2$2;
4578
- const CompoundIcon = /*#__PURE__*/styled.div(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n height: 32px;\n width: 32px;\n"])), (_ref) => {
4579
- let {
4580
- geometryType,
4581
- icons
4582
- } = _ref;
4583
- return "url(" + icons[geometryType] + ") center center / " + (geometryType === GeometryType.Polyline ? '2rem 1.3rem' : 'auto 1rem') + " no-repeat";
4584
- });
4585
- const ClusterSymbol = /*#__PURE__*/styled.div(_templateObject2$2 || (_templateObject2$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 32px;\n height: 32px;\n\n :before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: inherit;\n height: inherit;\n background-color: ", ";\n border-radius: 50%;\n opacity: 0.28;\n }\n \n :after {\n content: \"99\";\n position: absolute;\n top: 4px;\n left: 4px;\n display: flex;\n justify-content: center;\n align-items: center;\n width: 24px;\n height: 24px;\n background-color: ", ";\n border-radius: 50%;\n color: white;\n font-size: 0.75rem;\n line-height: 1;\n }\n"])), (_ref2) => {
4586
- let {
4587
- color
4588
- } = _ref2;
4589
- return color;
4590
- }, (_ref3) => {
4591
- let {
4592
- color
4593
- } = _ref3;
4594
- return color;
4595
- });
4596
-
4597
- const MAX_SIZE = 32;
4598
- const StyleSymbol = (_ref) => {
4599
- let {
4600
- symbol,
4601
- size = MAX_SIZE,
4602
- children
4603
- } = _ref;
4604
-
4605
- if (children) {
4606
- return React.createElement(React.Fragment, null, children);
4607
- }
4608
-
4609
- let sGisSymbol = null;
4610
-
4611
- try {
4612
- sGisSymbol = deserializeSymbol(symbol);
4613
- } catch (e) {// TODO generate Error symbol
4614
- }
4615
-
4616
- if (!sGisSymbol) {
4617
- return null;
4618
- }
4619
-
4620
- if (isSGisClusterSymbol(symbol)) {
4621
- var _sGisSymbol$backgroun, _sGisSymbol$figure;
4622
-
4623
- const color = getParameterValue((_sGisSymbol$backgroun = sGisSymbol.background) == null ? void 0 : _sGisSymbol$backgroun.fillColor) || getParameterValue((_sGisSymbol$figure = sGisSymbol.figure) == null ? void 0 : _sGisSymbol$figure.fillColor) || "rgb(0, 170, 255)";
4624
- return React.createElement(ClusterSymbol, {
4625
- color: color
4626
- });
4627
- }
4628
-
4629
- return React.createElement(Symbol, {
4630
- symbol: adjustSymbol(sGisSymbol, {
4631
- size: size - 1
4632
- }),
4633
- size: size
4634
- });
4635
- };
4636
-
4637
- const LegendContext = /*#__PURE__*/createContext(null);
4638
- const LegendProvider = (_ref) => {
4639
- let {
4640
- symbol,
4641
- children
4642
- } = _ref;
4643
- return React.createElement(LegendContext.Provider, {
4644
- value: symbol || null
4645
- }, children);
269
+ width
270
+ } = painter;
271
+ const zeroPoint = painter.getPointFromPxPosition(0, 0).projectTo(crs);
272
+ const maxWidthPoint = painter.getPointFromPxPosition(width, 0).projectTo(crs);
273
+ const widthDistance = distance(zeroPoint, maxWidthPoint);
274
+ const pxK = width / (widthDistance || 1);
275
+ return Math.round(meters * pxK);
4646
276
  };
4647
- const useLegendContext = () => useContext(LegendContext);
4648
277
 
4649
278
  const polygonCircleFromPoint = (center, diameter) => {
4650
279
  const coordinates = [];
@@ -4661,5 +290,5 @@ const polygonCircleFromPoint = (center, diameter) => {
4661
290
  return [coordinates];
4662
291
  };
4663
292
 
4664
- export { ArrowLineMiterRender, BASE_OPERATORS, BETWEEN_OPERATORS, CONTAINS_OPERATORS, CircleLineMiterRender, ClassificationCondition, ClassificationManager, ClassifiedItem, ClusterLegendContainer, ClusterSymbol, ClusterSymbolPreview, ComparisonOperator, CompoundIcon, DEFAULT_CLUSTER_SVG, DEFAULT_ID_ATTRIBUTE_NAME, DEFAULT_LEGEND_SIZES, DEFAULT_LEGEND_STYLES, DEFAULT_LEGEND_SYMBOL_SIZE, DEFAULT_PARAMETER_INFO, DEFAULT_SYMBOL_FILL_COLOR, DEFAULT_SYMBOL_OFFSET, DEFAULT_SYMBOL_SIZE, DEFAULT_SYMBOL_STROKE_COLOR, DEFAULT_SYMBOL_WITH_BG_SIZE, DateFormat, ENDS_WITH_OPERATORS, EXTRA_BORDER_SIZE, EvergisStyle, FILLED_OPERATORS, FilterConditionOperation, GEOMETRY_ATTRIBUTE, ItemSeparator, ItemText, Legend, LegendChildren, LegendHeaderButton, LegendParameterDescription, LegendProvider, LegendSection, LegendSymbolRenderer, LineMiterRender, MapLegendBadge, MapLegendContainer, MapLegendDescription, MapLegendDescriptionContainer, MapLegendExpandButton, MapLegendHeader, MapLegendItem, MapLegendItems, MapLegendItemsContainer, MapLegendOther, MapLegendSectionContainer, MapLegendSectionItems, MapLegendValueDescr, MapLegendValues, MapLegendValuesOther, MapLegendValuesRange, MaximizedLegend, MaximizedLegendContainer, MinimizedLegend, MinimizedLegendContainer, NO_CONTENT_VALUE, OPERATOR_CONDITION_REMAP, PARAMETER_INFOS, PREVIEW_LIMITS, RANGE_OPERATORS, SGisBrushFill, SGisImageFill, SGisPolygonSymbol, SGisPolylineSymbol, SOLID_INTERVALS, STARTS_WITH_OPERATORS, SVGPoly, SYMBOL_CLASSIFICATION, SYMBOL_LIMITS, SYMBOL_SIZE_PARAMETERS, SelectedPointSymbol, SelectedPolySymbol, ShadowedPointSymbol, ShadowedPolySymbol, SizeMinimizedLegend, SizeMinimizedLegendDown, SizeMinimizedLegendLabel, SizeMinimizedLegendSymbol, SizeMinimizedLegendUp, SquareLineMiterRender, StyleSymbol, SvgSymbol, SvgSymbolBg, Symbol, SymbolButton, SymbolByType, SymbolContainer, adjustSymbol, applyParameterValue, checkLayerHasLegend, clamp, classifyParamsReduce, convertSvgToBase64, copyRings, createCompositeSymbol, createHiddenCondition, createLegendSymbol, createOtherHiddenCondition, createPointRender, createShadowRender, createSvgGradient, createValueTitle, createValueTitleFromCondition, dateComparisonOperators, defineStrokeStylePreset, deserializeSymbol, extractStyle, extractSymbol, findChildFeatureStyle, findChildFeatureSymbol, formatAttributeValue, formatDate, formatRangeClassValue, formatUniqueClassValue, getAttributeFromCondition, getAttributeNameFromClassified, getAttributeNameFromCondition, getChildSymbols, getClassificationValue, getClassified, getDashStylePreset, getDate, getDimensions, getExprFromCondition, getExtractedSymbol, getFeatureSymbol, getHexColor, getLegendSymbolRenders, getLegendSymbolSize, getLineDash, getMapLegendSymbolRenders, getMaximizedLegendValues, getMinimizedLegendValues, getOffsetParameterValue, getParameterFromSymbol, getParameterValue, getRangeValues$1 as getRangeValues, getServiceConfiguration, getSignFromConditionPart, getSimplifiedPolygonCoordinates, getSymbolParameterInfo, getSymbolRenders, getSymbolStrokeWidth, getTitleFromCondition, getValueFromConditionPart, isArrowLineMiter, isCalculatedParameter, isCircleLineMiter, isClusterFillColor, isClusterSymbol, isCombinedPolylineSymbol, isCompositeSymbol, isDashedBrush, isFilledLineMitter, isH3GridSymbol, isHatchBrush, isImageSymbol, isLabelSymbol, isLayerService, isMaskedImageSymbol, isMiterExist, isNumeric, isObject, isParameterByAttribute, isParameterType, isParameterValueSimple, isParameterValueSymbol, isPatternBrush, isPointLabelSymbol, isPointSymbol, isPolygonHasHatchBrush, isPolygonHasPatternBrush, isPolygonLabelSymbol, isPolygonSymbol, isPolylineLabelSymbol, isPolylineSymbols, isRangeClass, isRangeCondition, isRasterSymbol, isRequisiteNumbers, isSGisClusterSymbol, isSGisCombinedPolylineSymbol, isSGisH3Symbol, isSGisImageSymbol, isSGisPointSymbol, isSGisPolygonSymbol, isSGisPolylineSymbol, isScalablePolylineSymbol, isSimpleOffset, isSimplePolylineSymbol, isSimpleSymbol, isSizableSymbol, isSizeClassification, isSolidBrush, isSquareLineMiter, isSquareSymbol, isStaticImageSymbol, isStringAsInn, isStringAsKpp, isStringAsMail, isStringAsOgrn, isStringAsPhone, isStringAsUrl, isStringContainsDate, isStringParameterValue, isStrokeStyledSymbol, isStyle, isSvgPointSymbol, isSymbolWithOffset, isTwoDimensionalSymbol, isUniqueClass, isValidParameter, isValidUrl, mailHref, manipulateSvgSymbol, matchPhone, measureAreaSymbol, measureLengthSymbol, measurePolygonSnapSymbol, metersToPixels, numberComparisonOperators, numberWithSpaces, packStyle, phoneHref, polygonCircleFromPoint, printRangeClass, renderSymbolToCanvas, selectedPoint, selectedPolygon, selectedPolyline, serializeSvgPointSymbol, setDefaultParameterValue, setParameterValue, solidStrokeStylePreset, strokeStylePresets, symbolParameterWalker, symbolTypeGuard, textComparisonOperators, toIntervals, toLineDash, unClassify, updateSymbolParameter, urlHref, useCanvas, useLegendContext, useMount, useNode, useSvgSymbol, useSymbol, useToggle };
293
+ export { DateFormat, NO_CONTENT_VALUE, clamp, formatAttributeValue, formatDate, getDate, getHexColor, isNumeric, isObject, isRequisiteNumbers, isStringAsInn, isStringAsKpp, isStringAsMail, isStringAsOgrn, isStringAsPhone, isStringAsUrl, isStringContainsDate, isValidUrl, mailHref, matchPhone, metersToPixels, numberWithSpaces, phoneHref, polygonCircleFromPoint, urlHref, useMount, useNode, useToggle };
4665
294
  //# sourceMappingURL=react.esm.js.map