@syncfusion/ej2-maps 23.2.7 → 24.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -1
- package/README.md +1 -1
- package/dist/ej2-maps.min.js +2 -2
- package/dist/ej2-maps.umd.min.js +2 -2
- package/dist/ej2-maps.umd.min.js.map +1 -1
- package/dist/es6/ej2-maps.es2015.js +1122 -821
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +1190 -861
- package/dist/es6/ej2-maps.es5.js.map +1 -1
- package/dist/global/ej2-maps.min.js +2 -2
- package/dist/global/ej2-maps.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -13
- package/src/global.js +1 -1
- package/src/maps/index.d.ts +1 -0
- package/src/maps/index.js +1 -0
- package/src/maps/layers/layer-panel.js +14 -3
- package/src/maps/layers/legend.js +1 -1
- package/src/maps/layers/marker.js +51 -35
- package/src/maps/layers/polygon.d.ts +31 -0
- package/src/maps/layers/polygon.js +58 -0
- package/src/maps/maps-model.d.ts +1 -1
- package/src/maps/maps.d.ts +25 -1
- package/src/maps/maps.js +79 -15
- package/src/maps/model/base-model.d.ts +112 -25
- package/src/maps/model/base.d.ts +80 -7
- package/src/maps/model/base.js +56 -0
- package/src/maps/model/interface.d.ts +24 -3
- package/src/maps/user-interaction/highlight.js +6 -0
- package/src/maps/user-interaction/selection.js +13 -0
- package/src/maps/user-interaction/tooltip.js +13 -21
- package/src/maps/user-interaction/zoom.js +131 -59
- package/src/maps/utils/helper.d.ts +19 -1
- package/src/maps/utils/helper.js +124 -81
|
@@ -199,6 +199,25 @@ function convertGeoToPoint(latitude, longitude, factor, layer, mapModel) {
|
|
|
199
199
|
}
|
|
200
200
|
return new Point(x, y);
|
|
201
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* @private
|
|
204
|
+
*/
|
|
205
|
+
function calculatePolygonPath(maps, factor, currentLayer, markerData) {
|
|
206
|
+
let path = '';
|
|
207
|
+
Array.prototype.forEach.call(markerData, (data, dataIndex) => {
|
|
208
|
+
let lat = data.latitude;
|
|
209
|
+
let lng = data.longitude;
|
|
210
|
+
let location = (maps.isTileMap) ? convertTileLatLongToPoint(new MapLocation(lng, lat), factor, maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, currentLayer, maps);
|
|
211
|
+
if (dataIndex === 0) {
|
|
212
|
+
path += 'M ' + location.x + ' ' + location.y;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
path += ' L ' + location.x + ' ' + location.y;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
path += ' z ';
|
|
219
|
+
return path;
|
|
220
|
+
}
|
|
202
221
|
/**
|
|
203
222
|
* Converting tile latitude and longitude to point
|
|
204
223
|
*
|
|
@@ -340,6 +359,15 @@ class Point {
|
|
|
340
359
|
this.y = y;
|
|
341
360
|
}
|
|
342
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Defines the latitude and longitude values that define a map location.
|
|
364
|
+
*/
|
|
365
|
+
class Coordinate {
|
|
366
|
+
constructor(latitude, longitude) {
|
|
367
|
+
this.latitude = latitude;
|
|
368
|
+
this.longitude = longitude;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
343
371
|
/**
|
|
344
372
|
* Map internal class for min and max
|
|
345
373
|
*
|
|
@@ -894,45 +922,49 @@ function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex, markerC
|
|
|
894
922
|
width: clusters.width, imageUrl: clusters.imageUrl, shape: clusters.shape,
|
|
895
923
|
data: data, maps: maps, cluster: clusters, border: clusters.border
|
|
896
924
|
};
|
|
925
|
+
const containerRect = maps.element.getBoundingClientRect();
|
|
926
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
927
|
+
const translatePoint = (maps.isTileMap) ? new Object() : getTranslate(maps, currentLayer, false);
|
|
928
|
+
let factor;
|
|
929
|
+
if (!maps.isTileMap) {
|
|
930
|
+
factor = maps.mapLayerPanel.calculateFactor(currentLayer);
|
|
931
|
+
}
|
|
932
|
+
let isClusteringCompleted = false;
|
|
897
933
|
maps.trigger('markerClusterRendering', eventArg, (clusterargs) => {
|
|
898
|
-
|
|
934
|
+
Array.prototype.forEach.call(markerTemplate.childNodes, (markerElement, o) => {
|
|
899
935
|
indexCollection = [];
|
|
900
|
-
if (
|
|
901
|
-
tempElement =
|
|
936
|
+
if (markerElement['style']['visibility'] !== 'hidden') {
|
|
937
|
+
tempElement = markerElement;
|
|
902
938
|
bounds1 = tempElement.getBoundingClientRect();
|
|
903
939
|
indexCollection.push(o);
|
|
904
940
|
if (!isNullOrUndefined(bounds1)) {
|
|
905
|
-
|
|
906
|
-
if (
|
|
907
|
-
tempElement =
|
|
941
|
+
Array.prototype.forEach.call(markerTemplate.childNodes, (otherMarkerElement, p) => {
|
|
942
|
+
if (p >= o + 1 && otherMarkerElement['style']['visibility'] !== 'hidden') {
|
|
943
|
+
tempElement = otherMarkerElement;
|
|
908
944
|
bounds2 = tempElement.getBoundingClientRect();
|
|
909
945
|
if (!isNullOrUndefined(bounds2)) {
|
|
910
946
|
if (!(bounds1.left > bounds2.right || bounds1.right < bounds2.left
|
|
911
947
|
|| bounds1.top > bounds2.bottom || bounds1.bottom < bounds2.top)) {
|
|
912
948
|
colloideBounds.push(bounds2);
|
|
913
|
-
|
|
949
|
+
otherMarkerElement['style']['visibility'] = 'hidden';
|
|
914
950
|
indexCollection.push(p);
|
|
915
951
|
}
|
|
916
952
|
}
|
|
917
953
|
}
|
|
918
|
-
}
|
|
954
|
+
});
|
|
919
955
|
tempX = bounds1.left + bounds1.width / 2;
|
|
920
956
|
tempY = bounds1.top + bounds1.height;
|
|
921
957
|
if (colloideBounds.length > 0) {
|
|
922
958
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
923
959
|
indexCollection = indexCollection.filter((item, index, value) => value.indexOf(item) === index);
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
const translate = (maps.isTileMap) ? new Object() : getTranslate(maps, currentLayer, false);
|
|
930
|
-
const dataIndex = parseInt(markerTemplate.childNodes[o]['id'].split('_dataIndex_')[1].split('_')[0], 10);
|
|
931
|
-
const markerIndex = parseInt(markerTemplate.childNodes[o]['id'].split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
960
|
+
tempX = tempX - containerRect['left'];
|
|
961
|
+
tempY = (tempY - ((maps.availableSize.height <= containerRect['height']) ?
|
|
962
|
+
containerRect['top'] : (containerRect['bottom'] - containerRect['top'])));
|
|
963
|
+
const dataIndex = parseInt(markerElement['id'].split('_dataIndex_')[1].split('_')[0], 10);
|
|
964
|
+
const markerIndex = parseInt(markerElement['id'].split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
932
965
|
const markerSetting = currentLayer.markerSettings[markerIndex];
|
|
933
966
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
934
967
|
const markerData = markerSetting.dataSource[dataIndex];
|
|
935
|
-
let factor;
|
|
936
968
|
let location;
|
|
937
969
|
const longitude = (!isNullOrUndefined(markerSetting.longitudeValuePath)) ?
|
|
938
970
|
Number(getValueFromObject(markerData, markerSetting.longitudeValuePath)) :
|
|
@@ -943,44 +975,29 @@ function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex, markerC
|
|
|
943
975
|
!isNullOrUndefined(markerData['latitude']) ? parseFloat(markerData['latitude']) :
|
|
944
976
|
!isNullOrUndefined(markerData['Latitude']) ? parseFloat(markerData['Latitude']) : 0;
|
|
945
977
|
if (!maps.isTileMap) {
|
|
946
|
-
factor = maps.mapLayerPanel.calculateFactor(currentLayer);
|
|
947
978
|
location = convertGeoToPoint(latitude, longitude, factor, currentLayer, maps);
|
|
948
979
|
}
|
|
949
980
|
else if (maps.isTileMap && !maps.zoomSettings.enable) {
|
|
950
981
|
location = convertTileLatLongToPoint(new Point(longitude, latitude), maps.tileZoomLevel, maps.tileTranslatePoint, true);
|
|
951
982
|
}
|
|
952
|
-
|
|
953
|
-
const clusters = currentLayer.markerClusterSettings;
|
|
983
|
+
markerElement['style']['visibility'] = 'hidden';
|
|
954
984
|
if (eventArg.cancel) {
|
|
955
985
|
shapeCustom = {
|
|
956
986
|
size: new Size(clusters.width, clusters.height),
|
|
957
987
|
fill: clusters.fill, borderColor: clusters.border.color,
|
|
958
988
|
borderWidth: clusters.border.width, opacity: clusters.opacity,
|
|
959
|
-
dashArray: clusters.dashArray
|
|
989
|
+
dashArray: clusters.dashArray, imageUrl: clusters.imageUrl, shape: clusters.shape
|
|
960
990
|
};
|
|
961
|
-
shapeCustom['fill'] = clusters.fill;
|
|
962
|
-
shapeCustom['size']['width'] = clusters.width;
|
|
963
|
-
shapeCustom['size']['height'] = clusters.height;
|
|
964
|
-
shapeCustom['imageUrl'] = clusters.imageUrl;
|
|
965
|
-
shapeCustom['shape'] = clusters.shape;
|
|
966
|
-
shapeCustom['borderColor'] = clusters.border.color;
|
|
967
|
-
shapeCustom['borderWidth'] = clusters.border.width;
|
|
968
991
|
shapeCustom['borderOpacity'] = isNullOrUndefined(clusters.border.opacity) ? clusters.opacity : clusters.border.opacity;
|
|
969
992
|
}
|
|
970
993
|
else {
|
|
971
994
|
shapeCustom = {
|
|
972
|
-
size: new Size(
|
|
973
|
-
fill:
|
|
974
|
-
borderWidth:
|
|
975
|
-
dashArray: clusters.dashArray
|
|
995
|
+
size: new Size(eventArg.width, eventArg.height),
|
|
996
|
+
fill: eventArg.fill, borderColor: eventArg.border.color,
|
|
997
|
+
borderWidth: eventArg.border.width, opacity: clusters.opacity,
|
|
998
|
+
dashArray: clusters.dashArray, imageUrl: eventArg.imageUrl,
|
|
999
|
+
shape: eventArg.shape
|
|
976
1000
|
};
|
|
977
|
-
shapeCustom['fill'] = eventArg.fill;
|
|
978
|
-
shapeCustom['size']['width'] = eventArg.width;
|
|
979
|
-
shapeCustom['size']['height'] = eventArg.height;
|
|
980
|
-
shapeCustom['imageUrl'] = eventArg.imageUrl;
|
|
981
|
-
shapeCustom['shape'] = eventArg.shape;
|
|
982
|
-
shapeCustom['borderColor'] = eventArg.border.color;
|
|
983
|
-
shapeCustom['borderWidth'] = eventArg.border.width;
|
|
984
1001
|
shapeCustom['borderOpacity'] = isNullOrUndefined(eventArg.border.opacity) ? clusters.opacity : eventArg.border.opacity;
|
|
985
1002
|
}
|
|
986
1003
|
tempX = (maps.isTileMap) ? tempX : (markerTemplate.id.indexOf('_Markers_Group') > -1) ? tempX : tempX + postionY - (eventArg.width / 2);
|
|
@@ -1009,48 +1026,51 @@ function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex, markerC
|
|
|
1009
1026
|
}
|
|
1010
1027
|
colloideBounds = [];
|
|
1011
1028
|
}
|
|
1012
|
-
|
|
1029
|
+
isClusteringCompleted = true;
|
|
1030
|
+
});
|
|
1013
1031
|
layerElement.appendChild(clusterGroup);
|
|
1014
1032
|
maps.svgObject.appendChild(layerElement);
|
|
1015
1033
|
maps.element.appendChild(maps.svgObject);
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
if (!(
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1034
|
+
if (clusters.allowDeepClustering) {
|
|
1035
|
+
Array.prototype.forEach.call(clusterGroup.childNodes, (clusterElement, o) => {
|
|
1036
|
+
if (clusterElement['style']['visibility'] !== 'hidden') {
|
|
1037
|
+
tempElement = clusterElement;
|
|
1038
|
+
bounds1 = tempElement.getBoundingClientRect();
|
|
1039
|
+
if (!isNullOrUndefined(bounds1) && !(tempElement.id.indexOf('_datalabel_') > -1)) {
|
|
1040
|
+
for (let p = o + 1; p < clusterGroup.childElementCount; p++) {
|
|
1041
|
+
if (clusterGroup.childNodes[p]['style']['visibility'] !== 'hidden') {
|
|
1042
|
+
tempElement1 = clusterGroup.childNodes[p];
|
|
1043
|
+
bounds2 = tempElement1.getBoundingClientRect();
|
|
1044
|
+
if (!isNullOrUndefined(bounds2) && !(tempElement1.id.indexOf('_datalabel_') > -1)) {
|
|
1045
|
+
if (!(bounds1.left > bounds2.right || bounds1.right < bounds2.left
|
|
1046
|
+
|| bounds1.top > bounds2.bottom || bounds1.bottom < bounds2.top)) {
|
|
1047
|
+
clusterColloideBounds.push(tempElement1);
|
|
1048
|
+
clusterColloideBounds.push(clusterGroup.childNodes[p - 1]);
|
|
1049
|
+
clusterGroup.childNodes[p]['style']['visibility'] = 'hidden';
|
|
1050
|
+
clusterGroup.childNodes[p - 1]['style']['visibility'] = 'hidden';
|
|
1051
|
+
indexCollection.push(p);
|
|
1052
|
+
}
|
|
1033
1053
|
}
|
|
1034
1054
|
}
|
|
1035
1055
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1056
|
+
if (clusterColloideBounds.length > 0) {
|
|
1057
|
+
tempElement = clusterElement;
|
|
1058
|
+
for (let i = 0; i < clusterColloideBounds.length; i++) {
|
|
1059
|
+
if (tempElement.tagName === 'g') {
|
|
1060
|
+
tempElement.childNodes[0].textContent = tempElement.childNodes[0].textContent + ',' +
|
|
1061
|
+
clusterColloideBounds[i].textContent;
|
|
1062
|
+
}
|
|
1063
|
+
else {
|
|
1064
|
+
tempElement.textContent = tempElement.textContent + ',' + clusterColloideBounds[i].textContent;
|
|
1065
|
+
}
|
|
1066
|
+
clusterGroup.childNodes[o - 1].textContent = ((+(clusterGroup.childNodes[o - 1].textContent)) + (+(clusterColloideBounds[i + 1].textContent))).toString();
|
|
1067
|
+
i++;
|
|
1046
1068
|
}
|
|
1047
|
-
clusterGroup.childNodes[o - 1].textContent = ((+(clusterGroup.childNodes[o - 1].textContent)) + (+(clusterColloideBounds[i + 1].textContent))).toString();
|
|
1048
|
-
i++;
|
|
1049
1069
|
}
|
|
1070
|
+
clusterColloideBounds = [];
|
|
1050
1071
|
}
|
|
1051
|
-
clusterColloideBounds = [];
|
|
1052
1072
|
}
|
|
1053
|
-
}
|
|
1073
|
+
});
|
|
1054
1074
|
}
|
|
1055
1075
|
while (0 < clusterGroup.childNodes.length) {
|
|
1056
1076
|
markerCollection.insertBefore(clusterGroup.childNodes[0], markerCollection.firstChild);
|
|
@@ -1059,12 +1079,24 @@ function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex, markerC
|
|
|
1059
1079
|
getElementByID(maps.element.id + '_Secondary_Element').appendChild(markerCollection);
|
|
1060
1080
|
}
|
|
1061
1081
|
const element = document.getElementById(maps.element.id + '_LayerIndex_' + layerIndex + '_Polygon_Group');
|
|
1062
|
-
|
|
1082
|
+
const polygonElement = document.getElementById(maps.element.id + '_LayerIndex_' + layerIndex + '_Polygons_Group');
|
|
1083
|
+
if (isNullOrUndefined(element) && !maps.isTileMap) {
|
|
1063
1084
|
layerElement.insertBefore(markerCollection, layerElement.firstChild);
|
|
1064
1085
|
}
|
|
1065
|
-
else {
|
|
1086
|
+
else if (!maps.isTileMap) {
|
|
1066
1087
|
layerElement.appendChild(markerCollection);
|
|
1067
1088
|
}
|
|
1089
|
+
else {
|
|
1090
|
+
if (!isNullOrUndefined(polygonElement)) {
|
|
1091
|
+
polygonElement.insertAdjacentElement('afterend', markerCollection);
|
|
1092
|
+
}
|
|
1093
|
+
else if (!isNullOrUndefined(element)) {
|
|
1094
|
+
element.insertAdjacentElement('afterend', markerCollection);
|
|
1095
|
+
}
|
|
1096
|
+
else {
|
|
1097
|
+
layerElement.insertBefore(markerCollection, layerElement.firstChild);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1068
1100
|
const markerCluster = document.getElementById(maps.element.id + '_LayerIndex_' + layerIndex + '_markerCluster');
|
|
1069
1101
|
if (!isNullOrUndefined(markerCluster)) {
|
|
1070
1102
|
markerCluster.remove();
|
|
@@ -1080,6 +1112,7 @@ function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex, markerC
|
|
|
1080
1112
|
}
|
|
1081
1113
|
}
|
|
1082
1114
|
});
|
|
1115
|
+
return isClusteringCompleted;
|
|
1083
1116
|
}
|
|
1084
1117
|
/**
|
|
1085
1118
|
*
|
|
@@ -1596,7 +1629,7 @@ function drawBalloon(maps, options, size, location, type, element) {
|
|
|
1596
1629
|
const height = size.height;
|
|
1597
1630
|
let pathElement;
|
|
1598
1631
|
location.x -= width / 2;
|
|
1599
|
-
location.y -= height / 2;
|
|
1632
|
+
location.y -= ((options.id.indexOf('cluster') > -1) ? (height / 2) : options.id.indexOf('Legend') > -1 ? height / 1.25 : height);
|
|
1600
1633
|
options.d = 'M15,0C8.8,0,3.8,5,3.8,11.2C3.8,17.5,9.4,24.4,15,30c5.6-5.6,11.2-12.5,11.2-18.8C26.2,5,21.2,0,15,0z M15,16' +
|
|
1601
1634
|
'c-2.8,0-5-2.2-5-5s2.2-5,5-5s5,2.2,5,5S17.8,16,15,16z';
|
|
1602
1635
|
const balloon = maps.renderer.drawPath(options);
|
|
@@ -2002,7 +2035,8 @@ function getTranslate(mapObject, layer, animate) {
|
|
|
2002
2035
|
const topPosition = (((mapHeight + Math.abs(mapObject.mapAreaRect.height - mapHeight)) / 2) + mapObject.mapAreaRect.y) / factor;
|
|
2003
2036
|
const point = checkMethodeZoom ? calculateCenterFromPixel(mapObject, layer) :
|
|
2004
2037
|
convertGeoToPoint(centerLatitude, centerLongitude, mapObject.mapLayerPanel.calculateFactor(layer), layer, mapObject);
|
|
2005
|
-
if (isNullOrUndefined(mapObject.previousProjection) || mapObject.previousProjection !== mapObject.projectionType
|
|
2038
|
+
if (isNullOrUndefined(mapObject.previousProjection) || mapObject.previousProjection !== mapObject.projectionType
|
|
2039
|
+
|| mapObject.isMarkerZoomCompleted) {
|
|
2006
2040
|
x = -point.x + leftPosition;
|
|
2007
2041
|
y = -point.y + topPosition;
|
|
2008
2042
|
scaleFactor = zoomFactor;
|
|
@@ -2970,6 +3004,13 @@ function changeBorderWidth(element, index, scale, maps) {
|
|
|
2970
3004
|
if (childNode.id.indexOf('_NavigationGroup') > -1) {
|
|
2971
3005
|
changeNavaigationLineWidth(childNode, index, scale, maps);
|
|
2972
3006
|
}
|
|
3007
|
+
else if (childNode.id.indexOf('_Polygons_Group') > -1) {
|
|
3008
|
+
for (var i = 0; i < childNode.childElementCount; i++) {
|
|
3009
|
+
// eslint-disable-next-line
|
|
3010
|
+
const width = maps.layersCollection[index].polygonSettings.polygons[parseInt(childNode.children[i].id.split('_PolygonIndex_')[1])].borderWidth;
|
|
3011
|
+
childNode.children[i].setAttribute('stroke-width', (width / scale).toString());
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
2973
3014
|
else {
|
|
2974
3015
|
let currentStroke;
|
|
2975
3016
|
let value = 0;
|
|
@@ -4281,6 +4322,9 @@ class MarkerClusterSettings extends ChildProperty {
|
|
|
4281
4322
|
__decorate$1([
|
|
4282
4323
|
Property(false)
|
|
4283
4324
|
], MarkerClusterSettings.prototype, "allowClustering", void 0);
|
|
4325
|
+
__decorate$1([
|
|
4326
|
+
Property(true)
|
|
4327
|
+
], MarkerClusterSettings.prototype, "allowDeepClustering", void 0);
|
|
4284
4328
|
__decorate$1([
|
|
4285
4329
|
Complex({ color: 'transparent', width: 1 }, Border)
|
|
4286
4330
|
], MarkerClusterSettings.prototype, "border", void 0);
|
|
@@ -4412,6 +4456,44 @@ __decorate$1([
|
|
|
4412
4456
|
__decorate$1([
|
|
4413
4457
|
Complex({ color: 'transparent', width: 0 }, Border)
|
|
4414
4458
|
], HighlightSettings.prototype, "border", void 0);
|
|
4459
|
+
/**
|
|
4460
|
+
* Defines the properties for a single polygon shape to render over the Maps, such as coordinates, fill, border, and opacity.
|
|
4461
|
+
*/
|
|
4462
|
+
class PolygonSetting extends ChildProperty {
|
|
4463
|
+
}
|
|
4464
|
+
__decorate$1([
|
|
4465
|
+
Property(1)
|
|
4466
|
+
], PolygonSetting.prototype, "borderWidth", void 0);
|
|
4467
|
+
__decorate$1([
|
|
4468
|
+
Property(1)
|
|
4469
|
+
], PolygonSetting.prototype, "borderOpacity", void 0);
|
|
4470
|
+
__decorate$1([
|
|
4471
|
+
Property(1)
|
|
4472
|
+
], PolygonSetting.prototype, "opacity", void 0);
|
|
4473
|
+
__decorate$1([
|
|
4474
|
+
Property('#FF471A')
|
|
4475
|
+
], PolygonSetting.prototype, "borderColor", void 0);
|
|
4476
|
+
__decorate$1([
|
|
4477
|
+
Property('#FF471A')
|
|
4478
|
+
], PolygonSetting.prototype, "fill", void 0);
|
|
4479
|
+
__decorate$1([
|
|
4480
|
+
Property([])
|
|
4481
|
+
], PolygonSetting.prototype, "points", void 0);
|
|
4482
|
+
/**
|
|
4483
|
+
* Defines the properties of the polygon shapes that will be rendered on a map layer.
|
|
4484
|
+
* The selection and highlight settings for polygon shapes can also be defined.
|
|
4485
|
+
*/
|
|
4486
|
+
class PolygonSettings extends ChildProperty {
|
|
4487
|
+
}
|
|
4488
|
+
__decorate$1([
|
|
4489
|
+
Collection([], PolygonSetting)
|
|
4490
|
+
], PolygonSettings.prototype, "polygons", void 0);
|
|
4491
|
+
__decorate$1([
|
|
4492
|
+
Complex({}, SelectionSettings)
|
|
4493
|
+
], PolygonSettings.prototype, "selectionSettings", void 0);
|
|
4494
|
+
__decorate$1([
|
|
4495
|
+
Complex({}, HighlightSettings)
|
|
4496
|
+
], PolygonSettings.prototype, "highlightSettings", void 0);
|
|
4415
4497
|
/**
|
|
4416
4498
|
* Gets or sets the options to customize the navigation lines in maps which is used to connect different locations.
|
|
4417
4499
|
*/
|
|
@@ -4965,6 +5047,9 @@ __decorate$1([
|
|
|
4965
5047
|
__decorate$1([
|
|
4966
5048
|
Collection([], NavigationLineSettings)
|
|
4967
5049
|
], LayerSettings.prototype, "navigationLineSettings", void 0);
|
|
5050
|
+
__decorate$1([
|
|
5051
|
+
Complex({}, PolygonSettings)
|
|
5052
|
+
], LayerSettings.prototype, "polygonSettings", void 0);
|
|
4968
5053
|
__decorate$1([
|
|
4969
5054
|
Complex({}, TooltipSettings)
|
|
4970
5055
|
], LayerSettings.prototype, "tooltipSettings", void 0);
|
|
@@ -5007,498 +5092,7 @@ __decorate$1([
|
|
|
5007
5092
|
], MapsAreaSettings.prototype, "border", void 0);
|
|
5008
5093
|
|
|
5009
5094
|
/**
|
|
5010
|
-
*
|
|
5011
|
-
*/
|
|
5012
|
-
class Marker {
|
|
5013
|
-
constructor(maps) {
|
|
5014
|
-
this.maps = maps;
|
|
5015
|
-
this.trackElements = [];
|
|
5016
|
-
this.sameMarkerData = [];
|
|
5017
|
-
}
|
|
5018
|
-
markerRender(maps, layerElement, layerIndex, factor, type) {
|
|
5019
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5020
|
-
let templateFn;
|
|
5021
|
-
let markerCount = 0;
|
|
5022
|
-
let nullCount = 0;
|
|
5023
|
-
let markerTemplateCount = 0;
|
|
5024
|
-
maps.translateType = 'marker';
|
|
5025
|
-
const currentLayer = maps.layersCollection[layerIndex];
|
|
5026
|
-
this.markerSVGObject = maps.renderer.createGroup({
|
|
5027
|
-
id: maps.element.id + '_Markers_Group',
|
|
5028
|
-
class: 'GroupElement'
|
|
5029
|
-
});
|
|
5030
|
-
this.markerSVGObject.style.pointerEvents = 'auto';
|
|
5031
|
-
const markerTemplateEle = createElement('div', {
|
|
5032
|
-
id: maps.element.id + '_LayerIndex_' + layerIndex + '_Markers_Template_Group',
|
|
5033
|
-
className: maps.element.id + '_template'
|
|
5034
|
-
});
|
|
5035
|
-
markerTemplateEle.style.cssText = 'overflow: hidden; position: absolute;pointer-events: none;' +
|
|
5036
|
-
'top:' + maps.mapAreaRect.y + 'px;' +
|
|
5037
|
-
'left:' + maps.mapAreaRect.x + 'px;' +
|
|
5038
|
-
'height:' + maps.mapAreaRect.height + 'px;' +
|
|
5039
|
-
'width:' + maps.mapAreaRect.width + 'px;';
|
|
5040
|
-
currentLayer.markerSettings.map((markerSettings, markerIndex) => {
|
|
5041
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5042
|
-
const markerData = markerSettings.dataSource;
|
|
5043
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5044
|
-
Array.prototype.forEach.call(markerData, (data, dataIndex) => {
|
|
5045
|
-
maps.markerNullCount = markerIndex > 0 && dataIndex === 0 ? 0 : maps.markerNullCount;
|
|
5046
|
-
let eventArgs = {
|
|
5047
|
-
cancel: false, name: markerRendering, fill: markerSettings.fill, height: markerSettings.height,
|
|
5048
|
-
width: markerSettings.width, imageUrl: markerSettings.imageUrl, shape: markerSettings.shape,
|
|
5049
|
-
template: markerSettings.template, data: data, maps: maps, marker: markerSettings,
|
|
5050
|
-
border: markerSettings.border, colorValuePath: markerSettings.colorValuePath,
|
|
5051
|
-
shapeValuePath: markerSettings.shapeValuePath, imageUrlValuePath: markerSettings.imageUrlValuePath
|
|
5052
|
-
};
|
|
5053
|
-
maps.trigger('markerRendering', eventArgs, (MarkerArgs) => {
|
|
5054
|
-
eventArgs = markerColorChoose(eventArgs, data);
|
|
5055
|
-
eventArgs = markerShapeChoose(eventArgs, data);
|
|
5056
|
-
const lng = (!isNullOrUndefined(markerSettings.longitudeValuePath)) ?
|
|
5057
|
-
Number(getValueFromObject(data, markerSettings.longitudeValuePath)) : !isNullOrUndefined(data['longitude']) ?
|
|
5058
|
-
parseFloat(data['longitude']) : !isNullOrUndefined(data['Longitude']) ? parseFloat(data['Longitude']) : null;
|
|
5059
|
-
const lat = (!isNullOrUndefined(markerSettings.latitudeValuePath)) ?
|
|
5060
|
-
Number(getValueFromObject(data, markerSettings.latitudeValuePath)) : !isNullOrUndefined(data['latitude']) ?
|
|
5061
|
-
parseFloat(data['latitude']) : !isNullOrUndefined(data['Latitude']) ? parseFloat(data['Latitude']) : null;
|
|
5062
|
-
const offset = markerSettings.offset;
|
|
5063
|
-
if (!eventArgs.cancel && markerSettings.visible && !isNullOrUndefined(lng) && !isNullOrUndefined(lat)) {
|
|
5064
|
-
const markerID = maps.element.id + '_LayerIndex_' + layerIndex + '_MarkerIndex_'
|
|
5065
|
-
+ markerIndex + '_dataIndex_' + dataIndex;
|
|
5066
|
-
let location = (maps.isTileMap) ? convertTileLatLongToPoint(new MapLocation(lng, lat), factor, maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, currentLayer, maps);
|
|
5067
|
-
const animate$$1 = (currentLayer.animationDuration !== 0 || animationMode === 'Enable') || isNullOrUndefined(maps.zoomModule);
|
|
5068
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5069
|
-
const translate = (maps.isTileMap) ? (currentLayer.type === 'SubLayer' && isNullOrUndefined(maps.zoomModule)) ? location = convertTileLatLongToPoint(new MapLocation(lng, lat), maps.tileZoomLevel, maps.tileTranslatePoint, true) : new Object() :
|
|
5070
|
-
!isNullOrUndefined(maps.zoomModule) && maps.zoomSettings.zoomFactor > 1 ?
|
|
5071
|
-
getZoomTranslate(maps, currentLayer, animate$$1) :
|
|
5072
|
-
getTranslate(maps, currentLayer, animate$$1);
|
|
5073
|
-
const scale = type === 'AddMarker' ? maps.scale : translate['scale'];
|
|
5074
|
-
const transPoint = type === 'AddMarker' ? maps.translatePoint : translate['location'];
|
|
5075
|
-
if (eventArgs.template && (!isNaN(location.x) && !isNaN(location.y))) {
|
|
5076
|
-
markerTemplateCount++;
|
|
5077
|
-
markerTemplate(eventArgs, templateFn, markerID, data, markerIndex, markerTemplateEle, location, transPoint, scale, offset, maps);
|
|
5078
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5079
|
-
maps.renderReactTemplates();
|
|
5080
|
-
}
|
|
5081
|
-
else if (!eventArgs.template && (!isNaN(location.x) && !isNaN(location.y))) {
|
|
5082
|
-
markerCount++;
|
|
5083
|
-
marker(eventArgs, markerSettings, markerData, dataIndex, location, transPoint, markerID, offset, scale, maps, this.markerSVGObject);
|
|
5084
|
-
}
|
|
5085
|
-
}
|
|
5086
|
-
nullCount += (!isNaN(lat) && !isNaN(lng)) ? 0 : 1;
|
|
5087
|
-
markerTemplateCount += (eventArgs.cancel) ? 1 : 0;
|
|
5088
|
-
markerCount += (eventArgs.cancel) ? 1 : 0;
|
|
5089
|
-
maps.markerNullCount = (isNullOrUndefined(lng) || isNullOrUndefined(lat)) ?
|
|
5090
|
-
maps.markerNullCount + 1 : maps.markerNullCount;
|
|
5091
|
-
const markerDataLength = markerData.length - maps.markerNullCount;
|
|
5092
|
-
if (this.markerSVGObject.childElementCount === (markerDataLength - markerTemplateCount - nullCount) && (type !== 'Template')) {
|
|
5093
|
-
layerElement.appendChild(this.markerSVGObject);
|
|
5094
|
-
if (currentLayer.markerClusterSettings.allowClustering) {
|
|
5095
|
-
maps.svgObject.appendChild(this.markerSVGObject);
|
|
5096
|
-
maps.element.appendChild(maps.svgObject);
|
|
5097
|
-
if ((currentLayer.layerType === 'OSM' || (currentLayer.urlTemplate.indexOf('openstreetmap') !== -1 && isNullOrUndefined(currentLayer.shapeData)))
|
|
5098
|
-
&& maps.zoomSettings.enable) {
|
|
5099
|
-
clusterTemplate(currentLayer, this.markerSVGObject, maps, layerIndex, this.markerSVGObject, layerElement, true, false);
|
|
5100
|
-
layerElement.appendChild(this.markerSVGObject);
|
|
5101
|
-
}
|
|
5102
|
-
else {
|
|
5103
|
-
clusterTemplate(currentLayer, this.markerSVGObject, maps, layerIndex, this.markerSVGObject, layerElement, true, false);
|
|
5104
|
-
}
|
|
5105
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5106
|
-
maps.renderReactTemplates();
|
|
5107
|
-
}
|
|
5108
|
-
}
|
|
5109
|
-
if (markerTemplateEle.childElementCount === (markerDataLength - markerCount - nullCount) && getElementByID(maps.element.id + '_Secondary_Element')) {
|
|
5110
|
-
getElementByID(maps.element.id + '_Secondary_Element').appendChild(markerTemplateEle);
|
|
5111
|
-
if (maps.checkInitialRender) {
|
|
5112
|
-
if (currentLayer.markerClusterSettings.allowClustering) {
|
|
5113
|
-
clusterTemplate(currentLayer, markerTemplateEle, maps, layerIndex, this.markerSVGObject, layerElement, false, false);
|
|
5114
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5115
|
-
maps.renderReactTemplates();
|
|
5116
|
-
}
|
|
5117
|
-
}
|
|
5118
|
-
}
|
|
5119
|
-
});
|
|
5120
|
-
});
|
|
5121
|
-
});
|
|
5122
|
-
}
|
|
5123
|
-
/**
|
|
5124
|
-
* To find zoom level for individual layers like India, USA.
|
|
5125
|
-
*
|
|
5126
|
-
* @param {number} mapWidth - Specifies the width of the maps
|
|
5127
|
-
* @param {number} mapHeight - Specifies the height of the maps
|
|
5128
|
-
* @param {number} maxZoomFact - Specifies the maximum zoom factor
|
|
5129
|
-
* @returns {number} - Returns the scale factor
|
|
5130
|
-
*/
|
|
5131
|
-
calculateIndividualLayerMarkerZoomLevel(mapWidth, mapHeight, maxZoomFact) {
|
|
5132
|
-
let latZoom;
|
|
5133
|
-
let lngZoom;
|
|
5134
|
-
const height = Math.abs(this.maps.baseMapBounds.latitude.max - this.maps.baseMapBounds.latitude.min);
|
|
5135
|
-
const width = Math.abs(this.maps.baseMapBounds.longitude.max - this.maps.baseMapBounds.longitude.min);
|
|
5136
|
-
latZoom = Math.floor(Math.log(mapHeight / height));
|
|
5137
|
-
latZoom = (latZoom > maxZoomFact) ? maxZoomFact : latZoom;
|
|
5138
|
-
lngZoom = Math.floor(Math.log(mapWidth / width));
|
|
5139
|
-
lngZoom = (lngZoom > maxZoomFact) ? maxZoomFact : lngZoom;
|
|
5140
|
-
const result = Math.min(latZoom, lngZoom);
|
|
5141
|
-
const scaleFactor = Math.min(result, maxZoomFact - 1);
|
|
5142
|
-
if (!this.maps.isTileMap) {
|
|
5143
|
-
compareZoomFactor(scaleFactor, this.maps);
|
|
5144
|
-
}
|
|
5145
|
-
return scaleFactor;
|
|
5146
|
-
}
|
|
5147
|
-
/**
|
|
5148
|
-
* To calculate center position and factor value dynamically
|
|
5149
|
-
*
|
|
5150
|
-
* @param {LayerSettings[]} layersCollection - Specifies the layer settings instance.
|
|
5151
|
-
* @returns {void}
|
|
5152
|
-
* @private
|
|
5153
|
-
*/
|
|
5154
|
-
calculateZoomCenterPositionAndFactor(layersCollection) {
|
|
5155
|
-
if (!isNullOrUndefined(this.maps)) {
|
|
5156
|
-
if (this.maps.zoomSettings.shouldZoomInitially && this.maps.markerModule) {
|
|
5157
|
-
let minLong;
|
|
5158
|
-
let maxLat;
|
|
5159
|
-
let minLat;
|
|
5160
|
-
let maxLong;
|
|
5161
|
-
let zoomLevel;
|
|
5162
|
-
let centerLat;
|
|
5163
|
-
let centerLong;
|
|
5164
|
-
const maxZoomFact = this.maps.zoomSettings.maxZoom;
|
|
5165
|
-
const mapWidth = this.maps.mapAreaRect.width;
|
|
5166
|
-
const mapHeight = this.maps.mapAreaRect.height;
|
|
5167
|
-
this.maps.markerZoomedState = this.maps.markerZoomedState ? this.maps.markerZoomedState :
|
|
5168
|
-
isNullOrUndefined(this.maps.markerZoomFactor) ? !this.maps.markerZoomedState :
|
|
5169
|
-
this.maps.markerZoomFactor > 1 ? this.maps.markerZoomedState : !this.maps.markerZoomedState;
|
|
5170
|
-
this.maps.defaultState = this.maps.markerZoomedState ? !this.maps.markerZoomedState : this.maps.defaultState;
|
|
5171
|
-
Array.prototype.forEach.call(layersCollection, (currentLayer) => {
|
|
5172
|
-
const isMarker = currentLayer.markerSettings.length !== 0;
|
|
5173
|
-
if (isMarker) {
|
|
5174
|
-
Array.prototype.forEach.call(currentLayer.markerSettings, (markerSetting) => {
|
|
5175
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5176
|
-
const markerData = markerSetting.dataSource;
|
|
5177
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5178
|
-
Array.prototype.forEach.call(markerData, (data, dataIndex) => {
|
|
5179
|
-
const latitude = !isNullOrUndefined(data['latitude']) ? parseFloat(data['latitude']) :
|
|
5180
|
-
!isNullOrUndefined(data['Latitude']) ? parseFloat(data['Latitude']) : null;
|
|
5181
|
-
const longitude = !isNullOrUndefined(data['longitude']) ? parseFloat(data['longitude']) :
|
|
5182
|
-
!isNullOrUndefined(data['Longitude']) ? parseFloat(data['Longitude']) : null;
|
|
5183
|
-
minLong = isNullOrUndefined(minLong) && dataIndex === 0 ?
|
|
5184
|
-
longitude : minLong;
|
|
5185
|
-
maxLat = isNullOrUndefined(maxLat) && dataIndex === 0 ?
|
|
5186
|
-
latitude : maxLat;
|
|
5187
|
-
minLat = isNullOrUndefined(minLat) && dataIndex === 0 ?
|
|
5188
|
-
latitude : minLat;
|
|
5189
|
-
maxLong = isNullOrUndefined(maxLong) && dataIndex === 0 ?
|
|
5190
|
-
longitude : maxLong;
|
|
5191
|
-
if (minLong > longitude) {
|
|
5192
|
-
minLong = longitude;
|
|
5193
|
-
}
|
|
5194
|
-
if (minLat > latitude) {
|
|
5195
|
-
minLat = latitude;
|
|
5196
|
-
}
|
|
5197
|
-
if (maxLong < longitude) {
|
|
5198
|
-
maxLong = longitude;
|
|
5199
|
-
}
|
|
5200
|
-
if (maxLat < latitude) {
|
|
5201
|
-
maxLat = latitude;
|
|
5202
|
-
}
|
|
5203
|
-
});
|
|
5204
|
-
});
|
|
5205
|
-
}
|
|
5206
|
-
});
|
|
5207
|
-
if (!isNullOrUndefined(minLat) && !isNullOrUndefined(minLong) &&
|
|
5208
|
-
!isNullOrUndefined(maxLong) && !isNullOrUndefined(maxLat)) {
|
|
5209
|
-
// To find the center position
|
|
5210
|
-
centerLat = (minLat + maxLat) / 2;
|
|
5211
|
-
centerLong = (minLong + maxLong) / 2;
|
|
5212
|
-
this.maps.markerCenterLatitude = centerLat;
|
|
5213
|
-
this.maps.markerCenterLongitude = centerLong;
|
|
5214
|
-
if (isNullOrUndefined(this.maps.markerZoomCenterPoint) || this.maps.markerZoomedState) {
|
|
5215
|
-
this.maps.markerZoomCenterPoint = {
|
|
5216
|
-
latitude: centerLat,
|
|
5217
|
-
longitude: centerLong
|
|
5218
|
-
};
|
|
5219
|
-
}
|
|
5220
|
-
let markerFactor;
|
|
5221
|
-
if (this.maps.isTileMap || this.maps.baseMapRectBounds['min']['x'] === 0) {
|
|
5222
|
-
zoomLevel = calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeight, this.maps, false);
|
|
5223
|
-
if (this.maps.isTileMap) {
|
|
5224
|
-
markerFactor = isNullOrUndefined(this.maps.markerZoomFactor) ?
|
|
5225
|
-
zoomLevel : isNullOrUndefined(this.maps.mapScaleValue) ?
|
|
5226
|
-
zoomLevel : this.maps.mapScaleValue > 1 && this.maps.markerZoomFactor !== 1 ?
|
|
5227
|
-
this.maps.mapScaleValue : zoomLevel;
|
|
5228
|
-
}
|
|
5229
|
-
else {
|
|
5230
|
-
markerFactor = isNullOrUndefined(this.maps.mapScaleValue) ? zoomLevel :
|
|
5231
|
-
(Math.floor(this.maps.scale) !== 1 &&
|
|
5232
|
-
this.maps.mapScaleValue !== zoomLevel)
|
|
5233
|
-
&&
|
|
5234
|
-
(isNullOrUndefined(this.maps.shouldZoomCurrentFactor))
|
|
5235
|
-
? this.maps.mapScaleValue : zoomLevel;
|
|
5236
|
-
if (((markerFactor === this.maps.mapScaleValue &&
|
|
5237
|
-
(this.maps.markerZoomFactor === 1 || this.maps.mapScaleValue === 1))
|
|
5238
|
-
&& (!this.maps.enablePersistence))) {
|
|
5239
|
-
markerFactor = zoomLevel;
|
|
5240
|
-
}
|
|
5241
|
-
}
|
|
5242
|
-
}
|
|
5243
|
-
else {
|
|
5244
|
-
zoomLevel = this.calculateIndividualLayerMarkerZoomLevel(mapWidth, mapHeight, maxZoomFact);
|
|
5245
|
-
markerFactor = isNullOrUndefined(this.maps.mapScaleValue) ? zoomLevel :
|
|
5246
|
-
(this.maps.mapScaleValue !== zoomLevel)
|
|
5247
|
-
? this.maps.mapScaleValue : zoomLevel;
|
|
5248
|
-
}
|
|
5249
|
-
this.maps.markerZoomFactor = markerFactor;
|
|
5250
|
-
}
|
|
5251
|
-
}
|
|
5252
|
-
else {
|
|
5253
|
-
this.maps.markerZoomedState = false;
|
|
5254
|
-
if (this.maps.markerZoomFactor > 1) {
|
|
5255
|
-
this.maps.markerCenterLatitude = null;
|
|
5256
|
-
this.maps.markerCenterLongitude = null;
|
|
5257
|
-
this.maps.markerZoomFactor = 1;
|
|
5258
|
-
if (!this.maps.enablePersistence) {
|
|
5259
|
-
this.maps.mapScaleValue = 1;
|
|
5260
|
-
}
|
|
5261
|
-
}
|
|
5262
|
-
if (this.maps.isTileMap && !this.maps.enablePersistence
|
|
5263
|
-
&& this.maps.mapScaleValue <= 1) {
|
|
5264
|
-
this.maps.tileZoomLevel = this.maps.mapScaleValue === 0 ? (this.maps.isZoomByPosition ? this.maps.tileZoomLevel : 1)
|
|
5265
|
-
: this.maps.mapScaleValue;
|
|
5266
|
-
if (this.maps.mapScaleValue === 1 && this.maps.markerZoomFactor === 1) {
|
|
5267
|
-
this.maps.tileTranslatePoint.x = 0;
|
|
5268
|
-
this.maps.tileTranslatePoint.y = 0;
|
|
5269
|
-
}
|
|
5270
|
-
}
|
|
5271
|
-
}
|
|
5272
|
-
}
|
|
5273
|
-
}
|
|
5274
|
-
/**
|
|
5275
|
-
* To check and trigger marker click event
|
|
5276
|
-
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
5277
|
-
* @returns {void}
|
|
5278
|
-
* @private
|
|
5279
|
-
*/
|
|
5280
|
-
markerClick(e) {
|
|
5281
|
-
let target = e.target.id;
|
|
5282
|
-
if (target.indexOf(this.maps.element.id) === -1) {
|
|
5283
|
-
const ancestor = e.target.closest('.' + this.maps.element.id + '_marker_template_element');
|
|
5284
|
-
if (!isNullOrUndefined(ancestor) && ancestor.id.indexOf('_MarkerIndex_') > -1) {
|
|
5285
|
-
target = ancestor.id;
|
|
5286
|
-
}
|
|
5287
|
-
}
|
|
5288
|
-
if (target.indexOf('_LayerIndex_') === -1 || target.indexOf('_cluster_') > 0) {
|
|
5289
|
-
return;
|
|
5290
|
-
}
|
|
5291
|
-
const options = this.getMarker(target);
|
|
5292
|
-
if (isNullOrUndefined(options)) {
|
|
5293
|
-
return;
|
|
5294
|
-
}
|
|
5295
|
-
if (options.marker.enableDrag) {
|
|
5296
|
-
document.getElementById(this.maps.element.id + "_svg").style.cursor = 'grabbing';
|
|
5297
|
-
}
|
|
5298
|
-
const eventArgs = {
|
|
5299
|
-
cancel: false, name: markerClick, data: options.data, maps: this.maps,
|
|
5300
|
-
marker: options.marker, target: target, x: e.clientX, y: e.clientY,
|
|
5301
|
-
latitude: options.data['latitude'] || options.data['Latitude'],
|
|
5302
|
-
longitude: options.data['longitude'] || options.data['Longitude'],
|
|
5303
|
-
value: options.data['name']
|
|
5304
|
-
};
|
|
5305
|
-
this.maps.trigger(markerClick, eventArgs);
|
|
5306
|
-
if (options.marker.enableDrag) {
|
|
5307
|
-
let isCluster = false;
|
|
5308
|
-
const layerIndex = parseInt(target.split('_LayerIndex_')[1].split('_')[0], 10);
|
|
5309
|
-
const markerIndex = parseInt(target.split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
5310
|
-
const dataIndex = parseInt(target.split('_dataIndex_')[1].split('_')[0], 10);
|
|
5311
|
-
const marker$$1 = this.maps.layers[layerIndex].markerSettings[markerIndex];
|
|
5312
|
-
if (this.sameMarkerData.length > 0) {
|
|
5313
|
-
isCluster = (this.sameMarkerData[0].data.filter((el) => { return (el['index'] == dataIndex); })).length > 0 &&
|
|
5314
|
-
this.sameMarkerData[0].layerIndex === layerIndex && this.sameMarkerData[0].markerIndex === markerIndex;
|
|
5315
|
-
}
|
|
5316
|
-
if (!isCluster) {
|
|
5317
|
-
const dragEventArgs = {
|
|
5318
|
-
name: markerDragStart, x: e.clientX, y: e.clientY,
|
|
5319
|
-
latitude: options.data['latitude'] || options.data['Latitude'],
|
|
5320
|
-
longitude: options.data['longitude'] || options.data['Longitude'],
|
|
5321
|
-
layerIndex: layerIndex, markerIndex: markerIndex, dataIndex: dataIndex
|
|
5322
|
-
};
|
|
5323
|
-
this.maps.trigger(markerDragStart, dragEventArgs);
|
|
5324
|
-
this.maps.markerDragArgument = {
|
|
5325
|
-
targetId: target, x: e.clientX, y: e.clientY,
|
|
5326
|
-
latitude: options.data['latitude'] || options.data['Latitude'],
|
|
5327
|
-
longitude: options.data['longitude'] || options.data['Longitude'],
|
|
5328
|
-
shape: isNullOrUndefined(marker$$1.shapeValuePath) ? marker$$1.shape : marker$$1.dataSource[dataIndex][marker$$1.shapeValuePath],
|
|
5329
|
-
layerIndex: layerIndex, markerIndex: markerIndex, dataIndex: dataIndex
|
|
5330
|
-
};
|
|
5331
|
-
}
|
|
5332
|
-
}
|
|
5333
|
-
}
|
|
5334
|
-
/**
|
|
5335
|
-
* To check and trigger Cluster click event
|
|
5336
|
-
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
5337
|
-
* @returns {void}
|
|
5338
|
-
* @private
|
|
5339
|
-
*/
|
|
5340
|
-
markerClusterClick(e) {
|
|
5341
|
-
const target = e.target.id;
|
|
5342
|
-
if (target.indexOf('_LayerIndex_') === -1 || target.indexOf('_cluster_') === -1) {
|
|
5343
|
-
return;
|
|
5344
|
-
}
|
|
5345
|
-
const options = this.getMarker(target);
|
|
5346
|
-
if (isNullOrUndefined(options)) {
|
|
5347
|
-
return;
|
|
5348
|
-
}
|
|
5349
|
-
if ((options.clusterCollection.length > 0 && this.maps.markerClusterExpand)) {
|
|
5350
|
-
if (getElement(this.maps.element.id + '_mapsTooltip') &&
|
|
5351
|
-
this.maps.mapsTooltipModule.tooltipTargetID.indexOf('_MarkerIndex_') > -1) {
|
|
5352
|
-
removeElement(this.maps.element.id + '_mapsTooltip');
|
|
5353
|
-
}
|
|
5354
|
-
if (this.sameMarkerData.length > 0 && !this.maps.markerClusterExpandCheck) {
|
|
5355
|
-
this.maps.markerClusterExpandCheck = true;
|
|
5356
|
-
mergeSeparateCluster(this.sameMarkerData, this.maps, this.markerSVGObject);
|
|
5357
|
-
}
|
|
5358
|
-
else {
|
|
5359
|
-
this.sameMarkerData = options.clusterCollection;
|
|
5360
|
-
this.maps.markerClusterExpandCheck = false;
|
|
5361
|
-
clusterSeparate(this.sameMarkerData, this.maps, this.markerSVGObject, true);
|
|
5362
|
-
}
|
|
5363
|
-
}
|
|
5364
|
-
const eventArgs = {
|
|
5365
|
-
cancel: false, name: markerClusterClick, data: options, maps: this.maps,
|
|
5366
|
-
target: target, x: e.clientX, y: e.clientY,
|
|
5367
|
-
latitude: options.data['latitude'] || options.data['Latitude'], longitude: options.data['longitude'] || options.data['Longitude'],
|
|
5368
|
-
markerClusterCollection: options['markCollection']
|
|
5369
|
-
};
|
|
5370
|
-
this.maps.trigger(markerClusterClick, eventArgs);
|
|
5371
|
-
}
|
|
5372
|
-
/**
|
|
5373
|
-
* To get marker from target id
|
|
5374
|
-
*
|
|
5375
|
-
* @param {string} target - Specifies the target
|
|
5376
|
-
* @returns {string} - Returns the string
|
|
5377
|
-
*/
|
|
5378
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5379
|
-
getMarker(target) {
|
|
5380
|
-
const id = target.split('_LayerIndex_');
|
|
5381
|
-
const index = parseInt(id[1].split('_')[0], 10);
|
|
5382
|
-
const layer = this.maps.layers[index];
|
|
5383
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5384
|
-
let data;
|
|
5385
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5386
|
-
const markCollection = [];
|
|
5387
|
-
const clusterCollection = [];
|
|
5388
|
-
let marker$$1;
|
|
5389
|
-
this.maps.markerClusterExpand = layer.markerClusterSettings.allowClusterExpand;
|
|
5390
|
-
if (target.indexOf('_MarkerIndex_') > -1) {
|
|
5391
|
-
const markerIndex = parseInt(id[1].split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
5392
|
-
const dataIndex = parseInt(id[1].split('_dataIndex_')[1].split('_')[0], 10);
|
|
5393
|
-
marker$$1 = layer.markerSettings[markerIndex];
|
|
5394
|
-
if (!isNaN(markerIndex)) {
|
|
5395
|
-
data = marker$$1.dataSource[dataIndex];
|
|
5396
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5397
|
-
let collection = [];
|
|
5398
|
-
if (!marker$$1.template && (target.indexOf('_cluster_') > -1) && (this.maps.layers[index].markerClusterSettings.allowClusterExpand)) {
|
|
5399
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5400
|
-
Array.prototype.forEach.call(marker$$1.dataSource, (location, index) => {
|
|
5401
|
-
if (location['latitude'] === data['latitude'] && location['longitude'] === data['longitude']) {
|
|
5402
|
-
collection.push({ data: data, index: index });
|
|
5403
|
-
}
|
|
5404
|
-
});
|
|
5405
|
-
}
|
|
5406
|
-
if ((target.indexOf('_cluster_') > -1)) {
|
|
5407
|
-
let isClusterSame = false;
|
|
5408
|
-
const clusterElement = document.getElementById(target.indexOf('_datalabel_') > -1 ? layer.markerClusterSettings.shape === 'Balloon' ? target.split('_datalabel_')[0] + '_Group' : target.split('_datalabel_')[0] : layer.markerClusterSettings.shape === 'Balloon' ? target + '_Group' : target);
|
|
5409
|
-
const indexes = layer.markerClusterSettings.shape === 'Balloon' ? clusterElement.children[0].textContent.split(',').map(Number) : clusterElement.textContent.split(',').map(Number);
|
|
5410
|
-
collection = [];
|
|
5411
|
-
for (const i of indexes) {
|
|
5412
|
-
collection.push({ data: marker$$1.dataSource[i], index: i });
|
|
5413
|
-
markCollection.push(marker$$1.dataSource[i]);
|
|
5414
|
-
}
|
|
5415
|
-
isClusterSame = false;
|
|
5416
|
-
clusterCollection.push({
|
|
5417
|
-
data: collection, layerIndex: index, markerIndex: markerIndex, dataIndex: dataIndex,
|
|
5418
|
-
targetClusterIndex: +(target.split('_cluster_')[1].indexOf('_datalabel_') > -1 ? target.split('_cluster_')[1].split('_datalabel_')[0] : target.split('_cluster_')[1]),
|
|
5419
|
-
isClusterSame: isClusterSame
|
|
5420
|
-
});
|
|
5421
|
-
}
|
|
5422
|
-
return { marker: marker$$1, data: data, clusterCollection: clusterCollection, markCollection: markCollection };
|
|
5423
|
-
}
|
|
5424
|
-
}
|
|
5425
|
-
return null;
|
|
5426
|
-
}
|
|
5427
|
-
/**
|
|
5428
|
-
* To check and trigger marker move event
|
|
5429
|
-
*
|
|
5430
|
-
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
5431
|
-
* @returns {void}
|
|
5432
|
-
* @private
|
|
5433
|
-
*/
|
|
5434
|
-
markerMove(e) {
|
|
5435
|
-
const targetId = e.target.id;
|
|
5436
|
-
if (targetId.indexOf('_LayerIndex_') === -1 || targetId.indexOf('_cluster_') > 0) {
|
|
5437
|
-
return;
|
|
5438
|
-
}
|
|
5439
|
-
const options = this.getMarker(targetId);
|
|
5440
|
-
if (isNullOrUndefined(options)) {
|
|
5441
|
-
return;
|
|
5442
|
-
}
|
|
5443
|
-
if (options.marker.enableDrag) {
|
|
5444
|
-
document.getElementById(this.maps.element.id + "_svg").style.cursor = isNullOrUndefined(this.maps.markerDragArgument) ?
|
|
5445
|
-
'pointer' : 'grabbing';
|
|
5446
|
-
}
|
|
5447
|
-
const eventArgs = {
|
|
5448
|
-
cancel: false, name: markerMouseMove, data: options.data,
|
|
5449
|
-
maps: this.maps, target: targetId, x: e.clientX, y: e.clientY
|
|
5450
|
-
};
|
|
5451
|
-
this.maps.trigger(markerMouseMove, eventArgs);
|
|
5452
|
-
}
|
|
5453
|
-
/**
|
|
5454
|
-
* To check and trigger cluster move event
|
|
5455
|
-
*
|
|
5456
|
-
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
5457
|
-
* @returns {void}
|
|
5458
|
-
* @private
|
|
5459
|
-
*/
|
|
5460
|
-
markerClusterMouseMove(e) {
|
|
5461
|
-
const targetId = e.target.id;
|
|
5462
|
-
if (targetId.indexOf('_LayerIndex_') === -1 || targetId.indexOf('_cluster_') === -1) {
|
|
5463
|
-
return;
|
|
5464
|
-
}
|
|
5465
|
-
const options = this.getMarker(targetId);
|
|
5466
|
-
if (this.maps.markerClusterExpand) {
|
|
5467
|
-
e.target.style.cursor = 'pointer';
|
|
5468
|
-
}
|
|
5469
|
-
if (isNullOrUndefined(options)) {
|
|
5470
|
-
return;
|
|
5471
|
-
}
|
|
5472
|
-
const eventArgs = {
|
|
5473
|
-
cancel: false, name: markerClusterMouseMove, data: options.data, maps: this.maps,
|
|
5474
|
-
target: targetId, x: e.clientX, y: e.clientY
|
|
5475
|
-
};
|
|
5476
|
-
this.maps.trigger(markerClusterMouseMove, eventArgs);
|
|
5477
|
-
}
|
|
5478
|
-
/**
|
|
5479
|
-
* Get module name.
|
|
5480
|
-
*
|
|
5481
|
-
* @returns {string} - Returns the module name
|
|
5482
|
-
*/
|
|
5483
|
-
getModuleName() {
|
|
5484
|
-
return 'Marker';
|
|
5485
|
-
}
|
|
5486
|
-
/**
|
|
5487
|
-
* To destroy the layers.
|
|
5488
|
-
*
|
|
5489
|
-
* @returns {void}
|
|
5490
|
-
* @private
|
|
5491
|
-
*/
|
|
5492
|
-
destroy() {
|
|
5493
|
-
this.maps = null;
|
|
5494
|
-
this.trackElements = [];
|
|
5495
|
-
this.markerSVGObject = null;
|
|
5496
|
-
this.sameMarkerData = [];
|
|
5497
|
-
}
|
|
5498
|
-
}
|
|
5499
|
-
|
|
5500
|
-
/**
|
|
5501
|
-
* Maps constants doc
|
|
5095
|
+
* Maps constants doc
|
|
5502
5096
|
*/
|
|
5503
5097
|
/**
|
|
5504
5098
|
* Specifies the maps load event name.
|
|
@@ -6160,6 +5754,12 @@ class LayerPanel {
|
|
|
6160
5754
|
&& panel.mapObject.previousZoomFactor !== panel.mapObject.zoomSettings.zoomFactor) {
|
|
6161
5755
|
panel.mapObject.previousZoomFactor = panel.mapObject.zoomSettings.zoomFactor;
|
|
6162
5756
|
}
|
|
5757
|
+
if (panel.mapObject.polygonModule) {
|
|
5758
|
+
const polygonElement = panel.mapObject.polygonModule.polygonRender(this.mapObject, layerIndex, panel.mapObject.tileZoomLevel);
|
|
5759
|
+
if (!isNullOrUndefined(polygonElement)) {
|
|
5760
|
+
panel.layerObject.appendChild(polygonElement);
|
|
5761
|
+
}
|
|
5762
|
+
}
|
|
6163
5763
|
if (panel.mapObject.navigationLineModule) {
|
|
6164
5764
|
const navigationLineElement = panel.mapObject.navigationLineModule.renderNavigation(panel.currentLayer, panel.mapObject.tileZoomLevel, layerIndex);
|
|
6165
5765
|
if (!isNullOrUndefined(navigationLineElement)) {
|
|
@@ -6618,6 +6218,9 @@ class LayerPanel {
|
|
|
6618
6218
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6619
6219
|
layerIndex, colors, renderData, labelTemplateEle) {
|
|
6620
6220
|
let bubbleG;
|
|
6221
|
+
if (this.mapObject.polygonModule) {
|
|
6222
|
+
this.groupElements.push(this.mapObject.polygonModule.polygonRender(this.mapObject, layerIndex, (this.mapObject.isTileMap ? Math.floor(this.currentFactor) : this.currentFactor)));
|
|
6223
|
+
}
|
|
6621
6224
|
if (this.currentLayer.bubbleSettings.length && this.mapObject.bubbleModule) {
|
|
6622
6225
|
const length = this.currentLayer.bubbleSettings.length;
|
|
6623
6226
|
let bubble;
|
|
@@ -6968,9 +6571,11 @@ class LayerPanel {
|
|
|
6968
6571
|
(!(childNode.id.indexOf('_bubble_Group') > -1)) &&
|
|
6969
6572
|
(!(childNode.id.indexOf('_dataLableIndex_Group') > -1)) &&
|
|
6970
6573
|
(!(childNode.id.indexOf('_line_Group') > -1))) {
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6574
|
+
if (childNode.id.indexOf('_Polygons_Group') === -1) {
|
|
6575
|
+
const transform = 'scale( ' + this.mapObject.scale + ' ) ' + 'translate( ' + this.mapObject.translatePoint.x
|
|
6576
|
+
+ ' ' + this.mapObject.translatePoint.y + ' ) ';
|
|
6577
|
+
childNode.setAttribute('transform', transform);
|
|
6578
|
+
}
|
|
6974
6579
|
}
|
|
6975
6580
|
}
|
|
6976
6581
|
}
|
|
@@ -7663,6 +7268,8 @@ let Maps = class Maps extends Component {
|
|
|
7663
7268
|
/** @private */
|
|
7664
7269
|
this.selectedNavigationElementId = [];
|
|
7665
7270
|
/** @private */
|
|
7271
|
+
this.selectedPolygonElementId = [];
|
|
7272
|
+
/** @private */
|
|
7666
7273
|
this.selectedLegendElementId = [];
|
|
7667
7274
|
/** @private */
|
|
7668
7275
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -7680,6 +7287,8 @@ let Maps = class Maps extends Component {
|
|
|
7680
7287
|
/** @private */
|
|
7681
7288
|
this.initialTileTranslate = new Point(0, 0);
|
|
7682
7289
|
/** @private */
|
|
7290
|
+
this.isMarkerZoomCompleted = false;
|
|
7291
|
+
/** @private */
|
|
7683
7292
|
this.markerDragId = '';
|
|
7684
7293
|
/** @private */
|
|
7685
7294
|
this.initialCheck = true;
|
|
@@ -7870,8 +7479,8 @@ let Maps = class Maps extends Component {
|
|
|
7870
7479
|
const fetchApiModule = new Fetch(localAjax.dataOptions, localAjax.type, localAjax.contentType);
|
|
7871
7480
|
fetchApiModule.onSuccess = (args) => {
|
|
7872
7481
|
if (!isNullOrUndefined(args.type) && args.type === 'application/octet-stream') {
|
|
7873
|
-
|
|
7874
|
-
|
|
7482
|
+
const reader = new FileReader();
|
|
7483
|
+
const map = this;
|
|
7875
7484
|
reader.onload = function (data) {
|
|
7876
7485
|
args = JSON.parse(reader.result.toString());
|
|
7877
7486
|
map.processResponseJsonData('Fetch', args, layer, type);
|
|
@@ -8032,10 +7641,20 @@ let Maps = class Maps extends Component {
|
|
|
8032
7641
|
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.mapScaleValue, this.element.id + '_Zooming_');
|
|
8033
7642
|
}
|
|
8034
7643
|
if (!this.isZoomByPosition && !this.zoomNotApplied) {
|
|
8035
|
-
this.
|
|
7644
|
+
this.triggerZoomEvent();
|
|
8036
7645
|
}
|
|
8037
7646
|
this.isResize = false;
|
|
8038
7647
|
}
|
|
7648
|
+
triggerZoomEvent() {
|
|
7649
|
+
let loadedArgs;
|
|
7650
|
+
const minMaxLatitudeLongitude = this.getMinMaxLatitudeLongitude();
|
|
7651
|
+
loadedArgs = {
|
|
7652
|
+
maps: this, isResized: this.isResize, minLatitude: minMaxLatitudeLongitude.minLatitude,
|
|
7653
|
+
maxLatitude: minMaxLatitudeLongitude.maxLatitude, minLongitude: minMaxLatitudeLongitude.minLongitude,
|
|
7654
|
+
maxLongitude: minMaxLatitudeLongitude.maxLongitude, cancel: false, name: 'Loaded'
|
|
7655
|
+
};
|
|
7656
|
+
this.trigger('loaded', loadedArgs);
|
|
7657
|
+
}
|
|
8039
7658
|
/**
|
|
8040
7659
|
* To apply color to the initial selected marker
|
|
8041
7660
|
*
|
|
@@ -8207,6 +7826,20 @@ let Maps = class Maps extends Component {
|
|
|
8207
7826
|
this.element.appendChild(secondaryElement);
|
|
8208
7827
|
}
|
|
8209
7828
|
}
|
|
7829
|
+
/**
|
|
7830
|
+
* @returns {void}
|
|
7831
|
+
*/
|
|
7832
|
+
getMinMaxLatitudeLongitude() {
|
|
7833
|
+
const element = document.getElementById(this.element.id).getBoundingClientRect();
|
|
7834
|
+
let minPosition = this.isTileMap ? this.pointToLatLong((this.mapAreaRect.x - this.margin.left), -this.mapAreaRect.y) : this.getGeoLocation(0, (this.mapAreaRect.x + element.left), this.mapAreaRect.y);
|
|
7835
|
+
let maxPosition = this.isTileMap ? this.pointToLatLong(this.mapAreaRect.width, (this.mapAreaRect.height - this.mapAreaRect.y)) :
|
|
7836
|
+
this.getGeoLocation(0, (this.mapAreaRect.x + element.left + this.mapAreaRect.width), (this.mapAreaRect.y + this.mapAreaRect.height));
|
|
7837
|
+
const MinMaxLatitudeLongitude = {
|
|
7838
|
+
minLatitude: minPosition.latitude, maxLatitude: maxPosition.latitude, minLongitude: minPosition.longitude,
|
|
7839
|
+
maxLongitude: maxPosition.longitude
|
|
7840
|
+
};
|
|
7841
|
+
return MinMaxLatitudeLongitude;
|
|
7842
|
+
}
|
|
8210
7843
|
/**
|
|
8211
7844
|
* @returns {void}
|
|
8212
7845
|
* @private
|
|
@@ -9121,7 +8754,7 @@ let Maps = class Maps extends Component {
|
|
|
9121
8754
|
*/
|
|
9122
8755
|
zoomByPosition(centerPosition, zoomFactor) {
|
|
9123
8756
|
if (!this.isDestroyed) {
|
|
9124
|
-
this.zoomNotApplied = false;
|
|
8757
|
+
this.zoomNotApplied = this.isMarkerZoomCompleted = false;
|
|
9125
8758
|
let isRefresh = this.zoomSettings.zoomFactor === zoomFactor;
|
|
9126
8759
|
this.previousProjection = null;
|
|
9127
8760
|
if (!this.isTileMap && this.zoomModule) {
|
|
@@ -9218,14 +8851,13 @@ let Maps = class Maps extends Component {
|
|
|
9218
8851
|
* @returns {void}
|
|
9219
8852
|
*/
|
|
9220
8853
|
addMarker(layerIndex, markerCollection) {
|
|
9221
|
-
if (!this.isDestroyed) {
|
|
8854
|
+
if (!this.isDestroyed && !isNullOrUndefined(this.markerModule)) {
|
|
9222
8855
|
const layerEle = document.getElementById(this.element.id + '_LayerIndex_' + layerIndex);
|
|
9223
8856
|
if (markerCollection.length > 0 && layerEle) {
|
|
9224
8857
|
for (const newMarker of markerCollection) {
|
|
9225
8858
|
this.layersCollection[layerIndex].markerSettings.push(new MarkerSettings(this, 'markerSettings', newMarker));
|
|
9226
8859
|
}
|
|
9227
|
-
|
|
9228
|
-
markerModule.markerRender(this, layerEle, layerIndex, this.mapLayerPanel['currentFactor'], 'AddMarker');
|
|
8860
|
+
this.markerModule.markerRender(this, layerEle, layerIndex, this.mapLayerPanel['currentFactor'], 'AddMarker');
|
|
9229
8861
|
this.arrangeTemplate();
|
|
9230
8862
|
}
|
|
9231
8863
|
}
|
|
@@ -9350,6 +8982,7 @@ let Maps = class Maps extends Component {
|
|
|
9350
8982
|
*/
|
|
9351
8983
|
zoomToCoordinates(minLatitude, minLongitude, maxLatitude, maxLongitude) {
|
|
9352
8984
|
if (!this.isDestroyed) {
|
|
8985
|
+
this.isMarkerZoomCompleted = false;
|
|
9353
8986
|
let centerLatitude;
|
|
9354
8987
|
let centerLongtitude;
|
|
9355
8988
|
let isTwoCoordinates = false;
|
|
@@ -9388,12 +9021,15 @@ let Maps = class Maps extends Component {
|
|
|
9388
9021
|
this.maxLongOfGivenLocation = maxLongitude;
|
|
9389
9022
|
this.zoomNotApplied = true;
|
|
9390
9023
|
this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this, true);
|
|
9024
|
+
const minMaxLatitudeLongitude = this.getMinMaxLatitudeLongitude();
|
|
9391
9025
|
const zoomArgs = {
|
|
9392
9026
|
cancel: false, name: 'zoom', type: zoomIn, maps: this,
|
|
9393
9027
|
tileTranslatePoint: {}, translatePoint: {},
|
|
9394
9028
|
tileZoomLevel: this.isTileMap ? { previous: this.tileZoomLevel, current: this.scaleOfGivenLocation } : {},
|
|
9395
9029
|
scale: !this.isTileMap ? { previous: this.scale, current: this.scaleOfGivenLocation } :
|
|
9396
|
-
{ previous: this.tileZoomLevel, current: this.scaleOfGivenLocation }
|
|
9030
|
+
{ previous: this.tileZoomLevel, current: this.scaleOfGivenLocation },
|
|
9031
|
+
minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
|
|
9032
|
+
minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
|
|
9397
9033
|
};
|
|
9398
9034
|
this.trigger('zoom', zoomArgs);
|
|
9399
9035
|
this.refresh();
|
|
@@ -9563,6 +9199,9 @@ let Maps = class Maps extends Component {
|
|
|
9563
9199
|
}
|
|
9564
9200
|
else if (newProp.zoomSettings.shouldZoomInitially !== oldProp.zoomSettings.shouldZoomInitially) {
|
|
9565
9201
|
this.zoomSettings.zoomFactor = 1;
|
|
9202
|
+
this.previousProjection = null;
|
|
9203
|
+
this.scale = this.isMarkerZoomCompleted ? null : this.scale;
|
|
9204
|
+
this.isMarkerZoomCompleted = !newProp.zoomSettings.shouldZoomInitially;
|
|
9566
9205
|
render = true;
|
|
9567
9206
|
}
|
|
9568
9207
|
else if (newProp.zoomSettings.enable !== oldProp.zoomSettings.enable) {
|
|
@@ -9661,6 +9300,12 @@ let Maps = class Maps extends Component {
|
|
|
9661
9300
|
args: [this]
|
|
9662
9301
|
});
|
|
9663
9302
|
}
|
|
9303
|
+
if (this.isPolygonVisible()) {
|
|
9304
|
+
modules.push({
|
|
9305
|
+
member: 'Polygon',
|
|
9306
|
+
args: [this]
|
|
9307
|
+
});
|
|
9308
|
+
}
|
|
9664
9309
|
if (isVisible.tooltip) {
|
|
9665
9310
|
modules.push({
|
|
9666
9311
|
member: 'MapsTooltip',
|
|
@@ -9742,6 +9387,23 @@ let Maps = class Maps extends Component {
|
|
|
9742
9387
|
});
|
|
9743
9388
|
return isVisible;
|
|
9744
9389
|
}
|
|
9390
|
+
/**
|
|
9391
|
+
* To find navigation line visibility
|
|
9392
|
+
*
|
|
9393
|
+
* @returns {boolean} - Returns whether the navigation lines are visible or not.
|
|
9394
|
+
*/
|
|
9395
|
+
isPolygonVisible() {
|
|
9396
|
+
let isVisible = false;
|
|
9397
|
+
Array.prototype.forEach.call(this.layers, (layer) => {
|
|
9398
|
+
for (let i = 0; i < layer.polygonSettings.polygons.length; i++) {
|
|
9399
|
+
if (layer.polygonSettings.polygons.length > 0) {
|
|
9400
|
+
isVisible = true;
|
|
9401
|
+
break;
|
|
9402
|
+
}
|
|
9403
|
+
}
|
|
9404
|
+
});
|
|
9405
|
+
return isVisible;
|
|
9406
|
+
}
|
|
9745
9407
|
/**
|
|
9746
9408
|
* To find marker visibility
|
|
9747
9409
|
*/
|
|
@@ -9847,19 +9509,26 @@ let Maps = class Maps extends Component {
|
|
|
9847
9509
|
findVisibleLayers(layers, isLayerVisible = false, isBubblevisible = false, istooltipVisible = false, isSelection = false, isHighlight = false) {
|
|
9848
9510
|
let bubbles;
|
|
9849
9511
|
let markers;
|
|
9850
|
-
let
|
|
9512
|
+
let polygonSetting;
|
|
9851
9513
|
for (const layer of layers) {
|
|
9852
9514
|
isLayerVisible = layer.visible || isLayerVisible;
|
|
9853
9515
|
if (layer.visible) {
|
|
9854
9516
|
bubbles = layer.bubbleSettings;
|
|
9855
9517
|
markers = layer.markerSettings;
|
|
9856
|
-
|
|
9518
|
+
polygonSetting = layer.polygonSettings;
|
|
9519
|
+
let navigationLine = layer.navigationLineSettings;
|
|
9857
9520
|
for (const navigation of navigationLine) {
|
|
9858
9521
|
if (navigation.visible) {
|
|
9859
9522
|
isSelection = (!isNullOrUndefined(navigation.highlightSettings) && navigation.highlightSettings.enable) || isSelection;
|
|
9860
9523
|
isHighlight = (!isNullOrUndefined(navigation.selectionSettings) && navigation.selectionSettings.enable) || isHighlight;
|
|
9861
9524
|
}
|
|
9862
9525
|
}
|
|
9526
|
+
for (const polygon of polygonSetting.polygons) {
|
|
9527
|
+
if (polygon.points.length > 0) {
|
|
9528
|
+
isSelection = layer.polygonSettings.highlightSettings.enable || isSelection;
|
|
9529
|
+
isHighlight = layer.polygonSettings.selectionSettings.enable || isHighlight;
|
|
9530
|
+
}
|
|
9531
|
+
}
|
|
9863
9532
|
for (const marker$$1 of markers) {
|
|
9864
9533
|
if (marker$$1.visible) {
|
|
9865
9534
|
istooltipVisible = marker$$1.tooltipSettings.visible || istooltipVisible;
|
|
@@ -9954,7 +9623,7 @@ let Maps = class Maps extends Component {
|
|
|
9954
9623
|
pointToLatLong(pageX, pageY) {
|
|
9955
9624
|
let latitude = 0;
|
|
9956
9625
|
let longitude = 0;
|
|
9957
|
-
if (!this.isDestroyed) {
|
|
9626
|
+
if (!this.isDestroyed && !isNullOrUndefined(this.translatePoint)) {
|
|
9958
9627
|
const padding = this.layers[this.layers.length - 1].layerType === 'GoogleStaticMap' ? 0 : 10;
|
|
9959
9628
|
pageY = pageY + padding;
|
|
9960
9629
|
const mapSize = 256 * Math.pow(2, this.tileZoomLevel);
|
|
@@ -10151,268 +9820,824 @@ class Bubble {
|
|
|
10151
9820
|
this.maps = maps;
|
|
10152
9821
|
this.bubbleCollection = [];
|
|
10153
9822
|
}
|
|
10154
|
-
// eslint-disable-next-line valid-jsdoc
|
|
9823
|
+
// eslint-disable-next-line valid-jsdoc
|
|
9824
|
+
/**
|
|
9825
|
+
* To render bubble
|
|
9826
|
+
*
|
|
9827
|
+
* @private
|
|
9828
|
+
*/
|
|
9829
|
+
renderBubble(
|
|
9830
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9831
|
+
bubbleSettings, shapeData, color, range, bubbleIndex, dataIndex, layerIndex, layer, group, bubbleID) {
|
|
9832
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9833
|
+
const layerData = layer.layerData;
|
|
9834
|
+
const colorValuePath = bubbleSettings.colorValuePath;
|
|
9835
|
+
const equalValue = (!isNullOrUndefined(colorValuePath)) ? ((colorValuePath.indexOf('.') > -1) ?
|
|
9836
|
+
(getValueFromObject(shapeData, bubbleSettings.colorValuePath)) : shapeData[colorValuePath]) :
|
|
9837
|
+
shapeData[colorValuePath];
|
|
9838
|
+
const colorValue = (!isNullOrUndefined(colorValuePath)) ? ((colorValuePath.indexOf('.') > -1) ?
|
|
9839
|
+
Number(getValueFromObject(shapeData, bubbleSettings.colorValuePath)) : Number(shapeData[colorValuePath])) :
|
|
9840
|
+
Number(shapeData[colorValuePath]);
|
|
9841
|
+
const bubbleValue = (!isNullOrUndefined(bubbleSettings.valuePath)) ? ((bubbleSettings.valuePath.indexOf('.') > -1) ?
|
|
9842
|
+
Number(getValueFromObject(shapeData, bubbleSettings.valuePath)) : Number(shapeData[bubbleSettings.valuePath])) :
|
|
9843
|
+
Number(shapeData[bubbleSettings.valuePath]);
|
|
9844
|
+
let opacity;
|
|
9845
|
+
let bubbleColor;
|
|
9846
|
+
if (isNaN(bubbleValue) && isNaN(colorValue) && isNullOrUndefined(equalValue)) {
|
|
9847
|
+
return null;
|
|
9848
|
+
}
|
|
9849
|
+
let radius = getRatioOfBubble(bubbleSettings.minRadius, bubbleSettings.maxRadius, bubbleValue, range.min, range.max);
|
|
9850
|
+
const colorMapping = new ColorMapping(this.maps);
|
|
9851
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9852
|
+
const shapeColor = colorMapping.getColorByValue(bubbleSettings.colorMapping, colorValue, equalValue);
|
|
9853
|
+
// eslint-disable-next-line prefer-const
|
|
9854
|
+
bubbleColor = (Object.prototype.toString.call(shapeColor) === '[object Object]' &&
|
|
9855
|
+
!isNullOrUndefined(shapeColor['fill'])) ? shapeColor['fill'] : color;
|
|
9856
|
+
// eslint-disable-next-line prefer-const
|
|
9857
|
+
opacity = (Object.prototype.toString.call(shapeColor) === '[object Object]' &&
|
|
9858
|
+
!isNullOrUndefined(shapeColor['opacity'])) ? shapeColor['opacity'] : bubbleSettings.opacity;
|
|
9859
|
+
const shapePoints = [[]];
|
|
9860
|
+
this.maps.translateType = 'bubble';
|
|
9861
|
+
let midIndex = 0;
|
|
9862
|
+
let pointsLength = 0;
|
|
9863
|
+
let currentLength = 0;
|
|
9864
|
+
for (let i = 0, len = layerData.length; i < len; i++) {
|
|
9865
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9866
|
+
let shape = layerData[i];
|
|
9867
|
+
shape = shape['property'];
|
|
9868
|
+
const shapePath = checkPropertyPath(shapeData[layer.shapeDataPath], layer.shapePropertyPath, shape);
|
|
9869
|
+
const shapeDataLayerPathValue = !isNullOrUndefined(shapeData[layer.shapeDataPath]) &&
|
|
9870
|
+
isNaN(shapeData[layer.shapeDataPath]) ? shapeData[layer.shapeDataPath].toLowerCase() : shapeData[layer.shapeDataPath];
|
|
9871
|
+
const shapePathValue = !isNullOrUndefined(shape[shapePath]) && isNaN(shape[shapePath])
|
|
9872
|
+
? shape[shapePath].toLowerCase() : shape[shapePath];
|
|
9873
|
+
if (shapeDataLayerPathValue === shapePathValue && (layerData[i].type !== 'LineString' && layerData[i].type !== 'MultiLineString' && layerData[i]['type'] !== 'Point' && layerData[i]['type'] !== 'MultiPoint')) {
|
|
9874
|
+
if (!layerData[i]['_isMultiPolygon']) {
|
|
9875
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9876
|
+
shapePoints.push(this.getPoints(layerData[i], []));
|
|
9877
|
+
currentLength = shapePoints[shapePoints.length - 1].length;
|
|
9878
|
+
if (pointsLength < currentLength) {
|
|
9879
|
+
pointsLength = currentLength;
|
|
9880
|
+
midIndex = shapePoints.length - 1;
|
|
9881
|
+
}
|
|
9882
|
+
}
|
|
9883
|
+
else {
|
|
9884
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9885
|
+
const layer = layerData[i];
|
|
9886
|
+
for (let j = 0; j < layer.length; j++) {
|
|
9887
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9888
|
+
shapePoints.push(this.getPoints(layer[j], []));
|
|
9889
|
+
currentLength = shapePoints[shapePoints.length - 1].length;
|
|
9890
|
+
if (pointsLength < currentLength) {
|
|
9891
|
+
pointsLength = currentLength;
|
|
9892
|
+
midIndex = shapePoints.length - 1;
|
|
9893
|
+
}
|
|
9894
|
+
}
|
|
9895
|
+
}
|
|
9896
|
+
}
|
|
9897
|
+
}
|
|
9898
|
+
const projectionType = this.maps.projectionType;
|
|
9899
|
+
let centerY;
|
|
9900
|
+
let eventArgs;
|
|
9901
|
+
const bubbleBorder = {
|
|
9902
|
+
color: bubbleSettings.border.color, opacity: bubbleSettings.border.opacity,
|
|
9903
|
+
width: bubbleSettings.border.width
|
|
9904
|
+
};
|
|
9905
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9906
|
+
const center = findMidPointOfPolygon(shapePoints[midIndex], projectionType, layer.geometryType);
|
|
9907
|
+
if (bubbleSettings.visible) {
|
|
9908
|
+
if (!isNullOrUndefined(center)) {
|
|
9909
|
+
centerY = this.maps.projectionType === 'Mercator' ? center['y'] : (-center['y']);
|
|
9910
|
+
eventArgs = {
|
|
9911
|
+
cancel: false, name: bubbleRendering, border: bubbleBorder,
|
|
9912
|
+
cx: center['x'], cy: centerY, data: shapeData, fill: bubbleColor,
|
|
9913
|
+
maps: this.maps, radius: radius
|
|
9914
|
+
};
|
|
9915
|
+
}
|
|
9916
|
+
else {
|
|
9917
|
+
const shapePointsLength = shapePoints.length - 1;
|
|
9918
|
+
if (shapePoints[shapePointsLength]['x'] && shapePoints[shapePointsLength]['y']) {
|
|
9919
|
+
eventArgs = {
|
|
9920
|
+
cancel: false, name: bubbleRendering, border: bubbleBorder,
|
|
9921
|
+
cx: shapePoints[shapePointsLength]['x'], cy: shapePoints[shapePointsLength]['y'],
|
|
9922
|
+
data: shapeData, fill: bubbleColor, maps: this.maps,
|
|
9923
|
+
radius: radius
|
|
9924
|
+
};
|
|
9925
|
+
}
|
|
9926
|
+
else {
|
|
9927
|
+
return;
|
|
9928
|
+
}
|
|
9929
|
+
}
|
|
9930
|
+
this.maps.trigger('bubbleRendering', eventArgs, (bubbleArgs) => {
|
|
9931
|
+
if (eventArgs.cancel) {
|
|
9932
|
+
return;
|
|
9933
|
+
}
|
|
9934
|
+
let bubbleElement;
|
|
9935
|
+
eventArgs.border.opacity = isNullOrUndefined(eventArgs.border.opacity) ? opacity : eventArgs.border.opacity;
|
|
9936
|
+
if (bubbleSettings.bubbleType === 'Circle') {
|
|
9937
|
+
const circle = new CircleOption(bubbleID, eventArgs.fill, eventArgs.border, opacity, 0, 0, eventArgs.radius, null);
|
|
9938
|
+
bubbleElement = drawCircle(this.maps, circle, group);
|
|
9939
|
+
}
|
|
9940
|
+
else {
|
|
9941
|
+
const y = this.maps.projectionType === 'Mercator' ? (eventArgs.cy - radius) : (eventArgs.cy + radius);
|
|
9942
|
+
const rectangle = new RectOption(bubbleID, eventArgs.fill, eventArgs.border, opacity, new Rect(0, 0, radius * 2, radius * 2), 2, 2);
|
|
9943
|
+
eventArgs.cx -= radius;
|
|
9944
|
+
eventArgs.cy = y;
|
|
9945
|
+
bubbleElement = drawRectangle(this.maps, rectangle, group);
|
|
9946
|
+
}
|
|
9947
|
+
maintainSelection(this.maps.selectedBubbleElementId, this.maps.bubbleSelectionClass, bubbleElement, 'BubbleselectionMapStyle');
|
|
9948
|
+
this.bubbleCollection.push({
|
|
9949
|
+
LayerIndex: layerIndex,
|
|
9950
|
+
BubbleIndex: bubbleIndex,
|
|
9951
|
+
DataIndex: dataIndex,
|
|
9952
|
+
element: bubbleElement,
|
|
9953
|
+
center: { x: eventArgs.cx, y: eventArgs.cy }
|
|
9954
|
+
});
|
|
9955
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9956
|
+
let translate;
|
|
9957
|
+
const animate$$1 = (layer.animationDuration !== 0 || animationMode === 'Enable') || isNullOrUndefined(this.maps.zoomModule);
|
|
9958
|
+
if (this.maps.zoomSettings.zoomFactor > 1 && !isNullOrUndefined(this.maps.zoomModule) && !this.maps.isTileMap) {
|
|
9959
|
+
translate = getZoomTranslate(this.maps, layer, animate$$1);
|
|
9960
|
+
}
|
|
9961
|
+
else {
|
|
9962
|
+
translate = getTranslate(this.maps, layer, animate$$1);
|
|
9963
|
+
}
|
|
9964
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9965
|
+
const bubbleDataSource = bubbleSettings.dataSource;
|
|
9966
|
+
const scale = translate['scale'];
|
|
9967
|
+
const transPoint = translate['location'];
|
|
9968
|
+
const position = new MapLocation((this.maps.isTileMap ? ((eventArgs.cx + this.maps.translatePoint.x) * this.maps.tileZoomLevel) : ((eventArgs.cx + transPoint.x) * scale)), (this.maps.isTileMap ? ((eventArgs.cy + this.maps.translatePoint.y) * this.maps.tileZoomLevel) : ((eventArgs.cy + transPoint.y) * scale)));
|
|
9969
|
+
bubbleElement.setAttribute('transform', 'translate( ' + (position.x) + ' ' + (position.y) + ' )');
|
|
9970
|
+
const bubble = (bubbleDataSource.length - 1) === dataIndex ? 'bubble' : null;
|
|
9971
|
+
if (bubbleSettings.bubbleType === 'Square') {
|
|
9972
|
+
position.x += radius;
|
|
9973
|
+
position.y += radius * (this.maps.projectionType === 'Mercator' ? 1 : -1);
|
|
9974
|
+
}
|
|
9975
|
+
else {
|
|
9976
|
+
radius = 0;
|
|
9977
|
+
}
|
|
9978
|
+
if (bubbleSettings.animationDuration > 0 || animationMode === 'Enable') {
|
|
9979
|
+
elementAnimate(bubbleElement, bubbleSettings.animationDelay, bubbleSettings.animationDuration, position, this.maps, bubble, radius);
|
|
9980
|
+
}
|
|
9981
|
+
});
|
|
9982
|
+
}
|
|
9983
|
+
}
|
|
9984
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9985
|
+
getPoints(shape, points) {
|
|
9986
|
+
if (isNullOrUndefined(shape.map)) {
|
|
9987
|
+
points = shape['point'];
|
|
9988
|
+
}
|
|
9989
|
+
else {
|
|
9990
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9991
|
+
shape.map((current) => {
|
|
9992
|
+
points.push(new Point(current['point']['x'], current['point']['y']));
|
|
9993
|
+
});
|
|
9994
|
+
}
|
|
9995
|
+
return points;
|
|
9996
|
+
}
|
|
10155
9997
|
/**
|
|
10156
|
-
* To
|
|
9998
|
+
* To check and trigger bubble click event
|
|
10157
9999
|
*
|
|
10000
|
+
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
10001
|
+
* @returns {void}
|
|
10158
10002
|
* @private
|
|
10159
10003
|
*/
|
|
10160
|
-
|
|
10004
|
+
bubbleClick(e) {
|
|
10005
|
+
const target = e.target.id;
|
|
10006
|
+
if (target.indexOf('_LayerIndex_') === -1) {
|
|
10007
|
+
return;
|
|
10008
|
+
}
|
|
10009
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10010
|
+
const data = this.getbubble(target);
|
|
10011
|
+
if (isNullOrUndefined(data)) {
|
|
10012
|
+
return;
|
|
10013
|
+
}
|
|
10014
|
+
const eventArgs = {
|
|
10015
|
+
cancel: false, name: bubbleClick, data: data, maps: this.maps,
|
|
10016
|
+
target: target, x: e.clientX, y: e.clientY
|
|
10017
|
+
};
|
|
10018
|
+
this.maps.trigger(bubbleClick, eventArgs);
|
|
10019
|
+
}
|
|
10020
|
+
/**
|
|
10021
|
+
* To get bubble from target id
|
|
10022
|
+
*
|
|
10023
|
+
* @param {string} target - Specifies the target
|
|
10024
|
+
* @returns {object} - Returns the object
|
|
10025
|
+
*/
|
|
10161
10026
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10162
|
-
|
|
10027
|
+
getbubble(target) {
|
|
10028
|
+
const id = target.split('_LayerIndex_');
|
|
10029
|
+
const index = parseInt(id[1].split('_')[0], 10);
|
|
10030
|
+
const layer = this.maps.layers[index];
|
|
10163
10031
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
(
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10032
|
+
let data;
|
|
10033
|
+
if (target.indexOf('_BubbleIndex_') > -1) {
|
|
10034
|
+
const bubbleIndex = parseInt(id[1].split('_BubbleIndex_')[1], 10);
|
|
10035
|
+
const dataIndex = parseInt(id[1].split('_BubbleIndex_')[1].split('_dataIndex_')[1], 10);
|
|
10036
|
+
if (!isNaN(bubbleIndex)) {
|
|
10037
|
+
data = layer.bubbleSettings[bubbleIndex].dataSource[dataIndex];
|
|
10038
|
+
return data;
|
|
10039
|
+
}
|
|
10040
|
+
}
|
|
10041
|
+
return null;
|
|
10042
|
+
}
|
|
10043
|
+
// eslint-disable-next-line valid-jsdoc
|
|
10044
|
+
/**
|
|
10045
|
+
* To check and trigger bubble move event
|
|
10046
|
+
*
|
|
10047
|
+
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
10048
|
+
* @retruns {void}
|
|
10049
|
+
* @private
|
|
10050
|
+
*/
|
|
10051
|
+
bubbleMove(e) {
|
|
10052
|
+
const target = e.target.id;
|
|
10053
|
+
if (target.indexOf('_LayerIndex_') === -1) {
|
|
10054
|
+
return;
|
|
10179
10055
|
}
|
|
10180
|
-
let radius = getRatioOfBubble(bubbleSettings.minRadius, bubbleSettings.maxRadius, bubbleValue, range.min, range.max);
|
|
10181
|
-
const colorMapping = new ColorMapping(this.maps);
|
|
10182
10056
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10183
|
-
const
|
|
10184
|
-
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
this.maps.
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10057
|
+
const data = this.getbubble(target);
|
|
10058
|
+
if (isNullOrUndefined(data)) {
|
|
10059
|
+
return;
|
|
10060
|
+
}
|
|
10061
|
+
const eventArgs = {
|
|
10062
|
+
cancel: false, name: bubbleMouseMove, data: data, maps: this.maps,
|
|
10063
|
+
target: target, x: e.clientX, y: e.clientY
|
|
10064
|
+
};
|
|
10065
|
+
this.maps.trigger(bubbleMouseMove, eventArgs);
|
|
10066
|
+
}
|
|
10067
|
+
/**
|
|
10068
|
+
* Get module name.
|
|
10069
|
+
*
|
|
10070
|
+
* @returns {string} - Returns the module name.
|
|
10071
|
+
*/
|
|
10072
|
+
getModuleName() {
|
|
10073
|
+
return 'Bubble';
|
|
10074
|
+
}
|
|
10075
|
+
/**
|
|
10076
|
+
* To destroy the bubble.
|
|
10077
|
+
*
|
|
10078
|
+
* @returns {void}
|
|
10079
|
+
* @private
|
|
10080
|
+
*/
|
|
10081
|
+
destroy() {
|
|
10082
|
+
this.bubbleCollection = [];
|
|
10083
|
+
//TODO: Calling the below code throws spec issue.
|
|
10084
|
+
//this.maps = null;
|
|
10085
|
+
}
|
|
10086
|
+
}
|
|
10087
|
+
|
|
10088
|
+
/**
|
|
10089
|
+
* Marker class
|
|
10090
|
+
*/
|
|
10091
|
+
class Marker {
|
|
10092
|
+
constructor(maps) {
|
|
10093
|
+
this.maps = maps;
|
|
10094
|
+
this.trackElements = [];
|
|
10095
|
+
this.sameMarkerData = [];
|
|
10096
|
+
}
|
|
10097
|
+
markerRender(maps, layerElement, layerIndex, factor, type) {
|
|
10098
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10099
|
+
let templateFn;
|
|
10100
|
+
let markerCount = 0;
|
|
10101
|
+
let nullCount = 0;
|
|
10102
|
+
let markerTemplateCount = 0;
|
|
10103
|
+
maps.translateType = 'marker';
|
|
10104
|
+
const currentLayer = maps.layersCollection[layerIndex];
|
|
10105
|
+
this.markerSVGObject = maps.renderer.createGroup({
|
|
10106
|
+
id: maps.element.id + '_Markers_Group',
|
|
10107
|
+
class: 'GroupElement'
|
|
10108
|
+
});
|
|
10109
|
+
this.markerSVGObject.style.pointerEvents = 'auto';
|
|
10110
|
+
const markerTemplateEle = createElement('div', {
|
|
10111
|
+
id: maps.element.id + '_LayerIndex_' + layerIndex + '_Markers_Template_Group',
|
|
10112
|
+
className: maps.element.id + '_template'
|
|
10113
|
+
});
|
|
10114
|
+
markerTemplateEle.style.cssText = 'overflow: hidden; position: absolute;pointer-events: none;' +
|
|
10115
|
+
'top:' + maps.mapAreaRect.y + 'px;' +
|
|
10116
|
+
'left:' + maps.mapAreaRect.x + 'px;' +
|
|
10117
|
+
'height:' + maps.mapAreaRect.height + 'px;' +
|
|
10118
|
+
'width:' + maps.mapAreaRect.width + 'px;';
|
|
10119
|
+
const allowAnimation = (currentLayer.animationDuration !== 0 || animationMode === 'Enable') || isNullOrUndefined(maps.zoomModule);
|
|
10120
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10121
|
+
let translatePoint;
|
|
10122
|
+
if (!maps.isTileMap) {
|
|
10123
|
+
translatePoint = !isNullOrUndefined(maps.zoomModule) && maps.zoomSettings.zoomFactor > 1 ?
|
|
10124
|
+
getZoomTranslate(maps, currentLayer, allowAnimation) :
|
|
10125
|
+
getTranslate(maps, currentLayer, allowAnimation);
|
|
10126
|
+
}
|
|
10127
|
+
for (let markerIndex = 0; markerIndex < currentLayer.markerSettings.length; markerIndex++) {
|
|
10128
|
+
let markerSettings = currentLayer.markerSettings[markerIndex];
|
|
10196
10129
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10130
|
+
const markerData = markerSettings.dataSource;
|
|
10131
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10132
|
+
for (let dataIndex = 0; dataIndex < markerData.length; dataIndex++) {
|
|
10133
|
+
let data = markerData[dataIndex];
|
|
10134
|
+
maps.markerNullCount = markerIndex > 0 && dataIndex === 0 ? 0 : maps.markerNullCount;
|
|
10135
|
+
let eventArgs = {
|
|
10136
|
+
cancel: false, name: markerRendering, fill: markerSettings.fill, height: markerSettings.height,
|
|
10137
|
+
width: markerSettings.width, imageUrl: markerSettings.imageUrl, shape: markerSettings.shape,
|
|
10138
|
+
template: markerSettings.template, data: data, maps: maps, marker: markerSettings,
|
|
10139
|
+
border: markerSettings.border, colorValuePath: markerSettings.colorValuePath,
|
|
10140
|
+
shapeValuePath: markerSettings.shapeValuePath, imageUrlValuePath: markerSettings.imageUrlValuePath
|
|
10141
|
+
};
|
|
10142
|
+
maps.trigger('markerRendering', eventArgs, (MarkerArgs) => {
|
|
10143
|
+
eventArgs = markerColorChoose(eventArgs, data);
|
|
10144
|
+
eventArgs = markerShapeChoose(eventArgs, data);
|
|
10145
|
+
const lng = (!isNullOrUndefined(markerSettings.longitudeValuePath)) ?
|
|
10146
|
+
Number(getValueFromObject(data, markerSettings.longitudeValuePath)) : !isNullOrUndefined(data['longitude']) ?
|
|
10147
|
+
parseFloat(data['longitude']) : !isNullOrUndefined(data['Longitude']) ? parseFloat(data['Longitude']) : null;
|
|
10148
|
+
const lat = (!isNullOrUndefined(markerSettings.latitudeValuePath)) ?
|
|
10149
|
+
Number(getValueFromObject(data, markerSettings.latitudeValuePath)) : !isNullOrUndefined(data['latitude']) ?
|
|
10150
|
+
parseFloat(data['latitude']) : !isNullOrUndefined(data['Latitude']) ? parseFloat(data['Latitude']) : null;
|
|
10151
|
+
const offset = markerSettings.offset;
|
|
10152
|
+
if (!eventArgs.cancel && markerSettings.visible && !isNullOrUndefined(lng) && !isNullOrUndefined(lat)) {
|
|
10153
|
+
const markerID = maps.element.id + '_LayerIndex_' + layerIndex + '_MarkerIndex_'
|
|
10154
|
+
+ markerIndex + '_dataIndex_' + dataIndex;
|
|
10155
|
+
let location = (maps.isTileMap) ? convertTileLatLongToPoint(new MapLocation(lng, lat), factor, maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, currentLayer, maps);
|
|
10156
|
+
if (maps.isTileMap) {
|
|
10157
|
+
translatePoint = (currentLayer.type === 'SubLayer' && isNullOrUndefined(maps.zoomModule)) ? location = convertTileLatLongToPoint(new MapLocation(lng, lat), maps.tileZoomLevel, maps.tileTranslatePoint, true) : new Object();
|
|
10158
|
+
}
|
|
10159
|
+
const scale = type === 'AddMarker' ? maps.scale : translatePoint['scale'];
|
|
10160
|
+
const transPoint = type === 'AddMarker' ? maps.translatePoint : translatePoint['location'];
|
|
10161
|
+
if (eventArgs.template && (!isNaN(location.x) && !isNaN(location.y))) {
|
|
10162
|
+
markerTemplateCount++;
|
|
10163
|
+
markerTemplate(eventArgs, templateFn, markerID, data, markerIndex, markerTemplateEle, location, transPoint, scale, offset, maps);
|
|
10164
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10165
|
+
maps.renderReactTemplates();
|
|
10166
|
+
}
|
|
10167
|
+
else if (!eventArgs.template && (!isNaN(location.x) && !isNaN(location.y))) {
|
|
10168
|
+
markerCount++;
|
|
10169
|
+
marker(eventArgs, markerSettings, markerData, dataIndex, location, transPoint, markerID, offset, scale, maps, this.markerSVGObject);
|
|
10170
|
+
}
|
|
10171
|
+
}
|
|
10172
|
+
nullCount += (!isNaN(lat) && !isNaN(lng)) ? 0 : 1;
|
|
10173
|
+
markerTemplateCount += (eventArgs.cancel) ? 1 : 0;
|
|
10174
|
+
markerCount += (eventArgs.cancel) ? 1 : 0;
|
|
10175
|
+
maps.markerNullCount = (isNullOrUndefined(lng) || isNullOrUndefined(lat)) ?
|
|
10176
|
+
maps.markerNullCount + 1 : maps.markerNullCount;
|
|
10177
|
+
const markerDataLength = markerData.length - maps.markerNullCount;
|
|
10178
|
+
let isMarkersClustered = false;
|
|
10179
|
+
if (this.markerSVGObject.childElementCount === (markerDataLength - markerTemplateCount - nullCount) && (type !== 'Template')) {
|
|
10180
|
+
layerElement.appendChild(this.markerSVGObject);
|
|
10181
|
+
if (currentLayer.markerClusterSettings.allowClustering) {
|
|
10182
|
+
maps.svgObject.appendChild(this.markerSVGObject);
|
|
10183
|
+
maps.element.appendChild(maps.svgObject);
|
|
10184
|
+
if ((currentLayer.layerType === 'OSM' || (currentLayer.urlTemplate.indexOf('openstreetmap') !== -1 && isNullOrUndefined(currentLayer.shapeData)))
|
|
10185
|
+
&& maps.zoomSettings.enable) {
|
|
10186
|
+
isMarkersClustered = clusterTemplate(currentLayer, this.markerSVGObject, maps, layerIndex, this.markerSVGObject, layerElement, true, false);
|
|
10187
|
+
layerElement.appendChild(this.markerSVGObject);
|
|
10188
|
+
}
|
|
10189
|
+
else {
|
|
10190
|
+
isMarkersClustered = clusterTemplate(currentLayer, this.markerSVGObject, maps, layerIndex, this.markerSVGObject, layerElement, true, false);
|
|
10191
|
+
}
|
|
10192
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10193
|
+
maps.renderReactTemplates();
|
|
10194
|
+
}
|
|
10212
10195
|
}
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
if (pointsLength < currentLength) {
|
|
10222
|
-
pointsLength = currentLength;
|
|
10223
|
-
midIndex = shapePoints.length - 1;
|
|
10196
|
+
if (markerTemplateEle.childElementCount === (markerDataLength - markerCount - nullCount) && getElementByID(maps.element.id + '_Secondary_Element')) {
|
|
10197
|
+
getElementByID(maps.element.id + '_Secondary_Element').appendChild(markerTemplateEle);
|
|
10198
|
+
if (maps.checkInitialRender) {
|
|
10199
|
+
if (currentLayer.markerClusterSettings.allowClustering && !isMarkersClustered) {
|
|
10200
|
+
clusterTemplate(currentLayer, markerTemplateEle, maps, layerIndex, this.markerSVGObject, layerElement, false, false);
|
|
10201
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10202
|
+
maps.renderReactTemplates();
|
|
10203
|
+
}
|
|
10224
10204
|
}
|
|
10225
10205
|
}
|
|
10226
|
-
}
|
|
10206
|
+
});
|
|
10227
10207
|
}
|
|
10228
10208
|
}
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10209
|
+
}
|
|
10210
|
+
/**
|
|
10211
|
+
* To find zoom level for individual layers like India, USA.
|
|
10212
|
+
*
|
|
10213
|
+
* @param {number} mapWidth - Specifies the width of the maps
|
|
10214
|
+
* @param {number} mapHeight - Specifies the height of the maps
|
|
10215
|
+
* @param {number} maxZoomFact - Specifies the maximum zoom factor
|
|
10216
|
+
* @returns {number} - Returns the scale factor
|
|
10217
|
+
*/
|
|
10218
|
+
calculateIndividualLayerMarkerZoomLevel(mapWidth, mapHeight, maxZoomFact) {
|
|
10219
|
+
let latZoom;
|
|
10220
|
+
let lngZoom;
|
|
10221
|
+
const height = Math.abs(this.maps.baseMapBounds.latitude.max - this.maps.baseMapBounds.latitude.min);
|
|
10222
|
+
const width = Math.abs(this.maps.baseMapBounds.longitude.max - this.maps.baseMapBounds.longitude.min);
|
|
10223
|
+
latZoom = Math.floor(Math.log(mapHeight / height));
|
|
10224
|
+
latZoom = (latZoom > maxZoomFact) ? maxZoomFact : latZoom;
|
|
10225
|
+
lngZoom = Math.floor(Math.log(mapWidth / width));
|
|
10226
|
+
lngZoom = (lngZoom > maxZoomFact) ? maxZoomFact : lngZoom;
|
|
10227
|
+
const result = Math.min(latZoom, lngZoom);
|
|
10228
|
+
const scaleFactor = Math.min(result, maxZoomFact - 1);
|
|
10229
|
+
if (!this.maps.isTileMap) {
|
|
10230
|
+
compareZoomFactor(scaleFactor, this.maps);
|
|
10231
|
+
}
|
|
10232
|
+
return scaleFactor;
|
|
10233
|
+
}
|
|
10234
|
+
/**
|
|
10235
|
+
* To calculate center position and factor value dynamically
|
|
10236
|
+
*
|
|
10237
|
+
* @param {LayerSettings[]} layersCollection - Specifies the layer settings instance.
|
|
10238
|
+
* @returns {void}
|
|
10239
|
+
* @private
|
|
10240
|
+
*/
|
|
10241
|
+
calculateZoomCenterPositionAndFactor(layersCollection) {
|
|
10242
|
+
if (!isNullOrUndefined(this.maps)) {
|
|
10243
|
+
if (this.maps.zoomSettings.shouldZoomInitially && this.maps.markerModule) {
|
|
10244
|
+
let minLong;
|
|
10245
|
+
let maxLat;
|
|
10246
|
+
let minLat;
|
|
10247
|
+
let maxLong;
|
|
10248
|
+
let zoomLevel;
|
|
10249
|
+
let centerLat;
|
|
10250
|
+
let centerLong;
|
|
10251
|
+
const maxZoomFact = this.maps.zoomSettings.maxZoom;
|
|
10252
|
+
const mapWidth = this.maps.mapAreaRect.width;
|
|
10253
|
+
const mapHeight = this.maps.mapAreaRect.height;
|
|
10254
|
+
this.maps.markerZoomedState = this.maps.markerZoomedState ? this.maps.markerZoomedState :
|
|
10255
|
+
isNullOrUndefined(this.maps.markerZoomFactor) ? !this.maps.markerZoomedState :
|
|
10256
|
+
this.maps.markerZoomFactor > 1 ? this.maps.markerZoomedState : !this.maps.markerZoomedState;
|
|
10257
|
+
this.maps.defaultState = this.maps.markerZoomedState ? !this.maps.markerZoomedState : this.maps.defaultState;
|
|
10258
|
+
Array.prototype.forEach.call(layersCollection, (currentLayer) => {
|
|
10259
|
+
const isMarker = currentLayer.markerSettings.length !== 0;
|
|
10260
|
+
if (isMarker) {
|
|
10261
|
+
Array.prototype.forEach.call(currentLayer.markerSettings, (markerSetting) => {
|
|
10262
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10263
|
+
const markerData = markerSetting.dataSource;
|
|
10264
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10265
|
+
Array.prototype.forEach.call(markerData, (data, dataIndex) => {
|
|
10266
|
+
const latitude = !isNullOrUndefined(data['latitude']) ? parseFloat(data['latitude']) :
|
|
10267
|
+
!isNullOrUndefined(data['Latitude']) ? parseFloat(data['Latitude']) : null;
|
|
10268
|
+
const longitude = !isNullOrUndefined(data['longitude']) ? parseFloat(data['longitude']) :
|
|
10269
|
+
!isNullOrUndefined(data['Longitude']) ? parseFloat(data['Longitude']) : null;
|
|
10270
|
+
if (!isNullOrUndefined(latitude) && !isNullOrUndefined(longitude)) {
|
|
10271
|
+
minLong = isNullOrUndefined(minLong) && dataIndex === 0 ?
|
|
10272
|
+
longitude : minLong;
|
|
10273
|
+
maxLat = isNullOrUndefined(maxLat) && dataIndex === 0 ?
|
|
10274
|
+
latitude : maxLat;
|
|
10275
|
+
minLat = isNullOrUndefined(minLat) && dataIndex === 0 ?
|
|
10276
|
+
latitude : minLat;
|
|
10277
|
+
maxLong = isNullOrUndefined(maxLong) && dataIndex === 0 ?
|
|
10278
|
+
longitude : maxLong;
|
|
10279
|
+
if (minLong > longitude) {
|
|
10280
|
+
minLong = longitude;
|
|
10281
|
+
}
|
|
10282
|
+
if (minLat > latitude) {
|
|
10283
|
+
minLat = latitude;
|
|
10284
|
+
}
|
|
10285
|
+
if (maxLong < longitude) {
|
|
10286
|
+
maxLong = longitude;
|
|
10287
|
+
}
|
|
10288
|
+
if (maxLat < latitude) {
|
|
10289
|
+
maxLat = latitude;
|
|
10290
|
+
}
|
|
10291
|
+
}
|
|
10292
|
+
});
|
|
10293
|
+
});
|
|
10294
|
+
}
|
|
10295
|
+
});
|
|
10296
|
+
if (!isNullOrUndefined(minLat) && !isNullOrUndefined(minLong) &&
|
|
10297
|
+
!isNullOrUndefined(maxLong) && !isNullOrUndefined(maxLat)) {
|
|
10298
|
+
// To find the center position
|
|
10299
|
+
centerLat = (minLat + maxLat) / 2;
|
|
10300
|
+
centerLong = (minLong + maxLong) / 2;
|
|
10301
|
+
this.maps.markerCenterLatitude = centerLat;
|
|
10302
|
+
this.maps.markerCenterLongitude = centerLong;
|
|
10303
|
+
if (isNullOrUndefined(this.maps.markerZoomCenterPoint) || this.maps.markerZoomedState) {
|
|
10304
|
+
this.maps.markerZoomCenterPoint = {
|
|
10305
|
+
latitude: centerLat,
|
|
10306
|
+
longitude: centerLong
|
|
10307
|
+
};
|
|
10308
|
+
}
|
|
10309
|
+
let markerFactor;
|
|
10310
|
+
if (this.maps.isTileMap || this.maps.baseMapRectBounds['min']['x'] === 0) {
|
|
10311
|
+
zoomLevel = calculateZoomLevel(minLat, maxLat, minLong, maxLong, mapWidth, mapHeight, this.maps, false);
|
|
10312
|
+
if (this.maps.isTileMap) {
|
|
10313
|
+
markerFactor = isNullOrUndefined(this.maps.markerZoomFactor) ?
|
|
10314
|
+
zoomLevel : isNullOrUndefined(this.maps.mapScaleValue) ?
|
|
10315
|
+
zoomLevel : this.maps.mapScaleValue > 1 && this.maps.markerZoomFactor !== 1 ?
|
|
10316
|
+
this.maps.mapScaleValue : zoomLevel;
|
|
10317
|
+
}
|
|
10318
|
+
else {
|
|
10319
|
+
markerFactor = isNullOrUndefined(this.maps.mapScaleValue) ? zoomLevel :
|
|
10320
|
+
(Math.floor(this.maps.scale) !== 1 &&
|
|
10321
|
+
this.maps.mapScaleValue !== zoomLevel)
|
|
10322
|
+
&&
|
|
10323
|
+
(isNullOrUndefined(this.maps.shouldZoomCurrentFactor))
|
|
10324
|
+
? this.maps.mapScaleValue : zoomLevel;
|
|
10325
|
+
if (((markerFactor === this.maps.mapScaleValue &&
|
|
10326
|
+
(this.maps.markerZoomFactor === 1 || this.maps.mapScaleValue === 1))
|
|
10327
|
+
&& (!this.maps.enablePersistence))) {
|
|
10328
|
+
markerFactor = zoomLevel;
|
|
10329
|
+
}
|
|
10330
|
+
}
|
|
10331
|
+
}
|
|
10332
|
+
else {
|
|
10333
|
+
zoomLevel = this.calculateIndividualLayerMarkerZoomLevel(mapWidth, mapHeight, maxZoomFact);
|
|
10334
|
+
markerFactor = isNullOrUndefined(this.maps.mapScaleValue) ? zoomLevel :
|
|
10335
|
+
(this.maps.mapScaleValue !== zoomLevel)
|
|
10336
|
+
? this.maps.mapScaleValue : zoomLevel;
|
|
10337
|
+
}
|
|
10338
|
+
this.maps.markerZoomFactor = markerFactor;
|
|
10339
|
+
}
|
|
10246
10340
|
}
|
|
10247
10341
|
else {
|
|
10248
|
-
|
|
10249
|
-
if (
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
}
|
|
10342
|
+
this.maps.markerZoomedState = false;
|
|
10343
|
+
if (this.maps.markerZoomFactor > 1) {
|
|
10344
|
+
this.maps.markerCenterLatitude = null;
|
|
10345
|
+
this.maps.markerCenterLongitude = null;
|
|
10346
|
+
this.maps.markerZoomFactor = 1;
|
|
10347
|
+
if (!this.maps.enablePersistence) {
|
|
10348
|
+
this.maps.mapScaleValue = 1;
|
|
10349
|
+
}
|
|
10256
10350
|
}
|
|
10257
|
-
|
|
10258
|
-
|
|
10351
|
+
if (this.maps.isTileMap && !this.maps.enablePersistence
|
|
10352
|
+
&& this.maps.mapScaleValue <= 1) {
|
|
10353
|
+
this.maps.tileZoomLevel = this.maps.mapScaleValue === 0 ? (this.maps.isZoomByPosition ? this.maps.tileZoomLevel : 1)
|
|
10354
|
+
: this.maps.mapScaleValue;
|
|
10355
|
+
if (this.maps.mapScaleValue === 1 && this.maps.markerZoomFactor === 1) {
|
|
10356
|
+
this.maps.tileTranslatePoint.x = 0;
|
|
10357
|
+
this.maps.tileTranslatePoint.y = 0;
|
|
10358
|
+
}
|
|
10259
10359
|
}
|
|
10260
10360
|
}
|
|
10261
|
-
this.maps.trigger('bubbleRendering', eventArgs, (bubbleArgs) => {
|
|
10262
|
-
if (eventArgs.cancel) {
|
|
10263
|
-
return;
|
|
10264
|
-
}
|
|
10265
|
-
let bubbleElement;
|
|
10266
|
-
eventArgs.border.opacity = isNullOrUndefined(eventArgs.border.opacity) ? opacity : eventArgs.border.opacity;
|
|
10267
|
-
if (bubbleSettings.bubbleType === 'Circle') {
|
|
10268
|
-
const circle = new CircleOption(bubbleID, eventArgs.fill, eventArgs.border, opacity, 0, 0, eventArgs.radius, null);
|
|
10269
|
-
bubbleElement = drawCircle(this.maps, circle, group);
|
|
10270
|
-
}
|
|
10271
|
-
else {
|
|
10272
|
-
const y = this.maps.projectionType === 'Mercator' ? (eventArgs.cy - radius) : (eventArgs.cy + radius);
|
|
10273
|
-
const rectangle = new RectOption(bubbleID, eventArgs.fill, eventArgs.border, opacity, new Rect(0, 0, radius * 2, radius * 2), 2, 2);
|
|
10274
|
-
eventArgs.cx -= radius;
|
|
10275
|
-
eventArgs.cy = y;
|
|
10276
|
-
bubbleElement = drawRectangle(this.maps, rectangle, group);
|
|
10277
|
-
}
|
|
10278
|
-
maintainSelection(this.maps.selectedBubbleElementId, this.maps.bubbleSelectionClass, bubbleElement, 'BubbleselectionMapStyle');
|
|
10279
|
-
this.bubbleCollection.push({
|
|
10280
|
-
LayerIndex: layerIndex,
|
|
10281
|
-
BubbleIndex: bubbleIndex,
|
|
10282
|
-
DataIndex: dataIndex,
|
|
10283
|
-
element: bubbleElement,
|
|
10284
|
-
center: { x: eventArgs.cx, y: eventArgs.cy }
|
|
10285
|
-
});
|
|
10286
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10287
|
-
let translate;
|
|
10288
|
-
const animate$$1 = (layer.animationDuration !== 0 || animationMode === 'Enable') || isNullOrUndefined(this.maps.zoomModule);
|
|
10289
|
-
if (this.maps.zoomSettings.zoomFactor > 1 && !isNullOrUndefined(this.maps.zoomModule) && !this.maps.isTileMap) {
|
|
10290
|
-
translate = getZoomTranslate(this.maps, layer, animate$$1);
|
|
10291
|
-
}
|
|
10292
|
-
else {
|
|
10293
|
-
translate = getTranslate(this.maps, layer, animate$$1);
|
|
10294
|
-
}
|
|
10295
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10296
|
-
const bubbleDataSource = bubbleSettings.dataSource;
|
|
10297
|
-
const scale = translate['scale'];
|
|
10298
|
-
const transPoint = translate['location'];
|
|
10299
|
-
const position = new MapLocation((this.maps.isTileMap ? ((eventArgs.cx + this.maps.translatePoint.x) * this.maps.tileZoomLevel) : ((eventArgs.cx + transPoint.x) * scale)), (this.maps.isTileMap ? ((eventArgs.cy + this.maps.translatePoint.y) * this.maps.tileZoomLevel) : ((eventArgs.cy + transPoint.y) * scale)));
|
|
10300
|
-
bubbleElement.setAttribute('transform', 'translate( ' + (position.x) + ' ' + (position.y) + ' )');
|
|
10301
|
-
const bubble = (bubbleDataSource.length - 1) === dataIndex ? 'bubble' : null;
|
|
10302
|
-
if (bubbleSettings.bubbleType === 'Square') {
|
|
10303
|
-
position.x += radius;
|
|
10304
|
-
position.y += radius * (this.maps.projectionType === 'Mercator' ? 1 : -1);
|
|
10305
|
-
}
|
|
10306
|
-
else {
|
|
10307
|
-
radius = 0;
|
|
10308
|
-
}
|
|
10309
|
-
if (bubbleSettings.animationDuration > 0 || animationMode === 'Enable') {
|
|
10310
|
-
elementAnimate(bubbleElement, bubbleSettings.animationDelay, bubbleSettings.animationDuration, position, this.maps, bubble, radius);
|
|
10311
|
-
}
|
|
10312
|
-
});
|
|
10313
10361
|
}
|
|
10314
10362
|
}
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10363
|
+
/**
|
|
10364
|
+
* To check and trigger marker click event
|
|
10365
|
+
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
10366
|
+
* @returns {void}
|
|
10367
|
+
* @private
|
|
10368
|
+
*/
|
|
10369
|
+
markerClick(e) {
|
|
10370
|
+
let target = e.target.id;
|
|
10371
|
+
if (target.indexOf(this.maps.element.id) === -1) {
|
|
10372
|
+
const ancestor = e.target.closest('.' + this.maps.element.id + '_marker_template_element');
|
|
10373
|
+
if (!isNullOrUndefined(ancestor) && ancestor.id.indexOf('_MarkerIndex_') > -1) {
|
|
10374
|
+
target = ancestor.id;
|
|
10375
|
+
}
|
|
10376
|
+
}
|
|
10377
|
+
if (target.indexOf('_LayerIndex_') === -1 || target.indexOf('_cluster_') > 0) {
|
|
10378
|
+
return;
|
|
10379
|
+
}
|
|
10380
|
+
const options = this.getMarker(target);
|
|
10381
|
+
if (isNullOrUndefined(options)) {
|
|
10382
|
+
return;
|
|
10383
|
+
}
|
|
10384
|
+
if (options.marker.enableDrag) {
|
|
10385
|
+
document.getElementById(this.maps.element.id + "_svg").style.cursor = 'grabbing';
|
|
10319
10386
|
}
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10387
|
+
const eventArgs = {
|
|
10388
|
+
cancel: false, name: markerClick, data: options.data, maps: this.maps,
|
|
10389
|
+
marker: options.marker, target: target, x: e.clientX, y: e.clientY,
|
|
10390
|
+
latitude: options.data['latitude'] || options.data['Latitude'],
|
|
10391
|
+
longitude: options.data['longitude'] || options.data['Longitude'],
|
|
10392
|
+
value: options.data['name']
|
|
10393
|
+
};
|
|
10394
|
+
this.maps.trigger(markerClick, eventArgs);
|
|
10395
|
+
if (options.marker.enableDrag) {
|
|
10396
|
+
let isCluster = false;
|
|
10397
|
+
const layerIndex = parseInt(target.split('_LayerIndex_')[1].split('_')[0], 10);
|
|
10398
|
+
const markerIndex = parseInt(target.split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
10399
|
+
const dataIndex = parseInt(target.split('_dataIndex_')[1].split('_')[0], 10);
|
|
10400
|
+
const marker$$1 = this.maps.layers[layerIndex].markerSettings[markerIndex];
|
|
10401
|
+
if (this.sameMarkerData.length > 0) {
|
|
10402
|
+
isCluster = (this.sameMarkerData[0].data.filter((el) => { return (el['index'] == dataIndex); })).length > 0 &&
|
|
10403
|
+
this.sameMarkerData[0].layerIndex === layerIndex && this.sameMarkerData[0].markerIndex === markerIndex;
|
|
10404
|
+
}
|
|
10405
|
+
if (!isCluster) {
|
|
10406
|
+
const dragEventArgs = {
|
|
10407
|
+
name: markerDragStart, x: e.clientX, y: e.clientY,
|
|
10408
|
+
latitude: options.data['latitude'] || options.data['Latitude'],
|
|
10409
|
+
longitude: options.data['longitude'] || options.data['Longitude'],
|
|
10410
|
+
layerIndex: layerIndex, markerIndex: markerIndex, dataIndex: dataIndex
|
|
10411
|
+
};
|
|
10412
|
+
this.maps.trigger(markerDragStart, dragEventArgs);
|
|
10413
|
+
this.maps.markerDragArgument = {
|
|
10414
|
+
targetId: target, x: e.clientX, y: e.clientY,
|
|
10415
|
+
latitude: options.data['latitude'] || options.data['Latitude'],
|
|
10416
|
+
longitude: options.data['longitude'] || options.data['Longitude'],
|
|
10417
|
+
shape: isNullOrUndefined(marker$$1.shapeValuePath) ? marker$$1.shape : marker$$1.dataSource[dataIndex][marker$$1.shapeValuePath],
|
|
10418
|
+
layerIndex: layerIndex, markerIndex: markerIndex, dataIndex: dataIndex
|
|
10419
|
+
};
|
|
10420
|
+
}
|
|
10325
10421
|
}
|
|
10326
|
-
return points;
|
|
10327
10422
|
}
|
|
10328
10423
|
/**
|
|
10329
|
-
* To check and trigger
|
|
10330
|
-
*
|
|
10424
|
+
* To check and trigger Cluster click event
|
|
10331
10425
|
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
10332
10426
|
* @returns {void}
|
|
10333
10427
|
* @private
|
|
10334
10428
|
*/
|
|
10335
|
-
|
|
10429
|
+
markerClusterClick(e) {
|
|
10336
10430
|
const target = e.target.id;
|
|
10337
|
-
if (target.indexOf('_LayerIndex_') === -1) {
|
|
10431
|
+
if (target.indexOf('_LayerIndex_') === -1 || target.indexOf('_cluster_') === -1) {
|
|
10338
10432
|
return;
|
|
10339
10433
|
}
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
if (isNullOrUndefined(data)) {
|
|
10434
|
+
const options = this.getMarker(target);
|
|
10435
|
+
if (isNullOrUndefined(options)) {
|
|
10343
10436
|
return;
|
|
10344
10437
|
}
|
|
10438
|
+
if ((options.clusterCollection.length > 0 && this.maps.markerClusterExpand)) {
|
|
10439
|
+
if (getElement(this.maps.element.id + '_mapsTooltip') &&
|
|
10440
|
+
this.maps.mapsTooltipModule.tooltipTargetID.indexOf('_MarkerIndex_') > -1) {
|
|
10441
|
+
removeElement(this.maps.element.id + '_mapsTooltip');
|
|
10442
|
+
}
|
|
10443
|
+
if (this.sameMarkerData.length > 0 && !this.maps.markerClusterExpandCheck) {
|
|
10444
|
+
this.maps.markerClusterExpandCheck = true;
|
|
10445
|
+
mergeSeparateCluster(this.sameMarkerData, this.maps, this.markerSVGObject);
|
|
10446
|
+
}
|
|
10447
|
+
else {
|
|
10448
|
+
this.sameMarkerData = options.clusterCollection;
|
|
10449
|
+
this.maps.markerClusterExpandCheck = false;
|
|
10450
|
+
clusterSeparate(this.sameMarkerData, this.maps, this.markerSVGObject, true);
|
|
10451
|
+
}
|
|
10452
|
+
}
|
|
10345
10453
|
const eventArgs = {
|
|
10346
|
-
cancel: false, name:
|
|
10347
|
-
target: target, x: e.clientX, y: e.clientY
|
|
10454
|
+
cancel: false, name: markerClusterClick, data: options, maps: this.maps,
|
|
10455
|
+
target: target, x: e.clientX, y: e.clientY,
|
|
10456
|
+
latitude: options.data['latitude'] || options.data['Latitude'], longitude: options.data['longitude'] || options.data['Longitude'],
|
|
10457
|
+
markerClusterCollection: options['markCollection']
|
|
10348
10458
|
};
|
|
10349
|
-
this.maps.trigger(
|
|
10459
|
+
this.maps.trigger(markerClusterClick, eventArgs);
|
|
10350
10460
|
}
|
|
10351
10461
|
/**
|
|
10352
|
-
* To get
|
|
10462
|
+
* To get marker from target id
|
|
10353
10463
|
*
|
|
10354
10464
|
* @param {string} target - Specifies the target
|
|
10355
|
-
* @returns {
|
|
10465
|
+
* @returns {string} - Returns the string
|
|
10356
10466
|
*/
|
|
10357
10467
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10358
|
-
|
|
10468
|
+
getMarker(target) {
|
|
10359
10469
|
const id = target.split('_LayerIndex_');
|
|
10360
10470
|
const index = parseInt(id[1].split('_')[0], 10);
|
|
10361
10471
|
const layer = this.maps.layers[index];
|
|
10362
10472
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10363
10473
|
let data;
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10474
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10475
|
+
const markCollection = [];
|
|
10476
|
+
const clusterCollection = [];
|
|
10477
|
+
let marker$$1;
|
|
10478
|
+
this.maps.markerClusterExpand = layer.markerClusterSettings.allowClusterExpand;
|
|
10479
|
+
if (target.indexOf('_MarkerIndex_') > -1) {
|
|
10480
|
+
const markerIndex = parseInt(id[1].split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
10481
|
+
const dataIndex = parseInt(id[1].split('_dataIndex_')[1].split('_')[0], 10);
|
|
10482
|
+
marker$$1 = layer.markerSettings[markerIndex];
|
|
10483
|
+
if (!isNaN(markerIndex)) {
|
|
10484
|
+
data = marker$$1.dataSource[dataIndex];
|
|
10485
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10486
|
+
let collection = [];
|
|
10487
|
+
if (!marker$$1.template && (target.indexOf('_cluster_') > -1) && (this.maps.layers[index].markerClusterSettings.allowClusterExpand)) {
|
|
10488
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10489
|
+
Array.prototype.forEach.call(marker$$1.dataSource, (location, index) => {
|
|
10490
|
+
if (location['latitude'] === data['latitude'] && location['longitude'] === data['longitude']) {
|
|
10491
|
+
collection.push({ data: data, index: index });
|
|
10492
|
+
}
|
|
10493
|
+
});
|
|
10494
|
+
}
|
|
10495
|
+
if ((target.indexOf('_cluster_') > -1)) {
|
|
10496
|
+
let isClusterSame = false;
|
|
10497
|
+
const clusterElement = document.getElementById(target.indexOf('_datalabel_') > -1 ? layer.markerClusterSettings.shape === 'Balloon' ? target.split('_datalabel_')[0] + '_Group' : target.split('_datalabel_')[0] : layer.markerClusterSettings.shape === 'Balloon' ? target + '_Group' : target);
|
|
10498
|
+
const indexes = layer.markerClusterSettings.shape === 'Balloon' ? clusterElement.children[0].textContent.split(',').map(Number) : clusterElement.textContent.split(',').map(Number);
|
|
10499
|
+
collection = [];
|
|
10500
|
+
for (const i of indexes) {
|
|
10501
|
+
collection.push({ data: marker$$1.dataSource[i], index: i });
|
|
10502
|
+
markCollection.push(marker$$1.dataSource[i]);
|
|
10503
|
+
}
|
|
10504
|
+
isClusterSame = false;
|
|
10505
|
+
clusterCollection.push({
|
|
10506
|
+
data: collection, layerIndex: index, markerIndex: markerIndex, dataIndex: dataIndex,
|
|
10507
|
+
targetClusterIndex: +(target.split('_cluster_')[1].indexOf('_datalabel_') > -1 ? target.split('_cluster_')[1].split('_datalabel_')[0] : target.split('_cluster_')[1]),
|
|
10508
|
+
isClusterSame: isClusterSame
|
|
10509
|
+
});
|
|
10510
|
+
}
|
|
10511
|
+
return { marker: marker$$1, data: data, clusterCollection: clusterCollection, markCollection: markCollection };
|
|
10370
10512
|
}
|
|
10371
10513
|
}
|
|
10372
10514
|
return null;
|
|
10373
10515
|
}
|
|
10374
|
-
// eslint-disable-next-line valid-jsdoc
|
|
10375
10516
|
/**
|
|
10376
|
-
* To check and trigger
|
|
10517
|
+
* To check and trigger marker move event
|
|
10377
10518
|
*
|
|
10378
10519
|
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
10379
|
-
* @
|
|
10520
|
+
* @returns {void}
|
|
10380
10521
|
* @private
|
|
10381
10522
|
*/
|
|
10382
|
-
|
|
10383
|
-
const
|
|
10384
|
-
if (
|
|
10523
|
+
markerMove(e) {
|
|
10524
|
+
const targetId = e.target.id;
|
|
10525
|
+
if (targetId.indexOf('_LayerIndex_') === -1 || targetId.indexOf('_cluster_') > 0) {
|
|
10385
10526
|
return;
|
|
10386
10527
|
}
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
if (isNullOrUndefined(data)) {
|
|
10528
|
+
const options = this.getMarker(targetId);
|
|
10529
|
+
if (isNullOrUndefined(options)) {
|
|
10390
10530
|
return;
|
|
10391
10531
|
}
|
|
10532
|
+
if (options.marker.enableDrag) {
|
|
10533
|
+
document.getElementById(this.maps.element.id + "_svg").style.cursor = isNullOrUndefined(this.maps.markerDragArgument) ?
|
|
10534
|
+
'pointer' : 'grabbing';
|
|
10535
|
+
}
|
|
10392
10536
|
const eventArgs = {
|
|
10393
|
-
cancel: false, name:
|
|
10394
|
-
target:
|
|
10537
|
+
cancel: false, name: markerMouseMove, data: options.data,
|
|
10538
|
+
maps: this.maps, target: targetId, x: e.clientX, y: e.clientY
|
|
10395
10539
|
};
|
|
10396
|
-
this.maps.trigger(
|
|
10540
|
+
this.maps.trigger(markerMouseMove, eventArgs);
|
|
10541
|
+
}
|
|
10542
|
+
/**
|
|
10543
|
+
* To check and trigger cluster move event
|
|
10544
|
+
*
|
|
10545
|
+
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
10546
|
+
* @returns {void}
|
|
10547
|
+
* @private
|
|
10548
|
+
*/
|
|
10549
|
+
markerClusterMouseMove(e) {
|
|
10550
|
+
const targetId = e.target.id;
|
|
10551
|
+
if (targetId.indexOf('_LayerIndex_') === -1 || targetId.indexOf('_cluster_') === -1) {
|
|
10552
|
+
return;
|
|
10553
|
+
}
|
|
10554
|
+
const options = this.getMarker(targetId);
|
|
10555
|
+
if (this.maps.markerClusterExpand) {
|
|
10556
|
+
e.target.style.cursor = 'pointer';
|
|
10557
|
+
}
|
|
10558
|
+
if (isNullOrUndefined(options)) {
|
|
10559
|
+
return;
|
|
10560
|
+
}
|
|
10561
|
+
const eventArgs = {
|
|
10562
|
+
cancel: false, name: markerClusterMouseMove, data: options.data, maps: this.maps,
|
|
10563
|
+
target: targetId, x: e.clientX, y: e.clientY
|
|
10564
|
+
};
|
|
10565
|
+
this.maps.trigger(markerClusterMouseMove, eventArgs);
|
|
10397
10566
|
}
|
|
10398
10567
|
/**
|
|
10399
10568
|
* Get module name.
|
|
10400
10569
|
*
|
|
10401
|
-
* @returns {string} - Returns the module name
|
|
10570
|
+
* @returns {string} - Returns the module name
|
|
10402
10571
|
*/
|
|
10403
10572
|
getModuleName() {
|
|
10404
|
-
return '
|
|
10573
|
+
return 'Marker';
|
|
10405
10574
|
}
|
|
10406
10575
|
/**
|
|
10407
|
-
* To destroy the
|
|
10576
|
+
* To destroy the layers.
|
|
10408
10577
|
*
|
|
10409
10578
|
* @returns {void}
|
|
10410
10579
|
* @private
|
|
10411
10580
|
*/
|
|
10412
10581
|
destroy() {
|
|
10413
|
-
this.
|
|
10414
|
-
|
|
10415
|
-
|
|
10582
|
+
this.maps = null;
|
|
10583
|
+
this.trackElements = [];
|
|
10584
|
+
this.markerSVGObject = null;
|
|
10585
|
+
this.sameMarkerData = [];
|
|
10586
|
+
}
|
|
10587
|
+
}
|
|
10588
|
+
|
|
10589
|
+
/**
|
|
10590
|
+
* When injected, this module will be used to render polygon shapes over the Maps.
|
|
10591
|
+
*/
|
|
10592
|
+
class Polygon {
|
|
10593
|
+
constructor(maps) {
|
|
10594
|
+
this.maps = maps;
|
|
10595
|
+
}
|
|
10596
|
+
/**
|
|
10597
|
+
* To render polygon for maps
|
|
10598
|
+
*
|
|
10599
|
+
* @param {Maps} maps - Specifies the layer instance to which the polygon is to be rendered.
|
|
10600
|
+
* @param {number} layerIndex -Specifies the index of current layer.
|
|
10601
|
+
* @param {number} factor - Specifies the current zoom factor of the Maps.
|
|
10602
|
+
* @returns {Element} - Returns the polygon element.
|
|
10603
|
+
* @private
|
|
10604
|
+
*/
|
|
10605
|
+
polygonRender(maps, layerIndex, factor) {
|
|
10606
|
+
const currentLayer = maps.layersCollection[layerIndex];
|
|
10607
|
+
const polygonsSVGObject = maps.renderer.createGroup({
|
|
10608
|
+
id: maps.element.id + '_LayerIndex_' + layerIndex + '_Polygons_Group'
|
|
10609
|
+
});
|
|
10610
|
+
currentLayer.polygonSettings.polygons.map((polygonSetting, polygonIndex) => {
|
|
10611
|
+
const polygonSVGObject = maps.renderer.createGroup({
|
|
10612
|
+
id: maps.element.id + '_LayerIndex_' + layerIndex + '_Polygons_Group_' + polygonIndex
|
|
10613
|
+
});
|
|
10614
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10615
|
+
const polygonData = polygonSetting.points;
|
|
10616
|
+
const path = calculatePolygonPath(maps, factor, currentLayer, polygonData);
|
|
10617
|
+
const pathOptions = new PathOption(maps.element.id + '_LayerIndex_' + layerIndex + '_PolygonIndex_' + polygonIndex, polygonSetting.fill, (polygonSetting.borderWidth / factor), polygonSetting.borderColor, polygonSetting.opacity, polygonSetting.borderOpacity, '', path);
|
|
10618
|
+
const polygonEle = maps.renderer.drawPath(pathOptions);
|
|
10619
|
+
maintainSelection(this.maps.selectedPolygonElementId, this.maps.polygonSelectionClass, polygonEle, 'PolygonselectionMapStyle');
|
|
10620
|
+
polygonSVGObject.appendChild(polygonEle);
|
|
10621
|
+
polygonsSVGObject.appendChild(polygonSVGObject);
|
|
10622
|
+
});
|
|
10623
|
+
return polygonsSVGObject;
|
|
10624
|
+
}
|
|
10625
|
+
/**
|
|
10626
|
+
* Get module name.
|
|
10627
|
+
*
|
|
10628
|
+
* @returns {string} - Returns the module name
|
|
10629
|
+
*/
|
|
10630
|
+
getModuleName() {
|
|
10631
|
+
return 'Polygon';
|
|
10632
|
+
}
|
|
10633
|
+
/**
|
|
10634
|
+
* To destroy the layers.
|
|
10635
|
+
*
|
|
10636
|
+
* @returns {void}
|
|
10637
|
+
* @private
|
|
10638
|
+
*/
|
|
10639
|
+
destroy() {
|
|
10640
|
+
this.maps = null;
|
|
10416
10641
|
}
|
|
10417
10642
|
}
|
|
10418
10643
|
|
|
@@ -12789,7 +13014,7 @@ class Legend {
|
|
|
12789
13014
|
const legendToggleBorderWidth = this.maps.legendSettings.toggleLegendSettings.border.width;
|
|
12790
13015
|
const legendToggleBorderOpacity = isNullOrUndefined(this.maps.legendSettings.toggleLegendSettings.border.opacity) ?
|
|
12791
13016
|
this.maps.legendSettings.toggleLegendSettings.opacity : this.maps.legendSettings.toggleLegendSettings.border.opacity;
|
|
12792
|
-
if (targetEle.parentNode['id'].indexOf(this.maps.element.id + '_Legend_Index_') > -1) {
|
|
13017
|
+
if (!isNullOrUndefined(targetEle.parentNode) && targetEle.parentNode['id'].indexOf(this.maps.element.id + '_Legend_Index_') > -1) {
|
|
12793
13018
|
let mapElement;
|
|
12794
13019
|
const legendIndex = parseFloat(targetEle.parentElement.id.substr((this.maps.element.id + '_Legend_Index_').length));
|
|
12795
13020
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -13284,6 +13509,7 @@ class Highlight {
|
|
|
13284
13509
|
targetEle.getAttribute('class') !== 'MarkerselectionMapStyle' &&
|
|
13285
13510
|
targetEle.getAttribute('class') !== 'BubbleselectionMapStyle' &&
|
|
13286
13511
|
targetEle.getAttribute('class') !== 'navigationlineselectionMapStyle' &&
|
|
13512
|
+
targetEle.getAttribute('class') !== 'PolygonselectionMapStyle' &&
|
|
13287
13513
|
targetEle.getAttribute('class') !== 'LineselectionMapStyle') {
|
|
13288
13514
|
layerIndex = parseInt(targetEle.id.split('_LayerIndex_')[1].split('_')[0], 10);
|
|
13289
13515
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -13313,6 +13539,11 @@ class Highlight {
|
|
|
13313
13539
|
data = this.maps.layers[layerIndex].markerSettings[marker$$1].dataSource[dataIndex];
|
|
13314
13540
|
this.highlightSettings = this.maps.layers[layerIndex].markerSettings[marker$$1].highlightSettings;
|
|
13315
13541
|
}
|
|
13542
|
+
else if (targetEle.id.indexOf('_PolygonIndex_') > -1) {
|
|
13543
|
+
dataIndex = parseInt(targetEle.id.split('_PolygonIndex_')[1].split('_')[0], 10);
|
|
13544
|
+
data = this.maps.layers[layerIndex].polygonSettings.polygons[dataIndex].points;
|
|
13545
|
+
this.highlightSettings = this.maps.layers[layerIndex].polygonSettings.highlightSettings;
|
|
13546
|
+
}
|
|
13316
13547
|
else {
|
|
13317
13548
|
const index = parseInt(targetEle.id.split('_NavigationIndex_')[1].split('_')[0], 10);
|
|
13318
13549
|
layerIndex = parseInt(targetEle.id.split('_LayerIndex_')[1].split('_')[0], 10);
|
|
@@ -13549,6 +13780,12 @@ class Selection {
|
|
|
13549
13780
|
this.selectionsettings = this.maps.layers[layerIndex].markerSettings[markerIndex].selectionSettings;
|
|
13550
13781
|
this.selectionType = 'Marker';
|
|
13551
13782
|
}
|
|
13783
|
+
else if (targetElement.id.indexOf('_PolygonIndex_') > -1) {
|
|
13784
|
+
dataIndex = parseInt(targetElement.id.split('_PolygonIndex_')[1].split('_')[0], 10);
|
|
13785
|
+
data = this.maps.layers[layerIndex].polygonSettings.polygons[dataIndex].points;
|
|
13786
|
+
this.selectionsettings = this.maps.layers[layerIndex].polygonSettings.selectionSettings;
|
|
13787
|
+
this.selectionType = 'Polygon';
|
|
13788
|
+
}
|
|
13552
13789
|
else if (targetElement.id.indexOf('NavigationIndex') > -1) {
|
|
13553
13790
|
const index = parseInt(targetElement.id.split('_NavigationIndex_')[1].split('_')[0], 10);
|
|
13554
13791
|
shapeData = null;
|
|
@@ -13723,6 +13960,10 @@ class Selection {
|
|
|
13723
13960
|
this.maps.navigationSelectionClass = getElement(this.selectionType + 'selectionMap');
|
|
13724
13961
|
this.maps.selectedNavigationElementId.push(targetElement.getAttribute('id'));
|
|
13725
13962
|
}
|
|
13963
|
+
if (targetElement.getAttribute('class') === 'PolygonselectionMapStyle') {
|
|
13964
|
+
this.maps.polygonSelectionClass = getElement(this.selectionType + 'selectionMap');
|
|
13965
|
+
this.maps.selectedPolygonElementId.push(targetElement.getAttribute('id'));
|
|
13966
|
+
}
|
|
13726
13967
|
}
|
|
13727
13968
|
}
|
|
13728
13969
|
});
|
|
@@ -13762,6 +14003,9 @@ class Selection {
|
|
|
13762
14003
|
if (this.selectionType === 'navigationline') {
|
|
13763
14004
|
this.maps.selectedBubbleElementId.splice(this.maps.selectedBubbleElementId.indexOf(targetElement.getAttribute('id')), 1);
|
|
13764
14005
|
}
|
|
14006
|
+
if (this.selectionType === 'Polygon') {
|
|
14007
|
+
this.maps.selectedPolygonElementId.splice(this.maps.selectedPolygonElementId.indexOf(targetElement.getAttribute('id')), 1);
|
|
14008
|
+
}
|
|
13765
14009
|
}
|
|
13766
14010
|
/**
|
|
13767
14011
|
* Get module name.
|
|
@@ -13802,7 +14046,6 @@ class MapsTooltip {
|
|
|
13802
14046
|
let target;
|
|
13803
14047
|
let touchArg;
|
|
13804
14048
|
let tooltipArgs;
|
|
13805
|
-
let tooltipTemplateElement;
|
|
13806
14049
|
if (e.type.indexOf('touch') !== -1) {
|
|
13807
14050
|
this.isTouch = true;
|
|
13808
14051
|
touchArg = e;
|
|
@@ -13953,7 +14196,12 @@ class MapsTooltip {
|
|
|
13953
14196
|
id: this.maps.element.id + '_mapsTooltip',
|
|
13954
14197
|
className: 'EJ2-maps-Tooltip'
|
|
13955
14198
|
});
|
|
13956
|
-
|
|
14199
|
+
if (isNullOrUndefined(option.template) || option.template === '' || this.maps.tooltipDisplayMode === 'MouseMove') {
|
|
14200
|
+
tooltipEle.style.cssText = 'position: absolute;pointer-events:none;';
|
|
14201
|
+
}
|
|
14202
|
+
else {
|
|
14203
|
+
tooltipEle.style.position = 'absolute';
|
|
14204
|
+
}
|
|
13957
14205
|
document.getElementById(this.maps.element.id + '_Secondary_Element').appendChild(tooltipEle);
|
|
13958
14206
|
}
|
|
13959
14207
|
if (typeof option.template !== 'function' && option.template !== null && Object.keys(typeof option.template === 'object' ? option.template : {}).length === 1) {
|
|
@@ -13997,8 +14245,8 @@ class MapsTooltip {
|
|
|
13997
14245
|
header: '',
|
|
13998
14246
|
data: option['data'],
|
|
13999
14247
|
template: option['template'],
|
|
14000
|
-
content: tooltipArgs.content.toString() !== currentData.toString() ? [
|
|
14001
|
-
[
|
|
14248
|
+
content: tooltipArgs.content.toString() !== currentData.toString() ? [tooltipArgs.content.toString()] :
|
|
14249
|
+
[currentData.toString()],
|
|
14002
14250
|
shapes: [],
|
|
14003
14251
|
location: option['location'],
|
|
14004
14252
|
palette: [markerFill],
|
|
@@ -14015,8 +14263,8 @@ class MapsTooltip {
|
|
|
14015
14263
|
header: '',
|
|
14016
14264
|
data: tooltipArgs.options['data'],
|
|
14017
14265
|
template: tooltipArgs.options['template'],
|
|
14018
|
-
content: tooltipArgs.content.toString() !== currentData.toString() ? [
|
|
14019
|
-
[
|
|
14266
|
+
content: tooltipArgs.content.toString() !== currentData.toString() ? [tooltipArgs.content.toString()] :
|
|
14267
|
+
[currentData.toString()],
|
|
14020
14268
|
shapes: [],
|
|
14021
14269
|
location: tooltipArgs.options['location'],
|
|
14022
14270
|
palette: [markerFill],
|
|
@@ -14035,13 +14283,6 @@ class MapsTooltip {
|
|
|
14035
14283
|
this.svgTooltip.appendTo(tooltipEle);
|
|
14036
14284
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14037
14285
|
this.maps.renderReactTemplates();
|
|
14038
|
-
tooltipTemplateElement = document.getElementById(this.maps.element.id + '_mapsTooltip');
|
|
14039
|
-
if (tooltipTemplateElement !== null && tooltipTemplateElement.innerHTML.indexOf('href') !== -1
|
|
14040
|
-
&& tooltipTemplateElement.innerHTML.indexOf('</a>') !== -1) {
|
|
14041
|
-
let templateStyle = tooltipTemplateElement.getAttribute('style');
|
|
14042
|
-
templateStyle = templateStyle.replace('pointer-events: none;', 'position-events:all;');
|
|
14043
|
-
tooltipTemplateElement.style.cssText = templateStyle;
|
|
14044
|
-
}
|
|
14045
14286
|
}
|
|
14046
14287
|
else {
|
|
14047
14288
|
this.clearTooltip(e.target);
|
|
@@ -14063,12 +14304,8 @@ class MapsTooltip {
|
|
|
14063
14304
|
}
|
|
14064
14305
|
}
|
|
14065
14306
|
else {
|
|
14066
|
-
|
|
14067
|
-
if (
|
|
14068
|
-
&& tooltipTemplateElement.innerHTML.indexOf('</a>') !== -1) {
|
|
14069
|
-
this.maps.notify(click, this);
|
|
14070
|
-
}
|
|
14071
|
-
else {
|
|
14307
|
+
let tooltipElement = e.target.closest('#' + this.maps.element.id + '_mapsTooltipparent_template');
|
|
14308
|
+
if (isNullOrUndefined(tooltipElement)) {
|
|
14072
14309
|
this.clearTooltip(e.target);
|
|
14073
14310
|
}
|
|
14074
14311
|
}
|
|
@@ -14258,10 +14495,10 @@ class Zoom {
|
|
|
14258
14495
|
*/
|
|
14259
14496
|
performZooming(position, newZoomFactor, type) {
|
|
14260
14497
|
const map = this.maps;
|
|
14261
|
-
map.previousProjection = map.projectionType;
|
|
14498
|
+
map.previousProjection = newZoomFactor <= 1.5 ? undefined : map.projectionType;
|
|
14262
14499
|
map.defaultState = false;
|
|
14263
14500
|
map.initialCheck = false;
|
|
14264
|
-
map.markerZoomedState = false;
|
|
14501
|
+
map.markerZoomedState = map.isMarkerZoomCompleted = false;
|
|
14265
14502
|
map.zoomPersistence = map.enablePersistence;
|
|
14266
14503
|
const prevLevel = map.tileZoomLevel;
|
|
14267
14504
|
const scale = map.previousScale = map.scale;
|
|
@@ -14309,6 +14546,7 @@ class Zoom {
|
|
|
14309
14546
|
map.translatePoint = new Point(translatePointX, translatePointY);
|
|
14310
14547
|
}
|
|
14311
14548
|
map.scale = newZoomFactor;
|
|
14549
|
+
map.zoomTranslatePoint = map.translatePoint;
|
|
14312
14550
|
if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
|
|
14313
14551
|
map.translatePoint = map.previousPoint;
|
|
14314
14552
|
map.scale = map.mapScaleValue = map.previousScale;
|
|
@@ -14330,6 +14568,7 @@ class Zoom {
|
|
|
14330
14568
|
newZoomFactor = map.tileZoomLevel = map.mapScaleValue = map.initialZoomLevel;
|
|
14331
14569
|
map.scale = Math.pow(2, newZoomFactor - 1);
|
|
14332
14570
|
}
|
|
14571
|
+
map.mapScaleValue = isNaN(map.mapScaleValue) ? 1 : map.mapScaleValue;
|
|
14333
14572
|
map.translatePoint.y = (map.tileTranslatePoint.y - (0.01 * map.mapScaleValue)) / map.scale;
|
|
14334
14573
|
map.translatePoint.x = (map.tileTranslatePoint.x - (0.01 * map.mapScaleValue)) / map.scale;
|
|
14335
14574
|
if (this.triggerZoomEvent(prevTilePoint, prevLevel, type)) {
|
|
@@ -14383,18 +14622,28 @@ class Zoom {
|
|
|
14383
14622
|
triggerZoomEvent(prevTilePoint, prevLevel, type) {
|
|
14384
14623
|
const map = this.maps;
|
|
14385
14624
|
let zoomArgs;
|
|
14625
|
+
if (map.isTileMap) {
|
|
14626
|
+
map.mapScaleValue = isNullOrUndefined(map.mapScaleValue) ? 1 : map.mapScaleValue;
|
|
14627
|
+
map.translatePoint.y = (map.tileTranslatePoint.y - (0.01 * map.mapScaleValue)) / map.scale;
|
|
14628
|
+
map.translatePoint.x = (map.tileTranslatePoint.x - (0.01 * map.mapScaleValue)) / map.scale;
|
|
14629
|
+
}
|
|
14630
|
+
const minMaxLatitudeLongitude = this.maps.getMinMaxLatitudeLongitude();
|
|
14386
14631
|
if (!map.isTileMap) {
|
|
14387
14632
|
zoomArgs = {
|
|
14388
14633
|
cancel: false, name: 'zoom', type: type, maps: map,
|
|
14389
14634
|
tileTranslatePoint: {}, translatePoint: { previous: map.previousPoint, current: map.translatePoint },
|
|
14390
|
-
tileZoomLevel: {}, scale: { previous: map.previousScale, current: map.scale }
|
|
14635
|
+
tileZoomLevel: {}, scale: { previous: map.previousScale, current: map.scale },
|
|
14636
|
+
minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
|
|
14637
|
+
minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
|
|
14391
14638
|
};
|
|
14392
14639
|
}
|
|
14393
14640
|
else {
|
|
14394
14641
|
zoomArgs = {
|
|
14395
14642
|
cancel: false, name: 'zoom', type: type, maps: map,
|
|
14396
14643
|
tileTranslatePoint: { previous: prevTilePoint, current: map.tileTranslatePoint }, translatePoint: { previous: map.previousPoint, current: map.translatePoint },
|
|
14397
|
-
tileZoomLevel: { previous: prevLevel, current: map.tileZoomLevel }, scale: { previous: map.previousScale, current: map.scale }
|
|
14644
|
+
tileZoomLevel: { previous: prevLevel, current: map.tileZoomLevel }, scale: { previous: map.previousScale, current: map.scale },
|
|
14645
|
+
minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
|
|
14646
|
+
minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
|
|
14398
14647
|
};
|
|
14399
14648
|
}
|
|
14400
14649
|
map.trigger('zoom', zoomArgs);
|
|
@@ -14443,6 +14692,7 @@ class Zoom {
|
|
|
14443
14692
|
map.translatePoint = new Point(translatePointX, translatePointY);
|
|
14444
14693
|
}
|
|
14445
14694
|
map.scale = zoomCalculationFactor < this.maps.zoomSettings.maxZoom ? zoomCalculationFactor : this.maps.zoomSettings.maxZoom;
|
|
14695
|
+
map.zoomTranslatePoint = map.translatePoint;
|
|
14446
14696
|
isZoomCancelled = this.triggerZoomEvent(prevTilePoint, prevLevel, '');
|
|
14447
14697
|
if (isZoomCancelled) {
|
|
14448
14698
|
map.translatePoint = map.previousPoint;
|
|
@@ -14498,6 +14748,7 @@ class Zoom {
|
|
|
14498
14748
|
const map = this.maps;
|
|
14499
14749
|
const prevLevel = map.tileZoomLevel;
|
|
14500
14750
|
const availSize = map.mapAreaRect;
|
|
14751
|
+
map.isMarkerZoomCompleted = false;
|
|
14501
14752
|
map.previousScale = map.scale;
|
|
14502
14753
|
map.previousPoint = map.translatePoint;
|
|
14503
14754
|
map.previousProjection = map.projectionType;
|
|
@@ -14613,7 +14864,9 @@ class Zoom {
|
|
|
14613
14864
|
animateTransform(element, animate$$1, x, y, scale) {
|
|
14614
14865
|
const duration = this.currentLayer.animationDuration === 0 && animationMode === 'Enable' ? 1000 : this.currentLayer.animationDuration;
|
|
14615
14866
|
if (!animate$$1 || duration === 0 || this.maps.isTileMap) {
|
|
14616
|
-
|
|
14867
|
+
if (!(this.maps.isTileMap && element.id.indexOf('_Polygons_Group') > -1)) {
|
|
14868
|
+
element.setAttribute('transform', 'scale(' + (scale) + ') translate( ' + x + ' ' + y + ' )');
|
|
14869
|
+
}
|
|
14617
14870
|
return;
|
|
14618
14871
|
}
|
|
14619
14872
|
if (!this.maps.isTileMap) {
|
|
@@ -14657,6 +14910,17 @@ class Zoom {
|
|
|
14657
14910
|
layerElement.appendChild(maps.navigationLineModule.renderNavigation(this.currentLayer, maps.tileZoomLevel, this.index));
|
|
14658
14911
|
}
|
|
14659
14912
|
}
|
|
14913
|
+
else if (maps.isTileMap && (currentEle.id.indexOf('_Polygons_Group') > -1)) {
|
|
14914
|
+
if (this.currentLayer.polygonSettings.polygons.length > 0) {
|
|
14915
|
+
this.currentLayer.polygonSettings.polygons.map((polygonSettings, polygonIndex) => {
|
|
14916
|
+
const markerData = polygonSettings.points;
|
|
14917
|
+
const path = calculatePolygonPath(maps, maps.tileZoomLevel, this.currentLayer, markerData);
|
|
14918
|
+
let element = document.getElementById(maps.element.id + '_LayerIndex_' + this.index + '_PolygonIndex_' + polygonIndex);
|
|
14919
|
+
element.setAttribute('d', path);
|
|
14920
|
+
});
|
|
14921
|
+
document.getElementById(maps.element.id + '_LayerIndex_' + this.index + '_Polygons_Group').style.visibility = '';
|
|
14922
|
+
}
|
|
14923
|
+
}
|
|
14660
14924
|
else if (currentEle.id.indexOf('Legend') === -1) {
|
|
14661
14925
|
changeBorderWidth(currentEle, this.index, scale, maps);
|
|
14662
14926
|
maps.zoomTranslatePoint = maps.translatePoint;
|
|
@@ -14664,26 +14928,28 @@ class Zoom {
|
|
|
14664
14928
|
}
|
|
14665
14929
|
}
|
|
14666
14930
|
else if (currentEle.id.indexOf('_Markers_Group') > -1) {
|
|
14667
|
-
if (!this.isPanning && !isNullOrUndefined(currentEle.childNodes[0])) {
|
|
14931
|
+
if ((!this.isPanning) && !isNullOrUndefined(currentEle.childNodes[0])) {
|
|
14668
14932
|
this.markerTranslates(currentEle.childNodes[0], factor, x, y, scale, 'Marker', layerElement, animate$$1);
|
|
14669
14933
|
}
|
|
14670
14934
|
currentEle = layerElement.childNodes[j];
|
|
14671
14935
|
let markerAnimation;
|
|
14672
14936
|
if (!isNullOrUndefined(currentEle) && currentEle.id.indexOf('Markers') !== -1) {
|
|
14673
|
-
|
|
14674
|
-
this.markerTranslate(
|
|
14675
|
-
const layerIndex = parseInt(
|
|
14676
|
-
const dataIndex = parseInt(
|
|
14677
|
-
const markerIndex = parseInt(
|
|
14937
|
+
Array.prototype.forEach.call(currentEle.childNodes, (childNode, k) => {
|
|
14938
|
+
this.markerTranslate(childNode, factor, x, y, scale, 'Marker', animate$$1);
|
|
14939
|
+
const layerIndex = parseInt(childNode['id'].split('_LayerIndex_')[1].split('_')[0], 10);
|
|
14940
|
+
const dataIndex = parseInt(childNode['id'].split('_dataIndex_')[1].split('_')[0], 10);
|
|
14941
|
+
const markerIndex = parseInt(childNode['id'].split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
14678
14942
|
markerAnimation = this.currentLayer.markerSettings[markerIndex].animationDuration > 0 || animationMode === 'Enable';
|
|
14679
|
-
|
|
14680
|
-
|
|
14681
|
-
|
|
14682
|
-
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
|
|
14686
|
-
|
|
14943
|
+
if (this.currentLayer.markerSettings[markerIndex].initialMarkerSelection.length > 0) {
|
|
14944
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14945
|
+
const markerSelectionValues = this.currentLayer.markerSettings[markerIndex].dataSource[dataIndex];
|
|
14946
|
+
for (let x = 0; x < this.currentLayer.markerSettings[markerIndex].initialMarkerSelection.length; x++) {
|
|
14947
|
+
if (this.currentLayer.markerSettings[markerIndex].initialMarkerSelection[x]['latitude'] ===
|
|
14948
|
+
markerSelectionValues['latitude'] ||
|
|
14949
|
+
this.currentLayer.markerSettings[markerIndex].initialMarkerSelection[x]['longitude'] ===
|
|
14950
|
+
markerSelectionValues['longitude']) {
|
|
14951
|
+
maps.markerSelection(this.currentLayer.markerSettings[markerIndex].selectionSettings, maps, currentEle.children[k], this.currentLayer.markerSettings[markerIndex].dataSource[dataIndex]);
|
|
14952
|
+
}
|
|
14687
14953
|
}
|
|
14688
14954
|
}
|
|
14689
14955
|
if (((this.currentLayer.animationDuration > 0 || animationMode === 'Enable') || ((maps.layersCollection[0].animationDuration > 0 || animationMode === 'Enable') && this.currentLayer.type === 'SubLayer')) && !this.isPanning) {
|
|
@@ -14698,7 +14964,7 @@ class Zoom {
|
|
|
14698
14964
|
currentEle.style.cssText = markerStyle;
|
|
14699
14965
|
}
|
|
14700
14966
|
}
|
|
14701
|
-
}
|
|
14967
|
+
});
|
|
14702
14968
|
if (this.isPanning && maps.markerModule.sameMarkerData.length > 0) {
|
|
14703
14969
|
clusterSeparate(maps.markerModule.sameMarkerData, maps, currentEle, true);
|
|
14704
14970
|
}
|
|
@@ -14830,7 +15096,7 @@ class Zoom {
|
|
|
14830
15096
|
removeElement(markerTemplateElements.id);
|
|
14831
15097
|
}
|
|
14832
15098
|
const currentLayers = this.maps.layersCollection[layerIndex];
|
|
14833
|
-
currentLayers.markerSettings
|
|
15099
|
+
Array.prototype.forEach.call(currentLayers.markerSettings, (markerSettings, markerIndex) => {
|
|
14834
15100
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14835
15101
|
const markerDatas = markerSettings.dataSource;
|
|
14836
15102
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -14879,9 +15145,22 @@ class Zoom {
|
|
|
14879
15145
|
this.maps.markerNullCount = (isNullOrUndefined(lati) || isNullOrUndefined(long))
|
|
14880
15146
|
? this.maps.markerNullCount + 1 : this.maps.markerNullCount;
|
|
14881
15147
|
const markerDataLength = markerDatas.length - this.maps.markerNullCount;
|
|
15148
|
+
let isMarkersClustered = false;
|
|
14882
15149
|
if (markerSVGObject.childElementCount === (markerDataLength - markerTemplateCounts - nullCount) && (type !== 'Template')) {
|
|
14883
15150
|
if (this.maps.isTileMap) {
|
|
14884
|
-
|
|
15151
|
+
const polygonsElement = document.getElementById(this.maps.element.id + '_LayerIndex_' + layerIndex + '_Polygons_Group');
|
|
15152
|
+
const polygonElement = document.getElementById(this.maps.element.id + '_LayerIndex_' + layerIndex + '_Polygon_Group');
|
|
15153
|
+
if (!isNullOrUndefined(polygonsElement)) {
|
|
15154
|
+
polygonsElement.insertAdjacentElement('afterend', markerSVGObject);
|
|
15155
|
+
}
|
|
15156
|
+
else {
|
|
15157
|
+
if (!isNullOrUndefined(polygonElement)) {
|
|
15158
|
+
polygonElement.insertAdjacentElement('afterend', markerSVGObject);
|
|
15159
|
+
}
|
|
15160
|
+
else {
|
|
15161
|
+
layerElement.insertBefore(markerSVGObject, layerElement.firstElementChild);
|
|
15162
|
+
}
|
|
15163
|
+
}
|
|
14885
15164
|
}
|
|
14886
15165
|
else {
|
|
14887
15166
|
layerElement.appendChild(markerSVGObject);
|
|
@@ -14889,13 +15168,13 @@ class Zoom {
|
|
|
14889
15168
|
if (currentLayers.markerClusterSettings.allowClustering) {
|
|
14890
15169
|
this.maps.svgObject.appendChild(markerSVGObject);
|
|
14891
15170
|
this.maps.element.appendChild(this.maps.svgObject);
|
|
14892
|
-
clusterTemplate(currentLayers, markerSVGObject, this.maps, layerIndex, markerSVGObject, layerElement, true, true);
|
|
15171
|
+
isMarkersClustered = clusterTemplate(currentLayers, markerSVGObject, this.maps, layerIndex, markerSVGObject, layerElement, true, true);
|
|
14893
15172
|
}
|
|
14894
15173
|
}
|
|
14895
15174
|
if (markerTemplateElements.childElementCount === (markerDataLength - markerCounts - nullCount) && getElementByID(this.maps.element.id + '_Secondary_Element')) {
|
|
14896
15175
|
getElementByID(this.maps.element.id + '_Secondary_Element').appendChild(markerTemplateElements);
|
|
14897
15176
|
if (scale >= 1) {
|
|
14898
|
-
if (currentLayers.markerClusterSettings.allowClustering) {
|
|
15177
|
+
if (currentLayers.markerClusterSettings.allowClustering && !isMarkersClustered) {
|
|
14899
15178
|
clusterTemplate(currentLayers, markerTemplateElements, this.maps, layerIndex, markerSVGObject, layerElement, false, true);
|
|
14900
15179
|
}
|
|
14901
15180
|
}
|
|
@@ -14921,6 +15200,8 @@ class Zoom {
|
|
|
14921
15200
|
i + '_Markers_Template_Group');
|
|
14922
15201
|
const datalabelTemplateElemement = getElementByID(maps.element.id + '_LayerIndex_'
|
|
14923
15202
|
+ i + '_Label_Template_Group');
|
|
15203
|
+
const polygonElement = getElementByID(maps.element.id + '_LayerIndex_'
|
|
15204
|
+
+ i + '_Polygons_Group');
|
|
14924
15205
|
if ((!isNullOrUndefined(markerTemplateElement)) && markerTemplateElement.childElementCount > 0) {
|
|
14925
15206
|
markerTemplateElement.style.visibility = 'visible';
|
|
14926
15207
|
for (let k = 0; k < markerTemplateElement.childElementCount; k++) {
|
|
@@ -14932,6 +15213,12 @@ class Zoom {
|
|
|
14932
15213
|
this.dataLabelTranslate(datalabelTemplateElemement.childNodes[k], factor, x, y, scale, 'Template');
|
|
14933
15214
|
}
|
|
14934
15215
|
}
|
|
15216
|
+
if (!isNullOrUndefined(polygonElement)) {
|
|
15217
|
+
for (let k = 0; k < polygonElement.childElementCount; k++) {
|
|
15218
|
+
let width = maps.layersCollection[i].polygonSettings.polygons[k].borderWidth;
|
|
15219
|
+
polygonElement.childNodes[k].childNodes[0].setAttribute('stroke-width', (width / scale).toString());
|
|
15220
|
+
}
|
|
15221
|
+
}
|
|
14935
15222
|
}
|
|
14936
15223
|
}
|
|
14937
15224
|
dataLabelTranslate(element, factor, x, y, scale, type, animate$$1 = false) {
|
|
@@ -14985,7 +15272,6 @@ class Zoom {
|
|
|
14985
15272
|
zoomtextSize = measureText(zoomtext, style);
|
|
14986
15273
|
const start = labelY - zoomtextSize['height'] / 4;
|
|
14987
15274
|
const end = labelY + zoomtextSize['height'] / 4;
|
|
14988
|
-
labelY = end;
|
|
14989
15275
|
const xpositionEnds = labelX + zoomtextSize['width'] / 2;
|
|
14990
15276
|
const xpositionStart = labelX - zoomtextSize['width'] / 2;
|
|
14991
15277
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -15157,12 +15443,16 @@ class Zoom {
|
|
|
15157
15443
|
for (let i = 0; i < map.layersCollection.length; i++) {
|
|
15158
15444
|
const markerTemplateElement = getElementByID(this.maps.element.id + '_LayerIndex_' + i + '_Markers_Template_Group');
|
|
15159
15445
|
const lineElement = getElementByID(this.maps.element.id + '_LayerIndex_' + i + '_line_Group');
|
|
15446
|
+
const polygonElement = getElementByID(this.maps.element.id + '_LayerIndex_' + i + '_Polygons_Group');
|
|
15160
15447
|
if (!isNullOrUndefined(markerTemplateElement)) {
|
|
15161
15448
|
markerTemplateElement.style.visibility = 'hidden';
|
|
15162
15449
|
}
|
|
15163
15450
|
if (!isNullOrUndefined(lineElement)) {
|
|
15164
15451
|
lineElement.style.visibility = 'hidden';
|
|
15165
15452
|
}
|
|
15453
|
+
if (!isNullOrUndefined(polygonElement)) {
|
|
15454
|
+
polygonElement.style.visibility = 'hidden';
|
|
15455
|
+
}
|
|
15166
15456
|
}
|
|
15167
15457
|
}
|
|
15168
15458
|
}
|
|
@@ -15204,10 +15494,13 @@ class Zoom {
|
|
|
15204
15494
|
((layerRect.top + layerRect.height + legendHeight + map.margin.top) >= (elementRect.top + elementRect.height))));
|
|
15205
15495
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15206
15496
|
const location = this.maps.getGeoLocation(this.maps.layersCollection.length - 1, mouseLocation['layerX'], mouseLocation['layerY']);
|
|
15497
|
+
const minMaxLatitudeLongitude = this.maps.getMinMaxLatitudeLongitude();
|
|
15207
15498
|
panArgs = {
|
|
15208
15499
|
cancel: false, name: pan, maps: map,
|
|
15209
15500
|
tileTranslatePoint: {}, translatePoint: { previous: translatePoint, current: new Point(x, y) },
|
|
15210
|
-
scale: map.scale, tileZoomLevel: map.tileZoomLevel, latitude: location['latitude'], longitude: location['longitude']
|
|
15501
|
+
scale: map.scale, tileZoomLevel: map.tileZoomLevel, latitude: location['latitude'], longitude: location['longitude'],
|
|
15502
|
+
minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
|
|
15503
|
+
minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
|
|
15211
15504
|
};
|
|
15212
15505
|
map.trigger(pan, panArgs);
|
|
15213
15506
|
if (!panArgs.cancel) {
|
|
@@ -15241,11 +15534,14 @@ class Zoom {
|
|
|
15241
15534
|
map.translatePoint.y = (map.tileTranslatePoint.y - yDifference) / map.scale;
|
|
15242
15535
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15243
15536
|
const location = this.maps.getTileGeoLocation(mouseLocation['layerX'], mouseLocation['layerY']);
|
|
15537
|
+
const minMaxLatitudeLongitude = this.maps.getMinMaxLatitudeLongitude();
|
|
15244
15538
|
panArgs = {
|
|
15245
15539
|
cancel: false, name: pan, maps: map,
|
|
15246
15540
|
tileTranslatePoint: { previous: prevTilePoint, current: map.tileTranslatePoint },
|
|
15247
15541
|
translatePoint: { previous: translatePoint, current: map.translatePoint }, scale: map.scale,
|
|
15248
|
-
tileZoomLevel: map.tileZoomLevel, latitude: location['latitude'], longitude: location['longitude']
|
|
15542
|
+
tileZoomLevel: map.tileZoomLevel, latitude: location['latitude'], longitude: location['longitude'],
|
|
15543
|
+
minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
|
|
15544
|
+
minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
|
|
15249
15545
|
};
|
|
15250
15546
|
map.trigger(pan, panArgs);
|
|
15251
15547
|
map.mapLayerPanel.generateTiles(map.tileZoomLevel, map.tileTranslatePoint, 'Pan');
|
|
@@ -15267,7 +15563,7 @@ class Zoom {
|
|
|
15267
15563
|
*/
|
|
15268
15564
|
toolBarZooming(zoomFactor, type) {
|
|
15269
15565
|
const map = this.maps;
|
|
15270
|
-
map.initialCheck = false;
|
|
15566
|
+
map.initialCheck = map.isMarkerZoomCompleted = false;
|
|
15271
15567
|
map.defaultState = ((type === 'Reset' && zoomFactor === 1 && !(map.zoomSettings.resetToInitial && map.applyZoomReset))
|
|
15272
15568
|
|| (type === 'ZoomOut' && zoomFactor === 1));
|
|
15273
15569
|
const prevLevel = map.tileZoomLevel;
|
|
@@ -15280,7 +15576,7 @@ class Zoom {
|
|
|
15280
15576
|
const size = map.mapAreaRect;
|
|
15281
15577
|
const translatePoint = map.previousPoint = map.translatePoint;
|
|
15282
15578
|
const prevTilePoint = map.tileTranslatePoint;
|
|
15283
|
-
map.previousProjection =
|
|
15579
|
+
map.previousProjection = type === 'Reset' ? undefined : map.projectionType;
|
|
15284
15580
|
zoomFactor = (type === 'ZoomOut') ? (Math.round(zoomFactor) === 1 ? 1 : zoomFactor) : zoomFactor;
|
|
15285
15581
|
zoomFactor = (type === 'Reset') ? minZoom : (Math.round(zoomFactor) === 0) ? 1 : zoomFactor;
|
|
15286
15582
|
zoomFactor = (minZoom > zoomFactor && type === 'ZoomIn') ? minZoom + 1 : zoomFactor;
|
|
@@ -15538,7 +15834,10 @@ class Zoom {
|
|
|
15538
15834
|
isToolbarPerform = (this.maps.isTileMap ? this.maps.tileZoomLevel : this.maps.scale) + 1 <= this.maps.zoomSettings.maxZoom;
|
|
15539
15835
|
break;
|
|
15540
15836
|
case 'zoomout':
|
|
15541
|
-
|
|
15837
|
+
const scaleValue = this.maps.isTileMap ? this.maps.tileZoomLevel : this.maps.scale;
|
|
15838
|
+
isToolbarPerform = (this.maps.projectionType === 'Miller' || this.maps.projectionType === 'Winkel3' ||
|
|
15839
|
+
this.maps.projectionType === 'AitOff') ? Math.round(scaleValue) - 1 >= this.maps.zoomSettings.minZoom :
|
|
15840
|
+
(scaleValue) - 1 >= this.maps.zoomSettings.minZoom;
|
|
15542
15841
|
break;
|
|
15543
15842
|
case 'reset':
|
|
15544
15843
|
isToolbarPerform = Math.round(this.maps.isTileMap ? this.maps.tileZoomLevel : this.maps.scale) != this.maps.zoomSettings.minZoom;
|
|
@@ -15972,8 +16271,9 @@ class Zoom {
|
|
|
15972
16271
|
const pageX = e.pageX;
|
|
15973
16272
|
const pageY = e.pageY;
|
|
15974
16273
|
const target = e.target;
|
|
16274
|
+
let tooltipElement = e.target.closest('#' + this.maps.element.id + '_mapsTooltipparent_template');
|
|
15975
16275
|
if (this.maps.zoomSettings.enable && this.maps.zoomSettings.doubleClickZoom
|
|
15976
|
-
&& !(e.target['id'].indexOf('_Zooming_') > -1)) {
|
|
16276
|
+
&& !(e.target['id'].indexOf('_Zooming_') > -1) && isNullOrUndefined(tooltipElement)) {
|
|
15977
16277
|
const position = this.getMousePosition(pageX, pageY);
|
|
15978
16278
|
const map = this.maps;
|
|
15979
16279
|
const size = map.availableSize;
|
|
@@ -16146,8 +16446,9 @@ class Zoom {
|
|
|
16146
16446
|
*/
|
|
16147
16447
|
click(e) {
|
|
16148
16448
|
const map = this.maps;
|
|
16449
|
+
let tooltipElement = e.target.closest('#' + this.maps.element.id + '_mapsTooltipparent_template');
|
|
16149
16450
|
if ((map.markerModule && map.markerModule.sameMarkerData.length > 0) ||
|
|
16150
|
-
(e.target['id'].indexOf('MarkerIndex') > -1 && e.target['id'].indexOf('cluster') === -1)) {
|
|
16451
|
+
(e.target['id'].indexOf('MarkerIndex') > -1 && e.target['id'].indexOf('cluster') === -1) || !isNullOrUndefined(tooltipElement)) {
|
|
16151
16452
|
return null;
|
|
16152
16453
|
}
|
|
16153
16454
|
if (this.isSingleClick && map.zoomSettings.zoomOnClick && !(e.target['id'].indexOf('_Zooming_') > -1) && !map.zoomSettings.doubleClickZoom
|
|
@@ -16716,5 +17017,5 @@ class PdfExport {
|
|
|
16716
17017
|
* exporting all modules from maps index
|
|
16717
17018
|
*/
|
|
16718
17019
|
|
|
16719
|
-
export { Maps, load, loaded, click, onclick, rightClick, doubleClick, resize, tooltipRender, shapeSelected, shapeHighlight, mousemove, mouseup, mousedown, layerRendering, shapeRendering, markerRendering, markerClusterRendering, markerClick, markerDragStart, markerDragEnd, markerClusterClick, markerMouseMove, markerClusterMouseMove, dataLabelRendering, bubbleRendering, bubbleClick, bubbleMouseMove, animationComplete, legendRendering, annotationRendering, itemSelection, itemHighlight, beforePrint, zoomIn, zoomOut, pan, Annotation, Arrow, Font, ZoomToolbarButtonSettings, ZoomToolbarTooltipSettings, ZoomToolbarSettings, Border, CenterPosition, TooltipSettings, Margin, ConnectorLineSettings, MarkerClusterSettings, MarkerClusterData, ColorMappingSettings, InitialMarkerSelectionSettings, InitialShapeSelectionSettings, SelectionSettings, HighlightSettings, NavigationLineSettings, BubbleSettings, CommonTitleSettings, SubTitleSettings, TitleSettings, ZoomSettings, ToggleLegendSettings, LegendSettings, DataLabelSettings, ShapeSettings, MarkerBase, MarkerSettings, LayerSettings, Tile, MapsAreaSettings, Size, stringToNumber, calculateSize, createSvg, getMousePosition, degreesToRadians, radiansToDegrees, convertGeoToPoint, convertTileLatLongToPoint, xToCoordinate, yToCoordinate, aitoff, roundTo, sinci, acos, calculateBound, triggerDownload, Point, MinMax, GeoLocation, measureText, TextOption, PathOption, ColorValue, RectOption, CircleOption, PolygonOption, PolylineOption, LineOption, Line, MapLocation, Rect, PatternOptions, renderTextElement, convertElement, formatValue, convertStringToValue, convertElementFromLabel, drawSymbols, getValueFromObject, markerColorChoose, markerShapeChoose, clusterTemplate, mergeSeparateCluster, clusterSeparate, marker, markerTemplate, maintainSelection, maintainStyleClass, appendShape, drawCircle, drawRectangle, drawPath, drawPolygon, drawPolyline, drawLine, calculateShapes, drawDiamond, drawTriangle, drawCross, drawHorizontalLine, drawVerticalLine, drawStar, drawBalloon, drawPattern, getFieldData, checkShapeDataFields, checkPropertyPath, filter, getRatioOfBubble, findMidPointOfPolygon, isCustomPath, textTrim, findPosition, removeElement, calculateCenterFromPixel, getTranslate, getZoomTranslate, fixInitialScaleForTile, getElementByID, getClientElement, Internalize, getTemplateFunction, getElement, getShapeData, triggerShapeEvent, getElementsByClassName, querySelector, getTargetElement, createStyle, customizeStyle, triggerItemSelectionEvent, removeClass, elementAnimate, timeout, showTooltip, wordWrap, createTooltip, getHexColor, drawSymbol, renderLegendShape, getElementOffset, changeBorderWidth, changeNavaigationLineWidth, targetTouches, calculateScale, getDistance, getTouches, getTouchCenter, sum, zoomAnimate, animate, MapAjax, smoothTranslate, compareZoomFactor, calculateZoomLevel, processResult, LayerPanel, Bubble, BingMap, Marker, ColorMapping, DataLabel, NavigationLine, Legend, Highlight, Selection, MapsTooltip, Zoom, Annotations, Print, ImageExport, PdfExport };
|
|
17020
|
+
export { Maps, load, loaded, click, onclick, rightClick, doubleClick, resize, tooltipRender, shapeSelected, shapeHighlight, mousemove, mouseup, mousedown, layerRendering, shapeRendering, markerRendering, markerClusterRendering, markerClick, markerDragStart, markerDragEnd, markerClusterClick, markerMouseMove, markerClusterMouseMove, dataLabelRendering, bubbleRendering, bubbleClick, bubbleMouseMove, animationComplete, legendRendering, annotationRendering, itemSelection, itemHighlight, beforePrint, zoomIn, zoomOut, pan, Annotation, Arrow, Font, ZoomToolbarButtonSettings, ZoomToolbarTooltipSettings, ZoomToolbarSettings, Border, CenterPosition, TooltipSettings, Margin, ConnectorLineSettings, MarkerClusterSettings, MarkerClusterData, ColorMappingSettings, InitialMarkerSelectionSettings, InitialShapeSelectionSettings, SelectionSettings, HighlightSettings, PolygonSetting, PolygonSettings, NavigationLineSettings, BubbleSettings, CommonTitleSettings, SubTitleSettings, TitleSettings, ZoomSettings, ToggleLegendSettings, LegendSettings, DataLabelSettings, ShapeSettings, MarkerBase, MarkerSettings, LayerSettings, Tile, MapsAreaSettings, Size, stringToNumber, calculateSize, createSvg, getMousePosition, degreesToRadians, radiansToDegrees, convertGeoToPoint, calculatePolygonPath, convertTileLatLongToPoint, xToCoordinate, yToCoordinate, aitoff, roundTo, sinci, acos, calculateBound, triggerDownload, Point, Coordinate, MinMax, GeoLocation, measureText, TextOption, PathOption, ColorValue, RectOption, CircleOption, PolygonOption, PolylineOption, LineOption, Line, MapLocation, Rect, PatternOptions, renderTextElement, convertElement, formatValue, convertStringToValue, convertElementFromLabel, drawSymbols, getValueFromObject, markerColorChoose, markerShapeChoose, clusterTemplate, mergeSeparateCluster, clusterSeparate, marker, markerTemplate, maintainSelection, maintainStyleClass, appendShape, drawCircle, drawRectangle, drawPath, drawPolygon, drawPolyline, drawLine, calculateShapes, drawDiamond, drawTriangle, drawCross, drawHorizontalLine, drawVerticalLine, drawStar, drawBalloon, drawPattern, getFieldData, checkShapeDataFields, checkPropertyPath, filter, getRatioOfBubble, findMidPointOfPolygon, isCustomPath, textTrim, findPosition, removeElement, calculateCenterFromPixel, getTranslate, getZoomTranslate, fixInitialScaleForTile, getElementByID, getClientElement, Internalize, getTemplateFunction, getElement, getShapeData, triggerShapeEvent, getElementsByClassName, querySelector, getTargetElement, createStyle, customizeStyle, triggerItemSelectionEvent, removeClass, elementAnimate, timeout, showTooltip, wordWrap, createTooltip, getHexColor, drawSymbol, renderLegendShape, getElementOffset, changeBorderWidth, changeNavaigationLineWidth, targetTouches, calculateScale, getDistance, getTouches, getTouchCenter, sum, zoomAnimate, animate, MapAjax, smoothTranslate, compareZoomFactor, calculateZoomLevel, processResult, LayerPanel, Bubble, BingMap, Marker, Polygon, ColorMapping, DataLabel, NavigationLine, Legend, Highlight, Selection, MapsTooltip, Zoom, Annotations, Print, ImageExport, PdfExport };
|
|
16720
17021
|
//# sourceMappingURL=ej2-maps.es2015.js.map
|