@syncfusion/ej2-maps 30.2.4 → 31.2.2
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 +263 -0
- package/dist/ej2-maps.min.js +2 -2
- package/dist/ej2-maps.umd.min.js +2 -2
- package/dist/global/ej2-maps.min.js +2 -2
- package/dist/global/index.d.ts +2 -2
- package/dist/ts/index.d.ts +4 -0
- package/dist/ts/index.ts +4 -0
- package/dist/ts/maps/index.d.ts +28 -0
- package/dist/ts/maps/index.ts +28 -0
- package/dist/ts/maps/layers/bing-map.d.ts +21 -0
- package/dist/ts/maps/layers/bing-map.ts +51 -0
- package/dist/ts/maps/layers/bubble.d.ts +77 -0
- package/dist/ts/maps/layers/bubble.ts +304 -0
- package/dist/ts/maps/layers/color-mapping.d.ts +36 -0
- package/dist/ts/maps/layers/color-mapping.ts +230 -0
- package/dist/ts/maps/layers/data-label.d.ts +45 -0
- package/dist/ts/maps/layers/data-label.ts +457 -0
- package/dist/ts/maps/layers/layer-panel.d.ts +144 -0
- package/dist/ts/maps/layers/layer-panel.ts +1455 -0
- package/dist/ts/maps/layers/legend.d.ts +173 -0
- package/dist/ts/maps/layers/legend.ts +2465 -0
- package/dist/ts/maps/layers/marker.d.ts +105 -0
- package/dist/ts/maps/layers/marker.ts +632 -0
- package/dist/ts/maps/layers/navigation-selected-line.d.ts +33 -0
- package/dist/ts/maps/layers/navigation-selected-line.ts +171 -0
- package/dist/ts/maps/layers/polygon.d.ts +30 -0
- package/dist/ts/maps/layers/polygon.ts +68 -0
- package/dist/ts/maps/maps-model.d.ts +409 -0
- package/dist/ts/maps/maps.d.ts +1247 -0
- package/dist/ts/maps/maps.ts +3416 -0
- package/dist/ts/maps/model/base-model.d.ts +2107 -0
- package/dist/ts/maps/model/base.d.ts +1840 -0
- package/dist/ts/maps/model/base.ts +2257 -0
- package/dist/ts/maps/model/constants.d.ts +225 -0
- package/dist/ts/maps/model/constants.ts +226 -0
- package/dist/ts/maps/model/export-image.d.ts +39 -0
- package/dist/ts/maps/model/export-image.ts +194 -0
- package/dist/ts/maps/model/export-pdf.d.ts +40 -0
- package/dist/ts/maps/model/export-pdf.ts +183 -0
- package/dist/ts/maps/model/interface.d.ts +892 -0
- package/dist/ts/maps/model/interface.ts +929 -0
- package/dist/ts/maps/model/print.d.ts +45 -0
- package/dist/ts/maps/model/print.ts +125 -0
- package/dist/ts/maps/model/theme.d.ts +98 -0
- package/dist/ts/maps/model/theme.ts +919 -0
- package/dist/ts/maps/user-interaction/annotation.d.ts +27 -0
- package/dist/ts/maps/user-interaction/annotation.ts +133 -0
- package/dist/ts/maps/user-interaction/highlight.d.ts +63 -0
- package/dist/ts/maps/user-interaction/highlight.ts +272 -0
- package/dist/ts/maps/user-interaction/selection.d.ts +85 -0
- package/dist/ts/maps/user-interaction/selection.ts +342 -0
- package/dist/ts/maps/user-interaction/tooltip.d.ts +78 -0
- package/dist/ts/maps/user-interaction/tooltip.ts +500 -0
- package/dist/ts/maps/user-interaction/zoom.d.ts +334 -0
- package/dist/ts/maps/user-interaction/zoom.ts +2523 -0
- package/dist/ts/maps/utils/enum.d.ts +328 -0
- package/dist/ts/maps/utils/enum.ts +343 -0
- package/dist/ts/maps/utils/helper.d.ts +1318 -0
- package/dist/ts/maps/utils/helper.ts +3811 -0
- package/package.json +53 -18
- package/tslint.json +111 -0
|
@@ -0,0 +1,3416 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps Component file
|
|
3
|
+
*/
|
|
4
|
+
import { Component, NotifyPropertyChanges, INotifyPropertyChanged, Property, Fetch } from '@syncfusion/ej2-base';
|
|
5
|
+
import { EventHandler, Browser, EmitType, isNullOrUndefined, createElement, setValue, extend } from '@syncfusion/ej2-base';
|
|
6
|
+
import { Event, remove, L10n, Collection, Internationalization, Complex } from '@syncfusion/ej2-base';
|
|
7
|
+
import { ModuleDeclaration } from '@syncfusion/ej2-base';
|
|
8
|
+
import { SvgRenderer } from '@syncfusion/ej2-svg-base';
|
|
9
|
+
import { Size, createSvg, Point, removeElement, triggerShapeEvent, showTooltip, checkShapeDataFields, MapLocation, getMousePosition, calculateSize } from './utils/helper';
|
|
10
|
+
import { getElement, removeClass, getTranslate, triggerItemSelectionEvent, mergeSeparateCluster, customizeStyle, querySelector } from './utils/helper';
|
|
11
|
+
import { createStyle, getProcessedMarginValue } from './utils/helper';
|
|
12
|
+
import { ZoomSettings, LegendSettings } from './model/base';
|
|
13
|
+
import { LayerSettings, TitleSettings, Border, Margin, MapsAreaSettings, Annotation, CenterPosition } from './model/base';
|
|
14
|
+
import { ZoomSettingsModel, LegendSettingsModel, LayerSettingsModel, BubbleSettingsModel, PolygonSettingsModel } from './model/base-model';
|
|
15
|
+
import { MarkerSettingsModel, SelectionSettingsModel, InitialMarkerSelectionSettingsModel } from './model/base-model';
|
|
16
|
+
import { TitleSettingsModel, BorderModel, MarginModel, CenterPositionModel, InitialShapeSelectionSettingsModel } from './model/base-model';
|
|
17
|
+
import { MapsAreaSettingsModel, AnnotationModel } from './model/base-model';
|
|
18
|
+
import { Bubble } from './layers/bubble';
|
|
19
|
+
import { Legend } from './layers/legend';
|
|
20
|
+
import { Marker } from './layers/marker';
|
|
21
|
+
import { Highlight } from './user-interaction/highlight';
|
|
22
|
+
import { Selection } from './user-interaction/selection';
|
|
23
|
+
import { MapsTooltip } from './user-interaction/tooltip';
|
|
24
|
+
import { Zoom } from './user-interaction/zoom';
|
|
25
|
+
import { load, click, onclick, rightClick, doubleClick, resize, shapeSelected, zoomIn, mouseMove } from './model/constants';
|
|
26
|
+
import { ProjectionType, MapsTheme, PanDirection, TooltipGesture } from './utils/enum';
|
|
27
|
+
import { MapsModel } from './maps-model';
|
|
28
|
+
import { getThemeStyle, Theme } from './model/theme';
|
|
29
|
+
import { ILoadEventArgs, ILoadedEventArgs, IMinMaxLatitudeLongitude, IMouseEventArgs, IMouseMoveEventArgs, IResizeEventArgs, ITooltipRenderEventArgs } from './model/interface';
|
|
30
|
+
import { GeoPosition, ITooltipRenderCompleteEventArgs, ILegendRenderingEventArgs } from './model/interface';
|
|
31
|
+
import { ILayerRenderingEventArgs, IShapeRenderingEventArgs, IMarkerRenderingEventArgs, IMarkerClickEventArgs } from './model/interface';
|
|
32
|
+
import { IMarkerMoveEventArgs, ILabelRenderingEventArgs, IBubbleMoveEventArgs, IBubbleClickEventArgs } from './model/interface';
|
|
33
|
+
import { IMarkerClusterClickEventArgs, IMarkerClusterMoveEventArgs, IMarkerClusterRenderingEventArgs } from './model/interface';
|
|
34
|
+
import { ISelectionEventArgs, IShapeSelectedEventArgs, IMapPanEventArgs, IMapZoomEventArgs } from './model/interface';
|
|
35
|
+
import { IBubbleRenderingEventArgs, IAnimationCompleteEventArgs, IPrintEventArgs, IThemeStyle } from './model/interface';
|
|
36
|
+
import { LayerPanel } from './layers/layer-panel';
|
|
37
|
+
import { GeoLocation, Rect, RectOption, measureText, getElementByID, MapAjax, processResult, getElementsByClassName } from '../maps/utils/helper';
|
|
38
|
+
import { findPosition, textTrim, TextOption, renderTextElement, calculateZoomLevel, convertTileLatLongToPoint, convertGeoToPoint} from '../maps/utils/helper';
|
|
39
|
+
import { Annotations } from '../maps/user-interaction/annotation';
|
|
40
|
+
import { FontModel, DataLabel, MarkerSettings, IAnnotationRenderingEventArgs, IMarkerDragEventArgs, BingMap } from './index';
|
|
41
|
+
import { NavigationLineSettingsModel, changeBorderWidth } from './index';
|
|
42
|
+
import { NavigationLine } from './layers/navigation-selected-line';
|
|
43
|
+
import { Polygon } from './layers/polygon';
|
|
44
|
+
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
45
|
+
import { ExportType } from '../maps/utils/enum';
|
|
46
|
+
import { PdfPageOrientation } from '@syncfusion/ej2-pdf-export';
|
|
47
|
+
import { Print } from './model/print';
|
|
48
|
+
import { PdfExport } from './model/export-pdf';
|
|
49
|
+
import { ImageExport } from './model/export-image';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Represents the maps control. It is ideal for rendering maps from GeoJSON data or other map providers like OpenStreetMap, Google Maps, Bing Maps, etc that
|
|
53
|
+
* has rich feature set that includes markers, labels, bubbles and much more.
|
|
54
|
+
* ```html
|
|
55
|
+
* <div id="maps"/>
|
|
56
|
+
* <script>
|
|
57
|
+
* var maps = new Maps();
|
|
58
|
+
* maps.appendTo("#maps");
|
|
59
|
+
* </script>
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
@NotifyPropertyChanges
|
|
63
|
+
export class Maps extends Component<HTMLElement> implements INotifyPropertyChanged {
|
|
64
|
+
|
|
65
|
+
//Module Declaration of Maps.
|
|
66
|
+
/**
|
|
67
|
+
* Gets or sets the module to add bubbles in the maps.
|
|
68
|
+
*
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
public bubbleModule: Bubble;
|
|
72
|
+
/**
|
|
73
|
+
* Sets and get the module to add the marker in the maps.
|
|
74
|
+
*
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
public markerModule: Marker;
|
|
78
|
+
/**
|
|
79
|
+
* Gets or sets the module to add the data-label in the maps.
|
|
80
|
+
*
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
public dataLabelModule: DataLabel;
|
|
84
|
+
/**
|
|
85
|
+
* Gets or sets the module to highlight the element when mouse has hovered on it in maps.
|
|
86
|
+
*
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
public highlightModule: Highlight;
|
|
90
|
+
/**
|
|
91
|
+
* Gets or sets the module to add the navigation lines in the maps.
|
|
92
|
+
*
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
public navigationLineModule: NavigationLine;
|
|
96
|
+
/**
|
|
97
|
+
* Gets or sets the module to add the polygon shapes over the maps.
|
|
98
|
+
*
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
public polygonModule: Polygon;
|
|
102
|
+
/**
|
|
103
|
+
* Gets or sets the module to add the legend in maps.
|
|
104
|
+
*
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
public legendModule: Legend;
|
|
108
|
+
/**
|
|
109
|
+
* Gets or sets the module to select the geometric shapes when clicking in maps.
|
|
110
|
+
*
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
113
|
+
public selectionModule: Selection;
|
|
114
|
+
/**
|
|
115
|
+
* Gets or sets the module to add the tooltip when mouse has hovered on an element in maps.
|
|
116
|
+
*
|
|
117
|
+
* @private
|
|
118
|
+
*/
|
|
119
|
+
public mapsTooltipModule: MapsTooltip;
|
|
120
|
+
/**
|
|
121
|
+
* Gets or sets the module to add the zooming operations in maps.
|
|
122
|
+
*
|
|
123
|
+
* @private
|
|
124
|
+
*/
|
|
125
|
+
public zoomModule: Zoom;
|
|
126
|
+
/**
|
|
127
|
+
* Gets or sets the module to add annotation elements in maps.
|
|
128
|
+
*
|
|
129
|
+
* @private
|
|
130
|
+
*/
|
|
131
|
+
public annotationsModule: Annotations;
|
|
132
|
+
/**
|
|
133
|
+
* This module enables the print functionality in maps.
|
|
134
|
+
*
|
|
135
|
+
* @private
|
|
136
|
+
*/
|
|
137
|
+
public printModule: Print;
|
|
138
|
+
/**
|
|
139
|
+
* This module enables the export to PDF functionality in maps.
|
|
140
|
+
*
|
|
141
|
+
* @private
|
|
142
|
+
*/
|
|
143
|
+
public pdfExportModule: PdfExport;
|
|
144
|
+
/**
|
|
145
|
+
* This module enables the export to image functionality in maps.
|
|
146
|
+
*
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
149
|
+
public imageExportModule: ImageExport;
|
|
150
|
+
/**
|
|
151
|
+
* This module enables the bing map functionality in maps.
|
|
152
|
+
*
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
public bingMap: BingMap;
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
// Maps pblic API Declaration
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Gets or sets the background color of the maps container.
|
|
162
|
+
*
|
|
163
|
+
* @default null
|
|
164
|
+
*/
|
|
165
|
+
@Property(null)
|
|
166
|
+
public background: string;
|
|
167
|
+
/**
|
|
168
|
+
* Enables or disables the visibility state of the separator for grouping.
|
|
169
|
+
*
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
172
|
+
@Property(false)
|
|
173
|
+
public useGroupingSeparator: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Gets or sets the format to apply internationalization for the text in the maps.
|
|
176
|
+
*
|
|
177
|
+
* @default null
|
|
178
|
+
*/
|
|
179
|
+
@Property(null)
|
|
180
|
+
public format: string;
|
|
181
|
+
/**
|
|
182
|
+
* Gets or sets the width in which the maps is to be rendered.
|
|
183
|
+
*
|
|
184
|
+
* @default null
|
|
185
|
+
*/
|
|
186
|
+
@Property(null)
|
|
187
|
+
public width: string;
|
|
188
|
+
/**
|
|
189
|
+
* Gets or sets the height in which the maps is to be rendered.
|
|
190
|
+
*
|
|
191
|
+
* @default null
|
|
192
|
+
*/
|
|
193
|
+
@Property(null)
|
|
194
|
+
public height: string;
|
|
195
|
+
/**
|
|
196
|
+
* Gets or sets the mode in which the tooltip is to be displayed.
|
|
197
|
+
* The tooltip can be rendered on mouse move, click or double clicking on the
|
|
198
|
+
* element on the map.
|
|
199
|
+
*
|
|
200
|
+
* @default 'MouseMove'
|
|
201
|
+
*/
|
|
202
|
+
@Property('MouseMove')
|
|
203
|
+
public tooltipDisplayMode: TooltipGesture;
|
|
204
|
+
/**
|
|
205
|
+
* Enables or disables the print functionality in maps.
|
|
206
|
+
*
|
|
207
|
+
* @default false
|
|
208
|
+
*/
|
|
209
|
+
@Property(false)
|
|
210
|
+
public allowPrint: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Enables or disables the export to image functionality in maps.
|
|
213
|
+
*
|
|
214
|
+
* @default false
|
|
215
|
+
*/
|
|
216
|
+
@Property(false)
|
|
217
|
+
public allowImageExport: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Enables or disables the export to PDF functionality in maps.
|
|
220
|
+
*
|
|
221
|
+
* @default false
|
|
222
|
+
*/
|
|
223
|
+
@Property(false)
|
|
224
|
+
public allowPdfExport: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Gets or sets the options to customize the title of the maps.
|
|
227
|
+
*/
|
|
228
|
+
@Complex<TitleSettingsModel>({}, TitleSettings)
|
|
229
|
+
public titleSettings: TitleSettingsModel;
|
|
230
|
+
/**
|
|
231
|
+
* Gets or sets the options to customize the zooming operations in maps.
|
|
232
|
+
*/
|
|
233
|
+
@Complex<ZoomSettingsModel>({}, ZoomSettings)
|
|
234
|
+
public zoomSettings: ZoomSettingsModel;
|
|
235
|
+
/**
|
|
236
|
+
* Gets or sets the options to customize the legend of the maps.
|
|
237
|
+
*/
|
|
238
|
+
@Complex<LegendSettingsModel>({}, LegendSettings)
|
|
239
|
+
public legendSettings: LegendSettingsModel;
|
|
240
|
+
/**
|
|
241
|
+
* Gets or sets the options to customize the layers of the maps.
|
|
242
|
+
*/
|
|
243
|
+
@Collection<LayerSettingsModel>([], LayerSettings)
|
|
244
|
+
public layers: LayerSettingsModel[];
|
|
245
|
+
/**
|
|
246
|
+
* Gets or sets the options for customizing the annotations in the maps.
|
|
247
|
+
*/
|
|
248
|
+
@Collection<AnnotationModel>([], Annotation)
|
|
249
|
+
public annotations: AnnotationModel[];
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Gets or sets the options to customize the margin of the maps.
|
|
253
|
+
*/
|
|
254
|
+
@Complex<MarginModel>({}, Margin)
|
|
255
|
+
public margin: MarginModel;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Gets or sets the options for customizing the style properties of the maps border.
|
|
259
|
+
*/
|
|
260
|
+
@Complex<BorderModel>({ color: '#DDDDDD', width: 0 }, Border)
|
|
261
|
+
public border: BorderModel;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Gets or sets the theme styles supported for maps. When the theme is set, the styles associated with the theme will be set in the maps.
|
|
265
|
+
*
|
|
266
|
+
* @default Material
|
|
267
|
+
*/
|
|
268
|
+
@Property('Material')
|
|
269
|
+
public theme: MapsTheme;
|
|
270
|
+
/**
|
|
271
|
+
* Gets or sets the projection with which the maps will be rendered to show the two-dimensional curved surface of a globe on a plane.
|
|
272
|
+
*
|
|
273
|
+
* @default Mercator
|
|
274
|
+
*/
|
|
275
|
+
@Property('Mercator')
|
|
276
|
+
public projectionType: ProjectionType;
|
|
277
|
+
/**
|
|
278
|
+
* Gets or sets the index of the layer of maps which will be the base layer. It provides the option to select which layer to be visible in the maps.
|
|
279
|
+
*
|
|
280
|
+
* @default 0
|
|
281
|
+
*/
|
|
282
|
+
@Property(0)
|
|
283
|
+
public baseLayerIndex: number;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Gets or sets the description of the maps for assistive technology.
|
|
287
|
+
*
|
|
288
|
+
* @default null
|
|
289
|
+
*/
|
|
290
|
+
@Property(null)
|
|
291
|
+
public description: string;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Gets or sets the tab index value for the maps.
|
|
295
|
+
*
|
|
296
|
+
* @default 0
|
|
297
|
+
*/
|
|
298
|
+
@Property(0)
|
|
299
|
+
public tabIndex: number;
|
|
300
|
+
/**
|
|
301
|
+
* Gets or sets the center position of the maps.
|
|
302
|
+
*/
|
|
303
|
+
@Complex<CenterPositionModel>({ latitude: null, longitude: null }, CenterPosition)
|
|
304
|
+
public centerPosition: CenterPositionModel;
|
|
305
|
+
/**
|
|
306
|
+
* Gets or sets the options to customize the area around the map.
|
|
307
|
+
*/
|
|
308
|
+
@Complex<MapsAreaSettingsModel>({}, MapsAreaSettings)
|
|
309
|
+
public mapsArea: MapsAreaSettingsModel;
|
|
310
|
+
/**
|
|
311
|
+
* Triggers before the maps gets rendered.
|
|
312
|
+
*
|
|
313
|
+
* @event load
|
|
314
|
+
*/
|
|
315
|
+
@Event()
|
|
316
|
+
public load: EmitType<ILoadEventArgs>;
|
|
317
|
+
/**
|
|
318
|
+
* Triggers before the print gets started.
|
|
319
|
+
*
|
|
320
|
+
* @event beforePrint
|
|
321
|
+
*/
|
|
322
|
+
@Event()
|
|
323
|
+
public beforePrint: EmitType<IPrintEventArgs>;
|
|
324
|
+
/**
|
|
325
|
+
* Triggers after the maps gets rendered.
|
|
326
|
+
*
|
|
327
|
+
* @event loaded
|
|
328
|
+
*/
|
|
329
|
+
@Event()
|
|
330
|
+
public loaded: EmitType<ILoadedEventArgs>;
|
|
331
|
+
/**
|
|
332
|
+
* Triggers when a user clicks on an element in Maps.
|
|
333
|
+
*
|
|
334
|
+
* @event click
|
|
335
|
+
* @deprecated
|
|
336
|
+
*/
|
|
337
|
+
@Event()
|
|
338
|
+
public click: EmitType<IMouseEventArgs>;
|
|
339
|
+
/**
|
|
340
|
+
* Triggers when a user clicks on an element in Maps.
|
|
341
|
+
*
|
|
342
|
+
* @event onclick
|
|
343
|
+
*/
|
|
344
|
+
@Event()
|
|
345
|
+
public onclick: EmitType<IMouseEventArgs>;
|
|
346
|
+
/**
|
|
347
|
+
* Triggers when performing the double click operation on an element in maps.
|
|
348
|
+
*
|
|
349
|
+
* @event doubleClick
|
|
350
|
+
*/
|
|
351
|
+
@Event()
|
|
352
|
+
public doubleClick: EmitType<IMouseEventArgs>;
|
|
353
|
+
/**
|
|
354
|
+
* Triggers when performing the right click operation on an element in maps.
|
|
355
|
+
*
|
|
356
|
+
* @event rightClick
|
|
357
|
+
*/
|
|
358
|
+
@Event()
|
|
359
|
+
public rightClick: EmitType<IMouseEventArgs>;
|
|
360
|
+
/**
|
|
361
|
+
* Triggers to notify the resize of the maps when the window is resized.
|
|
362
|
+
*
|
|
363
|
+
* @event resize
|
|
364
|
+
*/
|
|
365
|
+
@Event()
|
|
366
|
+
public resize: EmitType<IResizeEventArgs>;
|
|
367
|
+
/**
|
|
368
|
+
* Triggers before the maps tooltip gets rendered.
|
|
369
|
+
*
|
|
370
|
+
* @event tooltipRender
|
|
371
|
+
*/
|
|
372
|
+
@Event()
|
|
373
|
+
public tooltipRender: EmitType<ITooltipRenderEventArgs>;
|
|
374
|
+
/**
|
|
375
|
+
* Triggers before the legend gets rendered.
|
|
376
|
+
*
|
|
377
|
+
* @event legendRendering
|
|
378
|
+
* @deprecated
|
|
379
|
+
*/
|
|
380
|
+
@Event()
|
|
381
|
+
public legendRendering: EmitType<ILegendRenderingEventArgs>;
|
|
382
|
+
/**
|
|
383
|
+
* Triggers after the maps tooltip gets rendered.
|
|
384
|
+
*
|
|
385
|
+
* @deprecated
|
|
386
|
+
* @event tooltipRenderComplete
|
|
387
|
+
*/
|
|
388
|
+
@Event()
|
|
389
|
+
public tooltipRenderComplete: EmitType<ITooltipRenderCompleteEventArgs>;
|
|
390
|
+
/**
|
|
391
|
+
* Triggers when a shape is selected in the maps.
|
|
392
|
+
*
|
|
393
|
+
* @event shapeSelected
|
|
394
|
+
*/
|
|
395
|
+
@Event()
|
|
396
|
+
public shapeSelected: EmitType<IShapeSelectedEventArgs>;
|
|
397
|
+
/**
|
|
398
|
+
* Triggers before the shape, bubble or marker gets selected.
|
|
399
|
+
*
|
|
400
|
+
* @event itemSelection
|
|
401
|
+
*/
|
|
402
|
+
@Event()
|
|
403
|
+
public itemSelection: EmitType<ISelectionEventArgs>;
|
|
404
|
+
/**
|
|
405
|
+
* Trigger before the shape, bubble or marker gets highlighted.
|
|
406
|
+
*
|
|
407
|
+
* @event itemHighlight
|
|
408
|
+
*/
|
|
409
|
+
@Event()
|
|
410
|
+
public itemHighlight: EmitType<ISelectionEventArgs>;
|
|
411
|
+
/**
|
|
412
|
+
* Triggers before the shape gets highlighted.
|
|
413
|
+
*
|
|
414
|
+
* @event shapeHighlight
|
|
415
|
+
*/
|
|
416
|
+
@Event()
|
|
417
|
+
public shapeHighlight: EmitType<IShapeSelectedEventArgs>;
|
|
418
|
+
/**
|
|
419
|
+
* Triggers before the maps layer gets rendered.
|
|
420
|
+
*
|
|
421
|
+
* @event layerRendering
|
|
422
|
+
*/
|
|
423
|
+
@Event()
|
|
424
|
+
public layerRendering: EmitType<ILayerRenderingEventArgs>;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Triggers before the maps shape gets rendered.
|
|
428
|
+
*
|
|
429
|
+
* @event shapeRendering
|
|
430
|
+
*/
|
|
431
|
+
@Event()
|
|
432
|
+
public shapeRendering: EmitType<IShapeRenderingEventArgs>;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Triggers before the maps marker gets rendered.
|
|
436
|
+
*
|
|
437
|
+
* @event markerRendering
|
|
438
|
+
*/
|
|
439
|
+
@Event()
|
|
440
|
+
public markerRendering: EmitType<IMarkerRenderingEventArgs>;
|
|
441
|
+
/**
|
|
442
|
+
* Triggers before the maps marker cluster gets rendered.
|
|
443
|
+
*
|
|
444
|
+
* @event markerClusterRendering
|
|
445
|
+
*/
|
|
446
|
+
@Event()
|
|
447
|
+
public markerClusterRendering: EmitType<IMarkerClusterRenderingEventArgs>;
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Triggers when clicking on a marker element.
|
|
451
|
+
*
|
|
452
|
+
* @event markerClick
|
|
453
|
+
*/
|
|
454
|
+
@Event()
|
|
455
|
+
public markerClick: EmitType<IMarkerClickEventArgs>;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* When the marker begins to drag on the map, this event is triggered.
|
|
459
|
+
*
|
|
460
|
+
* @event markerDragStart
|
|
461
|
+
*/
|
|
462
|
+
@Event()
|
|
463
|
+
public markerDragStart: EmitType<IMarkerDragEventArgs>;
|
|
464
|
+
/**
|
|
465
|
+
* When the marker has stopped dragging on the map, this event is triggered.
|
|
466
|
+
*
|
|
467
|
+
* @event markerDragEnd
|
|
468
|
+
*/
|
|
469
|
+
@Event()
|
|
470
|
+
public markerDragEnd: EmitType<IMarkerDragEventArgs>;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Triggers when clicking the marker cluster in maps.
|
|
474
|
+
*
|
|
475
|
+
* @event markerClusterClick
|
|
476
|
+
*/
|
|
477
|
+
@Event()
|
|
478
|
+
public markerClusterClick: EmitType<IMarkerClusterClickEventArgs>;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Triggers when moving the mouse over the marker cluster element in maps.
|
|
482
|
+
*
|
|
483
|
+
* @event markerClusterMouseMove
|
|
484
|
+
*/
|
|
485
|
+
@Event()
|
|
486
|
+
public markerClusterMouseMove: EmitType<IMarkerClusterMoveEventArgs>;
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Triggers when moving the mouse over the marker element in maps.
|
|
490
|
+
*
|
|
491
|
+
* @event markerMouseMove
|
|
492
|
+
*/
|
|
493
|
+
@Event()
|
|
494
|
+
public markerMouseMove: EmitType<IMarkerMoveEventArgs>;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* This event is triggered when the mouse pointer moves over the map.
|
|
498
|
+
*
|
|
499
|
+
* @event mouseMove
|
|
500
|
+
*/
|
|
501
|
+
@Event()
|
|
502
|
+
public mouseMove: EmitType<IMouseMoveEventArgs>;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Triggers before the data-label gets rendered.
|
|
506
|
+
*
|
|
507
|
+
* @event dataLabelRendering
|
|
508
|
+
*/
|
|
509
|
+
@Event()
|
|
510
|
+
public dataLabelRendering: EmitType<ILabelRenderingEventArgs>;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Triggers before the bubble element gets rendered on the map.
|
|
514
|
+
*
|
|
515
|
+
* @event bubbleRendering
|
|
516
|
+
*/
|
|
517
|
+
@Event()
|
|
518
|
+
public bubbleRendering: EmitType<IBubbleRenderingEventArgs>;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Triggers when performing the click operation on the bubble element in maps.
|
|
522
|
+
*
|
|
523
|
+
* @event bubbleClick
|
|
524
|
+
*/
|
|
525
|
+
@Event()
|
|
526
|
+
public bubbleClick: EmitType<IBubbleClickEventArgs>;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Triggers when hovering the mouse on the bubble element in maps.
|
|
530
|
+
*
|
|
531
|
+
* @event bubbleMouseMove
|
|
532
|
+
*/
|
|
533
|
+
@Event()
|
|
534
|
+
public bubbleMouseMove: EmitType<IBubbleMoveEventArgs>;
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Triggers after the animation is completed in the maps.
|
|
538
|
+
*
|
|
539
|
+
* @event animationComplete
|
|
540
|
+
*/
|
|
541
|
+
@Event()
|
|
542
|
+
public animationComplete: EmitType<IAnimationCompleteEventArgs>;
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Triggers before rendering an annotation in the maps.
|
|
546
|
+
*
|
|
547
|
+
* @event annotationRendering
|
|
548
|
+
*/
|
|
549
|
+
@Event()
|
|
550
|
+
public annotationRendering: EmitType<IAnnotationRenderingEventArgs>;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Triggers before the zoom operations such as zoom in and zoom out in the maps.
|
|
554
|
+
*
|
|
555
|
+
* @event zoom
|
|
556
|
+
*/
|
|
557
|
+
@Event()
|
|
558
|
+
public zoom: EmitType<IMapZoomEventArgs>;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Triggers before performing the panning operation.
|
|
562
|
+
*
|
|
563
|
+
* @event pan
|
|
564
|
+
*/
|
|
565
|
+
@Event()
|
|
566
|
+
public pan: EmitType<IMapPanEventArgs>;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* This event is triggered after performing the panning action.
|
|
570
|
+
*
|
|
571
|
+
* @event panComplete
|
|
572
|
+
*/
|
|
573
|
+
@Event()
|
|
574
|
+
public panComplete: EmitType<IMapPanEventArgs>;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* This event is triggered after the zooming operation is completed.
|
|
578
|
+
*
|
|
579
|
+
* @event zoomComplete
|
|
580
|
+
*/
|
|
581
|
+
@Event()
|
|
582
|
+
public zoomComplete: EmitType<IMapPanEventArgs>;
|
|
583
|
+
|
|
584
|
+
// Internal properties declaration area.
|
|
585
|
+
/**
|
|
586
|
+
* Specifies the function to format the text contents in the maps.
|
|
587
|
+
*
|
|
588
|
+
* @private
|
|
589
|
+
*/
|
|
590
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
591
|
+
public formatFunction: any;
|
|
592
|
+
/**
|
|
593
|
+
* Specifies the svg renderer object.
|
|
594
|
+
*
|
|
595
|
+
* @private
|
|
596
|
+
*/
|
|
597
|
+
public renderer: SvgRenderer;
|
|
598
|
+
/**
|
|
599
|
+
* Specifies the svg element's object of maps.
|
|
600
|
+
*
|
|
601
|
+
* @private
|
|
602
|
+
*/
|
|
603
|
+
public svgObject: Element;
|
|
604
|
+
/** @public */
|
|
605
|
+
public mapScaleValue: number;
|
|
606
|
+
/**
|
|
607
|
+
* Specifies the available height and width of maps.
|
|
608
|
+
*
|
|
609
|
+
* @private
|
|
610
|
+
*/
|
|
611
|
+
public availableSize: Size;
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* whether it is layer add or not.
|
|
615
|
+
*
|
|
616
|
+
* @private
|
|
617
|
+
*/
|
|
618
|
+
public isAddLayer: boolean;
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Specifies the localization object.
|
|
622
|
+
*
|
|
623
|
+
* @private
|
|
624
|
+
*/
|
|
625
|
+
public localeObject: L10n;
|
|
626
|
+
/**
|
|
627
|
+
* Specifies the default values of localization values.
|
|
628
|
+
*/
|
|
629
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
630
|
+
private defaultLocalConstants: any;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Internal use of internationalization instance.
|
|
634
|
+
*
|
|
635
|
+
* @private
|
|
636
|
+
*/
|
|
637
|
+
public intl: Internationalization;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Check layer whether is geometry or tile.
|
|
641
|
+
*
|
|
642
|
+
* @private
|
|
643
|
+
*/
|
|
644
|
+
public isTileMap: boolean = false;
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Resize the map
|
|
648
|
+
*/
|
|
649
|
+
private resizeTo: number;
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Resize the map
|
|
653
|
+
*
|
|
654
|
+
* @private
|
|
655
|
+
*/
|
|
656
|
+
public isResize: boolean = false;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* @private
|
|
660
|
+
*/
|
|
661
|
+
|
|
662
|
+
public mapAreaRect: Rect;
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* @private
|
|
666
|
+
*/
|
|
667
|
+
public layersCollection: LayerSettings[];
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* @private
|
|
671
|
+
*/
|
|
672
|
+
public isExportInitialTileMap: boolean;
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* @private
|
|
676
|
+
* @hidden
|
|
677
|
+
*/
|
|
678
|
+
public mapLayerPanel: LayerPanel;
|
|
679
|
+
/**
|
|
680
|
+
* @private
|
|
681
|
+
* @hidden
|
|
682
|
+
*/
|
|
683
|
+
/**
|
|
684
|
+
* @private
|
|
685
|
+
*/
|
|
686
|
+
public themeStyle: IThemeStyle;
|
|
687
|
+
/**
|
|
688
|
+
* @private
|
|
689
|
+
*/
|
|
690
|
+
public isReset: boolean = false;
|
|
691
|
+
/**
|
|
692
|
+
* @private
|
|
693
|
+
*/
|
|
694
|
+
public totalRect: Rect;
|
|
695
|
+
/**
|
|
696
|
+
*
|
|
697
|
+
* Specifies whether the shape is selected in the maps or not.
|
|
698
|
+
*
|
|
699
|
+
* @returns {boolean} - Returns a boolean value to specify whether the shape is selected in the maps or not.
|
|
700
|
+
*/
|
|
701
|
+
public get isShapeSelected(): boolean {
|
|
702
|
+
return this.mapSelect;
|
|
703
|
+
}
|
|
704
|
+
public dataLabel: DataLabel;
|
|
705
|
+
/** @private */
|
|
706
|
+
public isTouch: boolean;
|
|
707
|
+
/** @private */
|
|
708
|
+
public baseSize: Size = new Size(0, 0);
|
|
709
|
+
/** @private */
|
|
710
|
+
public scale: number;
|
|
711
|
+
/** @private */
|
|
712
|
+
public baseScale: number;
|
|
713
|
+
/** @private */
|
|
714
|
+
public mapSelect: boolean;
|
|
715
|
+
/** @private */
|
|
716
|
+
public baseMapBounds: GeoLocation;
|
|
717
|
+
/** @private */
|
|
718
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
719
|
+
public baseMapRectBounds: any;
|
|
720
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
721
|
+
private resizeEvent: any;
|
|
722
|
+
/** @public */
|
|
723
|
+
public translatePoint: Point = new Point(0, 0);
|
|
724
|
+
/** @private */
|
|
725
|
+
public baseTranslatePoint: Point = new Point(0, 0);
|
|
726
|
+
/** @public */
|
|
727
|
+
public zoomTranslatePoint: Point = new Point(0, 0);
|
|
728
|
+
/** @private */
|
|
729
|
+
public markerZoomFactor: number;
|
|
730
|
+
/** @private */
|
|
731
|
+
public markerZoomCenterPoint: CenterPositionModel;
|
|
732
|
+
/** @private */
|
|
733
|
+
public markerZoomedState: boolean = true;
|
|
734
|
+
/** @private */
|
|
735
|
+
public zoomPersistence: boolean = false;
|
|
736
|
+
/** @private */
|
|
737
|
+
public defaultState: boolean = true;
|
|
738
|
+
/** @private */
|
|
739
|
+
public currentTiles: HTMLElement;
|
|
740
|
+
/** @private */
|
|
741
|
+
public markerCenterLatitude: number;
|
|
742
|
+
/** @private */
|
|
743
|
+
public markerCenterLongitude: number;
|
|
744
|
+
/** @private */
|
|
745
|
+
public previousCenterLatitude: number;
|
|
746
|
+
/** @private */
|
|
747
|
+
public previousCenterLongitude: number;
|
|
748
|
+
/** @private */
|
|
749
|
+
public centerPositionChanged: boolean = false;
|
|
750
|
+
/** @private */
|
|
751
|
+
public previousZoomFactor: number;
|
|
752
|
+
/** @private */
|
|
753
|
+
public shouldZoomCurrentFactor: number;
|
|
754
|
+
/** @private */
|
|
755
|
+
public shouldZoomPreviousFactor: number;
|
|
756
|
+
/** @private */
|
|
757
|
+
public markerNullCount: number = 0;
|
|
758
|
+
/** @private */
|
|
759
|
+
public translateType: string;
|
|
760
|
+
/** @public */
|
|
761
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
762
|
+
public previousProjection: String;
|
|
763
|
+
/** @private */
|
|
764
|
+
public currentShapeDataLength: number;
|
|
765
|
+
/** @private */
|
|
766
|
+
public tileTranslatePoint: Point = new Point(0, 0);
|
|
767
|
+
/** @private */
|
|
768
|
+
public baseTileTranslatePoint: Point = new Point(0, 0);
|
|
769
|
+
/** @private */
|
|
770
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
771
|
+
public isDevice: Boolean = false;
|
|
772
|
+
/** @private */
|
|
773
|
+
public tileZoomLevel: number;
|
|
774
|
+
/** @private */
|
|
775
|
+
public isZoomByPosition: boolean;
|
|
776
|
+
/** @private */
|
|
777
|
+
public tileZoomScale: number;
|
|
778
|
+
/** @private */
|
|
779
|
+
public staticMapZoom: number = this.zoomSettings.enable ? this.zoomSettings.zoomFactor : 0;
|
|
780
|
+
/** @private */
|
|
781
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
782
|
+
public serverProcess: any;
|
|
783
|
+
/** @private */
|
|
784
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
785
|
+
public toolbarProperties: any;
|
|
786
|
+
/** @private */
|
|
787
|
+
public previousScale: number;
|
|
788
|
+
/** @private */
|
|
789
|
+
public previousPoint: Point;
|
|
790
|
+
/** @private */
|
|
791
|
+
public centerLatOfGivenLocation: number;
|
|
792
|
+
/** @private */
|
|
793
|
+
public centerLongOfGivenLocation: number;
|
|
794
|
+
/** @private */
|
|
795
|
+
public minLatOfGivenLocation: number;
|
|
796
|
+
/** @private */
|
|
797
|
+
public minLongOfGivenLocation: number;
|
|
798
|
+
/** @private */
|
|
799
|
+
public maxLatOfGivenLocation: number;
|
|
800
|
+
/** @private */
|
|
801
|
+
public maxLongOfGivenLocation: number;
|
|
802
|
+
/** @private */
|
|
803
|
+
public scaleOfGivenLocation: number;
|
|
804
|
+
/** @private */
|
|
805
|
+
public zoomNotApplied: boolean = false;
|
|
806
|
+
/** @public */
|
|
807
|
+
public dataLabelShape: number[] = [];
|
|
808
|
+
public zoomShapeCollection: string[] = [];
|
|
809
|
+
public zoomLabelPositions: object[] = [];
|
|
810
|
+
public mouseDownEvent: Object = { x: null, y: null };
|
|
811
|
+
public mouseClickEvent: Object = { x: null, y: null };
|
|
812
|
+
|
|
813
|
+
/** @private */
|
|
814
|
+
public shapeSelectionClass: Element;
|
|
815
|
+
/** @private */
|
|
816
|
+
public selectedElementId: string[] = [];
|
|
817
|
+
/** @private */
|
|
818
|
+
public markerSelectionClass: Element;
|
|
819
|
+
/** @private */
|
|
820
|
+
public selectedMarkerElementId: string[] = [];
|
|
821
|
+
/** @private */
|
|
822
|
+
public bubbleSelectionClass: Element;
|
|
823
|
+
/** @private */
|
|
824
|
+
public selectedBubbleElementId: string[] = [];
|
|
825
|
+
/** @private */
|
|
826
|
+
public navigationSelectionClass: Element;
|
|
827
|
+
/** @private */
|
|
828
|
+
public selectedNavigationElementId: string[] = [];
|
|
829
|
+
/** @private */
|
|
830
|
+
public polygonSelectionClass: Element;
|
|
831
|
+
/** @private */
|
|
832
|
+
public selectedPolygonElementId: string[] = [];
|
|
833
|
+
/** @private */
|
|
834
|
+
public legendSelectionClass: SelectionSettingsModel;
|
|
835
|
+
/** @private */
|
|
836
|
+
public selectedLegendElementId: number[] = [];
|
|
837
|
+
/** @private */
|
|
838
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
839
|
+
public legendSelectionCollection: any[] = [];
|
|
840
|
+
/** @private */
|
|
841
|
+
public shapeSelections: boolean = true;
|
|
842
|
+
/** @private */
|
|
843
|
+
public legendSelection: boolean = true;
|
|
844
|
+
/** @private */
|
|
845
|
+
public toggledLegendId: number[] = [];
|
|
846
|
+
/** @private */
|
|
847
|
+
public toggledElementId: string[] = [];
|
|
848
|
+
/** @private */
|
|
849
|
+
public checkInitialRender: boolean = true;
|
|
850
|
+
/** @private */
|
|
851
|
+
public widthBeforeRefresh: number;
|
|
852
|
+
/** @private */
|
|
853
|
+
public heightBeforeRefresh: number;
|
|
854
|
+
/** @private */
|
|
855
|
+
public previousTranslate: Point;
|
|
856
|
+
/** @private */
|
|
857
|
+
public initialTileTranslate: Point = new Point(0, 0);
|
|
858
|
+
/** @private */
|
|
859
|
+
public previousTileWidth: number;
|
|
860
|
+
/** @private */
|
|
861
|
+
public isMarkerZoomCompleted: boolean = false;
|
|
862
|
+
/** @private */
|
|
863
|
+
public markerDragId: string = '';
|
|
864
|
+
/** @private */
|
|
865
|
+
public previousTileHeight: number;
|
|
866
|
+
/** @private */
|
|
867
|
+
public initialZoomLevel: number;
|
|
868
|
+
/** @private */
|
|
869
|
+
public initialCheck: boolean = true;
|
|
870
|
+
/** @private */
|
|
871
|
+
public applyZoomReset: boolean = false;
|
|
872
|
+
/** @private */
|
|
873
|
+
public markerClusterExpandCheck: boolean = false;
|
|
874
|
+
/** @private */
|
|
875
|
+
public markerClusterExpand: boolean = false;
|
|
876
|
+
/** @private */
|
|
877
|
+
public mouseMoveId: string = '';
|
|
878
|
+
/** @private */
|
|
879
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
880
|
+
public shapeSelectionItem: any[] = [];
|
|
881
|
+
/** @private */
|
|
882
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
883
|
+
public markerDragArgument: any = null;
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Constructor for creating the widget.
|
|
887
|
+
*
|
|
888
|
+
* @param {MapsModel} options Specifies the options
|
|
889
|
+
* @param {string | HTMLElement} element Specifies the element
|
|
890
|
+
*/
|
|
891
|
+
constructor(options?: MapsModel, element?: string | HTMLElement) {
|
|
892
|
+
super(options, <HTMLElement | string>element);
|
|
893
|
+
setValue('mergePersistData', this.mergePersistMapsData, this);
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* To manage persist maps data.
|
|
897
|
+
*
|
|
898
|
+
* @returns {void}
|
|
899
|
+
*/
|
|
900
|
+
private mergePersistMapsData(): void {
|
|
901
|
+
let data: string;
|
|
902
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
903
|
+
let windowData: any;
|
|
904
|
+
try {
|
|
905
|
+
windowData = window.localStorage;
|
|
906
|
+
} catch (e) {
|
|
907
|
+
windowData = null;
|
|
908
|
+
}
|
|
909
|
+
if (!isNullOrUndefined(windowData)) {
|
|
910
|
+
data = window.localStorage.getItem(this.getModuleName() + this.element.id);
|
|
911
|
+
}
|
|
912
|
+
if (!(isNullOrUndefined(data) || (data === ''))) {
|
|
913
|
+
const dataObj: Maps = JSON.parse(data);
|
|
914
|
+
const keys: string[] = Object.keys(dataObj);
|
|
915
|
+
this.isProtectedOnChange = true;
|
|
916
|
+
for (const key of keys) {
|
|
917
|
+
if ((typeof this[key as string] === 'object') && !isNullOrUndefined(this[key as string])) {
|
|
918
|
+
extend(this[key as string], dataObj[key as string]);
|
|
919
|
+
} else {
|
|
920
|
+
this[key as string] = dataObj[key as string];
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
this.isProtectedOnChange = false;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Gets the localized label by locale keyword.
|
|
929
|
+
*
|
|
930
|
+
* @param {string} key - Specifies the key
|
|
931
|
+
* @returns {string} - Returns the string value
|
|
932
|
+
* @private
|
|
933
|
+
*/
|
|
934
|
+
public getLocalizedLabel(key: string): string {
|
|
935
|
+
return this.localeObject.getConstant(key);
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Initializing pre-required values.
|
|
939
|
+
*
|
|
940
|
+
* @returns {void}
|
|
941
|
+
*/
|
|
942
|
+
protected preRender(): void {
|
|
943
|
+
this.isDevice = Browser.isDevice;
|
|
944
|
+
this.initPrivateVariable();
|
|
945
|
+
this.allowServerDataBinding = false;
|
|
946
|
+
this.unWireEVents();
|
|
947
|
+
this.wireEVents();
|
|
948
|
+
this.setCulture();
|
|
949
|
+
}
|
|
950
|
+
private renderElements(): void {
|
|
951
|
+
if (!this.isDestroyed) {
|
|
952
|
+
this.trigger(load, { maps: this });
|
|
953
|
+
this.createSVG();
|
|
954
|
+
this.findBaseAndSubLayers();
|
|
955
|
+
if (!isNullOrUndefined(this.markerModule) && this.markerModule.getMapsInstance()) {
|
|
956
|
+
this.markerModule.initializeMarkerClusterList();
|
|
957
|
+
}
|
|
958
|
+
this.createSecondaryElement();
|
|
959
|
+
this.addTabIndex();
|
|
960
|
+
this.themeStyle = getThemeStyle(this.theme);
|
|
961
|
+
this.renderBorder();
|
|
962
|
+
this.renderTitle(this.titleSettings, 'title', null, null);
|
|
963
|
+
this.renderArea();
|
|
964
|
+
this.processRequestJsonData();
|
|
965
|
+
this.renderComplete();
|
|
966
|
+
this.isAddLayer = !this.isTileMap ? false : this.isAddLayer;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* To Initialize the control rendering.
|
|
971
|
+
*
|
|
972
|
+
* @returns {void}
|
|
973
|
+
*/
|
|
974
|
+
protected render(): void {
|
|
975
|
+
this.renderElements();
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
protected processRequestJsonData(): void {
|
|
979
|
+
const length: number = this.layersCollection.length - 1;
|
|
980
|
+
this.serverProcess = { request: 0, response: 0 }; let queryModule: Query;
|
|
981
|
+
let dataModule: DataManager;
|
|
982
|
+
Array.prototype.forEach.call(this.layersCollection, (layer: LayerSettings, layerIndex: number) => {
|
|
983
|
+
if (layer.shapeData instanceof DataManager) {
|
|
984
|
+
this.serverProcess['request']++;
|
|
985
|
+
dataModule = layer.shapeData;
|
|
986
|
+
queryModule = layer.query instanceof Query ? layer.query : new Query();
|
|
987
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
988
|
+
const dataManager: Promise<any> = dataModule.executeQuery(queryModule);
|
|
989
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
990
|
+
dataManager.then((e: any) => {
|
|
991
|
+
this.processResponseJsonData('DataManager', e, layer, 'ShapeData');
|
|
992
|
+
});
|
|
993
|
+
} else if (layer.shapeData instanceof MapAjax || layer.shapeData) {
|
|
994
|
+
if (!isNullOrUndefined(layer.shapeData['dataOptions'])) {
|
|
995
|
+
this.processAjaxRequest(layer, layer.shapeData, 'ShapeData');
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
if (layer.dataSource instanceof DataManager) {
|
|
999
|
+
this.serverProcess['request']++;
|
|
1000
|
+
dataModule = layer.dataSource as DataManager;
|
|
1001
|
+
queryModule = layer.query instanceof Query ? layer.query : new Query();
|
|
1002
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1003
|
+
const dataManager: Promise<any> = dataModule.executeQuery(queryModule);
|
|
1004
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1005
|
+
dataManager.then((e: any) => {
|
|
1006
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1007
|
+
layer.dataSource = processResult(e) as any[];
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
if (layer.markerSettings.length > 0) {
|
|
1011
|
+
for (let i: number = 0; i < layer.markerSettings.length; i++) {
|
|
1012
|
+
if (layer.markerSettings[i as number].dataSource instanceof DataManager) {
|
|
1013
|
+
this.serverProcess['request']++;
|
|
1014
|
+
dataModule = layer.markerSettings[i as number].dataSource as DataManager;
|
|
1015
|
+
queryModule = layer.markerSettings[i as number].query instanceof Query ?
|
|
1016
|
+
layer.markerSettings[i as number].query : new Query();
|
|
1017
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1018
|
+
const dataManager: Promise<any> = dataModule.executeQuery(queryModule);
|
|
1019
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1020
|
+
dataManager.then((e: any) => {
|
|
1021
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1022
|
+
layer.markerSettings[i as number].dataSource = processResult(e) as any[];
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
if (layer.bubbleSettings.length > 0) {
|
|
1028
|
+
for (let i: number = 0; i < layer.bubbleSettings.length; i++) {
|
|
1029
|
+
if (layer.bubbleSettings[i as number].dataSource instanceof DataManager) {
|
|
1030
|
+
this.serverProcess['request']++;
|
|
1031
|
+
dataModule = layer.bubbleSettings[i as number].dataSource as DataManager;
|
|
1032
|
+
queryModule = layer.bubbleSettings[i as number].query instanceof Query ?
|
|
1033
|
+
layer.bubbleSettings[i as number].query : new Query();
|
|
1034
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1035
|
+
const dataManager: Promise<any> = dataModule.executeQuery(queryModule);
|
|
1036
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1037
|
+
dataManager.then((e: any) => {
|
|
1038
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1039
|
+
layer.bubbleSettings[i as number].dataSource = processResult(e) as any[];
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
if (layer.dataSource instanceof MapAjax || (!isNullOrUndefined(layer.dataSource) && !isNullOrUndefined(layer.dataSource['dataOptions']))) {
|
|
1045
|
+
this.processAjaxRequest(layer, layer.dataSource, 'DataSource');
|
|
1046
|
+
}
|
|
1047
|
+
if (this.serverProcess['request'] === this.serverProcess['response'] && length === layerIndex) {
|
|
1048
|
+
this.processResponseJsonData(null);
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1053
|
+
private processAjaxRequest(layer: LayerSettings, localAjax: MapAjax | any, type: string): void {
|
|
1054
|
+
this.serverProcess['request']++;
|
|
1055
|
+
const fetchApiModule: Fetch = new Fetch(localAjax.dataOptions, localAjax.type, localAjax.contentType);
|
|
1056
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1057
|
+
fetchApiModule.onSuccess = (args: any) => {
|
|
1058
|
+
if (!isNullOrUndefined(args.type) && args.type === 'application/octet-stream') {
|
|
1059
|
+
const reader: FileReader = new FileReader();
|
|
1060
|
+
//eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
1061
|
+
const map: Maps = this;
|
|
1062
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
1063
|
+
reader.onload = function () {
|
|
1064
|
+
args = JSON.parse(reader.result.toString());
|
|
1065
|
+
map.processResponseJsonData('Fetch', args, layer, type);
|
|
1066
|
+
};
|
|
1067
|
+
reader.readAsText(args);
|
|
1068
|
+
} else {
|
|
1069
|
+
this.processResponseJsonData('Fetch', args, layer, type);
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
fetchApiModule.send(localAjax.sendData);
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* This method is used to process the JSON data to render the maps.
|
|
1076
|
+
*
|
|
1077
|
+
* @param {string} processType - Specifies the process type in maps.
|
|
1078
|
+
* @param {any | string} data - Specifies the data for maps.
|
|
1079
|
+
* @param {LayerSettings} layer - Specifies the layer for the maps.
|
|
1080
|
+
* @param {string} dataType - Specifies the data type for maps.
|
|
1081
|
+
* @returns {void}
|
|
1082
|
+
* @private
|
|
1083
|
+
*/
|
|
1084
|
+
public processResponseJsonData(processType: string,
|
|
1085
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1086
|
+
data?: any | string, layer?: LayerSettings, dataType?: string): void {
|
|
1087
|
+
this.serverProcess['response']++;
|
|
1088
|
+
if (processType) {
|
|
1089
|
+
if (dataType === 'ShapeData') {
|
|
1090
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1091
|
+
layer.shapeData = (processType === 'DataManager') ? processResult((data as any)) : data;
|
|
1092
|
+
} else {
|
|
1093
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1094
|
+
layer.dataSource = (processType === 'DataManager') ? processResult((data as any)) : data;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
if (!isNullOrUndefined(processType) && this.serverProcess['request'] === this.serverProcess['response']) {
|
|
1098
|
+
const collection: LayerSettings[] = this.layersCollection;
|
|
1099
|
+
this.layersCollection = [];
|
|
1100
|
+
for (let i: number = 0; i < collection.length; i++) {
|
|
1101
|
+
if (collection[i as number].isBaseLayer) {
|
|
1102
|
+
this.layersCollection.push(collection[i as number]);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
for (let j: number = 0; j < collection.length; j++) {
|
|
1106
|
+
if (!collection[j as number].isBaseLayer) {
|
|
1107
|
+
this.layersCollection.push(collection[j as number]);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
this.renderMap();
|
|
1111
|
+
} else if (isNullOrUndefined(processType)) {
|
|
1112
|
+
this.renderMap();
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
private renderMap(): void {
|
|
1117
|
+
if (this.legendModule && this.legendSettings.visible) {
|
|
1118
|
+
this.legendModule.renderLegend();
|
|
1119
|
+
}
|
|
1120
|
+
this.createTile();
|
|
1121
|
+
if (this.zoomSettings.enable && this.zoomModule) {
|
|
1122
|
+
this.zoomModule.createZoomingToolbars();
|
|
1123
|
+
}
|
|
1124
|
+
if (!isNullOrUndefined(this.dataLabelModule)) {
|
|
1125
|
+
this.dataLabelModule.dataLabelCollections = [];
|
|
1126
|
+
}
|
|
1127
|
+
this.mapLayerPanel.measureLayerPanel();
|
|
1128
|
+
if (!isNullOrUndefined(this.svgObject)) {
|
|
1129
|
+
this.element.appendChild(this.svgObject);
|
|
1130
|
+
}
|
|
1131
|
+
this.setSecondaryElementPosition();
|
|
1132
|
+
for (let i: number = 0; i < this.layers.length; i++) {
|
|
1133
|
+
if (this.layers[i as number].selectionSettings && this.layers[i as number].selectionSettings.enable &&
|
|
1134
|
+
this.layers[i as number].initialShapeSelection.length > 0 && this.checkInitialRender) {
|
|
1135
|
+
const checkSelection: boolean = this.layers[i as number].selectionSettings.enableMultiSelect;
|
|
1136
|
+
this.layers[i as number].selectionSettings.enableMultiSelect = checkSelection ? checkSelection : true;
|
|
1137
|
+
const shapeSelection: InitialShapeSelectionSettingsModel[] = this.layers[i as number].initialShapeSelection;
|
|
1138
|
+
for (let j: number = 0; j < this.layers[i as number].initialShapeSelection.length; j++) {
|
|
1139
|
+
this.shapeSelection(i, shapeSelection[j as number].shapePath, shapeSelection[j as number].shapeValue, true);
|
|
1140
|
+
}
|
|
1141
|
+
this.layers[i as number].selectionSettings.enableMultiSelect = checkSelection;
|
|
1142
|
+
if (i === this.layers.length - 1) { this.checkInitialRender = false; }
|
|
1143
|
+
}
|
|
1144
|
+
if (!this.isResize) {
|
|
1145
|
+
for (let k: number = 0; k < this.layers[i as number].markerSettings.length; k++) {
|
|
1146
|
+
// eslint-disable-next-line max-len
|
|
1147
|
+
if (this.layers[i as number].markerSettings[k as number].selectionSettings && this.layers[i as number].markerSettings[k as number].selectionSettings.enable
|
|
1148
|
+
&& this.layers[i as number].markerSettings[k as number].initialMarkerSelection.length > 0) {
|
|
1149
|
+
const markerSelectionValues: InitialMarkerSelectionSettingsModel[] =
|
|
1150
|
+
this.layers[i as number].markerSettings[k as number].initialMarkerSelection;
|
|
1151
|
+
for (let j: number = 0; j < markerSelectionValues.length; j++) {
|
|
1152
|
+
this.markerInitialSelection(i, k, this.layers[i as number].markerSettings[k as number],
|
|
1153
|
+
markerSelectionValues[j as number].latitude,
|
|
1154
|
+
markerSelectionValues[j as number].longitude);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
if (!isNullOrUndefined(document.getElementById(this.element.id + '_tile_parent'))) {
|
|
1161
|
+
const svg: ClientRect = this.svgObject.getBoundingClientRect();
|
|
1162
|
+
const element: HTMLElement = document.getElementById(this.element.id);
|
|
1163
|
+
const tileElement: HTMLElement = document.getElementById(this.element.id + '_tile_parent');
|
|
1164
|
+
const tileElement1: HTMLElement = document.getElementById(this.element.id + '_tiles');
|
|
1165
|
+
const tile: ClientRect = tileElement.getBoundingClientRect();
|
|
1166
|
+
let top: number; let left: number;
|
|
1167
|
+
left = parseFloat(tileElement.style.left);
|
|
1168
|
+
const bottom: number = svg.bottom - tile.bottom - element.offsetTop;
|
|
1169
|
+
top = parseFloat(tileElement.style.top);
|
|
1170
|
+
top = (bottom <= 11) ? top : (!isNullOrUndefined(this.legendModule) && this.legendSettings.position === 'Bottom') ? this.mapAreaRect.y : (top * 2);
|
|
1171
|
+
left = (bottom <= 11) ? left : !isNullOrUndefined(this.legendModule) ? left : (left * 2);
|
|
1172
|
+
tileElement.style.top = top + 'px';
|
|
1173
|
+
tileElement.style.left = left + 'px';
|
|
1174
|
+
tileElement1.style.top = top + 'px';
|
|
1175
|
+
tileElement1.style.left = left + 'px';
|
|
1176
|
+
if (!isNullOrUndefined(this.legendModule) && this.legendModule.totalPages.length > 0) {
|
|
1177
|
+
tileElement.style.height = tileElement1.style.height = this.legendModule.legendTotalRect.height + 'px';
|
|
1178
|
+
tileElement.style.width = tileElement1.style.width = this.legendModule.legendTotalRect.width + 'px';
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
this.arrangeTemplate();
|
|
1183
|
+
|
|
1184
|
+
if (this.annotationsModule) {
|
|
1185
|
+
if (this.width !== '0px' && this.height !== '0px' && this.width !== '0%' && this.height !== '0%') {
|
|
1186
|
+
this.annotationsModule.renderAnnotationElements();
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
this.element.style.outline = 'none';
|
|
1190
|
+
this.element.style.position = 'relative';
|
|
1191
|
+
for (let i: number = 0; i < document.getElementsByTagName('path').length - 1; i++) {
|
|
1192
|
+
if (document.getElementsByTagName('path')[i as number].id.indexOf('shapeIndex') > -1) {
|
|
1193
|
+
document.getElementsByTagName('path')[i as number].style.outline = 'none';
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
this.zoomingChange();
|
|
1197
|
+
if (this.zoomModule && this.isDevice) {
|
|
1198
|
+
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.mapScaleValue, this.element.id + '_Zooming_');
|
|
1199
|
+
}
|
|
1200
|
+
if (!this.isZoomByPosition && !this.zoomNotApplied) {
|
|
1201
|
+
this.triggerZoomEvent();
|
|
1202
|
+
}
|
|
1203
|
+
this.isResize = false;
|
|
1204
|
+
}
|
|
1205
|
+
private triggerZoomEvent(): void {
|
|
1206
|
+
let loadedArgs: ILoadedEventArgs;
|
|
1207
|
+
const minMaxLatitudeLongitude: IMinMaxLatitudeLongitude = this.getMinMaxLatitudeLongitude();
|
|
1208
|
+
// eslint-disable-next-line prefer-const
|
|
1209
|
+
loadedArgs = {
|
|
1210
|
+
maps: this, isResized: this.isResize, minLatitude: minMaxLatitudeLongitude.minLatitude,
|
|
1211
|
+
maxLatitude: minMaxLatitudeLongitude.maxLatitude, minLongitude: minMaxLatitudeLongitude.minLongitude,
|
|
1212
|
+
maxLongitude: minMaxLatitudeLongitude.maxLongitude, cancel: false, name: 'Loaded'
|
|
1213
|
+
};
|
|
1214
|
+
this.trigger('loaded', loadedArgs);
|
|
1215
|
+
//eslint-enable @typescript-eslint/prefer-const
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* To apply color to the initial selected marker.
|
|
1220
|
+
*
|
|
1221
|
+
* @param {SelectionSettingsModel} selectionSettings - Specifies the selection settings
|
|
1222
|
+
* @param {Maps} map - Specifies the instance of the maps
|
|
1223
|
+
* @param {Element} targetElement - Specifies the target element
|
|
1224
|
+
* @param {object} data - Specifies the data
|
|
1225
|
+
* @returns {void}
|
|
1226
|
+
* @private
|
|
1227
|
+
*/
|
|
1228
|
+
public markerSelection(
|
|
1229
|
+
selectionSettings: SelectionSettingsModel, map: Maps, targetElement: Element,
|
|
1230
|
+
data: object
|
|
1231
|
+
): void {
|
|
1232
|
+
const border: BorderModel = {
|
|
1233
|
+
color: selectionSettings.border.color,
|
|
1234
|
+
width: selectionSettings.border.width / map.scale,
|
|
1235
|
+
opacity: selectionSettings.border.opacity
|
|
1236
|
+
};
|
|
1237
|
+
const markerSelectionProperties: object = {
|
|
1238
|
+
opacity: selectionSettings.opacity,
|
|
1239
|
+
fill: selectionSettings.fill,
|
|
1240
|
+
border: border,
|
|
1241
|
+
target: targetElement.id,
|
|
1242
|
+
cancel: false,
|
|
1243
|
+
data: data,
|
|
1244
|
+
maps: map
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1247
|
+
if (!getElement('MarkerselectionMap')) {
|
|
1248
|
+
document.body.appendChild(createStyle('MarkerselectionMap', 'MarkerselectionMapStyle', markerSelectionProperties));
|
|
1249
|
+
} else {
|
|
1250
|
+
customizeStyle('MarkerselectionMap', 'MarkerselectionMapStyle', markerSelectionProperties);
|
|
1251
|
+
}
|
|
1252
|
+
if (this.selectedMarkerElementId.length === 0 || selectionSettings.enableMultiSelect) {
|
|
1253
|
+
if (targetElement.tagName === 'g') {
|
|
1254
|
+
targetElement.children[0].setAttribute('class', 'MarkerselectionMapStyle');
|
|
1255
|
+
this.selectedMarkerElementId.push(targetElement.children[0].id);
|
|
1256
|
+
} else {
|
|
1257
|
+
targetElement.setAttribute('class', 'MarkerselectionMapStyle');
|
|
1258
|
+
this.selectedMarkerElementId.push(targetElement.id);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* initial selection of marker.
|
|
1264
|
+
*
|
|
1265
|
+
* @param {number} layerIndex - Specifies the layer index
|
|
1266
|
+
* @param {number} markerIndex - Specifies the marker index
|
|
1267
|
+
* @param {MarkerSettingsModel} markerSettings - Specifies the marker settings
|
|
1268
|
+
* @param {number} latitude - Specifies hte latitude
|
|
1269
|
+
* @param {number} longitude - Specifies the longitude
|
|
1270
|
+
* @returns {void}
|
|
1271
|
+
* @private
|
|
1272
|
+
*/
|
|
1273
|
+
public markerInitialSelection(
|
|
1274
|
+
layerIndex: number, markerIndex: number, markerSettings: MarkerSettingsModel,
|
|
1275
|
+
latitude: number, longitude: number
|
|
1276
|
+
): void {
|
|
1277
|
+
const selectionSettings: SelectionSettingsModel = markerSettings.selectionSettings;
|
|
1278
|
+
if (selectionSettings.enable) {
|
|
1279
|
+
for (let i: number = 0; i < markerSettings.dataSource['length']; i++) {
|
|
1280
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1281
|
+
const data: any = markerSettings.dataSource[i as number];
|
|
1282
|
+
if (data['latitude'] === latitude && data['longitude'] === longitude) {
|
|
1283
|
+
const targetId: string = this.element.id + '_' + 'LayerIndex_' + layerIndex + '_MarkerIndex_' + markerIndex +
|
|
1284
|
+
'_dataIndex_' + i;
|
|
1285
|
+
this.markerSelection(selectionSettings, this, getElement(targetId), data);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Render the map area border.
|
|
1293
|
+
*
|
|
1294
|
+
* @returns {void}
|
|
1295
|
+
*/
|
|
1296
|
+
private renderArea(): void {
|
|
1297
|
+
const width: number = this.mapsArea.border.width;
|
|
1298
|
+
const background: string = this.mapsArea.background;
|
|
1299
|
+
if (width > 0 || (background || this.themeStyle.areaBackgroundColor)) {
|
|
1300
|
+
const mapBorder: BorderModel = {
|
|
1301
|
+
opacity: isNullOrUndefined(this.mapsArea.border.opacity) ? 1 : this.mapsArea.border.opacity,
|
|
1302
|
+
color: this.mapsArea.border.color, width: this.mapsArea.border.width
|
|
1303
|
+
};
|
|
1304
|
+
const rect: RectOption = new RectOption(
|
|
1305
|
+
this.element.id + '_MapAreaBorder', background || this.themeStyle.areaBackgroundColor,
|
|
1306
|
+
mapBorder, 1, this.mapAreaRect
|
|
1307
|
+
);
|
|
1308
|
+
this.svgObject.appendChild(this.renderer.drawRectangle(rect) as SVGRectElement);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* To add tab index for map element.
|
|
1313
|
+
*
|
|
1314
|
+
* @returns {void}
|
|
1315
|
+
*/
|
|
1316
|
+
private addTabIndex(): void {
|
|
1317
|
+
this.element.setAttribute('aria-label', this.description || 'Maps Element');
|
|
1318
|
+
this.element.setAttribute('role', 'region');
|
|
1319
|
+
this.element.tabIndex = this.tabIndex;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
private setSecondaryElementPosition(): void {
|
|
1323
|
+
const element: HTMLDivElement = getElementByID(this.element.id + '_Secondary_Element') as HTMLDivElement;
|
|
1324
|
+
const rect: ClientRect = this.element.getBoundingClientRect();
|
|
1325
|
+
const svgElement: Element = getElementByID(this.element.id + '_svg');
|
|
1326
|
+
if (!isNullOrUndefined(svgElement)) {
|
|
1327
|
+
const svgRect: ClientRect = svgElement.getBoundingClientRect();
|
|
1328
|
+
element.style.left = Math.max(svgRect.left - rect.left, 0) + 'px';
|
|
1329
|
+
element.style.top = Math.max(svgRect.top - rect.top, 0) + 'px';
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
private zoomingChange(): void {
|
|
1334
|
+
let left: number; let top: number;
|
|
1335
|
+
if (getElementByID(this.element.id + '_Layer_Collections') && this.zoomModule) {
|
|
1336
|
+
this.zoomModule.layerCollectionEle = getElementByID(this.element.id + '_Layer_Collections');
|
|
1337
|
+
}
|
|
1338
|
+
if (this.isTileMap && getElementByID(this.element.id + '_Tile_SVG') && getElementByID(this.element.id + '_tile_parent')) {
|
|
1339
|
+
const tileElement: Element = getElementByID(this.element.id + '_tile_parent');
|
|
1340
|
+
const tileSvgElement: Element = getElementByID(this.element.id + '_Tile_SVG');
|
|
1341
|
+
const tileSvgParentElement: Element = getElementByID(this.element.id + '_Tile_SVG_Parent');
|
|
1342
|
+
const tileRect: ClientRect = tileElement.getBoundingClientRect();
|
|
1343
|
+
const tileSvgRect: ClientRect = tileSvgElement.getBoundingClientRect();
|
|
1344
|
+
left = (tileRect.left - tileSvgRect.left);
|
|
1345
|
+
top = (tileRect.top - tileSvgRect.top);
|
|
1346
|
+
(tileSvgParentElement as HTMLElement).style.left = left + 'px';
|
|
1347
|
+
(tileSvgParentElement as HTMLElement).style.top = top + 'px';
|
|
1348
|
+
if (!isNullOrUndefined(this.legendModule) && this.legendModule.totalPages.length > 0) {
|
|
1349
|
+
(tileElement as HTMLElement).style.width = (tileSvgElement as HTMLElement).style.width =
|
|
1350
|
+
this.legendModule.legendTotalRect.width.toString();
|
|
1351
|
+
(tileElement as HTMLElement).style.height = (tileSvgElement as HTMLElement).style.height =
|
|
1352
|
+
this.legendModule.legendTotalRect.height.toString();
|
|
1353
|
+
(tileSvgParentElement as HTMLElement).style.width = this.legendModule.legendTotalRect.width + 'px';
|
|
1354
|
+
(tileSvgParentElement as HTMLElement).style.height = this.legendModule.legendTotalRect.height + 'px';
|
|
1355
|
+
}
|
|
1356
|
+
const markerTemplateElements: HTMLCollectionOf<Element> = document.getElementsByClassName('template');
|
|
1357
|
+
if (!isNullOrUndefined(markerTemplateElements) && markerTemplateElements.length > 0) {
|
|
1358
|
+
for (let i: number = 0; i < markerTemplateElements.length; i++) {
|
|
1359
|
+
const templateGroupEle: HTMLElement = markerTemplateElements[i as number] as HTMLElement;
|
|
1360
|
+
templateGroupEle.style.left = left + 'px';
|
|
1361
|
+
templateGroupEle.style.top = top + 'px';
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
if (this.zoomSettings.zoomFactor >= 0) {
|
|
1366
|
+
if (this.zoomModule && this.zoomModule.toolBarGroup && this.zoomSettings.enable) {
|
|
1367
|
+
this.zoomModule.alignToolBar();
|
|
1368
|
+
}
|
|
1369
|
+
const elements: Element = document.getElementById(this.element.id + '_Layer_Collections');
|
|
1370
|
+
if (!isNullOrUndefined(elements) && elements.childElementCount > 0) {
|
|
1371
|
+
for (let i: number = 0; i < elements.childNodes.length; i++) {
|
|
1372
|
+
const childElement: SVGAElement = elements.childNodes[i as number] as SVGAElement;
|
|
1373
|
+
if (childElement.tagName === 'g' && childElement.id.indexOf('_Legend_Group') === -1) {
|
|
1374
|
+
const layerIndex: number = parseFloat(childElement.id.split('_LayerIndex_')[1].split('_')[0]);
|
|
1375
|
+
for (let j: number = 0; j < childElement.childNodes.length; j++) {
|
|
1376
|
+
const childNode: Element = <Element>childElement.childNodes[j as number];
|
|
1377
|
+
if (!(childNode.id.indexOf('_Markers_Group') > -1) &&
|
|
1378
|
+
(!(childNode.id.indexOf('_bubble_Group') > -1)) &&
|
|
1379
|
+
(!(childNode.id.indexOf('_dataLableIndex_Group') > -1))) {
|
|
1380
|
+
changeBorderWidth(childNode, layerIndex, this.scale, this);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
if (this.zoomModule && ((this.previousScale !== this.scale) || this.zoomNotApplied || this.isZoomByPosition)) {
|
|
1387
|
+
this.zoomModule.applyTransform(this, false, true);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
private createSecondaryElement(): void {
|
|
1393
|
+
if (isNullOrUndefined(document.getElementById(this.element.id + '_Secondary_Element'))) {
|
|
1394
|
+
const secondaryElement: Element = createElement('div', {
|
|
1395
|
+
id: this.element.id + '_Secondary_Element'
|
|
1396
|
+
});
|
|
1397
|
+
(secondaryElement as HTMLElement).style.cssText = 'position: relative;z-index:2;';
|
|
1398
|
+
this.element.appendChild(secondaryElement);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
/**
|
|
1403
|
+
* @returns {void}
|
|
1404
|
+
*/
|
|
1405
|
+
public getMinMaxLatitudeLongitude(): IMinMaxLatitudeLongitude {
|
|
1406
|
+
const mapsElement: HTMLElement = document.getElementById(this.element.id);
|
|
1407
|
+
if (!isNullOrUndefined(mapsElement)) {
|
|
1408
|
+
const element: ClientRect = mapsElement.getBoundingClientRect();
|
|
1409
|
+
const marginLeft: number = getProcessedMarginValue(this.margin.left);
|
|
1410
|
+
const minPosition: GeoPosition = this.isTileMap ?
|
|
1411
|
+
this.pointToLatLong((this.mapAreaRect.x - marginLeft), - this.mapAreaRect.y) :
|
|
1412
|
+
this.getGeoLocation(0, (this.mapAreaRect.x + element.left), this.mapAreaRect.y);
|
|
1413
|
+
const maxPosition: GeoPosition = this.isTileMap ? this.pointToLatLong(this.mapAreaRect.width,
|
|
1414
|
+
(this.mapAreaRect.height - this.mapAreaRect.y)) :
|
|
1415
|
+
this.getGeoLocation(0, (this.mapAreaRect.x + element.left + this.mapAreaRect.width),
|
|
1416
|
+
(this.mapAreaRect.y + this.mapAreaRect.height));
|
|
1417
|
+
const MinMaxLatitudeLongitude: IMinMaxLatitudeLongitude = {
|
|
1418
|
+
minLatitude: minPosition.latitude, maxLatitude: maxPosition.latitude, minLongitude: minPosition.longitude,
|
|
1419
|
+
maxLongitude: maxPosition.longitude
|
|
1420
|
+
};
|
|
1421
|
+
return MinMaxLatitudeLongitude;
|
|
1422
|
+
} else {
|
|
1423
|
+
return { minLatitude: 0, maxLatitude: 0, minLongitude: 0,
|
|
1424
|
+
maxLongitude: 0 };
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* @returns {void}
|
|
1429
|
+
* @private
|
|
1430
|
+
*/
|
|
1431
|
+
public arrangeTemplate(): void {
|
|
1432
|
+
if (document.getElementById(this.element.id + '_Legend_Border')) {
|
|
1433
|
+
document.getElementById(this.element.id + '_Legend_Border').style.pointerEvents = 'none';
|
|
1434
|
+
}
|
|
1435
|
+
const templateElements: HTMLCollectionOf<Element> = document.getElementsByClassName(this.element.id + '_template');
|
|
1436
|
+
if (!isNullOrUndefined(templateElements) && templateElements.length > 0 &&
|
|
1437
|
+
getElementByID(this.element.id + '_Layer_Collections') && !this.isTileMap) {
|
|
1438
|
+
Array.prototype.forEach.call(templateElements, (templateGroupEle: Element) => {
|
|
1439
|
+
let offSetLetValue: number = 0;
|
|
1440
|
+
let offSetTopValue: number = 0;
|
|
1441
|
+
if (!isNullOrUndefined(templateGroupEle) && templateGroupEle.childElementCount > 0) {
|
|
1442
|
+
const layerOffset: ClientRect = getElementByID(this.element.id + '_Layer_Collections').getBoundingClientRect();
|
|
1443
|
+
const elementOffset: ClientRect = getElementByID(templateGroupEle.id).getBoundingClientRect();
|
|
1444
|
+
if (templateGroupEle.id.indexOf('Marker') === -1) {
|
|
1445
|
+
offSetLetValue = this.isTileMap ? 0 : (layerOffset.left < elementOffset.left) ?
|
|
1446
|
+
-(Math.abs(elementOffset.left - layerOffset.left)) : (Math.abs(elementOffset.left - layerOffset.left));
|
|
1447
|
+
offSetTopValue = this.isTileMap ? 0 : (layerOffset.top < elementOffset.top) ?
|
|
1448
|
+
- (Math.abs(elementOffset.top - layerOffset.top)) : Math.abs(elementOffset.top - layerOffset.top);
|
|
1449
|
+
}
|
|
1450
|
+
Array.prototype.forEach.call(templateGroupEle.childNodes, (currentTemplate: HTMLElement) => {
|
|
1451
|
+
if (currentTemplate.id.indexOf('Marker') === -1) {
|
|
1452
|
+
currentTemplate.style.left = parseFloat(currentTemplate.style.left) + offSetLetValue + 'px';
|
|
1453
|
+
currentTemplate.style.top = parseFloat(currentTemplate.style.top) + offSetTopValue + 'px';
|
|
1454
|
+
currentTemplate.style.transform = 'translate(-50%, -50%)';
|
|
1455
|
+
}
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
private createTile(): void {
|
|
1463
|
+
const mainLayer: LayerSettings = this.layersCollection[0];
|
|
1464
|
+
const padding: number = 0;
|
|
1465
|
+
if (mainLayer.isBaseLayer && (!isNullOrUndefined(mainLayer.urlTemplate) && mainLayer.urlTemplate !== '' && isNullOrUndefined(mainLayer.shapeData))) {
|
|
1466
|
+
removeElement(this.element.id + '_tile_parent');
|
|
1467
|
+
removeElement(this.element.id + '_tiles');
|
|
1468
|
+
removeElement('animated_tiles');
|
|
1469
|
+
const ele: Element = createElement('div', {
|
|
1470
|
+
id: this.element.id + '_tile_parent'
|
|
1471
|
+
});
|
|
1472
|
+
const marginRight: number = getProcessedMarginValue(this.margin.right);
|
|
1473
|
+
(ele as HTMLElement).style.cssText = 'position: absolute; left: ' +
|
|
1474
|
+
(this.mapAreaRect.x) + 'px; right: ' + (marginRight) + 'px; top: '
|
|
1475
|
+
+ (this.mapAreaRect.y + padding) + 'px; height: ' +
|
|
1476
|
+
(this.mapAreaRect.height) + 'px; width: '
|
|
1477
|
+
+ (this.mapAreaRect.width) + 'px; overflow: hidden;';
|
|
1478
|
+
const ele1: Element = createElement('div', {
|
|
1479
|
+
id: this.element.id + '_tiles'
|
|
1480
|
+
});
|
|
1481
|
+
(ele1 as HTMLElement).style.cssText = 'position: absolute; left: ' +
|
|
1482
|
+
(this.mapAreaRect.x) + 'px; right: ' + (marginRight) + 'px; top: '
|
|
1483
|
+
+ (this.mapAreaRect.y + padding) + 'px; height: ' + (this.mapAreaRect.height) + 'px; width: '
|
|
1484
|
+
+ (this.mapAreaRect.width) + 'px; overflow: hidden;';
|
|
1485
|
+
this.element.appendChild(ele);
|
|
1486
|
+
this.element.appendChild(ele1);
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* To initilize the private varibales of maps.
|
|
1493
|
+
*
|
|
1494
|
+
* @returns {void}
|
|
1495
|
+
*/
|
|
1496
|
+
private initPrivateVariable(): void {
|
|
1497
|
+
if (this.element.id === '') {
|
|
1498
|
+
const collection: number = document.getElementsByClassName('e-maps').length;
|
|
1499
|
+
this.element.id = 'maps_control_' + collection;
|
|
1500
|
+
}
|
|
1501
|
+
this.renderer = new SvgRenderer(this.element.id);
|
|
1502
|
+
this.mapLayerPanel = new LayerPanel(this);
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
private findBaseAndSubLayers(): void {
|
|
1506
|
+
const baseIndex: number = this.baseLayerIndex;
|
|
1507
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1508
|
+
const mainLayers: any[] = []; const subLayers: any[] = [];
|
|
1509
|
+
this.layersCollection = [];
|
|
1510
|
+
Array.prototype.forEach.call(this.layers, (layer: LayerSettingsModel) => {
|
|
1511
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
1512
|
+
(layer.type === 'Layer') ? mainLayers.push(layer) : subLayers.push(layer);
|
|
1513
|
+
});
|
|
1514
|
+
for (let i: number = 0; i < mainLayers.length; i++) {
|
|
1515
|
+
const baseLayer: LayerSettings = <LayerSettings>mainLayers[i as number];
|
|
1516
|
+
if (baseLayer.visible && baseIndex === i) {
|
|
1517
|
+
baseLayer.isBaseLayer = true;
|
|
1518
|
+
this.isTileMap = !isNullOrUndefined(baseLayer.shapeData) ? false : true;
|
|
1519
|
+
this.layersCollection.push(baseLayer);
|
|
1520
|
+
break;
|
|
1521
|
+
} else if (i === mainLayers.length - 1) {
|
|
1522
|
+
this.layersCollection.push(<LayerSettings>mainLayers[0]);
|
|
1523
|
+
break;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
subLayers.map((subLayer: LayerSettings) => {
|
|
1527
|
+
if (subLayer.visible) {
|
|
1528
|
+
this.layersCollection.push(subLayer);
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
/**
|
|
1534
|
+
* Render the map border.
|
|
1535
|
+
*
|
|
1536
|
+
* @private
|
|
1537
|
+
* @returns {void}
|
|
1538
|
+
*/
|
|
1539
|
+
private renderBorder(): void {
|
|
1540
|
+
const width: number = this.border.width;
|
|
1541
|
+
const borderElement: Element = this.svgObject.querySelector('#' + this.element.id + '_MapBorder');
|
|
1542
|
+
if ((width > 0 || (this.background || this.themeStyle.backgroundColor)) && isNullOrUndefined(borderElement)) {
|
|
1543
|
+
const border: BorderModel = {
|
|
1544
|
+
opacity: isNullOrUndefined(this.border.opacity) ? 1 : this.border.opacity,
|
|
1545
|
+
color: this.border.color, width: this.border.width
|
|
1546
|
+
};
|
|
1547
|
+
const borderRect: RectOption = new RectOption(
|
|
1548
|
+
this.element.id + '_MapBorder', this.background || this.themeStyle.backgroundColor, border, 1,
|
|
1549
|
+
new Rect(width / 2, width / 2, this.availableSize.width - width, this.availableSize.height - width));
|
|
1550
|
+
this.svgObject.appendChild(this.renderer.drawRectangle(borderRect) as SVGRectElement);
|
|
1551
|
+
} else {
|
|
1552
|
+
borderElement.setAttribute('fill', this.background || this.themeStyle.backgroundColor);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* Render the title and subtitle.
|
|
1558
|
+
*
|
|
1559
|
+
* @param {TitleSettingsModel} title - Specifies the title
|
|
1560
|
+
* @param {string} type - Specifies the type
|
|
1561
|
+
* @param {Rect} bounds - Specifies the bounds
|
|
1562
|
+
* @param {Element} groupEle - Specifies the group element
|
|
1563
|
+
* @returns {void}
|
|
1564
|
+
* @private
|
|
1565
|
+
*/
|
|
1566
|
+
private renderTitle(title: TitleSettingsModel, type: string, bounds: Rect, groupEle: Element): void {
|
|
1567
|
+
const style: FontModel = {
|
|
1568
|
+
size: title.textStyle.size,
|
|
1569
|
+
color: title.textStyle.color,
|
|
1570
|
+
fontFamily: title.textStyle.fontFamily,
|
|
1571
|
+
fontWeight: title.textStyle.fontWeight,
|
|
1572
|
+
fontStyle: title.textStyle.fontStyle,
|
|
1573
|
+
opacity: title.textStyle.opacity
|
|
1574
|
+
};
|
|
1575
|
+
let height: number;
|
|
1576
|
+
const marginTop: number = getProcessedMarginValue(this.margin.top);
|
|
1577
|
+
const marginBottom: number = getProcessedMarginValue(this.margin.bottom);
|
|
1578
|
+
const marginLeft: number = getProcessedMarginValue(this.margin.left);
|
|
1579
|
+
const marginRight: number = getProcessedMarginValue(this.margin.right);
|
|
1580
|
+
const width: number = Math.abs((marginLeft + marginRight) - this.availableSize.width);
|
|
1581
|
+
style.fontFamily = !isNullOrUndefined(style.fontFamily) ? style.fontFamily : this.themeStyle.fontFamily;
|
|
1582
|
+
style.fontWeight = type === 'title' ? style.fontWeight || this.themeStyle.titleFontWeight : style.fontWeight || this.themeStyle.titleFontWeight;
|
|
1583
|
+
style.size = type === 'title' ? (style.size || this.themeStyle.titleFontSize) : (style.size || this.themeStyle.subTitleFontSize || Theme.mapsSubTitleFont.size);
|
|
1584
|
+
if (title.text) {
|
|
1585
|
+
if (isNullOrUndefined(groupEle)) {
|
|
1586
|
+
groupEle = this.renderer.createGroup({ id: this.element.id + '_Title_Group' });
|
|
1587
|
+
}
|
|
1588
|
+
const trimmedTitle: string = textTrim(width, title.text, style);
|
|
1589
|
+
const elementSize: Size = measureText(trimmedTitle, style);
|
|
1590
|
+
const rect: Rect = (isNullOrUndefined(bounds)) ? new Rect(
|
|
1591
|
+
marginLeft, marginTop, this.availableSize.width, this.availableSize.height) : bounds;
|
|
1592
|
+
const location: Point = findPosition(rect, !isNullOrUndefined(title.alignment) ? title.alignment : 'Center', elementSize, type);
|
|
1593
|
+
const options: TextOption = new TextOption(
|
|
1594
|
+
this.element.id + '_Map_' + type, location.x, location.y, 'start', trimmedTitle
|
|
1595
|
+
);
|
|
1596
|
+
const titleBounds: Rect = new Rect(location.x, location.y, elementSize.width, elementSize.height);
|
|
1597
|
+
const element: Element = renderTextElement(
|
|
1598
|
+
options, style, style.color || (type === 'title' ? this.themeStyle.titleFontColor : this.themeStyle.subTitleFontColor),
|
|
1599
|
+
groupEle
|
|
1600
|
+
);
|
|
1601
|
+
element.setAttribute('aria-label', title.text);
|
|
1602
|
+
element.setAttribute('role', 'region');
|
|
1603
|
+
if ((type === 'title' && !title.subtitleSettings.text) || (type === 'subtitle')) {
|
|
1604
|
+
height = Math.abs((titleBounds.y + marginBottom) - this.availableSize.height);
|
|
1605
|
+
this.mapAreaRect = new Rect(marginLeft, titleBounds.y + 10, width, height - 10);
|
|
1606
|
+
}
|
|
1607
|
+
if (type !== 'subtitle' && title.subtitleSettings.text) {
|
|
1608
|
+
this.renderTitle(title.subtitleSettings, 'subtitle', titleBounds, groupEle);
|
|
1609
|
+
} else {
|
|
1610
|
+
this.svgObject.appendChild(groupEle);
|
|
1611
|
+
}
|
|
1612
|
+
} else {
|
|
1613
|
+
height = Math.abs((marginTop + marginBottom) - this.availableSize.height);
|
|
1614
|
+
this.mapAreaRect = new Rect(marginLeft, marginTop, width, height);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
/**
|
|
1619
|
+
* To create svg element for maps.
|
|
1620
|
+
*
|
|
1621
|
+
* @returns {void}
|
|
1622
|
+
*/
|
|
1623
|
+
private createSVG(): void {
|
|
1624
|
+
this.removeSvg();
|
|
1625
|
+
createSvg(this);
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* To Remove the SVG.
|
|
1629
|
+
*
|
|
1630
|
+
* @returns {void}
|
|
1631
|
+
*/
|
|
1632
|
+
private removeSvg(): void {
|
|
1633
|
+
removeElement(this.element.id + '_Secondary_Element');
|
|
1634
|
+
removeElement(this.element.id + '_tile_parent');
|
|
1635
|
+
removeElement(this.element.id + '_tiles');
|
|
1636
|
+
if (this.svgObject) {
|
|
1637
|
+
while (this.svgObject.childNodes.length > 0) {
|
|
1638
|
+
this.svgObject.removeChild(this.svgObject.firstChild);
|
|
1639
|
+
}
|
|
1640
|
+
if (!this.svgObject.hasChildNodes() && this.svgObject.parentNode) {
|
|
1641
|
+
remove(this.svgObject);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
this.clearTemplate();
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* To bind event handlers for maps.
|
|
1648
|
+
*
|
|
1649
|
+
* @returns {void}
|
|
1650
|
+
*/
|
|
1651
|
+
private wireEVents(): void {
|
|
1652
|
+
//let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
|
|
1653
|
+
EventHandler.add(this.element, 'click', this.mapsOnClick, this);
|
|
1654
|
+
EventHandler.add(this.element, 'contextmenu', this.mapsOnRightClick, this);
|
|
1655
|
+
EventHandler.add(this.element, 'dblclick', this.mapsOnDoubleClick, this);
|
|
1656
|
+
EventHandler.add(this.element, Browser.touchStartEvent, this.mouseDownOnMap, this);
|
|
1657
|
+
EventHandler.add(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap, this);
|
|
1658
|
+
EventHandler.add(this.element, Browser.touchEndEvent, this.mouseEndOnMap, this);
|
|
1659
|
+
EventHandler.add(this.element, 'pointerleave mouseleave', this.mouseLeaveOnMap, this);
|
|
1660
|
+
EventHandler.add(this.element, 'keydown', this.keyDownHandler, this);
|
|
1661
|
+
EventHandler.add(this.element, 'keyup', this.keyUpHandler, this);
|
|
1662
|
+
// EventHandler.add(this.element, cancelEvent, this.mouseLeaveOnMap, this);
|
|
1663
|
+
this.resizeEvent = this.mapsOnResize.bind(this);
|
|
1664
|
+
window.addEventListener(
|
|
1665
|
+
(Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize',
|
|
1666
|
+
this.resizeEvent
|
|
1667
|
+
);
|
|
1668
|
+
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
/**
|
|
1672
|
+
* To unbind event handlers from maps.
|
|
1673
|
+
*
|
|
1674
|
+
* @returns {void}
|
|
1675
|
+
*/
|
|
1676
|
+
private unWireEVents(): void {
|
|
1677
|
+
//let cancelEvent: string = Browser.isPointer ? 'pointerleave' : 'mouseleave';
|
|
1678
|
+
EventHandler.remove(this.element, 'click', this.mapsOnClick);
|
|
1679
|
+
EventHandler.remove(this.element, 'contextmenu', this.mapsOnRightClick);
|
|
1680
|
+
EventHandler.remove(this.element, 'dblclick', this.mapsOnDoubleClick);
|
|
1681
|
+
EventHandler.remove(this.element, Browser.touchStartEvent, this.mouseDownOnMap);
|
|
1682
|
+
EventHandler.remove(this.element, Browser.touchMoveEvent, this.mouseMoveOnMap);
|
|
1683
|
+
EventHandler.remove(this.element, Browser.touchEndEvent, this.mouseEndOnMap);
|
|
1684
|
+
EventHandler.remove(this.element, 'pointerleave mouseleave', this.mouseLeaveOnMap);
|
|
1685
|
+
EventHandler.remove(this.element, 'keydown', this.keyDownHandler);
|
|
1686
|
+
EventHandler.remove(this.element, 'keyup', this.keyUpHandler);
|
|
1687
|
+
//EventHandler.remove(this.element, cancelEvent, this.mouseLeaveOnMap);
|
|
1688
|
+
window.removeEventListener(
|
|
1689
|
+
(Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize',
|
|
1690
|
+
this.resizeEvent
|
|
1691
|
+
);
|
|
1692
|
+
}
|
|
1693
|
+
/**
|
|
1694
|
+
* This method is used to perform operations when mouse pointer leave from maps.
|
|
1695
|
+
*
|
|
1696
|
+
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
1697
|
+
* @returns {void}
|
|
1698
|
+
* @private
|
|
1699
|
+
*/
|
|
1700
|
+
//eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1701
|
+
public mouseLeaveOnMap(e: PointerEvent): void {
|
|
1702
|
+
if (document.getElementsByClassName('highlightMapStyle').length > 0 && this.legendModule) {
|
|
1703
|
+
this.legendModule.removeShapeHighlightCollection();
|
|
1704
|
+
removeClass(document.getElementsByClassName('highlightMapStyle')[0]);
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* This method is used to perform operations when keyboard key from maps.
|
|
1709
|
+
*
|
|
1710
|
+
* @param {KeyboardEvent} event - Specifies the keyboard event on maps.
|
|
1711
|
+
* @returns {void}
|
|
1712
|
+
* @private
|
|
1713
|
+
*/
|
|
1714
|
+
public keyUpHandler(event: KeyboardEvent): void {
|
|
1715
|
+
const id: string = event.target['id'];
|
|
1716
|
+
if (this.isTileMap) {
|
|
1717
|
+
this.removeTileMap();
|
|
1718
|
+
}
|
|
1719
|
+
if (event.code === 'Tab' && id.indexOf('_LayerIndex_') > -1 && id.indexOf('shapeIndex') > -1) {
|
|
1720
|
+
this.keyboardHighlightSelection(id, event);
|
|
1721
|
+
} else if (id.indexOf('_LayerIndex_') === -1 && id.indexOf('shapeIndex') === -1 &&
|
|
1722
|
+
getElementsByClassName('highlightMapStyle').length > 0) {
|
|
1723
|
+
removeClass(<Element>getElementsByClassName('highlightMapStyle')[0]);
|
|
1724
|
+
if (this.legendSettings.visible && this.legendModule) {
|
|
1725
|
+
this.legendModule.removeShapeHighlightCollection();
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
private keyboardHighlightSelection(id: string, event: KeyboardEvent): void {
|
|
1731
|
+
const key: string = event.type;
|
|
1732
|
+
const layerIndex: number = parseInt(id.split('_LayerIndex_')[1].split('_')[0], 10);
|
|
1733
|
+
const shapeIndex: number = parseInt(id.split('_shapeIndex_')[1].split('_')[0], 10);
|
|
1734
|
+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1735
|
+
const shapeData: any = this.layers[layerIndex as number].shapeData['features']['length'] > shapeIndex ?
|
|
1736
|
+
this.layers[layerIndex as number].shapeData['features'][shapeIndex as number]['properties'] : null;
|
|
1737
|
+
const dataIndex: number = parseInt(id.split('_dataIndex_')[1].split('_')[0], 10);
|
|
1738
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1739
|
+
const data: any = isNullOrUndefined(dataIndex) ? null : this.layers[layerIndex as number].dataSource[dataIndex as number];
|
|
1740
|
+
if (this.layers[layerIndex as number].selectionSettings.enable && key === 'keydown' && this.selectionModule) {
|
|
1741
|
+
this.selectionModule.selectionsettings = this.layers[layerIndex as number].selectionSettings;
|
|
1742
|
+
this.selectionModule.selectionType = 'Shape';
|
|
1743
|
+
this.selectionModule.selectElement(<Element>event.target, layerIndex, data, shapeData);
|
|
1744
|
+
} else if (this.highlightModule && (this.layers[layerIndex as number].highlightSettings.enable && key === 'keyup' &&
|
|
1745
|
+
!(event.target as HTMLElement).classList.contains('ShapeselectionMapStyle'))) {
|
|
1746
|
+
this.highlightModule.highlightSettings = this.layers[layerIndex as number].highlightSettings;
|
|
1747
|
+
this.highlightModule.handleHighlight(<Element>event.target, layerIndex, data, shapeData);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
/**
|
|
1751
|
+
* This method is used to perform operations when keyboard down from maps.
|
|
1752
|
+
*
|
|
1753
|
+
* @param {KeyboardEvent} event - Specifies the keyboard event on maps.
|
|
1754
|
+
* @returns {void}
|
|
1755
|
+
* @private
|
|
1756
|
+
*/
|
|
1757
|
+
public keyDownHandler(event: KeyboardEvent): void {
|
|
1758
|
+
const zoom: Zoom = this.zoomModule;
|
|
1759
|
+
let id: string = event.target['id'];
|
|
1760
|
+
if ((event.code === 'ArrowUp' || event.code === 'ArrowDown' || event.code === 'ArrowLeft'
|
|
1761
|
+
|| event.code === 'ArrowRight') && zoom) {
|
|
1762
|
+
const animatedTiles: HTMLElement = document.getElementById(this.element.id + '_animated_tiles');
|
|
1763
|
+
if (this.isTileMap && !isNullOrUndefined(animatedTiles)) {
|
|
1764
|
+
this.currentTiles = (animatedTiles.cloneNode(true) as HTMLElement);
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
if (this.zoomSettings.enable && zoom && (event.key === '+' || event.code === 'Equal')) {
|
|
1768
|
+
zoom.performZoomingByToolBar('zoomin');
|
|
1769
|
+
} else if (this.zoomSettings.enable && zoom && (event.key === '-' || event.code === 'Minus')) {
|
|
1770
|
+
zoom.performZoomingByToolBar('zoomout');
|
|
1771
|
+
} else if (this.zoomSettings.enable && zoom && event['keyCode'] === 82) {
|
|
1772
|
+
zoom.performZoomingByToolBar('reset');
|
|
1773
|
+
zoom.isPanModeEnabled = false;
|
|
1774
|
+
} else if (this.zoomSettings.enable && this.zoomSettings.enablePanning && zoom
|
|
1775
|
+
&& (event.code === 'ArrowUp' || event.code === 'ArrowDown')) {
|
|
1776
|
+
event.preventDefault();
|
|
1777
|
+
zoom.mouseDownLatLong['x'] = 0;
|
|
1778
|
+
zoom.mouseMoveLatLong['y'] = this.mapAreaRect.height / 7;
|
|
1779
|
+
zoom.panning('None', zoom.mouseDownLatLong['x'], event.code === 'ArrowUp' ? -(zoom.mouseMoveLatLong['y']) :
|
|
1780
|
+
zoom.mouseMoveLatLong['y'], event);
|
|
1781
|
+
zoom.mouseDownLatLong['y'] = zoom.mouseMoveLatLong['y'];
|
|
1782
|
+
} else if (this.zoomSettings.enable && this.zoomSettings.enablePanning && zoom
|
|
1783
|
+
&& (event.code === 'ArrowLeft' || event.code === 'ArrowRight')) {
|
|
1784
|
+
event.preventDefault();
|
|
1785
|
+
zoom.mouseDownLatLong['y'] = 0;
|
|
1786
|
+
zoom.mouseMoveLatLong['x'] = this.mapAreaRect.width / 7;
|
|
1787
|
+
zoom.panning('None', event.code === 'ArrowLeft' ? -(zoom.mouseMoveLatLong['x']) : zoom.mouseMoveLatLong['x'],
|
|
1788
|
+
zoom.mouseDownLatLong['y'], event);
|
|
1789
|
+
zoom.mouseDownLatLong['x'] = zoom.mouseMoveLatLong['x'];
|
|
1790
|
+
} else if (event.code === 'Enter') {
|
|
1791
|
+
id = event.target['id'];
|
|
1792
|
+
event.preventDefault();
|
|
1793
|
+
if (this.legendModule && (id.indexOf('_Left_Page_Rect') > -1 || id.indexOf('_Right_Page_Rect') > -1)) {
|
|
1794
|
+
this.mapAreaRect = this.legendModule.initialMapAreaRect;
|
|
1795
|
+
this.legendModule.currentPage = (id.indexOf('_Left_Page_') > -1) ? (this.legendModule.currentPage - 1) :
|
|
1796
|
+
(this.legendModule.currentPage + 1);
|
|
1797
|
+
this.legendModule.legendGroup = this.renderer.createGroup({ id: this.element.id + '_Legend_Group' });
|
|
1798
|
+
this.legendModule.drawLegendItem(this.legendModule.currentPage);
|
|
1799
|
+
const textContent: string = (document.getElementById(this.element.id + '_Paging_Text')).textContent;
|
|
1800
|
+
const text: number[] = textContent.split('/').map(Number);
|
|
1801
|
+
if (id.indexOf('_Left_Page_Rect') > -1) {
|
|
1802
|
+
if (text[0] !== 1) {
|
|
1803
|
+
(event.target as HTMLElement).focus();
|
|
1804
|
+
}
|
|
1805
|
+
(event.target as HTMLElement).style.outlineColor = text[0] - 1 !== text[1] ? '' : 'transparent';
|
|
1806
|
+
} else if (id.indexOf('_Right_Page_Rect') > -1) {
|
|
1807
|
+
if (text[0] !== text[1]) {
|
|
1808
|
+
(event.target as HTMLElement).focus();
|
|
1809
|
+
}
|
|
1810
|
+
(event.target as HTMLElement).style.outlineColor = text[0] !== text[1] + 1 ? '' : 'transparent';
|
|
1811
|
+
}
|
|
1812
|
+
if (querySelector(this.element.id + '_Legend_Border', this.element.id)) {
|
|
1813
|
+
(<HTMLElement>querySelector(this.element.id + '_Legend_Border', this.element.id)).style.pointerEvents = 'none';
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
if (id.indexOf('shapeIndex') > -1) {
|
|
1817
|
+
this.keyboardHighlightSelection(id, event);
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
if (this.zoomModule) {
|
|
1821
|
+
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.mapScaleValue, this.mouseMoveId);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
/**
|
|
1826
|
+
* Gets the selected element to be maintained or not.
|
|
1827
|
+
*
|
|
1828
|
+
* @param {Element} targetEle - Specifies the target element
|
|
1829
|
+
* @returns {boolean} - Returns the boolean value
|
|
1830
|
+
* @private
|
|
1831
|
+
*/
|
|
1832
|
+
public SelectedElement(targetEle: Element): boolean {
|
|
1833
|
+
let isSelect: boolean = false;
|
|
1834
|
+
if (targetEle.getAttribute('class') === 'ShapeselectionMapStyle') {
|
|
1835
|
+
isSelect = true;
|
|
1836
|
+
}
|
|
1837
|
+
return isSelect;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
/**
|
|
1841
|
+
* This method is used to perform the operations when a click operation is performed on maps.
|
|
1842
|
+
*
|
|
1843
|
+
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
1844
|
+
* @returns {void}
|
|
1845
|
+
* @private
|
|
1846
|
+
*/
|
|
1847
|
+
public mapsOnClick(e: PointerEvent): void {
|
|
1848
|
+
const targetEle: Element = <Element>e.target;
|
|
1849
|
+
const targetId: string = targetEle.id;
|
|
1850
|
+
let latitude: number = null;
|
|
1851
|
+
let longitude: number = null;
|
|
1852
|
+
this.mouseClickEvent = { x: e.x, y: e.y };
|
|
1853
|
+
if (targetEle.id.indexOf('_ToolBar') === -1) {
|
|
1854
|
+
const latLongValue: GeoPosition = this.getClickLocation(targetId, e.pageX, e.pageY, (targetEle as HTMLElement), e['layerX'], e['layerY']);
|
|
1855
|
+
if (!isNullOrUndefined(latLongValue)) {
|
|
1856
|
+
latitude = latLongValue.latitude;
|
|
1857
|
+
longitude = latLongValue.longitude;
|
|
1858
|
+
}
|
|
1859
|
+
const eventArgs: IMouseEventArgs = {
|
|
1860
|
+
cancel: false, name: click, target: targetId, x: e.clientX, y: e.clientY,
|
|
1861
|
+
latitude: latitude, longitude: longitude,
|
|
1862
|
+
isShapeSelected: this.SelectedElement(targetEle)
|
|
1863
|
+
};
|
|
1864
|
+
if (this.onclick) {
|
|
1865
|
+
eventArgs.name = onclick;
|
|
1866
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1867
|
+
this.trigger('onclick', eventArgs, (mouseArgs: IMouseEventArgs) => {
|
|
1868
|
+
this.clickHandler(e, eventArgs, targetEle);
|
|
1869
|
+
});
|
|
1870
|
+
} else {
|
|
1871
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1872
|
+
this.trigger('click', eventArgs, (mouseArgs: IMouseEventArgs) => {
|
|
1873
|
+
this.clickHandler(e, eventArgs, targetEle);
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
if (this.zoomModule) {
|
|
1878
|
+
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.mapScaleValue, targetId);
|
|
1879
|
+
if (this.isDevice) {
|
|
1880
|
+
this.zoomModule.removeToolbarClass('', '', '', '', '');
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
private clickHandler(e: PointerEvent, eventArgs: IMouseEventArgs, targetEle: Element): void {
|
|
1886
|
+
if (targetEle.id.indexOf('shapeIndex') > -1) {
|
|
1887
|
+
this.mergeCluster();
|
|
1888
|
+
if (getElement(this.element.id + '_mapsTooltip') &&
|
|
1889
|
+
this.mapsTooltipModule.tooltipTargetID.indexOf('_MarkerIndex_') > -1) {
|
|
1890
|
+
removeElement(this.element.id + '_mapsTooltip');
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
if (this.markerModule) {
|
|
1894
|
+
this.markerModule.markerClusterClick(e);
|
|
1895
|
+
}
|
|
1896
|
+
if (!eventArgs.cancel) {
|
|
1897
|
+
this.notify(click, targetEle);
|
|
1898
|
+
}
|
|
1899
|
+
if (!eventArgs.cancel && targetEle.id.indexOf('shapeIndex') !== -1) {
|
|
1900
|
+
this.triggerShapeSelection(targetEle);
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
private triggerShapeSelection(targetEle: Element): void {
|
|
1905
|
+
const layerIndex: number = parseInt(targetEle.id.split('_LayerIndex_')[1].split('_')[0], 10);
|
|
1906
|
+
const shapeSelectedEventArgs: IShapeSelectedEventArgs = triggerShapeEvent(
|
|
1907
|
+
targetEle.id, this.layers[layerIndex as number].selectionSettings, this, shapeSelected
|
|
1908
|
+
);
|
|
1909
|
+
if (!shapeSelectedEventArgs.cancel && this.selectionModule && !isNullOrUndefined(this.shapeSelected)) {
|
|
1910
|
+
customizeStyle(this.selectionModule.selectionType + 'selectionMap',
|
|
1911
|
+
this.selectionModule.selectionType + 'selectionMapStyle', shapeSelectedEventArgs);
|
|
1912
|
+
} else if (shapeSelectedEventArgs.cancel && this.selectionModule
|
|
1913
|
+
&& isNullOrUndefined(shapeSelectedEventArgs['data'])) {
|
|
1914
|
+
removeClass(targetEle);
|
|
1915
|
+
this.selectionModule.removedSelectionList(targetEle);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1919
|
+
private getMarkerClickLocation(pageX: number, pageY: number, x: number, y: number, marker: any, isDragEnd: boolean): GeoPosition {
|
|
1920
|
+
document.getElementById(this.element.id + '_svg').style.cursor = 'grabbing';
|
|
1921
|
+
const targetElement: Element = getElement(marker.targetId);
|
|
1922
|
+
let latLongValue: GeoPosition = this.getClickLocation(marker.targetId, pageX, pageY, (targetElement as HTMLElement), x, y);
|
|
1923
|
+
const location: Point = (this.isTileMap) ? convertTileLatLongToPoint(
|
|
1924
|
+
new MapLocation(latLongValue.longitude, latLongValue.latitude), this.tileZoomLevel, this.tileTranslatePoint, true
|
|
1925
|
+
) : convertGeoToPoint(latLongValue.latitude, latLongValue.longitude, this.mapLayerPanel.currentFactor,
|
|
1926
|
+
<LayerSettings>this.layersCollection[marker.layerIndex], this);
|
|
1927
|
+
const transPoint: Point = this.translatePoint;
|
|
1928
|
+
const translateX: number = (this.isTileMap ? location.x : (location.x + transPoint.x) * this.scale);
|
|
1929
|
+
const translateY: number = (this.isTileMap ? location.y : (location.y + transPoint.y) * this.scale);
|
|
1930
|
+
if (this.markerDragArgument.shape !== 'Balloon') {
|
|
1931
|
+
targetElement.setAttribute('transform', 'translate( ' + translateX + ' ' + translateY + ' )');
|
|
1932
|
+
} else {
|
|
1933
|
+
targetElement.parentElement.setAttribute('transform', 'translate( ' + translateX + ' ' + translateY + ' )');
|
|
1934
|
+
}
|
|
1935
|
+
if (isDragEnd) {
|
|
1936
|
+
const markerSettings: MarkerSettingsModel = this.layers[marker.layerIndex].markerSettings[marker.markerIndex];
|
|
1937
|
+
latLongValue = this.getClickLocation(marker.targetId, (pageX - markerSettings.offset.x), (pageY - markerSettings.offset.y),
|
|
1938
|
+
(targetElement as HTMLElement), (x - markerSettings.offset.x),
|
|
1939
|
+
(y - markerSettings.offset.y));
|
|
1940
|
+
}
|
|
1941
|
+
return latLongValue;
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Gets the location of the mouse click.
|
|
1945
|
+
*
|
|
1946
|
+
* @param {string} targetId - Specifies the ID for the target.
|
|
1947
|
+
* @param {number} pageX - Defines the page X position.
|
|
1948
|
+
* @param {number} pageY - Defines the page Y position.
|
|
1949
|
+
* @param {HTMLElement} targetElement - Specifies the target element on the event.
|
|
1950
|
+
* @param {number} x - Defines the x position in pixel.
|
|
1951
|
+
* @param {number} y - Defines the y position in pixel.
|
|
1952
|
+
* @param {string} type - Specifies the type.
|
|
1953
|
+
* @returns {GeoPosition} - Returns the position of the event.
|
|
1954
|
+
* @private
|
|
1955
|
+
*/
|
|
1956
|
+
public getClickLocation(targetId: string, pageX: number, pageY: number, targetElement: HTMLElement,
|
|
1957
|
+
x: number, y: number, type?: string): GeoPosition {
|
|
1958
|
+
let layerIndex: number = 0;
|
|
1959
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1960
|
+
let latLongValue: any;
|
|
1961
|
+
if (targetId.indexOf('_LayerIndex_') !== -1 && !this.isTileMap && (!isNullOrUndefined(type) ||
|
|
1962
|
+
((parseInt(this.mouseDownEvent['x'], 10) === parseInt(this.mouseClickEvent['x'], 10)) &&
|
|
1963
|
+
(parseInt(this.mouseDownEvent['y'], 10) === parseInt(this.mouseClickEvent['y'], 10))))) {
|
|
1964
|
+
layerIndex = parseFloat(targetId.split('_LayerIndex_')[1].split('_')[0]);
|
|
1965
|
+
if (this.layers[layerIndex as number].geometryType === 'Normal') {
|
|
1966
|
+
if (targetId.indexOf('_shapeIndex_') > -1) {
|
|
1967
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1968
|
+
const immediateParent: Element = (targetElement as any).parentElement;
|
|
1969
|
+
const parentElement: Element = immediateParent.id.indexOf('_Point_Group') > -1 || immediateParent.id.indexOf('_LineString_Group') > -1
|
|
1970
|
+
|| immediateParent.id.indexOf('_MultiLineString_Group') > -1 || immediateParent.id.indexOf('_Polygon_Group') > -1 ?
|
|
1971
|
+
immediateParent.parentElement : immediateParent;
|
|
1972
|
+
const location: MapLocation = getMousePosition(pageX, pageY, parentElement);
|
|
1973
|
+
const zoomScaleValue: number = this.mapLayerPanel.currentFactor * this.mapScaleValue;
|
|
1974
|
+
const minLongitude: number = Math.abs((-this.baseMapBounds.longitude.min) * zoomScaleValue);
|
|
1975
|
+
const minLatitude: number = Math.abs(this.baseMapBounds.latitude.max * zoomScaleValue);
|
|
1976
|
+
latLongValue = {
|
|
1977
|
+
latitude: Math.abs(this.baseMapBounds.latitude.max - (location.y / zoomScaleValue)),
|
|
1978
|
+
longitude: Math.abs((location.x / zoomScaleValue) + this.baseMapBounds.longitude.min)
|
|
1979
|
+
};
|
|
1980
|
+
if (this.baseMapBounds.longitude.min < 0 && minLongitude > location.x) {
|
|
1981
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1982
|
+
(latLongValue as any).longitude = -(latLongValue as any).longitude;
|
|
1983
|
+
}
|
|
1984
|
+
if (this.baseMapBounds.latitude.min < 0 && minLatitude > location.y) {
|
|
1985
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1986
|
+
(latLongValue as any).latitude = - (latLongValue as any).latitude;
|
|
1987
|
+
}
|
|
1988
|
+
} else if (targetId.indexOf('_MarkerIndex_') > -1 && this.markerModule && !this.markerDragArgument) {
|
|
1989
|
+
const markerIndex: number = parseInt(targetId.split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
1990
|
+
const dataIndex: number = parseInt(targetId.split('_dataIndex_')[1].split('_')[0], 10);
|
|
1991
|
+
if (!isNaN(markerIndex) && !isNaN(dataIndex)) {
|
|
1992
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1993
|
+
const dataObject: any =
|
|
1994
|
+
this.layers[layerIndex as number].markerSettings[markerIndex as number].dataSource[dataIndex as number];
|
|
1995
|
+
latLongValue = { latitude: dataObject['latitude'], longitude: dataObject.longitude };
|
|
1996
|
+
} else {
|
|
1997
|
+
latLongValue = { latitude: null, longitude: null };
|
|
1998
|
+
}
|
|
1999
|
+
} else if (targetId.indexOf('_MarkerIndex_') > -1 && this.markerModule && this.markerDragArgument) {
|
|
2000
|
+
const element: HTMLElement = document.getElementById(this.element.id + '_LayerIndex_' + this.markerDragArgument.layerIndex);
|
|
2001
|
+
const elementRect: ClientRect = element.getBoundingClientRect();
|
|
2002
|
+
const location: MapLocation = new MapLocation(pageX > elementRect.left ? Math.abs(elementRect.left - pageX) : 0,
|
|
2003
|
+
pageY > elementRect.top ? Math.abs(elementRect.top - pageY) : 0);
|
|
2004
|
+
const minLongitude: number = Math.abs((-this.baseMapBounds.longitude.min) * this.mapLayerPanel.currentFactor);
|
|
2005
|
+
const minLatitude: number = Math.abs(this.baseMapBounds.latitude.max * this.mapLayerPanel.currentFactor);
|
|
2006
|
+
latLongValue = {
|
|
2007
|
+
latitude: Math.abs(this.baseMapBounds.latitude.max
|
|
2008
|
+
- (location.y / (this.mapLayerPanel.currentFactor * this.scale))),
|
|
2009
|
+
longitude: Math.abs((location.x / (this.mapLayerPanel.currentFactor * this.scale))
|
|
2010
|
+
+ this.baseMapBounds.longitude.min)
|
|
2011
|
+
};
|
|
2012
|
+
if (this.baseMapBounds.longitude.min < 0 && minLongitude > location.x) {
|
|
2013
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2014
|
+
(latLongValue as any).longitude = -(latLongValue as any).longitude;
|
|
2015
|
+
}
|
|
2016
|
+
if (this.baseMapBounds.latitude.min < 0 && minLatitude > location.y) {
|
|
2017
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2018
|
+
(latLongValue as any).latitude = - (latLongValue as any).latitude;
|
|
2019
|
+
}
|
|
2020
|
+
} else { latLongValue = { latitude: null, longitude: null }; }
|
|
2021
|
+
} else {
|
|
2022
|
+
latLongValue = this.getGeoLocation(layerIndex, pageX, pageY);
|
|
2023
|
+
}
|
|
2024
|
+
} else if (this.isTileMap && (!isNullOrUndefined(type) ||
|
|
2025
|
+
((parseInt(this.mouseDownEvent['x'], 10) === parseInt(this.mouseClickEvent['x'], 10)) &&
|
|
2026
|
+
(parseInt(this.mouseDownEvent['y'], 10) === parseInt(this.mouseClickEvent['y'], 10))))) {
|
|
2027
|
+
latLongValue = this.getTileGeoLocation(x, y);
|
|
2028
|
+
}
|
|
2029
|
+
return latLongValue;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
private removeTileMap(): void {
|
|
2033
|
+
const animateElement: HTMLElement = document.getElementById(this.element.id + '_animated_tiles');
|
|
2034
|
+
if (!isNullOrUndefined(this.currentTiles) && animateElement.childElementCount < this.currentTiles.childElementCount) {
|
|
2035
|
+
for (let l: number = animateElement.childElementCount - 1; l >= this.currentTiles.childElementCount; l--) {
|
|
2036
|
+
animateElement.removeChild(animateElement.children[l as number]);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
this.currentTiles = null;
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
/**
|
|
2043
|
+
* This method is used to perform operations when mouse click on maps.
|
|
2044
|
+
*
|
|
2045
|
+
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
2046
|
+
* @returns {boolean} - Returns the boolean value
|
|
2047
|
+
* @private
|
|
2048
|
+
*/
|
|
2049
|
+
public mouseEndOnMap(e: PointerEvent): boolean {
|
|
2050
|
+
let pageX: number;
|
|
2051
|
+
let pageY: number;
|
|
2052
|
+
let touchArg: TouchEvent;
|
|
2053
|
+
let layerX: number = 0;
|
|
2054
|
+
let layerY: number = 0;
|
|
2055
|
+
if (e.type.indexOf('touch') !== - 1) {
|
|
2056
|
+
this.isTouch = true;
|
|
2057
|
+
touchArg = <TouchEvent & PointerEvent>e;
|
|
2058
|
+
layerX = pageX = touchArg.changedTouches[0].pageX;
|
|
2059
|
+
pageY = touchArg.changedTouches[0].pageY;
|
|
2060
|
+
layerY = pageY - (this.isTileMap ? 10 : 0);
|
|
2061
|
+
this.mouseClickEvent = { x: pageX, y: pageY };
|
|
2062
|
+
} else {
|
|
2063
|
+
this.isTouch = e.pointerType === 'touch';
|
|
2064
|
+
pageX = e.pageX;
|
|
2065
|
+
pageY = e.pageY;
|
|
2066
|
+
layerX = e['layerX'];
|
|
2067
|
+
layerY = e['layerY'] - (this.isTileMap ? 10 : 0);
|
|
2068
|
+
}
|
|
2069
|
+
if (this.isTileMap) {
|
|
2070
|
+
this.removeTileMap();
|
|
2071
|
+
}
|
|
2072
|
+
if (this.isTouch) {
|
|
2073
|
+
this.titleTooltip(e, pageX, pageY, true);
|
|
2074
|
+
if (!isNullOrUndefined(this.legendModule)) {
|
|
2075
|
+
this.legendTooltip(e, e.pageX, e.pageY, true);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
this.notify(Browser.touchEndEvent, e);
|
|
2079
|
+
if (e.cancelable && !this.isTouch) {
|
|
2080
|
+
e.preventDefault();
|
|
2081
|
+
}
|
|
2082
|
+
if (!isNullOrUndefined(this.markerDragArgument)) {
|
|
2083
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2084
|
+
const marker: any = this.markerDragArgument;
|
|
2085
|
+
this.mouseClickEvent['x'] = this.mouseDownEvent['x'];
|
|
2086
|
+
this.mouseClickEvent['y'] = this.mouseDownEvent['y'];
|
|
2087
|
+
const latLongValue: GeoPosition = this.getMarkerClickLocation(pageX, pageY, layerX, layerY, this.markerDragArgument, true);
|
|
2088
|
+
const markerObject: MarkerSettingsModel = this.layers[marker.layerIndex].markerSettings[marker.markerIndex];
|
|
2089
|
+
document.getElementById(this.element.id + '_svg').style.cursor = markerObject.enableDrag ? 'pointer' : 'grabbing';
|
|
2090
|
+
const dragEventArgs: IMarkerDragEventArgs = {
|
|
2091
|
+
name: 'markerDragEnd', x: pageX, y: pageY,
|
|
2092
|
+
latitude: latLongValue.latitude, longitude: latLongValue.longitude,
|
|
2093
|
+
layerIndex: marker.layerIndex, markerIndex: marker.markerIndex,
|
|
2094
|
+
dataIndex: marker.dataIndex
|
|
2095
|
+
};
|
|
2096
|
+
if (isNullOrUndefined(markerObject.latitudeValuePath) && isNullOrUndefined(markerObject.longitudeValuePath)) {
|
|
2097
|
+
const data: object = markerObject.dataSource[marker.dataIndex];
|
|
2098
|
+
if (!isNullOrUndefined(data['Longitude']) && !isNullOrUndefined(data['Latitude'])) {
|
|
2099
|
+
markerObject.dataSource[marker.dataIndex].Latitude = dragEventArgs.latitude;
|
|
2100
|
+
markerObject.dataSource[marker.dataIndex].Longitude = dragEventArgs.longitude;
|
|
2101
|
+
} else {
|
|
2102
|
+
markerObject.dataSource[marker.dataIndex].latitude = dragEventArgs.latitude;
|
|
2103
|
+
markerObject.dataSource[marker.dataIndex].longitude = dragEventArgs.longitude;
|
|
2104
|
+
}
|
|
2105
|
+
} else {
|
|
2106
|
+
markerObject.dataSource[marker.dataIndex][markerObject.latitudeValuePath] = dragEventArgs.latitude;
|
|
2107
|
+
markerObject.dataSource[marker.dataIndex][markerObject.longitudeValuePath] = dragEventArgs.longitude;
|
|
2108
|
+
}
|
|
2109
|
+
this.markerDragId = '';
|
|
2110
|
+
this.markerDragArgument = null;
|
|
2111
|
+
this.trigger('markerDragEnd', dragEventArgs);
|
|
2112
|
+
} else {
|
|
2113
|
+
document.getElementById(this.element.id + '_svg').style.cursor = 'auto';
|
|
2114
|
+
}
|
|
2115
|
+
if (this.zoomModule && this.isDevice) {
|
|
2116
|
+
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.scale, this.element.id + '_Zooming_');
|
|
2117
|
+
this.zoomModule.removeToolbarClass('', '', '', '', '');
|
|
2118
|
+
}
|
|
2119
|
+
return false;
|
|
2120
|
+
}
|
|
2121
|
+
/**
|
|
2122
|
+
* This method is used to perform operations when mouse is clicked down on maps.
|
|
2123
|
+
*
|
|
2124
|
+
* @param {PointerEvent} e - Specifies the pointer event on maps
|
|
2125
|
+
* @returns {void}
|
|
2126
|
+
* @private
|
|
2127
|
+
*/
|
|
2128
|
+
public mouseDownOnMap(e: PointerEvent): void {
|
|
2129
|
+
this.mouseDownEvent = { x: e.x, y: e.y };
|
|
2130
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2131
|
+
if (e.type.indexOf('touch') !== - 1 && (e as any).changedTouches) {
|
|
2132
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2133
|
+
this.mouseDownEvent = { x: (e as any).changedTouches[0].pageX, y: (e as any).changedTouches[0].pageY };
|
|
2134
|
+
}
|
|
2135
|
+
if (this.isDevice && !isNullOrUndefined(this.mapsTooltipModule)) {
|
|
2136
|
+
this.mapsTooltipModule.renderTooltip(e);
|
|
2137
|
+
}
|
|
2138
|
+
const element: Element = <Element>e.target;
|
|
2139
|
+
this.markerDragId = element.id;
|
|
2140
|
+
const animatedTiles: HTMLElement = document.getElementById(this.element.id + '_animated_tiles');
|
|
2141
|
+
if (this.isTileMap && !isNullOrUndefined(animatedTiles)) {
|
|
2142
|
+
this.currentTiles = (animatedTiles.cloneNode(true) as HTMLElement);
|
|
2143
|
+
}
|
|
2144
|
+
if (element.id.indexOf('_ToolBar') === -1) {
|
|
2145
|
+
const markerModule: Marker = this.markerModule;
|
|
2146
|
+
if (element.id.indexOf('shapeIndex') > -1 || element.id.indexOf('Tile') > -1) {
|
|
2147
|
+
this.mergeCluster();
|
|
2148
|
+
}
|
|
2149
|
+
if (markerModule) {
|
|
2150
|
+
markerModule.markerClick(e);
|
|
2151
|
+
markerModule.markerClusterClick(e);
|
|
2152
|
+
}
|
|
2153
|
+
if (this.bubbleModule) {
|
|
2154
|
+
this.bubbleModule.bubbleClick(e);
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
this.notify(Browser.touchStartEvent, e);
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
/**
|
|
2161
|
+
* Merges the marker clusters.
|
|
2162
|
+
*
|
|
2163
|
+
* @returns {void}
|
|
2164
|
+
* @private
|
|
2165
|
+
*/
|
|
2166
|
+
public mergeCluster(): void {
|
|
2167
|
+
if (this.markerModule && (this.markerModule.sameMarkerData.length > 0) &&
|
|
2168
|
+
(this.zoomModule ? this.zoomModule.isSingleClick : true)) {
|
|
2169
|
+
mergeSeparateCluster(this.markerModule.sameMarkerData, this);
|
|
2170
|
+
this.markerModule.sameMarkerData = [];
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
/**
|
|
2175
|
+
* @param {PointerEvent} e - Specifies the pointer event.
|
|
2176
|
+
* @returns {void}
|
|
2177
|
+
* @private
|
|
2178
|
+
*/
|
|
2179
|
+
public mapsOnRightClick(e: PointerEvent): void {
|
|
2180
|
+
const targetEle: Element = <Element>e.target;
|
|
2181
|
+
const targetId: string = targetEle.id;
|
|
2182
|
+
let latitude: number = null;
|
|
2183
|
+
let longitude: number = null;
|
|
2184
|
+
this.mouseClickEvent = this.mouseDownEvent = { x: e.x, y: e.y };
|
|
2185
|
+
if (targetEle.id.indexOf('_ToolBar') === -1) {
|
|
2186
|
+
const latLongValue: GeoPosition = this.getClickLocation(targetId, e.pageX, e.pageY, (targetEle as HTMLElement), e['layerX'], e['layerY']);
|
|
2187
|
+
if (!isNullOrUndefined(latLongValue)) {
|
|
2188
|
+
latitude = latLongValue.latitude;
|
|
2189
|
+
longitude = latLongValue.longitude;
|
|
2190
|
+
}
|
|
2191
|
+
const eventArgs: IMouseEventArgs = {
|
|
2192
|
+
cancel: false, name: rightClick, target: targetId, x: e.clientX, y: e.clientY,
|
|
2193
|
+
latitude: latitude, longitude: longitude,
|
|
2194
|
+
isShapeSelected: false
|
|
2195
|
+
};
|
|
2196
|
+
this.trigger('rightClick', eventArgs);
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
/**
|
|
2201
|
+
* This method is used to perform operations when performing the double click operation on maps.
|
|
2202
|
+
*
|
|
2203
|
+
* @param {PointerEvent} e - Specifies the pointer event.
|
|
2204
|
+
* @returns {void}
|
|
2205
|
+
* @private
|
|
2206
|
+
*/
|
|
2207
|
+
public mapsOnDoubleClick(e: PointerEvent): void {
|
|
2208
|
+
this.notify('dblclick', e);
|
|
2209
|
+
const targetElement: Element = <Element>e.target;
|
|
2210
|
+
const targetId: string = targetElement.id;
|
|
2211
|
+
let layerIndex: number = 0;
|
|
2212
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2213
|
+
let latLongValue: any;
|
|
2214
|
+
let latitude: number = null; let longitude: number = null;
|
|
2215
|
+
if (targetElement.id.indexOf('_ToolBar') === -1) {
|
|
2216
|
+
if (targetElement.id.indexOf('_LayerIndex_') !== -1 && !this.isTileMap && (this.mouseDownEvent['x'] === e.clientX)
|
|
2217
|
+
&& (this.mouseDownEvent['y'] === e.clientY)) {
|
|
2218
|
+
layerIndex = parseFloat(targetElement.id.split('_LayerIndex_')[1].split('_')[0]);
|
|
2219
|
+
latLongValue = this.getGeoLocation(layerIndex, e['layerX'], e['layerY']);
|
|
2220
|
+
latitude = latLongValue['latitude']; longitude = latLongValue['longitude'];
|
|
2221
|
+
} else if (this.isTileMap && (this.mouseDownEvent['x'] === e.clientX)
|
|
2222
|
+
&& (this.mouseDownEvent['y'] === e.clientY)) {
|
|
2223
|
+
latLongValue = this.getTileGeoLocation(e['layerX'], e['layerY']);
|
|
2224
|
+
latitude = latLongValue['latitude']; longitude = latLongValue['longitude'];
|
|
2225
|
+
}
|
|
2226
|
+
const doubleClickArgs: IMouseEventArgs = {
|
|
2227
|
+
cancel: false, name: doubleClick, x: e.clientX, y: e.clientY,
|
|
2228
|
+
target: targetId, latitude: latitude, longitude: longitude, isShapeSelected: null
|
|
2229
|
+
};
|
|
2230
|
+
this.trigger('doubleClick', doubleClickArgs);
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
/**
|
|
2235
|
+
* This method is used to perform operations while performing mouse over on maps.
|
|
2236
|
+
*
|
|
2237
|
+
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
2238
|
+
* @returns {void}
|
|
2239
|
+
* @private
|
|
2240
|
+
*/
|
|
2241
|
+
public mouseMoveOnMap(e: PointerEvent): void {
|
|
2242
|
+
let target: Element;
|
|
2243
|
+
target = (e.type === 'touchmove') ? <Element>(<TouchEvent & PointerEvent>e).target :
|
|
2244
|
+
target = <Element>e.target;
|
|
2245
|
+
// if (target.id.indexOf('shapeIndex') !== -1 && !this.highlightSettings.enable) {
|
|
2246
|
+
// triggerShapeEvent(target.id, this.highlightSettings, this, shapeHighlight);
|
|
2247
|
+
// }
|
|
2248
|
+
this.mouseMoveEvent(e);
|
|
2249
|
+
if (this.markerModule) {
|
|
2250
|
+
this.markerModule.markerMove(e);
|
|
2251
|
+
this.markerModule.markerClusterMouseMove(e);
|
|
2252
|
+
}
|
|
2253
|
+
if (this.bubbleModule) {
|
|
2254
|
+
this.bubbleModule.bubbleMove(e);
|
|
2255
|
+
}
|
|
2256
|
+
if (target.id.indexOf('MarkerIndex') === -1) {
|
|
2257
|
+
document.getElementById(this.element.id + '_svg').style.cursor = 'auto';
|
|
2258
|
+
}
|
|
2259
|
+
this.onMouseMove(e);
|
|
2260
|
+
this.notify(Browser.touchMoveEvent, e);
|
|
2261
|
+
}
|
|
2262
|
+
/**
|
|
2263
|
+
* To check and trigger mouse move event on maps.
|
|
2264
|
+
*
|
|
2265
|
+
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
2266
|
+
* @returns {void}
|
|
2267
|
+
* @private
|
|
2268
|
+
*/
|
|
2269
|
+
private mouseMoveEvent(e: PointerEvent): void {
|
|
2270
|
+
const targetId: string = (e.target as Element).id;
|
|
2271
|
+
let layerIndex: number;
|
|
2272
|
+
let eventArgs: IMouseMoveEventArgs;
|
|
2273
|
+
if (this.isTileMap) {
|
|
2274
|
+
const latLongValue: GeoPosition = this.getTileGeoLocation(e['layerX'], e['layerY']);
|
|
2275
|
+
eventArgs = {
|
|
2276
|
+
x: e.clientX, y: e.clientY, latitude: latLongValue.latitude,
|
|
2277
|
+
longitude: latLongValue.longitude, target: e.target as Element
|
|
2278
|
+
};
|
|
2279
|
+
} else {
|
|
2280
|
+
layerIndex = targetId.indexOf('_LayerIndex_') > -1 ? parseInt(targetId.split('_LayerIndex_')[1].split('_')[0], 10) : this.baseLayerIndex;
|
|
2281
|
+
const latLongValue: GeoPosition = this.getGeoLocation(layerIndex, e.clientX, e.clientY);
|
|
2282
|
+
eventArgs = {
|
|
2283
|
+
x: e.clientX, y: e.clientY, latitude: latLongValue.latitude,
|
|
2284
|
+
longitude: latLongValue.longitude, target: e.target as Element
|
|
2285
|
+
};
|
|
2286
|
+
}
|
|
2287
|
+
this.trigger(mouseMove, eventArgs);
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* This method is used to perform operations when mouse move event is performed on maps.
|
|
2291
|
+
*
|
|
2292
|
+
* @param {PointerEvent} e - Specifies the pointer event on maps.
|
|
2293
|
+
* @returns {void}
|
|
2294
|
+
* @private
|
|
2295
|
+
*/
|
|
2296
|
+
public onMouseMove(e: PointerEvent): boolean {
|
|
2297
|
+
const element: Element = <Element>e.target;
|
|
2298
|
+
this.mouseMoveId = element['id'];
|
|
2299
|
+
let pageX: number;
|
|
2300
|
+
let pageY: number;
|
|
2301
|
+
let touches: TouchList = null;
|
|
2302
|
+
let layerX: number = 0;
|
|
2303
|
+
let layerY: number = 0;
|
|
2304
|
+
if (e.type.indexOf('touch') === -1) {
|
|
2305
|
+
pageX = (<PointerEvent>e).pageX;
|
|
2306
|
+
pageY = (<PointerEvent>e).pageY;
|
|
2307
|
+
layerX = e['layerX'];
|
|
2308
|
+
layerY = e['layerY'] - (this.isTileMap ? 10 : 0);
|
|
2309
|
+
this.titleTooltip(e, e.pageX, e.pageY);
|
|
2310
|
+
if (!isNullOrUndefined(this.legendModule)) {
|
|
2311
|
+
this.legendTooltip(e, e.pageX, e.pageY, true);
|
|
2312
|
+
}
|
|
2313
|
+
} else {
|
|
2314
|
+
touches = (<TouchEvent & PointerEvent>e).touches;
|
|
2315
|
+
layerX = pageX = touches[0].clientX;
|
|
2316
|
+
layerY = pageY = touches[0].clientY - (this.isTileMap ? 10 : 0);
|
|
2317
|
+
}
|
|
2318
|
+
if (!isNullOrUndefined(this.markerDragArgument)) {
|
|
2319
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2320
|
+
const marker: any = this.markerDragArgument;
|
|
2321
|
+
this.mouseClickEvent['x'] = this.mouseDownEvent['x'];
|
|
2322
|
+
this.mouseClickEvent['y'] = this.mouseDownEvent['y'];
|
|
2323
|
+
this.getMarkerClickLocation(pageX, pageY, layerX, layerY, marker, false);
|
|
2324
|
+
}
|
|
2325
|
+
if (this.zoomModule) {
|
|
2326
|
+
this.zoomModule.removeToolbarOpacity(this.isTileMap ? Math.round(this.tileZoomLevel) : this.scale, (<HTMLElement>e.target).id);
|
|
2327
|
+
}
|
|
2328
|
+
return false;
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
private legendTooltip(event: Event, x: number, y: number, isTouch?: boolean): void {
|
|
2332
|
+
let targetId: string = (<HTMLElement>event.target).id;
|
|
2333
|
+
let legendText: string; let page: number = this.legendModule.currentPage;
|
|
2334
|
+
let legendIndex: string = (<HTMLElement>event.target).id.split('_Index_')[1];
|
|
2335
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2336
|
+
let collection: any;
|
|
2337
|
+
page = this.legendModule.totalPages.length <= this.legendModule.currentPage
|
|
2338
|
+
? this.legendModule.totalPages.length - 1 : this.legendModule.currentPage < 0 ?
|
|
2339
|
+
0 : this.legendModule.currentPage;
|
|
2340
|
+
const count: number = this.legendModule.totalPages.length !== 0 ?
|
|
2341
|
+
this.legendModule.totalPages[page as number]['Collection'].length : this.legendModule.totalPages.length;
|
|
2342
|
+
for (let i: number = 0; i < count; i++) {
|
|
2343
|
+
collection = this.legendModule.totalPages[page as number]['Collection'][i as number];
|
|
2344
|
+
legendText = collection['DisplayText'];
|
|
2345
|
+
targetId = event.target['id'];
|
|
2346
|
+
legendIndex = event.target['id'].split('_Index_')[1];
|
|
2347
|
+
if ((targetId === (this.element.id + '_Legend_Text_Index_' + legendIndex)) &&
|
|
2348
|
+
((<HTMLElement>event.target).textContent.indexOf('...') > -1) && collection['idIndex'] === parseInt(legendIndex, 10)) {
|
|
2349
|
+
showTooltip(
|
|
2350
|
+
legendText, this.legendSettings.textStyle.size, x, y, this.element.offsetWidth, this.element.offsetHeight,
|
|
2351
|
+
this.element.id + '_EJ2_Legend_Text_Tooltip', getElement(this.element.id + '_Secondary_Element'), isTouch
|
|
2352
|
+
);
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
if ((targetId !== (this.element.id + '_Legend_Text_Index_' + legendIndex))) {
|
|
2356
|
+
removeElement(this.element.id + '_EJ2_Legend_Text_Tooltip');
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
private titleTooltip(event: Event, x: number, y: number, isTouch?: boolean): void {
|
|
2361
|
+
const targetId: string = (<HTMLElement>event.target).id;
|
|
2362
|
+
if (targetId === (this.element.id + '_LegendTitle') && ((<HTMLElement>event.target).textContent.indexOf('...') > -1)) {
|
|
2363
|
+
showTooltip(
|
|
2364
|
+
this.legendSettings.title.text, this.legendSettings.titleStyle.size, x, y, this.element.offsetWidth,
|
|
2365
|
+
this.element.offsetHeight, this.element.id + '_EJ2_LegendTitle_Tooltip',
|
|
2366
|
+
getElement(this.element.id + '_Secondary_Element'), isTouch
|
|
2367
|
+
);
|
|
2368
|
+
} else {
|
|
2369
|
+
removeElement(this.element.id + '_EJ2_LegendTitle_Tooltip');
|
|
2370
|
+
}
|
|
2371
|
+
if ((targetId === (this.element.id + '_Map_title')) && ((<HTMLElement>event.target).textContent.indexOf('...') > -1)) {
|
|
2372
|
+
showTooltip(
|
|
2373
|
+
this.titleSettings.text, this.titleSettings.textStyle.size || this.themeStyle.titleFontSize, x, y,
|
|
2374
|
+
this.element.offsetWidth, this.element.offsetHeight,
|
|
2375
|
+
this.element.id + '_EJ2_Title_Tooltip', getElement(this.element.id + '_Secondary_Element'), isTouch
|
|
2376
|
+
);
|
|
2377
|
+
} else {
|
|
2378
|
+
removeElement(this.element.id + '_EJ2_Title_Tooltip');
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
/*
|
|
2382
|
+
|
|
2383
|
+
/**
|
|
2384
|
+
* This method is used to perform operations while resizing the window.
|
|
2385
|
+
*
|
|
2386
|
+
* @param e - Specifies the arguments of window resize event.
|
|
2387
|
+
*/
|
|
2388
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2389
|
+
public mapsOnResize(e: Event): boolean {
|
|
2390
|
+
if (!this.isDestroyed && !this.isExportInitialTileMap) {
|
|
2391
|
+
this.isResize = this.isReset = true;
|
|
2392
|
+
const args: IResizeEventArgs = {
|
|
2393
|
+
cancel: false,
|
|
2394
|
+
name: resize,
|
|
2395
|
+
previousSize: this.availableSize,
|
|
2396
|
+
currentSize: calculateSize(this),
|
|
2397
|
+
maps: this
|
|
2398
|
+
};
|
|
2399
|
+
this.trigger(resize, args);
|
|
2400
|
+
if (!args.cancel) {
|
|
2401
|
+
if (this.resizeTo) {
|
|
2402
|
+
clearTimeout(this.resizeTo);
|
|
2403
|
+
}
|
|
2404
|
+
if (!isNullOrUndefined(this.element) && this.element.classList.contains('e-maps')) {
|
|
2405
|
+
this.resizeTo = setTimeout(
|
|
2406
|
+
(): void => {
|
|
2407
|
+
this.unWireEVents();
|
|
2408
|
+
this.createSVG();
|
|
2409
|
+
this.refreshing = true;
|
|
2410
|
+
this.wireEVents();
|
|
2411
|
+
this.render();
|
|
2412
|
+
this.refreshing = false;
|
|
2413
|
+
},
|
|
2414
|
+
500);
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
return false;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
/**
|
|
2422
|
+
* This method is used to zoom the map by specifying the center position.
|
|
2423
|
+
*
|
|
2424
|
+
* @param {number} centerPosition - Specifies the location of the maps to be zoomed as geographical coordinates.
|
|
2425
|
+
* @param {number} centerPosition.longitude - Specifies the longitude of the location to be zoomed.
|
|
2426
|
+
* @param {number} centerPosition.latitude - Specifies the latitude of the location to be zoomed.
|
|
2427
|
+
* @param {number} zoomFactor - Specifies the zoom factor for the maps.
|
|
2428
|
+
* @returns {void}
|
|
2429
|
+
*/
|
|
2430
|
+
public zoomByPosition(centerPosition: { latitude: number, longitude: number }, zoomFactor: number): void {
|
|
2431
|
+
if (!this.isDestroyed) {
|
|
2432
|
+
this.zoomNotApplied = this.isMarkerZoomCompleted = false;
|
|
2433
|
+
let isRefresh: boolean = this.zoomSettings.zoomFactor === zoomFactor;
|
|
2434
|
+
this.previousProjection = null;
|
|
2435
|
+
if (!this.isTileMap && this.zoomModule) {
|
|
2436
|
+
if (!isNullOrUndefined(centerPosition)) {
|
|
2437
|
+
this.zoomSettings.zoomFactor = zoomFactor;
|
|
2438
|
+
isRefresh = this.centerPosition.latitude === centerPosition.latitude &&
|
|
2439
|
+
this.centerPosition.longitude === centerPosition.longitude ? true : isRefresh;
|
|
2440
|
+
this.centerPosition = centerPosition;
|
|
2441
|
+
this.isZoomByPosition = true;
|
|
2442
|
+
this.mapScaleValue = null;
|
|
2443
|
+
}
|
|
2444
|
+
else {
|
|
2445
|
+
this.zoomSettings.zoomFactor = zoomFactor;
|
|
2446
|
+
this.isZoomByPosition = true;
|
|
2447
|
+
this.mapScaleValue = null;
|
|
2448
|
+
}
|
|
2449
|
+
} else if (this.zoomModule) {
|
|
2450
|
+
this.tileZoomLevel = this.zoomSettings.zoomFactor = zoomFactor;
|
|
2451
|
+
isRefresh = this.centerPosition.latitude === centerPosition.latitude &&
|
|
2452
|
+
this.centerPosition.longitude === centerPosition.longitude ? true : isRefresh;
|
|
2453
|
+
this.centerPosition = centerPosition;
|
|
2454
|
+
this.isZoomByPosition = true;
|
|
2455
|
+
}
|
|
2456
|
+
if (isRefresh) {
|
|
2457
|
+
this.refresh();
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
/**
|
|
2463
|
+
* This method is used to perform panning by specifying the direction.
|
|
2464
|
+
*
|
|
2465
|
+
* @param {PanDirection} direction - Specifies the direction in which the panning must be performed.
|
|
2466
|
+
* @param {PointerEvent | TouchEvent} mouseLocation - Specifies the location of the mouse pointer in maps in pixels.
|
|
2467
|
+
* @returns {void}
|
|
2468
|
+
*/
|
|
2469
|
+
public panByDirection(direction: PanDirection, mouseLocation?: PointerEvent | TouchEvent): void {
|
|
2470
|
+
if (!this.isDestroyed) {
|
|
2471
|
+
let xDiff: number = 0; let yDiff: number = 0;
|
|
2472
|
+
switch (direction) {
|
|
2473
|
+
case 'Left':
|
|
2474
|
+
xDiff = -(this.mapAreaRect.width / 7);
|
|
2475
|
+
break;
|
|
2476
|
+
case 'Right':
|
|
2477
|
+
xDiff = (this.mapAreaRect.width / 7);
|
|
2478
|
+
break;
|
|
2479
|
+
case 'Top':
|
|
2480
|
+
yDiff = -(this.mapAreaRect.height / 7);
|
|
2481
|
+
break;
|
|
2482
|
+
case 'Bottom':
|
|
2483
|
+
yDiff = (this.mapAreaRect.height / 7);
|
|
2484
|
+
break;
|
|
2485
|
+
}
|
|
2486
|
+
if (this.zoomModule) {
|
|
2487
|
+
this.zoomModule.panning(direction, xDiff, yDiff, mouseLocation);
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
/**
|
|
2493
|
+
* This method is used to add the layers dynamically to the maps.
|
|
2494
|
+
*
|
|
2495
|
+
* @param {object} layer - Specifies the layer to be added in the maps.
|
|
2496
|
+
* @returns {void}
|
|
2497
|
+
*/
|
|
2498
|
+
public addLayer(layer: Object): void {
|
|
2499
|
+
if (!this.isDestroyed) {
|
|
2500
|
+
const mapsLayer: LayerSettingsModel[] = this.layers;
|
|
2501
|
+
mapsLayer.push(layer);
|
|
2502
|
+
this.isAddLayer = true;
|
|
2503
|
+
this.layers = mapsLayer;
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* This method is used to remove a layer from the maps.
|
|
2508
|
+
*
|
|
2509
|
+
* @param {number} index - Specifies the index number of the layer to be removed.
|
|
2510
|
+
* @returns {void}
|
|
2511
|
+
*/
|
|
2512
|
+
public removeLayer(index: number): void {
|
|
2513
|
+
if (!this.isDestroyed) {
|
|
2514
|
+
const mapsLayer: LayerSettingsModel[] = this.layers;
|
|
2515
|
+
mapsLayer.splice(index, 1);
|
|
2516
|
+
this.layers = mapsLayer;
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
/**
|
|
2520
|
+
* This method is used to add markers dynamically in the maps.
|
|
2521
|
+
* If we provide the index value of the layer in which the marker to be added and the settings
|
|
2522
|
+
* of the marker as parameters, the marker will be added in the location.
|
|
2523
|
+
*
|
|
2524
|
+
* @param {number} layerIndex - Specifies the index number of the layer.
|
|
2525
|
+
* @param {MarkerSettingsModel[]} markerCollection - Specifies the settings of the marker to be added.
|
|
2526
|
+
* @returns {void}
|
|
2527
|
+
*/
|
|
2528
|
+
public addMarker(layerIndex?: number, markerCollection?: MarkerSettingsModel[]): void {
|
|
2529
|
+
if (!this.isDestroyed && !isNullOrUndefined(this.markerModule)) {
|
|
2530
|
+
if (!isNullOrUndefined(layerIndex) && !isNullOrUndefined(markerCollection)) {
|
|
2531
|
+
const layerEle: Element = document.getElementById(this.element.id + '_LayerIndex_' + layerIndex);
|
|
2532
|
+
if (markerCollection.length > 0 && layerEle) {
|
|
2533
|
+
for (const newMarker of markerCollection) {
|
|
2534
|
+
this.layersCollection[layerIndex as number].markerSettings.push(new MarkerSettings(this, 'markerSettings', newMarker));
|
|
2535
|
+
}
|
|
2536
|
+
this.markerModule.markerRender(this, layerEle, layerIndex, this.isTileMap ? this.tileZoomLevel : this.mapLayerPanel['currentFactor'], 'AddMarker');
|
|
2537
|
+
this.arrangeTemplate();
|
|
2538
|
+
}
|
|
2539
|
+
} else {
|
|
2540
|
+
for (let i: number = 0; i < this.layers.length; i++) {
|
|
2541
|
+
const layerEle: Element = document.getElementById(this.element.id + '_LayerIndex_' + i);
|
|
2542
|
+
this.markerModule.zoomedMarkerCluster[i as number] = [];
|
|
2543
|
+
this.markerModule.initialMarkerCluster[i as number] = [];
|
|
2544
|
+
this.markerModule.markerRender(this, layerEle, i, this.isTileMap ? this.tileZoomLevel : this.mapLayerPanel['currentFactor'], null);
|
|
2545
|
+
}
|
|
2546
|
+
this.arrangeTemplate();
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
/**
|
|
2552
|
+
* This method is used to select the geometric shape element in the maps.
|
|
2553
|
+
*
|
|
2554
|
+
* @param {number} layerIndex - Specifies the index of the layer in maps.
|
|
2555
|
+
* @param {string | string[]} propertyName - Specifies the property name from the data source.
|
|
2556
|
+
* @param {string} name - Specifies the name of the shape, which is mapped from the data source, that is selected.
|
|
2557
|
+
* @param {boolean} enable - Specifies whether the shape should be selected or the selection should be removed.
|
|
2558
|
+
* @returns {void}
|
|
2559
|
+
*/
|
|
2560
|
+
public shapeSelection(layerIndex: number, propertyName: string | string[], name: string, enable?: boolean): void {
|
|
2561
|
+
if (!this.isDestroyed && !isNullOrUndefined(this.layers[layerIndex as number])) {
|
|
2562
|
+
let targetEle: Element;
|
|
2563
|
+
let subLayerIndex: number;
|
|
2564
|
+
const popertyNameArray: string[] = Array.isArray(propertyName) ? propertyName : Array(propertyName);
|
|
2565
|
+
if (isNullOrUndefined(enable)) {
|
|
2566
|
+
enable = true;
|
|
2567
|
+
}
|
|
2568
|
+
const selectionsettings: SelectionSettingsModel = this.layers[layerIndex as number].selectionSettings;
|
|
2569
|
+
if (!selectionsettings.enableMultiSelect && this.legendSelection && enable) {
|
|
2570
|
+
this.removeShapeSelection();
|
|
2571
|
+
}
|
|
2572
|
+
if (this.layers[layerIndex as number].type === 'SubLayer') {
|
|
2573
|
+
for (let i: number = 0; i < this.layersCollection.length; i++) {
|
|
2574
|
+
if ((this.layersCollection[i as number].shapeData === this.layers[layerIndex as number].shapeData)) {
|
|
2575
|
+
subLayerIndex = i;
|
|
2576
|
+
break;
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
if (!isNullOrUndefined(selectionsettings) && selectionsettings.enable) {
|
|
2581
|
+
let targetId: string;
|
|
2582
|
+
let dataIndex: number;
|
|
2583
|
+
let shapeIndex: number;
|
|
2584
|
+
let indexValue: number;
|
|
2585
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2586
|
+
let shapeDataValue: any;
|
|
2587
|
+
let data: any;
|
|
2588
|
+
const shapeData: any[] = <any[]>this.layers[layerIndex as number].shapeData['features'];
|
|
2589
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
2590
|
+
for (let i: number = 0; i < shapeData.length; i++) {
|
|
2591
|
+
for (let j: number = 0; j < (<string[]>popertyNameArray).length; j++) {
|
|
2592
|
+
const propertyName: string = !isNullOrUndefined(shapeData[i as number]['properties'][popertyNameArray[j as number]])
|
|
2593
|
+
&& isNaN(shapeData[i as number]['properties'][popertyNameArray[j as number]]) ?
|
|
2594
|
+
shapeData[i as number]['properties'][popertyNameArray[j as number]].toLowerCase() : shapeData[i as number]['properties'][popertyNameArray[j as number]];
|
|
2595
|
+
const shapeName: string = !isNullOrUndefined(name) && typeof name === 'string' ? name.toLowerCase() : name;
|
|
2596
|
+
let k: number;
|
|
2597
|
+
if (propertyName === shapeName) {
|
|
2598
|
+
if (!isNullOrUndefined(this.layers[layerIndex as number].shapeSettings.colorValuePath)) {
|
|
2599
|
+
k = checkShapeDataFields(
|
|
2600
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2601
|
+
<any[]>this.layers[layerIndex as number].dataSource, shapeData[i as number]['properties'],
|
|
2602
|
+
this.layers[layerIndex as number].shapeDataPath, this.layers[layerIndex as number].shapePropertyPath,
|
|
2603
|
+
this.layers[layerIndex as number]);
|
|
2604
|
+
}
|
|
2605
|
+
const baseLayer: LayerSettings = <LayerSettings>this.layers[layerIndex as number];
|
|
2606
|
+
if (this.baseLayerIndex >= 0 && baseLayer.isBaseLayer) {
|
|
2607
|
+
indexValue = 0;
|
|
2608
|
+
} else if (this.layers[layerIndex as number].type === 'SubLayer') {
|
|
2609
|
+
indexValue = subLayerIndex;
|
|
2610
|
+
}
|
|
2611
|
+
targetId = this.element.id + '_' + 'LayerIndex_' + indexValue + '_shapeIndex_' + i + '_dataIndex_' + k;
|
|
2612
|
+
targetEle = getElement(targetId);
|
|
2613
|
+
if (isNullOrUndefined(k) && isNullOrUndefined(targetEle)) {
|
|
2614
|
+
targetId = this.element.id + '_' + 'LayerIndex_' + layerIndex + '_shapeIndex_' + i + '_dataIndex_null';
|
|
2615
|
+
targetEle = getElement(targetId);
|
|
2616
|
+
}
|
|
2617
|
+
shapeIndex = parseInt(targetEle.id.split('_shapeIndex_')[1].split('_')[0], 10);
|
|
2618
|
+
shapeDataValue = this.layers[layerIndex as number].shapeData['features']['length'] > shapeIndex ?
|
|
2619
|
+
this.layers[layerIndex as number].shapeData['features'][shapeIndex as number]['properties'] : null;
|
|
2620
|
+
dataIndex = parseInt(targetEle.id.split('_dataIndex_')[1].split('_')[0], 10);
|
|
2621
|
+
data = isNullOrUndefined(dataIndex) ? null : this.layers[layerIndex as number].dataSource[dataIndex as number];
|
|
2622
|
+
if (enable) {
|
|
2623
|
+
triggerItemSelectionEvent(selectionsettings, this, targetEle, shapeDataValue, data);
|
|
2624
|
+
this.shapeSelectionClass = getElement('ShapeselectionMap');
|
|
2625
|
+
if (this.legendSettings.visible && targetEle.id.indexOf('_MarkerIndex_') === -1) {
|
|
2626
|
+
this.legendModule.shapeHighLightAndSelection(
|
|
2627
|
+
targetEle, data, selectionsettings, 'selection', layerIndex);
|
|
2628
|
+
}
|
|
2629
|
+
const shapeToggled: boolean = this.legendSettings.visible ? this.legendModule.shapeToggled : true;
|
|
2630
|
+
if (shapeToggled) {
|
|
2631
|
+
targetEle.setAttribute('class', 'ShapeselectionMapStyle');
|
|
2632
|
+
if (this.selectedElementId.indexOf(targetEle.getAttribute('id')) === -1) {
|
|
2633
|
+
this.selectedElementId.push(targetEle.getAttribute('id'));
|
|
2634
|
+
}
|
|
2635
|
+
if (!selectionsettings.enableMultiSelect) { return; }
|
|
2636
|
+
}
|
|
2637
|
+
} else {
|
|
2638
|
+
this.legendSelection = (!selectionsettings.enableMultiSelect && !this.legendSelection) ?
|
|
2639
|
+
true : this.legendSelection;
|
|
2640
|
+
if (this.legendSettings.visible && targetEle.id.indexOf('_MarkerIndex_') === -1 &&
|
|
2641
|
+
targetEle.getAttribute('class') === 'ShapeselectionMapStyle') {
|
|
2642
|
+
this.legendModule.shapeHighLightAndSelection(
|
|
2643
|
+
targetEle, data, selectionsettings, 'selection', layerIndex);
|
|
2644
|
+
}
|
|
2645
|
+
const shapeToggled: boolean = this.legendSettings.visible ? this.legendModule.shapeToggled : true;
|
|
2646
|
+
if (shapeToggled) {
|
|
2647
|
+
removeClass(targetEle);
|
|
2648
|
+
const selectedElementIdIndex: number = this.selectedElementId.indexOf(targetEle.getAttribute('id'));
|
|
2649
|
+
if (selectedElementIdIndex !== -1) {
|
|
2650
|
+
this.selectedElementId.splice(selectedElementIdIndex, 1);
|
|
2651
|
+
if (!selectionsettings.enableMultiSelect && this.legendSelection
|
|
2652
|
+
&& this.selectedElementId.length > 0) {
|
|
2653
|
+
this.removeShapeSelection();
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
/**
|
|
2666
|
+
* This method is used to zoom the maps based on the provided coordinates.
|
|
2667
|
+
*
|
|
2668
|
+
* @param {number} minLatitude - Specifies the minimum latitude of the location to be zoomed.
|
|
2669
|
+
* @param {number} minLongitude - Specifies the minimum latitude of the location to be zoomed.
|
|
2670
|
+
* @param {number} maxLatitude - Specifies the maximum latitude of the location to be zoomed.
|
|
2671
|
+
* @param {number} maxLongitude - Specifies the maximum longitude of the location to be zoomed.
|
|
2672
|
+
* @returns {void}
|
|
2673
|
+
*/
|
|
2674
|
+
public zoomToCoordinates(minLatitude: number, minLongitude: number, maxLatitude: number, maxLongitude: number): void {
|
|
2675
|
+
if (!this.isDestroyed) {
|
|
2676
|
+
this.isMarkerZoomCompleted = false;
|
|
2677
|
+
let centerLatitude: number;
|
|
2678
|
+
let centerLongtitude: number;
|
|
2679
|
+
let isTwoCoordinates: boolean = false;
|
|
2680
|
+
this.centerPosition = {
|
|
2681
|
+
latitude: null,
|
|
2682
|
+
longitude: null
|
|
2683
|
+
};
|
|
2684
|
+
this.isZoomByPosition = false;
|
|
2685
|
+
if (isNullOrUndefined(maxLatitude) && isNullOrUndefined(maxLongitude)
|
|
2686
|
+
|| isNullOrUndefined(minLatitude) && isNullOrUndefined(minLongitude)) {
|
|
2687
|
+
minLatitude = isNullOrUndefined(minLatitude) ? 0 : minLatitude;
|
|
2688
|
+
minLongitude = isNullOrUndefined(minLatitude) ? 0 : minLongitude;
|
|
2689
|
+
maxLatitude = isNullOrUndefined(maxLatitude) ? minLatitude : maxLatitude;
|
|
2690
|
+
maxLongitude = isNullOrUndefined(maxLongitude) ? minLongitude : maxLongitude;
|
|
2691
|
+
isTwoCoordinates = true;
|
|
2692
|
+
}
|
|
2693
|
+
if (minLatitude > maxLatitude) {
|
|
2694
|
+
[minLatitude, maxLatitude] = [maxLatitude, minLatitude];
|
|
2695
|
+
}
|
|
2696
|
+
if (minLongitude > maxLongitude) {
|
|
2697
|
+
[minLongitude, maxLongitude] = [maxLongitude, minLongitude];
|
|
2698
|
+
}
|
|
2699
|
+
if (!isTwoCoordinates) {
|
|
2700
|
+
centerLatitude = (minLatitude + maxLatitude) / 2;
|
|
2701
|
+
centerLongtitude = (minLongitude + maxLongitude) / 2;
|
|
2702
|
+
} else {
|
|
2703
|
+
centerLatitude = (minLatitude + maxLatitude);
|
|
2704
|
+
centerLongtitude = (minLongitude + maxLongitude);
|
|
2705
|
+
}
|
|
2706
|
+
this.centerLatOfGivenLocation = centerLatitude;
|
|
2707
|
+
this.centerLongOfGivenLocation = centerLongtitude;
|
|
2708
|
+
this.minLatOfGivenLocation = minLatitude;
|
|
2709
|
+
this.minLongOfGivenLocation = minLongitude;
|
|
2710
|
+
this.maxLatOfGivenLocation = maxLatitude;
|
|
2711
|
+
this.maxLongOfGivenLocation = maxLongitude;
|
|
2712
|
+
this.zoomNotApplied = true;
|
|
2713
|
+
this.scaleOfGivenLocation = calculateZoomLevel(minLatitude, maxLatitude, minLongitude, maxLongitude,
|
|
2714
|
+
this.mapAreaRect.width, this.mapAreaRect.height, this, true);
|
|
2715
|
+
const minMaxLatitudeLongitude: IMinMaxLatitudeLongitude = this.getMinMaxLatitudeLongitude();
|
|
2716
|
+
const zoomArgs: IMapZoomEventArgs = {
|
|
2717
|
+
cancel: false, name: 'zoom', type: zoomIn, maps: this,
|
|
2718
|
+
tileTranslatePoint: {}, translatePoint: {},
|
|
2719
|
+
tileZoomLevel: this.isTileMap ? { previous: this.tileZoomLevel, current: this.scaleOfGivenLocation } : {},
|
|
2720
|
+
scale: !this.isTileMap ? { previous: this.scale, current: this.scaleOfGivenLocation } :
|
|
2721
|
+
{ previous: this.tileZoomLevel, current: this.scaleOfGivenLocation },
|
|
2722
|
+
minLatitude: minMaxLatitudeLongitude.minLatitude, maxLatitude: minMaxLatitudeLongitude.maxLatitude,
|
|
2723
|
+
minLongitude: minMaxLatitudeLongitude.minLongitude, maxLongitude: minMaxLatitudeLongitude.maxLongitude
|
|
2724
|
+
};
|
|
2725
|
+
this.trigger('zoom', zoomArgs);
|
|
2726
|
+
this.refresh();
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
/**
|
|
2731
|
+
* This method is used to remove multiple selected shapes in the maps.
|
|
2732
|
+
*
|
|
2733
|
+
* @returns {void}
|
|
2734
|
+
*/
|
|
2735
|
+
private removeShapeSelection(): void {
|
|
2736
|
+
const selectedElements: number = this.selectedElementId.length;
|
|
2737
|
+
for (let i: number = 0; i < selectedElements; i++) {
|
|
2738
|
+
removeClass(getElementByID(this.selectedElementId[0]));
|
|
2739
|
+
this.selectedElementId.splice(0, 1);
|
|
2740
|
+
}
|
|
2741
|
+
if (this.legendSettings.visible) {
|
|
2742
|
+
const legendSelectedElements: number = this.legendSelectionCollection.length;
|
|
2743
|
+
for (let i: number = 0; i < legendSelectedElements; i++) {
|
|
2744
|
+
removeClass(getElementByID(this.legendSelectionCollection[i as number]['legendElement']['id']));
|
|
2745
|
+
this.selectedLegendElementId.splice(0, 1);
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
this.shapeSelectionItem = [];
|
|
2749
|
+
this.legendSelectionCollection = [];
|
|
2750
|
+
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
/**
|
|
2754
|
+
* This method is used to set culture for maps.
|
|
2755
|
+
*
|
|
2756
|
+
* @returns {void}
|
|
2757
|
+
*/
|
|
2758
|
+
private setCulture(): void {
|
|
2759
|
+
this.intl = new Internationalization();
|
|
2760
|
+
this.setLocaleConstants();
|
|
2761
|
+
this.localeObject = new L10n(this.getModuleName(), this.defaultLocalConstants, this.locale);
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
/**
|
|
2765
|
+
* This method to set locale constants to the maps.
|
|
2766
|
+
*
|
|
2767
|
+
* @returns {void}
|
|
2768
|
+
*/
|
|
2769
|
+
private setLocaleConstants(): void {
|
|
2770
|
+
// Need to modify after the api confirm
|
|
2771
|
+
this.defaultLocalConstants = {
|
|
2772
|
+
ZoomIn: 'Zoom in',
|
|
2773
|
+
Zoom: 'Zoom',
|
|
2774
|
+
ZoomOut: 'Zoom out',
|
|
2775
|
+
Pan: 'Pan',
|
|
2776
|
+
Reset: 'Reset',
|
|
2777
|
+
ImageNotFound: 'Image Not Found'
|
|
2778
|
+
};
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
/**
|
|
2782
|
+
* This method destroys the maps. This method removes the events associated with the maps and disposes the objects created for rendering and updating the maps.
|
|
2783
|
+
*
|
|
2784
|
+
* @returns {void}
|
|
2785
|
+
*/
|
|
2786
|
+
public destroy(): void {
|
|
2787
|
+
this.unWireEVents();
|
|
2788
|
+
if (!isNullOrUndefined(this.mapsTooltipModule)) {
|
|
2789
|
+
this.mapsTooltipModule.removeEventListener();
|
|
2790
|
+
}
|
|
2791
|
+
if (!isNullOrUndefined(this.zoomModule)) {
|
|
2792
|
+
this.zoomModule.removeEventListener();
|
|
2793
|
+
}
|
|
2794
|
+
if (!isNullOrUndefined(this.legendModule)) {
|
|
2795
|
+
this.legendModule.removeEventListener();
|
|
2796
|
+
}
|
|
2797
|
+
if (!isNullOrUndefined(this.selectionModule)) {
|
|
2798
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2799
|
+
this.selectionModule.removeEventListener();
|
|
2800
|
+
}
|
|
2801
|
+
if (!isNullOrUndefined(this.highlightModule)) {
|
|
2802
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2803
|
+
this.highlightModule.removeEventListener();
|
|
2804
|
+
}
|
|
2805
|
+
if (!isNullOrUndefined(this.bingMap)) {
|
|
2806
|
+
this.bingMap.destroy();
|
|
2807
|
+
}
|
|
2808
|
+
super.destroy();
|
|
2809
|
+
this.shapeSelectionItem = [];
|
|
2810
|
+
this.toggledElementId = [];
|
|
2811
|
+
this.toggledLegendId = [];
|
|
2812
|
+
this.legendSelectionCollection = [];
|
|
2813
|
+
this.selectedLegendElementId = [];
|
|
2814
|
+
this.selectedNavigationElementId = [];
|
|
2815
|
+
this.selectedBubbleElementId = [];
|
|
2816
|
+
this.selectedMarkerElementId = [];
|
|
2817
|
+
this.selectedElementId = [];
|
|
2818
|
+
this.dataLabelShape = [];
|
|
2819
|
+
this.zoomShapeCollection = [];
|
|
2820
|
+
this.zoomLabelPositions = [];
|
|
2821
|
+
this.mouseDownEvent = { x: null, y: null };
|
|
2822
|
+
this.mouseClickEvent = { x: null, y: null };
|
|
2823
|
+
this.formatFunction = null;
|
|
2824
|
+
this.localeObject = null;
|
|
2825
|
+
this.defaultLocalConstants = null;
|
|
2826
|
+
this.intl = null;
|
|
2827
|
+
this.mapAreaRect = null;
|
|
2828
|
+
this.layersCollection = null;
|
|
2829
|
+
this.themeStyle = null;
|
|
2830
|
+
this.totalRect = null;
|
|
2831
|
+
this.baseSize = null;
|
|
2832
|
+
this.baseMapBounds = null;
|
|
2833
|
+
this.baseMapRectBounds = null;
|
|
2834
|
+
this.baseTranslatePoint = null;
|
|
2835
|
+
this.baseTileTranslatePoint = null;
|
|
2836
|
+
this.markerZoomCenterPoint = null;
|
|
2837
|
+
this.currentTiles = null;
|
|
2838
|
+
this.serverProcess = null;
|
|
2839
|
+
this.toolbarProperties = null;
|
|
2840
|
+
this.zoomLabelPositions = null;
|
|
2841
|
+
this.resizeEvent = null;
|
|
2842
|
+
this.availableSize = null;
|
|
2843
|
+
if (document.getElementById('mapsmeasuretext')) {
|
|
2844
|
+
document.getElementById('mapsmeasuretext').remove();
|
|
2845
|
+
}
|
|
2846
|
+
this.removeSvg();
|
|
2847
|
+
this.svgObject = null;
|
|
2848
|
+
this.mapLayerPanel = null;
|
|
2849
|
+
this.renderer = null;
|
|
2850
|
+
this.translatePoint = null;
|
|
2851
|
+
this.tileTranslatePoint = null;
|
|
2852
|
+
this.previousPoint = null;
|
|
2853
|
+
this.dataLabelShape = [];
|
|
2854
|
+
this.zoomShapeCollection = [];
|
|
2855
|
+
this.selectedElementId = [];
|
|
2856
|
+
this.selectedMarkerElementId = [];
|
|
2857
|
+
this.selectedBubbleElementId = [];
|
|
2858
|
+
this.shapeSelectionClass = null;
|
|
2859
|
+
this.markerSelectionClass = null;
|
|
2860
|
+
this.bubbleSelectionClass = null;
|
|
2861
|
+
this.navigationSelectionClass = null;
|
|
2862
|
+
this.selectedNavigationElementId = [];
|
|
2863
|
+
this.polygonSelectionClass = null;
|
|
2864
|
+
this.selectedPolygonElementId = [];
|
|
2865
|
+
this.legendSelectionClass = null;
|
|
2866
|
+
this.previousTranslate = null;
|
|
2867
|
+
this.initialTileTranslate = null;
|
|
2868
|
+
this.markerDragArgument = null;
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
/**
|
|
2872
|
+
* Gets component name.
|
|
2873
|
+
*
|
|
2874
|
+
* @returns {string} - Returns the string value
|
|
2875
|
+
* @private
|
|
2876
|
+
*/
|
|
2877
|
+
public getModuleName(): string {
|
|
2878
|
+
return 'maps';
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
/**
|
|
2882
|
+
* Gets the properties to be maintained in the persisted state.
|
|
2883
|
+
*
|
|
2884
|
+
* @returns {string} - Returns the string value
|
|
2885
|
+
* @private
|
|
2886
|
+
*/
|
|
2887
|
+
public getPersistData(): string {
|
|
2888
|
+
const keyEntity: string[] = ['translatePoint', 'zoomSettings', 'mapScaleValue', 'tileTranslatePoint', 'baseTranslatePoint',
|
|
2889
|
+
'scale', 'zoomPersistence', 'defaultState', 'markerZoomedState', 'initialCheck', 'initialZoomLevel', 'initialTileTranslate',
|
|
2890
|
+
'applyZoomReset', 'markerZoomFactor'];
|
|
2891
|
+
return this.addOnPersist(keyEntity);
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
/**
|
|
2895
|
+
* Called internally if any of the property value changed.
|
|
2896
|
+
*
|
|
2897
|
+
* @param {MapsModel} newProp - Specifies the new property
|
|
2898
|
+
* @param {MapsModel} oldProp - Specifies the old property
|
|
2899
|
+
* @returns {void}
|
|
2900
|
+
* @private
|
|
2901
|
+
*/
|
|
2902
|
+
public onPropertyChanged(newProp: MapsModel, oldProp: MapsModel): void {
|
|
2903
|
+
if (!this.isDestroyed) {
|
|
2904
|
+
let render: boolean = false; let isMarker: boolean = false; let isLayer: boolean = false;
|
|
2905
|
+
for (const prop of Object.keys(newProp)) {
|
|
2906
|
+
switch (prop) {
|
|
2907
|
+
case 'background':
|
|
2908
|
+
this.renderBorder();
|
|
2909
|
+
break;
|
|
2910
|
+
case 'height':
|
|
2911
|
+
case 'width':
|
|
2912
|
+
case 'layers':
|
|
2913
|
+
case 'projectionType':
|
|
2914
|
+
case 'centerPosition':
|
|
2915
|
+
case 'legendSettings':
|
|
2916
|
+
case 'baseLayerIndex':
|
|
2917
|
+
if (prop === 'layers') {
|
|
2918
|
+
isLayer = true;
|
|
2919
|
+
const layerPropLength: number = Object.keys(newProp.layers).length;
|
|
2920
|
+
for (let x: number = 0; x < layerPropLength; x++) {
|
|
2921
|
+
if (!isNullOrUndefined(newProp.layers[x as number])) {
|
|
2922
|
+
const collection: string[] = Object.keys(newProp.layers[x as number]);
|
|
2923
|
+
for (const collectionProp of collection) {
|
|
2924
|
+
if ((isNullOrUndefined(this.layers[x as number].shapeData)
|
|
2925
|
+
&& !isNullOrUndefined(this.layers[x as number].urlTemplate) && this.layers[x as number].urlTemplate !== '')) {
|
|
2926
|
+
this.isReset = true;
|
|
2927
|
+
} else if (collectionProp === 'markerSettings') {
|
|
2928
|
+
isMarker = true;
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
render = true;
|
|
2935
|
+
break;
|
|
2936
|
+
case 'zoomSettings':
|
|
2937
|
+
if (!isNullOrUndefined(oldProp.zoomSettings)) {
|
|
2938
|
+
if (newProp.zoomSettings.zoomFactor !== oldProp.zoomSettings.zoomFactor && !isLayer) {
|
|
2939
|
+
render = false;
|
|
2940
|
+
} else if (newProp.zoomSettings.shouldZoomInitially !== oldProp.zoomSettings.shouldZoomInitially) {
|
|
2941
|
+
this.zoomSettings.zoomFactor = 1;
|
|
2942
|
+
this.previousProjection = null;
|
|
2943
|
+
this.scale = this.isMarkerZoomCompleted ? null : this.scale;
|
|
2944
|
+
this.isMarkerZoomCompleted = !newProp.zoomSettings.shouldZoomInitially;
|
|
2945
|
+
render = true;
|
|
2946
|
+
} else if (newProp.zoomSettings.enable !== oldProp.zoomSettings.enable) {
|
|
2947
|
+
this.zoomSettings.zoomFactor = 1;
|
|
2948
|
+
render = true;
|
|
2949
|
+
} else {
|
|
2950
|
+
render = true;
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
break;
|
|
2954
|
+
case 'locale':
|
|
2955
|
+
case 'currencyCode':
|
|
2956
|
+
super.refresh();
|
|
2957
|
+
break;
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
if (render) {
|
|
2961
|
+
if (newProp.layers && isMarker) {
|
|
2962
|
+
removeElement(this.element.id + '_Markers_Group');
|
|
2963
|
+
if (this.isTileMap) {
|
|
2964
|
+
this.mapLayerPanel.renderTileLayer(this.mapLayerPanel, this.layers['currentFactor'], (this.layers.length - 1));
|
|
2965
|
+
} else {
|
|
2966
|
+
this.render();
|
|
2967
|
+
}
|
|
2968
|
+
} else {
|
|
2969
|
+
this.createSVG();
|
|
2970
|
+
this.renderElements();
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
/**
|
|
2976
|
+
* To provide the array of modules needed for maps rendering.
|
|
2977
|
+
*
|
|
2978
|
+
* @returns {ModuleDeclaration[]} - Returns the modules
|
|
2979
|
+
* @private
|
|
2980
|
+
*/
|
|
2981
|
+
public requiredModules(): ModuleDeclaration[] {
|
|
2982
|
+
const modules: ModuleDeclaration[] = [];
|
|
2983
|
+
const isVisible: { layer: boolean, bubble: boolean, tooltip: boolean, selection: boolean, highlight: boolean } =
|
|
2984
|
+
this.findVisibleLayers(this.layers);
|
|
2985
|
+
let annotationEnable: boolean = false;
|
|
2986
|
+
this.annotations.map((annotation: Annotation) => {
|
|
2987
|
+
annotationEnable = annotation.content != null;
|
|
2988
|
+
});
|
|
2989
|
+
|
|
2990
|
+
if (this.isBubbleVisible()) {
|
|
2991
|
+
modules.push({
|
|
2992
|
+
member: 'Bubble',
|
|
2993
|
+
args: [this],
|
|
2994
|
+
name: 'Bubble'
|
|
2995
|
+
});
|
|
2996
|
+
}
|
|
2997
|
+
if (isVisible.highlight) {
|
|
2998
|
+
modules.push({
|
|
2999
|
+
member: 'Highlight',
|
|
3000
|
+
args: [this],
|
|
3001
|
+
name: 'Highlight'
|
|
3002
|
+
});
|
|
3003
|
+
}
|
|
3004
|
+
if (isVisible.selection) {
|
|
3005
|
+
modules.push({
|
|
3006
|
+
member: 'Selection',
|
|
3007
|
+
args: [this],
|
|
3008
|
+
name: 'Selection'
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
3011
|
+
if (this.legendSettings.visible) {
|
|
3012
|
+
modules.push({
|
|
3013
|
+
member: 'Legend',
|
|
3014
|
+
args: [this],
|
|
3015
|
+
name: 'Legend'
|
|
3016
|
+
});
|
|
3017
|
+
}
|
|
3018
|
+
if (this.zoomSettings.enable || this.zoomSettings.zoomFactor > this.zoomSettings.minZoom) {
|
|
3019
|
+
modules.push({
|
|
3020
|
+
member: 'Zoom',
|
|
3021
|
+
args: [this],
|
|
3022
|
+
name: 'Zoom'
|
|
3023
|
+
});
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
if (this.isMarkersVisible()) {
|
|
3027
|
+
modules.push({
|
|
3028
|
+
member: 'Marker',
|
|
3029
|
+
args: [this],
|
|
3030
|
+
name: 'Marker'
|
|
3031
|
+
});
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
|
|
3035
|
+
if (this.isDataLabelVisible()) {
|
|
3036
|
+
modules.push({
|
|
3037
|
+
member: 'DataLabel',
|
|
3038
|
+
args: [this],
|
|
3039
|
+
name: 'DataLabel'
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
if (this.isNavigationVisible()) {
|
|
3044
|
+
modules.push({
|
|
3045
|
+
member: 'NavigationLine',
|
|
3046
|
+
args: [this],
|
|
3047
|
+
name: 'NavigationLine'
|
|
3048
|
+
});
|
|
3049
|
+
}
|
|
3050
|
+
if (this.isPolygonVisible()) {
|
|
3051
|
+
modules.push({
|
|
3052
|
+
member: 'Polygon',
|
|
3053
|
+
args: [this],
|
|
3054
|
+
name: 'Polygon'
|
|
3055
|
+
});
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
if (isVisible.tooltip) {
|
|
3059
|
+
modules.push({
|
|
3060
|
+
member: 'MapsTooltip',
|
|
3061
|
+
args: [this],
|
|
3062
|
+
name: 'MapsTooltip'
|
|
3063
|
+
});
|
|
3064
|
+
}
|
|
3065
|
+
if (annotationEnable) {
|
|
3066
|
+
modules.push({
|
|
3067
|
+
member: 'Annotations',
|
|
3068
|
+
args: [this, Annotations],
|
|
3069
|
+
name: 'Annotations'
|
|
3070
|
+
});
|
|
3071
|
+
}
|
|
3072
|
+
if (this.allowPrint) {
|
|
3073
|
+
modules.push({
|
|
3074
|
+
member: 'Print',
|
|
3075
|
+
args: [this],
|
|
3076
|
+
name: 'Print'
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
if (this.allowImageExport) {
|
|
3080
|
+
modules.push({
|
|
3081
|
+
member: 'ImageExport',
|
|
3082
|
+
args: [this],
|
|
3083
|
+
name: 'ImageExport'
|
|
3084
|
+
});
|
|
3085
|
+
}
|
|
3086
|
+
if (this.allowPdfExport) {
|
|
3087
|
+
modules.push({
|
|
3088
|
+
member: 'PdfExport',
|
|
3089
|
+
args: [this],
|
|
3090
|
+
name: 'PdfExport'
|
|
3091
|
+
});
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3094
|
+
return modules;
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
/**
|
|
3098
|
+
* To find marker visibility.
|
|
3099
|
+
*
|
|
3100
|
+
* @returns {boolean} - Returns whether the markers are visible or not.
|
|
3101
|
+
*/
|
|
3102
|
+
|
|
3103
|
+
private isMarkersVisible(): boolean {
|
|
3104
|
+
let isVisible: boolean = false;
|
|
3105
|
+
Array.prototype.forEach.call(this.layers, (layer: LayerSettings) => {
|
|
3106
|
+
for (let i: number = 0; i < layer.markerSettings.length; i++) {
|
|
3107
|
+
if (layer.markerSettings[i as number].visible) {
|
|
3108
|
+
isVisible = true;
|
|
3109
|
+
break;
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
});
|
|
3113
|
+
return isVisible;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
/**
|
|
3117
|
+
* To find DataLabel visibility.
|
|
3118
|
+
*
|
|
3119
|
+
* @returns {boolean} - Returns whether the data labels are visible or not.
|
|
3120
|
+
*/
|
|
3121
|
+
|
|
3122
|
+
private isDataLabelVisible(): boolean {
|
|
3123
|
+
let isVisible: boolean = false;
|
|
3124
|
+
for (let i: number = 0; i < this.layers.length; i++) {
|
|
3125
|
+
if (this.layers[i as number].dataLabelSettings.visible) {
|
|
3126
|
+
isVisible = true;
|
|
3127
|
+
break;
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
return isVisible;
|
|
3131
|
+
}
|
|
3132
|
+
|
|
3133
|
+
/**
|
|
3134
|
+
* To find navigation line visibility.
|
|
3135
|
+
*
|
|
3136
|
+
* @returns {boolean} - Returns whether the navigation lines are visible or not.
|
|
3137
|
+
*/
|
|
3138
|
+
|
|
3139
|
+
private isNavigationVisible(): boolean {
|
|
3140
|
+
let isVisible: boolean = false;
|
|
3141
|
+
Array.prototype.forEach.call(this.layers, (layer: LayerSettings) => {
|
|
3142
|
+
for (let i: number = 0; i < layer.navigationLineSettings.length; i++) {
|
|
3143
|
+
if (layer.navigationLineSettings[i as number].visible) {
|
|
3144
|
+
isVisible = true;
|
|
3145
|
+
break;
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
});
|
|
3149
|
+
return isVisible;
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
/**
|
|
3153
|
+
* To find navigation line visibility.
|
|
3154
|
+
*
|
|
3155
|
+
* @returns {boolean} - Returns whether the navigation lines are visible or not.
|
|
3156
|
+
*/
|
|
3157
|
+
private isPolygonVisible(): boolean {
|
|
3158
|
+
let isVisible: boolean = false;
|
|
3159
|
+
Array.prototype.forEach.call(this.layers, (layer: LayerSettings) => {
|
|
3160
|
+
for (let i: number = 0; i < layer.polygonSettings.polygons.length; i++) {
|
|
3161
|
+
if (layer.polygonSettings.polygons.length > 0) {
|
|
3162
|
+
isVisible = true;
|
|
3163
|
+
break;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
});
|
|
3167
|
+
return isVisible;
|
|
3168
|
+
}
|
|
3169
|
+
|
|
3170
|
+
/**
|
|
3171
|
+
* To find marker visibility.
|
|
3172
|
+
*
|
|
3173
|
+
* @returns {boolean} - Returns whether the bubble is visible or not.
|
|
3174
|
+
*/
|
|
3175
|
+
|
|
3176
|
+
private isBubbleVisible(): boolean {
|
|
3177
|
+
let isVisible: boolean = false;
|
|
3178
|
+
for (const layer of this.layers) {
|
|
3179
|
+
if (this.getBubbleVisible(layer)) {
|
|
3180
|
+
isVisible = true;
|
|
3181
|
+
break;
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
return isVisible;
|
|
3185
|
+
}
|
|
3186
|
+
/**
|
|
3187
|
+
* To find the bubble visibility from layer.
|
|
3188
|
+
*
|
|
3189
|
+
* @param {LayerSettingsModel} layer - Spcifies the layer settings model
|
|
3190
|
+
* @returns {boolean} - Returns the boolean value
|
|
3191
|
+
* @private
|
|
3192
|
+
*/
|
|
3193
|
+
public getBubbleVisible(layer: LayerSettingsModel): boolean {
|
|
3194
|
+
let isVisible: boolean = false;
|
|
3195
|
+
for (const bubble of layer.bubbleSettings) {
|
|
3196
|
+
if (bubble.visible) {
|
|
3197
|
+
isVisible = true;
|
|
3198
|
+
break;
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
return isVisible;
|
|
3202
|
+
}
|
|
3203
|
+
/**
|
|
3204
|
+
* This method handles the printing functionality for the maps.
|
|
3205
|
+
*
|
|
3206
|
+
* @param {string[] | string | Element} id - Specifies the element to be printed.
|
|
3207
|
+
* @returns {void}
|
|
3208
|
+
*/
|
|
3209
|
+
public print(id?: string[] | string | Element): void {
|
|
3210
|
+
if ((this.allowPrint) && (this.printModule) && !this.isDestroyed) {
|
|
3211
|
+
this.printModule.print(this, id);
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
/**
|
|
3215
|
+
* This method handles the export functionality for the maps.
|
|
3216
|
+
*
|
|
3217
|
+
* @param {ExportType} type - Specifies the type of the exported file.
|
|
3218
|
+
* @param {string} fileName - Specifies the name of the file with which the rendered maps need to be exported.
|
|
3219
|
+
* @param {PdfPageOrientation} orientation - Specifies the orientation of the PDF document while exporting.
|
|
3220
|
+
* @param {boolean} allowDownload - Specifies whether to download as a file or get as base64 string for the file.
|
|
3221
|
+
* @returns {Promise<string>} - Specifies the base64 string of the exported image which is returned when the `allowDownload` is set to false.
|
|
3222
|
+
*/
|
|
3223
|
+
public export(type: ExportType, fileName: string, orientation?: PdfPageOrientation, allowDownload?: boolean): Promise<string> {
|
|
3224
|
+
if (!this.isDestroyed) {
|
|
3225
|
+
if (isNullOrUndefined(allowDownload)) {
|
|
3226
|
+
allowDownload = true;
|
|
3227
|
+
}
|
|
3228
|
+
if ((type !== 'PDF') && (this.allowImageExport) && (this.imageExportModule)) {
|
|
3229
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3230
|
+
return new Promise((resolve: any) => {
|
|
3231
|
+
resolve(this.imageExportModule.export(this, type, fileName, allowDownload));
|
|
3232
|
+
});
|
|
3233
|
+
} else if ((this.allowPdfExport) && (this.pdfExportModule)) {
|
|
3234
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3235
|
+
return new Promise((resolve: any) => {
|
|
3236
|
+
resolve(this.pdfExportModule.export(this, type, fileName, allowDownload, orientation));
|
|
3237
|
+
});
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
return null;
|
|
3241
|
+
}
|
|
3242
|
+
|
|
3243
|
+
/**
|
|
3244
|
+
* This method is used to get the Bing maps URL.
|
|
3245
|
+
*
|
|
3246
|
+
* @param {string} url - Specifies the URL of the Bing maps along with the API key.
|
|
3247
|
+
* @returns {Promise<string>} - Returns the processed Bing URL as `Promise`.
|
|
3248
|
+
*/
|
|
3249
|
+
public getBingUrlTemplate(url: string): Promise<string> {
|
|
3250
|
+
let promise: Promise<string>;
|
|
3251
|
+
if (!this.isDestroyed) {
|
|
3252
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3253
|
+
promise = new Promise((resolve: any) => {
|
|
3254
|
+
const fetchApi : Fetch = new Fetch({
|
|
3255
|
+
url: url
|
|
3256
|
+
}); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3257
|
+
fetchApi.onSuccess = (json: any) => {
|
|
3258
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3259
|
+
const resource: any = json['resourceSets'][0]['resources'][0];
|
|
3260
|
+
resolve(<string>resource['imageUrl']);
|
|
3261
|
+
};
|
|
3262
|
+
fetchApi.send();
|
|
3263
|
+
});
|
|
3264
|
+
}
|
|
3265
|
+
return promise;
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3268
|
+
/**
|
|
3269
|
+
* To find visibility of layers and markers for required modules load.
|
|
3270
|
+
*
|
|
3271
|
+
* @param {LayerSettingsModel[]} layers - Specifies the layers.
|
|
3272
|
+
* @param {boolean} isLayerVisible - Specifies whether the layer is visible or not.
|
|
3273
|
+
* @param {boolean} isBubblevisible - Specifies whether the bubble is visible or not.
|
|
3274
|
+
* @param {boolean} istooltipVisible - Specifies whether the tooltip is visible or not.
|
|
3275
|
+
* @param {boolean} isSelection - Specifies whether the shape is selectd or not.
|
|
3276
|
+
* @param {boolean} isHighlight - Specfies whether the shape is highlighted or not.
|
|
3277
|
+
* @returns {object} - Returns the boolean values in object.
|
|
3278
|
+
*/
|
|
3279
|
+
private findVisibleLayers(
|
|
3280
|
+
layers: LayerSettingsModel[], isLayerVisible: boolean = false,
|
|
3281
|
+
isBubblevisible: boolean = false, istooltipVisible: boolean = false, isSelection: boolean = false,
|
|
3282
|
+
isHighlight: boolean = false
|
|
3283
|
+
): { layer: boolean, bubble: boolean, tooltip: boolean, selection: boolean, highlight: boolean } {
|
|
3284
|
+
let bubbles: BubbleSettingsModel[];
|
|
3285
|
+
let markers: MarkerSettingsModel[];
|
|
3286
|
+
let polygonSetting: PolygonSettingsModel;
|
|
3287
|
+
for (const layer of layers) {
|
|
3288
|
+
isLayerVisible = layer.visible || isLayerVisible;
|
|
3289
|
+
if (layer.visible) {
|
|
3290
|
+
bubbles = layer.bubbleSettings;
|
|
3291
|
+
markers = layer.markerSettings;
|
|
3292
|
+
polygonSetting = layer.polygonSettings;
|
|
3293
|
+
const navigationLine: NavigationLineSettingsModel[] = layer.navigationLineSettings;
|
|
3294
|
+
for (const navigation of navigationLine) {
|
|
3295
|
+
if (navigation.visible) {
|
|
3296
|
+
isSelection = (!isNullOrUndefined(navigation.highlightSettings) &&
|
|
3297
|
+
navigation.highlightSettings.enable) || isSelection;
|
|
3298
|
+
isHighlight = (!isNullOrUndefined(navigation.selectionSettings) &&
|
|
3299
|
+
navigation.selectionSettings.enable) || isHighlight;
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
for (const polygon of polygonSetting.polygons) {
|
|
3303
|
+
if (!isNullOrUndefined(polygon.points) && polygon.points.length > 0) {
|
|
3304
|
+
isSelection = layer.polygonSettings.highlightSettings.enable || isSelection;
|
|
3305
|
+
isHighlight = layer.polygonSettings.selectionSettings.enable || isHighlight;
|
|
3306
|
+
istooltipVisible = layer.polygonSettings.tooltipSettings.visible || istooltipVisible;
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3309
|
+
for (const marker of markers) {
|
|
3310
|
+
if (marker.visible) {
|
|
3311
|
+
istooltipVisible = marker.tooltipSettings.visible || istooltipVisible;
|
|
3312
|
+
isSelection = marker.selectionSettings.enable || isSelection;
|
|
3313
|
+
isHighlight = marker.highlightSettings.enable || isHighlight;
|
|
3314
|
+
}
|
|
3315
|
+
if (istooltipVisible) { break; }
|
|
3316
|
+
}
|
|
3317
|
+
for (const bubble of bubbles) {
|
|
3318
|
+
if (bubble.visible) {
|
|
3319
|
+
istooltipVisible = bubble.tooltipSettings.visible || istooltipVisible;
|
|
3320
|
+
isSelection = bubble.selectionSettings.enable || isSelection;
|
|
3321
|
+
isHighlight = bubble.highlightSettings.enable || isHighlight;
|
|
3322
|
+
}
|
|
3323
|
+
if (istooltipVisible) { break; }
|
|
3324
|
+
}
|
|
3325
|
+
istooltipVisible = layer.tooltipSettings.visible || istooltipVisible;
|
|
3326
|
+
isSelection = layer.selectionSettings.enable || isSelection;
|
|
3327
|
+
isHighlight = layer.highlightSettings.enable || isHighlight;
|
|
3328
|
+
}
|
|
3329
|
+
if (isLayerVisible && isBubblevisible && istooltipVisible) { break; }
|
|
3330
|
+
}
|
|
3331
|
+
return {
|
|
3332
|
+
layer: isLayerVisible, bubble: isBubblevisible, tooltip: istooltipVisible,
|
|
3333
|
+
selection: isSelection, highlight: isHighlight
|
|
3334
|
+
};
|
|
3335
|
+
}
|
|
3336
|
+
/**
|
|
3337
|
+
* This method is used to get the geographical coordinates for location points in pixels when shape maps are rendered in the maps.
|
|
3338
|
+
*
|
|
3339
|
+
* @param {number} layerIndex - Specifies the index number of the layer of the maps.
|
|
3340
|
+
* @param {number} x - Specifies the x value in pixel.
|
|
3341
|
+
* @param {number} y - Specifies the y value in pixel.
|
|
3342
|
+
* @returns {GeoPosition}- Returns the geographical coordinates.
|
|
3343
|
+
*/
|
|
3344
|
+
public getGeoLocation(layerIndex: number, x: number, y: number): GeoPosition {
|
|
3345
|
+
let latitude: number = null;
|
|
3346
|
+
let longitude: number = null;
|
|
3347
|
+
if (!this.isDestroyed && !this.isTileMap) {
|
|
3348
|
+
const container: HTMLElement = document.getElementById(this.element.id);
|
|
3349
|
+
const elementClientRect: ClientRect = this.element.getBoundingClientRect();
|
|
3350
|
+
const pageX: number = x - container.offsetLeft - (elementClientRect.left - container.offsetLeft) - window.scrollX;
|
|
3351
|
+
const pageY: number = y - container.offsetTop - (elementClientRect.top - container.offsetTop) - window.scrollY;
|
|
3352
|
+
const currentLayer: LayerSettings = <LayerSettings>this.layersCollection[layerIndex as number];
|
|
3353
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3354
|
+
const translate: any = getTranslate(this, currentLayer, false);
|
|
3355
|
+
const translatePoint: Point = translate['location'] as Point;
|
|
3356
|
+
const translatePointX: number = translatePoint.x * this.scale;
|
|
3357
|
+
const translatePointY: number = translatePoint.y * this.scale;
|
|
3358
|
+
const mapSize: number = (Math.min(this.mapAreaRect.height, this.mapAreaRect.width)
|
|
3359
|
+
* this.mapLayerPanel['currentFactor']) * this.scale;
|
|
3360
|
+
const xx: number = (this.clip(pageX - translatePointX, 0, mapSize - 1) / mapSize) - 0.5;
|
|
3361
|
+
const yy: number = 0.5 - (this.clip(pageY - translatePointY, 0, mapSize - 1) / mapSize);
|
|
3362
|
+
latitude = 90 - 360 * Math.atan(Math.exp(-yy * 2 * Math.PI)) / Math.PI;
|
|
3363
|
+
longitude = 360 * xx;
|
|
3364
|
+
}
|
|
3365
|
+
return { latitude: latitude, longitude: longitude };
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
private clip(value: number, minVal: number, maxVal: number): number {
|
|
3369
|
+
return Math.min(Math.max(value, minVal), maxVal);
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
/**
|
|
3373
|
+
* This method is used to get the geographical coordinates for location points in pixels when an online map provider is rendered in the maps.
|
|
3374
|
+
*
|
|
3375
|
+
* @param {number} x - Specifies the x value in pixel.
|
|
3376
|
+
* @param {number} y - Specifies the y value in pixel.
|
|
3377
|
+
* @returns {GeoPosition} - Returns the geographical coordinates.
|
|
3378
|
+
*/
|
|
3379
|
+
public getTileGeoLocation(x: number, y: number): GeoPosition {
|
|
3380
|
+
let latitude: number = null;
|
|
3381
|
+
let longitude: number = null;
|
|
3382
|
+
if (this.isTileMap) {
|
|
3383
|
+
const element: HTMLElement = document.getElementById(this.element.id + '_tile_parent');
|
|
3384
|
+
if (!this.isDestroyed && !isNullOrUndefined(element)) {
|
|
3385
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3386
|
+
const latLong: any = this.pointToLatLong(
|
|
3387
|
+
x + this.mapAreaRect.x - element.offsetLeft,
|
|
3388
|
+
y + this.mapAreaRect.y - element.offsetTop);
|
|
3389
|
+
latitude = latLong['latitude'];
|
|
3390
|
+
longitude = latLong['longitude'];
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
return { latitude: latitude, longitude: longitude };
|
|
3394
|
+
}
|
|
3395
|
+
/**
|
|
3396
|
+
* This method is used to convert the point in pixels to latitude and longitude in maps.
|
|
3397
|
+
*
|
|
3398
|
+
* @param {number} pageX - Specifies the x position value in pixels.
|
|
3399
|
+
* @param {number} pageY - Specifies the y position value in pixels.
|
|
3400
|
+
* @returns {object} - Returns the latitude and longitude values.
|
|
3401
|
+
*/
|
|
3402
|
+
public pointToLatLong(pageX: number, pageY: number): Object {
|
|
3403
|
+
let latitude: number = 0;
|
|
3404
|
+
let longitude: number = 0;
|
|
3405
|
+
if (!this.isDestroyed && !isNullOrUndefined(this.translatePoint)) {
|
|
3406
|
+
const padding: number = 10;
|
|
3407
|
+
pageY = !isNullOrUndefined(this.markerDragArgument) ? pageY + padding : pageY;
|
|
3408
|
+
const mapSize: number = 256 * Math.pow(2, this.tileZoomLevel);
|
|
3409
|
+
const x1: number = (this.clip(pageX - (this.translatePoint.x * this.scale), 0, mapSize - 1) / mapSize) - 0.5;
|
|
3410
|
+
const y1: number = 0.5 - (this.clip(pageY - (this.translatePoint.y * this.scale), 0, mapSize - 1) / mapSize);
|
|
3411
|
+
latitude = 90 - 360 * Math.atan(Math.exp(-y1 * 2 * Math.PI)) / Math.PI;
|
|
3412
|
+
longitude = 360 * x1;
|
|
3413
|
+
}
|
|
3414
|
+
return { latitude: latitude, longitude: longitude };
|
|
3415
|
+
}
|
|
3416
|
+
}
|