@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
package/src/maps/utils/helper.js
CHANGED
|
@@ -215,6 +215,25 @@ export function convertGeoToPoint(latitude, longitude, factor, layer, mapModel)
|
|
|
215
215
|
}
|
|
216
216
|
return new Point(x, y);
|
|
217
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* @private
|
|
220
|
+
*/
|
|
221
|
+
export function calculatePolygonPath(maps, factor, currentLayer, markerData) {
|
|
222
|
+
var path = '';
|
|
223
|
+
Array.prototype.forEach.call(markerData, function (data, dataIndex) {
|
|
224
|
+
var lat = data.latitude;
|
|
225
|
+
var lng = data.longitude;
|
|
226
|
+
var location = (maps.isTileMap) ? convertTileLatLongToPoint(new MapLocation(lng, lat), factor, maps.tileTranslatePoint, true) : convertGeoToPoint(lat, lng, factor, currentLayer, maps);
|
|
227
|
+
if (dataIndex === 0) {
|
|
228
|
+
path += 'M ' + location.x + ' ' + location.y;
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
path += ' L ' + location.x + ' ' + location.y;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
path += ' z ';
|
|
235
|
+
return path;
|
|
236
|
+
}
|
|
218
237
|
/**
|
|
219
238
|
* Converting tile latitude and longitude to point
|
|
220
239
|
*
|
|
@@ -358,6 +377,17 @@ var Point = /** @class */ (function () {
|
|
|
358
377
|
return Point;
|
|
359
378
|
}());
|
|
360
379
|
export { Point };
|
|
380
|
+
/**
|
|
381
|
+
* Defines the latitude and longitude values that define a map location.
|
|
382
|
+
*/
|
|
383
|
+
var Coordinate = /** @class */ (function () {
|
|
384
|
+
function Coordinate(latitude, longitude) {
|
|
385
|
+
this.latitude = latitude;
|
|
386
|
+
this.longitude = longitude;
|
|
387
|
+
}
|
|
388
|
+
return Coordinate;
|
|
389
|
+
}());
|
|
390
|
+
export { Coordinate };
|
|
361
391
|
/**
|
|
362
392
|
* Map internal class for min and max
|
|
363
393
|
*
|
|
@@ -965,46 +995,50 @@ export function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex,
|
|
|
965
995
|
width: clusters.width, imageUrl: clusters.imageUrl, shape: clusters.shape,
|
|
966
996
|
data: data, maps: maps, cluster: clusters, border: clusters.border
|
|
967
997
|
};
|
|
998
|
+
var containerRect = maps.element.getBoundingClientRect();
|
|
999
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1000
|
+
var translatePoint = (maps.isTileMap) ? new Object() : getTranslate(maps, currentLayer, false);
|
|
1001
|
+
var factor;
|
|
1002
|
+
if (!maps.isTileMap) {
|
|
1003
|
+
factor = maps.mapLayerPanel.calculateFactor(currentLayer);
|
|
1004
|
+
}
|
|
1005
|
+
var isClusteringCompleted = false;
|
|
968
1006
|
maps.trigger('markerClusterRendering', eventArg, function (clusterargs) {
|
|
969
|
-
|
|
1007
|
+
Array.prototype.forEach.call(markerTemplate.childNodes, function (markerElement, o) {
|
|
970
1008
|
indexCollection = [];
|
|
971
|
-
if (
|
|
972
|
-
tempElement =
|
|
1009
|
+
if (markerElement['style']['visibility'] !== 'hidden') {
|
|
1010
|
+
tempElement = markerElement;
|
|
973
1011
|
bounds1 = tempElement.getBoundingClientRect();
|
|
974
1012
|
indexCollection.push(o);
|
|
975
1013
|
if (!isNullOrUndefined(bounds1)) {
|
|
976
|
-
|
|
977
|
-
if (
|
|
978
|
-
tempElement =
|
|
1014
|
+
Array.prototype.forEach.call(markerTemplate.childNodes, function (otherMarkerElement, p) {
|
|
1015
|
+
if (p >= o + 1 && otherMarkerElement['style']['visibility'] !== 'hidden') {
|
|
1016
|
+
tempElement = otherMarkerElement;
|
|
979
1017
|
bounds2 = tempElement.getBoundingClientRect();
|
|
980
1018
|
if (!isNullOrUndefined(bounds2)) {
|
|
981
1019
|
if (!(bounds1.left > bounds2.right || bounds1.right < bounds2.left
|
|
982
1020
|
|| bounds1.top > bounds2.bottom || bounds1.bottom < bounds2.top)) {
|
|
983
1021
|
colloideBounds.push(bounds2);
|
|
984
|
-
|
|
1022
|
+
otherMarkerElement['style']['visibility'] = 'hidden';
|
|
985
1023
|
indexCollection.push(p);
|
|
986
1024
|
}
|
|
987
1025
|
}
|
|
988
1026
|
}
|
|
989
|
-
}
|
|
1027
|
+
});
|
|
990
1028
|
tempX = bounds1.left + bounds1.width / 2;
|
|
991
1029
|
tempY = bounds1.top + bounds1.height;
|
|
992
1030
|
if (colloideBounds.length > 0) {
|
|
993
1031
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
994
1032
|
indexCollection = indexCollection.filter(function (item, index, value) { return value.indexOf(item) === index; });
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
var translate = (maps.isTileMap) ? new Object() : getTranslate(maps, currentLayer, false);
|
|
1001
|
-
var dataIndex = parseInt(markerTemplate.childNodes[o]['id'].split('_dataIndex_')[1].split('_')[0], 10);
|
|
1002
|
-
var markerIndex = parseInt(markerTemplate.childNodes[o]['id'].split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
1033
|
+
tempX = tempX - containerRect['left'];
|
|
1034
|
+
tempY = (tempY - ((maps.availableSize.height <= containerRect['height']) ?
|
|
1035
|
+
containerRect['top'] : (containerRect['bottom'] - containerRect['top'])));
|
|
1036
|
+
var dataIndex = parseInt(markerElement['id'].split('_dataIndex_')[1].split('_')[0], 10);
|
|
1037
|
+
var markerIndex = parseInt(markerElement['id'].split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
1003
1038
|
var markerSetting = currentLayer.markerSettings[markerIndex];
|
|
1004
1039
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1005
1040
|
var markerData = markerSetting.dataSource[dataIndex];
|
|
1006
|
-
var
|
|
1007
|
-
var location_1 = void 0;
|
|
1041
|
+
var location_1;
|
|
1008
1042
|
var longitude = (!isNullOrUndefined(markerSetting.longitudeValuePath)) ?
|
|
1009
1043
|
Number(getValueFromObject(markerData, markerSetting.longitudeValuePath)) :
|
|
1010
1044
|
!isNullOrUndefined(markerData['longitude']) ? parseFloat(markerData['longitude']) :
|
|
@@ -1014,45 +1048,30 @@ export function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex,
|
|
|
1014
1048
|
!isNullOrUndefined(markerData['latitude']) ? parseFloat(markerData['latitude']) :
|
|
1015
1049
|
!isNullOrUndefined(markerData['Latitude']) ? parseFloat(markerData['Latitude']) : 0;
|
|
1016
1050
|
if (!maps.isTileMap) {
|
|
1017
|
-
factor = maps.mapLayerPanel.calculateFactor(currentLayer);
|
|
1018
1051
|
location_1 = convertGeoToPoint(latitude, longitude, factor, currentLayer, maps);
|
|
1019
1052
|
}
|
|
1020
1053
|
else if (maps.isTileMap && !maps.zoomSettings.enable) {
|
|
1021
1054
|
location_1 = convertTileLatLongToPoint(new Point(longitude, latitude), maps.tileZoomLevel, maps.tileTranslatePoint, true);
|
|
1022
1055
|
}
|
|
1023
|
-
|
|
1024
|
-
var clusters_1 = currentLayer.markerClusterSettings;
|
|
1056
|
+
markerElement['style']['visibility'] = 'hidden';
|
|
1025
1057
|
if (eventArg.cancel) {
|
|
1026
1058
|
shapeCustom = {
|
|
1027
|
-
size: new Size(
|
|
1028
|
-
fill:
|
|
1029
|
-
borderWidth:
|
|
1030
|
-
dashArray:
|
|
1059
|
+
size: new Size(clusters.width, clusters.height),
|
|
1060
|
+
fill: clusters.fill, borderColor: clusters.border.color,
|
|
1061
|
+
borderWidth: clusters.border.width, opacity: clusters.opacity,
|
|
1062
|
+
dashArray: clusters.dashArray, imageUrl: clusters.imageUrl, shape: clusters.shape
|
|
1031
1063
|
};
|
|
1032
|
-
shapeCustom['
|
|
1033
|
-
shapeCustom['size']['width'] = clusters_1.width;
|
|
1034
|
-
shapeCustom['size']['height'] = clusters_1.height;
|
|
1035
|
-
shapeCustom['imageUrl'] = clusters_1.imageUrl;
|
|
1036
|
-
shapeCustom['shape'] = clusters_1.shape;
|
|
1037
|
-
shapeCustom['borderColor'] = clusters_1.border.color;
|
|
1038
|
-
shapeCustom['borderWidth'] = clusters_1.border.width;
|
|
1039
|
-
shapeCustom['borderOpacity'] = isNullOrUndefined(clusters_1.border.opacity) ? clusters_1.opacity : clusters_1.border.opacity;
|
|
1064
|
+
shapeCustom['borderOpacity'] = isNullOrUndefined(clusters.border.opacity) ? clusters.opacity : clusters.border.opacity;
|
|
1040
1065
|
}
|
|
1041
1066
|
else {
|
|
1042
1067
|
shapeCustom = {
|
|
1043
|
-
size: new Size(
|
|
1044
|
-
fill:
|
|
1045
|
-
borderWidth:
|
|
1046
|
-
dashArray:
|
|
1068
|
+
size: new Size(eventArg.width, eventArg.height),
|
|
1069
|
+
fill: eventArg.fill, borderColor: eventArg.border.color,
|
|
1070
|
+
borderWidth: eventArg.border.width, opacity: clusters.opacity,
|
|
1071
|
+
dashArray: clusters.dashArray, imageUrl: eventArg.imageUrl,
|
|
1072
|
+
shape: eventArg.shape
|
|
1047
1073
|
};
|
|
1048
|
-
shapeCustom['
|
|
1049
|
-
shapeCustom['size']['width'] = eventArg.width;
|
|
1050
|
-
shapeCustom['size']['height'] = eventArg.height;
|
|
1051
|
-
shapeCustom['imageUrl'] = eventArg.imageUrl;
|
|
1052
|
-
shapeCustom['shape'] = eventArg.shape;
|
|
1053
|
-
shapeCustom['borderColor'] = eventArg.border.color;
|
|
1054
|
-
shapeCustom['borderWidth'] = eventArg.border.width;
|
|
1055
|
-
shapeCustom['borderOpacity'] = isNullOrUndefined(eventArg.border.opacity) ? clusters_1.opacity : eventArg.border.opacity;
|
|
1074
|
+
shapeCustom['borderOpacity'] = isNullOrUndefined(eventArg.border.opacity) ? clusters.opacity : eventArg.border.opacity;
|
|
1056
1075
|
}
|
|
1057
1076
|
tempX = (maps.isTileMap) ? tempX : (markerTemplate.id.indexOf('_Markers_Group') > -1) ? tempX : tempX + postionY - (eventArg.width / 2);
|
|
1058
1077
|
tempY = (maps.isTileMap) ? tempY : (markerTemplate.id.indexOf('_Markers_Group') > -1) ? tempY : tempY - (eventArg.height / 2);
|
|
@@ -1080,48 +1099,51 @@ export function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex,
|
|
|
1080
1099
|
}
|
|
1081
1100
|
colloideBounds = [];
|
|
1082
1101
|
}
|
|
1083
|
-
|
|
1102
|
+
isClusteringCompleted = true;
|
|
1103
|
+
});
|
|
1084
1104
|
layerElement.appendChild(clusterGroup);
|
|
1085
1105
|
maps.svgObject.appendChild(layerElement);
|
|
1086
1106
|
maps.element.appendChild(maps.svgObject);
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
if (!(
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1107
|
+
if (clusters.allowDeepClustering) {
|
|
1108
|
+
Array.prototype.forEach.call(clusterGroup.childNodes, function (clusterElement, o) {
|
|
1109
|
+
if (clusterElement['style']['visibility'] !== 'hidden') {
|
|
1110
|
+
tempElement = clusterElement;
|
|
1111
|
+
bounds1 = tempElement.getBoundingClientRect();
|
|
1112
|
+
if (!isNullOrUndefined(bounds1) && !(tempElement.id.indexOf('_datalabel_') > -1)) {
|
|
1113
|
+
for (var p = o + 1; p < clusterGroup.childElementCount; p++) {
|
|
1114
|
+
if (clusterGroup.childNodes[p]['style']['visibility'] !== 'hidden') {
|
|
1115
|
+
tempElement1 = clusterGroup.childNodes[p];
|
|
1116
|
+
bounds2 = tempElement1.getBoundingClientRect();
|
|
1117
|
+
if (!isNullOrUndefined(bounds2) && !(tempElement1.id.indexOf('_datalabel_') > -1)) {
|
|
1118
|
+
if (!(bounds1.left > bounds2.right || bounds1.right < bounds2.left
|
|
1119
|
+
|| bounds1.top > bounds2.bottom || bounds1.bottom < bounds2.top)) {
|
|
1120
|
+
clusterColloideBounds.push(tempElement1);
|
|
1121
|
+
clusterColloideBounds.push(clusterGroup.childNodes[p - 1]);
|
|
1122
|
+
clusterGroup.childNodes[p]['style']['visibility'] = 'hidden';
|
|
1123
|
+
clusterGroup.childNodes[p - 1]['style']['visibility'] = 'hidden';
|
|
1124
|
+
indexCollection.push(p);
|
|
1125
|
+
}
|
|
1104
1126
|
}
|
|
1105
1127
|
}
|
|
1106
1128
|
}
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1129
|
+
if (clusterColloideBounds.length > 0) {
|
|
1130
|
+
tempElement = clusterElement;
|
|
1131
|
+
for (var i = 0; i < clusterColloideBounds.length; i++) {
|
|
1132
|
+
if (tempElement.tagName === 'g') {
|
|
1133
|
+
tempElement.childNodes[0].textContent = tempElement.childNodes[0].textContent + ',' +
|
|
1134
|
+
clusterColloideBounds[i].textContent;
|
|
1135
|
+
}
|
|
1136
|
+
else {
|
|
1137
|
+
tempElement.textContent = tempElement.textContent + ',' + clusterColloideBounds[i].textContent;
|
|
1138
|
+
}
|
|
1139
|
+
clusterGroup.childNodes[o - 1].textContent = ((+(clusterGroup.childNodes[o - 1].textContent)) + (+(clusterColloideBounds[i + 1].textContent))).toString();
|
|
1140
|
+
i++;
|
|
1117
1141
|
}
|
|
1118
|
-
clusterGroup.childNodes[o - 1].textContent = ((+(clusterGroup.childNodes[o - 1].textContent)) + (+(clusterColloideBounds[i + 1].textContent))).toString();
|
|
1119
|
-
i++;
|
|
1120
1142
|
}
|
|
1143
|
+
clusterColloideBounds = [];
|
|
1121
1144
|
}
|
|
1122
|
-
clusterColloideBounds = [];
|
|
1123
1145
|
}
|
|
1124
|
-
}
|
|
1146
|
+
});
|
|
1125
1147
|
}
|
|
1126
1148
|
while (0 < clusterGroup.childNodes.length) {
|
|
1127
1149
|
markerCollection.insertBefore(clusterGroup.childNodes[0], markerCollection.firstChild);
|
|
@@ -1130,12 +1152,24 @@ export function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex,
|
|
|
1130
1152
|
getElementByID(maps.element.id + '_Secondary_Element').appendChild(markerCollection);
|
|
1131
1153
|
}
|
|
1132
1154
|
var element = document.getElementById(maps.element.id + '_LayerIndex_' + layerIndex + '_Polygon_Group');
|
|
1133
|
-
|
|
1155
|
+
var polygonElement = document.getElementById(maps.element.id + '_LayerIndex_' + layerIndex + '_Polygons_Group');
|
|
1156
|
+
if (isNullOrUndefined(element) && !maps.isTileMap) {
|
|
1134
1157
|
layerElement.insertBefore(markerCollection, layerElement.firstChild);
|
|
1135
1158
|
}
|
|
1136
|
-
else {
|
|
1159
|
+
else if (!maps.isTileMap) {
|
|
1137
1160
|
layerElement.appendChild(markerCollection);
|
|
1138
1161
|
}
|
|
1162
|
+
else {
|
|
1163
|
+
if (!isNullOrUndefined(polygonElement)) {
|
|
1164
|
+
polygonElement.insertAdjacentElement('afterend', markerCollection);
|
|
1165
|
+
}
|
|
1166
|
+
else if (!isNullOrUndefined(element)) {
|
|
1167
|
+
element.insertAdjacentElement('afterend', markerCollection);
|
|
1168
|
+
}
|
|
1169
|
+
else {
|
|
1170
|
+
layerElement.insertBefore(markerCollection, layerElement.firstChild);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1139
1173
|
var markerCluster = document.getElementById(maps.element.id + '_LayerIndex_' + layerIndex + '_markerCluster');
|
|
1140
1174
|
if (!isNullOrUndefined(markerCluster)) {
|
|
1141
1175
|
markerCluster.remove();
|
|
@@ -1151,6 +1185,7 @@ export function clusterTemplate(currentLayer, markerTemplate, maps, layerIndex,
|
|
|
1151
1185
|
}
|
|
1152
1186
|
}
|
|
1153
1187
|
});
|
|
1188
|
+
return isClusteringCompleted;
|
|
1154
1189
|
}
|
|
1155
1190
|
/**
|
|
1156
1191
|
*
|
|
@@ -1667,7 +1702,7 @@ export function drawBalloon(maps, options, size, location, type, element) {
|
|
|
1667
1702
|
var height = size.height;
|
|
1668
1703
|
var pathElement;
|
|
1669
1704
|
location.x -= width / 2;
|
|
1670
|
-
location.y -= height / 2;
|
|
1705
|
+
location.y -= ((options.id.indexOf('cluster') > -1) ? (height / 2) : options.id.indexOf('Legend') > -1 ? height / 1.25 : height);
|
|
1671
1706
|
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' +
|
|
1672
1707
|
'c-2.8,0-5-2.2-5-5s2.2-5,5-5s5,2.2,5,5S17.8,16,15,16z';
|
|
1673
1708
|
var balloon = maps.renderer.drawPath(options);
|
|
@@ -2076,7 +2111,8 @@ export function getTranslate(mapObject, layer, animate) {
|
|
|
2076
2111
|
var topPosition = (((mapHeight + Math.abs(mapObject.mapAreaRect.height - mapHeight)) / 2) + mapObject.mapAreaRect.y) / factor;
|
|
2077
2112
|
var point = checkMethodeZoom ? calculateCenterFromPixel(mapObject, layer) :
|
|
2078
2113
|
convertGeoToPoint(centerLatitude, centerLongitude, mapObject.mapLayerPanel.calculateFactor(layer), layer, mapObject);
|
|
2079
|
-
if (isNullOrUndefined(mapObject.previousProjection) || mapObject.previousProjection !== mapObject.projectionType
|
|
2114
|
+
if (isNullOrUndefined(mapObject.previousProjection) || mapObject.previousProjection !== mapObject.projectionType
|
|
2115
|
+
|| mapObject.isMarkerZoomCompleted) {
|
|
2080
2116
|
x = -point.x + leftPosition;
|
|
2081
2117
|
y = -point.y + topPosition;
|
|
2082
2118
|
scaleFactor = zoomFactor;
|
|
@@ -3045,6 +3081,13 @@ export function changeBorderWidth(element, index, scale, maps) {
|
|
|
3045
3081
|
if (childNode.id.indexOf('_NavigationGroup') > -1) {
|
|
3046
3082
|
changeNavaigationLineWidth(childNode, index, scale, maps);
|
|
3047
3083
|
}
|
|
3084
|
+
else if (childNode.id.indexOf('_Polygons_Group') > -1) {
|
|
3085
|
+
for (var i = 0; i < childNode.childElementCount; i++) {
|
|
3086
|
+
// eslint-disable-next-line
|
|
3087
|
+
var width = maps.layersCollection[index].polygonSettings.polygons[parseInt(childNode.children[i].id.split('_PolygonIndex_')[1])].borderWidth;
|
|
3088
|
+
childNode.children[i].setAttribute('stroke-width', (width / scale).toString());
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3048
3091
|
else {
|
|
3049
3092
|
var currentStroke = void 0;
|
|
3050
3093
|
var value = 0;
|