@syncfusion/ej2-maps 19.4.56 → 19.4.57-105067

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/.eslintrc.json +18 -3
  2. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +72 -72
  3. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +49 -49
  4. package/CHANGELOG.md +441 -439
  5. package/README.md +73 -73
  6. package/dist/ej2-maps.umd.min.js +1 -10
  7. package/dist/ej2-maps.umd.min.js.map +1 -1
  8. package/dist/es6/ej2-maps.es2015.js +1161 -638
  9. package/dist/es6/ej2-maps.es2015.js.map +1 -1
  10. package/dist/es6/ej2-maps.es5.js +1200 -678
  11. package/dist/es6/ej2-maps.es5.js.map +1 -1
  12. package/dist/global/ej2-maps.min.js +1 -10
  13. package/dist/global/ej2-maps.min.js.map +1 -1
  14. package/dist/global/index.d.ts +0 -9
  15. package/dist/ts/maps/layers/bing-map.ts +50 -0
  16. package/dist/ts/maps/layers/bubble.ts +290 -0
  17. package/dist/ts/maps/layers/color-mapping.ts +226 -0
  18. package/dist/ts/maps/layers/data-label.ts +418 -0
  19. package/dist/ts/maps/layers/layer-panel.ts +1480 -0
  20. package/dist/ts/maps/layers/legend.ts +2236 -0
  21. package/dist/ts/maps/layers/marker.ts +453 -0
  22. package/dist/ts/maps/layers/navigation-selected-line.ts +167 -0
  23. package/dist/ts/maps/maps.ts +2886 -0
  24. package/dist/ts/maps/model/base.ts +1843 -0
  25. package/dist/ts/maps/model/constants.ts +200 -0
  26. package/dist/ts/maps/model/export-image.ts +178 -0
  27. package/dist/ts/maps/model/export-pdf.ts +170 -0
  28. package/dist/ts/maps/model/interface.ts +823 -0
  29. package/dist/ts/maps/model/print.ts +104 -0
  30. package/dist/ts/maps/model/theme.ts +554 -0
  31. package/dist/ts/maps/user-interaction/annotation.ts +127 -0
  32. package/dist/ts/maps/user-interaction/highlight.ts +233 -0
  33. package/dist/ts/maps/user-interaction/selection.ts +321 -0
  34. package/dist/ts/maps/user-interaction/tooltip.ts +387 -0
  35. package/dist/ts/maps/user-interaction/zoom.ts +1767 -0
  36. package/dist/ts/maps/utils/enum.ts +368 -0
  37. package/dist/ts/maps/utils/helper.ts +3421 -0
  38. package/helper/e2e/index.js +3 -3
  39. package/helper/e2e/maps-helper.js +13 -13
  40. package/license +9 -9
  41. package/package.json +85 -85
  42. package/src/maps/layers/bing-map.d.ts +4 -0
  43. package/src/maps/layers/bing-map.js +16 -3
  44. package/src/maps/layers/bubble.d.ts +1 -2
  45. package/src/maps/layers/bubble.js +7 -12
  46. package/src/maps/layers/data-label.d.ts +1 -4
  47. package/src/maps/layers/data-label.js +32 -35
  48. package/src/maps/layers/layer-panel.d.ts +18 -1
  49. package/src/maps/layers/layer-panel.js +226 -72
  50. package/src/maps/layers/legend.d.ts +5 -2
  51. package/src/maps/layers/legend.js +170 -61
  52. package/src/maps/layers/marker.d.ts +2 -4
  53. package/src/maps/layers/marker.js +49 -48
  54. package/src/maps/layers/navigation-selected-line.d.ts +1 -2
  55. package/src/maps/layers/navigation-selected-line.js +7 -13
  56. package/src/maps/maps-model.d.ts +259 -251
  57. package/src/maps/maps.d.ts +24 -3
  58. package/src/maps/maps.js +152 -90
  59. package/src/maps/model/base-model.d.ts +1025 -1021
  60. package/src/maps/model/base.d.ts +5 -1
  61. package/src/maps/model/base.js +24 -24
  62. package/src/maps/model/constants.d.ts +6 -0
  63. package/src/maps/model/constants.js +6 -0
  64. package/src/maps/model/export-image.d.ts +2 -4
  65. package/src/maps/model/export-image.js +26 -32
  66. package/src/maps/model/export-pdf.d.ts +4 -6
  67. package/src/maps/model/export-pdf.js +27 -35
  68. package/src/maps/model/interface.d.ts +34 -26
  69. package/src/maps/model/print.d.ts +2 -5
  70. package/src/maps/model/print.js +33 -21
  71. package/src/maps/model/theme.js +7 -4
  72. package/src/maps/user-interaction/annotation.d.ts +1 -2
  73. package/src/maps/user-interaction/annotation.js +3 -4
  74. package/src/maps/user-interaction/highlight.d.ts +1 -2
  75. package/src/maps/user-interaction/highlight.js +11 -10
  76. package/src/maps/user-interaction/selection.d.ts +1 -2
  77. package/src/maps/user-interaction/selection.js +42 -19
  78. package/src/maps/user-interaction/tooltip.d.ts +3 -5
  79. package/src/maps/user-interaction/tooltip.js +27 -14
  80. package/src/maps/user-interaction/zoom.d.ts +3 -8
  81. package/src/maps/user-interaction/zoom.js +282 -162
  82. package/src/maps/utils/enum.d.ts +5 -1
  83. package/src/maps/utils/helper.d.ts +1 -1
  84. package/src/maps/utils/helper.js +62 -31
@@ -0,0 +1,200 @@
1
+ /**
2
+ * Maps constants doc
3
+ */
4
+
5
+ /**
6
+ * Specifies the maps load event name.
7
+ *
8
+ * @private
9
+ */
10
+ export const load: string = 'load';
11
+ /**
12
+ * Specifies the maps loaded event name.
13
+ *
14
+ * @private
15
+ */
16
+ export const loaded: string = 'loaded';
17
+ /**
18
+ * Specifies the maps click event name.
19
+ *
20
+ * @private
21
+ */
22
+ export const click: string = 'click';
23
+ /**
24
+ * Specifies the maps onclick event name.
25
+ *
26
+ * @private
27
+ */
28
+ export const onclick: string = 'onclick';
29
+ /**
30
+ * Specifies the maps right click event name.
31
+ *
32
+ * @private
33
+ */
34
+ export const rightClick: string = 'rightClick';
35
+ /**
36
+ * Specifies the maps double click event name.
37
+ *
38
+ * @private
39
+ */
40
+ export const doubleClick: string = 'doubleClick';
41
+ /**
42
+ * Specifies the maps resize event name.
43
+ *
44
+ * @private
45
+ */
46
+ export const resize: string = 'resize';
47
+ /**
48
+ * Specifies the maps tooltip event name.
49
+ *
50
+ */
51
+ export const tooltipRender: string = 'tooltipRender';
52
+ /**
53
+ * Specifies the map shape selected event.
54
+ *
55
+ */
56
+ export const shapeSelected: string = 'shapeSelected';
57
+ /**
58
+ * Specifies the maps shape highlight event.
59
+ *
60
+ */
61
+ export const shapeHighlight: string = 'shapeHighlight';
62
+ /**
63
+ * Specifies the maps mouse move event name.
64
+ *
65
+ * @private
66
+ */
67
+ export const mousemove: string = 'mousemove';
68
+ /**
69
+ * Specifies the maps mouse up event name.
70
+ *
71
+ * @private
72
+ */
73
+ export const mouseup: string = 'mouseup';
74
+ /**
75
+ * Specifies the maps mouse down event name.
76
+ *
77
+ * @private
78
+ */
79
+ export const mousedown: string = 'mousedown';
80
+ /**
81
+ * Specifies the maps layer rendering event name.
82
+ *
83
+ * @private
84
+ */
85
+ export const layerRendering: string = 'layerRendering';
86
+ /**
87
+ * Specifies the maps shape rendering event name.
88
+ *
89
+ * @private
90
+ */
91
+ export const shapeRendering: string = 'shapeRendering';
92
+ /**
93
+ * Specifies the maps marker rendering event name.
94
+ *
95
+ * @private
96
+ */
97
+ export const markerRendering: string = 'markerRendering';
98
+ /**
99
+ * Specifies the maps cluster rendering event name.
100
+ *
101
+ * @private
102
+ */
103
+ export const markerClusterRendering: string = 'markerClusterRendering';
104
+ /**
105
+ * Specifies the maps marker click event name.
106
+ *
107
+ * @private
108
+ */
109
+ export const markerClick: string = 'markerClick';
110
+ /**
111
+ * Specifies the maps cluster click event name.
112
+ *
113
+ * @private
114
+ */
115
+ export const markerClusterClick: string = 'markerClusterClick';
116
+ /**
117
+ * Specifies the maps marker mouse move event name.
118
+ *
119
+ * @private
120
+ */
121
+ export const markerMouseMove: string = 'markerMouseMove';
122
+ /**
123
+ * Specifies the maps cluster mouse move event name.
124
+ *
125
+ * @private
126
+ */
127
+ export const markerClusterMouseMove: string = 'markerClusterMouseMove';
128
+ /**
129
+ * Specifies the maps data label rendering event name.
130
+ *
131
+ * @private
132
+ */
133
+ export const dataLabelRendering: string = 'dataLabelRendering';
134
+ /**
135
+ * Specifies the maps bubbleRendering event name.
136
+ *
137
+ * @private
138
+ */
139
+ export const bubbleRendering: string = 'bubbleRendering';
140
+ /**
141
+ * Specifies the maps bubble click event name.
142
+ *
143
+ * @private
144
+ */
145
+ export const bubbleClick: string = 'bubbleClick';
146
+ /**
147
+ * Specifies the maps bubble mouse move event name.
148
+ *
149
+ * @private
150
+ */
151
+ export const bubbleMouseMove: string = 'bubbleMouseMove';
152
+ /**
153
+ * Specifies the maps animation complete event name.
154
+ *
155
+ * @private
156
+ */
157
+ export const animationComplete: string = 'animationComplete';
158
+ /**
159
+ * Specifies the maps legend rendering event name.
160
+ *
161
+ * @private
162
+ */
163
+ export const legendRendering: string = 'legendRendering';
164
+ /**
165
+ * Specifies the maps annotation rendering event name.
166
+ *
167
+ * @private
168
+ */
169
+ export const annotationRendering: string = 'annotationRendering';
170
+ /**
171
+ * Specifies the maps item selection event name.
172
+ *
173
+ * @private
174
+ */
175
+ export const itemSelection: string = 'itemSelection';
176
+ /**
177
+ * Specifies the maps item highlight event name.
178
+ *
179
+ */
180
+ export const itemHighlight: string = 'itemHighlight';
181
+ /**
182
+ * Specifies the maps before print event name.
183
+ *
184
+ */
185
+ export const beforePrint: string = 'beforePrint';
186
+ /**
187
+ * Specifies the maps zoom in event name.
188
+ *
189
+ */
190
+ export const zoomIn: string = 'zoomIn';
191
+ /**
192
+ * Specifies the maps zoom out event name.
193
+ *
194
+ */
195
+ export const zoomOut: string = 'zoomOut';
196
+ /**
197
+ * Specifies the maps pan event name.
198
+ *
199
+ */
200
+ export const pan: string = 'pan';
@@ -0,0 +1,178 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ import { createElement, Browser, isNullOrUndefined } from '@syncfusion/ej2-base';
3
+ import { Maps } from '../../index';
4
+ import { triggerDownload, getElementByID } from '../utils/helper';
5
+ import { ExportType } from '../utils/enum';
6
+
7
+ /**
8
+ * This module enables the export to Image functionality in Maps control.
9
+ *
10
+ * @hidden
11
+ */
12
+ export class ImageExport {
13
+
14
+ /**
15
+ * Constructor for Maps
16
+ *
17
+ * @param {Maps} control - Specifies the instance of the map
18
+ */
19
+ constructor(control: Maps) {
20
+ }
21
+ /**
22
+ * To export the file as image/svg format
23
+ *
24
+ * @param {ExportType} type - Specifies the type of the image file
25
+ * @param {string} fileName - Specifies the file name of the image file
26
+ * @param {boolean} allowDownload - Specifies whether to download image as a file or not.
27
+ * @returns {Promise<string>} - Returns the promise string.
28
+ * @private
29
+ */
30
+ public export(maps: Maps, type: ExportType, fileName: string, allowDownload?: boolean): Promise<string> {
31
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
+ const promise: Promise<string> = new Promise((resolve: any, reject: any) => {
33
+ const imageCanvasElement: HTMLCanvasElement = <HTMLCanvasElement>createElement('canvas', {
34
+ id: 'ej2-canvas',
35
+ attrs: {
36
+ 'width': maps.availableSize.width.toString(),
37
+ 'height': maps.availableSize.height.toString()
38
+ }
39
+ });
40
+ const isDownload: boolean = !(Browser.userAgent.toString().indexOf('HeadlessChrome') > -1);
41
+ const toolbarEle: HTMLElement = document.getElementById(maps.element.id + '_ToolBar');
42
+ const svgParent: HTMLElement = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
43
+ let svgDataElement: string;
44
+ let tileSvg: Element;
45
+ let svgObject: Element = getElementByID(maps.element.id + '_svg').cloneNode(true) as Element;
46
+ if (!maps.isTileMap) {
47
+ svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
48
+ maps.svgObject.outerHTML + '</svg>';
49
+ } else {
50
+ tileSvg = getElementByID(maps.element.id + '_Tile_SVG').cloneNode(true) as Element;
51
+ svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
52
+ svgObject.outerHTML + tileSvg.outerHTML + '</svg>';
53
+ }
54
+ const url: string = window.URL.createObjectURL(
55
+ new Blob(
56
+ type === 'SVG' ? [svgDataElement] :
57
+ [(new XMLSerializer()).serializeToString(svgObject)],
58
+ { type: 'image/svg+xml' }
59
+ )
60
+ );
61
+ if (type === 'SVG') {
62
+ if (allowDownload) {
63
+ triggerDownload(
64
+ fileName, type,
65
+ url, isDownload
66
+ );
67
+ } else {
68
+ resolve(null);
69
+ }
70
+ } else {
71
+ const image: HTMLImageElement = new Image();
72
+ const ctxt: CanvasRenderingContext2D = imageCanvasElement.getContext('2d');
73
+ if (!maps.isTileMap) {
74
+ image.onload = (() => {
75
+ ctxt.drawImage(image, 0, 0);
76
+ window.URL.revokeObjectURL(url);
77
+ if (allowDownload) {
78
+ triggerDownload(
79
+ fileName, type, imageCanvasElement.toDataURL('image/png').replace('image/png', 'image/octet-stream'),
80
+ isDownload
81
+ );
82
+ } else {
83
+ if (type === 'PNG') {
84
+ resolve(imageCanvasElement.toDataURL('image/png'));
85
+ } else if (type === 'JPEG') {
86
+ resolve(imageCanvasElement.toDataURL('image/jpeg'));
87
+ }
88
+ }
89
+ });
90
+ image.src = url;
91
+ } else {
92
+ const svgParentElement: HTMLElement = document.getElementById(maps.element.id + '_MapAreaBorder');
93
+ let top: number = parseFloat(svgParentElement.getAttribute('y'));
94
+ let left: number = parseFloat(svgParentElement.getAttribute('x'));
95
+ const imgxHttp: XMLHttpRequest = new XMLHttpRequest();
96
+ const imgTileLength: number = maps.mapLayerPanel.tiles.length;
97
+ for (let i: number = 0; i <= imgTileLength + 1; i++) {
98
+ const tile: HTMLElement = document.getElementById(maps.element.id + '_tile_' + (i - 1));
99
+ const exportTileImg: HTMLImageElement = new Image();
100
+ exportTileImg.crossOrigin = 'Anonymous';
101
+ ctxt.fillStyle = maps.background ? maps.background : '#FFFFFF';
102
+ ctxt.fillRect(0, 0, maps.availableSize.width, maps.availableSize.height);
103
+ ctxt.font = maps.titleSettings.textStyle.size + ' Arial';
104
+ let titleElement: HTMLElement = document.getElementById(maps.element.id + '_Map_title');
105
+ if (!isNullOrUndefined(titleElement)) {
106
+ ctxt.fillStyle = titleElement.getAttribute('fill');
107
+ ctxt.fillText(
108
+ maps.titleSettings.text, parseFloat(titleElement.getAttribute('x')),
109
+ parseFloat(titleElement.getAttribute('y'))
110
+ );
111
+ }
112
+ exportTileImg.onload = (() => {
113
+ if (i === 0 || i === imgTileLength + 1) {
114
+ if (i === 0) {
115
+ ctxt.setTransform(1, 0, 0, 1, 0, 0);
116
+ ctxt.rect(0, top, parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
117
+ ctxt.clip();
118
+ } else {
119
+ ctxt.setTransform(1, 0, 0, 1, left, top);
120
+ }
121
+ } else {
122
+ ctxt.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left, parseFloat(tile.style.top) +
123
+ top);
124
+ }
125
+ ctxt.drawImage(exportTileImg, 0, 0);
126
+ if (i === imgTileLength + 1) {
127
+ localStorage.setItem('local-canvasImage', imageCanvasElement.toDataURL('image/png'));
128
+ const localBase64: string = localStorage.getItem('local-canvasImage');
129
+ if (allowDownload) {
130
+ triggerDownload(fileName, type, localBase64, isDownload);
131
+ localStorage.removeItem('local-canvasImage');
132
+ } else {
133
+ if (type === 'PNG') {
134
+ resolve(localBase64);
135
+ } else if (type === 'JPEG') {
136
+ resolve(imageCanvasElement.toDataURL('image/jpeg'));
137
+ }
138
+ }
139
+ }
140
+ });
141
+ if (i === 0 || i === imgTileLength + 1) {
142
+ if (i === 0) {
143
+ exportTileImg.src = url;
144
+ } else {
145
+ setTimeout(() => {
146
+ exportTileImg.src = window.URL.createObjectURL(new Blob(
147
+ [(new XMLSerializer()).serializeToString(tileSvg)],
148
+ { type: 'image/svg+xml' }));
149
+ }, 300);
150
+ }
151
+ } else {
152
+ imgxHttp.open('GET', tile.children[0].getAttribute('src'), true);
153
+ imgxHttp.send();
154
+ exportTileImg.src = tile.children[0].getAttribute('src');
155
+ }
156
+ }
157
+ }
158
+ }
159
+ });
160
+ return promise;
161
+ }
162
+ /**
163
+ * Get module name.
164
+ *
165
+ * @returns {string} - Returns the module name
166
+ */
167
+ protected getModuleName(): string {
168
+ return 'ImageExport';
169
+ }
170
+
171
+ /**
172
+ * To destroy the ImageExport.
173
+ *
174
+ * @returns {void}
175
+ * @private
176
+ */
177
+ public destroy(): void { }
178
+ }
@@ -0,0 +1,170 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ import { createElement, isNullOrUndefined} from '@syncfusion/ej2-base';
3
+ import { Maps } from '../../index';
4
+ import { ExportType } from '../utils/enum';
5
+ import { PdfPageOrientation, PdfDocument, PdfBitmap } from '@syncfusion/ej2-pdf-export';
6
+
7
+
8
+ /**
9
+ * This module enables the export to PDF functionality in Maps control.
10
+ *
11
+ * @hidden
12
+ */
13
+ export class PdfExport {
14
+
15
+ /**
16
+ * Constructor for Maps
17
+ *
18
+ * @param {Maps} control Specifies the instance of the map
19
+ */
20
+ constructor() { }
21
+
22
+ /**
23
+ * To export the file as image/svg format
24
+ *
25
+ * @param {ExportType} type - Specifies the type of the document
26
+ * @param {string} fileName - Specifies the file name of the document
27
+ * @param {boolean} allowDownload - Specifies whether to download the document or not
28
+ * @param {PdfPageOrientation} orientation - Specifies the orientation of the PDF document to export the component
29
+ * @returns {Promise<string>} - Returns the promise string
30
+ * @private
31
+ */
32
+ public export(maps: Maps, type: ExportType, fileName: string, allowDownload?: boolean, orientation?: PdfPageOrientation): Promise<string> {
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ const promise: Promise<string> = new Promise((resolve: any, reject: any) => {
35
+ const canvasElement: HTMLCanvasElement = <HTMLCanvasElement>createElement('canvas', {
36
+ id: 'ej2-canvas',
37
+ attrs: {
38
+ 'width': maps.availableSize.width.toString(),
39
+ 'height': maps.availableSize.height.toString()
40
+ }
41
+ });
42
+ orientation = isNullOrUndefined(orientation) ? PdfPageOrientation.Landscape : orientation;
43
+ const svgParent: HTMLElement = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
44
+ let svgData: string;
45
+ const exportElement: HTMLElement = maps.svgObject.cloneNode(true) as HTMLElement;
46
+ const backgroundElement: HTMLElement = exportElement.childNodes[0] as HTMLElement;
47
+ const backgroundColor: string = backgroundElement.getAttribute('fill');
48
+ if ((maps.theme === 'Tailwind' || maps.theme === 'TailwindDark' || maps.theme === 'Bootstrap5' || maps.theme === 'Bootstrap5Dark'
49
+ || maps.theme === 'Fluent' || maps.theme === 'FluentDark') && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
50
+ (exportElement.childNodes[0] as HTMLElement).setAttribute('fill', 'rgba(255,255,255, 1)');
51
+ }
52
+ const url: string = window.URL.createObjectURL(
53
+ new Blob(
54
+ type === 'SVG' ? [svgData] :
55
+ [(new XMLSerializer()).serializeToString(exportElement)],
56
+ { type: 'image/svg+xml' }
57
+ )
58
+ );
59
+ const pdfDocument: PdfDocument = new PdfDocument();
60
+ const image: HTMLImageElement = new Image();
61
+ const ctx: CanvasRenderingContext2D = canvasElement.getContext('2d');
62
+ if (!maps.isTileMap) {
63
+ image.onload = (() => {
64
+ ctx.drawImage(image, 0, 0);
65
+ window.URL.revokeObjectURL(url);
66
+ if (type === 'PDF') {
67
+ let imageString: string = canvasElement.toDataURL('image/jpeg').replace('image/jpeg', 'image/octet-stream');
68
+ pdfDocument.pageSettings.orientation = orientation;
69
+ imageString = imageString.slice(imageString.indexOf(',') + 1);
70
+ pdfDocument.pages.add().graphics.drawImage(
71
+ new PdfBitmap(imageString), 0, 0, (maps.availableSize.width - 60), maps.availableSize.height
72
+ );
73
+ if (allowDownload) {
74
+ pdfDocument.save(fileName + '.pdf');
75
+ pdfDocument.destroy();
76
+ } else {
77
+ resolve(null);
78
+ }
79
+ }
80
+ });
81
+ image.src = url;
82
+ } else {
83
+ const svgParentElement: HTMLElement = document.getElementById(maps.element.id + '_MapAreaBorder');
84
+ let top: number = parseFloat(svgParentElement.getAttribute('y'));
85
+ let left: number = parseFloat(svgParentElement.getAttribute('x'));
86
+ const xHttp: XMLHttpRequest = new XMLHttpRequest();
87
+ const tileLength: number = maps.mapLayerPanel.tiles.length;
88
+ for (let i: number = 0; i <= tileLength + 1; i++) {
89
+ const tile: HTMLElement = document.getElementById(maps.element.id + '_tile_' + (i - 1));
90
+ const tileImg: HTMLImageElement = new Image();
91
+ tileImg.crossOrigin = 'Anonymous';
92
+ ctx.fillStyle = maps.background ? maps.background : '#FFFFFF';
93
+ ctx.fillRect(0, 0, maps.availableSize.width, maps.availableSize.height);
94
+ ctx.font = maps.titleSettings.textStyle.size + ' Arial';
95
+ let titleElement: HTMLElement = document.getElementById(maps.element.id + '_Map_title');
96
+ if (!isNullOrUndefined(titleElement)) {
97
+ ctx.fillStyle = titleElement.getAttribute('fill');
98
+ ctx.fillText(
99
+ maps.titleSettings.text, parseFloat(titleElement.getAttribute('x')),
100
+ parseFloat(titleElement.getAttribute('y')));
101
+ }
102
+ tileImg.onload = (() => {
103
+ if (i === 0 || i === tileLength + 1) {
104
+ if (i === 0) {
105
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
106
+ ctx.rect(0, top, parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
107
+ ctx.clip();
108
+ } else {
109
+ ctx.setTransform(1, 0, 0, 1, left, top);
110
+ }
111
+ } else {
112
+ ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left, parseFloat(tile.style.top) + top);
113
+ }
114
+ ctx.drawImage(tileImg, 0, 0);
115
+ if (i === tileLength + 1) {
116
+ if (type === 'PDF') {
117
+ localStorage.setItem('saved-image-example', canvasElement.toDataURL('image/jpeg'));
118
+ let x: string = localStorage.getItem('saved-image-example');
119
+ pdfDocument.pageSettings.orientation = orientation;
120
+ x = x.slice(x.indexOf(',') + 1);
121
+ pdfDocument.pages.add().graphics.drawImage(
122
+ new PdfBitmap(x), 0, 0, (maps.availableSize.width - 60), maps.availableSize.height
123
+ );
124
+ if (allowDownload) {
125
+ pdfDocument.save(fileName + '.pdf');
126
+ pdfDocument.destroy();
127
+ } else {
128
+ resolve(null);
129
+ }
130
+ }
131
+ }
132
+ });
133
+ if (i === 0 || i === tileLength + 1) {
134
+ if (i === 0) {
135
+ tileImg.src = url;
136
+ } else {
137
+ setTimeout(() => {
138
+ let tileSvg: Element = document.getElementById(maps.element.id + '_Tile_SVG');
139
+ tileImg.src = window.URL.createObjectURL(new Blob(
140
+ [(new XMLSerializer()).serializeToString(tileSvg)],
141
+ { type: 'image/svg+xml' }));
142
+ }, 300);
143
+ }
144
+ } else {
145
+ xHttp.open('GET', tile.children[0].getAttribute('src'), true);
146
+ xHttp.send();
147
+ tileImg.src = tile.children[0].getAttribute('src');
148
+ }
149
+ }
150
+ }
151
+ });
152
+ return promise;
153
+ }
154
+ /**
155
+ * Get module name.
156
+ *
157
+ * @returns {string} - Returns the module name
158
+ */
159
+ protected getModuleName(): string {
160
+ return 'PdfExport';
161
+ }
162
+
163
+ /**
164
+ * To destroy the PdfExport.
165
+ *
166
+ * @returns {void}
167
+ * @private
168
+ */
169
+ public destroy(): void { }
170
+ }