@syncfusion/ej2-maps 20.3.56 → 20.4.40
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/.eslintrc.json +16 -1
- package/CHANGELOG.md +11 -1
- package/README.md +65 -51
- 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 +961 -730
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +947 -720
- 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 +34 -21
- package/src/maps/layers/bing-map.d.ts +1 -0
- package/src/maps/layers/bing-map.js +1 -0
- package/src/maps/layers/bubble.d.ts +4 -0
- package/src/maps/layers/bubble.js +7 -3
- package/src/maps/layers/color-mapping.d.ts +5 -0
- package/src/maps/layers/color-mapping.js +5 -3
- package/src/maps/layers/data-label.d.ts +0 -1
- package/src/maps/layers/data-label.js +5 -12
- package/src/maps/layers/layer-panel.d.ts +7 -7
- package/src/maps/layers/layer-panel.js +98 -53
- package/src/maps/layers/legend.js +63 -26
- package/src/maps/layers/marker.d.ts +13 -0
- package/src/maps/layers/marker.js +124 -107
- package/src/maps/layers/navigation-selected-line.d.ts +5 -0
- package/src/maps/layers/navigation-selected-line.js +111 -104
- package/src/maps/maps-model.d.ts +1 -1
- package/src/maps/maps.d.ts +17 -0
- package/src/maps/maps.js +448 -364
- package/src/maps/model/base.js +1 -1
- package/src/maps/model/export-image.d.ts +4 -3
- package/src/maps/model/export-image.js +7 -6
- package/src/maps/model/export-pdf.d.ts +6 -6
- package/src/maps/model/export-pdf.js +8 -7
- package/src/maps/model/interface.d.ts +2 -2
- package/src/maps/model/print.d.ts +4 -2
- package/src/maps/model/print.js +6 -3
- package/src/maps/user-interaction/annotation.js +0 -2
- package/src/maps/user-interaction/highlight.js +4 -3
- package/src/maps/user-interaction/selection.js +4 -2
- package/src/maps/user-interaction/tooltip.js +5 -5
- package/src/maps/user-interaction/zoom.d.ts +5 -0
- package/src/maps/user-interaction/zoom.js +9 -8
- package/src/maps/utils/helper.d.ts +2 -0
- package/src/maps/utils/helper.js +37 -30
package/src/maps/maps.js
CHANGED
|
@@ -17,11 +17,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
17
17
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
19
|
};
|
|
20
|
-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
21
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
22
|
-
/* eslint-disable radix */
|
|
23
|
-
/* eslint-disable max-len */
|
|
24
|
-
/* eslint-disable valid-jsdoc */
|
|
25
20
|
/**
|
|
26
21
|
* Maps Component file
|
|
27
22
|
*/
|
|
@@ -224,18 +219,20 @@ var Maps = /** @class */ (function (_super) {
|
|
|
224
219
|
this.setCulture();
|
|
225
220
|
};
|
|
226
221
|
Maps.prototype.renderElements = function () {
|
|
227
|
-
this.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
222
|
+
if (!this.isDestroyed) {
|
|
223
|
+
this.trigger(load, { maps: this });
|
|
224
|
+
this.createSVG();
|
|
225
|
+
this.findBaseAndSubLayers();
|
|
226
|
+
this.createSecondaryElement();
|
|
227
|
+
this.addTabIndex();
|
|
228
|
+
this.themeStyle = getThemeStyle(this.theme);
|
|
229
|
+
this.renderBorder();
|
|
230
|
+
this.renderTitle(this.titleSettings, 'title', null, null);
|
|
231
|
+
this.renderArea();
|
|
232
|
+
this.processRequestJsonData();
|
|
233
|
+
this.renderComplete();
|
|
234
|
+
this.isAddLayer = !this.isTileMap ? false : this.isAddLayer;
|
|
235
|
+
}
|
|
239
236
|
};
|
|
240
237
|
/**
|
|
241
238
|
* To Initialize the control rendering.
|
|
@@ -250,8 +247,6 @@ var Maps = /** @class */ (function (_super) {
|
|
|
250
247
|
var length = this.layersCollection.length - 1;
|
|
251
248
|
this.serverProcess = { request: 0, response: 0 };
|
|
252
249
|
var queryModule;
|
|
253
|
-
var localAjax;
|
|
254
|
-
var ajaxModule;
|
|
255
250
|
var dataModule;
|
|
256
251
|
Array.prototype.forEach.call(this.layersCollection, function (layer, layerIndex) {
|
|
257
252
|
if (layer.shapeData instanceof DataManager) {
|
|
@@ -287,7 +282,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
287
282
|
if (layer.markerSettings[i].dataSource instanceof DataManager) {
|
|
288
283
|
_this.serverProcess['request']++;
|
|
289
284
|
dataModule = layer.markerSettings[i].dataSource;
|
|
290
|
-
queryModule = layer.markerSettings[i].query instanceof Query ?
|
|
285
|
+
queryModule = layer.markerSettings[i].query instanceof Query ?
|
|
286
|
+
layer.markerSettings[i].query : new Query();
|
|
291
287
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
292
288
|
var dataManager = dataModule.executeQuery(queryModule);
|
|
293
289
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -306,7 +302,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
306
302
|
if (layer.bubbleSettings[i].dataSource instanceof DataManager) {
|
|
307
303
|
_this.serverProcess['request']++;
|
|
308
304
|
dataModule = layer.bubbleSettings[i].dataSource;
|
|
309
|
-
queryModule = layer.bubbleSettings[i].query instanceof Query ?
|
|
305
|
+
queryModule = layer.bubbleSettings[i].query instanceof Query ?
|
|
306
|
+
layer.bubbleSettings[i].query : new Query();
|
|
310
307
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
311
308
|
var dataManager = dataModule.executeQuery(queryModule);
|
|
312
309
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -416,6 +413,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
416
413
|
}
|
|
417
414
|
if (!this.isResize) {
|
|
418
415
|
for (var k = 0; k < this.layers[i].markerSettings.length; k++) {
|
|
416
|
+
// eslint-disable-next-line max-len
|
|
419
417
|
if (this.layers[i].markerSettings[k].selectionSettings && this.layers[i].markerSettings[k].selectionSettings.enable
|
|
420
418
|
&& this.layers[i].markerSettings[k].initialMarkerSelection.length > 0) {
|
|
421
419
|
var markerSelectionValues = this.layers[i].markerSettings[k].initialMarkerSelection;
|
|
@@ -611,8 +609,10 @@ var Maps = /** @class */ (function (_super) {
|
|
|
611
609
|
tileSvgParentElement.style.left = left + 'px';
|
|
612
610
|
tileSvgParentElement.style.top = top + 'px';
|
|
613
611
|
if (!isNullOrUndefined(this.legendModule) && this.legendModule.totalPages.length > 0) {
|
|
614
|
-
tileElement.style.width = tileSvgElement.style.width =
|
|
615
|
-
|
|
612
|
+
tileElement.style.width = tileSvgElement.style.width =
|
|
613
|
+
this.legendModule.legendTotalRect.width.toString();
|
|
614
|
+
tileElement.style.height = tileSvgElement.style.height =
|
|
615
|
+
this.legendModule.legendTotalRect.height.toString();
|
|
616
616
|
tileSvgParentElement.style.width = this.legendModule.legendTotalRect.width + 'px';
|
|
617
617
|
tileSvgParentElement.style.height = this.legendModule.legendTotalRect.height + 'px';
|
|
618
618
|
}
|
|
@@ -633,7 +633,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
633
633
|
if (!isNullOrUndefined(elements) && elements.childElementCount > 0) {
|
|
634
634
|
for (var i = 0; i < elements.childNodes.length; i++) {
|
|
635
635
|
var childElement = elements.childNodes[i];
|
|
636
|
-
if (childElement.tagName === 'g' && childElement.id.indexOf('_Legend_Group')
|
|
636
|
+
if (childElement.tagName === 'g' && childElement.id.indexOf('_Legend_Group') === -1) {
|
|
637
637
|
var layerIndex = parseFloat(childElement.id.split('_LayerIndex_')[1].split('_')[0]);
|
|
638
638
|
for (var j = 0; j < childElement.childNodes.length; j++) {
|
|
639
639
|
var childNode = childElement.childNodes[j];
|
|
@@ -764,7 +764,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
764
764
|
break;
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
|
-
subLayers.map(function (subLayer
|
|
767
|
+
subLayers.map(function (subLayer) {
|
|
768
768
|
if (subLayer.visible) {
|
|
769
769
|
_this.layersCollection.push(subLayer);
|
|
770
770
|
}
|
|
@@ -924,6 +924,9 @@ var Maps = /** @class */ (function (_super) {
|
|
|
924
924
|
};
|
|
925
925
|
Maps.prototype.keyUpHandler = function (event) {
|
|
926
926
|
var id = event.target['id'];
|
|
927
|
+
if (this.isTileMap) {
|
|
928
|
+
this.removeTileMap();
|
|
929
|
+
}
|
|
927
930
|
if (event.code === 'Tab' && id.indexOf('_LayerIndex_') > -1 && id.indexOf('shapeIndex') > -1) {
|
|
928
931
|
this.keyboardHighlightSelection(id, event.type);
|
|
929
932
|
}
|
|
@@ -957,6 +960,13 @@ var Maps = /** @class */ (function (_super) {
|
|
|
957
960
|
};
|
|
958
961
|
Maps.prototype.keyDownHandler = function (event) {
|
|
959
962
|
var zoom = this.zoomModule;
|
|
963
|
+
if ((event.code === 'ArrowUp' || event.code === 'ArrowDown' || event.code === 'ArrowLeft'
|
|
964
|
+
|| event.code === 'ArrowRight') && zoom) {
|
|
965
|
+
var animatedTiles = document.getElementById(this.element.id + '_animated_tiles');
|
|
966
|
+
if (this.isTileMap && !isNullOrUndefined(animatedTiles)) {
|
|
967
|
+
this.currentTiles = animatedTiles.cloneNode(true);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
960
970
|
if ((event.key === '+' || event.code === 'Equal') && zoom) {
|
|
961
971
|
zoom.performZoomingByToolBar('zoomin');
|
|
962
972
|
}
|
|
@@ -1031,6 +1041,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1031
1041
|
* This method is used to perform the operations when a click operation is performed on maps.
|
|
1032
1042
|
*
|
|
1033
1043
|
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
1044
|
+
* @returns {void}
|
|
1034
1045
|
*/
|
|
1035
1046
|
Maps.prototype.mapsOnClick = function (e) {
|
|
1036
1047
|
var _this = this;
|
|
@@ -1096,8 +1107,9 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1096
1107
|
Maps.prototype.getClickLocation = function (targetId, pageX, pageY, targetElement, x, y) {
|
|
1097
1108
|
var layerIndex = 0;
|
|
1098
1109
|
var latLongValue;
|
|
1099
|
-
if (targetId.indexOf('_LayerIndex_') !== -1 && !this.isTileMap &&
|
|
1100
|
-
|
|
1110
|
+
if (targetId.indexOf('_LayerIndex_') !== -1 && !this.isTileMap &&
|
|
1111
|
+
(parseInt(this.mouseDownEvent['x'], 10) === parseInt(this.mouseClickEvent['x'], 10)) &&
|
|
1112
|
+
(parseInt(this.mouseDownEvent['y'], 10) === parseInt(this.mouseClickEvent['y'], 10))) {
|
|
1101
1113
|
layerIndex = parseFloat(targetId.split('_LayerIndex_')[1].split('_')[0]);
|
|
1102
1114
|
if (this.layers[layerIndex].geometryType === 'Normal') {
|
|
1103
1115
|
if (targetId.indexOf('_shapeIndex_') > -1) {
|
|
@@ -1134,12 +1146,21 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1134
1146
|
latLongValue = this.getGeoLocation(layerIndex, x, y);
|
|
1135
1147
|
}
|
|
1136
1148
|
}
|
|
1137
|
-
else if (this.isTileMap && (parseInt(this.mouseDownEvent['x']) === parseInt(this.mouseClickEvent['x']))
|
|
1138
|
-
|
|
1149
|
+
else if (this.isTileMap && (parseInt(this.mouseDownEvent['x'], 10) === parseInt(this.mouseClickEvent['x'], 10)) &&
|
|
1150
|
+
(parseInt(this.mouseDownEvent['y'], 10) === parseInt(this.mouseClickEvent['y'], 10))) {
|
|
1139
1151
|
latLongValue = this.getTileGeoLocation(x, y);
|
|
1140
1152
|
}
|
|
1141
1153
|
return latLongValue;
|
|
1142
1154
|
};
|
|
1155
|
+
Maps.prototype.removeTileMap = function () {
|
|
1156
|
+
var animateElement = document.getElementById(this.element.id + '_animated_tiles');
|
|
1157
|
+
if (!isNullOrUndefined(this.currentTiles) && animateElement.childElementCount < this.currentTiles.childElementCount) {
|
|
1158
|
+
for (var l = animateElement.childElementCount - 1; l >= this.currentTiles.childElementCount; l--) {
|
|
1159
|
+
animateElement.removeChild(animateElement.children[l]);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
this.currentTiles = null;
|
|
1163
|
+
};
|
|
1143
1164
|
/**
|
|
1144
1165
|
* This method is used to perform operations when mouse click on maps.
|
|
1145
1166
|
*
|
|
@@ -1171,6 +1192,9 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1171
1192
|
pageY = e.pageY;
|
|
1172
1193
|
target = e.target;
|
|
1173
1194
|
}
|
|
1195
|
+
if (this.isTileMap) {
|
|
1196
|
+
this.removeTileMap();
|
|
1197
|
+
}
|
|
1174
1198
|
if (this.isTouch) {
|
|
1175
1199
|
if (targetEle.id.indexOf('_ToolBar') === -1) {
|
|
1176
1200
|
var latLongValue = this.getClickLocation(targetId, pageX, pageY, targetEle, pageX, pageY);
|
|
@@ -1207,6 +1231,10 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1207
1231
|
}
|
|
1208
1232
|
var rect = this.element.getBoundingClientRect();
|
|
1209
1233
|
var element = e.target;
|
|
1234
|
+
var animatedTiles = document.getElementById(this.element.id + '_animated_tiles');
|
|
1235
|
+
if (this.isTileMap && !isNullOrUndefined(animatedTiles)) {
|
|
1236
|
+
this.currentTiles = animatedTiles.cloneNode(true);
|
|
1237
|
+
}
|
|
1210
1238
|
if (element.id.indexOf('_ToolBar') === -1) {
|
|
1211
1239
|
var markerModule = this.markerModule;
|
|
1212
1240
|
if (element.id.indexOf('shapeIndex') > -1 || element.id.indexOf('Tile') > -1) {
|
|
@@ -1239,6 +1267,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1239
1267
|
* This method is used to perform operations when performing the double click operation on maps.
|
|
1240
1268
|
*
|
|
1241
1269
|
* @param {PointerEvent} e - Specifies the pointer event.
|
|
1270
|
+
* @returns {void}
|
|
1242
1271
|
*/
|
|
1243
1272
|
Maps.prototype.mapsOnDoubleClick = function (e) {
|
|
1244
1273
|
this.notify('dblclick', e);
|
|
@@ -1262,8 +1291,10 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1262
1291
|
latitude = latLongValue['latitude'];
|
|
1263
1292
|
longitude = latLongValue['longitude'];
|
|
1264
1293
|
}
|
|
1265
|
-
var doubleClickArgs = {
|
|
1266
|
-
|
|
1294
|
+
var doubleClickArgs = {
|
|
1295
|
+
cancel: false, name: doubleClick, x: e.clientX, y: e.clientY,
|
|
1296
|
+
target: targetId, latitude: latitude, longitude: longitude, isShapeSelected: null
|
|
1297
|
+
};
|
|
1267
1298
|
this.trigger('doubleClick', doubleClickArgs);
|
|
1268
1299
|
}
|
|
1269
1300
|
};
|
|
@@ -1363,28 +1394,30 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1363
1394
|
*/
|
|
1364
1395
|
Maps.prototype.mapsOnResize = function (e) {
|
|
1365
1396
|
var _this = this;
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
if (
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
this.
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1397
|
+
if (!this.isDestroyed) {
|
|
1398
|
+
this.isResize = this.isReset = true;
|
|
1399
|
+
var args = {
|
|
1400
|
+
cancel: false,
|
|
1401
|
+
name: resize,
|
|
1402
|
+
previousSize: this.availableSize,
|
|
1403
|
+
currentSize: calculateSize(this),
|
|
1404
|
+
maps: this
|
|
1405
|
+
};
|
|
1406
|
+
this.trigger(resize, args);
|
|
1407
|
+
if (!args.cancel) {
|
|
1408
|
+
if (this.resizeTo) {
|
|
1409
|
+
clearTimeout(this.resizeTo);
|
|
1410
|
+
}
|
|
1411
|
+
if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-maps')) {
|
|
1412
|
+
this.resizeTo = setTimeout(function () {
|
|
1413
|
+
_this.unWireEVents();
|
|
1414
|
+
_this.createSVG();
|
|
1415
|
+
_this.refreshing = true;
|
|
1416
|
+
_this.wireEVents();
|
|
1417
|
+
_this.render();
|
|
1418
|
+
_this.refreshing = false;
|
|
1419
|
+
}, 500);
|
|
1420
|
+
}
|
|
1388
1421
|
}
|
|
1389
1422
|
}
|
|
1390
1423
|
return false;
|
|
@@ -1399,69 +1432,79 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1399
1432
|
* @returns {void}
|
|
1400
1433
|
*/
|
|
1401
1434
|
Maps.prototype.zoomByPosition = function (centerPosition, zoomFactor) {
|
|
1402
|
-
this.
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
if (!
|
|
1406
|
-
|
|
1407
|
-
|
|
1435
|
+
if (!this.isDestroyed) {
|
|
1436
|
+
this.zoomNotApplied = false;
|
|
1437
|
+
var isRefresh = this.zoomSettings.zoomFactor === zoomFactor;
|
|
1438
|
+
if (!this.isTileMap && this.zoomModule) {
|
|
1439
|
+
if (!isNullOrUndefined(centerPosition)) {
|
|
1440
|
+
this.zoomSettings.zoomFactor = zoomFactor;
|
|
1441
|
+
isRefresh = this.centerPosition.latitude === centerPosition.latitude &&
|
|
1442
|
+
this.centerPosition.longitude === centerPosition.longitude ? true : isRefresh;
|
|
1443
|
+
this.centerPosition = centerPosition;
|
|
1444
|
+
this.isZoomByPosition = true;
|
|
1445
|
+
this.mapScaleValue = null;
|
|
1446
|
+
}
|
|
1447
|
+
else {
|
|
1448
|
+
this.zoomSettings.zoomFactor = zoomFactor;
|
|
1449
|
+
this.isZoomByPosition = true;
|
|
1450
|
+
this.mapScaleValue = null;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
else if (this.zoomModule) {
|
|
1454
|
+
this.tileZoomLevel = this.zoomSettings.zoomFactor = zoomFactor;
|
|
1455
|
+
isRefresh = this.centerPosition.latitude === centerPosition.latitude &&
|
|
1456
|
+
this.centerPosition.longitude === centerPosition.longitude ? true : isRefresh;
|
|
1408
1457
|
this.centerPosition = centerPosition;
|
|
1409
1458
|
this.isZoomByPosition = true;
|
|
1410
|
-
this.mapScaleValue = null;
|
|
1411
1459
|
}
|
|
1412
|
-
|
|
1413
|
-
this.
|
|
1414
|
-
this.isZoomByPosition = true;
|
|
1415
|
-
this.mapScaleValue = null;
|
|
1460
|
+
if (isRefresh) {
|
|
1461
|
+
this.refresh();
|
|
1416
1462
|
}
|
|
1417
1463
|
}
|
|
1418
|
-
else if (this.zoomModule) {
|
|
1419
|
-
this.tileZoomLevel = this.zoomSettings.zoomFactor = zoomFactor;
|
|
1420
|
-
isRefresh = this.centerPosition.latitude === centerPosition.latitude && this.centerPosition.longitude === centerPosition.longitude ? true : isRefresh;
|
|
1421
|
-
this.centerPosition = centerPosition;
|
|
1422
|
-
this.isZoomByPosition = true;
|
|
1423
|
-
}
|
|
1424
|
-
if (isRefresh) {
|
|
1425
|
-
this.refresh();
|
|
1426
|
-
}
|
|
1427
1464
|
};
|
|
1428
1465
|
/**
|
|
1429
1466
|
* This method is used to perform panning by specifying the direction.
|
|
1430
1467
|
*
|
|
1431
1468
|
* @param {PanDirection} direction - Specifies the direction in which the panning is performed.
|
|
1432
1469
|
* @param {PointerEvent | TouchEvent} mouseLocation - Specifies the location of the mouse pointer in maps.
|
|
1470
|
+
* @returns {void}
|
|
1433
1471
|
*/
|
|
1434
1472
|
Maps.prototype.panByDirection = function (direction, mouseLocation) {
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
this.zoomModule
|
|
1473
|
+
if (!this.isDestroyed) {
|
|
1474
|
+
var xDiff = 0;
|
|
1475
|
+
var yDiff = 0;
|
|
1476
|
+
switch (direction) {
|
|
1477
|
+
case 'Left':
|
|
1478
|
+
xDiff = -(this.mapAreaRect.width / 7);
|
|
1479
|
+
break;
|
|
1480
|
+
case 'Right':
|
|
1481
|
+
xDiff = (this.mapAreaRect.width / 7);
|
|
1482
|
+
break;
|
|
1483
|
+
case 'Top':
|
|
1484
|
+
yDiff = -(this.mapAreaRect.height / 7);
|
|
1485
|
+
break;
|
|
1486
|
+
case 'Bottom':
|
|
1487
|
+
yDiff = (this.mapAreaRect.height / 7);
|
|
1488
|
+
break;
|
|
1489
|
+
}
|
|
1490
|
+
if (this.zoomModule) {
|
|
1491
|
+
this.zoomModule.panning(direction, xDiff, yDiff, mouseLocation);
|
|
1492
|
+
}
|
|
1453
1493
|
}
|
|
1454
1494
|
};
|
|
1455
1495
|
/**
|
|
1456
1496
|
* This method is used to add the layers dynamically to the maps.
|
|
1457
1497
|
*
|
|
1458
1498
|
* @param {Object} layer - Specifies the layer for the maps.
|
|
1499
|
+
* @returns {void}
|
|
1459
1500
|
*/
|
|
1460
1501
|
Maps.prototype.addLayer = function (layer) {
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1502
|
+
if (!this.isDestroyed) {
|
|
1503
|
+
var mapsLayer = this.layers;
|
|
1504
|
+
mapsLayer.push(layer);
|
|
1505
|
+
this.isAddLayer = true;
|
|
1506
|
+
this.layers = mapsLayer;
|
|
1507
|
+
}
|
|
1465
1508
|
};
|
|
1466
1509
|
/**
|
|
1467
1510
|
* This method is used to remove a layer from map.
|
|
@@ -1470,9 +1513,11 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1470
1513
|
* @returns {void}
|
|
1471
1514
|
*/
|
|
1472
1515
|
Maps.prototype.removeLayer = function (index) {
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1516
|
+
if (!this.isDestroyed) {
|
|
1517
|
+
var mapsLayer = this.layers;
|
|
1518
|
+
mapsLayer.splice(index, 1);
|
|
1519
|
+
this.layers = mapsLayer;
|
|
1520
|
+
}
|
|
1476
1521
|
};
|
|
1477
1522
|
/**
|
|
1478
1523
|
* This method is used to add markers dynamically in the maps.
|
|
@@ -1484,15 +1529,17 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1484
1529
|
* @returns {void}
|
|
1485
1530
|
*/
|
|
1486
1531
|
Maps.prototype.addMarker = function (layerIndex, markerCollection) {
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
var
|
|
1491
|
-
|
|
1532
|
+
if (!this.isDestroyed) {
|
|
1533
|
+
var layerEle = document.getElementById(this.element.id + '_LayerIndex_' + layerIndex);
|
|
1534
|
+
if (markerCollection.length > 0 && layerEle) {
|
|
1535
|
+
for (var _i = 0, markerCollection_1 = markerCollection; _i < markerCollection_1.length; _i++) {
|
|
1536
|
+
var newMarker = markerCollection_1[_i];
|
|
1537
|
+
this.layersCollection[layerIndex].markerSettings.push(new MarkerSettings(this, 'markerSettings', newMarker));
|
|
1538
|
+
}
|
|
1539
|
+
var markerModule = new Marker(this);
|
|
1540
|
+
markerModule.markerRender(this, layerEle, layerIndex, this.mapLayerPanel['currentFactor'], 'AddMarker');
|
|
1541
|
+
this.arrangeTemplate();
|
|
1492
1542
|
}
|
|
1493
|
-
var markerModule = new Marker(this);
|
|
1494
|
-
markerModule.markerRender(this, layerEle, layerIndex, this.mapLayerPanel['currentFactor'], 'AddMarker');
|
|
1495
|
-
this.arrangeTemplate();
|
|
1496
1543
|
}
|
|
1497
1544
|
};
|
|
1498
1545
|
/**
|
|
@@ -1505,93 +1552,96 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1505
1552
|
* @returns {void}
|
|
1506
1553
|
*/
|
|
1507
1554
|
Maps.prototype.shapeSelection = function (layerIndex, propertyName, name, enable) {
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
enable
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
this.
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1555
|
+
if (!this.isDestroyed) {
|
|
1556
|
+
var targetEle = void 0;
|
|
1557
|
+
var subLayerIndex = void 0;
|
|
1558
|
+
var popertyNameArray = Array.isArray(propertyName) ? propertyName : Array(propertyName);
|
|
1559
|
+
if (isNullOrUndefined(enable)) {
|
|
1560
|
+
enable = true;
|
|
1561
|
+
}
|
|
1562
|
+
var selectionsettings = this.layers[layerIndex].selectionSettings;
|
|
1563
|
+
if (!selectionsettings.enableMultiSelect && this.legendSelection && enable) {
|
|
1564
|
+
this.removeShapeSelection();
|
|
1565
|
+
}
|
|
1566
|
+
if (this.layers[layerIndex].type === 'SubLayer') {
|
|
1567
|
+
for (var i = 0; i < this.layersCollection.length; i++) {
|
|
1568
|
+
if ((this.layersCollection[i].shapeData === this.layers[layerIndex].shapeData)) {
|
|
1569
|
+
subLayerIndex = i;
|
|
1570
|
+
break;
|
|
1571
|
+
}
|
|
1523
1572
|
}
|
|
1524
1573
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
targetId = this.element.id + '_' + 'LayerIndex_' + indexValue + '_shapeIndex_' + i + '_dataIndex_' + k;
|
|
1553
|
-
targetEle = getElement(targetId);
|
|
1554
|
-
if (isNullOrUndefined(k) && isNullOrUndefined(targetEle)) {
|
|
1555
|
-
targetId = this.element.id + '_' + 'LayerIndex_' + layerIndex + '_shapeIndex_' + i + '_dataIndex_null';
|
|
1574
|
+
if (selectionsettings.enable) {
|
|
1575
|
+
var targetId = void 0;
|
|
1576
|
+
var dataIndex = void 0;
|
|
1577
|
+
var shapeIndex = void 0;
|
|
1578
|
+
var indexValue = void 0;
|
|
1579
|
+
var shapeDataValue = void 0;
|
|
1580
|
+
var data = void 0;
|
|
1581
|
+
var shapeData = this.layers[layerIndex].shapeData['features'];
|
|
1582
|
+
for (var i = 0; i < shapeData.length; i++) {
|
|
1583
|
+
for (var j = 0; j < popertyNameArray.length; j++) {
|
|
1584
|
+
var propertyName_1 = !isNullOrUndefined(shapeData[i]['properties'][popertyNameArray[j]])
|
|
1585
|
+
&& isNaN(shapeData[i]['properties'][popertyNameArray[j]]) ?
|
|
1586
|
+
shapeData[i]['properties'][popertyNameArray[j]].toLowerCase() : shapeData[i]['properties'][popertyNameArray[j]];
|
|
1587
|
+
var shapeName = !isNullOrUndefined(name) && typeof name === 'string' ? name.toLowerCase() : name;
|
|
1588
|
+
var k = void 0;
|
|
1589
|
+
if (propertyName_1 === shapeName) {
|
|
1590
|
+
if (!isNullOrUndefined(this.layers[layerIndex].shapeSettings.colorValuePath)) {
|
|
1591
|
+
k = checkShapeDataFields(this.layers[layerIndex].dataSource, shapeData[i]['properties'], this.layers[layerIndex].shapeDataPath, this.layers[layerIndex].shapePropertyPath, this.layers[layerIndex]);
|
|
1592
|
+
}
|
|
1593
|
+
var baseLayer = this.layers[layerIndex];
|
|
1594
|
+
if (this.baseLayerIndex >= 0 && baseLayer.isBaseLayer) {
|
|
1595
|
+
indexValue = 0;
|
|
1596
|
+
}
|
|
1597
|
+
else if (this.layers[layerIndex].type === 'SubLayer') {
|
|
1598
|
+
indexValue = subLayerIndex;
|
|
1599
|
+
}
|
|
1600
|
+
targetId = this.element.id + '_' + 'LayerIndex_' + indexValue + '_shapeIndex_' + i + '_dataIndex_' + k;
|
|
1556
1601
|
targetEle = getElement(targetId);
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
this.layers[layerIndex].shapeData['features'][shapeIndex]['properties'] : null;
|
|
1561
|
-
dataIndex = parseInt(targetEle.id.split('_dataIndex_')[1].split('_')[0], 10);
|
|
1562
|
-
data = isNullOrUndefined(dataIndex) ? null : this.layers[layerIndex].dataSource[dataIndex];
|
|
1563
|
-
if (enable) {
|
|
1564
|
-
triggerItemSelectionEvent(selectionsettings, this, targetEle, shapeDataValue, data);
|
|
1565
|
-
this.shapeSelectionClass = getElement('ShapeselectionMap');
|
|
1566
|
-
if (this.legendSettings.visible && targetEle.id.indexOf('_MarkerIndex_') === -1) {
|
|
1567
|
-
this.legendModule.shapeHighLightAndSelection(targetEle, data, selectionsettings, 'selection', layerIndex);
|
|
1602
|
+
if (isNullOrUndefined(k) && isNullOrUndefined(targetEle)) {
|
|
1603
|
+
targetId = this.element.id + '_' + 'LayerIndex_' + layerIndex + '_shapeIndex_' + i + '_dataIndex_null';
|
|
1604
|
+
targetEle = getElement(targetId);
|
|
1568
1605
|
}
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1606
|
+
shapeIndex = parseInt(targetEle.id.split('_shapeIndex_')[1].split('_')[0], 10);
|
|
1607
|
+
shapeDataValue = this.layers[layerIndex].shapeData['features']['length'] > shapeIndex ?
|
|
1608
|
+
this.layers[layerIndex].shapeData['features'][shapeIndex]['properties'] : null;
|
|
1609
|
+
dataIndex = parseInt(targetEle.id.split('_dataIndex_')[1].split('_')[0], 10);
|
|
1610
|
+
data = isNullOrUndefined(dataIndex) ? null : this.layers[layerIndex].dataSource[dataIndex];
|
|
1611
|
+
if (enable) {
|
|
1612
|
+
triggerItemSelectionEvent(selectionsettings, this, targetEle, shapeDataValue, data);
|
|
1613
|
+
this.shapeSelectionClass = getElement('ShapeselectionMap');
|
|
1614
|
+
if (this.legendSettings.visible && targetEle.id.indexOf('_MarkerIndex_') === -1) {
|
|
1615
|
+
this.legendModule.shapeHighLightAndSelection(targetEle, data, selectionsettings, 'selection', layerIndex);
|
|
1574
1616
|
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1617
|
+
var shapeToggled = this.legendSettings.visible ? this.legendModule.shapeToggled : true;
|
|
1618
|
+
if (shapeToggled) {
|
|
1619
|
+
targetEle.setAttribute('class', 'ShapeselectionMapStyle');
|
|
1620
|
+
if (this.selectedElementId.indexOf(targetEle.getAttribute('id')) === -1) {
|
|
1621
|
+
this.selectedElementId.push(targetEle.getAttribute('id'));
|
|
1622
|
+
}
|
|
1623
|
+
if (!selectionsettings.enableMultiSelect) {
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1577
1626
|
}
|
|
1578
1627
|
}
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1628
|
+
else {
|
|
1629
|
+
this.legendSelection = (!selectionsettings.enableMultiSelect && !this.legendSelection) ?
|
|
1630
|
+
true : this.legendSelection;
|
|
1631
|
+
if (this.legendSettings.visible && targetEle.id.indexOf('_MarkerIndex_') === -1 &&
|
|
1632
|
+
targetEle.getAttribute('class') === 'ShapeselectionMapStyle') {
|
|
1633
|
+
this.legendModule.shapeHighLightAndSelection(targetEle, data, selectionsettings, 'selection', layerIndex);
|
|
1634
|
+
}
|
|
1635
|
+
var shapeToggled = this.legendSettings.visible ? this.legendModule.shapeToggled : true;
|
|
1636
|
+
if (shapeToggled) {
|
|
1637
|
+
removeClass(targetEle);
|
|
1638
|
+
var selectedElementIdIndex = this.selectedElementId.indexOf(targetEle.getAttribute('id'));
|
|
1639
|
+
if (selectedElementIdIndex !== -1) {
|
|
1640
|
+
this.selectedElementId.splice(selectedElementIdIndex, 1);
|
|
1641
|
+
if (!selectionsettings.enableMultiSelect && this.legendSelection
|
|
1642
|
+
&& this.selectedElementId.length > 0) {
|
|
1643
|
+
this.removeShapeSelection();
|
|
1644
|
+
}
|
|
1595
1645
|
}
|
|
1596
1646
|
}
|
|
1597
1647
|
}
|
|
@@ -1612,53 +1662,55 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1612
1662
|
*/
|
|
1613
1663
|
Maps.prototype.zoomToCoordinates = function (minLatitude, minLongitude, maxLatitude, maxLongitude) {
|
|
1614
1664
|
var _a, _b;
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1665
|
+
if (!this.isDestroyed) {
|
|
1666
|
+
var centerLatitude = void 0;
|
|
1667
|
+
var centerLongtitude = void 0;
|
|
1668
|
+
var isTwoCoordinates = false;
|
|
1669
|
+
this.centerPosition = {
|
|
1670
|
+
latitude: null,
|
|
1671
|
+
longitude: null
|
|
1672
|
+
};
|
|
1673
|
+
this.isZoomByPosition = false;
|
|
1674
|
+
if (isNullOrUndefined(maxLatitude) && isNullOrUndefined(maxLongitude)
|
|
1675
|
+
|| isNullOrUndefined(minLatitude) && isNullOrUndefined(minLongitude)) {
|
|
1676
|
+
minLatitude = isNullOrUndefined(minLatitude) ? 0 : minLatitude;
|
|
1677
|
+
minLongitude = isNullOrUndefined(minLatitude) ? 0 : minLongitude;
|
|
1678
|
+
maxLatitude = isNullOrUndefined(maxLatitude) ? minLatitude : maxLatitude;
|
|
1679
|
+
maxLongitude = isNullOrUndefined(maxLongitude) ? minLongitude : maxLongitude;
|
|
1680
|
+
isTwoCoordinates = true;
|
|
1681
|
+
}
|
|
1682
|
+
if (minLatitude > maxLatitude) {
|
|
1683
|
+
_a = [maxLatitude, minLatitude], minLatitude = _a[0], maxLatitude = _a[1];
|
|
1684
|
+
}
|
|
1685
|
+
if (minLongitude > maxLongitude) {
|
|
1686
|
+
_b = [maxLongitude, minLongitude], minLongitude = _b[0], maxLongitude = _b[1];
|
|
1687
|
+
}
|
|
1688
|
+
if (!isTwoCoordinates) {
|
|
1689
|
+
centerLatitude = (minLatitude + maxLatitude) / 2;
|
|
1690
|
+
centerLongtitude = (minLongitude + maxLongitude) / 2;
|
|
1691
|
+
}
|
|
1692
|
+
else {
|
|
1693
|
+
centerLatitude = (minLatitude + maxLatitude);
|
|
1694
|
+
centerLongtitude = (minLongitude + maxLongitude);
|
|
1695
|
+
}
|
|
1696
|
+
this.centerLatOfGivenLocation = centerLatitude;
|
|
1697
|
+
this.centerLongOfGivenLocation = centerLongtitude;
|
|
1698
|
+
this.minLatOfGivenLocation = minLatitude;
|
|
1699
|
+
this.minLongOfGivenLocation = minLongitude;
|
|
1700
|
+
this.maxLatOfGivenLocation = maxLatitude;
|
|
1701
|
+
this.maxLongOfGivenLocation = maxLongitude;
|
|
1702
|
+
this.zoomNotApplied = true;
|
|
1703
|
+
this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this);
|
|
1704
|
+
var zoomArgs = {
|
|
1705
|
+
cancel: false, name: 'zoom', type: zoomIn, maps: this,
|
|
1706
|
+
tileTranslatePoint: {}, translatePoint: {},
|
|
1707
|
+
tileZoomLevel: this.isTileMap ? { previous: this.tileZoomLevel, current: this.scaleOfGivenLocation } : {},
|
|
1708
|
+
scale: !this.isTileMap ? { previous: this.scale, current: this.scaleOfGivenLocation } :
|
|
1709
|
+
{ previous: this.tileZoomLevel, current: this.scaleOfGivenLocation }
|
|
1710
|
+
};
|
|
1711
|
+
this.trigger('zoom', zoomArgs);
|
|
1712
|
+
this.refresh();
|
|
1640
1713
|
}
|
|
1641
|
-
else {
|
|
1642
|
-
centerLatitude = (minLatitude + maxLatitude);
|
|
1643
|
-
centerLongtitude = (minLongitude + maxLongitude);
|
|
1644
|
-
}
|
|
1645
|
-
this.centerLatOfGivenLocation = centerLatitude;
|
|
1646
|
-
this.centerLongOfGivenLocation = centerLongtitude;
|
|
1647
|
-
this.minLatOfGivenLocation = minLatitude;
|
|
1648
|
-
this.minLongOfGivenLocation = minLongitude;
|
|
1649
|
-
this.maxLatOfGivenLocation = maxLatitude;
|
|
1650
|
-
this.maxLongOfGivenLocation = maxLongitude;
|
|
1651
|
-
this.zoomNotApplied = true;
|
|
1652
|
-
this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude, this.mapAreaRect.width, this.mapAreaRect.height, this);
|
|
1653
|
-
var zoomArgs = {
|
|
1654
|
-
cancel: false, name: 'zoom', type: zoomIn, maps: this,
|
|
1655
|
-
tileTranslatePoint: {}, translatePoint: {},
|
|
1656
|
-
tileZoomLevel: this.isTileMap ? { previous: this.tileZoomLevel, current: this.scaleOfGivenLocation } : {},
|
|
1657
|
-
scale: !this.isTileMap ? { previous: this.scale, current: this.scaleOfGivenLocation } :
|
|
1658
|
-
{ previous: this.tileZoomLevel, current: this.scaleOfGivenLocation }
|
|
1659
|
-
};
|
|
1660
|
-
this.trigger('zoom', zoomArgs);
|
|
1661
|
-
this.refresh();
|
|
1662
1714
|
};
|
|
1663
1715
|
/**
|
|
1664
1716
|
* This method is used to remove multiple selected shapes in the maps.
|
|
@@ -1709,6 +1761,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1709
1761
|
};
|
|
1710
1762
|
/**
|
|
1711
1763
|
* This method disposes the maps component.
|
|
1764
|
+
*
|
|
1765
|
+
* @returns {void}
|
|
1712
1766
|
*/
|
|
1713
1767
|
Maps.prototype.destroy = function () {
|
|
1714
1768
|
this.unWireEVents();
|
|
@@ -1765,93 +1819,96 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1765
1819
|
* @private
|
|
1766
1820
|
*/
|
|
1767
1821
|
Maps.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
var
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
var
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1822
|
+
if (!this.isDestroyed) {
|
|
1823
|
+
var render = false;
|
|
1824
|
+
var isMarker = false;
|
|
1825
|
+
var isLayer = false;
|
|
1826
|
+
var isStaticMapType = false;
|
|
1827
|
+
var layerEle = void 0;
|
|
1828
|
+
if (newProp['layers']) {
|
|
1829
|
+
var newLayerLength = Object.keys(newProp['layers']).length;
|
|
1830
|
+
layerEle = document.getElementById(this.element.id + '_LayerIndex_' + (newLayerLength - 1));
|
|
1831
|
+
}
|
|
1832
|
+
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
1833
|
+
var prop = _a[_i];
|
|
1834
|
+
switch (prop) {
|
|
1835
|
+
case 'background':
|
|
1836
|
+
this.renderBorder();
|
|
1837
|
+
break;
|
|
1838
|
+
case 'height':
|
|
1839
|
+
case 'width':
|
|
1840
|
+
case 'layers':
|
|
1841
|
+
case 'projectionType':
|
|
1842
|
+
case 'centerPosition':
|
|
1843
|
+
case 'legendSettings':
|
|
1844
|
+
case 'baseLayerIndex':
|
|
1845
|
+
if (prop === 'layers') {
|
|
1846
|
+
isLayer = true;
|
|
1847
|
+
var layerPropLength = Object.keys(newProp.layers).length;
|
|
1848
|
+
for (var x = 0; x < layerPropLength; x++) {
|
|
1849
|
+
if (!isNullOrUndefined(newProp.layers[x])) {
|
|
1850
|
+
var collection = Object.keys(newProp.layers[x]);
|
|
1851
|
+
for (var _b = 0, collection_1 = collection; _b < collection_1.length; _b++) {
|
|
1852
|
+
var collectionProp = collection_1[_b];
|
|
1853
|
+
if ((collectionProp === 'layerType' && newProp.layers[x].layerType !== 'Geometry') ||
|
|
1854
|
+
(isNullOrUndefined(this.layers[x].shapeData)
|
|
1855
|
+
&& !isNullOrUndefined(this.layers[x].urlTemplate) && this.layers[x].urlTemplate !== '')) {
|
|
1856
|
+
this.isReset = true;
|
|
1857
|
+
}
|
|
1858
|
+
else if (collectionProp === 'markerSettings') {
|
|
1859
|
+
isMarker = true;
|
|
1860
|
+
}
|
|
1861
|
+
else if (collectionProp === 'staticMapType') {
|
|
1862
|
+
isStaticMapType = true;
|
|
1863
|
+
}
|
|
1807
1864
|
}
|
|
1808
1865
|
}
|
|
1809
1866
|
}
|
|
1810
1867
|
}
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1868
|
+
render = true;
|
|
1869
|
+
break;
|
|
1870
|
+
case 'zoomSettings':
|
|
1871
|
+
if (!isNullOrUndefined(oldProp.zoomSettings)) {
|
|
1872
|
+
if (newProp.zoomSettings.zoomFactor !== oldProp.zoomSettings.zoomFactor && !isLayer) {
|
|
1873
|
+
render = false;
|
|
1874
|
+
}
|
|
1875
|
+
else if (newProp.zoomSettings.shouldZoomInitially !== oldProp.zoomSettings.shouldZoomInitially) {
|
|
1876
|
+
this.zoomSettings.zoomFactor = 1;
|
|
1877
|
+
render = true;
|
|
1878
|
+
}
|
|
1879
|
+
else if (newProp.zoomSettings.enable !== oldProp.zoomSettings.enable) {
|
|
1880
|
+
this.zoomSettings.zoomFactor = 1;
|
|
1881
|
+
render = true;
|
|
1882
|
+
}
|
|
1883
|
+
else {
|
|
1884
|
+
render = true;
|
|
1885
|
+
}
|
|
1829
1886
|
}
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1887
|
+
break;
|
|
1888
|
+
case 'locale':
|
|
1889
|
+
case 'currencyCode':
|
|
1890
|
+
_super.prototype.refresh.call(this);
|
|
1891
|
+
break;
|
|
1892
|
+
}
|
|
1836
1893
|
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1894
|
+
if (render) {
|
|
1895
|
+
if (newProp.layers && isMarker) {
|
|
1896
|
+
removeElement(this.element.id + '_Markers_Group');
|
|
1897
|
+
if (this.isTileMap) {
|
|
1898
|
+
this.mapLayerPanel.renderTileLayer(this.mapLayerPanel, this.layers['currentFactor'], (this.layers.length - 1));
|
|
1899
|
+
}
|
|
1900
|
+
else {
|
|
1901
|
+
this.render();
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
else if (newProp.layers && isStaticMapType) {
|
|
1905
|
+
this.mapLayerPanel.renderGoogleMap(this.layers[this.layers.length - 1].key, this.staticMapZoom);
|
|
1843
1906
|
}
|
|
1844
1907
|
else {
|
|
1845
|
-
this.
|
|
1908
|
+
this.createSVG();
|
|
1909
|
+
this.renderElements();
|
|
1846
1910
|
}
|
|
1847
1911
|
}
|
|
1848
|
-
else if (newProp.layers && isStaticMapType) {
|
|
1849
|
-
this.mapLayerPanel.renderGoogleMap(this.layers[this.layers.length - 1].key, this.staticMapZoom);
|
|
1850
|
-
}
|
|
1851
|
-
else {
|
|
1852
|
-
this.createSVG();
|
|
1853
|
-
this.renderElements();
|
|
1854
|
-
}
|
|
1855
1912
|
}
|
|
1856
1913
|
};
|
|
1857
1914
|
/**
|
|
@@ -1864,7 +1921,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1864
1921
|
var modules = [];
|
|
1865
1922
|
var isVisible = this.findVisibleLayers(this.layers);
|
|
1866
1923
|
var annotationEnable = false;
|
|
1867
|
-
this.annotations.map(function (annotation
|
|
1924
|
+
this.annotations.map(function (annotation) {
|
|
1868
1925
|
annotationEnable = annotation.content != null;
|
|
1869
1926
|
});
|
|
1870
1927
|
if (this.isBubbleVisible()) {
|
|
@@ -1949,10 +2006,12 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1949
2006
|
};
|
|
1950
2007
|
/**
|
|
1951
2008
|
* To find marker visibility
|
|
2009
|
+
*
|
|
2010
|
+
* @returns {boolean} - Returns whether the markers are visible or not.
|
|
1952
2011
|
*/
|
|
1953
2012
|
Maps.prototype.isMarkersVisible = function () {
|
|
1954
2013
|
var isVisible = false;
|
|
1955
|
-
Array.prototype.forEach.call(this.layers, function (layer
|
|
2014
|
+
Array.prototype.forEach.call(this.layers, function (layer) {
|
|
1956
2015
|
for (var i = 0; i < layer.markerSettings.length; i++) {
|
|
1957
2016
|
if (layer.markerSettings[i].visible) {
|
|
1958
2017
|
isVisible = true;
|
|
@@ -1964,6 +2023,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1964
2023
|
};
|
|
1965
2024
|
/**
|
|
1966
2025
|
* To find DataLabel visibility
|
|
2026
|
+
*
|
|
2027
|
+
* @returns {boolean} - Returns whether the data labels are visible or not.
|
|
1967
2028
|
*/
|
|
1968
2029
|
Maps.prototype.isDataLabelVisible = function () {
|
|
1969
2030
|
var isVisible = false;
|
|
@@ -1977,10 +2038,12 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1977
2038
|
};
|
|
1978
2039
|
/**
|
|
1979
2040
|
* To find navigation line visibility
|
|
2041
|
+
*
|
|
2042
|
+
* @returns {boolean} - Returns whether the navigation lines are visible or not.
|
|
1980
2043
|
*/
|
|
1981
2044
|
Maps.prototype.isNavigationVisible = function () {
|
|
1982
2045
|
var isVisible = false;
|
|
1983
|
-
Array.prototype.forEach.call(this.layers, function (layer
|
|
2046
|
+
Array.prototype.forEach.call(this.layers, function (layer) {
|
|
1984
2047
|
for (var i = 0; i < layer.navigationLineSettings.length; i++) {
|
|
1985
2048
|
if (layer.navigationLineSettings[i].visible) {
|
|
1986
2049
|
isVisible = true;
|
|
@@ -1992,6 +2055,8 @@ var Maps = /** @class */ (function (_super) {
|
|
|
1992
2055
|
};
|
|
1993
2056
|
/**
|
|
1994
2057
|
* To find space between the secondary element and svg element.
|
|
2058
|
+
*
|
|
2059
|
+
* @returns {Point} - Returns the left and top value of the secondary element of Maps.
|
|
1995
2060
|
* @private
|
|
1996
2061
|
*/
|
|
1997
2062
|
Maps.prototype.getExtraPosition = function () {
|
|
@@ -2049,7 +2114,7 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2049
2114
|
* @returns {void}
|
|
2050
2115
|
*/
|
|
2051
2116
|
Maps.prototype.print = function (id) {
|
|
2052
|
-
if ((this.allowPrint) && (this.printModule)) {
|
|
2117
|
+
if ((this.allowPrint) && (this.printModule) && !this.isDestroyed) {
|
|
2053
2118
|
this.printModule.print(this, id);
|
|
2054
2119
|
}
|
|
2055
2120
|
};
|
|
@@ -2064,18 +2129,20 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2064
2129
|
*/
|
|
2065
2130
|
Maps.prototype.export = function (type, fileName, orientation, allowDownload) {
|
|
2066
2131
|
var _this = this;
|
|
2067
|
-
if (
|
|
2068
|
-
allowDownload
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2132
|
+
if (!this.isDestroyed) {
|
|
2133
|
+
if (isNullOrUndefined(allowDownload)) {
|
|
2134
|
+
allowDownload = true;
|
|
2135
|
+
}
|
|
2136
|
+
if ((type !== 'PDF') && (this.allowImageExport) && (this.imageExportModule)) {
|
|
2137
|
+
return new Promise(function (resolve, reject) {
|
|
2138
|
+
resolve(_this.imageExportModule.export(_this, type, fileName, allowDownload));
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
else if ((this.allowPdfExport) && (this.pdfExportModule)) {
|
|
2142
|
+
return new Promise(function (resolve, reject) {
|
|
2143
|
+
resolve(_this.pdfExportModule.export(_this, type, fileName, allowDownload, orientation));
|
|
2144
|
+
});
|
|
2145
|
+
}
|
|
2079
2146
|
}
|
|
2080
2147
|
return null;
|
|
2081
2148
|
};
|
|
@@ -2086,19 +2153,22 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2086
2153
|
* @returns {Promise<string>} - Returns the processed Bing URL as Promise.
|
|
2087
2154
|
*/
|
|
2088
2155
|
Maps.prototype.getBingUrlTemplate = function (url) {
|
|
2089
|
-
var promise
|
|
2090
|
-
|
|
2091
|
-
|
|
2156
|
+
var promise;
|
|
2157
|
+
if (!this.isDestroyed) {
|
|
2158
|
+
promise = new Promise(function (resolve, reject) {
|
|
2159
|
+
var ajax = new Ajax({
|
|
2160
|
+
url: url
|
|
2161
|
+
});
|
|
2162
|
+
ajax.onSuccess = function (json) {
|
|
2163
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2164
|
+
var jsonObject = JSON.parse(json);
|
|
2165
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2166
|
+
var resource = jsonObject['resourceSets'][0]['resources'][0];
|
|
2167
|
+
resolve(resource['imageUrl']);
|
|
2168
|
+
};
|
|
2169
|
+
ajax.send();
|
|
2092
2170
|
});
|
|
2093
|
-
|
|
2094
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2095
|
-
var jsonObject = JSON.parse(json);
|
|
2096
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2097
|
-
var resource = jsonObject['resourceSets'][0]['resources'][0];
|
|
2098
|
-
resolve(resource['imageUrl']);
|
|
2099
|
-
};
|
|
2100
|
-
ajax.send();
|
|
2101
|
-
});
|
|
2171
|
+
}
|
|
2102
2172
|
return promise;
|
|
2103
2173
|
};
|
|
2104
2174
|
/**
|
|
@@ -2179,21 +2249,25 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2179
2249
|
* @returns {GeoPosition}- Returns the geo position
|
|
2180
2250
|
*/
|
|
2181
2251
|
Maps.prototype.getGeoLocation = function (layerIndex, x, y) {
|
|
2182
|
-
var
|
|
2183
|
-
var
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2252
|
+
var latitude = 0;
|
|
2253
|
+
var longitude = 0;
|
|
2254
|
+
if (!this.isDestroyed) {
|
|
2255
|
+
var container = document.getElementById(this.element.id);
|
|
2256
|
+
var pageX = x - container.offsetLeft;
|
|
2257
|
+
var pageY = y - container.offsetTop;
|
|
2258
|
+
var currentLayer = this.layersCollection[layerIndex];
|
|
2259
|
+
var translate = getTranslate(this, currentLayer, false);
|
|
2260
|
+
var translatePoint = translate['location'];
|
|
2261
|
+
var translatePointX = translatePoint.x * this.scale;
|
|
2262
|
+
var translatePointY = translatePoint.y * this.scale;
|
|
2263
|
+
var mapSize = (Math.min(this.mapAreaRect.height, this.mapAreaRect.width)
|
|
2264
|
+
* this.mapLayerPanel['currentFactor']) * this.scale;
|
|
2265
|
+
var xx = (this.clip(pageX - translatePointX, 0, mapSize - 1) / mapSize) - 0.5;
|
|
2266
|
+
var yy = 0.5 - (this.clip(pageY - translatePointY, 0, mapSize - 1) / mapSize);
|
|
2267
|
+
latitude = 90 - 360 * Math.atan(Math.exp(-yy * 2 * Math.PI)) / Math.PI;
|
|
2268
|
+
longitude = 360 * xx;
|
|
2269
|
+
}
|
|
2270
|
+
return { latitude: latitude, longitude: longitude };
|
|
2197
2271
|
};
|
|
2198
2272
|
Maps.prototype.clip = function (value, minVal, maxVal) {
|
|
2199
2273
|
return Math.min(Math.max(value, minVal), maxVal);
|
|
@@ -2206,10 +2280,16 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2206
2280
|
* @returns {GeoPosition} - Returns the position
|
|
2207
2281
|
*/
|
|
2208
2282
|
Maps.prototype.getTileGeoLocation = function (x, y) {
|
|
2209
|
-
var
|
|
2210
|
-
var
|
|
2211
|
-
|
|
2212
|
-
|
|
2283
|
+
var latitude = 0;
|
|
2284
|
+
var longitude = 0;
|
|
2285
|
+
if (!this.isDestroyed) {
|
|
2286
|
+
var container = document.getElementById(this.element.id);
|
|
2287
|
+
var ele = document.getElementById(this.element.id + '_tile_parent');
|
|
2288
|
+
var latLong = this.pointToLatLong(x + this.mapAreaRect.x - (ele.offsetLeft - container.offsetLeft), y + this.mapAreaRect.y - (ele.offsetTop - container.offsetTop));
|
|
2289
|
+
latitude = latLong['latitude'];
|
|
2290
|
+
longitude = latLong['longitude'];
|
|
2291
|
+
}
|
|
2292
|
+
return { latitude: latitude, longitude: longitude };
|
|
2213
2293
|
};
|
|
2214
2294
|
/**
|
|
2215
2295
|
* This method is used to convert the point to latitude and longitude in maps.
|
|
@@ -2219,14 +2299,18 @@ var Maps = /** @class */ (function (_super) {
|
|
|
2219
2299
|
* @returns {Object} - Returns the object.
|
|
2220
2300
|
*/
|
|
2221
2301
|
Maps.prototype.pointToLatLong = function (pageX, pageY) {
|
|
2222
|
-
var
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2302
|
+
var latitude = 0;
|
|
2303
|
+
var longitude = 0;
|
|
2304
|
+
if (!this.isDestroyed) {
|
|
2305
|
+
var padding = this.layers[this.layers.length - 1].layerType === 'GoogleStaticMap' ? 0 : 10;
|
|
2306
|
+
pageY = (this.zoomSettings.enable) ? pageY + padding : pageY;
|
|
2307
|
+
var mapSize = 256 * Math.pow(2, this.tileZoomLevel);
|
|
2308
|
+
var x1 = (this.clip(pageX - (this.translatePoint.x * this.scale), 0, mapSize - 1) / mapSize) - 0.5;
|
|
2309
|
+
var y1 = 0.5 - (this.clip(pageY - (this.translatePoint.y * this.scale), 0, mapSize - 1) / mapSize);
|
|
2310
|
+
latitude = 90 - 360 * Math.atan(Math.exp(-y1 * 2 * Math.PI)) / Math.PI;
|
|
2311
|
+
longitude = 360 * x1;
|
|
2312
|
+
}
|
|
2313
|
+
return { latitude: latitude, longitude: longitude };
|
|
2230
2314
|
};
|
|
2231
2315
|
__decorate([
|
|
2232
2316
|
Property(null)
|