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