@syncfusion/ej2-maps 25.2.4 → 26.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/.eslintrc.json +3 -2
  2. package/dist/ej2-maps.min.js +2 -2
  3. package/dist/ej2-maps.umd.min.js +2 -2
  4. package/dist/ej2-maps.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-maps.es2015.js +1328 -1138
  6. package/dist/es6/ej2-maps.es2015.js.map +1 -1
  7. package/dist/es6/ej2-maps.es5.js +1375 -1180
  8. package/dist/es6/ej2-maps.es5.js.map +1 -1
  9. package/dist/global/ej2-maps.min.js +2 -2
  10. package/dist/global/ej2-maps.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +13 -13
  13. package/src/maps/layers/bing-map.d.ts +2 -2
  14. package/src/maps/layers/bubble.d.ts +3 -4
  15. package/src/maps/layers/bubble.js +3 -4
  16. package/src/maps/layers/color-mapping.d.ts +2 -2
  17. package/src/maps/layers/color-mapping.js +2 -2
  18. package/src/maps/layers/data-label.d.ts +1 -1
  19. package/src/maps/layers/data-label.js +6 -6
  20. package/src/maps/layers/layer-panel.d.ts +7 -7
  21. package/src/maps/layers/layer-panel.js +129 -193
  22. package/src/maps/layers/legend.d.ts +9 -0
  23. package/src/maps/layers/legend.js +147 -55
  24. package/src/maps/layers/marker.d.ts +8 -8
  25. package/src/maps/layers/marker.js +109 -105
  26. package/src/maps/layers/navigation-selected-line.d.ts +1 -1
  27. package/src/maps/layers/navigation-selected-line.js +2 -2
  28. package/src/maps/layers/polygon.d.ts +1 -1
  29. package/src/maps/layers/polygon.js +10 -7
  30. package/src/maps/maps.d.ts +24 -26
  31. package/src/maps/maps.js +39 -46
  32. package/src/maps/model/base-model.d.ts +20 -93
  33. package/src/maps/model/base.d.ts +19 -83
  34. package/src/maps/model/base.js +13 -40
  35. package/src/maps/model/constants.d.ts +0 -4
  36. package/src/maps/model/constants.js +0 -4
  37. package/src/maps/model/export-image.js +5 -2
  38. package/src/maps/model/export-pdf.js +5 -2
  39. package/src/maps/model/interface.d.ts +14 -1
  40. package/src/maps/model/interface.js +0 -1
  41. package/src/maps/model/print.d.ts +3 -3
  42. package/src/maps/model/print.js +8 -5
  43. package/src/maps/model/theme.d.ts +1 -1
  44. package/src/maps/model/theme.js +190 -15
  45. package/src/maps/user-interaction/annotation.d.ts +1 -2
  46. package/src/maps/user-interaction/annotation.js +1 -2
  47. package/src/maps/user-interaction/highlight.d.ts +4 -4
  48. package/src/maps/user-interaction/highlight.js +4 -4
  49. package/src/maps/user-interaction/selection.d.ts +5 -5
  50. package/src/maps/user-interaction/selection.js +5 -5
  51. package/src/maps/user-interaction/tooltip.d.ts +6 -6
  52. package/src/maps/user-interaction/tooltip.js +30 -13
  53. package/src/maps/user-interaction/zoom.d.ts +6 -4
  54. package/src/maps/user-interaction/zoom.js +50 -50
  55. package/src/maps/utils/enum.d.ts +7 -53
  56. package/src/maps/utils/helper.d.ts +87 -72
  57. package/src/maps/utils/helper.js +130 -102
  58. package/CHANGELOG.md +0 -632
@@ -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
  /**
@@ -159,7 +161,7 @@ var Marker = /** @class */ (function () {
159
161
  return scaleFactor;
160
162
  };
161
163
  /**
162
- * To calculate center position and factor value dynamically
164
+ * To calculate center position and factor value dynamically.
163
165
  *
164
166
  * @param {LayerSettings[]} layersCollection - Specifies the layer settings instance.
165
167
  * @returns {void}
@@ -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
  });
@@ -288,7 +292,7 @@ var Marker = /** @class */ (function () {
288
292
  }
289
293
  };
290
294
  /**
291
- * To check and trigger marker click event
295
+ * To check and trigger marker click event.
292
296
  *
293
297
  * @param {PointerEvent} e - Specifies the pointer event argument.
294
298
  * @returns {void}
@@ -350,7 +354,7 @@ var Marker = /** @class */ (function () {
350
354
  }
351
355
  };
352
356
  /**
353
- * To check and trigger Cluster click event
357
+ * To check and trigger Cluster click event.
354
358
  *
355
359
  * @param {PointerEvent} e - Specifies the pointer event argument.
356
360
  * @returns {void}
@@ -389,7 +393,7 @@ var Marker = /** @class */ (function () {
389
393
  this.maps.trigger(markerClusterClick, eventArgs);
390
394
  };
391
395
  /**
392
- * To get marker from target id
396
+ * To get marker from target id.
393
397
  *
394
398
  * @param {string} target - Specifies the target
395
399
  * @returns {object} - Returns the marker, data, clusterCollection, markCollection
@@ -445,7 +449,7 @@ var Marker = /** @class */ (function () {
445
449
  return null;
446
450
  };
447
451
  /**
448
- * To check and trigger marker move event
452
+ * To check and trigger marker move event.
449
453
  *
450
454
  * @param {PointerEvent} e - Specifies the pointer event argument.
451
455
  * @returns {void}
@@ -471,7 +475,7 @@ var Marker = /** @class */ (function () {
471
475
  this.maps.trigger(markerMouseMove, eventArgs);
472
476
  };
473
477
  /**
474
- * To check and trigger cluster move event
478
+ * To check and trigger cluster move event.
475
479
  *
476
480
  * @param {PointerEvent} e - Specifies the pointer event argument.
477
481
  * @returns {void}
@@ -495,8 +499,8 @@ var Marker = /** @class */ (function () {
495
499
  };
496
500
  this.maps.trigger(markerClusterMouseMove, eventArgs);
497
501
  };
498
- /** @private
499
- *
502
+ /**
503
+ * @private
500
504
  * @returns {void}
501
505
  */
502
506
  Marker.prototype.initializeMarkerClusterList = function () {
@@ -7,7 +7,7 @@ export declare class NavigationLine {
7
7
  private maps;
8
8
  constructor(maps: Maps);
9
9
  /**
10
- * To render navigation line for maps
10
+ * To render navigation line for maps.
11
11
  *
12
12
  * @param {LayerSettings} layer - Specifies the layer instance to which the navigation line is to be rendered.
13
13
  * @param {number} factor - Specifies the current zoom factor of the Maps.
@@ -9,7 +9,7 @@ var NavigationLine = /** @class */ (function () {
9
9
  this.maps = maps;
10
10
  }
11
11
  /**
12
- * To render navigation line for maps
12
+ * To render navigation line for maps.
13
13
  *
14
14
  * @param {LayerSettings} layer - Specifies the layer instance to which the navigation line is to be rendered.
15
15
  * @param {number} factor - Specifies the current zoom factor of the Maps.
@@ -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);
@@ -5,7 +5,7 @@ import { Maps } from '../../index';
5
5
  export declare class Polygon {
6
6
  constructor(maps: Maps);
7
7
  /**
8
- * To render polygon for maps
8
+ * To render polygon for maps.
9
9
  *
10
10
  * @param {Maps} maps - Specifies the layer instance to which the polygon is to be rendered.
11
11
  * @param {number} layerIndex -Specifies the index of current layer.
@@ -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.
@@ -10,7 +11,7 @@ var Polygon = /** @class */ (function () {
10
11
  /* eslint-enable @typescript-eslint/no-unused-vars */
11
12
  /* eslint-enable @typescript-eslint/no-empty-function */
12
13
  /**
13
- * To render polygon for maps
14
+ * To render polygon for maps.
14
15
  *
15
16
  * @param {Maps} maps - Specifies the layer instance to which the polygon is to be rendered.
16
17
  * @param {number} layerIndex -Specifies the index of current layer.
@@ -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
  };
@@ -519,7 +519,7 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
519
519
  */
520
520
  intl: Internationalization;
521
521
  /**
522
- * Check layer whether is geometry or tile
522
+ * Check layer whether is geometry or tile.
523
523
  *
524
524
  * @private
525
525
  */
@@ -709,7 +709,7 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
709
709
  /** @private */
710
710
  toggledLegendId: number[];
711
711
  /** @private */
712
- toggledShapeElementId: string[];
712
+ toggledElementId: string[];
713
713
  /** @private */
714
714
  checkInitialRender: boolean;
715
715
  /** @private */
@@ -745,14 +745,14 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
745
745
  /** @private */
746
746
  markerDragArgument: any;
747
747
  /**
748
- * Constructor for creating the widget
748
+ * Constructor for creating the widget.
749
749
  *
750
750
  * @param {MapsModel} options Specifies the options
751
751
  * @param {string | HTMLElement} element Specifies the element
752
752
  */
753
753
  constructor(options?: MapsModel, element?: string | HTMLElement);
754
754
  /**
755
- * To manage persist maps data
755
+ * To manage persist maps data.
756
756
  *
757
757
  * @returns {void}
758
758
  */
@@ -794,7 +794,7 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
794
794
  private renderMap;
795
795
  private triggerZoomEvent;
796
796
  /**
797
- * To apply color to the initial selected marker
797
+ * To apply color to the initial selected marker.
798
798
  *
799
799
  * @param {SelectionSettingsModel} selectionSettings - Specifies the selection settings
800
800
  * @param {Maps} map - Specifies the instance of the maps
@@ -805,7 +805,7 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
805
805
  */
806
806
  markerSelection(selectionSettings: SelectionSettingsModel, map: Maps, targetElement: Element, data: object): void;
807
807
  /**
808
- * initial selection of marker
808
+ * initial selection of marker.
809
809
  *
810
810
  * @param {number} layerIndex - Specifies the layer index
811
811
  * @param {number} markerIndex - Specifies the marker index
@@ -817,13 +817,13 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
817
817
  */
818
818
  markerInitialSelection(layerIndex: number, markerIndex: number, markerSettings: MarkerSettingsModel, latitude: number, longitude: number): void;
819
819
  /**
820
- * Render the map area border
820
+ * Render the map area border.
821
821
  *
822
822
  * @returns {void}
823
823
  */
824
824
  private renderArea;
825
825
  /**
826
- * To add tab index for map element
826
+ * To add tab index for map element.
827
827
  *
828
828
  * @returns {void}
829
829
  */
@@ -849,14 +849,14 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
849
849
  private initPrivateVariable;
850
850
  private findBaseAndSubLayers;
851
851
  /**
852
- * Render the map border
852
+ * Render the map border.
853
853
  *
854
854
  * @private
855
855
  * @returns {void}
856
856
  */
857
857
  private renderBorder;
858
858
  /**
859
- * Render the title and subtitle
859
+ * Render the title and subtitle.
860
860
  *
861
861
  * @param {TitleSettingsModel} title - Specifies the title
862
862
  * @param {string} type - Specifies the type
@@ -867,13 +867,13 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
867
867
  */
868
868
  private renderTitle;
869
869
  /**
870
- * To create svg element for maps
870
+ * To create svg element for maps.
871
871
  *
872
872
  * @returns {void}
873
873
  */
874
874
  private createSVG;
875
875
  /**
876
- * To Remove the SVG
876
+ * To Remove the SVG.
877
877
  *
878
878
  * @returns {void}
879
879
  */
@@ -921,7 +921,7 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
921
921
  private triggerShapeSelection;
922
922
  private getMarkerClickLocation;
923
923
  /**
924
- * Gets the location of the mouse click
924
+ * Gets the location of the mouse click.
925
925
  *
926
926
  * @param {string} targetId - Specifies the ID for the target.
927
927
  * @param {number} pageX - Defines the page X position.
@@ -930,10 +930,8 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
930
930
  * @param {number} x - Defines the x position in pixel.
931
931
  * @param {number} y - Defines the y position in pixel.
932
932
  * @param {string} type - Specifies the type.
933
- * @returns {GeoPosition} - Returns the position of the event
934
- *
933
+ * @returns {GeoPosition} - Returns the position of the event.
935
934
  * @private
936
- *
937
935
  */
938
936
  getClickLocation(targetId: string, pageX: number, pageY: number, targetElement: HTMLElement, x: number, y: number, type?: string): GeoPosition;
939
937
  private removeTileMap;
@@ -1017,7 +1015,7 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
1017
1015
  /**
1018
1016
  * This method is used to add the layers dynamically to the maps.
1019
1017
  *
1020
- * @param {Object} layer - Specifies the layer to be added in the maps.
1018
+ * @param {object} layer - Specifies the layer to be added in the maps.
1021
1019
  * @returns {void}
1022
1020
  */
1023
1021
  addLayer(layer: Object): void;
@@ -1083,7 +1081,7 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
1083
1081
  */
1084
1082
  destroy(): void;
1085
1083
  /**
1086
- * Gets component name
1084
+ * Gets component name.
1087
1085
  *
1088
1086
  * @returns {string} - Returns the string value
1089
1087
  * @private
@@ -1106,44 +1104,44 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
1106
1104
  */
1107
1105
  onPropertyChanged(newProp: MapsModel, oldProp: MapsModel): void;
1108
1106
  /**
1109
- * To provide the array of modules needed for maps rendering
1107
+ * To provide the array of modules needed for maps rendering.
1110
1108
  *
1111
1109
  * @returns {ModuleDeclaration[]} - Returns the modules
1112
1110
  * @private
1113
1111
  */
1114
1112
  requiredModules(): ModuleDeclaration[];
1115
1113
  /**
1116
- * To find marker visibility
1114
+ * To find marker visibility.
1117
1115
  *
1118
1116
  * @returns {boolean} - Returns whether the markers are visible or not.
1119
1117
  */
1120
1118
  private isMarkersVisible;
1121
1119
  /**
1122
- * To find DataLabel visibility
1120
+ * To find DataLabel visibility.
1123
1121
  *
1124
1122
  * @returns {boolean} - Returns whether the data labels are visible or not.
1125
1123
  */
1126
1124
  private isDataLabelVisible;
1127
1125
  /**
1128
- * To find navigation line visibility
1126
+ * To find navigation line visibility.
1129
1127
  *
1130
1128
  * @returns {boolean} - Returns whether the navigation lines are visible or not.
1131
1129
  */
1132
1130
  private isNavigationVisible;
1133
1131
  /**
1134
- * To find navigation line visibility
1132
+ * To find navigation line visibility.
1135
1133
  *
1136
1134
  * @returns {boolean} - Returns whether the navigation lines are visible or not.
1137
1135
  */
1138
1136
  private isPolygonVisible;
1139
1137
  /**
1140
- * To find marker visibility
1138
+ * To find marker visibility.
1141
1139
  *
1142
1140
  * @returns {boolean} - Returns whether the bubble is visible or not.
1143
1141
  */
1144
1142
  private isBubbleVisible;
1145
1143
  /**
1146
- * To find the bubble visibility from layer
1144
+ * To find the bubble visibility from layer.
1147
1145
  *
1148
1146
  * @param {LayerSettingsModel} layer - Spcifies the layer settings model
1149
1147
  * @returns {boolean} - Returns the boolean value
@@ -1209,7 +1207,7 @@ export declare class Maps extends Component<HTMLElement> implements INotifyPrope
1209
1207
  *
1210
1208
  * @param {number} pageX - Specifies the x position value in pixels.
1211
1209
  * @param {number} pageY - Specifies the y position value in pixels.
1212
- * @returns {Object} - Returns the latitude and longitude values.
1210
+ * @returns {object} - Returns the latitude and longitude values.
1213
1211
  */
1214
1212
  pointToLatLong(pageX: number, pageY: number): Object;
1215
1213
  }