@evergis/react 2.0.172 → 2.0.174

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.esm.js CHANGED
@@ -1,20 +1,14 @@
1
1
  import React, { useState, useCallback, useMemo, useContext, createContext, useEffect, useRef, useReducer, memo, Fragment } from 'react';
2
2
  import { Bbox } from '@evergis/sgis/es/Bbox';
3
3
  import { getMouseOffset, listenDomEvent } from '@evergis/sgis/es/utils/domEvent';
4
- import { Api, AttributeType, unique, GeometryType, EvergisDynamicLayer as EvergisDynamicLayer$1, EvergisTileLayer as EvergisTileLayer$1, isEvergisDynamicLayer } from '@evergis/api';
4
+ import { Api, unique, AttributeType, GeometryType, EvergisDynamicLayer as EvergisDynamicLayer$1, EvergisTileLayer as EvergisTileLayer$1, isEvergisDynamicLayer } from '@evergis/api';
5
5
  import { Map as Map$1, BboxChangeEvent, BboxChangeEndEvent } from '@evergis/sgis/es/Map';
6
6
  import { DomPainter, MapResize } from '@evergis/sgis/es/painters/DomPainter/DomPainter';
7
7
  import { FeatureLayer as FeatureLayer$1 } from '@evergis/sgis/es/layers/FeatureLayer';
8
8
  import { Icon, IconButton, EverCloudStatisticsIcon, EverCloudZoomtoIcon, EverCloudCloseIcon, EverCloudPlayPrevIcon, EverCloudPlayNextIcon } from '@evergis/icons';
9
- import { isValid, toDate, format, parseJSON, parseISO } from 'date-fns';
10
- import { ConditionInterpreter, TokenType, ConditionEvaluator } from '@evergis/condition';
11
- import { MultiPoint } from '@evergis/sgis/es/features/MultiPoint';
12
- import { Polyline } from '@evergis/sgis/es/features/Polyline';
13
- import { Polygon } from '@evergis/sgis/es/features/Polygon';
14
- import { PointFeature } from '@evergis/sgis/es/features/PointFeature';
15
- import { webMercator, geo, wgs84, ellipticalMercator, plain } from '@evergis/sgis/es/Crs';
16
9
  import { BrushFill } from '@evergis/sgis/es/symbols/polygon/BrushFill';
17
10
  import { Color } from '@evergis/color';
11
+ import { ConditionInterpreter, TokenType, ConditionEvaluator, Char } from '@evergis/condition';
18
12
  import { ImageFill } from '@evergis/sgis/es/symbols/polygon/ImageFill';
19
13
  import { PolygonSymbol } from '@evergis/sgis/es/symbols/polygon/Simple';
20
14
  import { PolylineSymbol } from '@evergis/sgis/es/symbols/PolylineSymbol';
@@ -23,9 +17,16 @@ import { projectRings, length, area, distance } from '@evergis/sgis/es/geotools'
23
17
  import { simplifyCoordinates, softEquals } from '@evergis/sgis/es/utils/math';
24
18
  import { PolylineControl } from '@evergis/sgis/es/controls/PolylineControl';
25
19
  import { LabelFeature } from '@evergis/sgis/es/features/Label';
20
+ import { webMercator, geo, wgs84, ellipticalMercator, plain } from '@evergis/sgis/es/Crs';
21
+ import { Polygon } from '@evergis/sgis/es/features/Polygon';
26
22
  import { DrawingFinishEvent } from '@evergis/sgis/es/controls/Control';
23
+ import { isValid, toDate, format, parseJSON, parseISO } from 'date-fns';
24
+ import { MultiPoint } from '@evergis/sgis/es/features/MultiPoint';
25
+ import { Polyline } from '@evergis/sgis/es/features/Polyline';
26
+ import { PointFeature } from '@evergis/sgis/es/features/PointFeature';
27
27
  import { PolyEditor } from '@evergis/sgis/es/controls/PolyEditor';
28
28
  import get from 'lodash-es/get';
29
+ import { isNil } from 'lodash-es';
29
30
  import ReactDOM from 'react-dom';
30
31
  import { DynamicPointSymbol, Symbol as Symbol$1 } from '@evergis/sgis/es/symbols/Symbol';
31
32
  import { Poly } from '@evergis/sgis/es/features/Poly';
@@ -448,227 +449,6 @@ const useEvergisCard = features => {
448
449
  };
449
450
  };
450
451
 
451
- const NO_CONTENT_VALUE = '—';
452
- var DateFormat;
453
-
454
- (function (DateFormat) {
455
- DateFormat["ClientDefaultFormat"] = "dd.MM.yyyy HH:mm";
456
- DateFormat["DateTime"] = "dd.MM.yyyy HH:mm:ss";
457
- DateFormat["UTC"] = "yyyy-MM-dd'T'HH:mm:ss.sssxxx";
458
- DateFormat["AxisTooltip"] = "d MMMM yyyy";
459
- })(DateFormat || (DateFormat = {}));
460
-
461
- const stringDateParsers = [parseJSON, parseISO, rawDate => new Date(rawDate)];
462
- const getDate = rawDate => {
463
- if (!rawDate) return null;
464
-
465
- if (typeof rawDate === "string") {
466
- for (const parser of stringDateParsers) {
467
- const date = parser(rawDate);
468
-
469
- if (isValid(date)) {
470
- return toDate(date);
471
- }
472
- }
473
-
474
- return null;
475
- }
476
-
477
- const parsedDate = toDate(rawDate);
478
- return isValid(parsedDate) ? parsedDate : null;
479
- };
480
- const formatDate = function formatDate(date, _temp) {
481
- let {
482
- dateFormat = DateFormat.ClientDefaultFormat,
483
- defaultValue = NO_CONTENT_VALUE
484
- } = _temp === void 0 ? {} : _temp;
485
- const dateValue = date ? getDate(date) : null;
486
-
487
- if (isValid(dateValue)) {
488
- return format(dateValue, dateFormat);
489
- }
490
-
491
- return "" + defaultValue;
492
- };
493
-
494
- function numberWithSpaces(x, fractionDigits, delim) {
495
- if (fractionDigits === void 0) {
496
- fractionDigits = 2;
497
- }
498
-
499
- if (delim === void 0) {
500
- delim = ',';
501
- }
502
-
503
- const [num, frac] = x.toFixed(fractionDigits).split('.');
504
- const numWithSpaces = num.replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
505
- return [numWithSpaces, frac].join(delim);
506
- }
507
-
508
- function matchPhone(value) {
509
- const phoneRegexp = /((8|\+7)[- ]?)?(\(?\d{3,4}\)?[- ]?)?[\d\- ]{7,10}/g;
510
- return !isStringAsInn(value) && value.match(phoneRegexp);
511
- }
512
- function isStringAsInn(value) {
513
- const innRegexp = /^(([0-9]{12})|([0-9]{10}))$/;
514
- return innRegexp.test(value);
515
- }
516
- function isStringAsKpp(value) {
517
- const kppRegexp = /^(([0-9]{9}))$/;
518
- return kppRegexp.test(value);
519
- }
520
- function isStringAsOgrn(value) {
521
- const ogrnRegexp = /^([0-9]{13})?$/;
522
- return ogrnRegexp.test((+value).toString());
523
- }
524
- function isStringContainsDate(value) {
525
- const dateRegexp = /\d{4}(-|\/)\d{2}(-|\/)\d{2}/g;
526
- return dateRegexp.test(value);
527
- }
528
- function isRequisiteNumbers(value) {
529
- return isStringAsInn(value) || isStringAsKpp(value) || isStringAsOgrn(value);
530
- }
531
- function isStringAsPhone(value) {
532
- const phoneRegexp = /^((8|\+7)[- ]?)?(\(?\d{3,4}\)?[- ]?)?[\d\- ]{7,10}/;
533
- return !isRequisiteNumbers(value) && !isStringContainsDate(value) && phoneRegexp.test(value);
534
- }
535
- function isStringAsMail(value) {
536
- return isStringAsUrl(value) && value.includes('@');
537
- }
538
- function isStringAsUrl(value) {
539
- if (isValidUrl(value)) {
540
- return true;
541
- }
542
-
543
- const urlRegexp = /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;
544
- const urlKind = value.match(urlRegexp);
545
- return urlKind !== null;
546
- }
547
- function isValidUrl(value) {
548
- try {
549
- new URL(value);
550
- } catch (_) {
551
- return false;
552
- }
553
-
554
- return true;
555
- }
556
- const mailHref = mail => "mailto:" + mail;
557
- const phoneHref = mail => "tel:" + mail;
558
- const urlHref = url => isValidUrl(url) ? url : "//" + url;
559
-
560
- const stringAttribute = value => ({
561
- type: 0
562
- /* String */
563
- ,
564
- value
565
- });
566
-
567
- const urlAttribute = value => ({
568
- type: 2
569
- /* Url */
570
- ,
571
- value
572
- });
573
-
574
- const mailAttribute = value => ({
575
- type: 3
576
- /* Mail */
577
- ,
578
- value
579
- });
580
-
581
- const phoneAttribute = value => ({
582
- type: 1
583
- /* Phone */
584
- ,
585
- value
586
- });
587
-
588
- const convertStringAttribute = value => {
589
- if (isStringAsMail(value)) {
590
- return mailAttribute(value);
591
- }
592
-
593
- if (isStringAsUrl(value)) {
594
- return urlAttribute(value);
595
- }
596
-
597
- if (isStringAsPhone(value)) {
598
- return phoneAttribute(value);
599
- }
600
-
601
- return stringAttribute(value);
602
- };
603
-
604
- const formatStringAttribute = value => {
605
- const phones = matchPhone(value);
606
-
607
- if (!isRequisiteNumbers(value) && !isStringContainsDate(value) && phones && phones.length) {
608
- return phones.map(phoneAttribute);
609
- }
610
-
611
- const attributeValues = value.split(/[\s|]/).map(convertStringAttribute);
612
-
613
- if (attributeValues.every(_ref => {
614
- let {
615
- type
616
- } = _ref;
617
- return type === 0;
618
- }
619
- /* String */
620
- )) {
621
- return [stringAttribute(attributeValues.map(_ref2 => {
622
- let {
623
- value
624
- } = _ref2;
625
- return isNaN(+value) || isRequisiteNumbers(value) ? isStringAsOgrn(value) ? +value : value : numberWithSpaces(+value, 0, '');
626
- }).join(' '))];
627
- }
628
-
629
- return attributeValues;
630
- };
631
-
632
- const formatDateTimeAttribute = value => stringAttribute(value.toString());
633
-
634
- const formatIntAttribute = value => stringAttribute(numberWithSpaces(value, 0, ''));
635
-
636
- const DOUBLE_FRACTIONS = 2;
637
-
638
- const formatDoubleAttribute = value => stringAttribute(numberWithSpaces(value, DOUBLE_FRACTIONS, '.'));
639
-
640
- const isNullOrUndefined = value => value === null || value === undefined;
641
-
642
- const NO_CONTENT_ATTRIBUTE = {
643
- type: 0
644
- /* String */
645
- ,
646
- value: NO_CONTENT_VALUE
647
- };
648
- const formatAttributeValue = attribute => {
649
- if (isNullOrUndefined(attribute.value)) {
650
- return [NO_CONTENT_ATTRIBUTE];
651
- }
652
-
653
- switch (attribute.type) {
654
- case 'String':
655
- return formatStringAttribute(attribute.value);
656
-
657
- case 'DateTime':
658
- return [formatDateTimeAttribute(attribute.value)];
659
-
660
- case 'Int32':
661
- case 'Int64':
662
- return [formatIntAttribute(attribute.value)];
663
-
664
- case 'Double':
665
- return [formatDoubleAttribute(attribute.value)];
666
-
667
- default:
668
- return [NO_CONTENT_ATTRIBUTE];
669
- }
670
- };
671
-
672
452
  function isRangeClass(value) {
673
453
  return Boolean(value && 'from' in value);
674
454
  }
@@ -830,29 +610,96 @@ const isPolygonLabelSymbol = /*#__PURE__*/symbolTypeGuard('polygonLabelSymbol');
830
610
  const isPolylineLabelSymbol = /*#__PURE__*/symbolTypeGuard('polylineLabelSymbol');
831
611
  const isLabelSymbol = symbol => Boolean(symbol && (isPointLabelSymbol(symbol) || isPolygonLabelSymbol(symbol) || isPolylineLabelSymbol(symbol)));
832
612
 
833
- const isPointSymbol = /*#__PURE__*/symbolTypeGuard('circlePointSymbol');
834
- const isSquareSymbol = /*#__PURE__*/symbolTypeGuard('squarePointSymbol');
835
- const isMaskedImageSymbol = /*#__PURE__*/symbolTypeGuard('maskedImagePointSymbol');
836
- const isStaticImageSymbol = /*#__PURE__*/symbolTypeGuard('imagePointSymbol');
837
- const isPolygonSymbol = /*#__PURE__*/symbolTypeGuard('polygonSymbol');
838
- const isPolylineSymbol = /*#__PURE__*/symbolTypeGuard('polylineSymbol');
839
- const isSimplePolylineSymbol = /*#__PURE__*/symbolTypeGuard('simplePolylineSymbol');
840
- const isPolylineSymbols = symbol => Boolean(symbol && (isPolylineSymbol(symbol) || isSimplePolylineSymbol(symbol)));
841
- const isCompositeSymbol = /*#__PURE__*/symbolTypeGuard('compositeSymbol');
842
- const isRasterSymbol = /*#__PURE__*/symbolTypeGuard('rasterSymbol');
843
- const isImageSymbol = symbol => Boolean(symbol && (isMaskedImageSymbol(symbol) || isStaticImageSymbol(symbol)));
844
- const isTwoDimensionalSymbol = symbol => Boolean(symbol && 'width' in symbol);
845
- const isSizableSymbol = symbol => Boolean(symbol && 'size' in symbol);
846
- const isStrokeStyledSymbol = symbol => Boolean(symbol && (isPolygonSymbol(symbol) || isPolylineSymbols(symbol)));
847
- const isScalablePolylineSymbol = symbol => symbol.beginning !== null && symbol.ending !== null || symbol.stroke && symbol.stroke.type !== 'solid';
848
- const isSimpleSymbol = symbol => Boolean(symbol && !isLabelSymbol(symbol) && !isCompositeSymbol(symbol) && !isRasterSymbol(symbol));
849
- const isH3GridSymbol = /*#__PURE__*/symbolTypeGuard("h3grid");
850
- const isSvgPointSymbol = /*#__PURE__*/symbolTypeGuard("svgPointSymbol");
851
-
852
- const isHatchBrush = /*#__PURE__*/symbolTypeGuard('hatch');
853
- const isPatternBrush = /*#__PURE__*/symbolTypeGuard('pattern');
854
- const isDashedBrush = /*#__PURE__*/symbolTypeGuard('dashed');
855
- const isSolidBrush = /*#__PURE__*/symbolTypeGuard('solid');
613
+ const _excluded = ["ignoreLabel", "label", "symbol", "raster", "children"];
614
+ const createCompositeSymbol = childSymbols => ({
615
+ type: 'compositeSymbol',
616
+ childSymbols
617
+ });
618
+ const getChildSymbols = symbol => {
619
+ if (!symbol || !isCompositeSymbol(symbol)) return [];
620
+ return symbol.childSymbols || [];
621
+ };
622
+ const extractSymbol = symbol => {
623
+ const childSymbols = getChildSymbols(symbol);
624
+ return {
625
+ // @ts-ignore
626
+ symbol: childSymbols.find(isSimpleSymbol),
627
+ label: childSymbols.find(isLabelSymbol) || null,
628
+ raster: childSymbols.find(isRasterSymbol) || null
629
+ };
630
+ };
631
+ const extractStyle = style => {
632
+ // @ts-ignore
633
+ if (isCompositeSymbol(style.symbol)) {
634
+ return _extends({}, style, extractSymbol(style.symbol), {
635
+ // @ts-ignore
636
+ children: style.children && style.children.map(extractStyle)
637
+ });
638
+ } // NOTE: for cases when style is exist style object should have same reference for all extractStyle calls
639
+
640
+
641
+ return style || {};
642
+ };
643
+ const packStyle = style => {
644
+ const {
645
+ ignoreLabel,
646
+ label,
647
+ symbol,
648
+ raster,
649
+ children
650
+ } = style,
651
+ styleDc = _objectWithoutPropertiesLoose(style, _excluded);
652
+
653
+ const childSymbols = [!ignoreLabel && label, raster].filter(Boolean);
654
+ return _extends({}, styleDc, {
655
+ symbol: childSymbols.length ? // @ts-ignore
656
+ createCompositeSymbol([symbol, ...childSymbols]) : symbol,
657
+ // @ts-ignore
658
+ children: children ? // @ts-ignore
659
+ children.map(childStyle => packStyle(_extends({}, childStyle, {
660
+ ignoreLabel,
661
+ label
662
+ }))) : children
663
+ });
664
+ };
665
+
666
+ const isPointSymbol = /*#__PURE__*/symbolTypeGuard('circlePointSymbol');
667
+ const isSquareSymbol = /*#__PURE__*/symbolTypeGuard('squarePointSymbol');
668
+ const isMaskedImageSymbol = /*#__PURE__*/symbolTypeGuard('maskedImagePointSymbol');
669
+ const isStaticImageSymbol = /*#__PURE__*/symbolTypeGuard('imagePointSymbol');
670
+ const isPolygonSymbol = /*#__PURE__*/symbolTypeGuard('polygonSymbol');
671
+ const isPolylineSymbol = /*#__PURE__*/symbolTypeGuard('polylineSymbol');
672
+ const isSimplePolylineSymbol = /*#__PURE__*/symbolTypeGuard('simplePolylineSymbol');
673
+ const isPolylineSymbols = symbol => Boolean(symbol && (isPolylineSymbol(symbol) || isSimplePolylineSymbol(symbol)));
674
+ const isCompositeSymbol = /*#__PURE__*/symbolTypeGuard('compositeSymbol');
675
+ const isRasterSymbol = /*#__PURE__*/symbolTypeGuard('rasterSymbol');
676
+ const isImageSymbol = symbol => Boolean(symbol && (isMaskedImageSymbol(symbol) || isStaticImageSymbol(symbol)));
677
+ const isTwoDimensionalSymbol = symbol => Boolean(symbol && 'width' in symbol);
678
+ const isSizableSymbol = symbol => Boolean(symbol && 'size' in symbol);
679
+ const isStrokeStyledSymbol = symbol => Boolean(symbol && (isPolygonSymbol(symbol) || isPolylineSymbols(symbol)));
680
+ const isScalablePolylineSymbol = symbol => symbol.beginning !== null && symbol.ending !== null || symbol.stroke && symbol.stroke.type !== 'solid';
681
+ const isSimpleSymbol = symbol => Boolean(symbol && !isLabelSymbol(symbol) && !isCompositeSymbol(symbol) && !isRasterSymbol(symbol));
682
+ const isH3GridSymbol = /*#__PURE__*/symbolTypeGuard("h3grid");
683
+ const isSvgPointSymbol = /*#__PURE__*/symbolTypeGuard("svgPointSymbol");
684
+ const isClusterSymbol = /*#__PURE__*/symbolTypeGuard("cluster");
685
+ const isClusterFillColor = (symbol, parameter) => {
686
+ return isClusterSymbol(symbol) && parameter === "fillColor";
687
+ };
688
+ const getExtractedSymbol = function getExtractedSymbol(symbol, extractCluster) {
689
+ var _extractSymbol;
690
+
691
+ if (extractCluster === void 0) {
692
+ extractCluster = false;
693
+ }
694
+
695
+ const extracted = isCompositeSymbol(symbol) ? (_extractSymbol = extractSymbol(symbol)) == null ? void 0 : _extractSymbol.symbol : symbol;
696
+ return extractCluster && isClusterSymbol(extracted) ? extracted.singleObjectSymbol : extracted;
697
+ };
698
+
699
+ const isHatchBrush = /*#__PURE__*/symbolTypeGuard('hatch');
700
+ const isPatternBrush = /*#__PURE__*/symbolTypeGuard('pattern');
701
+ const isDashedBrush = /*#__PURE__*/symbolTypeGuard('dashed');
702
+ const isSolidBrush = /*#__PURE__*/symbolTypeGuard('solid');
856
703
  const isPolygonHasPatternBrush = symbol => Boolean(symbol && isPolygonSymbol(symbol) && isPatternBrush(symbol.fill));
857
704
  const isPolygonHasHatchBrush = symbol => Boolean(symbol && isPolygonSymbol(symbol) && isHatchBrush(symbol.fill));
858
705
 
@@ -1058,138 +905,6 @@ function getRangeValues(_ref, isDouble, isDate, index) {
1058
905
  };
1059
906
  }
1060
907
 
1061
- /** Spatial Reference WKID using for @evergis/sgis */
1062
-
1063
- var SrId;
1064
-
1065
- (function (SrId) {
1066
- /** 3857 */
1067
- SrId[SrId["WebMercator"] = 3857] = "WebMercator";
1068
- /** 4326 */
1069
-
1070
- SrId[SrId["Geo"] = 4326] = "Geo";
1071
- /** 84 */
1072
-
1073
- SrId[SrId["Wgs84"] = 84] = "Wgs84";
1074
- /** 3395 */
1075
-
1076
- SrId[SrId["EllipticalMercator"] = 3395] = "EllipticalMercator";
1077
- })(SrId || (SrId = {}));
1078
-
1079
- const CRS_MAP = {
1080
- [SrId.WebMercator]: webMercator,
1081
- [SrId.Geo]: geo,
1082
- [SrId.Wgs84]: wgs84,
1083
- [SrId.EllipticalMercator]: ellipticalMercator
1084
- };
1085
- const DEFAULT_SRID = SrId.WebMercator;
1086
- const DEFAULT_CRS = CRS_MAP[DEFAULT_SRID];
1087
- const getCrs = srId => CRS_MAP[srId];
1088
-
1089
- const getFeatureAttributeType = attributeValue => {
1090
- if (attributeValue instanceof Date) {
1091
- return AttributeType.DateTime;
1092
- }
1093
-
1094
- if (typeof attributeValue === 'string') {
1095
- return AttributeType.String;
1096
- }
1097
-
1098
- if (typeof attributeValue === 'number') {
1099
- return AttributeType.Int64;
1100
- }
1101
-
1102
- return AttributeType.Unknown;
1103
- };
1104
- const getLayerAttributes = layerDefinition => {
1105
- const attributes = layerDefinition && layerDefinition.attributes || {};
1106
- return Object.entries(attributes).map(_ref => {
1107
- let [name, definition] = _ref;
1108
- return _extends({
1109
- name
1110
- }, definition);
1111
- });
1112
- };
1113
- const getFeatureAttributes = attributes => {
1114
- return attributes ? Object.entries(attributes).map(_ref2 => {
1115
- let [name, value] = _ref2;
1116
- return {
1117
- name,
1118
- value,
1119
- type: getFeatureAttributeType(value)
1120
- };
1121
- }) : [];
1122
- };
1123
- const getClassificationAttribute = (attributeName, attributes) => {
1124
- const attribute = attributes[attributeName];
1125
- const attrNamePart = {
1126
- name: attributeName,
1127
- type: (attribute == null ? void 0 : attribute.type) || AttributeType.Unknown
1128
- };
1129
- return attribute ? _extends({}, attrNamePart, attribute) : attrNamePart;
1130
- };
1131
- const mergeAttributes = (attributes1, attributes2) => {
1132
- return attributes1.map(attribute => _extends({}, attribute, attributes2.find(_ref3 => {
1133
- let {
1134
- name
1135
- } = _ref3;
1136
- return attribute.name === name;
1137
- }) || {}));
1138
- };
1139
-
1140
- const _excluded = ["ignoreLabel", "label", "symbol", "raster", "children"];
1141
- const createCompositeSymbol = childSymbols => ({
1142
- type: 'compositeSymbol',
1143
- childSymbols
1144
- });
1145
- const getChildSymbols = symbol => {
1146
- if (!symbol || !isCompositeSymbol(symbol)) return [];
1147
- return symbol.childSymbols || [];
1148
- };
1149
- const extractSymbol = symbol => {
1150
- const childSymbols = getChildSymbols(symbol);
1151
- return {
1152
- // @ts-ignore
1153
- symbol: childSymbols.find(isSimpleSymbol),
1154
- label: childSymbols.find(isLabelSymbol) || null,
1155
- raster: childSymbols.find(isRasterSymbol) || null
1156
- };
1157
- };
1158
- const extractStyle = style => {
1159
- // @ts-ignore
1160
- if (isCompositeSymbol(style.symbol)) {
1161
- return _extends({}, style, extractSymbol(style.symbol), {
1162
- // @ts-ignore
1163
- children: style.children && style.children.map(extractStyle)
1164
- });
1165
- } // NOTE: for cases when style is exist style object should have same reference for all extractStyle calls
1166
-
1167
-
1168
- return style || {};
1169
- };
1170
- const packStyle = style => {
1171
- const {
1172
- ignoreLabel,
1173
- label,
1174
- symbol,
1175
- raster,
1176
- children
1177
- } = style,
1178
- styleDc = _objectWithoutPropertiesLoose(style, _excluded);
1179
-
1180
- const childSymbols = [!ignoreLabel && label, raster].filter(Boolean);
1181
- return _extends({}, styleDc, {
1182
- symbol: childSymbols.length ? // @ts-ignore
1183
- createCompositeSymbol([symbol, ...childSymbols]) : symbol,
1184
- // @ts-ignore
1185
- children: children ? // @ts-ignore
1186
- children.map(childStyle => packStyle(_extends({}, childStyle, {
1187
- ignoreLabel,
1188
- label
1189
- }))) : children
1190
- });
1191
- };
1192
-
1193
908
  let EvergisStyle = /*#__PURE__*/function () {
1194
909
  function EvergisStyle(style) {
1195
910
  _classCallCheck(this, EvergisStyle);
@@ -1636,40 +1351,673 @@ let ArrowLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
1636
1351
  return ArrowLineMiterRender;
1637
1352
  }(LineMiterRender);
1638
1353
 
1639
- const DEFAULT_FORMATTERS = {
1640
- polygon: formatPolygonMeasure,
1641
- length: formatLength
1642
- };
1643
-
1644
- const COORD_FRACTION = 6;
1645
- const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
1646
- let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
1647
- _inherits(BaseMeasureToolCreator, _PolylineControl);
1648
-
1649
- var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
1650
-
1651
- function BaseMeasureToolCreator(map, painter, params) {
1652
- var _this;
1653
-
1654
- _classCallCheck(this, BaseMeasureToolCreator);
1655
-
1656
- _this = _super.call(this, map, params);
1657
-
1658
- _this.cancel = () => {
1659
- _this.fire('cancel');
1660
- };
1354
+ const NO_CONTENT_VALUE = '—';
1355
+ var DateFormat;
1661
1356
 
1662
- _this.painter = painter;
1663
- _this.renderLabelSymbol = params.renderLabelSymbol;
1664
- _this.formatters = params.formatters || DEFAULT_FORMATTERS;
1665
- _this.areaSymbol = params.areaSymbol;
1357
+ (function (DateFormat) {
1358
+ DateFormat["ClientDefaultFormat"] = "dd.MM.yyyy HH:mm";
1359
+ DateFormat["DateTime"] = "dd.MM.yyyy HH:mm:ss";
1360
+ DateFormat["UTC"] = "yyyy-MM-dd'T'HH:mm:ss.sssxxx";
1361
+ DateFormat["AxisTooltip"] = "d MMMM yyyy";
1362
+ })(DateFormat || (DateFormat = {}));
1666
1363
 
1667
- _this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
1364
+ const stringDateParsers = [parseJSON, parseISO, rawDate => new Date(rawDate)];
1365
+ const getDate = rawDate => {
1366
+ if (!rawDate) return null;
1668
1367
 
1368
+ if (typeof rawDate === "string") {
1369
+ for (const parser of stringDateParsers) {
1370
+ const date = parser(rawDate);
1669
1371
 
1670
- _this.on('change', _this.updateDistance);
1372
+ if (isValid(date)) {
1373
+ return toDate(date);
1374
+ }
1375
+ }
1671
1376
 
1672
- return _this;
1377
+ return null;
1378
+ }
1379
+
1380
+ const parsedDate = toDate(rawDate);
1381
+ return isValid(parsedDate) ? parsedDate : null;
1382
+ };
1383
+ const formatDate = function formatDate(date, _temp) {
1384
+ let {
1385
+ dateFormat = DateFormat.ClientDefaultFormat,
1386
+ defaultValue = NO_CONTENT_VALUE
1387
+ } = _temp === void 0 ? {} : _temp;
1388
+ const dateValue = date ? getDate(date) : null;
1389
+
1390
+ if (isValid(dateValue)) {
1391
+ return format(dateValue, dateFormat);
1392
+ }
1393
+
1394
+ return "" + defaultValue;
1395
+ };
1396
+
1397
+ function numberWithSpaces(x, fractionDigits, delim) {
1398
+ if (fractionDigits === void 0) {
1399
+ fractionDigits = 2;
1400
+ }
1401
+
1402
+ if (delim === void 0) {
1403
+ delim = ',';
1404
+ }
1405
+
1406
+ const [num, frac] = x.toFixed(fractionDigits).split('.');
1407
+ const numWithSpaces = num.replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
1408
+ return [numWithSpaces, frac].join(delim);
1409
+ }
1410
+
1411
+ function matchPhone(value) {
1412
+ const phoneRegexp = /((8|\+7)[- ]?)?(\(?\d{3,4}\)?[- ]?)?[\d\- ]{7,10}/g;
1413
+ return !isStringAsInn(value) && value.match(phoneRegexp);
1414
+ }
1415
+ function isStringAsInn(value) {
1416
+ const innRegexp = /^(([0-9]{12})|([0-9]{10}))$/;
1417
+ return innRegexp.test(value);
1418
+ }
1419
+ function isStringAsKpp(value) {
1420
+ const kppRegexp = /^(([0-9]{9}))$/;
1421
+ return kppRegexp.test(value);
1422
+ }
1423
+ function isStringAsOgrn(value) {
1424
+ const ogrnRegexp = /^([0-9]{13})?$/;
1425
+ return ogrnRegexp.test((+value).toString());
1426
+ }
1427
+ function isStringContainsDate(value) {
1428
+ const dateRegexp = /\d{4}(-|\/)\d{2}(-|\/)\d{2}/g;
1429
+ return dateRegexp.test(value);
1430
+ }
1431
+ function isRequisiteNumbers(value) {
1432
+ return isStringAsInn(value) || isStringAsKpp(value) || isStringAsOgrn(value);
1433
+ }
1434
+ function isStringAsPhone(value) {
1435
+ const phoneRegexp = /^((8|\+7)[- ]?)?(\(?\d{3,4}\)?[- ]?)?[\d\- ]{7,10}/;
1436
+ return !isRequisiteNumbers(value) && !isStringContainsDate(value) && phoneRegexp.test(value);
1437
+ }
1438
+ function isStringAsMail(value) {
1439
+ return isStringAsUrl(value) && value.includes('@');
1440
+ }
1441
+ function isStringAsUrl(value) {
1442
+ if (isValidUrl(value)) {
1443
+ return true;
1444
+ }
1445
+
1446
+ const urlRegexp = /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;
1447
+ const urlKind = value.match(urlRegexp);
1448
+ return urlKind !== null;
1449
+ }
1450
+ function isValidUrl(value) {
1451
+ try {
1452
+ new URL(value);
1453
+ } catch (_) {
1454
+ return false;
1455
+ }
1456
+
1457
+ return true;
1458
+ }
1459
+ const mailHref = mail => "mailto:" + mail;
1460
+ const phoneHref = mail => "tel:" + mail;
1461
+ const urlHref = url => isValidUrl(url) ? url : "//" + url;
1462
+
1463
+ const stringAttribute = value => ({
1464
+ type: 0
1465
+ /* String */
1466
+ ,
1467
+ value
1468
+ });
1469
+
1470
+ const urlAttribute = value => ({
1471
+ type: 2
1472
+ /* Url */
1473
+ ,
1474
+ value
1475
+ });
1476
+
1477
+ const mailAttribute = value => ({
1478
+ type: 3
1479
+ /* Mail */
1480
+ ,
1481
+ value
1482
+ });
1483
+
1484
+ const phoneAttribute = value => ({
1485
+ type: 1
1486
+ /* Phone */
1487
+ ,
1488
+ value
1489
+ });
1490
+
1491
+ const convertStringAttribute = value => {
1492
+ if (isStringAsMail(value)) {
1493
+ return mailAttribute(value);
1494
+ }
1495
+
1496
+ if (isStringAsUrl(value)) {
1497
+ return urlAttribute(value);
1498
+ }
1499
+
1500
+ if (isStringAsPhone(value)) {
1501
+ return phoneAttribute(value);
1502
+ }
1503
+
1504
+ return stringAttribute(value);
1505
+ };
1506
+
1507
+ const formatStringAttribute = value => {
1508
+ const phones = matchPhone(value);
1509
+
1510
+ if (!isRequisiteNumbers(value) && !isStringContainsDate(value) && phones && phones.length) {
1511
+ return phones.map(phoneAttribute);
1512
+ }
1513
+
1514
+ const attributeValues = value.split(/[\s|]/).map(convertStringAttribute);
1515
+
1516
+ if (attributeValues.every(_ref => {
1517
+ let {
1518
+ type
1519
+ } = _ref;
1520
+ return type === 0;
1521
+ }
1522
+ /* String */
1523
+ )) {
1524
+ return [stringAttribute(attributeValues.map(_ref2 => {
1525
+ let {
1526
+ value
1527
+ } = _ref2;
1528
+ return isNaN(+value) || isRequisiteNumbers(value) ? isStringAsOgrn(value) ? +value : value : numberWithSpaces(+value, 0, '');
1529
+ }).join(' '))];
1530
+ }
1531
+
1532
+ return attributeValues;
1533
+ };
1534
+
1535
+ const formatDateTimeAttribute = value => stringAttribute(value.toString());
1536
+
1537
+ const formatIntAttribute = value => stringAttribute(numberWithSpaces(value, 0, ''));
1538
+
1539
+ const DOUBLE_FRACTIONS = 2;
1540
+
1541
+ const formatDoubleAttribute = value => stringAttribute(numberWithSpaces(value, DOUBLE_FRACTIONS, '.'));
1542
+
1543
+ const isNullOrUndefined = value => value === null || value === undefined;
1544
+
1545
+ const NO_CONTENT_ATTRIBUTE = {
1546
+ type: 0
1547
+ /* String */
1548
+ ,
1549
+ value: NO_CONTENT_VALUE
1550
+ };
1551
+ const formatAttributeValue = attribute => {
1552
+ if (isNullOrUndefined(attribute.value)) {
1553
+ return [NO_CONTENT_ATTRIBUTE];
1554
+ }
1555
+
1556
+ switch (attribute.type) {
1557
+ case 'String':
1558
+ return formatStringAttribute(attribute.value);
1559
+
1560
+ case 'DateTime':
1561
+ return [formatDateTimeAttribute(attribute.value)];
1562
+
1563
+ case 'Int32':
1564
+ case 'Int64':
1565
+ return [formatIntAttribute(attribute.value)];
1566
+
1567
+ case 'Double':
1568
+ return [formatDoubleAttribute(attribute.value)];
1569
+
1570
+ default:
1571
+ return [NO_CONTENT_ATTRIBUTE];
1572
+ }
1573
+ };
1574
+
1575
+ /** Spatial Reference WKID using for @evergis/sgis */
1576
+
1577
+ var SrId;
1578
+
1579
+ (function (SrId) {
1580
+ /** 3857 */
1581
+ SrId[SrId["WebMercator"] = 3857] = "WebMercator";
1582
+ /** 4326 */
1583
+
1584
+ SrId[SrId["Geo"] = 4326] = "Geo";
1585
+ /** 84 */
1586
+
1587
+ SrId[SrId["Wgs84"] = 84] = "Wgs84";
1588
+ /** 3395 */
1589
+
1590
+ SrId[SrId["EllipticalMercator"] = 3395] = "EllipticalMercator";
1591
+ })(SrId || (SrId = {}));
1592
+
1593
+ const CRS_MAP = {
1594
+ [SrId.WebMercator]: webMercator,
1595
+ [SrId.Geo]: geo,
1596
+ [SrId.Wgs84]: wgs84,
1597
+ [SrId.EllipticalMercator]: ellipticalMercator
1598
+ };
1599
+ const DEFAULT_SRID = SrId.WebMercator;
1600
+ const DEFAULT_CRS = CRS_MAP[DEFAULT_SRID];
1601
+ const getCrs = srId => CRS_MAP[srId];
1602
+
1603
+ const getFeatureAttributeType = attributeValue => {
1604
+ if (attributeValue instanceof Date) {
1605
+ return AttributeType.DateTime;
1606
+ }
1607
+
1608
+ if (typeof attributeValue === 'string') {
1609
+ return AttributeType.String;
1610
+ }
1611
+
1612
+ if (typeof attributeValue === 'number') {
1613
+ return AttributeType.Int64;
1614
+ }
1615
+
1616
+ return AttributeType.Unknown;
1617
+ };
1618
+ const getLayerAttributes = layerDefinition => {
1619
+ const attributes = layerDefinition && layerDefinition.attributes || {};
1620
+ return Object.entries(attributes).map(_ref => {
1621
+ let [name, definition] = _ref;
1622
+ return _extends({
1623
+ name
1624
+ }, definition);
1625
+ });
1626
+ };
1627
+ const getFeatureAttributes = attributes => {
1628
+ return attributes ? Object.entries(attributes).map(_ref2 => {
1629
+ let [name, value] = _ref2;
1630
+ return {
1631
+ name,
1632
+ value,
1633
+ type: getFeatureAttributeType(value)
1634
+ };
1635
+ }) : [];
1636
+ };
1637
+ const mergeAttributes = (attributes1, attributes2) => {
1638
+ return attributes1.map(attribute => _extends({}, attribute, attributes2.find(_ref3 => {
1639
+ let {
1640
+ name
1641
+ } = _ref3;
1642
+ return attribute.name === name;
1643
+ }) || {}));
1644
+ };
1645
+
1646
+ let EvergisFeature = /*#__PURE__*/function () {
1647
+ function EvergisFeature(feature) {
1648
+ _classCallCheck(this, EvergisFeature);
1649
+
1650
+ this.id = null;
1651
+ this.displayName = null;
1652
+ this.geometry = null;
1653
+ this.layerName = null;
1654
+ this.layerAlias = null;
1655
+ this.attributes = null;
1656
+ this.symbol = null;
1657
+ this.id = feature.id;
1658
+ this.displayName = feature.id;
1659
+ this.geometry = feature.geometry;
1660
+ this.layerName = feature.layer;
1661
+ this.layerAlias = feature.layer;
1662
+ this.attributes = getFeatureAttributes(feature.attributes);
1663
+ }
1664
+
1665
+ _createClass(EvergisFeature, [{
1666
+ key: "sGisFeature",
1667
+ value: function sGisFeature() {
1668
+ if (!this.geometry || !this.symbol) {
1669
+ return null;
1670
+ } // @ts-ignore
1671
+
1672
+
1673
+ const {
1674
+ type,
1675
+ coordinates,
1676
+ sr
1677
+ } = this.geometry;
1678
+ const crs = CRS_MAP[sr];
1679
+
1680
+ if (!crs) {
1681
+ return null;
1682
+ }
1683
+
1684
+ switch (type) {
1685
+ case GeometryType.Point:
1686
+ return new PointFeature(coordinates, {
1687
+ symbol: selectedPoint,
1688
+ crs
1689
+ });
1690
+
1691
+ case GeometryType.Multipoint:
1692
+ return new MultiPoint(coordinates, {
1693
+ symbol: selectedPoint,
1694
+ crs
1695
+ });
1696
+
1697
+ case GeometryType.Polyline:
1698
+ return new Polyline(coordinates, {
1699
+ symbol: selectedPolyline,
1700
+ crs
1701
+ });
1702
+
1703
+ case GeometryType.Polygon:
1704
+ return new Polygon(coordinates, {
1705
+ symbol: selectedPolygon,
1706
+ crs
1707
+ });
1708
+
1709
+ default:
1710
+ return null;
1711
+ }
1712
+ }
1713
+ }, {
1714
+ key: "extent",
1715
+ value: function extent() {
1716
+ const feature = this.sGisFeature();
1717
+ return feature && feature.bbox;
1718
+ }
1719
+ }]);
1720
+
1721
+ return EvergisFeature;
1722
+ }();
1723
+
1724
+ function evaluateCondition(condition, attributes) {
1725
+ try {
1726
+ const evaluator = new ConditionEvaluator(attributes);
1727
+ const result = evaluator.evaluate(condition);
1728
+
1729
+ if (result instanceof Error) {
1730
+ return null;
1731
+ }
1732
+
1733
+ return result;
1734
+ } catch (_unused) {
1735
+ return null;
1736
+ }
1737
+ }
1738
+
1739
+ function getAttributeValue(attributes, attributeName) {
1740
+ const attributeMeta = attributes.find(_ref => {
1741
+ let {
1742
+ name
1743
+ } = _ref;
1744
+ return name === attributeName;
1745
+ });
1746
+ return attributeMeta ? attributeMeta.value : null;
1747
+ }
1748
+
1749
+ const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
1750
+ const getAttributeNameFromClassified = values => values.length > 0 ? getAttributeNameFromCondition(values[0].condition) : null;
1751
+
1752
+ function findFeatureValue(parameterValues, _ref2) {
1753
+ let [name, value] = _ref2;
1754
+ return value !== null ? parameterValues.find(_ref3 => {
1755
+ let {
1756
+ condition
1757
+ } = _ref3;
1758
+ return value !== undefined && evaluateCondition(condition, {
1759
+ [name]: value
1760
+ });
1761
+ }) : null;
1762
+ }
1763
+
1764
+ function extractValuesAttribute(parameterValues, attributes) {
1765
+ const name = getAttributeNameFromClassified(parameterValues) || '';
1766
+ const value = name && getAttributeValue(attributes, name);
1767
+ return [name, value];
1768
+ }
1769
+
1770
+ function evaluateFeatureSymbol(attributes) {
1771
+ // @ts-ignore
1772
+ function calc(result, _ref4) {
1773
+ let [parameterName, parameterValue] = _ref4;
1774
+ let newParameterValue;
1775
+
1776
+ if (isParameterByAttribute(parameterValue)) {
1777
+ const [attributeName, attributeValue] = extractValuesAttribute(parameterValue.values, attributes);
1778
+ const featureValue = findFeatureValue(parameterValue.values, [attributeName, attributeValue]);
1779
+ newParameterValue = featureValue ? featureValue.value : parameterValue.defaultValue;
1780
+ } else if (isObject(parameterValue)) {
1781
+ // @ts-ignore
1782
+ newParameterValue = Object.entries(parameterValue).reduce(calc, parameterValue);
1783
+ }
1784
+
1785
+ return newParameterValue !== undefined ? _extends({}, result, {
1786
+ [parameterName]: newParameterValue
1787
+ }) : result;
1788
+ }
1789
+
1790
+ return calc;
1791
+ }
1792
+
1793
+ function findChildFeatureStyle(childStyles, attributes) {
1794
+ return (childStyles || []).find(_ref5 => {
1795
+ let {
1796
+ condition
1797
+ } = _ref5;
1798
+ const attributeName = condition && getAttributeNameFromCondition(condition);
1799
+ const attributeValue = attributeName && getAttributeValue(attributes, attributeName);
1800
+
1801
+ if (condition && attributeName && attributeValue !== undefined) {
1802
+ return evaluateCondition(condition, {
1803
+ [attributeName]: attributeValue
1804
+ });
1805
+ }
1806
+
1807
+ return false;
1808
+ }) || null;
1809
+ }
1810
+ function findChildFeatureSymbol(childStyles, attributes) {
1811
+ const featureStyle = findChildFeatureStyle(childStyles, attributes);
1812
+ return featureStyle ? featureStyle.symbol : null;
1813
+ }
1814
+ function getFeatureSymbol(style, attributes) {
1815
+ if (!style || !style.symbol) {
1816
+ return null;
1817
+ }
1818
+
1819
+ if (style.children !== null) {
1820
+ return findChildFeatureSymbol(style.children, attributes) || style.symbol;
1821
+ }
1822
+
1823
+ return Object.entries(style.symbol).reduce(evaluateFeatureSymbol(attributes), style.symbol);
1824
+ }
1825
+
1826
+ let EvergisLayer = /*#__PURE__*/function () {
1827
+ function EvergisLayer(service) {
1828
+ _classCallCheck(this, EvergisLayer);
1829
+
1830
+ this.name = null;
1831
+ this.titleAttribute = null;
1832
+ this.alias = null;
1833
+ this.attributes = null;
1834
+ this.style = null;
1835
+ const evergisService = service;
1836
+ const {
1837
+ name,
1838
+ alias,
1839
+ style,
1840
+ layerDefinition
1841
+ } = evergisService;
1842
+ this.name = name;
1843
+ this.alias = alias || name;
1844
+ this.attributes = getLayerAttributes(layerDefinition);
1845
+ this.style = style && new EvergisStyle(style) || null;
1846
+ this.titleAttribute = layerDefinition && layerDefinition.titleAttribute || null;
1847
+ }
1848
+
1849
+ _createClass(EvergisLayer, [{
1850
+ key: "evaluateFeature",
1851
+ value: function evaluateFeature(feature) {
1852
+ feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
1853
+ feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
1854
+ feature.layerAlias = this.alias;
1855
+ const titleAttribute = (feature.attributes || []).find(_ref => {
1856
+ let {
1857
+ name
1858
+ } = _ref;
1859
+ return name === this.titleAttribute;
1860
+ });
1861
+ const displayName = titleAttribute && formatAttributeValue(titleAttribute)[0].value || feature.id;
1862
+ feature.displayName = displayName ? "" + displayName : feature.id;
1863
+ return feature;
1864
+ }
1865
+ }]);
1866
+
1867
+ return EvergisLayer;
1868
+ }();
1869
+
1870
+ const findFeatureLayer = feature => layer => layer.name === feature.layerName;
1871
+
1872
+ const evaluateFeature = layers => feature => {
1873
+ const featureLayer = layers.find(findFeatureLayer(feature));
1874
+ return featureLayer ? featureLayer.evaluateFeature(feature) : feature;
1875
+ };
1876
+
1877
+ function createValueTitle(value, index) {
1878
+ if (value.title) return value.title;
1879
+ if (isRangeClass(value)) return printRangeClass(value, index);
1880
+ if (isUniqueClass(value)) return value.uniqueValue;
1881
+ return '';
1882
+ }
1883
+
1884
+ function isValidParameter(parameter) {
1885
+ return !(parameter != null && parameter.includes("labelSymbol")) && !(parameter != null && parameter.includes("singleObjectSymbol"));
1886
+ }
1887
+
1888
+ var FilterConditionOperation;
1889
+
1890
+ (function (FilterConditionOperation) {
1891
+ FilterConditionOperation["AND"] = "&&";
1892
+ FilterConditionOperation["OR"] = "||";
1893
+ })(FilterConditionOperation || (FilterConditionOperation = {}));
1894
+
1895
+ var ComparisonOperator;
1896
+
1897
+ (function (ComparisonOperator) {
1898
+ /** `==` */
1899
+ ComparisonOperator["Equals"] = "Equals";
1900
+ /** `!=` */
1901
+
1902
+ ComparisonOperator["NotEquals"] = "NotEquals";
1903
+ /** `>` */
1904
+
1905
+ ComparisonOperator["GreaterThan"] = "GreaterThan";
1906
+ /** `<` */
1907
+
1908
+ ComparisonOperator["LessThan"] = "LessThan";
1909
+ /** `>=` */
1910
+
1911
+ ComparisonOperator["GreaterOrEquals"] = "GreaterOrEquals";
1912
+ /** `<=` */
1913
+
1914
+ ComparisonOperator["LessOrEquals"] = "LessOrEquals";
1915
+ ComparisonOperator["Filled"] = "Filled";
1916
+ ComparisonOperator["Empty"] = "Empty";
1917
+ /** `==` */
1918
+
1919
+ ComparisonOperator["Contains"] = "Contains";
1920
+ /** `!=` */
1921
+
1922
+ ComparisonOperator["NotContains"] = "NotContains";
1923
+ ComparisonOperator["StartsWith"] = "StartsWith";
1924
+ ComparisonOperator["NotStartsWith"] = "NotStartsWith";
1925
+ ComparisonOperator["EndsWith"] = "EndsWith";
1926
+ ComparisonOperator["NotEndsWith"] = "NotEndsWith";
1927
+ ComparisonOperator["Between"] = "Between";
1928
+ ComparisonOperator["Outside"] = "Outside";
1929
+ })(ComparisonOperator || (ComparisonOperator = {}));
1930
+
1931
+ function formatArea(num) {
1932
+ let result = num;
1933
+ let measure = 'м²';
1934
+
1935
+ if (num >= 10000000) {
1936
+ result = num / 1000000;
1937
+ measure = 'км²';
1938
+ } else if (num >= 10000) {
1939
+ result = num / 10000;
1940
+ measure = 'га';
1941
+ }
1942
+
1943
+ return numberWithSpaces(result) + " " + measure;
1944
+ }
1945
+ function formatLength(num) {
1946
+ let result = num;
1947
+ let measure = 'м';
1948
+
1949
+ if (num > 10000) {
1950
+ result = num / 1000;
1951
+ measure = 'км';
1952
+ }
1953
+
1954
+ return numberWithSpaces(result) + " " + measure;
1955
+ }
1956
+ function formatPolygonMeasure(area, perimiter) {
1957
+ return "S : " + formatArea(area) + " P : " + formatLength(perimiter);
1958
+ }
1959
+ function isPolylineLikePolygon(rings, resolution) {
1960
+ if (rings[0].length <= 3) {
1961
+ return false;
1962
+ }
1963
+
1964
+ const coords = rings[0];
1965
+ const firstPoint = coords[0];
1966
+ const lastPoint = coords[coords.length - 1];
1967
+ const distance = resolution * 2;
1968
+ return softEquals(firstPoint[0], lastPoint[0], distance) && softEquals(firstPoint[1], lastPoint[1], distance);
1969
+ }
1970
+
1971
+ function getScale(scale) {
1972
+ const scales = [1, 2, 5];
1973
+
1974
+ for (let x = 0; x < 21; x++) {
1975
+ for (let y = 0; y < scales.length; y++) {
1976
+ const result = Math.pow(10, x) * scales[y];
1977
+
1978
+ if (result > scale) {
1979
+ return result;
1980
+ }
1981
+ }
1982
+ }
1983
+
1984
+ return 1;
1985
+ }
1986
+
1987
+ const DEFAULT_FORMATTERS = {
1988
+ polygon: formatPolygonMeasure,
1989
+ length: formatLength
1990
+ };
1991
+
1992
+ const COORD_FRACTION = 6;
1993
+ const DEFAULT_LABEL_POSITION = [Infinity, Infinity];
1994
+ let BaseMeasureToolCreator = /*#__PURE__*/function (_PolylineControl) {
1995
+ _inherits(BaseMeasureToolCreator, _PolylineControl);
1996
+
1997
+ var _super = /*#__PURE__*/_createSuper(BaseMeasureToolCreator);
1998
+
1999
+ function BaseMeasureToolCreator(map, painter, params) {
2000
+ var _this;
2001
+
2002
+ _classCallCheck(this, BaseMeasureToolCreator);
2003
+
2004
+ _this = _super.call(this, map, params);
2005
+
2006
+ _this.cancel = () => {
2007
+ _this.fire('cancel');
2008
+ };
2009
+
2010
+ _this.painter = painter;
2011
+ _this.renderLabelSymbol = params.renderLabelSymbol;
2012
+ _this.formatters = params.formatters || DEFAULT_FORMATTERS;
2013
+ _this.areaSymbol = params.areaSymbol;
2014
+
2015
+ _this.on('pointAdd', _this.handlePointAdd); // @ts-ignore
2016
+
2017
+
2018
+ _this.on('change', _this.updateDistance);
2019
+
2020
+ return _this;
1673
2021
  }
1674
2022
 
1675
2023
  _createClass(BaseMeasureToolCreator, [{
@@ -1973,6 +2321,197 @@ const isParameterType = (types, parameter) => {
1973
2321
  })) || false;
1974
2322
  };
1975
2323
 
2324
+ const comparisonOperatorMapReversed = {
2325
+ [TokenType.ArEq]: ComparisonOperator.Equals,
2326
+ [TokenType.ArNotEq]: ComparisonOperator.NotEquals,
2327
+ [TokenType.ArGr]: ComparisonOperator.GreaterThan,
2328
+ [TokenType.ArLs]: ComparisonOperator.LessThan,
2329
+ [TokenType.ArGre]: ComparisonOperator.GreaterOrEquals,
2330
+ [TokenType.ArLse]: ComparisonOperator.LessOrEquals,
2331
+ [TokenType.Between]: ComparisonOperator.Between,
2332
+ [TokenType.Outside]: ComparisonOperator.Outside
2333
+ };
2334
+ const NUMERIC_ATTRIBUTE_TYPES = [AttributeType.Int32, AttributeType.Int64, AttributeType.DateTime, AttributeType.Double];
2335
+
2336
+ const formatValue = (value, isDate) => {
2337
+ return isDate ? "#'" + formatDate(value, {
2338
+ dateFormat: DateFormat.UTC,
2339
+ defaultValue: value
2340
+ }) + "'" : value ? value.toString() : 0;
2341
+ };
2342
+
2343
+ function formatCondition(condition) {
2344
+ const {
2345
+ comparisonOperator,
2346
+ value,
2347
+ type,
2348
+ attribute
2349
+ } = condition;
2350
+ const operator = OPERATOR_CONDITION_REMAP[comparisonOperator] || comparisonOperator;
2351
+ const preparedValue = typeof value === "string" && value.includes(" - ") ? value.split(" - ") : value;
2352
+ const isDate = type === AttributeType.DateTime;
2353
+ const isBetweenOutside = BETWEEN_OPERATORS.includes(comparisonOperator);
2354
+ const escapeValue = !NUMERIC_ATTRIBUTE_TYPES.includes(type) && preparedValue !== null;
2355
+
2356
+ if (isBetweenOutside && Array.isArray(preparedValue) && preparedValue[0] !== undefined) {
2357
+ return OPERATOR_CONDITION_REMAP[comparisonOperator] + "(" + attribute + ", " + formatValue(preparedValue[0], isDate) + ", " + formatValue(preparedValue[1], isDate) + ")";
2358
+ }
2359
+
2360
+ const formattedValue = Array.isArray(preparedValue) ? preparedValue.map(val => formatValue(val, isDate)) : formatValue(preparedValue, isDate);
2361
+ const nulledValue = isNil(preparedValue) ? "{null}" : formattedValue;
2362
+ const valueEscaped = escapeValue && typeof nulledValue === "string" ? "'" + Char.escapeSpecChars(addOperationToValue(nulledValue, comparisonOperator)) + "'" : nulledValue;
2363
+ return attribute + " " + operator + " " + valueEscaped;
2364
+ }
2365
+ function createConditionString(condition) {
2366
+ if (Array.isArray(condition)) {
2367
+ return "( " + formatCondition(condition[0]) + " " + condition[0].operation + " " + formatCondition(condition[1]) + " )";
2368
+ }
2369
+
2370
+ return formatCondition(condition);
2371
+ }
2372
+ function createCondition(_ref) {
2373
+ let {
2374
+ attribute,
2375
+ operation,
2376
+ value
2377
+ } = _ref;
2378
+ const comparisonOperator = comparisonOperatorMapReversed[operation];
2379
+ const convertedResult = convertOperatorValue(value, comparisonOperator);
2380
+ return _extends({
2381
+ attribute
2382
+ }, convertedResult);
2383
+ }
2384
+
2385
+ function convertOperatorValue(value, comparisonOperator) {
2386
+ if (typeof value === "string") {
2387
+ const operatorIndex = +(comparisonOperator === ComparisonOperator.NotEquals);
2388
+
2389
+ if (value.startsWith(Char.PERCENTAGE) && value.endsWith(Char.PERCENTAGE)) {
2390
+ return {
2391
+ value: value.slice(1, -1),
2392
+ comparisonOperator: CONTAINS_OPERATORS[operatorIndex]
2393
+ };
2394
+ }
2395
+
2396
+ if (value.startsWith(Char.PERCENTAGE)) {
2397
+ return {
2398
+ value: value.slice(1),
2399
+ comparisonOperator: ENDS_WITH_OPERATORS[operatorIndex]
2400
+ };
2401
+ }
2402
+
2403
+ if (value.endsWith(Char.PERCENTAGE)) {
2404
+ return {
2405
+ value: value.slice(0, -1),
2406
+ comparisonOperator: STARTS_WITH_OPERATORS[operatorIndex]
2407
+ };
2408
+ }
2409
+ }
2410
+
2411
+ return {
2412
+ value,
2413
+ comparisonOperator
2414
+ };
2415
+ }
2416
+
2417
+ const addContains = value => "%" + value + "%";
2418
+
2419
+ const addStartsWith = value => value + "%";
2420
+
2421
+ const addEndsWith = value => "%" + value;
2422
+
2423
+ function addOperationToValue(value, operator) {
2424
+ switch (operator) {
2425
+ case ComparisonOperator.Contains:
2426
+ case ComparisonOperator.NotContains:
2427
+ return addContains(value);
2428
+
2429
+ case ComparisonOperator.StartsWith:
2430
+ case ComparisonOperator.NotStartsWith:
2431
+ return addStartsWith(value);
2432
+
2433
+ case ComparisonOperator.EndsWith:
2434
+ case ComparisonOperator.NotEndsWith:
2435
+ return addEndsWith(value);
2436
+
2437
+ case ComparisonOperator.Between:
2438
+ return Char.BETWEEN;
2439
+
2440
+ case ComparisonOperator.Outside:
2441
+ return Char.OUTSIDE;
2442
+
2443
+ default:
2444
+ return value;
2445
+ }
2446
+ }
2447
+
2448
+ let FilterCondition = /*#__PURE__*/function () {
2449
+ function FilterCondition(condition) {
2450
+ if (condition === void 0) {
2451
+ condition = null;
2452
+ }
2453
+
2454
+ _classCallCheck(this, FilterCondition);
2455
+
2456
+ this.condition = condition;
2457
+ this.conditionInterpreter = new ConditionInterpreter(condition);
2458
+ }
2459
+
2460
+ _createClass(FilterCondition, [{
2461
+ key: "conditions",
2462
+ get: function get() {
2463
+ const {
2464
+ value
2465
+ } = this.conditionInterpreter;
2466
+
2467
+ if (value instanceof Error) {
2468
+ // TODO handle errors in client notifications
2469
+ console.warn(value.message);
2470
+ }
2471
+
2472
+ return value instanceof Error ? [] : value.expressions.map(createCondition);
2473
+ }
2474
+ }, {
2475
+ key: "conditionOperation",
2476
+ get: function get() {
2477
+ const {
2478
+ value
2479
+ } = this.conditionInterpreter;
2480
+
2481
+ if (value instanceof Error) {
2482
+ return null;
2483
+ }
2484
+
2485
+ const isOrCondition = value.boolOperations.includes(TokenType.BoolOr);
2486
+ const isAndCondition = value.boolOperations.includes(TokenType.BoolAnd);
2487
+
2488
+ if (isOrCondition && isAndCondition) {
2489
+ return null;
2490
+ }
2491
+
2492
+ return isOrCondition ? FilterConditionOperation.OR : isAndCondition ? FilterConditionOperation.AND : null;
2493
+ }
2494
+ }, {
2495
+ key: "isParsingError",
2496
+ value: function isParsingError() {
2497
+ return this.conditionInterpreter.value instanceof Error;
2498
+ }
2499
+ }, {
2500
+ key: "toString",
2501
+ value: function toString() {
2502
+ return this.condition;
2503
+ }
2504
+ }], [{
2505
+ key: "from",
2506
+ value: function from(conditions, operation) {
2507
+ const condition = (conditions == null ? void 0 : conditions.map(createConditionString).join(" " + operation + " ")) || null;
2508
+ return new FilterCondition(condition);
2509
+ }
2510
+ }]);
2511
+
2512
+ return FilterCondition;
2513
+ }();
2514
+
1976
2515
  const isLayerService = value => isObject(value) && "name" in value;
1977
2516
  const getAttributeFromCondition = condition => {
1978
2517
  const parts = condition.split(" ");
@@ -2006,7 +2545,7 @@ const isRangeCondition = condition => condition.includes("(");
2006
2545
  const getSymbolParameterInfo = parameter => {
2007
2546
  return PARAMETER_INFOS[parameter] || DEFAULT_PARAMETER_INFO;
2008
2547
  };
2009
- const formatValue = (value, type, calculatedParameter) => {
2548
+ const formatValue$1 = (value, type, calculatedParameter) => {
2010
2549
  var _ref;
2011
2550
 
2012
2551
  if (type === AttributeType.DateTime) {
@@ -2025,7 +2564,7 @@ const formatUniqueClassValue = value => {
2025
2564
  attribute,
2026
2565
  uniqueValue
2027
2566
  } = value;
2028
- return attribute ? formatValue(uniqueValue, attribute.type) : uniqueValue;
2567
+ return attribute ? formatValue$1(uniqueValue, attribute.type) : uniqueValue;
2029
2568
  };
2030
2569
  const getRangeValues$1 = (_ref2, isDouble, isDate, index) => {
2031
2570
  let {
@@ -2076,7 +2615,7 @@ const getTitleFromCondition = condition => {
2076
2615
  return (_parts$ = parts[1]) == null ? void 0 : _parts$.slice(1, -1);
2077
2616
  };
2078
2617
 
2079
- function createValueTitle(paramValue, attributeType, index) {
2618
+ function createValueTitle$1(paramValue, attributeType, index) {
2080
2619
  if (paramValue.title) return paramValue.title;
2081
2620
  const value = {
2082
2621
  parameterValue: getParameterValue(paramValue.value),
@@ -2314,8 +2853,63 @@ const createLegendSymbol = (parameterValue, parameter, classificationsParams, ba
2314
2853
 
2315
2854
  return null;
2316
2855
  };
2317
- const getMinimizedLegendValues = (attributeType, param, index) => {
2318
- return param.values.map(paramValue => {
2856
+ function createHiddenCondition(attributeName, attributeType, value) {
2857
+ let newValue;
2858
+ let comparisonOperator;
2859
+
2860
+ if (isRangeClass(value)) {
2861
+ if (value.from && value.to) {
2862
+ newValue = [value.from, value.to];
2863
+ comparisonOperator = ComparisonOperator.Outside;
2864
+ } else if (value.from) {
2865
+ newValue = value.from;
2866
+ comparisonOperator = ComparisonOperator.LessThan;
2867
+ } else if (value.to) {
2868
+ newValue = value.to;
2869
+ comparisonOperator = ComparisonOperator.GreaterThan;
2870
+ }
2871
+ } else {
2872
+ newValue = value.uniqueValue;
2873
+ comparisonOperator = ComparisonOperator.NotEquals;
2874
+ }
2875
+
2876
+ return new FilterCondition(createConditionString({
2877
+ attribute: attributeName,
2878
+ type: attributeType,
2879
+ comparisonOperator: comparisonOperator,
2880
+ value: newValue
2881
+ })).toString();
2882
+ }
2883
+ const createOtherHiddenCondition = (values, attributeName, attributeType) => {
2884
+ const value = values[values.length - 1];
2885
+ let hiddenCondition;
2886
+
2887
+ if (isRangeClass(value)) {
2888
+ hiddenCondition = new FilterCondition(createConditionString({
2889
+ attribute: attributeName,
2890
+ type: attributeType,
2891
+ comparisonOperator: ComparisonOperator.LessOrEquals,
2892
+ value: value.to || value.from
2893
+ })).toString();
2894
+ } else {
2895
+ const conditions = values.map(val => new FilterCondition(createConditionString({
2896
+ attribute: attributeName,
2897
+ type: attributeType,
2898
+ comparisonOperator: ComparisonOperator.Equals,
2899
+ value: val.uniqueValue
2900
+ })).toString());
2901
+ hiddenCondition = "( " + conditions.filter(Boolean).join(" " + FilterConditionOperation.OR + " ") + " )";
2902
+ }
2903
+
2904
+ return hiddenCondition;
2905
+ };
2906
+ const getMinimizedLegendValues = (attributeName, attributeType, classified, index, otherTitle) => {
2907
+ const other = {
2908
+ title: otherTitle,
2909
+ parameterValue: classified.defaultValue,
2910
+ hiddenCondition: createOtherHiddenCondition(classified.values.map(val => getClassificationValue(val.value, otherTitle, new ClassificationCondition(val.condition))), attributeName, attributeType)
2911
+ };
2912
+ const items = classified.values.map(paramValue => {
2319
2913
  const parameterValue = getParameterValue(paramValue.value);
2320
2914
  const result = {
2321
2915
  parameterValue,
@@ -2329,33 +2923,41 @@ const getMinimizedLegendValues = (attributeType, param, index) => {
2329
2923
  const to = getValueFromConditionPart(paramValue.condition, 2);
2330
2924
  result.from = from ? isNumeric(from) ? +from : formatDate(from) : null;
2331
2925
  result.to = to ? isNumeric(to) ? +to : formatDate(to) : null;
2332
- result.title = createValueTitle(paramValue, attributeType, index);
2926
+ result.title = createValueTitle$1(paramValue, attributeType, index);
2333
2927
  return result;
2334
2928
  }
2335
2929
 
2336
- result.uniqueValue = formatValue(paramValue.value);
2930
+ result.uniqueValue = formatValue$1(paramValue.value);
2337
2931
  result.title = getTitleFromCondition(paramValue.condition);
2932
+ result.hiddenCondition = createHiddenCondition(attributeName, attributeType, getClassificationValue(paramValue.value, result.title, new ClassificationCondition(paramValue.condition)));
2338
2933
  return result;
2339
2934
  });
2935
+
2936
+ if (attributeType !== AttributeType.String) {
2937
+ items.reverse();
2938
+ }
2939
+
2940
+ return [...items, other];
2340
2941
  };
2341
- const getMaximizedLegendValues = (attributeType, param, params, classified, symbol, sectionIndex, otherTitle) => {
2942
+ const getMaximizedLegendValues = (attributeName, attributeType, param, params, classified, symbol, sectionIndex, otherTitle) => {
2342
2943
  const other = {
2343
2944
  title: otherTitle,
2344
- symbol: createLegendSymbol(classified.defaultValue, param, params, symbol)
2945
+ symbol: createLegendSymbol(classified.defaultValue, param, params, symbol),
2946
+ hiddenCondition: createOtherHiddenCondition(classified.values.map(val => getClassificationValue(val.value, otherTitle, new ClassificationCondition(val.condition))), attributeName, attributeType)
2345
2947
  };
2346
2948
  const items = classified.values.map((paramValue, index) => {
2347
2949
  const result = {
2348
2950
  symbol: createLegendSymbol(classified.values[index].value, param, params, symbol)
2349
2951
  };
2350
-
2351
- if (isRangeCondition(paramValue.condition)) {
2352
- result.title = createValueTitle(paramValue, attributeType, sectionIndex);
2353
- return result;
2354
- }
2355
-
2356
- result.title = getTitleFromCondition(paramValue.condition);
2952
+ result.title = isRangeCondition(paramValue.condition) ? createValueTitle$1(paramValue, attributeType, sectionIndex) : getTitleFromCondition(paramValue.condition);
2953
+ result.hiddenCondition = createHiddenCondition(attributeName, attributeType, getClassificationValue(classified.values[index].value, result.title, new ClassificationCondition(classified.values[index].condition)));
2357
2954
  return result;
2358
2955
  });
2956
+
2957
+ if (attributeType !== AttributeType.String) {
2958
+ items.reverse();
2959
+ }
2960
+
2359
2961
  return [...items, other];
2360
2962
  };
2361
2963
  const getClassified = layerInfo => {
@@ -2491,6 +3093,16 @@ function getAttributeType(layer, attributeName) {
2491
3093
  return attribute ? attribute.type : AttributeType.Unknown;
2492
3094
  }
2493
3095
 
3096
+ const getClassificationValue = (parameterValue, title, condition) => _extends({
3097
+ parameterValue,
3098
+ title
3099
+ }, condition.isUnique() ? {
3100
+ uniqueValue: condition.uniqueValue
3101
+ } : {
3102
+ from: condition.range[0],
3103
+ to: condition.range[1]
3104
+ });
3105
+
2494
3106
  const metersToPixels = (meters, _ref) => {
2495
3107
  let {
2496
3108
  painter,
@@ -2573,6 +3185,34 @@ const PARAMETER_INFOS = {
2573
3185
 
2574
3186
  })
2575
3187
  };
3188
+ const OPERATOR_CONDITION_REMAP = {
3189
+ [ComparisonOperator.Equals]: "==",
3190
+ [ComparisonOperator.NotEquals]: "!=",
3191
+ [ComparisonOperator.GreaterThan]: ">",
3192
+ [ComparisonOperator.GreaterOrEquals]: ">=",
3193
+ [ComparisonOperator.LessThan]: "<",
3194
+ [ComparisonOperator.LessOrEquals]: "<=",
3195
+ [ComparisonOperator.Filled]: "!=",
3196
+ [ComparisonOperator.Empty]: "==",
3197
+ [ComparisonOperator.Contains]: "==",
3198
+ [ComparisonOperator.NotContains]: "!=",
3199
+ [ComparisonOperator.StartsWith]: "==",
3200
+ [ComparisonOperator.NotStartsWith]: "!=",
3201
+ [ComparisonOperator.EndsWith]: "==",
3202
+ [ComparisonOperator.NotEndsWith]: "!=",
3203
+ [ComparisonOperator.Between]: "between",
3204
+ [ComparisonOperator.Outside]: "!between"
3205
+ };
3206
+ const BASE_OPERATORS = [ComparisonOperator.Equals, ComparisonOperator.NotEquals];
3207
+ const CONTAINS_OPERATORS = [ComparisonOperator.Contains, ComparisonOperator.NotContains];
3208
+ const FILLED_OPERATORS = [ComparisonOperator.Filled, ComparisonOperator.Empty];
3209
+ const STARTS_WITH_OPERATORS = [ComparisonOperator.StartsWith, ComparisonOperator.NotStartsWith];
3210
+ const ENDS_WITH_OPERATORS = [ComparisonOperator.EndsWith, ComparisonOperator.NotEndsWith];
3211
+ const RANGE_OPERATORS = [ComparisonOperator.LessThan, ComparisonOperator.LessOrEquals, ComparisonOperator.GreaterThan, ComparisonOperator.GreaterOrEquals];
3212
+ const BETWEEN_OPERATORS = [ComparisonOperator.Between, ComparisonOperator.Outside];
3213
+ const numberComparisonOperators = [...BASE_OPERATORS, ...RANGE_OPERATORS, ...FILLED_OPERATORS, ...BETWEEN_OPERATORS];
3214
+ const dateComparisonOperators = [...BASE_OPERATORS, ...RANGE_OPERATORS, ...FILLED_OPERATORS, ...BETWEEN_OPERATORS];
3215
+ const textComparisonOperators = [...BASE_OPERATORS, ...CONTAINS_OPERATORS, ...STARTS_WITH_OPERATORS, ...ENDS_WITH_OPERATORS, ...FILLED_OPERATORS];
2576
3216
 
2577
3217
  var SvgSymbolBg;
2578
3218
 
@@ -2651,1578 +3291,1165 @@ const manipulateSvgSymbol = (SVGContainer, symbol, svg, bg) => {
2651
3291
  } else {
2652
3292
  SVGContainer.svg(innerSvg);
2653
3293
  }
2654
- } else {
2655
- const fillColor = getParameterValue(figure == null ? void 0 : figure.fillColor);
2656
- SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(" "));
2657
- SVGContainer.svg(innerSvg);
2658
- SVGContainer.find("#symbol-figure").each(item => {
2659
- item.center(DEFAULT_SYMBOL_SIZE / 2, DEFAULT_SYMBOL_SIZE / 2).fill(fillColor || DEFAULT_SYMBOL_FILL_COLOR);
2660
- });
2661
- }
2662
- }
2663
-
2664
- const rootTransform = (_$exec2 = /<svg[^>]*transform="([^"]+)"/g.exec(symbolData)) == null ? void 0 : _$exec2[1];
2665
-
2666
- if (rootTransform) {
2667
- const transformParts = rootTransform.slice(0, -1).split("(");
2668
- SVGContainer.transform({
2669
- [transformParts[0]]: transformParts[1].split(",")
2670
- });
2671
- }
2672
-
2673
- const rotatedAngle = SVGContainer.transform("rotate");
2674
-
2675
- if (rotatedAngle) {
2676
- SVGContainer.rotate(-rotatedAngle, 0, 0);
2677
- }
2678
-
2679
- if (angle !== undefined) {
2680
- SVGContainer.rotate(angle * (180 / Math.PI), 0, 0);
2681
- }
2682
-
2683
- return SVGContainer;
2684
- };
2685
-
2686
- let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
2687
- _inherits(CircleLineMiterRender, _LineMiterRender);
2688
-
2689
- var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
2690
-
2691
- function CircleLineMiterRender() {
2692
- _classCallCheck(this, CircleLineMiterRender);
2693
-
2694
- return _super.apply(this, arguments);
2695
- }
2696
-
2697
- _createClass(CircleLineMiterRender, [{
2698
- key: "usageSize",
2699
- get: function get() {
2700
- return this.miterSize + this.strokeWidth * 3;
2701
- }
2702
- }, {
2703
- key: "createRings",
2704
- value: function createRings(_ref, xMultiplier) {
2705
- let [x, y] = _ref;
2706
- return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
2707
- }
2708
- }, {
2709
- key: "createRender",
2710
- value: function createRender(miterRings) {
2711
- const isFilled = this.kind === LineMiterKind.FilledCircle;
2712
- return new PolyRender(polygonCircleFromPoint(miterRings[0][0], this.miterSize), {
2713
- fillColor: isFilled ? this.color : 'transparent',
2714
- strokeColor: this.color,
2715
- strokeWidth: this.strokeWidth,
2716
- enclosed: true
2717
- });
2718
- }
2719
- }]);
2720
-
2721
- return CircleLineMiterRender;
2722
- }(LineMiterRender);
2723
-
2724
- let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
2725
- _inherits(SquareLineMiterRender, _LineMiterRender);
2726
-
2727
- var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
2728
-
2729
- function SquareLineMiterRender() {
2730
- _classCallCheck(this, SquareLineMiterRender);
2731
-
2732
- return _super.apply(this, arguments);
2733
- }
2734
-
2735
- _createClass(SquareLineMiterRender, [{
2736
- key: "usageSize",
2737
- get: function get() {
2738
- return this.miterSize + this.strokeWidth;
2739
- }
2740
- }, {
2741
- key: "createRings",
2742
- value: function createRings(_ref, xMultiplier) {
2743
- let [x, y] = _ref;
2744
- 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]]];
2745
- }
2746
- }, {
2747
- key: "createRender",
2748
- value: function createRender(miterRings) {
2749
- const isFilled = this.kind === LineMiterKind.FilledSquare;
2750
- return new PolyRender(miterRings, {
2751
- enclosed: true,
2752
- fillColor: isFilled ? this.color : void 0,
2753
- fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
2754
- lineCap: 'square',
2755
- lineJoin: 'miter',
2756
- strokeColor: this.color,
2757
- strokeWidth: this.strokeWidth
2758
- });
2759
- }
2760
- }]);
2761
-
2762
- return SquareLineMiterRender;
2763
- }(LineMiterRender);
2764
-
2765
- const getLineMiterRender = options => {
2766
- switch (options.kind) {
2767
- case LineMiterKind.Arrow:
2768
- case LineMiterKind.FilledArrow:
2769
- return new ArrowLineMiterRender(options);
2770
-
2771
- case LineMiterKind.Square:
2772
- case LineMiterKind.FilledSquare:
2773
- return new SquareLineMiterRender(options);
2774
-
2775
- case LineMiterKind.Circle:
2776
- case LineMiterKind.FilledCircle:
2777
- return new CircleLineMiterRender(options);
2778
-
2779
- default:
2780
- return null;
2781
- }
2782
- };
2783
-
2784
- const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
2785
- const reversedRing = ring.slice().reverse();
2786
-
2787
- for (let i = 0; i < reversedRing.length; i++) {
2788
- const coordinates = reversedRing[i];
2789
-
2790
- if (isLastRing && i === 0) {
2791
- reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
2792
- }
2793
-
2794
- const nextCoordinates = reversedRing[i - 1];
2795
-
2796
- if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
2797
- reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
2798
- }
2799
- }
2800
-
2801
- return reversedRing.reverse();
2802
- };
2803
-
2804
- const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
2805
- const newRing = ring.slice();
2806
-
2807
- for (let i = 0; i < newRing.length; i++) {
2808
- const coordinates = newRing[i];
2809
-
2810
- if (i === 0 && isFirstRing) {
2811
- newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
2812
- }
2813
-
2814
- const prevCoordinates = newRing[i - 1];
2815
-
2816
- if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
2817
- newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
2818
- }
2819
- }
2820
-
2821
- return newRing;
2822
- };
2823
-
2824
- const updateRingsForMiter = (rings, position, miterSize) => {
2825
- return rings.map((ring, ringIndex) => {
2826
- switch (position) {
2827
- case 'right':
2828
- return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
2829
-
2830
- default:
2831
- return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
2832
- }
2833
- });
2834
- };
2835
-
2836
- const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
2837
- let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
2838
- _inherits(SGisPolylineSymbol, _sPolylineSymbol);
2839
-
2840
- var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
2841
-
2842
- function SGisPolylineSymbol(originalSymbol) {
2843
- var _originalSymbol$strok, _originalSymbol$strok2;
2844
-
2845
- var _this;
2846
-
2847
- _classCallCheck(this, SGisPolylineSymbol);
2848
-
2849
- _this = _super.call(this, {
2850
- // @ts-ignore
2851
- strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
2852
- strokeWidth: clamp( // @ts-ignore
2853
- getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
2854
- // @ts-ignore
2855
- lineDash: getLineDash(originalSymbol.stroke),
2856
- // @ts-ignore
2857
- lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
2858
- });
2859
- _this.originalSymbol = originalSymbol;
2860
- return _this;
2861
- }
2862
-
2863
- _createClass(SGisPolylineSymbol, [{
2864
- key: "renderFunction",
2865
- value: function renderFunction(feature, resolution, crs) {
2866
- if (!isSimplePolylineSymbol(this.originalSymbol)) return _get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, feature, resolution, crs);
2867
- const {
2868
- ending,
2869
- beginningSize,
2870
- beginning,
2871
- endingSize
2872
- } = this.originalSymbol;
2873
- const renders = [];
2874
- const featureCopy = feature.clone();
2875
- const beginningMiterRender = getLineMiterRender({
2876
- color: this.strokeColor,
2877
- // @ts-ignore
2878
- kind: beginning,
2879
- position: 'left',
2880
- // @ts-ignore
2881
- size: beginningSize,
2882
- strokeWidth: this.strokeWidth
2883
- });
2884
- const endingMiterRender = getLineMiterRender({
2885
- color: this.strokeColor,
2886
- // @ts-ignore
2887
- kind: ending,
2888
- position: 'right',
2889
- // @ts-ignore
2890
- size: endingSize,
2891
- strokeWidth: this.strokeWidth
2892
- });
2893
-
2894
- if (beginningMiterRender) {
2895
- const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
2896
- const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
2897
- featureCopy.rings = updatedRings;
2898
- renders.push(render);
2899
- }
3294
+ } else {
3295
+ const fillColor = getParameterValue(figure == null ? void 0 : figure.fillColor);
3296
+ SVGContainer.size(currentSize + "px", currentSize + "px").viewbox(viewBox.join(" "));
3297
+ SVGContainer.svg(innerSvg);
3298
+ SVGContainer.find("#symbol-figure").each(item => {
3299
+ item.center(DEFAULT_SYMBOL_SIZE / 2, DEFAULT_SYMBOL_SIZE / 2).fill(fillColor || DEFAULT_SYMBOL_FILL_COLOR);
3300
+ });
3301
+ }
3302
+ }
2900
3303
 
2901
- if (endingMiterRender) {
2902
- const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
2903
- const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
2904
- featureCopy.rings = updatedRings;
2905
- renders.push(render);
2906
- } // NOTE: линия должна быть в начале чтобы быть под митерами
3304
+ const rootTransform = (_$exec2 = /<svg[^>]*transform="([^"]+)"/g.exec(symbolData)) == null ? void 0 : _$exec2[1];
2907
3305
 
3306
+ if (rootTransform) {
3307
+ const transformParts = rootTransform.slice(0, -1).split("(");
3308
+ SVGContainer.transform({
3309
+ [transformParts[0]]: transformParts[1].split(",")
3310
+ });
3311
+ }
2908
3312
 
2909
- renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
2910
- return renders;
2911
- }
2912
- }, {
2913
- key: "clone",
2914
- value: function clone() {
2915
- return new SGisPolylineSymbol(this.originalSymbol);
2916
- }
2917
- }]);
3313
+ const rotatedAngle = SVGContainer.transform("rotate");
2918
3314
 
2919
- return SGisPolylineSymbol;
2920
- }(PolylineSymbol);
3315
+ if (rotatedAngle) {
3316
+ SVGContainer.rotate(-rotatedAngle, 0, 0);
3317
+ }
2921
3318
 
2922
- let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
2923
- _inherits(LabelSymbol, _DynamicPointSymbol);
3319
+ if (angle !== undefined) {
3320
+ SVGContainer.rotate(angle * (180 / Math.PI), 0, 0);
3321
+ }
2924
3322
 
2925
- var _super = /*#__PURE__*/_createSuper(LabelSymbol);
3323
+ return SVGContainer;
3324
+ };
2926
3325
 
2927
- function LabelSymbol(_temp) {
2928
- var _this;
3326
+ let CircleLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
3327
+ _inherits(CircleLineMiterRender, _LineMiterRender);
2929
3328
 
2930
- let {
2931
- component,
2932
- offset
2933
- } = _temp === void 0 ? {} : _temp;
3329
+ var _super = /*#__PURE__*/_createSuper(CircleLineMiterRender);
2934
3330
 
2935
- _classCallCheck(this, LabelSymbol);
3331
+ function CircleLineMiterRender() {
3332
+ _classCallCheck(this, CircleLineMiterRender);
2936
3333
 
2937
- _this = _super.call(this, {
2938
- offset
2939
- });
2940
- _this.component = component;
2941
- return _this;
3334
+ return _super.apply(this, arguments);
2942
3335
  }
2943
3336
 
2944
- _createClass(LabelSymbol, [{
2945
- key: "_getFeatureNode",
2946
- value: function _getFeatureNode(feature) {
2947
- const node = document.createElement('div');
2948
- this.renderDom(feature.content, node);
2949
- return node;
3337
+ _createClass(CircleLineMiterRender, [{
3338
+ key: "usageSize",
3339
+ get: function get() {
3340
+ return this.miterSize + this.strokeWidth * 3;
2950
3341
  }
2951
3342
  }, {
2952
- key: "_updateFeatureNode",
2953
- value: function _updateFeatureNode(feature) {
2954
- this.renderDom(feature.content, this.getNode(feature));
3343
+ key: "createRings",
3344
+ value: function createRings(_ref, xMultiplier) {
3345
+ let [x, y] = _ref;
3346
+ return [[[x + (this.miterSize / 2 + this.strokeWidth) * xMultiplier, y]]];
2955
3347
  }
2956
3348
  }, {
2957
- key: "renderDom",
2958
- value: function renderDom(content, node) {
2959
- if (!node) {
2960
- return;
2961
- }
2962
-
2963
- const Component = this.component;
2964
-
2965
- if (Component) {
2966
- ReactDOM.render(React.createElement(Component, {
2967
- content: content
2968
- }), node);
2969
- } else {
2970
- node.innerText = content;
2971
- }
2972
- }
2973
- }]);
2974
-
2975
- return LabelSymbol;
2976
- }(DynamicPointSymbol);
2977
-
2978
- const defaultOffset = [8, -16];
2979
- const createLabelSymbol = props => {
2980
- const {
2981
- offset = defaultOffset,
2982
- renderLabel = _ref => {
2983
- let {
2984
- content
2985
- } = _ref;
2986
- return React.createElement("div", null, content);
2987
- },
2988
- onClose = undefined
2989
- } = props || {};
2990
- return new LabelSymbol({
2991
- offset,
2992
- component: _ref2 => {
2993
- let {
2994
- content
2995
- } = _ref2;
2996
- return renderLabel({
2997
- content,
2998
- onClose
3349
+ key: "createRender",
3350
+ value: function createRender(miterRings) {
3351
+ const isFilled = this.kind === LineMiterKind.FilledCircle;
3352
+ return new PolyRender(polygonCircleFromPoint(miterRings[0][0], this.miterSize), {
3353
+ fillColor: isFilled ? this.color : 'transparent',
3354
+ strokeColor: this.color,
3355
+ strokeWidth: this.strokeWidth,
3356
+ enclosed: true
2999
3357
  });
3000
3358
  }
3001
- });
3002
- };
3359
+ }]);
3003
3360
 
3004
- function createShadowRender(position, _ref) {
3005
- let {
3006
- strokeWidth = 2,
3007
- shadowColor,
3008
- shadowSize,
3009
- size = 6
3010
- } = _ref;
3011
- const shadowDiameter = size + strokeWidth + shadowSize;
3012
- return new PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
3013
- fillColor: 'transparent',
3014
- strokeColor: shadowColor,
3015
- strokeWidth: shadowSize,
3016
- enclosed: true
3017
- });
3018
- }
3019
- function getEditorPointRenderer(position, _ref2) {
3020
- let {
3021
- strokeColor,
3022
- strokeWidth,
3023
- shadowColor,
3024
- fillColor,
3025
- shadowSize,
3026
- size = 0
3027
- } = _ref2;
3028
- return [createShadowRender(position, {
3029
- strokeWidth,
3030
- strokeColor,
3031
- shadowSize,
3032
- shadowColor,
3033
- size
3034
- }), new PolyRender(polygonCircleFromPoint(position, size), {
3035
- fillColor,
3036
- strokeColor,
3037
- strokeWidth,
3038
- enclosed: true
3039
- })];
3040
- }
3361
+ return CircleLineMiterRender;
3362
+ }(LineMiterRender);
3041
3363
 
3042
- let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
3043
- _inherits(ShadowedPointSymbol, _PointSymbol);
3364
+ let SquareLineMiterRender = /*#__PURE__*/function (_LineMiterRender) {
3365
+ _inherits(SquareLineMiterRender, _LineMiterRender);
3044
3366
 
3045
- var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
3367
+ var _super = /*#__PURE__*/_createSuper(SquareLineMiterRender);
3046
3368
 
3047
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3048
- function ShadowedPointSymbol(options) {
3049
- _classCallCheck(this, ShadowedPointSymbol);
3369
+ function SquareLineMiterRender() {
3370
+ _classCallCheck(this, SquareLineMiterRender);
3050
3371
 
3051
- return _super.call(this, options);
3372
+ return _super.apply(this, arguments);
3052
3373
  }
3053
3374
 
3054
- _createClass(ShadowedPointSymbol, [{
3055
- key: "renderFunction",
3056
- value: function renderFunction(feature, resolution, crs) {
3057
- if (!(feature instanceof PointFeature)) return [];
3058
- const {
3059
- position
3060
- } = feature.projectTo(crs);
3061
- const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
3062
- const shadowRender = this.getShadow(pxPosition, feature);
3063
- const pointArc = this.getPoint(pxPosition, feature);
3064
- return shadowRender ? [shadowRender, pointArc] : [pointArc];
3065
- }
3066
- }, {
3067
- key: "getShadow",
3068
- value: function getShadow(position, _feature) {
3069
- return ShadowedPointSymbol.getShadowArc(position, this);
3070
- }
3071
- }, {
3072
- key: "getPoint",
3073
- value: function getPoint(position, _feature) {
3074
- return ShadowedPointSymbol.getPointArc(position, this);
3075
- }
3076
- }], [{
3077
- key: "getShadowArc",
3078
- value: function getShadowArc(position, _ref) {
3079
- let {
3080
- strokeWidth = 2,
3081
- shadowColor,
3082
- shadowSize,
3083
- size = 6
3084
- } = _ref;
3085
- return new PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
3086
- fillColor: 'transparent',
3087
- strokeColor: shadowColor,
3088
- strokeWidth: shadowSize,
3089
- enclosed: true
3090
- });
3375
+ _createClass(SquareLineMiterRender, [{
3376
+ key: "usageSize",
3377
+ get: function get() {
3378
+ return this.miterSize + this.strokeWidth;
3091
3379
  }
3092
3380
  }, {
3093
- key: "getPointArc",
3094
- value: function getPointArc(position, _ref2) {
3095
- let {
3096
- strokeWidth,
3097
- fillColor,
3098
- strokeColor,
3099
- size = 6
3100
- } = _ref2;
3101
- return new PolyRender(polygonCircleFromPoint(position, size), {
3102
- fillColor,
3103
- strokeColor,
3104
- strokeWidth,
3105
- enclosed: true
3106
- });
3381
+ key: "createRings",
3382
+ value: function createRings(_ref, xMultiplier) {
3383
+ let [x, y] = _ref;
3384
+ 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]]];
3107
3385
  }
3108
3386
  }, {
3109
- key: "getArcs",
3110
- value: function getArcs(position, params) {
3111
- const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
3112
- const pointRender = ShadowedPointSymbol.getPointArc(position, params);
3113
- return shadowRender ? [shadowRender, pointRender] : [pointRender];
3387
+ key: "createRender",
3388
+ value: function createRender(miterRings) {
3389
+ const isFilled = this.kind === LineMiterKind.FilledSquare;
3390
+ return new PolyRender(miterRings, {
3391
+ enclosed: true,
3392
+ fillColor: isFilled ? this.color : void 0,
3393
+ fillStyle: isFilled ? FillStyle.Color : FillStyle.None,
3394
+ lineCap: 'square',
3395
+ lineJoin: 'miter',
3396
+ strokeColor: this.color,
3397
+ strokeWidth: this.strokeWidth
3398
+ });
3114
3399
  }
3115
3400
  }]);
3116
3401
 
3117
- return ShadowedPointSymbol;
3118
- }(PointSymbol);
3402
+ return SquareLineMiterRender;
3403
+ }(LineMiterRender);
3119
3404
 
3120
- let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
3121
- _inherits(ShadowedPolySymbol, _PolylineSymbol);
3405
+ const getLineMiterRender = options => {
3406
+ switch (options.kind) {
3407
+ case LineMiterKind.Arrow:
3408
+ case LineMiterKind.FilledArrow:
3409
+ return new ArrowLineMiterRender(options);
3122
3410
 
3123
- var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
3411
+ case LineMiterKind.Square:
3412
+ case LineMiterKind.FilledSquare:
3413
+ return new SquareLineMiterRender(options);
3124
3414
 
3125
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3126
- function ShadowedPolySymbol(options) {
3127
- _classCallCheck(this, ShadowedPolySymbol);
3415
+ case LineMiterKind.Circle:
3416
+ case LineMiterKind.FilledCircle:
3417
+ return new CircleLineMiterRender(options);
3128
3418
 
3129
- return _super.call(this, options);
3419
+ default:
3420
+ return null;
3130
3421
  }
3422
+ };
3131
3423
 
3132
- _createClass(ShadowedPolySymbol, [{
3133
- key: "renderFunction",
3134
- value: function renderFunction(feature, resolution, crs) {
3135
- if (!(feature instanceof Poly)) return [];
3136
-
3137
- const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
3424
+ const updateRingForRightMiter = (ring, miterSize, isLastRing) => {
3425
+ const reversedRing = ring.slice().reverse();
3138
3426
 
3139
- const polyRender = this.getPolyRender(coordinates, feature);
3140
- const shadowRender = this.getShadow(coordinates, feature);
3141
- const vertexRenders = this.getVertexRenders(coordinates);
3142
- let renders = [polyRender];
3427
+ for (let i = 0; i < reversedRing.length; i++) {
3428
+ const coordinates = reversedRing[i];
3143
3429
 
3144
- if (shadowRender) {
3145
- renders = [shadowRender, polyRender];
3146
- }
3430
+ if (isLastRing && i === 0) {
3431
+ reversedRing[i] = [coordinates[0] - miterSize, coordinates[1]];
3432
+ }
3147
3433
 
3148
- if (vertexRenders) {
3149
- renders = renders.concat(vertexRenders);
3150
- }
3434
+ const nextCoordinates = reversedRing[i - 1];
3151
3435
 
3152
- return renders;
3153
- }
3154
- }, {
3155
- key: "getShadow",
3156
- value: function getShadow(coordinates, _feature) {
3157
- return new PolyRender(coordinates, {
3158
- fillStyle: FillStyle.None,
3159
- enclosed: this.enclose,
3160
- strokeColor: this.shadowColor,
3161
- strokeWidth: this.shadowSize,
3162
- lineDash: this.lineDash
3163
- });
3164
- }
3165
- }, {
3166
- key: "getPolyRender",
3167
- value: function getPolyRender(coordinates, _feature) {
3168
- return new PolyRender(coordinates, {
3169
- fillStyle: this.enclose ? FillStyle.Color : FillStyle.None,
3170
- enclosed: this.enclose,
3171
- fillColor: this.fillColor,
3172
- strokeColor: this.strokeColor,
3173
- strokeWidth: this.strokeWidth,
3174
- lineDash: this.lineDash
3175
- });
3176
- }
3177
- }, {
3178
- key: "getVertexRenders",
3179
- value: function getVertexRenders(coordinates) {
3180
- if (!this.showVertex) return;
3181
- const vertexCoordinates = coordinates.reduce((acc, curr) => {
3182
- return acc.concat(curr);
3183
- }, []);
3184
- return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
3185
- size: 6,
3186
- strokeWidth: 2,
3187
- shadowColor: this.shadowColor,
3188
- strokeColor: this.strokeColor,
3189
- shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
3190
- fillColor: '#ffffff'
3191
- })).reduce((acc, curr) => acc.concat(curr), []);
3436
+ if (nextCoordinates && nextCoordinates[0] < coordinates[0]) {
3437
+ reversedRing[i] = [nextCoordinates[0] - Math.abs(nextCoordinates[0] - coordinates[0]), coordinates[1]];
3192
3438
  }
3193
- }]);
3439
+ }
3194
3440
 
3195
- return ShadowedPolySymbol;
3196
- }(PolylineSymbol);
3197
- const polySymbolParams = {
3198
- strokeWidth: 2,
3199
- strokeColor: '#e33600',
3200
- shadowSize: 8,
3201
- shadowColor: 'rgba(227, 54, 0, 0.3)'
3202
- };
3203
- const measureSymbolParams = {
3204
- strokeColor: '#ff6933',
3205
- shadowSize: 0,
3206
- vertexShadowSize: 0
3207
- };
3208
- const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
3209
- enclose: false,
3210
- showVertex: true
3211
- }));
3212
- const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
3213
- fillColor: 'rgba(255, 105, 51, 0.25)',
3214
- enclose: true,
3215
- showVertex: true
3216
- }));
3217
- const snapSymbolParams = {
3218
- size: 10,
3219
- strokeWidth: 2,
3220
- strokeColor: '#e33600',
3221
- fillColor: '#ffffff',
3222
- shadowColor: 'rgba(227, 54, 0, 0.3)',
3223
- shadowSize: 3
3441
+ return reversedRing.reverse();
3224
3442
  };
3225
- const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
3226
- strokeColor: '#ff6933',
3227
- shadowSize: 0
3228
- }));
3229
3443
 
3230
- let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
3231
- _inherits(SelectedPointSymbol, _ShadowedPointSymbol);
3444
+ const updateRingForLeftMiter = (ring, miterSize, isFirstRing) => {
3445
+ const newRing = ring.slice();
3232
3446
 
3233
- var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
3447
+ for (let i = 0; i < newRing.length; i++) {
3448
+ const coordinates = newRing[i];
3234
3449
 
3235
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3236
- function SelectedPointSymbol(props) {
3237
- _classCallCheck(this, SelectedPointSymbol);
3450
+ if (i === 0 && isFirstRing) {
3451
+ newRing[i] = [coordinates[0] + miterSize, coordinates[1]];
3452
+ }
3238
3453
 
3239
- return _super.call(this, props);
3240
- }
3454
+ const prevCoordinates = newRing[i - 1];
3241
3455
 
3242
- _createClass(SelectedPointSymbol, [{
3243
- key: "getShadow",
3244
- value: function getShadow(position, feature) {
3245
- if (feature.isSelected) {
3246
- return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
3247
- }
3456
+ if (prevCoordinates && prevCoordinates[0] > coordinates[0]) {
3457
+ newRing[i] = [prevCoordinates[0] + Math.abs(coordinates[0] - prevCoordinates[0]), coordinates[1]];
3248
3458
  }
3249
- }, {
3250
- key: "getPoint",
3251
- value: function getPoint(position, feature) {
3252
- const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
3459
+ }
3253
3460
 
3254
- if (feature.isSelected) {
3255
- pointRender.strokeColor = this.selectedStrokeColor;
3256
- pointRender.fillColor = this.selectedFillColor;
3257
- }
3461
+ return newRing;
3462
+ };
3258
3463
 
3259
- return pointRender;
3464
+ const updateRingsForMiter = (rings, position, miterSize) => {
3465
+ return rings.map((ring, ringIndex) => {
3466
+ switch (position) {
3467
+ case 'right':
3468
+ return updateRingForRightMiter(ring, miterSize, ringIndex === rings.length - 1);
3469
+
3470
+ default:
3471
+ return updateRingForLeftMiter(ring, miterSize, ringIndex === 0);
3260
3472
  }
3261
- }]);
3473
+ });
3474
+ };
3262
3475
 
3263
- return SelectedPointSymbol;
3264
- }(ShadowedPointSymbol);
3476
+ const copyRings = rings => rings.map(ring => ring.map(coordinates => coordinates.slice()));
3477
+ let SGisPolylineSymbol = /*#__PURE__*/function (_sPolylineSymbol) {
3478
+ _inherits(SGisPolylineSymbol, _sPolylineSymbol);
3265
3479
 
3266
- let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
3267
- _inherits(SelectedPolySymbol, _ShadowedPolySymbol);
3480
+ var _super = /*#__PURE__*/_createSuper(SGisPolylineSymbol);
3268
3481
 
3269
- var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
3482
+ function SGisPolylineSymbol(originalSymbol) {
3483
+ var _originalSymbol$strok, _originalSymbol$strok2;
3270
3484
 
3271
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3272
- function SelectedPolySymbol(props) {
3273
- _classCallCheck(this, SelectedPolySymbol);
3485
+ var _this;
3274
3486
 
3275
- return _super.call(this, props);
3487
+ _classCallCheck(this, SGisPolylineSymbol);
3488
+
3489
+ _this = _super.call(this, {
3490
+ // @ts-ignore
3491
+ strokeColor: getHexColor(getParameterValue((_originalSymbol$strok = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok.color)),
3492
+ strokeWidth: clamp( // @ts-ignore
3493
+ getParameterValue((_originalSymbol$strok2 = originalSymbol.stroke) == null ? void 0 : _originalSymbol$strok2.width), PREVIEW_LIMITS.STROKE_WIDTH_MIN, PREVIEW_LIMITS.STROKE_WIDTH_MAX),
3494
+ // @ts-ignore
3495
+ lineDash: getLineDash(originalSymbol.stroke),
3496
+ // @ts-ignore
3497
+ lineCap: isDashedBrush(originalSymbol.stroke) ? 'square' : 'round'
3498
+ });
3499
+ _this.originalSymbol = originalSymbol;
3500
+ return _this;
3276
3501
  }
3277
3502
 
3278
- _createClass(SelectedPolySymbol, [{
3279
- key: "getShadow",
3280
- value: function getShadow(coordinates, feature) {
3281
- if (feature.isSelected) {
3282
- return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
3283
- }
3284
- }
3285
- }, {
3286
- key: "getPolyRender",
3287
- value: function getPolyRender(coordinates, feature) {
3288
- const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
3503
+ _createClass(SGisPolylineSymbol, [{
3504
+ key: "renderFunction",
3505
+ value: function renderFunction(feature, resolution, crs) {
3506
+ if (!isSimplePolylineSymbol(this.originalSymbol)) return _get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, feature, resolution, crs);
3507
+ const {
3508
+ ending,
3509
+ beginningSize,
3510
+ beginning,
3511
+ endingSize
3512
+ } = this.originalSymbol;
3513
+ const renders = [];
3514
+ const featureCopy = feature.clone();
3515
+ const beginningMiterRender = getLineMiterRender({
3516
+ color: this.strokeColor,
3517
+ // @ts-ignore
3518
+ kind: beginning,
3519
+ position: 'left',
3520
+ // @ts-ignore
3521
+ size: beginningSize,
3522
+ strokeWidth: this.strokeWidth
3523
+ });
3524
+ const endingMiterRender = getLineMiterRender({
3525
+ color: this.strokeColor,
3526
+ // @ts-ignore
3527
+ kind: ending,
3528
+ position: 'right',
3529
+ // @ts-ignore
3530
+ size: endingSize,
3531
+ strokeWidth: this.strokeWidth
3532
+ });
3533
+
3534
+ if (beginningMiterRender) {
3535
+ const updatedRings = updateRingsForMiter(featureCopy.rings, 'left', beginningMiterRender.usageSize);
3536
+ const render = beginningMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
3537
+ featureCopy.rings = updatedRings;
3538
+ renders.push(render);
3539
+ }
3289
3540
 
3290
- if (feature.isSelected) {
3291
- polyRender.fillColor = this.selectedFillColor;
3292
- polyRender.strokeColor = this.selectedStrokeColor;
3541
+ if (endingMiterRender) {
3542
+ const updatedRings = updateRingsForMiter(featureCopy.rings, 'right', endingMiterRender.usageSize);
3543
+ const render = endingMiterRender.getRender(updatedRings, feature.crs, resolution, crs);
3544
+ featureCopy.rings = updatedRings;
3545
+ renders.push(render);
3546
+ } // NOTE: линия должна быть в начале чтобы быть под митерами
3293
3547
 
3294
- if (this.selectedStrokeWidth !== void 0) {
3295
- polyRender.strokeWidth = this.selectedStrokeWidth;
3296
- }
3297
- }
3298
3548
 
3299
- return polyRender;
3549
+ renders.unshift(..._get(_getPrototypeOf(SGisPolylineSymbol.prototype), "renderFunction", this).call(this, featureCopy, resolution, crs));
3550
+ return renders;
3551
+ }
3552
+ }, {
3553
+ key: "clone",
3554
+ value: function clone() {
3555
+ return new SGisPolylineSymbol(this.originalSymbol);
3300
3556
  }
3301
3557
  }]);
3302
3558
 
3303
- return SelectedPolySymbol;
3304
- }(ShadowedPolySymbol);
3305
-
3306
- const selectedPoint = /*#__PURE__*/new SelectedPointSymbol({
3307
- size: 8,
3308
- strokeWidth: 2,
3309
- strokeColor: 'rgba(255, 87, 34, 0.3)',
3310
- fillColor: 'rgba(255, 255, 255, 0.65)',
3311
- shadowColor: 'rgba(255, 87, 34, 0.3)',
3312
- shadowSize: 3,
3313
- selectedStrokeColor: '#ff5722',
3314
- selectedFillColor: 'rgba(255, 255, 255, 0.65)'
3315
- });
3316
- const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
3317
- strokeWidth: 6,
3318
- strokeColor: 'rgba(255, 87, 34, 0.2)',
3319
- shadowSize: 8,
3320
- shadowColor: 'rgba(255, 87, 34, 0.3)',
3321
- selectedStrokeColor: '#ff5722',
3322
- selectedStrokeWidth: 2
3323
- });
3324
- const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
3325
- strokeWidth: 2,
3326
- strokeColor: 'rgba(255, 87, 34, 0.3)',
3327
- shadowSize: 8,
3328
- shadowColor: 'rgba(255, 87, 34, 0.3)',
3329
- fillColor: 'rgba(255, 255, 255, 0.36)',
3330
- enclose: true,
3331
- selectedFillColor: 'rgba(255, 255, 255, 0.56)',
3332
- selectedStrokeColor: '#ff5722'
3333
- });
3559
+ return SGisPolylineSymbol;
3560
+ }(PolylineSymbol);
3334
3561
 
3335
- const defaultPathStyles = {
3336
- strokeWidth: 2,
3337
- strokeColor: 'rgb(0, 163, 245)',
3338
- fillStyle: FillStyle.None
3339
- };
3340
- let SVGPoly = /*#__PURE__*/function (_Symbol) {
3341
- _inherits(SVGPoly, _Symbol);
3562
+ let LabelSymbol = /*#__PURE__*/function (_DynamicPointSymbol) {
3563
+ _inherits(LabelSymbol, _DynamicPointSymbol);
3342
3564
 
3343
- var _super = /*#__PURE__*/_createSuper(SVGPoly);
3565
+ var _super = /*#__PURE__*/_createSuper(LabelSymbol);
3344
3566
 
3345
- function SVGPoly(_temp) {
3567
+ function LabelSymbol(_temp) {
3346
3568
  var _this;
3347
3569
 
3348
3570
  let {
3349
- redrawFeatureNode,
3350
- pathStyles,
3351
- circle,
3352
- className,
3353
- appendToSvg
3571
+ component,
3572
+ offset
3354
3573
  } = _temp === void 0 ? {} : _temp;
3355
3574
 
3356
- _classCallCheck(this, SVGPoly);
3575
+ _classCallCheck(this, LabelSymbol);
3357
3576
 
3358
- _this = _super.call(this);
3359
- _this.container = document.createElement('div');
3360
- _this.container.style.position = 'absolute';
3361
- _this.redrawFeatureNode = redrawFeatureNode;
3362
- _this.pathStyles = _extends({
3363
- center: [0, 0],
3364
- fillColor: 'none'
3365
- }, pathStyles);
3366
- _this.circle = circle;
3367
- _this.className = className;
3368
- _this.appendToSvg = appendToSvg;
3577
+ _this = _super.call(this, {
3578
+ offset
3579
+ });
3580
+ _this.component = component;
3369
3581
  return _this;
3370
3582
  }
3371
3583
 
3372
- _createClass(SVGPoly, [{
3373
- key: "renderFunction",
3374
- value: function renderFunction(feature, resolution, crs) {
3375
- const coordinates = feature instanceof Poly ? new PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
3376
- this.setCirclePxRaius(crs);
3377
- this.container.innerHTML = '';
3378
- const svg = this.setSvg(coordinates);
3379
- svg && this.container.append(svg);
3380
- feature.__dynamicSymbolRender = new DynamicRender({
3381
- node: this.container,
3382
- update: (bbox, resolution) => this.update({
3383
- bbox,
3384
- resolution,
3385
- feature,
3386
- crs
3387
- }),
3388
- redraw: () => {
3389
- this.redrawFeatureNode && this.redrawFeatureNode(feature);
3390
- }
3391
- });
3392
-
3393
- this._setEventListeners(feature);
3394
-
3395
- return [feature.__dynamicSymbolRender];
3584
+ _createClass(LabelSymbol, [{
3585
+ key: "_getFeatureNode",
3586
+ value: function _getFeatureNode(feature) {
3587
+ const node = document.createElement('div');
3588
+ this.renderDom(feature.content, node);
3589
+ return node;
3396
3590
  }
3397
3591
  }, {
3398
- key: "setCirclePxRaius",
3399
- value: function setCirclePxRaius(crs) {
3400
- if (this.circle && this.pathStyles) {
3401
- var _this$circle;
3402
-
3403
- this.pathStyles.radius = metersToPixels(this.circle.radius, {
3404
- painter: this.circle.painter,
3405
- crs
3406
- }) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
3407
- }
3592
+ key: "_updateFeatureNode",
3593
+ value: function _updateFeatureNode(feature) {
3594
+ this.renderDom(feature.content, this.getNode(feature));
3408
3595
  }
3409
3596
  }, {
3410
- key: "update",
3411
- value: function update(_ref) {
3412
- var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
3597
+ key: "renderDom",
3598
+ value: function renderDom(content, node) {
3599
+ if (!node) {
3600
+ return;
3601
+ }
3413
3602
 
3414
- let {
3415
- bbox,
3416
- resolution,
3417
- feature,
3418
- crs
3419
- } = _ref;
3420
- if (!feature) return;
3421
- if (!bbox) bbox = feature.__lastBbox;
3422
- if (!resolution) resolution = feature.__lastResolution;
3423
- if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
3603
+ const Component = this.component;
3424
3604
 
3425
- if (feature.__lastResolution && resolution !== feature.__lastResolution) {
3426
- const newCoordinates = feature instanceof Poly ? new PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
3427
- this.setCirclePxRaius(crs);
3428
- this.container.innerHTML = '';
3429
- const svg = this.setSvg(newCoordinates);
3430
- svg && this.container.append(svg);
3605
+ if (Component) {
3606
+ ReactDOM.render(React.createElement(Component, {
3607
+ content: content
3608
+ }), node);
3609
+ } else {
3610
+ node.innerText = content;
3431
3611
  }
3612
+ }
3613
+ }]);
3432
3614
 
3433
- const polygon = feature.projectTo(bbox.crs);
3434
- 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;
3435
- const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
3436
- const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
3437
- this.container.style.left = dx.toString() + "px";
3438
- this.container.style.top = dy.toString() + "px";
3439
- feature.__lastBbox = bbox;
3440
- feature.__lastResolution = resolution;
3615
+ return LabelSymbol;
3616
+ }(DynamicPointSymbol);
3617
+
3618
+ const defaultOffset = [8, -16];
3619
+ const createLabelSymbol = props => {
3620
+ const {
3621
+ offset = defaultOffset,
3622
+ renderLabel = _ref => {
3623
+ let {
3624
+ content
3625
+ } = _ref;
3626
+ return React.createElement("div", null, content);
3627
+ },
3628
+ onClose = undefined
3629
+ } = props || {};
3630
+ return new LabelSymbol({
3631
+ offset,
3632
+ component: _ref2 => {
3633
+ let {
3634
+ content
3635
+ } = _ref2;
3636
+ return renderLabel({
3637
+ content,
3638
+ onClose
3639
+ });
3441
3640
  }
3442
- }, {
3443
- key: "setSvg",
3444
- value: function setSvg(coordinates) {
3445
- const {
3446
- lineCap,
3447
- lineJoin,
3448
- miterLimit,
3449
- lineDash,
3450
- dashOffset
3451
- } = this.pathStyles || {};
3452
- const svgRender = new SvgRender(_extends({
3453
- coordinates
3454
- }, defaultPathStyles, {
3455
- appendToSvg: this.appendToSvg
3456
- }, this.pathStyles));
3641
+ });
3642
+ };
3643
+
3644
+ function createShadowRender(position, _ref) {
3645
+ let {
3646
+ strokeWidth = 2,
3647
+ shadowColor,
3648
+ shadowSize,
3649
+ size = 6
3650
+ } = _ref;
3651
+ const shadowDiameter = size + strokeWidth + shadowSize;
3652
+ return new PolyRender(polygonCircleFromPoint(position, shadowDiameter), {
3653
+ fillColor: 'transparent',
3654
+ strokeColor: shadowColor,
3655
+ strokeWidth: shadowSize,
3656
+ enclosed: true
3657
+ });
3658
+ }
3659
+ function getEditorPointRenderer(position, _ref2) {
3660
+ let {
3661
+ strokeColor,
3662
+ strokeWidth,
3663
+ shadowColor,
3664
+ fillColor,
3665
+ shadowSize,
3666
+ size = 0
3667
+ } = _ref2;
3668
+ return [createShadowRender(position, {
3669
+ strokeWidth,
3670
+ strokeColor,
3671
+ shadowSize,
3672
+ shadowColor,
3673
+ size
3674
+ }), new PolyRender(polygonCircleFromPoint(position, size), {
3675
+ fillColor,
3676
+ strokeColor,
3677
+ strokeWidth,
3678
+ enclosed: true
3679
+ })];
3680
+ }
3457
3681
 
3458
- if (this.circle) {
3459
- svgRender._setArcNode();
3460
- } else {
3461
- svgRender._setPolyNode();
3462
- }
3682
+ let ShadowedPointSymbol = /*#__PURE__*/function (_PointSymbol) {
3683
+ _inherits(ShadowedPointSymbol, _PointSymbol);
3463
3684
 
3464
- let svgElement;
3465
- svgRender.getNode((_, svg) => {
3466
- svgElement = svg;
3467
- this.className && svgElement.classList.add(this.className);
3468
- const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
3685
+ var _super = /*#__PURE__*/_createSuper(ShadowedPointSymbol);
3469
3686
 
3470
- if (path) {
3471
- path.setAttribute('stroke-linecap', lineCap || 'round');
3472
- path.setAttribute('stroke-linejoin', lineJoin || 'round');
3473
- path.setAttribute('stroke-miterlimit', (miterLimit || 10).toString());
3474
- path.setAttribute('stroke-dashoffset', (dashOffset || 0).toString());
3687
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3688
+ function ShadowedPointSymbol(options) {
3689
+ _classCallCheck(this, ShadowedPointSymbol);
3475
3690
 
3476
- if (this.circle) {
3477
- path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
3478
- }
3479
- }
3691
+ return _super.call(this, options);
3692
+ }
3693
+
3694
+ _createClass(ShadowedPointSymbol, [{
3695
+ key: "renderFunction",
3696
+ value: function renderFunction(feature, resolution, crs) {
3697
+ if (!(feature instanceof PointFeature)) return [];
3698
+ const {
3699
+ position
3700
+ } = feature.projectTo(crs);
3701
+ const pxPosition = [position[0] / resolution + (this.offset[0] || 0), -position[1] / resolution + (this.offset[1] || 0)];
3702
+ const shadowRender = this.getShadow(pxPosition, feature);
3703
+ const pointArc = this.getPoint(pxPosition, feature);
3704
+ return shadowRender ? [shadowRender, pointArc] : [pointArc];
3705
+ }
3706
+ }, {
3707
+ key: "getShadow",
3708
+ value: function getShadow(position, _feature) {
3709
+ return ShadowedPointSymbol.getShadowArc(position, this);
3710
+ }
3711
+ }, {
3712
+ key: "getPoint",
3713
+ value: function getPoint(position, _feature) {
3714
+ return ShadowedPointSymbol.getPointArc(position, this);
3715
+ }
3716
+ }], [{
3717
+ key: "getShadowArc",
3718
+ value: function getShadowArc(position, _ref) {
3719
+ let {
3720
+ strokeWidth = 2,
3721
+ shadowColor,
3722
+ shadowSize,
3723
+ size = 6
3724
+ } = _ref;
3725
+ return new PolyRender(polygonCircleFromPoint(position, size + strokeWidth + shadowSize), {
3726
+ fillColor: 'transparent',
3727
+ strokeColor: shadowColor,
3728
+ strokeWidth: shadowSize,
3729
+ enclosed: true
3480
3730
  });
3481
- return svgElement;
3482
3731
  }
3483
3732
  }, {
3484
- key: "_setEventListeners",
3485
- value: function _setEventListeners(dynamicFeature) {
3486
- var _dynamicFeature$__dyn;
3487
-
3488
- if (dynamicFeature.eventFlags === MouseEventFlags.None) return;
3489
- const svgNode = dynamicFeature == null ? void 0 : (_dynamicFeature$__dyn = dynamicFeature.__dynamicSymbolRender) == null ? void 0 : _dynamicFeature$__dyn.node.querySelector(this.circle ? 'circle' : 'path');
3490
- Object.keys(mouseEvents).forEach(eventName => {
3491
- if (dynamicFeature.eventFlags & mouseEvents[eventName].flag) {
3492
- listenDomEvent(svgNode, mouseEvents[eventName].type, event => {
3493
- dynamicFeature.fire(mouseEvents[eventName].type, {
3494
- node: svgNode,
3495
- browserEvent: event
3496
- });
3497
- });
3498
- }
3733
+ key: "getPointArc",
3734
+ value: function getPointArc(position, _ref2) {
3735
+ let {
3736
+ strokeWidth,
3737
+ fillColor,
3738
+ strokeColor,
3739
+ size = 6
3740
+ } = _ref2;
3741
+ return new PolyRender(polygonCircleFromPoint(position, size), {
3742
+ fillColor,
3743
+ strokeColor,
3744
+ strokeWidth,
3745
+ enclosed: true
3499
3746
  });
3500
3747
  }
3748
+ }, {
3749
+ key: "getArcs",
3750
+ value: function getArcs(position, params) {
3751
+ const shadowRender = ShadowedPointSymbol.getShadowArc(position, params);
3752
+ const pointRender = ShadowedPointSymbol.getPointArc(position, params);
3753
+ return shadowRender ? [shadowRender, pointRender] : [pointRender];
3754
+ }
3501
3755
  }]);
3502
3756
 
3503
- return SVGPoly;
3504
- }(Symbol$1);
3505
-
3506
- function isSGisPointSymbol(symbol) {
3507
- return symbol instanceof PointSymbol || symbol instanceof StaticImageSymbol || symbol instanceof SquareSymbol || symbol instanceof MaskedImage;
3508
- }
3509
- function isSGisImageSymbol(symbol) {
3510
- return symbol instanceof StaticImageSymbol || symbol instanceof MaskedImage;
3511
- }
3512
- function isSGisPolygonSymbol(symbol) {
3513
- return symbol instanceof PolygonSymbol || symbol instanceof BrushFill || symbol instanceof ImageFill;
3514
- }
3515
- function isSGisPolylineSymbol(symbol) {
3516
- return symbol instanceof PolylineSymbol;
3517
- }
3518
- function isSGisH3Symbol(symbol) {
3519
- return symbol instanceof H3Symbol;
3520
- }
3521
- function isSGisClusterSymbol(symbol) {
3522
- return !!symbol.singleObjectSymbol;
3523
- }
3757
+ return ShadowedPointSymbol;
3758
+ }(PointSymbol);
3524
3759
 
3525
- /**
3526
- * Моки фич для отображения превью символа
3527
- * http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
3528
- */
3760
+ let ShadowedPolySymbol = /*#__PURE__*/function (_PolylineSymbol) {
3761
+ _inherits(ShadowedPolySymbol, _PolylineSymbol);
3529
3762
 
3530
- const viewBoxSize = 100;
3531
- const pointFeature = /*#__PURE__*/new PointFeature([50, -50], {
3532
- crs: plain
3533
- });
3534
- const lineFeature = /*#__PURE__*/new Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
3535
- crs: plain
3536
- });
3537
- const polygonFeature = /*#__PURE__*/new Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
3538
- crs: plain
3539
- });
3540
- const h3gridFeature = /*#__PURE__*/new H3Feature([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
3541
- crs: plain
3542
- });
3543
- const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
3544
- crs: plain
3545
- });
3546
- const polygonLegendFeature = /*#__PURE__*/new Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
3547
- crs: plain
3548
- });
3549
- const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
3550
- crs: plain
3551
- });
3552
- const MAP_LEGEND_FEATURES = {
3553
- polygon: polygonMapLegendFeature
3554
- };
3555
- const LEGEND_FEATURES = {
3556
- point: pointFeature,
3557
- polyline: lineLegendFeature,
3558
- polygon: polygonLegendFeature,
3559
- h3grid: h3gridFeature
3560
- };
3561
- const MOCK_FEATURES = {
3562
- point: pointFeature,
3563
- polyline: lineFeature,
3564
- polygon: polygonFeature,
3565
- h3grid: h3gridFeature
3566
- };
3763
+ var _super = /*#__PURE__*/_createSuper(ShadowedPolySymbol);
3567
3764
 
3568
- function getSymbolRenders(symbol, size, features) {
3569
- if (size === void 0) {
3570
- size = viewBoxSize;
3571
- }
3765
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3766
+ function ShadowedPolySymbol(options) {
3767
+ _classCallCheck(this, ShadowedPolySymbol);
3572
3768
 
3573
- if (features === void 0) {
3574
- features = {};
3769
+ return _super.call(this, options);
3575
3770
  }
3576
3771
 
3577
- const resolution = viewBoxSize / size;
3578
-
3579
- const featuresToRender = _extends({}, MOCK_FEATURES, features);
3772
+ _createClass(ShadowedPolySymbol, [{
3773
+ key: "renderFunction",
3774
+ value: function renderFunction(feature, resolution, crs) {
3775
+ if (!(feature instanceof Poly)) return [];
3580
3776
 
3581
- if (isSGisPolygonSymbol(symbol)) {
3582
- return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, plain);
3583
- }
3777
+ const coordinates = _get(_getPrototypeOf(ShadowedPolySymbol.prototype), "getRenderedCoordinates", this).call(this, feature, resolution, crs);
3584
3778
 
3585
- if (isSGisPolylineSymbol(symbol)) {
3586
- return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, plain);
3587
- }
3779
+ const polyRender = this.getPolyRender(coordinates, feature);
3780
+ const shadowRender = this.getShadow(coordinates, feature);
3781
+ const vertexRenders = this.getVertexRenders(coordinates);
3782
+ let renders = [polyRender];
3588
3783
 
3589
- if (isSGisH3Symbol(symbol)) {
3590
- return symbol.renderFunctionAsync(featuresToRender.h3grid, resolution, plain);
3591
- }
3784
+ if (shadowRender) {
3785
+ renders = [shadowRender, polyRender];
3786
+ }
3592
3787
 
3593
- return symbol.renderFunctionAsync(featuresToRender.point, resolution, plain);
3594
- }
3595
- const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
3596
- if (size === void 0) {
3597
- size = viewBoxSize;
3598
- }
3788
+ if (vertexRenders) {
3789
+ renders = renders.concat(vertexRenders);
3790
+ }
3599
3791
 
3600
- return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
3601
- };
3602
- const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
3603
- if (size === void 0) {
3604
- size = viewBoxSize;
3605
- }
3792
+ return renders;
3793
+ }
3794
+ }, {
3795
+ key: "getShadow",
3796
+ value: function getShadow(coordinates, _feature) {
3797
+ return new PolyRender(coordinates, {
3798
+ fillStyle: FillStyle.None,
3799
+ enclosed: this.enclose,
3800
+ strokeColor: this.shadowColor,
3801
+ strokeWidth: this.shadowSize,
3802
+ lineDash: this.lineDash
3803
+ });
3804
+ }
3805
+ }, {
3806
+ key: "getPolyRender",
3807
+ value: function getPolyRender(coordinates, _feature) {
3808
+ return new PolyRender(coordinates, {
3809
+ fillStyle: this.enclose ? FillStyle.Color : FillStyle.None,
3810
+ enclosed: this.enclose,
3811
+ fillColor: this.fillColor,
3812
+ strokeColor: this.strokeColor,
3813
+ strokeWidth: this.strokeWidth,
3814
+ lineDash: this.lineDash
3815
+ });
3816
+ }
3817
+ }, {
3818
+ key: "getVertexRenders",
3819
+ value: function getVertexRenders(coordinates) {
3820
+ if (!this.showVertex) return;
3821
+ const vertexCoordinates = coordinates.reduce((acc, curr) => {
3822
+ return acc.concat(curr);
3823
+ }, []);
3824
+ return vertexCoordinates.map(coord => getEditorPointRenderer(coord, {
3825
+ size: 6,
3826
+ strokeWidth: 2,
3827
+ shadowColor: this.shadowColor,
3828
+ strokeColor: this.strokeColor,
3829
+ shadowSize: this.vertexShadowSize !== undefined ? this.vertexShadowSize : 2,
3830
+ fillColor: '#ffffff'
3831
+ })).reduce((acc, curr) => acc.concat(curr), []);
3832
+ }
3833
+ }]);
3606
3834
 
3607
- return getSymbolRenders(symbol, size, LEGEND_FEATURES);
3835
+ return ShadowedPolySymbol;
3836
+ }(PolylineSymbol);
3837
+ const polySymbolParams = {
3838
+ strokeWidth: 2,
3839
+ strokeColor: '#e33600',
3840
+ shadowSize: 8,
3841
+ shadowColor: 'rgba(227, 54, 0, 0.3)'
3608
3842
  };
3843
+ const measureSymbolParams = {
3844
+ strokeColor: '#ff6933',
3845
+ shadowSize: 0,
3846
+ vertexShadowSize: 0
3847
+ };
3848
+ const measureLengthSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
3849
+ enclose: false,
3850
+ showVertex: true
3851
+ }));
3852
+ const measureAreaSymbol = /*#__PURE__*/new ShadowedPolySymbol( /*#__PURE__*/_extends({}, polySymbolParams, measureSymbolParams, {
3853
+ fillColor: 'rgba(255, 105, 51, 0.25)',
3854
+ enclose: true,
3855
+ showVertex: true
3856
+ }));
3857
+ const snapSymbolParams = {
3858
+ size: 10,
3859
+ strokeWidth: 2,
3860
+ strokeColor: '#e33600',
3861
+ fillColor: '#ffffff',
3862
+ shadowColor: 'rgba(227, 54, 0, 0.3)',
3863
+ shadowSize: 3
3864
+ };
3865
+ const measurePolygonSnapSymbol = /*#__PURE__*/new ShadowedPointSymbol( /*#__PURE__*/_extends({}, snapSymbolParams, {
3866
+ strokeColor: '#ff6933',
3867
+ shadowSize: 0
3868
+ }));
3609
3869
 
3610
- function renderSymbolToCanvas(renders, canvas) {
3611
- renders.forEach(render => {
3612
- canvas.draw(render);
3613
- });
3614
- }
3615
-
3616
- function deserializeSymbol(symbol) {
3617
- switch (symbol.type) {
3618
- case "h3grid":
3619
- return deserializeH3Symbol(symbol);
3620
-
3621
- case "svgPointSymbol":
3622
- return deserializeSvgPointSymbol(symbol);
3623
-
3624
- case 'circlePointSymbol':
3625
- return deserializePointSymbol(symbol);
3626
-
3627
- case 'squarePointSymbol':
3628
- return deserializeSquareSymbol(symbol);
3629
-
3630
- case 'maskedImagePointSymbol':
3631
- return deserializeMaskedImageSymbol(symbol);
3870
+ let SelectedPointSymbol = /*#__PURE__*/function (_ShadowedPointSymbol) {
3871
+ _inherits(SelectedPointSymbol, _ShadowedPointSymbol);
3632
3872
 
3633
- case 'imagePointSymbol':
3634
- return deserializeImagePointSymbol(symbol);
3873
+ var _super = /*#__PURE__*/_createSuper(SelectedPointSymbol);
3635
3874
 
3636
- case 'polygonSymbol':
3637
- return deserializePolygonSymbol(symbol);
3875
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3876
+ function SelectedPointSymbol(props) {
3877
+ _classCallCheck(this, SelectedPointSymbol);
3638
3878
 
3639
- case 'simplePolylineSymbol':
3640
- case 'polylineSymbol':
3641
- return deserializePolylineSymbol(symbol);
3879
+ return _super.call(this, props);
3880
+ }
3642
3881
 
3643
- case "clusterSymbol":
3644
- return deserializeSymbol(symbol.singleObjectSymbol);
3882
+ _createClass(SelectedPointSymbol, [{
3883
+ key: "getShadow",
3884
+ value: function getShadow(position, feature) {
3885
+ if (feature.isSelected) {
3886
+ return _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getShadow", this).call(this, position, feature);
3887
+ }
3888
+ }
3889
+ }, {
3890
+ key: "getPoint",
3891
+ value: function getPoint(position, feature) {
3892
+ const pointRender = _get(_getPrototypeOf(SelectedPointSymbol.prototype), "getPoint", this).call(this, position, feature);
3645
3893
 
3646
- default:
3647
- return null;
3648
- }
3649
- }
3894
+ if (feature.isSelected) {
3895
+ pointRender.strokeColor = this.selectedStrokeColor;
3896
+ pointRender.fillColor = this.selectedFillColor;
3897
+ }
3650
3898
 
3651
- function deserializeH3Symbol(symbol) {
3652
- var _symbol$stroke, _symbol$stroke2, _symbol$fill;
3899
+ return pointRender;
3900
+ }
3901
+ }]);
3653
3902
 
3654
- return new H3Symbol(_extends({}, symbol, {
3655
- cellSize: getParameterValue(symbol.cellSize),
3656
- strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
3657
- strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
3658
- fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
3659
- }));
3660
- }
3903
+ return SelectedPointSymbol;
3904
+ }(ShadowedPointSymbol);
3661
3905
 
3662
- function deserializePointSymbol(symbol) {
3663
- // @ts-ignore
3664
- return new PointSymbol(deserializePointSymbolParams(symbol));
3665
- }
3906
+ let SelectedPolySymbol = /*#__PURE__*/function (_ShadowedPolySymbol) {
3907
+ _inherits(SelectedPolySymbol, _ShadowedPolySymbol);
3666
3908
 
3667
- const getOffsetParameterValue = offset => [getParameterValue(offset == null ? void 0 : offset[0]), getParameterValue(offset == null ? void 0 : offset[1])];
3909
+ var _super = /*#__PURE__*/_createSuper(SelectedPolySymbol);
3668
3910
 
3669
- function deserializeSvgPointSymbolParams(_ref) {
3670
- let {
3671
- type,
3672
- data,
3673
- size,
3674
- offset,
3675
- angle,
3676
- background,
3677
- figure
3678
- } = _ref;
3679
- return _extends({
3680
- type: getParameterValue(type),
3681
- data: getParameterValue(data),
3682
- size: getParameterValue(size),
3683
- offset: getOffsetParameterValue(offset),
3684
- angle: getParameterValue(angle)
3685
- }, background ? {
3686
- background: _extends({}, background, {
3687
- fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
3688
- strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
3689
- strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
3690
- })
3691
- } : {}, figure ? {
3692
- figure: _extends({}, figure, {
3693
- fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
3694
- })
3695
- } : {});
3696
- }
3911
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
3912
+ function SelectedPolySymbol(props) {
3913
+ _classCallCheck(this, SelectedPolySymbol);
3697
3914
 
3698
- function deserializeSvgPointSymbol(symbol) {
3699
- return new PointSymbol(deserializeSvgPointSymbolParams(symbol));
3700
- }
3915
+ return _super.call(this, props);
3916
+ }
3701
3917
 
3702
- function deserializeSquareSymbol(symbol) {
3703
- return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
3704
- // @ts-ignore
3705
- angle: getParameterValue(symbol.angle)
3706
- }));
3707
- }
3918
+ _createClass(SelectedPolySymbol, [{
3919
+ key: "getShadow",
3920
+ value: function getShadow(coordinates, feature) {
3921
+ if (feature.isSelected) {
3922
+ return _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getShadow", this).call(this, coordinates, feature);
3923
+ }
3924
+ }
3925
+ }, {
3926
+ key: "getPolyRender",
3927
+ value: function getPolyRender(coordinates, feature) {
3928
+ const polyRender = _get(_getPrototypeOf(SelectedPolySymbol.prototype), "getPolyRender", this).call(this, coordinates, feature);
3708
3929
 
3709
- function deserializeMaskedImageSymbol(symbol) {
3710
- return new MaskedImage(_extends({}, symbol, {
3711
- // @ts-ignore
3712
- angle: getParameterValue(symbol.angle),
3713
- // @ts-ignore
3714
- width: getParameterValue(symbol.width),
3715
- // @ts-ignore
3716
- height: getParameterValue(symbol.height),
3717
- // @ts-ignore
3718
- anchorPoint: deserializeAnchor(symbol.offset),
3719
- // @ts-ignore
3720
- imageSource: deserializeBase64(symbol.image),
3721
- // @ts-ignore
3722
- maskSource: deserializeBase64(symbol.imageMask),
3723
- // @ts-ignore
3724
- maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
3725
- }));
3726
- }
3930
+ if (feature.isSelected) {
3931
+ polyRender.fillColor = this.selectedFillColor;
3932
+ polyRender.strokeColor = this.selectedStrokeColor;
3727
3933
 
3728
- function deserializeImagePointSymbol(symbol) {
3729
- return new StaticImageSymbol(_extends({}, symbol, {
3730
- // @ts-ignore
3731
- angle: getParameterValue(symbol.angle),
3732
- // @ts-ignore
3733
- width: getParameterValue(symbol.width),
3734
- // @ts-ignore
3735
- height: getParameterValue(symbol.height),
3736
- // @ts-ignore
3737
- anchorPoint: deserializeAnchor(symbol.offset),
3738
- // @ts-ignore
3739
- source: deserializeBase64(symbol.image)
3740
- }));
3741
- }
3934
+ if (this.selectedStrokeWidth !== void 0) {
3935
+ polyRender.strokeWidth = this.selectedStrokeWidth;
3936
+ }
3937
+ }
3742
3938
 
3743
- function deserializePolygonSymbol(symbol) {
3744
- if (isPolygonHasPatternBrush(symbol)) {
3745
- return new SGisImageFill(symbol);
3746
- }
3939
+ return polyRender;
3940
+ }
3941
+ }]);
3747
3942
 
3748
- if (isPolygonHasHatchBrush(symbol)) {
3749
- return new SGisBrushFill(symbol);
3750
- }
3943
+ return SelectedPolySymbol;
3944
+ }(ShadowedPolySymbol);
3751
3945
 
3752
- return new SGisPolygonSymbol(symbol);
3753
- }
3946
+ const selectedPoint = /*#__PURE__*/new SelectedPointSymbol({
3947
+ size: 8,
3948
+ strokeWidth: 2,
3949
+ strokeColor: 'rgba(255, 87, 34, 0.3)',
3950
+ fillColor: 'rgba(255, 255, 255, 0.65)',
3951
+ shadowColor: 'rgba(255, 87, 34, 0.3)',
3952
+ shadowSize: 3,
3953
+ selectedStrokeColor: '#ff5722',
3954
+ selectedFillColor: 'rgba(255, 255, 255, 0.65)'
3955
+ });
3956
+ const selectedPolyline = /*#__PURE__*/new SelectedPolySymbol({
3957
+ strokeWidth: 6,
3958
+ strokeColor: 'rgba(255, 87, 34, 0.2)',
3959
+ shadowSize: 8,
3960
+ shadowColor: 'rgba(255, 87, 34, 0.3)',
3961
+ selectedStrokeColor: '#ff5722',
3962
+ selectedStrokeWidth: 2
3963
+ });
3964
+ const selectedPolygon = /*#__PURE__*/new SelectedPolySymbol({
3965
+ strokeWidth: 2,
3966
+ strokeColor: 'rgba(255, 87, 34, 0.3)',
3967
+ shadowSize: 8,
3968
+ shadowColor: 'rgba(255, 87, 34, 0.3)',
3969
+ fillColor: 'rgba(255, 255, 255, 0.36)',
3970
+ enclose: true,
3971
+ selectedFillColor: 'rgba(255, 255, 255, 0.56)',
3972
+ selectedStrokeColor: '#ff5722'
3973
+ });
3754
3974
 
3755
- function deserializePolylineSymbol(symbol) {
3756
- return new SGisPolylineSymbol(symbol);
3757
- }
3975
+ const defaultPathStyles = {
3976
+ strokeWidth: 2,
3977
+ strokeColor: 'rgb(0, 163, 245)',
3978
+ fillStyle: FillStyle.None
3979
+ };
3980
+ let SVGPoly = /*#__PURE__*/function (_Symbol) {
3981
+ _inherits(SVGPoly, _Symbol);
3758
3982
 
3759
- function deserializePointSymbolParams(_ref2) {
3760
- let {
3761
- size,
3762
- offset,
3763
- strokeColor,
3764
- strokeWidth,
3765
- fillColor
3766
- } = _ref2;
3767
- return {
3768
- size: getParameterValue(size),
3769
- offset: deserializeAnchor(offset),
3770
- strokeWidth: getParameterValue(strokeWidth),
3771
- strokeColor: deserializeColor(getParameterValue(strokeColor)),
3772
- fillColor: deserializeColor(getParameterValue(fillColor))
3773
- };
3774
- }
3983
+ var _super = /*#__PURE__*/_createSuper(SVGPoly);
3775
3984
 
3776
- function deserializeBase64(base) {
3777
- return "data:image/png;base64," + base;
3778
- }
3985
+ function SVGPoly(_temp) {
3986
+ var _this;
3779
3987
 
3780
- function deserializeAnchor(offset) {
3781
- // @ts-ignore
3782
- return offset.map(getParameterValue);
3783
- }
3988
+ let {
3989
+ redrawFeatureNode,
3990
+ pathStyles,
3991
+ circle,
3992
+ className,
3993
+ appendToSvg
3994
+ } = _temp === void 0 ? {} : _temp;
3784
3995
 
3785
- function deserializeColor(color) {
3786
- return color ? new Color(color).toString() : null;
3787
- }
3996
+ _classCallCheck(this, SVGPoly);
3788
3997
 
3789
- const clampSymbol = (symbol, min, max) => {
3790
- if (isSGisImageSymbol(symbol)) {
3791
- symbol.width = clamp(symbol.width, min, max);
3792
- symbol.height = clamp(symbol.height, min, max);
3793
- } else if (isSGisPointSymbol(symbol)) {
3794
- symbol.size = clamp(symbol.size, min, max);
3998
+ _this = _super.call(this);
3999
+ _this.container = document.createElement('div');
4000
+ _this.container.style.position = 'absolute';
4001
+ _this.redrawFeatureNode = redrawFeatureNode;
4002
+ _this.pathStyles = _extends({
4003
+ center: [0, 0],
4004
+ fillColor: 'none'
4005
+ }, pathStyles);
4006
+ _this.circle = circle;
4007
+ _this.className = className;
4008
+ _this.appendToSvg = appendToSvg;
4009
+ return _this;
3795
4010
  }
3796
4011
 
3797
- return symbol;
3798
- };
3799
- function centerAlignSymbol(symbol) {
3800
- if (isSGisImageSymbol(symbol)) {
3801
- symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
3802
- } else if (isSGisPointSymbol(symbol)) {
3803
- symbol.offset = [0, 0];
3804
- }
4012
+ _createClass(SVGPoly, [{
4013
+ key: "renderFunction",
4014
+ value: function renderFunction(feature, resolution, crs) {
4015
+ const coordinates = feature instanceof Poly ? new PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
4016
+ this.setCirclePxRaius(crs);
4017
+ this.container.innerHTML = '';
4018
+ const svg = this.setSvg(coordinates);
4019
+ svg && this.container.append(svg);
4020
+ feature.__dynamicSymbolRender = new DynamicRender({
4021
+ node: this.container,
4022
+ update: (bbox, resolution) => this.update({
4023
+ bbox,
4024
+ resolution,
4025
+ feature,
4026
+ crs
4027
+ }),
4028
+ redraw: () => {
4029
+ this.redrawFeatureNode && this.redrawFeatureNode(feature);
4030
+ }
4031
+ });
3805
4032
 
3806
- return symbol;
3807
- }
3808
- const adjustSymbol = (symbol, _ref) => {
3809
- let {
3810
- size
3811
- } = _ref;
3812
- return centerAlignSymbol(clampSymbol(symbol, 0, size));
3813
- };
4033
+ this._setEventListeners(feature);
3814
4034
 
3815
- let EvergisFeature = /*#__PURE__*/function () {
3816
- function EvergisFeature(feature) {
3817
- _classCallCheck(this, EvergisFeature);
4035
+ return [feature.__dynamicSymbolRender];
4036
+ }
4037
+ }, {
4038
+ key: "setCirclePxRaius",
4039
+ value: function setCirclePxRaius(crs) {
4040
+ if (this.circle && this.pathStyles) {
4041
+ var _this$circle;
3818
4042
 
3819
- this.id = null;
3820
- this.displayName = null;
3821
- this.geometry = null;
3822
- this.layerName = null;
3823
- this.layerAlias = null;
3824
- this.attributes = null;
3825
- this.symbol = null;
3826
- this.id = feature.id;
3827
- this.displayName = feature.id;
3828
- this.geometry = feature.geometry;
3829
- this.layerName = feature.layer;
3830
- this.layerAlias = feature.layer;
3831
- this.attributes = getFeatureAttributes(feature.attributes);
3832
- }
4043
+ this.pathStyles.radius = metersToPixels(this.circle.radius, {
4044
+ painter: this.circle.painter,
4045
+ crs
4046
+ }) + (((_this$circle = this.circle) == null ? void 0 : _this$circle.pxOffset) || 0);
4047
+ }
4048
+ }
4049
+ }, {
4050
+ key: "update",
4051
+ value: function update(_ref) {
4052
+ var _this$pathStyles, _this$pathStyles2, _this$pathStyles3, _this$pathStyles4;
3833
4053
 
3834
- _createClass(EvergisFeature, [{
3835
- key: "sGisFeature",
3836
- value: function sGisFeature() {
3837
- if (!this.geometry || !this.symbol) {
3838
- return null;
3839
- } // @ts-ignore
4054
+ let {
4055
+ bbox,
4056
+ resolution,
4057
+ feature,
4058
+ crs
4059
+ } = _ref;
4060
+ if (!feature) return;
4061
+ if (!bbox) bbox = feature.__lastBbox;
4062
+ if (!resolution) resolution = feature.__lastResolution;
4063
+ if (!bbox || !resolution || !feature.crs.canProjectTo(bbox.crs)) return;
3840
4064
 
4065
+ if (feature.__lastResolution && resolution !== feature.__lastResolution) {
4066
+ const newCoordinates = feature instanceof Poly ? new PolylineSymbol().getRenderedCoordinates(feature, resolution, crs) : feature.centroid;
4067
+ this.setCirclePxRaius(crs);
4068
+ this.container.innerHTML = '';
4069
+ const svg = this.setSvg(newCoordinates);
4070
+ svg && this.container.append(svg);
4071
+ }
3841
4072
 
4073
+ const polygon = feature.projectTo(bbox.crs);
4074
+ 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;
4075
+ const dx = Math.round((polygon.bbox.xMin - bbox.xMin) / resolution) - radiusOffset;
4076
+ const dy = Math.round((bbox.yMax - polygon.bbox.yMax) / resolution) - radiusOffset;
4077
+ this.container.style.left = dx.toString() + "px";
4078
+ this.container.style.top = dy.toString() + "px";
4079
+ feature.__lastBbox = bbox;
4080
+ feature.__lastResolution = resolution;
4081
+ }
4082
+ }, {
4083
+ key: "setSvg",
4084
+ value: function setSvg(coordinates) {
3842
4085
  const {
3843
- type,
3844
- coordinates,
3845
- sr
3846
- } = this.geometry;
3847
- const crs = CRS_MAP[sr];
4086
+ lineCap,
4087
+ lineJoin,
4088
+ miterLimit,
4089
+ lineDash,
4090
+ dashOffset
4091
+ } = this.pathStyles || {};
4092
+ const svgRender = new SvgRender(_extends({
4093
+ coordinates
4094
+ }, defaultPathStyles, {
4095
+ appendToSvg: this.appendToSvg
4096
+ }, this.pathStyles));
3848
4097
 
3849
- if (!crs) {
3850
- return null;
4098
+ if (this.circle) {
4099
+ svgRender._setArcNode();
4100
+ } else {
4101
+ svgRender._setPolyNode();
3851
4102
  }
3852
4103
 
3853
- switch (type) {
3854
- case GeometryType.Point:
3855
- return new PointFeature(coordinates, {
3856
- symbol: selectedPoint,
3857
- crs
3858
- });
3859
-
3860
- case GeometryType.Multipoint:
3861
- return new MultiPoint(coordinates, {
3862
- symbol: selectedPoint,
3863
- crs
3864
- });
3865
-
3866
- case GeometryType.Polyline:
3867
- return new Polyline(coordinates, {
3868
- symbol: selectedPolyline,
3869
- crs
3870
- });
4104
+ let svgElement;
4105
+ svgRender.getNode((_, svg) => {
4106
+ svgElement = svg;
4107
+ this.className && svgElement.classList.add(this.className);
4108
+ const path = svgElement && svgElement.querySelector(this.circle ? 'circle' : 'path');
3871
4109
 
3872
- case GeometryType.Polygon:
3873
- return new Polygon(coordinates, {
3874
- symbol: selectedPolygon,
3875
- crs
3876
- });
4110
+ if (path) {
4111
+ path.setAttribute('stroke-linecap', lineCap || 'round');
4112
+ path.setAttribute('stroke-linejoin', lineJoin || 'round');
4113
+ path.setAttribute('stroke-miterlimit', (miterLimit || 10).toString());
4114
+ path.setAttribute('stroke-dashoffset', (dashOffset || 0).toString());
3877
4115
 
3878
- default:
3879
- return null;
3880
- }
4116
+ if (this.circle) {
4117
+ path.setAttribute('stroke-dasharray', lineDash && lineDash.length > 0 ? lineDash.join(',') : '');
4118
+ }
4119
+ }
4120
+ });
4121
+ return svgElement;
3881
4122
  }
3882
4123
  }, {
3883
- key: "extent",
3884
- value: function extent() {
3885
- const feature = this.sGisFeature();
3886
- return feature && feature.bbox;
3887
- }
3888
- }]);
3889
-
3890
- return EvergisFeature;
3891
- }();
3892
-
3893
- function evaluateCondition(condition, attributes) {
3894
- try {
3895
- const evaluator = new ConditionEvaluator(attributes);
3896
- const result = evaluator.evaluate(condition);
4124
+ key: "_setEventListeners",
4125
+ value: function _setEventListeners(dynamicFeature) {
4126
+ var _dynamicFeature$__dyn;
3897
4127
 
3898
- if (result instanceof Error) {
3899
- return null;
4128
+ if (dynamicFeature.eventFlags === MouseEventFlags.None) return;
4129
+ const svgNode = dynamicFeature == null ? void 0 : (_dynamicFeature$__dyn = dynamicFeature.__dynamicSymbolRender) == null ? void 0 : _dynamicFeature$__dyn.node.querySelector(this.circle ? 'circle' : 'path');
4130
+ Object.keys(mouseEvents).forEach(eventName => {
4131
+ if (dynamicFeature.eventFlags & mouseEvents[eventName].flag) {
4132
+ listenDomEvent(svgNode, mouseEvents[eventName].type, event => {
4133
+ dynamicFeature.fire(mouseEvents[eventName].type, {
4134
+ node: svgNode,
4135
+ browserEvent: event
4136
+ });
4137
+ });
4138
+ }
4139
+ });
3900
4140
  }
4141
+ }]);
3901
4142
 
3902
- return result;
3903
- } catch (_unused) {
3904
- return null;
3905
- }
3906
- }
4143
+ return SVGPoly;
4144
+ }(Symbol$1);
3907
4145
 
3908
- function getAttributeValue(attributes, attributeName) {
3909
- const attributeMeta = attributes.find(_ref => {
3910
- let {
3911
- name
3912
- } = _ref;
3913
- return name === attributeName;
3914
- });
3915
- return attributeMeta ? attributeMeta.value : null;
4146
+ function isSGisPointSymbol(symbol) {
4147
+ return symbol instanceof PointSymbol || symbol instanceof StaticImageSymbol || symbol instanceof SquareSymbol || symbol instanceof MaskedImage;
3916
4148
  }
3917
-
3918
- const getAttributeNameFromCondition = condition => new ClassificationCondition(condition).attributeName;
3919
- const getAttributeNameFromClassified = values => values.length > 0 ? getAttributeNameFromCondition(values[0].condition) : null;
3920
-
3921
- function findFeatureValue(parameterValues, _ref2) {
3922
- let [name, value] = _ref2;
3923
- return value !== null ? parameterValues.find(_ref3 => {
3924
- let {
3925
- condition
3926
- } = _ref3;
3927
- return value !== undefined && evaluateCondition(condition, {
3928
- [name]: value
3929
- });
3930
- }) : null;
4149
+ function isSGisImageSymbol(symbol) {
4150
+ return symbol instanceof StaticImageSymbol || symbol instanceof MaskedImage;
3931
4151
  }
3932
-
3933
- function extractValuesAttribute(parameterValues, attributes) {
3934
- const name = getAttributeNameFromClassified(parameterValues) || '';
3935
- const value = name && getAttributeValue(attributes, name);
3936
- return [name, value];
4152
+ function isSGisPolygonSymbol(symbol) {
4153
+ return symbol instanceof PolygonSymbol || symbol instanceof BrushFill || symbol instanceof ImageFill;
4154
+ }
4155
+ function isSGisPolylineSymbol(symbol) {
4156
+ return symbol instanceof PolylineSymbol;
4157
+ }
4158
+ function isSGisH3Symbol(symbol) {
4159
+ return symbol instanceof H3Symbol;
4160
+ }
4161
+ function isSGisClusterSymbol(symbol) {
4162
+ return !!symbol.singleObjectSymbol;
3937
4163
  }
3938
4164
 
3939
- function evaluateFeatureSymbol(attributes) {
3940
- // @ts-ignore
3941
- function calc(result, _ref4) {
3942
- let [parameterName, parameterValue] = _ref4;
3943
- let newParameterValue;
4165
+ /**
4166
+ * Моки фич для отображения превью символа
4167
+ * http://cf.everpoint.ru/pages/viewpage.action?pageId=45024217
4168
+ */
3944
4169
 
3945
- if (isParameterByAttribute(parameterValue)) {
3946
- const [attributeName, attributeValue] = extractValuesAttribute(parameterValue.values, attributes);
3947
- const featureValue = findFeatureValue(parameterValue.values, [attributeName, attributeValue]);
3948
- newParameterValue = featureValue ? featureValue.value : parameterValue.defaultValue;
3949
- } else if (isObject(parameterValue)) {
3950
- // @ts-ignore
3951
- newParameterValue = Object.entries(parameterValue).reduce(calc, parameterValue);
3952
- }
4170
+ const viewBoxSize = 100;
4171
+ const pointFeature = /*#__PURE__*/new PointFeature([50, -50], {
4172
+ crs: plain
4173
+ });
4174
+ const lineFeature = /*#__PURE__*/new Polyline([[0, -57], [26, -57], [40, -35], [60, -65], [74, -43], [100, -43]], {
4175
+ crs: plain
4176
+ });
4177
+ const polygonFeature = /*#__PURE__*/new Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
4178
+ crs: plain
4179
+ });
4180
+ const h3gridFeature = /*#__PURE__*/new H3Feature([[50, -15], [80, -33], [80, -67], [50, -85], [20, -67], [20, -33], [50, -15]], {
4181
+ crs: plain
4182
+ });
4183
+ const lineLegendFeature = /*#__PURE__*/new Polyline([[0, -50], [100, -50]], {
4184
+ crs: plain
4185
+ });
4186
+ const polygonLegendFeature = /*#__PURE__*/new Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
4187
+ crs: plain
4188
+ });
4189
+ const polygonMapLegendFeature = /*#__PURE__*/new Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
4190
+ crs: plain
4191
+ });
4192
+ const MAP_LEGEND_FEATURES = {
4193
+ polygon: polygonMapLegendFeature
4194
+ };
4195
+ const LEGEND_FEATURES = {
4196
+ point: pointFeature,
4197
+ polyline: lineLegendFeature,
4198
+ polygon: polygonLegendFeature,
4199
+ h3grid: h3gridFeature
4200
+ };
4201
+ const MOCK_FEATURES = {
4202
+ point: pointFeature,
4203
+ polyline: lineFeature,
4204
+ polygon: polygonFeature,
4205
+ h3grid: h3gridFeature
4206
+ };
3953
4207
 
3954
- return newParameterValue !== undefined ? _extends({}, result, {
3955
- [parameterName]: newParameterValue
3956
- }) : result;
4208
+ function getSymbolRenders(symbol, size, features) {
4209
+ if (size === void 0) {
4210
+ size = viewBoxSize;
3957
4211
  }
3958
4212
 
3959
- return calc;
3960
- }
4213
+ if (features === void 0) {
4214
+ features = {};
4215
+ }
3961
4216
 
3962
- function findChildFeatureStyle(childStyles, attributes) {
3963
- return (childStyles || []).find(_ref5 => {
3964
- let {
3965
- condition
3966
- } = _ref5;
3967
- const attributeName = condition && getAttributeNameFromCondition(condition);
3968
- const attributeValue = attributeName && getAttributeValue(attributes, attributeName);
4217
+ const resolution = viewBoxSize / size;
3969
4218
 
3970
- if (condition && attributeName && attributeValue !== undefined) {
3971
- return evaluateCondition(condition, {
3972
- [attributeName]: attributeValue
3973
- });
3974
- }
4219
+ const featuresToRender = _extends({}, MOCK_FEATURES, features);
3975
4220
 
3976
- return false;
3977
- }) || null;
3978
- }
3979
- function findChildFeatureSymbol(childStyles, attributes) {
3980
- const featureStyle = findChildFeatureStyle(childStyles, attributes);
3981
- return featureStyle ? featureStyle.symbol : null;
4221
+ if (isSGisPolygonSymbol(symbol)) {
4222
+ return symbol.renderFunctionAsync(featuresToRender.polygon, resolution, plain);
4223
+ }
4224
+
4225
+ if (isSGisPolylineSymbol(symbol)) {
4226
+ return symbol.renderFunctionAsync(featuresToRender.polyline, resolution, plain);
4227
+ }
4228
+
4229
+ if (isSGisH3Symbol(symbol)) {
4230
+ return symbol.renderFunctionAsync(featuresToRender.h3grid, resolution, plain);
4231
+ }
4232
+
4233
+ return symbol.renderFunctionAsync(featuresToRender.point, resolution, plain);
3982
4234
  }
3983
- function getFeatureSymbol(style, attributes) {
3984
- if (!style || !style.symbol) {
3985
- return null;
4235
+ const getMapLegendSymbolRenders = function getMapLegendSymbolRenders(symbol, size) {
4236
+ if (size === void 0) {
4237
+ size = viewBoxSize;
3986
4238
  }
3987
4239
 
3988
- if (style.children !== null) {
3989
- return findChildFeatureSymbol(style.children, attributes) || style.symbol;
4240
+ return getSymbolRenders(symbol, size, MAP_LEGEND_FEATURES);
4241
+ };
4242
+ const getLegendSymbolRenders = function getLegendSymbolRenders(symbol, size) {
4243
+ if (size === void 0) {
4244
+ size = viewBoxSize;
3990
4245
  }
3991
4246
 
3992
- return Object.entries(style.symbol).reduce(evaluateFeatureSymbol(attributes), style.symbol);
4247
+ return getSymbolRenders(symbol, size, LEGEND_FEATURES);
4248
+ };
4249
+
4250
+ function renderSymbolToCanvas(renders, canvas) {
4251
+ renders.forEach(render => {
4252
+ canvas.draw(render);
4253
+ });
3993
4254
  }
3994
4255
 
3995
- let EvergisLayer = /*#__PURE__*/function () {
3996
- function EvergisLayer(service) {
3997
- _classCallCheck(this, EvergisLayer);
4256
+ function deserializeSymbol(symbol) {
4257
+ switch (symbol.type) {
4258
+ case "h3grid":
4259
+ return deserializeH3Symbol(symbol);
3998
4260
 
3999
- this.name = null;
4000
- this.titleAttribute = null;
4001
- this.alias = null;
4002
- this.attributes = null;
4003
- this.style = null;
4004
- const evergisService = service;
4005
- const {
4006
- name,
4007
- alias,
4008
- style,
4009
- layerDefinition
4010
- } = evergisService;
4011
- this.name = name;
4012
- this.alias = alias || name;
4013
- this.attributes = getLayerAttributes(layerDefinition);
4014
- this.style = style && new EvergisStyle(style) || null;
4015
- this.titleAttribute = layerDefinition && layerDefinition.titleAttribute || null;
4016
- }
4261
+ case "svgPointSymbol":
4262
+ return deserializeSvgPointSymbol(symbol);
4017
4263
 
4018
- _createClass(EvergisLayer, [{
4019
- key: "evaluateFeature",
4020
- value: function evaluateFeature(feature) {
4021
- feature.attributes = mergeAttributes(feature.attributes || [], this.attributes || []);
4022
- feature.symbol = this.style && getFeatureSymbol(this.style, feature.attributes);
4023
- feature.layerAlias = this.alias;
4024
- const titleAttribute = (feature.attributes || []).find(_ref => {
4025
- let {
4026
- name
4027
- } = _ref;
4028
- return name === this.titleAttribute;
4029
- });
4030
- const displayName = titleAttribute && formatAttributeValue(titleAttribute)[0].value || feature.id;
4031
- feature.displayName = displayName ? "" + displayName : feature.id;
4032
- return feature;
4033
- }
4034
- }]);
4264
+ case 'circlePointSymbol':
4265
+ return deserializePointSymbol(symbol);
4035
4266
 
4036
- return EvergisLayer;
4037
- }();
4267
+ case 'squarePointSymbol':
4268
+ return deserializeSquareSymbol(symbol);
4038
4269
 
4039
- const findFeatureLayer = feature => layer => layer.name === feature.layerName;
4270
+ case 'maskedImagePointSymbol':
4271
+ return deserializeMaskedImageSymbol(symbol);
4040
4272
 
4041
- const evaluateFeature = layers => feature => {
4042
- const featureLayer = layers.find(findFeatureLayer(feature));
4043
- return featureLayer ? featureLayer.evaluateFeature(feature) : feature;
4044
- };
4273
+ case 'imagePointSymbol':
4274
+ return deserializeImagePointSymbol(symbol);
4045
4275
 
4046
- const OTHERS_TITLE = 'Другое';
4047
- const createLegendItem = _ref => {
4048
- let {
4049
- attributes,
4050
- renderTitle,
4051
- skipDefaultValue,
4052
- reverse
4053
- } = _ref;
4054
- return classification => {
4055
- const {
4056
- defaultTitle,
4057
- defaultValue,
4058
- values,
4059
- attribute: attributeName,
4060
- parameter
4061
- } = classification;
4062
- const attribute = attributeName && attributes ? getClassificationAttribute(attributeName, attributes) : undefined;
4063
- const defaultLegendValue = {
4064
- title: defaultTitle || OTHERS_TITLE,
4065
- parameterValue: defaultValue
4066
- };
4067
- const legendValues = values.map((value, index) => ({
4068
- title: renderTitle && renderTitle(_extends({}, value, {
4069
- attribute
4070
- }), index),
4071
- parameterValue: value.parameterValue
4072
- }));
4073
- const withDefault = skipDefaultValue ? legendValues : [...legendValues, defaultLegendValue];
4074
- const reversedValues = reverse ? [...withDefault].reverse() : withDefault;
4075
- return {
4076
- title: attribute && attribute.alias || attributeName,
4077
- attribute,
4078
- parameter,
4079
- values: reversedValues
4080
- };
4081
- };
4082
- };
4276
+ case 'polygonSymbol':
4277
+ return deserializePolygonSymbol(symbol);
4278
+
4279
+ case 'simplePolylineSymbol':
4280
+ case 'polylineSymbol':
4281
+ return deserializePolylineSymbol(symbol);
4282
+
4283
+ case "clusterSymbol":
4284
+ return deserializeSymbol(symbol.singleObjectSymbol);
4285
+
4286
+ default:
4287
+ return null;
4288
+ }
4289
+ }
4083
4290
 
4084
- function isValidParameter(parameter) {
4085
- return !(parameter != null && parameter.includes("labelSymbol")) && !(parameter != null && parameter.includes("singleObjectSymbol"));
4291
+ function deserializeH3Symbol(symbol) {
4292
+ var _symbol$stroke, _symbol$stroke2, _symbol$fill;
4293
+
4294
+ return new H3Symbol(_extends({}, symbol, {
4295
+ cellSize: getParameterValue(symbol.cellSize),
4296
+ strokeWidth: getParameterValue(symbol == null ? void 0 : (_symbol$stroke = symbol.stroke) == null ? void 0 : _symbol$stroke.width),
4297
+ strokeColor: getParameterValue(symbol == null ? void 0 : (_symbol$stroke2 = symbol.stroke) == null ? void 0 : _symbol$stroke2.color),
4298
+ fillColor: getParameterValue(symbol == null ? void 0 : (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color)
4299
+ }));
4086
4300
  }
4087
4301
 
4088
- function createStyleLegend(style, config) {
4089
- const {
4090
- classificationManager,
4091
- symbol
4092
- } = style;
4093
- const items = classificationManager.filter(_ref => {
4094
- let {
4095
- parameter
4096
- } = _ref;
4097
- return config.parameters && parameter ? config.parameters.includes(parameter) : isValidParameter(parameter);
4098
- });
4302
+ function deserializePointSymbol(symbol) {
4303
+ // @ts-ignore
4304
+ return new PointSymbol(deserializePointSymbolParams(symbol));
4305
+ }
4099
4306
 
4100
- if (!items.length) {
4101
- return null;
4102
- }
4307
+ const getOffsetParameterValue = offset => [getParameterValue(offset == null ? void 0 : offset[0]), getParameterValue(offset == null ? void 0 : offset[1])];
4103
4308
 
4104
- return {
4105
- symbol: unClassify(symbol.singleObjectSymbol || symbol),
4106
- items: items.map(createLegendItem(config))
4107
- };
4309
+ function deserializeSvgPointSymbolParams(_ref) {
4310
+ let {
4311
+ type,
4312
+ data,
4313
+ size,
4314
+ offset,
4315
+ angle,
4316
+ background,
4317
+ figure
4318
+ } = _ref;
4319
+ return _extends({
4320
+ type: getParameterValue(type),
4321
+ data: getParameterValue(data),
4322
+ size: getParameterValue(size),
4323
+ offset: getOffsetParameterValue(offset),
4324
+ angle: getParameterValue(angle)
4325
+ }, background ? {
4326
+ background: _extends({}, background, {
4327
+ fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
4328
+ strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
4329
+ strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
4330
+ })
4331
+ } : {}, figure ? {
4332
+ figure: _extends({}, figure, {
4333
+ fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
4334
+ })
4335
+ } : {});
4108
4336
  }
4109
4337
 
4110
- function createValueTitle$1(value, index) {
4111
- if (value.title) return value.title;
4112
- if (isRangeClass(value)) return printRangeClass(value, index);
4113
- if (isUniqueClass(value)) return value.uniqueValue;
4114
- return '';
4338
+ function deserializeSvgPointSymbol(symbol) {
4339
+ return new PointSymbol(deserializeSvgPointSymbolParams(symbol));
4115
4340
  }
4116
4341
 
4117
- function formatArea(num) {
4118
- let result = num;
4119
- let measure = 'м²';
4342
+ function deserializeSquareSymbol(symbol) {
4343
+ return new SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
4344
+ // @ts-ignore
4345
+ angle: getParameterValue(symbol.angle)
4346
+ }));
4347
+ }
4120
4348
 
4121
- if (num >= 10000000) {
4122
- result = num / 1000000;
4123
- measure = 'км²';
4124
- } else if (num >= 10000) {
4125
- result = num / 10000;
4126
- measure = 'га';
4127
- }
4349
+ function deserializeMaskedImageSymbol(symbol) {
4350
+ return new MaskedImage(_extends({}, symbol, {
4351
+ // @ts-ignore
4352
+ angle: getParameterValue(symbol.angle),
4353
+ // @ts-ignore
4354
+ width: getParameterValue(symbol.width),
4355
+ // @ts-ignore
4356
+ height: getParameterValue(symbol.height),
4357
+ // @ts-ignore
4358
+ anchorPoint: deserializeAnchor(symbol.offset),
4359
+ // @ts-ignore
4360
+ imageSource: deserializeBase64(symbol.image),
4361
+ // @ts-ignore
4362
+ maskSource: deserializeBase64(symbol.imageMask),
4363
+ // @ts-ignore
4364
+ maskColor: deserializeColor(getParameterValue(symbol.maskedColor))
4365
+ }));
4366
+ }
4128
4367
 
4129
- return numberWithSpaces(result) + " " + measure;
4368
+ function deserializeImagePointSymbol(symbol) {
4369
+ return new StaticImageSymbol(_extends({}, symbol, {
4370
+ // @ts-ignore
4371
+ angle: getParameterValue(symbol.angle),
4372
+ // @ts-ignore
4373
+ width: getParameterValue(symbol.width),
4374
+ // @ts-ignore
4375
+ height: getParameterValue(symbol.height),
4376
+ // @ts-ignore
4377
+ anchorPoint: deserializeAnchor(symbol.offset),
4378
+ // @ts-ignore
4379
+ source: deserializeBase64(symbol.image)
4380
+ }));
4130
4381
  }
4131
- function formatLength(num) {
4132
- let result = num;
4133
- let measure = 'м';
4134
4382
 
4135
- if (num > 10000) {
4136
- result = num / 1000;
4137
- measure = 'км';
4383
+ function deserializePolygonSymbol(symbol) {
4384
+ if (isPolygonHasPatternBrush(symbol)) {
4385
+ return new SGisImageFill(symbol);
4138
4386
  }
4139
4387
 
4140
- return numberWithSpaces(result) + " " + measure;
4141
- }
4142
- function formatPolygonMeasure(area, perimiter) {
4143
- return "S : " + formatArea(area) + " P : " + formatLength(perimiter);
4144
- }
4145
- function isPolylineLikePolygon(rings, resolution) {
4146
- if (rings[0].length <= 3) {
4147
- return false;
4388
+ if (isPolygonHasHatchBrush(symbol)) {
4389
+ return new SGisBrushFill(symbol);
4148
4390
  }
4149
4391
 
4150
- const coords = rings[0];
4151
- const firstPoint = coords[0];
4152
- const lastPoint = coords[coords.length - 1];
4153
- const distance = resolution * 2;
4154
- return softEquals(firstPoint[0], lastPoint[0], distance) && softEquals(firstPoint[1], lastPoint[1], distance);
4392
+ return new SGisPolygonSymbol(symbol);
4155
4393
  }
4156
4394
 
4157
- function getScale(scale) {
4158
- const scales = [1, 2, 5];
4159
-
4160
- for (let x = 0; x < 21; x++) {
4161
- for (let y = 0; y < scales.length; y++) {
4162
- const result = Math.pow(10, x) * scales[y];
4163
-
4164
- if (result > scale) {
4165
- return result;
4166
- }
4167
- }
4168
- }
4395
+ function deserializePolylineSymbol(symbol) {
4396
+ return new SGisPolylineSymbol(symbol);
4397
+ }
4169
4398
 
4170
- return 1;
4399
+ function deserializePointSymbolParams(_ref2) {
4400
+ let {
4401
+ size,
4402
+ offset,
4403
+ strokeColor,
4404
+ strokeWidth,
4405
+ fillColor
4406
+ } = _ref2;
4407
+ return {
4408
+ size: getParameterValue(size),
4409
+ offset: deserializeAnchor(offset),
4410
+ strokeWidth: getParameterValue(strokeWidth),
4411
+ strokeColor: deserializeColor(getParameterValue(strokeColor)),
4412
+ fillColor: deserializeColor(getParameterValue(fillColor))
4413
+ };
4171
4414
  }
4172
4415
 
4173
- const useLegend = (style, config) => useMemo(() => {
4174
- if (!style || !(config && config.attributes)) return null;
4175
- return createStyleLegend(style, config);
4176
- }, [style, config]);
4416
+ function deserializeBase64(base) {
4417
+ return "data:image/png;base64," + base;
4418
+ }
4177
4419
 
4178
- const DEFAULT_LEGEND_CONFIG = {
4179
- renderTitle: createValueTitle$1
4180
- };
4181
- const useLayerLegend = (layer, config) => {
4182
- const {
4183
- style,
4184
- layerDefinition
4185
- } = layer || {};
4186
- const {
4187
- attributes
4188
- } = layerDefinition || {};
4189
- const styleProxy = style && new EvergisStyle(style);
4190
- return useLegend(styleProxy, _extends({
4191
- attributes: attributes
4192
- }, DEFAULT_LEGEND_CONFIG, config));
4193
- };
4420
+ function deserializeAnchor(offset) {
4421
+ // @ts-ignore
4422
+ return offset.map(getParameterValue);
4423
+ }
4194
4424
 
4195
- const useMapLegend = (layer, config) => {
4196
- const legend = useLayerLegend(layer, config);
4425
+ function deserializeColor(color) {
4426
+ return color ? new Color(color).toString() : null;
4427
+ }
4197
4428
 
4198
- if (!legend) {
4199
- return null;
4429
+ const clampSymbol = (symbol, min, max) => {
4430
+ if (isSGisImageSymbol(symbol)) {
4431
+ symbol.width = clamp(symbol.width, min, max);
4432
+ symbol.height = clamp(symbol.height, min, max);
4433
+ } else if (isSGisPointSymbol(symbol)) {
4434
+ symbol.size = clamp(symbol.size, min, max);
4200
4435
  }
4201
4436
 
4202
- return {
4203
- symbol: legend.symbol,
4204
- items: legend.items
4205
- };
4437
+ return symbol;
4206
4438
  };
4439
+ function centerAlignSymbol(symbol) {
4440
+ if (isSGisImageSymbol(symbol)) {
4441
+ symbol.anchorPoint = [symbol.width / 2, symbol.height / 2];
4442
+ } else if (isSGisPointSymbol(symbol)) {
4443
+ symbol.offset = [0, 0];
4444
+ }
4207
4445
 
4208
- const LEGEND_SYMBOL_MAX_SIZE = 32;
4209
- const useLegendValueSymbol = _ref => {
4446
+ return symbol;
4447
+ }
4448
+ const adjustSymbol = (symbol, _ref) => {
4210
4449
  let {
4211
- parameter,
4212
- parameterValue
4450
+ size
4213
4451
  } = _ref;
4214
- const symbol = useLegendContext();
4215
- const valueSymbol = // @ts-ignore
4216
- symbol && applyParameterValue(symbol, parameter, parameterValue);
4217
- let sGisSymbol = null;
4218
-
4219
- try {
4220
- sGisSymbol = valueSymbol && deserializeSymbol(valueSymbol);
4221
- } catch (e) {}
4222
-
4223
- return sGisSymbol && adjustSymbol(sGisSymbol, {
4224
- size: LEGEND_SYMBOL_MAX_SIZE - 1
4225
- });
4452
+ return centerAlignSymbol(clampSymbol(symbol, 0, size));
4226
4453
  };
4227
4454
 
4228
4455
  const DEFAULT_SYMBOL_SIZE$1 = 26;
@@ -5131,6 +5358,12 @@ const useToggle = initial => {
5131
5358
  return [state, toggle, setState];
5132
5359
  };
5133
5360
 
5361
+ function useNode() {
5362
+ const [node, onSetNode] = useState(null);
5363
+ const ref = useCallback(onSetNode, [onSetNode]);
5364
+ return [ref, node];
5365
+ }
5366
+
5134
5367
  const Symbol = _ref => {
5135
5368
  let {
5136
5369
  symbol,
@@ -5578,7 +5811,7 @@ const Fullscreen = () => {
5578
5811
  }));
5579
5812
  };
5580
5813
 
5581
- var _templateObject$4, _templateObject2$4, _templateObject3$3, _templateObject4$3, _templateObject5$3, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12$1, _templateObject13$1, _templateObject14$1, _templateObject15$1, _templateObject16$1, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34;
5814
+ var _templateObject$4, _templateObject2$4, _templateObject3$3, _templateObject4$3, _templateObject5$3, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12$1, _templateObject13$1, _templateObject14$1, _templateObject15$1, _templateObject16$1, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36;
5582
5815
  const MapLegendDescription = /*#__PURE__*/styled.div(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
5583
5816
  const ItemText = /*#__PURE__*/styled.div(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: calc(100% - 2rem);\n font: ", ";\n"])), _ref => {
5584
5817
  let {
@@ -5590,7 +5823,7 @@ const ItemText = /*#__PURE__*/styled.div(_templateObject2$4 || (_templateObject2
5590
5823
  });
5591
5824
  const ItemSeparator = /*#__PURE__*/styled.div(_templateObject3$3 || (_templateObject3$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n :after {\n content: \"-\";\n margin: 0 0.5rem;\n font-size: 0.75rem;\n }\n"])));
5592
5825
  const SymbolContainer = /*#__PURE__*/styled("span")(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n min-width: 16px;\n margin-right: 0.5rem;\n"])));
5593
- const ClassifiedItem = /*#__PURE__*/styled.div(_templateObject5$3 || (_templateObject5$3 = /*#__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"])), _ref2 => {
5826
+ const ClassifiedItem = /*#__PURE__*/styled.div(_templateObject5$3 || (_templateObject5$3 = /*#__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"])), _ref2 => {
5594
5827
  let {
5595
5828
  isClusterFillColor
5596
5829
  } = _ref2;
@@ -5629,16 +5862,33 @@ const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject8$2 || (
5629
5862
  const MapLegendContainer = /*#__PURE__*/styled.div(_templateObject9$1 || (_templateObject9$1 = /*#__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"])));
5630
5863
  const MapLegendHeader = /*#__PURE__*/styled.div(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: bold;\n"])));
5631
5864
  const MapLegendDescriptionContainer = /*#__PURE__*/styled.div(_templateObject11$1 || (_templateObject11$1 = /*#__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"])));
5632
- const MinimizedLegendContainer = /*#__PURE__*/styled.div(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: calc(100% - 1.5rem);\n padding-right: 1.5rem;\n"])));
5633
- const MapLegendSectionContainer = /*#__PURE__*/styled.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n \n :not(:last-child) {\n margin-bottom: 1rem;\n }\n"])));
5634
- const MapLegendValueDescr = /*#__PURE__*/styled.div(_templateObject14$1 || (_templateObject14$1 = /*#__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"])));
5865
+ const MaximizedLegendContainer = /*#__PURE__*/styled.div(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: ", ";\n top: 0;\n opacity: ", ";\n overflow: hidden;\n transition: opacity 0.5s;\n"])), _ref8 => {
5866
+ let {
5867
+ isShown
5868
+ } = _ref8;
5869
+ return isShown ? "relative" : "absolute";
5870
+ }, _ref9 => {
5871
+ let {
5872
+ isShown
5873
+ } = _ref9;
5874
+ return isShown ? 1 : 0;
5875
+ });
5876
+ const MinimizedLegendContainer = /*#__PURE__*/styled(MaximizedLegendContainer)(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: calc(100% - 1.5rem);\n padding-right: 1.5rem;\n"])));
5877
+ const MapLegendSectionContainer = /*#__PURE__*/styled.div(_templateObject14$1 || (_templateObject14$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n \n :not(:last-child) {\n margin-bottom: 1rem;\n }\n"])));
5878
+ const MapLegendSectionItems = /*#__PURE__*/styled.div(_templateObject15$1 || (_templateObject15$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n height: ", "px;\n overflow: hidden;\n transition: height 0.5s;\n"])), _ref10 => {
5879
+ let {
5880
+ height
5881
+ } = _ref10;
5882
+ return height;
5883
+ });
5884
+ const MapLegendValueDescr = /*#__PURE__*/styled.div(_templateObject16$1 || (_templateObject16$1 = /*#__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"])));
5635
5885
 
5636
5886
  const SizeLegendItemMixin = function SizeLegendItemMixin(value) {
5637
5887
  if (value === void 0) {
5638
5888
  value = 0;
5639
5889
  }
5640
5890
 
5641
- return css(_templateObject15$1 || (_templateObject15$1 = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 50%;\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);
5891
+ return css(_templateObject17 || (_templateObject17 = _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);
5642
5892
  };
5643
5893
 
5644
5894
  const StrokeWidthLegendItemMixin = function StrokeWidthLegendItemMixin(value) {
@@ -5646,79 +5896,79 @@ const StrokeWidthLegendItemMixin = function StrokeWidthLegendItemMixin(value) {
5646
5896
  value = 0;
5647
5897
  }
5648
5898
 
5649
- return css(_templateObject16$1 || (_templateObject16$1 = _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, :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));
5899
+ return css(_templateObject18 || (_templateObject18 = _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, :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));
5650
5900
  };
5651
5901
 
5652
- const StrokeColorLegendItemMixin = /*#__PURE__*/css(_templateObject17 || (_templateObject17 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-right: 0.5rem;\n width: 1.5rem;\n"])));
5653
- const MapLegendItem = /*#__PURE__*/styled.div(_templateObject18 || (_templateObject18 = /*#__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"])), _ref8 => {
5902
+ const StrokeColorLegendItemMixin = /*#__PURE__*/css(_templateObject19 || (_templateObject19 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-right: 0.5rem;\n width: 1.5rem;\n"])));
5903
+ const MapLegendItem = /*#__PURE__*/styled.div(_templateObject20 || (_templateObject20 = /*#__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"])), _ref11 => {
5654
5904
  let {
5655
5905
  parameter
5656
- } = _ref8;
5906
+ } = _ref11;
5657
5907
  return isParameterType(["strokeColor", "stroke.color"], parameter) ? 0.25 : 1;
5658
- }, _ref9 => {
5908
+ }, _ref12 => {
5659
5909
  let {
5660
5910
  value
5661
- } = _ref9;
5911
+ } = _ref12;
5662
5912
  return typeof value === "number" ? "none" : value;
5663
- }, _ref10 => {
5913
+ }, _ref13 => {
5664
5914
  let {
5665
5915
  isHidden
5666
- } = _ref10;
5916
+ } = _ref13;
5667
5917
  return isHidden ? 0.28 : 1;
5668
- }, _ref11 => {
5918
+ }, _ref14 => {
5669
5919
  let {
5670
5920
  value,
5671
5921
  parameter
5672
- } = _ref11;
5922
+ } = _ref14;
5673
5923
  return isParameterType("size", parameter) && SizeLegendItemMixin(value);
5674
- }, _ref12 => {
5924
+ }, _ref15 => {
5675
5925
  let {
5676
5926
  value,
5677
5927
  parameter
5678
- } = _ref12;
5928
+ } = _ref15;
5679
5929
  return isParameterType(["strokeWidth", "stroke.width"], parameter) && StrokeWidthLegendItemMixin(value);
5680
5930
  });
5681
- const MapLegendOther = /*#__PURE__*/styled(MapLegendItem)(_templateObject19 || (_templateObject19 = /*#__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"])));
5682
- const SizeLegendItemsMixin = /*#__PURE__*/css(_templateObject20 || (_templateObject20 = /*#__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);
5683
- const StrokeWidthLegendItemsMixin = /*#__PURE__*/css(_templateObject21 || (_templateObject21 = /*#__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);
5684
- const SizeMinimizedLegend = /*#__PURE__*/styled.div(_templateObject22 || (_templateObject22 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n margin: 0.5rem 0 0.25rem;\n"])));
5685
- const SizeMinimizedLegendSymbol = /*#__PURE__*/styled.div(_templateObject23 || (_templateObject23 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n"])));
5686
- const SizeMinimizedLegendLabel = /*#__PURE__*/styled.div(_templateObject24 || (_templateObject24 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
5687
- const SizeMinimizedLegendDown = /*#__PURE__*/styled.div(_templateObject25 || (_templateObject25 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: rgba(48, 69, 79, 0.65);\n"])));
5688
- const SizeMinimizedLegendUp = /*#__PURE__*/styled(SizeMinimizedLegendDown)(_templateObject26 || (_templateObject26 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
5689
- const SingleSizeLegendItemsMixin = /*#__PURE__*/css(_templateObject27 || (_templateObject27 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n\n ", ":after {\n margin: 0 auto;\n }\n"])), MapLegendItem);
5690
- const SingleLegendItemsMixin = /*#__PURE__*/css(_templateObject28 || (_templateObject28 = /*#__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"])), _ref13 => {
5931
+ const MapLegendOther = /*#__PURE__*/styled(MapLegendItem)(_templateObject21 || (_templateObject21 = /*#__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"])));
5932
+ const SizeLegendItemsMixin = /*#__PURE__*/css(_templateObject22 || (_templateObject22 = /*#__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);
5933
+ const StrokeWidthLegendItemsMixin = /*#__PURE__*/css(_templateObject23 || (_templateObject23 = /*#__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);
5934
+ const SizeMinimizedLegend = /*#__PURE__*/styled.div(_templateObject24 || (_templateObject24 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n margin: 0.5rem 0 0.25rem;\n"])));
5935
+ const SizeMinimizedLegendSymbol = /*#__PURE__*/styled.div(_templateObject25 || (_templateObject25 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n"])));
5936
+ const SizeMinimizedLegendLabel = /*#__PURE__*/styled.div(_templateObject26 || (_templateObject26 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n"])));
5937
+ const SizeMinimizedLegendDown = /*#__PURE__*/styled.div(_templateObject27 || (_templateObject27 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: rgba(48, 69, 79, 0.65);\n"])));
5938
+ const SizeMinimizedLegendUp = /*#__PURE__*/styled(SizeMinimizedLegendDown)(_templateObject28 || (_templateObject28 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
5939
+ const SingleSizeLegendItemsMixin = /*#__PURE__*/css(_templateObject29 || (_templateObject29 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 4rem;\n margin-right: 0.75rem;\n\n ", ":after {\n margin: 0 auto;\n }\n"])), MapLegendItem);
5940
+ const SingleLegendItemsMixin = /*#__PURE__*/css(_templateObject30 || (_templateObject30 = /*#__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"])), _ref16 => {
5691
5941
  let {
5692
5942
  isSize
5693
- } = _ref13;
5943
+ } = _ref16;
5694
5944
  return isSize && SingleSizeLegendItemsMixin;
5695
- }, MapLegendItem, _ref14 => {
5945
+ }, MapLegendItem, _ref17 => {
5696
5946
  let {
5697
5947
  parameter
5698
- } = _ref14;
5948
+ } = _ref17;
5699
5949
  return isParameterType(["strokeColor", "stroke.color"], parameter) && StrokeColorLegendItemMixin;
5700
5950
  });
5701
- const MapLegendItems = /*#__PURE__*/styled.div(_templateObject29 || (_templateObject29 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n ", ";\n ", ";\n"])), _ref15 => {
5951
+ const MapLegendItems = /*#__PURE__*/styled.div(_templateObject31 || (_templateObject31 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n ", ";\n ", ";\n"])), _ref18 => {
5702
5952
  let {
5703
5953
  isSize
5704
- } = _ref15;
5954
+ } = _ref18;
5705
5955
  return isSize && SizeLegendItemsMixin;
5706
- }, _ref16 => {
5956
+ }, _ref19 => {
5707
5957
  let {
5708
5958
  isStrokeWidth
5709
- } = _ref16;
5959
+ } = _ref19;
5710
5960
  return isStrokeWidth && StrokeWidthLegendItemsMixin;
5711
- }, _ref17 => {
5961
+ }, _ref20 => {
5712
5962
  let {
5713
5963
  isSingle
5714
- } = _ref17;
5964
+ } = _ref20;
5715
5965
  return isSingle && SingleLegendItemsMixin;
5716
5966
  });
5717
- const MapLegendItemsContainer = /*#__PURE__*/styled.div(_templateObject30 || (_templateObject30 = /*#__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);
5718
- const MapLegendValues = /*#__PURE__*/styled.div(_templateObject31 || (_templateObject31 = /*#__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"])));
5719
- const MapLegendValuesRange = /*#__PURE__*/styled.div(_templateObject32 || (_templateObject32 = /*#__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"])));
5720
- const MapLegendValuesOther = /*#__PURE__*/styled(MapLegendOther)(_templateObject33 || (_templateObject33 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n justify-content: center;\n border: 0;\n overflow: visible;\n"])));
5721
- const MapLegendExpandButton = /*#__PURE__*/styled.div(_templateObject34 || (_templateObject34 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin-top: 0.1rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
5967
+ const MapLegendItemsContainer = /*#__PURE__*/styled.div(_templateObject32 || (_templateObject32 = /*#__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);
5968
+ const MapLegendValues = /*#__PURE__*/styled.div(_templateObject33 || (_templateObject33 = /*#__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"])));
5969
+ const MapLegendValuesRange = /*#__PURE__*/styled.div(_templateObject34 || (_templateObject34 = /*#__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"])));
5970
+ const MapLegendValuesOther = /*#__PURE__*/styled(MapLegendOther)(_templateObject35 || (_templateObject35 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n justify-content: center;\n border: 0;\n overflow: visible;\n"])));
5971
+ const MapLegendExpandButton = /*#__PURE__*/styled.div(_templateObject36 || (_templateObject36 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin-top: 0.1rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
5722
5972
 
5723
5973
  const getValueFromLegendTitle = (title, minOrMax) => {
5724
5974
  if (title.includes(" - ")) {
@@ -5738,6 +5988,8 @@ const MinimizedLegend = _ref => {
5738
5988
  var _currentValues$, _currentValues, _currentValues$2, _currentValues2;
5739
5989
 
5740
5990
  let {
5991
+ innerRef,
5992
+ isShown,
5741
5993
  values,
5742
5994
  title,
5743
5995
  parameter,
@@ -5750,7 +6002,10 @@ const MinimizedLegend = _ref => {
5750
6002
  const titleMax = getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max");
5751
6003
  const titleMin = getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min");
5752
6004
  const checkIsHidden = useCallback(hiddenCondition => hiddenCondition ? hiddenLegends == null ? void 0 : hiddenLegends.some(condition => hiddenCondition.includes(condition)) : false, [hiddenLegends]);
5753
- return React.createElement(MinimizedLegendContainer, null, !!title && React.createElement(MapLegendValueDescr, null, title), isSize ? React.createElement(React.Fragment, null, React.createElement(SizeMinimizedLegend, null, React.createElement(SizeMinimizedLegendSymbol, null, React.createElement(MapLegendItems, {
6005
+ return React.createElement(MinimizedLegendContainer, {
6006
+ ref: innerRef,
6007
+ isShown: isShown
6008
+ }, !!title && React.createElement(MapLegendValueDescr, null, title), isSize ? React.createElement(React.Fragment, null, React.createElement(SizeMinimizedLegend, null, React.createElement(SizeMinimizedLegendSymbol, null, React.createElement(MapLegendItems, {
5754
6009
  parameter: parameter,
5755
6010
  isSize: true
5756
6011
  }, currentValues.map((value, index) => React.createElement(MapLegendItem, {
@@ -6001,11 +6256,16 @@ const LegendSymbolRenderer = /*#__PURE__*/memo(_ref => {
6001
6256
 
6002
6257
  const MaximizedLegend = _ref => {
6003
6258
  let {
6259
+ innerRef,
6260
+ isShown,
6261
+ layerName,
6004
6262
  symbol: sectionSymbol,
6005
6263
  parameter,
6006
6264
  values,
6007
6265
  index: sectionIndex,
6008
- attributeType
6266
+ attributeType,
6267
+ hiddenLegends,
6268
+ toggleHiddenLegend
6009
6269
  } = _ref;
6010
6270
  const {
6011
6271
  t
@@ -6045,19 +6305,22 @@ const MaximizedLegend = _ref => {
6045
6305
 
6046
6306
  return React.createElement(React.Fragment, null, columns.map(renderColumn));
6047
6307
  }, [isDate, renderColumn, t]);
6308
+ const isHidden = useCallback(hiddenCondition => !!(hiddenLegends != null && hiddenLegends.includes(hiddenCondition)), [hiddenLegends]);
6048
6309
  const renderLegend = useCallback((_ref2, index) => {
6049
6310
  var _parameterValue$value;
6050
6311
 
6051
6312
  let {
6052
6313
  symbol,
6053
- title
6054
- /* , hiddenCondition*/
6055
-
6314
+ title,
6315
+ hiddenCondition
6056
6316
  } = _ref2;
6057
- if (!symbol) return null; // const isClusterFillColor = checkIsClusterFillColor(symbol, parameter);
6058
-
6317
+ if (!symbol) return null;
6318
+ const isClusterFillColor$1 = isClusterFillColor(symbol, parameter);
6059
6319
  return React.createElement(ClassifiedItem, {
6060
- key: sectionIndex + title + index
6320
+ key: sectionIndex + title + index,
6321
+ isHidden: isHidden(hiddenCondition),
6322
+ isClusterFillColor: isClusterFillColor$1,
6323
+ onClick: () => toggleHiddenLegend == null ? void 0 : toggleHiddenLegend(layerName, hiddenCondition)
6061
6324
  }, isSize || isStrokeWidth || isStrokeColor ? React.createElement(MapLegendItems, {
6062
6325
  parameter: parameter,
6063
6326
  isSize: isSize,
@@ -6067,15 +6330,16 @@ const MaximizedLegend = _ref => {
6067
6330
  }, React.createElement(MapLegendItem, {
6068
6331
  key: "" + title + index,
6069
6332
  title: title,
6070
- value: (parameterValue == null ? void 0 : (_parameterValue$value = parameterValue.values[index]) == null ? void 0 : _parameterValue$value.value) || (parameterValue == null ? void 0 : parameterValue.defaultValue),
6333
+ value: (parameterValue == null ? void 0 : (_parameterValue$value = parameterValue.values[(parameterValue == null ? void 0 : parameterValue.values.length) - index - 1]) == null ? void 0 : _parameterValue$value.value) || (parameterValue == null ? void 0 : parameterValue.defaultValue),
6071
6334
  parameter: parameter
6072
6335
  })) : React.createElement(SymbolContainer, null, React.createElement(LegendSymbolRenderer, {
6073
- symbol: symbol
6074
- /* isClusterFillColor ? symbol : getExtractedSymbol(symbol, true)*/
6075
-
6336
+ symbol: isClusterFillColor$1 ? symbol : getExtractedSymbol(symbol, true)
6076
6337
  })), renderItemText(title, index));
6077
- }, [isSize, isStrokeColor, isStrokeWidth, parameter, parameterValue == null ? void 0 : parameterValue.defaultValue, parameterValue == null ? void 0 : parameterValue.values, renderItemText, sectionIndex]);
6078
- return React.createElement(React.Fragment, null, values.map(renderLegend));
6338
+ }, [isSize, isStrokeColor, isStrokeWidth, parameter, parameterValue == null ? void 0 : parameterValue.defaultValue, parameterValue == null ? void 0 : parameterValue.values, renderItemText, sectionIndex, hiddenLegends, toggleHiddenLegend]);
6339
+ return React.createElement(MaximizedLegendContainer, {
6340
+ ref: innerRef,
6341
+ isShown: isShown
6342
+ }, values.map(renderLegend));
6079
6343
  };
6080
6344
 
6081
6345
  const LegendParameterDescription = _ref => {
@@ -6090,10 +6354,14 @@ const LegendParameterDescription = _ref => {
6090
6354
 
6091
6355
  const LegendSection = _ref => {
6092
6356
  let {
6357
+ layerName,
6093
6358
  symbol,
6094
- param,
6095
- params,
6359
+ parameter,
6360
+ parameters,
6096
6361
  classified,
6362
+ hiddenLegends,
6363
+ toggleHiddenLegend,
6364
+ attributeName,
6097
6365
  attributeTitle,
6098
6366
  attributeType,
6099
6367
  index
@@ -6102,55 +6370,67 @@ const LegendSection = _ref => {
6102
6370
  t
6103
6371
  } = useTranslation("common");
6104
6372
  const [isExpanded, toggleExpanded] = useToggle();
6373
+ const [maxRef, maxNode] = useNode();
6374
+ const [minRef, minNode] = useNode();
6105
6375
  return React.createElement(MapLegendSectionContainer, null, React.createElement(MapLegendHeader, null, attributeTitle), React.createElement(LegendParameterDescription, {
6106
- parameter: param
6107
- }), isExpanded ? React.createElement(MaximizedLegend, {
6108
- key: param,
6376
+ parameter: parameter
6377
+ }), React.createElement(MapLegendSectionItems, {
6378
+ height: isExpanded ? ((maxNode == null ? void 0 : maxNode.offsetHeight) || 0) + 4 : minNode == null ? void 0 : minNode.offsetHeight
6379
+ }, React.createElement(MaximizedLegend, {
6380
+ innerRef: maxRef,
6381
+ isShown: isExpanded,
6382
+ layerName: layerName,
6109
6383
  symbol: symbol,
6110
- parameter: param,
6384
+ hiddenLegends: hiddenLegends == null ? void 0 : hiddenLegends[layerName],
6385
+ toggleHiddenLegend: toggleHiddenLegend,
6386
+ parameter: parameter,
6111
6387
  attributeType: attributeType,
6112
6388
  index: index,
6113
- values: getMaximizedLegendValues(attributeType, param, params, classified, symbol, index, t("classification.other"))
6114
- }) : React.createElement(MinimizedLegend, {
6115
- key: param,
6116
- values: getMinimizedLegendValues(attributeType, classified, index),
6117
- defaultValue: classified.defaultValue,
6118
- parameter: param,
6119
- attributeType: attributeType
6120
- }), React.createElement(MapLegendExpandButton, {
6389
+ values: getMaximizedLegendValues(attributeName, attributeType, parameter, parameters, classified, symbol, index, t("classification.other"))
6390
+ }), React.createElement(MinimizedLegend, {
6391
+ innerRef: minRef,
6392
+ isShown: !isExpanded,
6393
+ values: getMinimizedLegendValues(attributeName, attributeType, classified, index, t("classification.other")),
6394
+ hiddenLegends: hiddenLegends == null ? void 0 : hiddenLegends[layerName],
6395
+ parameter: parameter
6396
+ })), React.createElement(MapLegendExpandButton, {
6121
6397
  onClick: toggleExpanded
6122
6398
  }, t(isExpanded ? "toggleMenu" : "Развернуть")));
6123
6399
  };
6124
6400
 
6125
- const Legend = _ref => {
6401
+ const _excluded$3 = ["layerInfo"];
6402
+ const Legend = /*#__PURE__*/memo(_ref => {
6126
6403
  let {
6127
6404
  layerInfo
6128
- } = _ref;
6405
+ } = _ref,
6406
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
6407
+
6129
6408
  const classified = getClassified(layerInfo);
6130
- const params = Object.keys(classified);
6409
+ const parameters = Object.keys(classified);
6131
6410
  const attributes = getLayerAttributes(layerInfo.layerDefinition);
6132
6411
  return React.createElement(MapLegendContainer, null, Object.keys(classified).map((param, index) => {
6133
- var _classified$param$val, _attributes$find, _layerInfo$style;
6412
+ var _classified$param$val, _layerInfo$style, _attributes$find;
6134
6413
 
6135
6414
  const attributeName = getAttributeNameFromCondition((_classified$param$val = classified[param].values[0]) == null ? void 0 : _classified$param$val.condition);
6136
- const attributeAlias = (_attributes$find = attributes.find(_ref2 => {
6137
- let {
6138
- name
6139
- } = _ref2;
6140
- return name === attributeName;
6141
- })) == null ? void 0 : _attributes$find.alias;
6142
- return React.createElement(LegendSection, {
6415
+ return React.createElement(LegendSection, Object.assign({
6143
6416
  key: index,
6417
+ layerName: layerInfo.name,
6144
6418
  symbol: (_layerInfo$style = layerInfo.style) == null ? void 0 : _layerInfo$style.symbol,
6419
+ attributeName: attributeName,
6420
+ attributeTitle: ((_attributes$find = attributes.find(_ref2 => {
6421
+ let {
6422
+ name
6423
+ } = _ref2;
6424
+ return name === attributeName;
6425
+ })) == null ? void 0 : _attributes$find.alias) || attributeName,
6145
6426
  attributeType: getAttributeType(layerInfo, attributeName),
6146
- attributeTitle: attributeAlias || attributeName,
6147
6427
  classified: classified[param],
6148
- param: param,
6149
- params: params,
6428
+ parameter: param,
6429
+ parameters: parameters,
6150
6430
  index: index
6151
- });
6431
+ }, rest));
6152
6432
  }));
6153
- };
6433
+ });
6154
6434
 
6155
6435
  const Map = _ref => {
6156
6436
  let {
@@ -6375,12 +6655,12 @@ let MeasureTool = /*#__PURE__*/function (_React$Component) {
6375
6655
  return MeasureTool;
6376
6656
  }(React.Component);
6377
6657
 
6378
- const _excluded$3 = ["isActive"];
6658
+ const _excluded$4 = ["isActive"];
6379
6659
  const Measurer = _ref => {
6380
6660
  let {
6381
6661
  isActive
6382
6662
  } = _ref,
6383
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
6663
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
6384
6664
 
6385
6665
  const {
6386
6666
  map,
@@ -6494,7 +6774,7 @@ const TooltipComponent = /*#__PURE__*/styled.div(_templateObject11$2 || (_templa
6494
6774
  return withArrow && corner;
6495
6775
  });
6496
6776
 
6497
- const _excluded$4 = ["features", "map", "center", "component", "zIndex", "children", "content", "onEachFeature", "clickMode"];
6777
+ const _excluded$5 = ["features", "map", "center", "component", "zIndex", "children", "content", "onEachFeature", "clickMode"];
6498
6778
 
6499
6779
  const {
6500
6780
  Provider,
@@ -6513,7 +6793,7 @@ const Tooltip = _ref => {
6513
6793
  onEachFeature,
6514
6794
  clickMode
6515
6795
  } = _ref,
6516
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
6796
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
6517
6797
 
6518
6798
  const onTooltip = useTooltip(zIndex);
6519
6799
  useEffect(() => {
@@ -6554,5 +6834,5 @@ const DraggableMarker = _ref => {
6554
6834
  return React.createElement(Fragment, null);
6555
6835
  };
6556
6836
 
6557
- export { ArrowLineMiterRender, BaseMeasureToolCreator, BaseMeasureToolEditor, CRS_MAP, CardAttributes, CardHeader, CircleLineMiterRender, ClassificationCondition, ClassificationManager, ClassifiedItem, ClusterLayer, ClusterSymbol, CompoundIcon, DEFAULT_CRS, DEFAULT_ID_ATTRIBUTE_NAME, DEFAULT_LEGEND_SIZES, DEFAULT_LEGEND_STYLES, DEFAULT_LEGEND_SYMBOL_SIZE, DEFAULT_PARAMETER_INFO, DEFAULT_SRID, DEFAULT_SYMBOL_FILL_COLOR, DEFAULT_SYMBOL_OFFSET, DEFAULT_SYMBOL_SIZE, DEFAULT_SYMBOL_STROKE_COLOR, DEFAULT_SYMBOL_WITH_BG_SIZE, DateFormat, DraggableMarker, EXTRA_BORDER_SIZE, EvergisCard, EvergisCardAttribute, AttributeContainer as EvergisCardAttributeContainer, AttributeTitle as EvergisCardAttributeTitle, AttributeValueContainer as EvergisCardAttributeValueContainer, CardControls as EvergisCardCardControls, CardTitle as EvergisCardCardTitle, EvergisCardContainer, CurrentFeatureIndex as EvergisCardCurrentFeatureIndex, FeatureName as EvergisCardFeatureName, LayerName as EvergisCardLayerName, CardPagination as EvergisCardPagination, PaginationDescription as EvergisCardPaginationDescription, SimpleAttribute as EvergisCardSimpleValue, StickyHeader as EvergisCardStickyHeader, ValueLink as EvergisCardValueLink, EvergisDynamicLayer, EvergisFeature, EvergisLayer, EvergisProvider, EvergisSelect, EvergisSelectLayer, EvergisSelectProvider, EvergisStyle, EvergisTileLayer, FeatureLayer, Fullscreen, GEOMETRY_ATTRIBUTE, ItemSeparator, ItemText, LabelSymbol, Legend, LegendParameterDescription, LegendProvider, LegendSection, LegendSymbolRenderer, LineMiterKind, LineMiterRender, Map, MapControl, MapControls, MapLegendContainer, MapLegendControl, MapLegendDescription, MapLegendDescriptionContainer, MapLegendExpandButton, MapLegendHeader, MapLegendItem, MapLegendItems, MapLegendItemsContainer, MapLegendOther, MapLegendSectionContainer, MapLegendValueDescr, MapLegendValues, MapLegendValuesOther, MapLegendValuesRange, MapProvider, MaximizedLegend, Measure, MeasureTool, Measurer, MinimizedLegend, MinimizedLegendContainer, NO_CONTENT_VALUE, Noop, PARAMETER_INFOS, PREVIEW_LIMITS, SGisBrushFill, SGisImageFill, SGisPolygonSymbol, SGisPolylineSymbol, SOLID_INTERVALS, SVGPoly, SYMBOL_CLASSIFICATION, SYMBOL_LIMITS, SYMBOL_SIZE_PARAMETERS, ScaleRuler, ScaleRulerBlock, ScaleRulerContainer, Search, SelectedPointSymbol, SelectedPolySymbol, ShadowedPointSymbol, ShadowedPolySymbol, SizeMinimizedLegend, SizeMinimizedLegendDown, SizeMinimizedLegendLabel, SizeMinimizedLegendSymbol, SizeMinimizedLegendUp, SquareLineMiterRender, SrId, StyleSymbol, SvgSymbol, SvgSymbolBg, Symbol, SymbolButton, SymbolByType, SymbolContainer, TextContainer, TileLayer, Tooltip, TooltipComponent, TooltipProvider, Zoom, ZoomLevel, adjustSymbol, applyParameterValue, checkLayerHasLegend, clamp, convertSvgToBase64, copyRings, createCompositeSymbol, createLabelSymbol, createLegendSymbol, createStyleLegend, createSvgGradient, createValueTitle$1 as createValueTitle, defaultOffset, defineStrokeStylePreset, deserializeSymbol, evaluateFeature, extractStyle, extractSymbol, findChildFeatureStyle, findChildFeatureSymbol, formatArea, formatAttributeValue, formatDate, formatLength, formatPolygonMeasure, formatRangeClassValue, formatUniqueClassValue, formatValue, getAttributeFromCondition, getAttributeNameFromClassified, getAttributeNameFromCondition, getAttributeType, getAttributesConfiguration, getChildSymbols, getClassified, getCrs, getDashStylePreset, getDate, getDimensions, getExprFromCondition, getFeatureSymbol, getHexColor, getLayerDefinition, getLegendSymbolRenders, getLegendSymbolSize, getLineDash, getMapLegendSymbolRenders, getMapState, getMaximizedLegendValues, getMinimizedLegendValues, getOffsetParameterValue, getParameterFromSymbol, getParameterValue, getRangeValues$1 as getRangeValues, getScale, getServiceConfiguration, getSignFromConditionPart, getSymbolParameterInfo, getSymbolRenders, getSymbolStrokeWidth, getTitleFromCondition, getValueFromConditionPart, isArrowLineMiter, isCalculatedParameter, isCircleLineMiter, isCompositeSymbol, isDashedBrush, isFilledLineMitter, isH3GridSymbol, isHatchBrush, isImageSymbol, isLabelSymbol, isLayerService, isMaskedImageSymbol, isMiterExist, isNumeric, isObject, isParameterByAttribute, isParameterType, isParameterValueSimple, isParameterValueSymbol, isPatternBrush, isPointLabelSymbol, isPointSymbol, isPolygonHasHatchBrush, isPolygonHasPatternBrush, isPolygonLabelSymbol, isPolygonSymbol, isPolylineLabelSymbol, isPolylineLikePolygon, isPolylineSymbol, isPolylineSymbols, isRangeClass, isRangeCondition, isRasterSymbol, isRequisiteNumbers, isSGisClusterSymbol, 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, numberWithSpaces, packStyle, phoneHref, polygonCircleFromPoint, printRangeClass, renderSymbolToCanvas, selectedPoint, selectedPolygon, selectedPolyline, serializeSvgPointSymbol, setDefaultParameterValue, setParameterValue, shouldUpdateMapState, solidStrokeStylePreset, strokeStylePresets, symbolParameterWalker, symbolTypeGuard, toIntervals, toLineDash, unClassify, updateMapResolution, updateSymbolParameter, urlHref, useCanvas, useClusterLayer, useCrs, useDebouncedCallback, useDraggableMarker, useEventPoint, useEvergisContext, useEvergisDynamicLayer, useEvergisSelect, useEvergisSelectContext, useEvergisTileLayer, useFeatureLayer, useLayerLegend, useLayerOrder, useLayerVisibility, useLegend, useLegendContext, useLegendValueSymbol, useMapBboxChange, useMapContext, useMapLegend, useMapLevel, useMapPick, useMapResize, useMapState, useMapView, useMapViewActions, useMapWrapper, useMaxMinScale, useMetersToPixels, useMetersToPixelsCb, useMount, useProperty, useScale, useSvgSymbol, useSymbol, useToggle, useTooltip, useTooltipContext, useUpdate, useUpdateMapView };
6837
+ export { ArrowLineMiterRender, BASE_OPERATORS, BETWEEN_OPERATORS, BaseMeasureToolCreator, BaseMeasureToolEditor, CONTAINS_OPERATORS, CRS_MAP, CardAttributes, CardHeader, CircleLineMiterRender, ClassificationCondition, ClassificationManager, ClassifiedItem, ClusterLayer, ClusterSymbol, ComparisonOperator, CompoundIcon, DEFAULT_CRS, DEFAULT_ID_ATTRIBUTE_NAME, DEFAULT_LEGEND_SIZES, DEFAULT_LEGEND_STYLES, DEFAULT_LEGEND_SYMBOL_SIZE, DEFAULT_PARAMETER_INFO, DEFAULT_SRID, DEFAULT_SYMBOL_FILL_COLOR, DEFAULT_SYMBOL_OFFSET, DEFAULT_SYMBOL_SIZE, DEFAULT_SYMBOL_STROKE_COLOR, DEFAULT_SYMBOL_WITH_BG_SIZE, DateFormat, DraggableMarker, ENDS_WITH_OPERATORS, EXTRA_BORDER_SIZE, EvergisCard, EvergisCardAttribute, AttributeContainer as EvergisCardAttributeContainer, AttributeTitle as EvergisCardAttributeTitle, AttributeValueContainer as EvergisCardAttributeValueContainer, CardControls as EvergisCardCardControls, CardTitle as EvergisCardCardTitle, EvergisCardContainer, CurrentFeatureIndex as EvergisCardCurrentFeatureIndex, FeatureName as EvergisCardFeatureName, LayerName as EvergisCardLayerName, CardPagination as EvergisCardPagination, PaginationDescription as EvergisCardPaginationDescription, SimpleAttribute as EvergisCardSimpleValue, StickyHeader as EvergisCardStickyHeader, ValueLink as EvergisCardValueLink, EvergisDynamicLayer, EvergisFeature, EvergisLayer, EvergisProvider, EvergisSelect, EvergisSelectLayer, EvergisSelectProvider, EvergisStyle, EvergisTileLayer, FILLED_OPERATORS, FeatureLayer, FilterConditionOperation, Fullscreen, GEOMETRY_ATTRIBUTE, ItemSeparator, ItemText, LabelSymbol, Legend, LegendParameterDescription, LegendProvider, LegendSection, LegendSymbolRenderer, LineMiterKind, LineMiterRender, Map, MapControl, MapControls, MapLegendContainer, MapLegendControl, MapLegendDescription, MapLegendDescriptionContainer, MapLegendExpandButton, MapLegendHeader, MapLegendItem, MapLegendItems, MapLegendItemsContainer, MapLegendOther, MapLegendSectionContainer, MapLegendSectionItems, MapLegendValueDescr, MapLegendValues, MapLegendValuesOther, MapLegendValuesRange, MapProvider, MaximizedLegend, MaximizedLegendContainer, Measure, MeasureTool, Measurer, MinimizedLegend, MinimizedLegendContainer, NO_CONTENT_VALUE, Noop, 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, ScaleRuler, ScaleRulerBlock, ScaleRulerContainer, Search, SelectedPointSymbol, SelectedPolySymbol, ShadowedPointSymbol, ShadowedPolySymbol, SizeMinimizedLegend, SizeMinimizedLegendDown, SizeMinimizedLegendLabel, SizeMinimizedLegendSymbol, SizeMinimizedLegendUp, SquareLineMiterRender, SrId, StyleSymbol, SvgSymbol, SvgSymbolBg, Symbol, SymbolButton, SymbolByType, SymbolContainer, TextContainer, TileLayer, Tooltip, TooltipComponent, TooltipProvider, Zoom, ZoomLevel, adjustSymbol, applyParameterValue, checkLayerHasLegend, clamp, convertSvgToBase64, copyRings, createCompositeSymbol, createHiddenCondition, createLabelSymbol, createLegendSymbol, createOtherHiddenCondition, createSvgGradient, createValueTitle, dateComparisonOperators, defaultOffset, defineStrokeStylePreset, deserializeSymbol, evaluateFeature, extractStyle, extractSymbol, findChildFeatureStyle, findChildFeatureSymbol, formatArea, formatAttributeValue, formatDate, formatLength, formatPolygonMeasure, formatRangeClassValue, formatUniqueClassValue, formatValue$1 as formatValue, getAttributeFromCondition, getAttributeNameFromClassified, getAttributeNameFromCondition, getAttributeType, getAttributesConfiguration, getChildSymbols, getClassified, getCrs, getDashStylePreset, getDate, getDimensions, getExprFromCondition, getExtractedSymbol, getFeatureSymbol, getHexColor, getLayerDefinition, getLegendSymbolRenders, getLegendSymbolSize, getLineDash, getMapLegendSymbolRenders, getMapState, getMaximizedLegendValues, getMinimizedLegendValues, getOffsetParameterValue, getParameterFromSymbol, getParameterValue, getRangeValues$1 as getRangeValues, getScale, getServiceConfiguration, getSignFromConditionPart, getSymbolParameterInfo, getSymbolRenders, getSymbolStrokeWidth, getTitleFromCondition, getValueFromConditionPart, isArrowLineMiter, isCalculatedParameter, isCircleLineMiter, isClusterFillColor, isClusterSymbol, isCompositeSymbol, isDashedBrush, isFilledLineMitter, isH3GridSymbol, isHatchBrush, isImageSymbol, isLabelSymbol, isLayerService, isMaskedImageSymbol, isMiterExist, isNumeric, isObject, isParameterByAttribute, isParameterType, isParameterValueSimple, isParameterValueSymbol, isPatternBrush, isPointLabelSymbol, isPointSymbol, isPolygonHasHatchBrush, isPolygonHasPatternBrush, isPolygonLabelSymbol, isPolygonSymbol, isPolylineLabelSymbol, isPolylineLikePolygon, isPolylineSymbol, isPolylineSymbols, isRangeClass, isRangeCondition, isRasterSymbol, isRequisiteNumbers, isSGisClusterSymbol, 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, shouldUpdateMapState, solidStrokeStylePreset, strokeStylePresets, symbolParameterWalker, symbolTypeGuard, textComparisonOperators, toIntervals, toLineDash, unClassify, updateMapResolution, updateSymbolParameter, urlHref, useCanvas, useClusterLayer, useCrs, useDebouncedCallback, useDraggableMarker, useEventPoint, useEvergisContext, useEvergisDynamicLayer, useEvergisSelect, useEvergisSelectContext, useEvergisTileLayer, useFeatureLayer, useLayerOrder, useLayerVisibility, useLegendContext, useMapBboxChange, useMapContext, useMapLevel, useMapPick, useMapResize, useMapState, useMapView, useMapViewActions, useMapWrapper, useMaxMinScale, useMetersToPixels, useMetersToPixelsCb, useMount, useNode, useProperty, useScale, useSvgSymbol, useSymbol, useToggle, useTooltip, useTooltipContext, useUpdate, useUpdateMapView };
6558
6838
  //# sourceMappingURL=react.esm.js.map