@syncfusion/ej2-maps 25.2.5 → 26.1.41

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.
@@ -633,7 +633,9 @@ var Legend = /** @class */ (function () {
633
633
  }
634
634
  else {
635
635
  var layerIndex = currentItem[currentItem.length - 1].layerIndex;
636
- this.setToggleAttributes(legendTextElement, legendShapeElement, this.maps.layers[layerIndex].shapeSettings.fill, this.maps.layers[layerIndex].shapeSettings.opacity, this.maps.layers[layerIndex].shapeSettings.border.color, isNullOrUndefined(this.maps.layers[layerIndex].shapeSettings.border.width)
636
+ this.setToggleAttributes(legendTextElement, legendShapeElement, this.maps.layers[layerIndex].shapeSettings.fill, this.maps.layers[layerIndex].shapeSettings.opacity,
637
+ /* eslint-disable-next-line max-len */
638
+ this.maps.layers[layerIndex].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor, isNullOrUndefined(this.maps.layers[layerIndex].shapeSettings.border.width)
637
639
  ? 0 : this.maps.layers[layerIndex].shapeSettings.border.width, isNullOrUndefined(this.maps.layers[layerIndex].shapeSettings.border.opacity)
638
640
  ? this.maps.layers[layerIndex].shapeSettings.opacity
639
641
  : this.maps.layers[layerIndex].shapeSettings.border.opacity, this.maps.layers[layerIndex].shapeSettings.fill);
@@ -832,7 +834,7 @@ var Legend = /** @class */ (function () {
832
834
  collection.push({
833
835
  legendElement: targetElement, legendOldFill: oldElement['fill'], legendOldOpacity: oldElement['opacity'],
834
836
  legendOldBorderColor: oldElement['borderColor'], legendOldBorderWidth: oldElement['borderWidth'],
835
- shapeOpacity: shapeSettings.opacity, shapeOldBorderColor: shapeSettings.border.color,
837
+ shapeOpacity: shapeSettings.opacity, shapeOldBorderColor: shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor,
836
838
  shapeOldBorderWidth: shapeSettings.border.width
837
839
  });
838
840
  var length = collection.length;
@@ -1309,7 +1311,8 @@ var Legend = /** @class */ (function () {
1309
1311
  this.legendBorderRect = new Rect((this.legendItemRect.x - spacing), (this.legendItemRect.y - spacing - textSize.height), (this.legendItemRect.width) + (spacing * 2), (this.legendItemRect.height) + (spacing * 2) + textSize.height +
1310
1312
  (legend.mode === 'Interactive' ? 0 : (this.page !== 0) ? spacing : 0));
1311
1313
  var legendBorder = {
1312
- color: legend.border.color, width: legend.border.width, opacity: legend.border.opacity
1314
+ color: legend.border.color || this.maps.themeStyle.legendBorderColor, opacity: legend.border.opacity,
1315
+ width: legend.border.width || this.maps.themeStyle.legendBorderWidth
1313
1316
  };
1314
1317
  legendBorder.opacity = isNullOrUndefined(legendBorder.opacity) ? 1 : legendBorder.opacity;
1315
1318
  var renderOptions = new RectOption(map.element.id + '_Legend_Border', legend.background, legendBorder, 1, this.legendBorderRect, null, null, '', '');
@@ -1496,15 +1499,17 @@ var Legend = /** @class */ (function () {
1496
1499
  legendText = !isNullOrUndefined(colorMap.label) ? colorMap.label : colorMap.from + ' - ' + colorMap.to;
1497
1500
  rangeData = [];
1498
1501
  var colorMapProcess_1 = false;
1499
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1500
- Array.prototype.forEach.call(dataSource, function (data, dataIndex) {
1501
- var colorValue = (colorValuePath.indexOf('.') > -1) ? Number(getValueFromObject(data, colorValuePath)) :
1502
- parseFloat(data[colorValuePath]);
1503
- if (colorValue >= colorMap.from && colorValue <= colorMap.to) {
1504
- colorMapProcess_1 = true;
1505
- rangeData.push(_this.getLegendData(layerIndex, dataIndex, data, dataPath, layerData, propertyPath, colorValue));
1506
- }
1507
- });
1502
+ if (!isNullOrUndefined(dataSource) && dataSource.length > 0) {
1503
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1504
+ Array.prototype.forEach.call(dataSource, function (data, dataIndex) {
1505
+ var colorValue = (colorValuePath.indexOf('.') > -1) ? Number(getValueFromObject(data, colorValuePath)) :
1506
+ parseFloat(data[colorValuePath]);
1507
+ if (colorValue >= colorMap.from && colorValue <= colorMap.to) {
1508
+ colorMapProcess_1 = true;
1509
+ rangeData.push(_this.getLegendData(layerIndex, dataIndex, data, dataPath, layerData, propertyPath, colorValue));
1510
+ }
1511
+ });
1512
+ }
1508
1513
  if (!colorMapProcess_1) {
1509
1514
  rangeData.push({
1510
1515
  layerIndex: layerIndex, shapeIndex: null, dataIndex: null,
@@ -1592,23 +1597,25 @@ var Legend = /** @class */ (function () {
1592
1597
  legendText = !isNullOrUndefined(colorMap.label) ? colorMap.label : colorMap.value;
1593
1598
  equalData = [];
1594
1599
  var eqaulColorProcess_1 = false;
1595
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1596
- Array.prototype.forEach.call(dataSource, function (data, dataIndex) {
1597
- var equalValue = ((colorValuePath.indexOf('.') > -1) ? (getValueFromObject(data, colorValuePath)) :
1598
- (data[colorValuePath]));
1599
- if (equalValue === colorMap.value) {
1600
- eqaulColorProcess_1 = true;
1601
- if (equalValues.indexOf(equalValue) === -1) {
1602
- equalValues.push(equalValue);
1600
+ if (!isNullOrUndefined(dataSource) && dataSource.length > 0) {
1601
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1602
+ Array.prototype.forEach.call(dataSource, function (data, dataIndex) {
1603
+ var equalValue = ((colorValuePath.indexOf('.') > -1) ? (getValueFromObject(data, colorValuePath)) :
1604
+ (data[colorValuePath]));
1605
+ if (equalValue === colorMap.value) {
1606
+ eqaulColorProcess_1 = true;
1607
+ if (equalValues.indexOf(equalValue) === -1) {
1608
+ equalValues.push(equalValue);
1609
+ }
1610
+ equalData.push(_this.getLegendData(layerIndex, dataIndex, data, dataPath, layerData, propertyPath, equalValue));
1603
1611
  }
1604
- equalData.push(_this.getLegendData(layerIndex, dataIndex, data, dataPath, layerData, propertyPath, equalValue));
1605
- }
1606
- else {
1607
- if (outOfRangeValues.indexOf(equalValue) === -1) {
1608
- outOfRangeValues.push(equalValue);
1612
+ else {
1613
+ if (outOfRangeValues.indexOf(equalValue) === -1) {
1614
+ outOfRangeValues.push(equalValue);
1615
+ }
1609
1616
  }
1610
- }
1611
- });
1617
+ });
1618
+ }
1612
1619
  for (var x = 0; x < equalValues.length; x++) {
1613
1620
  for (var y = 0; y < outOfRangeValues.length; y++) {
1614
1621
  if (equalValues[x] === outOfRangeValues[y]) {
@@ -1875,7 +1882,7 @@ var Legend = /** @class */ (function () {
1875
1882
  if (isVisible && mapElement !== null) {
1876
1883
  if (this.maps.legendSettings.toggleLegendSettings.applyShapeSettings) {
1877
1884
  mapElement.setAttribute('fill', this.maps.layers[k].shapeSettings.fill);
1878
- mapElement.setAttribute('stroke', this.maps.layers[k].shapeSettings.border.color);
1885
+ mapElement.setAttribute('stroke', this.maps.layers[k].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor);
1879
1886
  mapElement.setAttribute('fill-opacity', (this.maps.layers[k].shapeSettings.opacity).toString());
1880
1887
  mapElement.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width).toString());
1881
1888
  mapElement.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ?
@@ -1905,7 +1912,9 @@ var Legend = /** @class */ (function () {
1905
1912
  this.setToggleAttributes(legendTextId, legendShapeId, legendToggleFill, legendToggleOpacity, legendToggleBorderColor, legendToggleBorderWidth, legendToggleBorderOpacity, legendToggleFill);
1906
1913
  }
1907
1914
  else {
1908
- this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[k].shapeSettings.fill, this.maps.layers[k].shapeSettings.opacity, this.maps.layers[k].shapeSettings.border.color, isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width)
1915
+ this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[k].shapeSettings.fill, this.maps.layers[k].shapeSettings.opacity,
1916
+ /* eslint-disable-next-line max-len */
1917
+ this.maps.layers[k].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor, isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width)
1909
1918
  ? 0 : this.maps.layers[k].shapeSettings.border.width,
1910
1919
  /* eslint-disable-next-line max-len */
1911
1920
  isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity)
@@ -1962,7 +1971,7 @@ var Legend = /** @class */ (function () {
1962
1971
  if (this.maps.legendSettings.toggleLegendSettings.applyShapeSettings) {
1963
1972
  layerElement.setAttribute('fill', this.maps.layers[j].shapeSettings.fill);
1964
1973
  layerElement.setAttribute('fill-opacity', (this.maps.layers[j].shapeSettings.opacity).toString());
1965
- layerElement.setAttribute('stroke', this.maps.layers[j].shapeSettings.border.color);
1974
+ layerElement.setAttribute('stroke', this.maps.layers[j].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor);
1966
1975
  layerElement.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[j].shapeSettings.border.width) ? 0 : this.maps.layers[j].shapeSettings.border.width).toString());
1967
1976
  layerElement.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[j].shapeSettings.border.opacity) ?
1968
1977
  this.maps.layers[j].shapeSettings.opacity :
@@ -1982,7 +1991,9 @@ var Legend = /** @class */ (function () {
1982
1991
  this.setToggleAttributes(legendTextId, legendShapeId, legendToggleFill, legendToggleOpacity, legendToggleBorderColor, legendToggleBorderWidth, legendToggleBorderOpacity, legendToggleFill);
1983
1992
  }
1984
1993
  else {
1985
- this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[j].shapeSettings.fill, this.maps.layers[j].shapeSettings.opacity, this.maps.layers[j].shapeSettings.border.color, isNullOrUndefined(this.maps.layers[j].shapeSettings.border.width)
1994
+ this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[j].shapeSettings.fill, this.maps.layers[j].shapeSettings.opacity,
1995
+ /* eslint-disable-next-line max-len */
1996
+ this.maps.layers[j].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor, isNullOrUndefined(this.maps.layers[j].shapeSettings.border.width)
1986
1997
  ? 0 : this.maps.layers[j].shapeSettings.border.width,
1987
1998
  /* eslint-disable-next-line max-len */
1988
1999
  isNullOrUndefined(this.maps.layers[j].shapeSettings.border.opacity)
@@ -2004,7 +2015,7 @@ var Legend = /** @class */ (function () {
2004
2015
  this.maps.layers[j].shapeSettings.border.opacity).toString());
2005
2016
  layerElement.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[j].shapeSettings.border.width) ? 0 : this.maps.layers[j].shapeSettings.border.width).toString());
2006
2017
  layerElement.setAttribute('fill-opacity', (this.maps.layers[j].shapeSettings.opacity).toString());
2007
- layerElement.setAttribute('stroke', this.maps.layers[j].shapeSettings.border.color);
2018
+ layerElement.setAttribute('stroke', this.maps.layers[j].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor);
2008
2019
  if (targetEle !== null) {
2009
2020
  legendTextId = querySelector(this.maps.element.id + '_Legend_Text_Index_' + legendIndex, this.maps.element.id);
2010
2021
  legendShapeId = querySelector(this.maps.element.id + '_Legend_Shape_Index_' + legendIndex, this.maps.element.id);
@@ -2054,7 +2065,7 @@ var Legend = /** @class */ (function () {
2054
2065
  }
2055
2066
  if (this.maps.legendSettings.toggleLegendSettings.applyShapeSettings) {
2056
2067
  LegendInteractive.setAttribute('fill', this.maps.layers[k].shapeSettings.fill);
2057
- LegendInteractive.setAttribute('stroke', this.maps.layers[k].shapeSettings.border.color);
2068
+ LegendInteractive.setAttribute('stroke', this.maps.layers[k].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor);
2058
2069
  LegendInteractive.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width).toString());
2059
2070
  LegendInteractive.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ?
2060
2071
  this.maps.layers[k].shapeSettings.opacity :
@@ -2075,7 +2086,9 @@ var Legend = /** @class */ (function () {
2075
2086
  this.setToggleAttributes(legendTextId, legendShapeId, legendToggleFill, legendToggleOpacity, legendToggleBorderColor, legendToggleBorderWidth, legendToggleBorderOpacity, legendToggleFill);
2076
2087
  }
2077
2088
  else {
2078
- this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[k].shapeSettings.fill, this.maps.layers[k].shapeSettings.opacity, this.maps.layers[k].shapeSettings.border.color,
2089
+ this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[k].shapeSettings.fill, this.maps.layers[k].shapeSettings.opacity,
2090
+ /* eslint-disable-next-line max-len */
2091
+ this.maps.layers[k].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor,
2079
2092
  /* eslint-disable-next-line max-len */
2080
2093
  (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width)
2081
2094
  ? 0
@@ -2136,7 +2149,7 @@ var Legend = /** @class */ (function () {
2136
2149
  }
2137
2150
  if (this.maps.legendSettings.toggleLegendSettings.applyShapeSettings) {
2138
2151
  mapLegendElement.setAttribute('fill', this.maps.layers[0].shapeSettings.fill);
2139
- mapLegendElement.setAttribute('stroke', this.maps.layers[0].shapeSettings.border.color);
2152
+ mapLegendElement.setAttribute('stroke', this.maps.layers[0].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor);
2140
2153
  mapLegendElement.setAttribute('fill-opacity', (this.maps.layers[k].shapeSettings.opacity).toString());
2141
2154
  mapLegendElement.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 : this.maps.layers[k].shapeSettings.border.width).toString());
2142
2155
  mapLegendElement.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ?
@@ -2157,7 +2170,9 @@ var Legend = /** @class */ (function () {
2157
2170
  this.setToggleAttributes(legendTextId, legendShapeId, legendToggleFill, legendToggleOpacity, legendToggleBorderColor, legendToggleBorderWidth, legendToggleBorderOpacity, legendToggleFill);
2158
2171
  }
2159
2172
  else {
2160
- this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[0].shapeSettings.fill, this.maps.layers[k].shapeSettings.opacity, this.maps.layers[0].shapeSettings.border.color, isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width)
2173
+ this.setToggleAttributes(legendTextId, legendShapeId, this.maps.layers[0].shapeSettings.fill, this.maps.layers[k].shapeSettings.opacity,
2174
+ /* eslint-disable-next-line max-len */
2175
+ this.maps.layers[0].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor, isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width)
2161
2176
  ? 0
2162
2177
  : this.maps.layers[k].shapeSettings.border.width,
2163
2178
  /* eslint-disable-next-line max-len */
@@ -2177,7 +2192,7 @@ var Legend = /** @class */ (function () {
2177
2192
  mapLegendElement.setAttribute('fill-opacity', (this.maps.layers[k].shapeSettings.opacity).toString());
2178
2193
  mapLegendElement.setAttribute('stroke-width', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.width) ? 0 :
2179
2194
  this.maps.layers[k].shapeSettings.border.width).toString());
2180
- mapLegendElement.setAttribute('stroke', this.maps.layers[0].shapeSettings.border.color);
2195
+ mapLegendElement.setAttribute('stroke', this.maps.layers[0].shapeSettings.border.color || this.maps.themeStyle.shapeBorderColor);
2181
2196
  mapLegendElement.setAttribute('stroke-opacity', (isNullOrUndefined(this.maps.layers[k].shapeSettings.border.opacity) ?
2182
2197
  this.maps.layers[k].shapeSettings.opacity :
2183
2198
  this.maps.layers[k].shapeSettings.border.opacity).toString());
@@ -55,83 +55,85 @@ var Marker = /** @class */ (function () {
55
55
  Array.prototype.forEach.call(currentLayer.markerSettings, function (markerSettings, markerIndex) {
56
56
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
57
  var markerData = markerSettings.dataSource;
58
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
- Array.prototype.forEach.call(markerData, function (data, dataIndex) {
60
- maps.markerNullCount = markerIndex > 0 && dataIndex === 0 ? 0 : maps.markerNullCount;
61
- var eventArgs = {
62
- cancel: false, name: markerRendering, fill: markerSettings.fill, height: markerSettings.height,
63
- width: markerSettings.width, imageUrl: markerSettings.imageUrl, shape: markerSettings.shape,
64
- template: markerSettings.template, data: data, maps: maps, marker: markerSettings,
65
- border: markerSettings.border, colorValuePath: markerSettings.colorValuePath,
66
- shapeValuePath: markerSettings.shapeValuePath, imageUrlValuePath: markerSettings.imageUrlValuePath
67
- };
68
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
69
- maps.trigger('markerRendering', eventArgs, function (MarkerArgs) {
70
- eventArgs = markerColorChoose(eventArgs, data);
71
- eventArgs = markerShapeChoose(eventArgs, data);
72
- var lng = (!isNullOrUndefined(markerSettings.longitudeValuePath)) ?
73
- Number(getValueFromObject(data, markerSettings.longitudeValuePath)) : !isNullOrUndefined(data['longitude']) ?
74
- parseFloat(data['longitude']) : !isNullOrUndefined(data['Longitude']) ? parseFloat(data['Longitude']) : null;
75
- var lat = (!isNullOrUndefined(markerSettings.latitudeValuePath)) ?
76
- Number(getValueFromObject(data, markerSettings.latitudeValuePath)) : !isNullOrUndefined(data['latitude']) ?
77
- parseFloat(data['latitude']) : !isNullOrUndefined(data['Latitude']) ? parseFloat(data['Latitude']) : null;
78
- var offset = markerSettings.offset;
79
- if (!eventArgs.cancel && markerSettings.visible && !isNullOrUndefined(lng) && !isNullOrUndefined(lat)) {
80
- var markerID = maps.element.id + '_LayerIndex_' + layerIndex + '_MarkerIndex_'
81
- + markerIndex + '_dataIndex_' + dataIndex;
82
- var location_1 = (maps.isTileMap) ? convertTileLatLongToPoint(new MapLocation(lng, lat), factor, maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, currentLayer, maps);
83
- if (maps.isTileMap) {
84
- translatePoint = (currentLayer.type === 'SubLayer' && isNullOrUndefined(maps.zoomModule)) ? location_1 = convertTileLatLongToPoint(new MapLocation(lng, lat), maps.tileZoomLevel, maps.tileTranslatePoint, true) : new Object();
85
- }
86
- var scale = type === 'AddMarker' ? maps.scale : translatePoint['scale'];
87
- var transPoint = type === 'AddMarker' ? maps.translatePoint : translatePoint['location'];
88
- if (eventArgs.template && (!isNaN(location_1.x) && !isNaN(location_1.y))) {
89
- markerTemplateCount++;
90
- markerTemplate(eventArgs, templateFn, markerID, data, markerIndex, markerTemplateEle, location_1, transPoint, scale, offset, maps);
91
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
- maps.renderReactTemplates();
93
- }
94
- else if (!eventArgs.template && (!isNaN(location_1.x) && !isNaN(location_1.y))) {
95
- markerCount++;
96
- marker(eventArgs, markerSettings, markerData, dataIndex, location_1, transPoint, markerID, offset, scale, maps, _this.markerSVGObject);
97
- }
98
- }
99
- nullCount += (!isNaN(lat) && !isNaN(lng)) ? 0 : 1;
100
- markerTemplateCount += (eventArgs.cancel) ? 1 : 0;
101
- markerCount += (eventArgs.cancel) ? 1 : 0;
102
- maps.markerNullCount = (isNullOrUndefined(lng) || isNullOrUndefined(lat)) ?
103
- maps.markerNullCount + 1 : maps.markerNullCount;
104
- var markerDataLength = markerData.length - maps.markerNullCount;
105
- var isMarkersClustered = false;
106
- if (_this.markerSVGObject.childElementCount === (markerDataLength - markerTemplateCount - nullCount) && (type !== 'Template')) {
107
- layerElement.appendChild(_this.markerSVGObject);
108
- if (currentLayer.markerClusterSettings.allowClustering) {
109
- maps.svgObject.appendChild(_this.markerSVGObject);
110
- maps.element.appendChild(maps.svgObject);
111
- if ((currentLayer.layerType === 'OSM' || (currentLayer.urlTemplate.indexOf('openstreetmap') !== -1 && isNullOrUndefined(currentLayer.shapeData)))
112
- && maps.zoomSettings.enable) {
113
- isMarkersClustered = clusterTemplate(currentLayer, _this.markerSVGObject, maps, layerIndex, _this.markerSVGObject, layerElement, true, false);
114
- layerElement.appendChild(_this.markerSVGObject);
58
+ if (!isNullOrUndefined(markerSettings.dataSource)) {
59
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
+ Array.prototype.forEach.call(markerData, function (data, dataIndex) {
61
+ maps.markerNullCount = markerIndex > 0 && dataIndex === 0 ? 0 : maps.markerNullCount;
62
+ var eventArgs = {
63
+ cancel: false, name: markerRendering, fill: markerSettings.fill, height: markerSettings.height,
64
+ width: markerSettings.width, imageUrl: markerSettings.imageUrl, shape: markerSettings.shape,
65
+ template: markerSettings.template, data: data, maps: maps, marker: markerSettings,
66
+ border: markerSettings.border, colorValuePath: markerSettings.colorValuePath,
67
+ shapeValuePath: markerSettings.shapeValuePath, imageUrlValuePath: markerSettings.imageUrlValuePath
68
+ };
69
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
70
+ maps.trigger('markerRendering', eventArgs, function (MarkerArgs) {
71
+ eventArgs = markerColorChoose(eventArgs, data);
72
+ eventArgs = markerShapeChoose(eventArgs, data);
73
+ var lng = (!isNullOrUndefined(markerSettings.longitudeValuePath)) ?
74
+ Number(getValueFromObject(data, markerSettings.longitudeValuePath)) : !isNullOrUndefined(data['longitude']) ?
75
+ parseFloat(data['longitude']) : !isNullOrUndefined(data['Longitude']) ? parseFloat(data['Longitude']) : null;
76
+ var lat = (!isNullOrUndefined(markerSettings.latitudeValuePath)) ?
77
+ Number(getValueFromObject(data, markerSettings.latitudeValuePath)) : !isNullOrUndefined(data['latitude']) ?
78
+ parseFloat(data['latitude']) : !isNullOrUndefined(data['Latitude']) ? parseFloat(data['Latitude']) : null;
79
+ var offset = markerSettings.offset;
80
+ if (!eventArgs.cancel && markerSettings.visible && !isNullOrUndefined(lng) && !isNullOrUndefined(lat)) {
81
+ var markerID = maps.element.id + '_LayerIndex_' + layerIndex + '_MarkerIndex_'
82
+ + markerIndex + '_dataIndex_' + dataIndex;
83
+ var location_1 = (maps.isTileMap) ? convertTileLatLongToPoint(new MapLocation(lng, lat), factor, maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, currentLayer, maps);
84
+ if (maps.isTileMap) {
85
+ translatePoint = (currentLayer.type === 'SubLayer' && isNullOrUndefined(maps.zoomModule)) ? location_1 = convertTileLatLongToPoint(new MapLocation(lng, lat), maps.tileZoomLevel, maps.tileTranslatePoint, true) : new Object();
115
86
  }
116
- else {
117
- isMarkersClustered = clusterTemplate(currentLayer, _this.markerSVGObject, maps, layerIndex, _this.markerSVGObject, layerElement, true, false);
87
+ var scale = type === 'AddMarker' ? maps.scale : translatePoint['scale'];
88
+ var transPoint = type === 'AddMarker' ? maps.translatePoint : translatePoint['location'];
89
+ if (eventArgs.template && (!isNaN(location_1.x) && !isNaN(location_1.y))) {
90
+ markerTemplateCount++;
91
+ markerTemplate(eventArgs, templateFn, markerID, data, markerIndex, markerTemplateEle, location_1, transPoint, scale, offset, maps);
92
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
+ maps.renderReactTemplates();
94
+ }
95
+ else if (!eventArgs.template && (!isNaN(location_1.x) && !isNaN(location_1.y))) {
96
+ markerCount++;
97
+ marker(eventArgs, markerSettings, markerData, dataIndex, location_1, transPoint, markerID, offset, scale, maps, _this.markerSVGObject);
118
98
  }
119
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
120
- maps.renderReactTemplates();
121
99
  }
122
- }
123
- if (markerTemplateEle.childElementCount === (markerDataLength - markerCount - nullCount) && getElementByID(maps.element.id + '_Secondary_Element')) {
124
- getElementByID(maps.element.id + '_Secondary_Element').appendChild(markerTemplateEle);
125
- if (maps.checkInitialRender) {
126
- if (currentLayer.markerClusterSettings.allowClustering && !isMarkersClustered) {
127
- clusterTemplate(currentLayer, markerTemplateEle, maps, layerIndex, _this.markerSVGObject, layerElement, false, false);
100
+ nullCount += (!isNaN(lat) && !isNaN(lng)) ? 0 : 1;
101
+ markerTemplateCount += (eventArgs.cancel) ? 1 : 0;
102
+ markerCount += (eventArgs.cancel) ? 1 : 0;
103
+ maps.markerNullCount = (isNullOrUndefined(lng) || isNullOrUndefined(lat)) ?
104
+ maps.markerNullCount + 1 : maps.markerNullCount;
105
+ var markerDataLength = markerData.length - maps.markerNullCount;
106
+ var isMarkersClustered = false;
107
+ if (_this.markerSVGObject.childElementCount === (markerDataLength - markerTemplateCount - nullCount) && (type !== 'Template')) {
108
+ layerElement.appendChild(_this.markerSVGObject);
109
+ if (currentLayer.markerClusterSettings.allowClustering) {
110
+ maps.svgObject.appendChild(_this.markerSVGObject);
111
+ maps.element.appendChild(maps.svgObject);
112
+ if ((currentLayer.urlTemplate.indexOf('openstreetmap') !== -1 && isNullOrUndefined(currentLayer.shapeData))
113
+ && maps.zoomSettings.enable) {
114
+ isMarkersClustered = clusterTemplate(currentLayer, _this.markerSVGObject, maps, layerIndex, _this.markerSVGObject, layerElement, true, false);
115
+ layerElement.appendChild(_this.markerSVGObject);
116
+ }
117
+ else {
118
+ isMarkersClustered = clusterTemplate(currentLayer, _this.markerSVGObject, maps, layerIndex, _this.markerSVGObject, layerElement, true, false);
119
+ }
128
120
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
129
121
  maps.renderReactTemplates();
130
122
  }
131
123
  }
132
- }
124
+ if (markerTemplateEle.childElementCount === (markerDataLength - markerCount - nullCount) && getElementByID(maps.element.id + '_Secondary_Element')) {
125
+ getElementByID(maps.element.id + '_Secondary_Element').appendChild(markerTemplateEle);
126
+ if (maps.checkInitialRender) {
127
+ if (currentLayer.markerClusterSettings.allowClustering && !isMarkersClustered) {
128
+ clusterTemplate(currentLayer, markerTemplateEle, maps, layerIndex, _this.markerSVGObject, layerElement, false, false);
129
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
+ maps.renderReactTemplates();
131
+ }
132
+ }
133
+ }
134
+ });
133
135
  });
134
- });
136
+ }
135
137
  });
136
138
  };
137
139
  /**
@@ -188,35 +190,37 @@ var Marker = /** @class */ (function () {
188
190
  Array.prototype.forEach.call(currentLayer.markerSettings, function (markerSetting) {
189
191
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
190
192
  var markerData = markerSetting.dataSource;
191
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
192
- Array.prototype.forEach.call(markerData, function (data, dataIndex) {
193
- var latitude = !isNullOrUndefined(data['latitude']) ? parseFloat(data['latitude']) :
194
- !isNullOrUndefined(data['Latitude']) ? parseFloat(data['Latitude']) : null;
195
- var longitude = !isNullOrUndefined(data['longitude']) ? parseFloat(data['longitude']) :
196
- !isNullOrUndefined(data['Longitude']) ? parseFloat(data['Longitude']) : null;
197
- if (!isNullOrUndefined(latitude) && !isNullOrUndefined(longitude)) {
198
- minLong_1 = isNullOrUndefined(minLong_1) && dataIndex === 0 ?
199
- longitude : minLong_1;
200
- maxLat_1 = isNullOrUndefined(maxLat_1) && dataIndex === 0 ?
201
- latitude : maxLat_1;
202
- minLat_1 = isNullOrUndefined(minLat_1) && dataIndex === 0 ?
203
- latitude : minLat_1;
204
- maxLong_1 = isNullOrUndefined(maxLong_1) && dataIndex === 0 ?
205
- longitude : maxLong_1;
206
- if (minLong_1 > longitude) {
207
- minLong_1 = longitude;
208
- }
209
- if (minLat_1 > latitude) {
210
- minLat_1 = latitude;
211
- }
212
- if (maxLong_1 < longitude) {
213
- maxLong_1 = longitude;
214
- }
215
- if (maxLat_1 < latitude) {
216
- maxLat_1 = latitude;
193
+ if (!isNullOrUndefined(markerData) && markerData.length > 0) {
194
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
195
+ Array.prototype.forEach.call(markerData, function (data, dataIndex) {
196
+ var latitude = !isNullOrUndefined(data['latitude']) ? parseFloat(data['latitude']) :
197
+ !isNullOrUndefined(data['Latitude']) ? parseFloat(data['Latitude']) : null;
198
+ var longitude = !isNullOrUndefined(data['longitude']) ? parseFloat(data['longitude']) :
199
+ !isNullOrUndefined(data['Longitude']) ? parseFloat(data['Longitude']) : null;
200
+ if (!isNullOrUndefined(latitude) && !isNullOrUndefined(longitude)) {
201
+ minLong_1 = isNullOrUndefined(minLong_1) && dataIndex === 0 ?
202
+ longitude : minLong_1;
203
+ maxLat_1 = isNullOrUndefined(maxLat_1) && dataIndex === 0 ?
204
+ latitude : maxLat_1;
205
+ minLat_1 = isNullOrUndefined(minLat_1) && dataIndex === 0 ?
206
+ latitude : minLat_1;
207
+ maxLong_1 = isNullOrUndefined(maxLong_1) && dataIndex === 0 ?
208
+ longitude : maxLong_1;
209
+ if (minLong_1 > longitude) {
210
+ minLong_1 = longitude;
211
+ }
212
+ if (minLat_1 > latitude) {
213
+ minLat_1 = latitude;
214
+ }
215
+ if (maxLong_1 < longitude) {
216
+ maxLong_1 = longitude;
217
+ }
218
+ if (maxLat_1 < latitude) {
219
+ maxLat_1 = latitude;
220
+ }
217
221
  }
218
- }
219
- });
222
+ });
223
+ }
220
224
  });
221
225
  }
222
226
  });
@@ -61,7 +61,7 @@ var NavigationLine = /** @class */ (function () {
61
61
  dashArray = navigation[i].dashArray;
62
62
  arrowSettings = navigation[i].arrowSettings;
63
63
  showArrow = !isNullOrUndefined(arrowSettings) ? arrowSettings.showArrow : false;
64
- if (longitude.length === latitude.length && visible) {
64
+ if (!isNullOrUndefined(longitude) && !isNullOrUndefined(latitude) && longitude.length === latitude.length && visible) {
65
65
  for (var i_1 = 0; i_1 < longitude.length; i_1++) {
66
66
  var location_1 = (this.maps.isTileMap) ? convertTileLatLongToPoint(new Point(longitude[i_1], latitude[i_1]), factor, this.maps.tileTranslatePoint, true) : convertGeoToPoint(latitude[i_1], longitude[i_1], factor, layer, this.maps);
67
67
  point.push(location_1);
@@ -1,3 +1,4 @@
1
+ import { isNullOrUndefined } from '@syncfusion/ej2-base';
1
2
  import { PathOption, calculatePolygonPath, maintainSelection } from '../utils/helper';
2
3
  /**
3
4
  * When injected, this module will be used to render polygon shapes over the Maps.
@@ -28,12 +29,14 @@ var Polygon = /** @class */ (function () {
28
29
  id: maps.element.id + '_LayerIndex_' + layerIndex + '_Polygons_Group_' + polygonIndex
29
30
  });
30
31
  var polygonData = polygonSetting.points;
31
- var path = calculatePolygonPath(maps, factor, currentLayer, polygonData);
32
- var pathOptions = new PathOption(maps.element.id + '_LayerIndex_' + layerIndex + '_PolygonIndex_' + polygonIndex, polygonSetting.fill, (polygonSetting.borderWidth / factor), polygonSetting.borderColor, polygonSetting.opacity, polygonSetting.borderOpacity, '', path);
33
- var polygonEle = maps.renderer.drawPath(pathOptions);
34
- maintainSelection(maps.selectedPolygonElementId, maps.polygonSelectionClass, polygonEle, 'PolygonselectionMapStyle');
35
- polygonSVGObject.appendChild(polygonEle);
36
- polygonsSVGObject.appendChild(polygonSVGObject);
32
+ if (!isNullOrUndefined(polygonSetting.points) && polygonSetting.points.length > 0) {
33
+ var path = calculatePolygonPath(maps, factor, currentLayer, polygonData);
34
+ var pathOptions = new PathOption(maps.element.id + '_LayerIndex_' + layerIndex + '_PolygonIndex_' + polygonIndex, polygonSetting.fill, (polygonSetting.borderWidth / factor), polygonSetting.borderColor, polygonSetting.opacity, polygonSetting.borderOpacity, '', path);
35
+ var polygonEle = maps.renderer.drawPath(pathOptions);
36
+ maintainSelection(maps.selectedPolygonElementId, maps.polygonSelectionClass, polygonEle, 'PolygonselectionMapStyle');
37
+ polygonSVGObject.appendChild(polygonEle);
38
+ polygonsSVGObject.appendChild(polygonSVGObject);
39
+ }
37
40
  });
38
41
  return polygonsSVGObject;
39
42
  };
package/src/maps/maps.js CHANGED
@@ -332,7 +332,7 @@ var Maps = /** @class */ (function (_super) {
332
332
  _loop_2(i);
333
333
  }
334
334
  }
335
- if (layer.dataSource instanceof MapAjax || !isNullOrUndefined(layer.dataSource['dataOptions'])) {
335
+ if (layer.dataSource instanceof MapAjax || (!isNullOrUndefined(layer.dataSource) && !isNullOrUndefined(layer.dataSource['dataOptions']))) {
336
336
  _this.processAjaxRequest(layer, layer.dataSource, 'DataSource');
337
337
  }
338
338
  if (_this.serverProcess['request'] === _this.serverProcess['response'] && length === layerIndex) {
@@ -772,8 +772,7 @@ var Maps = /** @class */ (function (_super) {
772
772
  Maps.prototype.createTile = function () {
773
773
  var mainLayer = this.layersCollection[0];
774
774
  var padding = 0;
775
- if (mainLayer.isBaseLayer && (mainLayer.layerType === 'OSM' || mainLayer.layerType === 'Bing' ||
776
- mainLayer.layerType === 'GoogleStaticMap' || mainLayer.layerType === 'Google' || (!isNullOrUndefined(mainLayer.urlTemplate) && mainLayer.urlTemplate !== ''))) {
775
+ if (mainLayer.isBaseLayer && (!isNullOrUndefined(mainLayer.urlTemplate) && mainLayer.urlTemplate !== '' && isNullOrUndefined(mainLayer.shapeData))) {
777
776
  removeElement(this.element.id + '_tile_parent');
778
777
  removeElement(this.element.id + '_tiles');
779
778
  removeElement('animated_tiles');
@@ -824,7 +823,7 @@ var Maps = /** @class */ (function (_super) {
824
823
  var baseLayer = mainLayers[i];
825
824
  if (baseLayer.visible && baseIndex === i) {
826
825
  baseLayer.isBaseLayer = true;
827
- this.isTileMap = (baseLayer.layerType === 'Geometry' && !isNullOrUndefined(baseLayer.shapeData)) ? false : true;
826
+ this.isTileMap = !isNullOrUndefined(baseLayer.shapeData) ? false : true;
828
827
  this.layersCollection.push(baseLayer);
829
828
  break;
830
829
  }
@@ -2110,7 +2109,6 @@ var Maps = /** @class */ (function (_super) {
2110
2109
  var render = false;
2111
2110
  var isMarker = false;
2112
2111
  var isLayer = false;
2113
- var isStaticMapType = false;
2114
2112
  for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
2115
2113
  var prop = _a[_i];
2116
2114
  switch (prop) {
@@ -2132,17 +2130,13 @@ var Maps = /** @class */ (function (_super) {
2132
2130
  var collection = Object.keys(newProp.layers[x]);
2133
2131
  for (var _b = 0, collection_1 = collection; _b < collection_1.length; _b++) {
2134
2132
  var collectionProp = collection_1[_b];
2135
- if ((collectionProp === 'layerType' && newProp.layers[x].layerType !== 'Geometry') ||
2136
- (isNullOrUndefined(this.layers[x].shapeData)
2137
- && !isNullOrUndefined(this.layers[x].urlTemplate) && this.layers[x].urlTemplate !== '')) {
2133
+ if ((isNullOrUndefined(this.layers[x].shapeData)
2134
+ && !isNullOrUndefined(this.layers[x].urlTemplate) && this.layers[x].urlTemplate !== '')) {
2138
2135
  this.isReset = true;
2139
2136
  }
2140
2137
  else if (collectionProp === 'markerSettings') {
2141
2138
  isMarker = true;
2142
2139
  }
2143
- else if (collectionProp === 'staticMapType') {
2144
- isStaticMapType = true;
2145
- }
2146
2140
  }
2147
2141
  }
2148
2142
  }
@@ -2186,9 +2180,6 @@ var Maps = /** @class */ (function (_super) {
2186
2180
  this.render();
2187
2181
  }
2188
2182
  }
2189
- else if (newProp.layers && isStaticMapType) {
2190
- this.mapLayerPanel.renderGoogleMap(this.layers[this.layers.length - 1].key, this.staticMapZoom);
2191
- }
2192
2183
  else {
2193
2184
  this.createSVG();
2194
2185
  this.renderElements();
@@ -2513,7 +2504,7 @@ var Maps = /** @class */ (function (_super) {
2513
2504
  }
2514
2505
  for (var _b = 0, _c = polygonSetting.polygons; _b < _c.length; _b++) {
2515
2506
  var polygon = _c[_b];
2516
- if (polygon.points.length > 0) {
2507
+ if (!isNullOrUndefined(polygon.points) && polygon.points.length > 0) {
2517
2508
  isSelection = layer.polygonSettings.highlightSettings.enable || isSelection;
2518
2509
  isHighlight = layer.polygonSettings.selectionSettings.enable || isHighlight;
2519
2510
  istooltipVisible = layer.polygonSettings.tooltipSettings.visible || istooltipVisible;
@@ -2622,7 +2613,7 @@ var Maps = /** @class */ (function (_super) {
2622
2613
  var latitude = 0;
2623
2614
  var longitude = 0;
2624
2615
  if (!this.isDestroyed && !isNullOrUndefined(this.translatePoint)) {
2625
- var padding = this.layers[this.layers.length - 1].layerType === 'GoogleStaticMap' ? 0 : 10;
2616
+ var padding = 10;
2626
2617
  pageY = pageY + padding;
2627
2618
  var mapSize = 256 * Math.pow(2, this.tileZoomLevel);
2628
2619
  var x1 = (this.clip(pageX - (this.translatePoint.x * this.scale), 0, mapSize - 1) / mapSize) - 0.5;