@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.
- package/.eslintrc.json +18 -3
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +72 -72
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +49 -49
- package/CHANGELOG.md +441 -439
- package/README.md +73 -73
- package/dist/ej2-maps.umd.min.js +1 -10
- package/dist/ej2-maps.umd.min.js.map +1 -1
- package/dist/es6/ej2-maps.es2015.js +1161 -638
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +1200 -678
- package/dist/es6/ej2-maps.es5.js.map +1 -1
- package/dist/global/ej2-maps.min.js +1 -10
- package/dist/global/ej2-maps.min.js.map +1 -1
- package/dist/global/index.d.ts +0 -9
- package/dist/ts/maps/layers/bing-map.ts +50 -0
- package/dist/ts/maps/layers/bubble.ts +290 -0
- package/dist/ts/maps/layers/color-mapping.ts +226 -0
- package/dist/ts/maps/layers/data-label.ts +418 -0
- package/dist/ts/maps/layers/layer-panel.ts +1480 -0
- package/dist/ts/maps/layers/legend.ts +2236 -0
- package/dist/ts/maps/layers/marker.ts +453 -0
- package/dist/ts/maps/layers/navigation-selected-line.ts +167 -0
- package/dist/ts/maps/maps.ts +2886 -0
- package/dist/ts/maps/model/base.ts +1843 -0
- package/dist/ts/maps/model/constants.ts +200 -0
- package/dist/ts/maps/model/export-image.ts +178 -0
- package/dist/ts/maps/model/export-pdf.ts +170 -0
- package/dist/ts/maps/model/interface.ts +823 -0
- package/dist/ts/maps/model/print.ts +104 -0
- package/dist/ts/maps/model/theme.ts +554 -0
- package/dist/ts/maps/user-interaction/annotation.ts +127 -0
- package/dist/ts/maps/user-interaction/highlight.ts +233 -0
- package/dist/ts/maps/user-interaction/selection.ts +321 -0
- package/dist/ts/maps/user-interaction/tooltip.ts +387 -0
- package/dist/ts/maps/user-interaction/zoom.ts +1767 -0
- package/dist/ts/maps/utils/enum.ts +368 -0
- package/dist/ts/maps/utils/helper.ts +3421 -0
- package/helper/e2e/index.js +3 -3
- package/helper/e2e/maps-helper.js +13 -13
- package/license +9 -9
- package/package.json +85 -85
- package/src/maps/layers/bing-map.d.ts +4 -0
- package/src/maps/layers/bing-map.js +16 -3
- package/src/maps/layers/bubble.d.ts +1 -2
- package/src/maps/layers/bubble.js +7 -12
- package/src/maps/layers/data-label.d.ts +1 -4
- package/src/maps/layers/data-label.js +32 -35
- package/src/maps/layers/layer-panel.d.ts +18 -1
- package/src/maps/layers/layer-panel.js +226 -72
- package/src/maps/layers/legend.d.ts +5 -2
- package/src/maps/layers/legend.js +170 -61
- package/src/maps/layers/marker.d.ts +2 -4
- package/src/maps/layers/marker.js +49 -48
- package/src/maps/layers/navigation-selected-line.d.ts +1 -2
- package/src/maps/layers/navigation-selected-line.js +7 -13
- package/src/maps/maps-model.d.ts +259 -251
- package/src/maps/maps.d.ts +24 -3
- package/src/maps/maps.js +152 -90
- package/src/maps/model/base-model.d.ts +1025 -1021
- package/src/maps/model/base.d.ts +5 -1
- package/src/maps/model/base.js +24 -24
- package/src/maps/model/constants.d.ts +6 -0
- package/src/maps/model/constants.js +6 -0
- package/src/maps/model/export-image.d.ts +2 -4
- package/src/maps/model/export-image.js +26 -32
- package/src/maps/model/export-pdf.d.ts +4 -6
- package/src/maps/model/export-pdf.js +27 -35
- package/src/maps/model/interface.d.ts +34 -26
- package/src/maps/model/print.d.ts +2 -5
- package/src/maps/model/print.js +33 -21
- package/src/maps/model/theme.js +7 -4
- package/src/maps/user-interaction/annotation.d.ts +1 -2
- package/src/maps/user-interaction/annotation.js +3 -4
- package/src/maps/user-interaction/highlight.d.ts +1 -2
- package/src/maps/user-interaction/highlight.js +11 -10
- package/src/maps/user-interaction/selection.d.ts +1 -2
- package/src/maps/user-interaction/selection.js +42 -19
- package/src/maps/user-interaction/tooltip.d.ts +3 -5
- package/src/maps/user-interaction/tooltip.js +27 -14
- package/src/maps/user-interaction/zoom.d.ts +3 -8
- package/src/maps/user-interaction/zoom.js +282 -162
- package/src/maps/utils/enum.d.ts +5 -1
- package/src/maps/utils/helper.d.ts +1 -1
- package/src/maps/utils/helper.js +62 -31
package/src/maps/model/base.d.ts
CHANGED
|
@@ -1333,18 +1333,21 @@ export declare class LayerSettings extends ChildProperty<LayerSettings> {
|
|
|
1333
1333
|
* Sets and gets the Bing map type for the layer. If you use shape data with BingMapType without using layer type as Bing,
|
|
1334
1334
|
* then the map will render based on shape data since default layer type will be set as Geometry.
|
|
1335
1335
|
*
|
|
1336
|
+
* @deprecated
|
|
1336
1337
|
* @default Aerial
|
|
1337
1338
|
*/
|
|
1338
1339
|
bingMapType: BingMapType;
|
|
1339
1340
|
/**
|
|
1340
1341
|
* Sets and gets the type of the static maps.
|
|
1341
1342
|
*
|
|
1343
|
+
* @deprecated
|
|
1342
1344
|
* @default RoadMap
|
|
1343
1345
|
*/
|
|
1344
1346
|
staticMapType: StaticMapType;
|
|
1345
1347
|
/**
|
|
1346
1348
|
* Sets and gets the key for the tile map layer in maps.
|
|
1347
1349
|
*
|
|
1350
|
+
* @deprecated
|
|
1348
1351
|
* @default ''
|
|
1349
1352
|
*/
|
|
1350
1353
|
key: string;
|
|
@@ -1352,13 +1355,14 @@ export declare class LayerSettings extends ChildProperty<LayerSettings> {
|
|
|
1352
1355
|
* Sets and gets the type of the layer in maps. If we use layer type with shape data property in layer of the maps
|
|
1353
1356
|
* then map will render based on the provided layer type.
|
|
1354
1357
|
*
|
|
1358
|
+
* @deprecated
|
|
1355
1359
|
* @default Geometry
|
|
1356
1360
|
*/
|
|
1357
1361
|
layerType: ShapeLayerType;
|
|
1358
1362
|
/**
|
|
1359
1363
|
* Sets and gets the template for the map using the url.
|
|
1360
1364
|
*
|
|
1361
|
-
* @default '
|
|
1365
|
+
* @default ''
|
|
1362
1366
|
*/
|
|
1363
1367
|
urlTemplate: string;
|
|
1364
1368
|
/**
|
package/src/maps/model/base.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
extendStatics(d, b);
|
|
10
|
-
function __() { this.constructor = d; }
|
|
11
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
-
};
|
|
13
|
-
})();
|
|
14
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
};
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
20
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
21
21
|
/**
|
|
22
22
|
* Maps base document
|
|
@@ -525,7 +525,7 @@ var SubTitleSettings = /** @class */ (function (_super) {
|
|
|
525
525
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
526
526
|
}
|
|
527
527
|
__decorate([
|
|
528
|
-
Complex({ size:
|
|
528
|
+
Complex({ size: null, fontWeight: null, fontFamily: null }, Font)
|
|
529
529
|
], SubTitleSettings.prototype, "textStyle", void 0);
|
|
530
530
|
__decorate([
|
|
531
531
|
Property('Center')
|
|
@@ -542,7 +542,7 @@ var TitleSettings = /** @class */ (function (_super) {
|
|
|
542
542
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
543
543
|
}
|
|
544
544
|
__decorate([
|
|
545
|
-
Complex({ size:
|
|
545
|
+
Complex({ size: null, fontWeight: null, fontFamily: null }, Font)
|
|
546
546
|
], TitleSettings.prototype, "textStyle", void 0);
|
|
547
547
|
__decorate([
|
|
548
548
|
Property('Center')
|
|
@@ -689,7 +689,7 @@ var LegendSettings = /** @class */ (function (_super) {
|
|
|
689
689
|
Property('')
|
|
690
690
|
], LegendSettings.prototype, "height", void 0);
|
|
691
691
|
__decorate([
|
|
692
|
-
Complex({}, Font)
|
|
692
|
+
Complex({ fontFamily: null }, Font)
|
|
693
693
|
], LegendSettings.prototype, "textStyle", void 0);
|
|
694
694
|
__decorate([
|
|
695
695
|
Property(15)
|
|
@@ -710,7 +710,7 @@ var LegendSettings = /** @class */ (function (_super) {
|
|
|
710
710
|
Complex({}, CommonTitleSettings)
|
|
711
711
|
], LegendSettings.prototype, "title", void 0);
|
|
712
712
|
__decorate([
|
|
713
|
-
Complex(Theme.legendTitleFont, Font)
|
|
713
|
+
Complex({ size: Theme.legendTitleFont.size, color: Theme.legendTitleFont.color, fontStyle: Theme.legendTitleFont.fontStyle, fontWeight: Theme.legendTitleFont.fontWeight, fontFamily: null }, Font)
|
|
714
714
|
], LegendSettings.prototype, "titleStyle", void 0);
|
|
715
715
|
__decorate([
|
|
716
716
|
Property('Bottom')
|
|
@@ -978,7 +978,7 @@ var LayerSettings = /** @class */ (function (_super) {
|
|
|
978
978
|
Property('Geometry')
|
|
979
979
|
], LayerSettings.prototype, "layerType", void 0);
|
|
980
980
|
__decorate([
|
|
981
|
-
Property('
|
|
981
|
+
Property('')
|
|
982
982
|
], LayerSettings.prototype, "urlTemplate", void 0);
|
|
983
983
|
__decorate([
|
|
984
984
|
Property(true)
|
|
@@ -19,6 +19,12 @@ export declare const loaded: string;
|
|
|
19
19
|
* @private
|
|
20
20
|
*/
|
|
21
21
|
export declare const click: string;
|
|
22
|
+
/**
|
|
23
|
+
* Specifies the maps onclick event name.
|
|
24
|
+
*
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
export declare const onclick: string;
|
|
22
28
|
/**
|
|
23
29
|
* Specifies the maps right click event name.
|
|
24
30
|
*
|
|
@@ -19,6 +19,12 @@ export var loaded = 'loaded';
|
|
|
19
19
|
* @private
|
|
20
20
|
*/
|
|
21
21
|
export var click = 'click';
|
|
22
|
+
/**
|
|
23
|
+
* Specifies the maps onclick event name.
|
|
24
|
+
*
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
export var onclick = 'onclick';
|
|
22
28
|
/**
|
|
23
29
|
* Specifies the maps right click event name.
|
|
24
30
|
*
|
|
@@ -6,7 +6,6 @@ import { ExportType } from '../utils/enum';
|
|
|
6
6
|
* @hidden
|
|
7
7
|
*/
|
|
8
8
|
export declare class ImageExport {
|
|
9
|
-
private control;
|
|
10
9
|
/**
|
|
11
10
|
* Constructor for Maps
|
|
12
11
|
*
|
|
@@ -22,7 +21,7 @@ export declare class ImageExport {
|
|
|
22
21
|
* @returns {Promise<string>} - Returns the promise string.
|
|
23
22
|
* @private
|
|
24
23
|
*/
|
|
25
|
-
export(type: ExportType, fileName: string, allowDownload?: boolean): Promise<string>;
|
|
24
|
+
export(maps: Maps, type: ExportType, fileName: string, allowDownload?: boolean): Promise<string>;
|
|
26
25
|
/**
|
|
27
26
|
* Get module name.
|
|
28
27
|
*
|
|
@@ -32,9 +31,8 @@ export declare class ImageExport {
|
|
|
32
31
|
/**
|
|
33
32
|
* To destroy the ImageExport.
|
|
34
33
|
*
|
|
35
|
-
* @param {Maps} maps - Specifies the instance of the maps.
|
|
36
34
|
* @returns {void}
|
|
37
35
|
* @private
|
|
38
36
|
*/
|
|
39
|
-
destroy(
|
|
37
|
+
destroy(): void;
|
|
40
38
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
2
|
import { createElement, Browser, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
3
|
-
import { triggerDownload, getElementByID
|
|
3
|
+
import { triggerDownload, getElementByID } from '../utils/helper';
|
|
4
4
|
/**
|
|
5
5
|
* This module enables the export to Image functionality in Maps control.
|
|
6
6
|
*
|
|
@@ -13,7 +13,6 @@ var ImageExport = /** @class */ (function () {
|
|
|
13
13
|
* @param {Maps} control - Specifies the instance of the map
|
|
14
14
|
*/
|
|
15
15
|
function ImageExport(control) {
|
|
16
|
-
this.control = control;
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
19
18
|
* To export the file as image/svg format
|
|
@@ -24,30 +23,28 @@ var ImageExport = /** @class */ (function () {
|
|
|
24
23
|
* @returns {Promise<string>} - Returns the promise string.
|
|
25
24
|
* @private
|
|
26
25
|
*/
|
|
27
|
-
ImageExport.prototype.export = function (type, fileName, allowDownload) {
|
|
28
|
-
var _this = this;
|
|
26
|
+
ImageExport.prototype.export = function (maps, type, fileName, allowDownload) {
|
|
29
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
28
|
var promise = new Promise(function (resolve, reject) {
|
|
31
29
|
var imageCanvasElement = createElement('canvas', {
|
|
32
30
|
id: 'ej2-canvas',
|
|
33
31
|
attrs: {
|
|
34
|
-
'width':
|
|
35
|
-
'height':
|
|
32
|
+
'width': maps.availableSize.width.toString(),
|
|
33
|
+
'height': maps.availableSize.height.toString()
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
36
|
var isDownload = !(Browser.userAgent.toString().indexOf('HeadlessChrome') > -1);
|
|
39
|
-
var toolbarEle = document.getElementById(
|
|
40
|
-
var svgParent = document.getElementById(
|
|
41
|
-
var tileParent = document.getElementById(_this.control.element.id + '_tile_parent');
|
|
37
|
+
var toolbarEle = document.getElementById(maps.element.id + '_ToolBar');
|
|
38
|
+
var svgParent = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
|
|
42
39
|
var svgDataElement;
|
|
43
40
|
var tileSvg;
|
|
44
|
-
var svgObject = getElementByID(
|
|
45
|
-
if (!
|
|
41
|
+
var svgObject = getElementByID(maps.element.id + '_svg').cloneNode(true);
|
|
42
|
+
if (!maps.isTileMap) {
|
|
46
43
|
svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
|
|
47
|
-
|
|
44
|
+
maps.svgObject.outerHTML + '</svg>';
|
|
48
45
|
}
|
|
49
46
|
else {
|
|
50
|
-
tileSvg = getElementByID(
|
|
47
|
+
tileSvg = getElementByID(maps.element.id + '_Tile_SVG').cloneNode(true);
|
|
51
48
|
svgDataElement = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
|
|
52
49
|
svgObject.outerHTML + tileSvg.outerHTML + '</svg>';
|
|
53
50
|
}
|
|
@@ -64,7 +61,7 @@ var ImageExport = /** @class */ (function () {
|
|
|
64
61
|
else {
|
|
65
62
|
var image_1 = new Image();
|
|
66
63
|
var ctxt_1 = imageCanvasElement.getContext('2d');
|
|
67
|
-
if (!
|
|
64
|
+
if (!maps.isTileMap) {
|
|
68
65
|
image_1.onload = (function () {
|
|
69
66
|
ctxt_1.drawImage(image_1, 0, 0);
|
|
70
67
|
window.URL.revokeObjectURL(url);
|
|
@@ -83,35 +80,37 @@ var ImageExport = /** @class */ (function () {
|
|
|
83
80
|
image_1.src = url;
|
|
84
81
|
}
|
|
85
82
|
else {
|
|
86
|
-
var
|
|
83
|
+
var svgParentElement = document.getElementById(maps.element.id + '_MapAreaBorder');
|
|
84
|
+
var top_1 = parseFloat(svgParentElement.getAttribute('y'));
|
|
85
|
+
var left_1 = parseFloat(svgParentElement.getAttribute('x'));
|
|
87
86
|
var imgxHttp = new XMLHttpRequest();
|
|
88
|
-
var imgTileLength_1 =
|
|
87
|
+
var imgTileLength_1 = maps.mapLayerPanel.tiles.length;
|
|
89
88
|
var _loop_1 = function (i) {
|
|
90
|
-
var tile = document.getElementById(
|
|
89
|
+
var tile = document.getElementById(maps.element.id + '_tile_' + (i - 1));
|
|
91
90
|
var exportTileImg = new Image();
|
|
92
91
|
exportTileImg.crossOrigin = 'Anonymous';
|
|
93
|
-
ctxt_1.fillStyle =
|
|
94
|
-
ctxt_1.fillRect(0, 0,
|
|
95
|
-
ctxt_1.font =
|
|
96
|
-
var titleElement = document.getElementById(
|
|
92
|
+
ctxt_1.fillStyle = maps.background ? maps.background : '#FFFFFF';
|
|
93
|
+
ctxt_1.fillRect(0, 0, maps.availableSize.width, maps.availableSize.height);
|
|
94
|
+
ctxt_1.font = maps.titleSettings.textStyle.size + ' Arial';
|
|
95
|
+
var titleElement = document.getElementById(maps.element.id + '_Map_title');
|
|
97
96
|
if (!isNullOrUndefined(titleElement)) {
|
|
98
97
|
ctxt_1.fillStyle = titleElement.getAttribute('fill');
|
|
99
|
-
ctxt_1.fillText(
|
|
98
|
+
ctxt_1.fillText(maps.titleSettings.text, parseFloat(titleElement.getAttribute('x')), parseFloat(titleElement.getAttribute('y')));
|
|
100
99
|
}
|
|
101
100
|
exportTileImg.onload = (function () {
|
|
102
101
|
if (i === 0 || i === imgTileLength_1 + 1) {
|
|
103
102
|
if (i === 0) {
|
|
104
103
|
ctxt_1.setTransform(1, 0, 0, 1, 0, 0);
|
|
105
|
-
ctxt_1.rect(0,
|
|
104
|
+
ctxt_1.rect(0, top_1, parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
|
|
106
105
|
ctxt_1.clip();
|
|
107
106
|
}
|
|
108
107
|
else {
|
|
109
|
-
ctxt_1.setTransform(1, 0, 0, 1,
|
|
108
|
+
ctxt_1.setTransform(1, 0, 0, 1, left_1, top_1);
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
else {
|
|
113
|
-
ctxt_1.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) +
|
|
114
|
-
|
|
112
|
+
ctxt_1.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left_1, parseFloat(tile.style.top) +
|
|
113
|
+
top_1);
|
|
115
114
|
}
|
|
116
115
|
ctxt_1.drawImage(exportTileImg, 0, 0);
|
|
117
116
|
if (i === imgTileLength_1 + 1) {
|
|
@@ -166,15 +165,10 @@ var ImageExport = /** @class */ (function () {
|
|
|
166
165
|
/**
|
|
167
166
|
* To destroy the ImageExport.
|
|
168
167
|
*
|
|
169
|
-
* @param {Maps} maps - Specifies the instance of the maps.
|
|
170
168
|
* @returns {void}
|
|
171
169
|
* @private
|
|
172
170
|
*/
|
|
173
|
-
ImageExport.prototype.destroy = function (
|
|
174
|
-
/**
|
|
175
|
-
* Destroy method performed here
|
|
176
|
-
*/
|
|
177
|
-
};
|
|
171
|
+
ImageExport.prototype.destroy = function () { };
|
|
178
172
|
return ImageExport;
|
|
179
173
|
}());
|
|
180
174
|
export { ImageExport };
|
|
@@ -7,13 +7,12 @@ import { PdfPageOrientation } from '@syncfusion/ej2-pdf-export';
|
|
|
7
7
|
* @hidden
|
|
8
8
|
*/
|
|
9
9
|
export declare class PdfExport {
|
|
10
|
-
private control;
|
|
11
10
|
/**
|
|
12
11
|
* Constructor for Maps
|
|
13
12
|
*
|
|
14
13
|
* @param {Maps} control Specifies the instance of the map
|
|
15
14
|
*/
|
|
16
|
-
constructor(
|
|
15
|
+
constructor();
|
|
17
16
|
/**
|
|
18
17
|
* To export the file as image/svg format
|
|
19
18
|
*
|
|
@@ -24,7 +23,7 @@ export declare class PdfExport {
|
|
|
24
23
|
* @returns {Promise<string>} - Returns the promise string
|
|
25
24
|
* @private
|
|
26
25
|
*/
|
|
27
|
-
export(type: ExportType, fileName: string, allowDownload?: boolean, orientation?: PdfPageOrientation): Promise<string>;
|
|
26
|
+
export(maps: Maps, type: ExportType, fileName: string, allowDownload?: boolean, orientation?: PdfPageOrientation): Promise<string>;
|
|
28
27
|
/**
|
|
29
28
|
* Get module name.
|
|
30
29
|
*
|
|
@@ -32,11 +31,10 @@ export declare class PdfExport {
|
|
|
32
31
|
*/
|
|
33
32
|
protected getModuleName(): string;
|
|
34
33
|
/**
|
|
35
|
-
* To destroy the
|
|
34
|
+
* To destroy the PdfExport.
|
|
36
35
|
*
|
|
37
|
-
* @param {Maps} maps - Specifies the instance of the maps.
|
|
38
36
|
* @returns {void}
|
|
39
37
|
* @private
|
|
40
38
|
*/
|
|
41
|
-
destroy(
|
|
39
|
+
destroy(): void;
|
|
42
40
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
2
|
import { createElement, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
3
3
|
import { PdfPageOrientation, PdfDocument, PdfBitmap } from '@syncfusion/ej2-pdf-export';
|
|
4
|
-
import { getClientElement } from '../utils/helper';
|
|
5
4
|
/**
|
|
6
5
|
* This module enables the export to PDF functionality in Maps control.
|
|
7
6
|
*
|
|
@@ -13,8 +12,7 @@ var PdfExport = /** @class */ (function () {
|
|
|
13
12
|
*
|
|
14
13
|
* @param {Maps} control Specifies the instance of the map
|
|
15
14
|
*/
|
|
16
|
-
function PdfExport(
|
|
17
|
-
this.control = control;
|
|
15
|
+
function PdfExport() {
|
|
18
16
|
}
|
|
19
17
|
/**
|
|
20
18
|
* To export the file as image/svg format
|
|
@@ -26,26 +24,24 @@ var PdfExport = /** @class */ (function () {
|
|
|
26
24
|
* @returns {Promise<string>} - Returns the promise string
|
|
27
25
|
* @private
|
|
28
26
|
*/
|
|
29
|
-
PdfExport.prototype.export = function (type, fileName, allowDownload, orientation) {
|
|
30
|
-
var _this = this;
|
|
27
|
+
PdfExport.prototype.export = function (maps, type, fileName, allowDownload, orientation) {
|
|
31
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
29
|
var promise = new Promise(function (resolve, reject) {
|
|
33
30
|
var canvasElement = createElement('canvas', {
|
|
34
31
|
id: 'ej2-canvas',
|
|
35
32
|
attrs: {
|
|
36
|
-
'width':
|
|
37
|
-
'height':
|
|
33
|
+
'width': maps.availableSize.width.toString(),
|
|
34
|
+
'height': maps.availableSize.height.toString()
|
|
38
35
|
}
|
|
39
36
|
});
|
|
40
37
|
orientation = isNullOrUndefined(orientation) ? PdfPageOrientation.Landscape : orientation;
|
|
41
|
-
var svgParent = document.getElementById(
|
|
38
|
+
var svgParent = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
|
|
42
39
|
var svgData;
|
|
43
|
-
var exportElement =
|
|
44
|
-
var tileParent = document.getElementById(_this.control.element.id + '_tile_parent');
|
|
40
|
+
var exportElement = maps.svgObject.cloneNode(true);
|
|
45
41
|
var backgroundElement = exportElement.childNodes[0];
|
|
46
42
|
var backgroundColor = backgroundElement.getAttribute('fill');
|
|
47
|
-
if ((
|
|
48
|
-
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
43
|
+
if ((maps.theme === 'Tailwind' || maps.theme === 'TailwindDark' || maps.theme === 'Bootstrap5' || maps.theme === 'Bootstrap5Dark'
|
|
44
|
+
|| maps.theme === 'Fluent' || maps.theme === 'FluentDark') && (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
|
|
49
45
|
exportElement.childNodes[0].setAttribute('fill', 'rgba(255,255,255, 1)');
|
|
50
46
|
}
|
|
51
47
|
var url = window.URL.createObjectURL(new Blob(type === 'SVG' ? [svgData] :
|
|
@@ -53,7 +49,7 @@ var PdfExport = /** @class */ (function () {
|
|
|
53
49
|
var pdfDocument = new PdfDocument();
|
|
54
50
|
var image = new Image();
|
|
55
51
|
var ctx = canvasElement.getContext('2d');
|
|
56
|
-
if (!
|
|
52
|
+
if (!maps.isTileMap) {
|
|
57
53
|
image.onload = (function () {
|
|
58
54
|
ctx.drawImage(image, 0, 0);
|
|
59
55
|
window.URL.revokeObjectURL(url);
|
|
@@ -61,7 +57,7 @@ var PdfExport = /** @class */ (function () {
|
|
|
61
57
|
var imageString = canvasElement.toDataURL('image/jpeg').replace('image/jpeg', 'image/octet-stream');
|
|
62
58
|
pdfDocument.pageSettings.orientation = orientation;
|
|
63
59
|
imageString = imageString.slice(imageString.indexOf(',') + 1);
|
|
64
|
-
pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(imageString), 0, 0, (
|
|
60
|
+
pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(imageString), 0, 0, (maps.availableSize.width - 60), maps.availableSize.height);
|
|
65
61
|
if (allowDownload) {
|
|
66
62
|
pdfDocument.save(fileName + '.pdf');
|
|
67
63
|
pdfDocument.destroy();
|
|
@@ -74,35 +70,36 @@ var PdfExport = /** @class */ (function () {
|
|
|
74
70
|
image.src = url;
|
|
75
71
|
}
|
|
76
72
|
else {
|
|
77
|
-
var
|
|
73
|
+
var svgParentElement = document.getElementById(maps.element.id + '_MapAreaBorder');
|
|
74
|
+
var top_1 = parseFloat(svgParentElement.getAttribute('y'));
|
|
75
|
+
var left_1 = parseFloat(svgParentElement.getAttribute('x'));
|
|
78
76
|
var xHttp = new XMLHttpRequest();
|
|
79
|
-
var tileLength_1 =
|
|
77
|
+
var tileLength_1 = maps.mapLayerPanel.tiles.length;
|
|
80
78
|
var _loop_1 = function (i) {
|
|
81
|
-
var tile = document.getElementById(
|
|
79
|
+
var tile = document.getElementById(maps.element.id + '_tile_' + (i - 1));
|
|
82
80
|
var tileImg = new Image();
|
|
83
81
|
tileImg.crossOrigin = 'Anonymous';
|
|
84
|
-
ctx.fillStyle =
|
|
85
|
-
ctx.fillRect(0, 0,
|
|
86
|
-
ctx.font =
|
|
87
|
-
var titleElement = document.getElementById(
|
|
82
|
+
ctx.fillStyle = maps.background ? maps.background : '#FFFFFF';
|
|
83
|
+
ctx.fillRect(0, 0, maps.availableSize.width, maps.availableSize.height);
|
|
84
|
+
ctx.font = maps.titleSettings.textStyle.size + ' Arial';
|
|
85
|
+
var titleElement = document.getElementById(maps.element.id + '_Map_title');
|
|
88
86
|
if (!isNullOrUndefined(titleElement)) {
|
|
89
87
|
ctx.fillStyle = titleElement.getAttribute('fill');
|
|
90
|
-
ctx.fillText(
|
|
88
|
+
ctx.fillText(maps.titleSettings.text, parseFloat(titleElement.getAttribute('x')), parseFloat(titleElement.getAttribute('y')));
|
|
91
89
|
}
|
|
92
90
|
tileImg.onload = (function () {
|
|
93
91
|
if (i === 0 || i === tileLength_1 + 1) {
|
|
94
92
|
if (i === 0) {
|
|
95
93
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
96
|
-
ctx.rect(0,
|
|
94
|
+
ctx.rect(0, top_1, parseFloat(svgParent.style.width), parseFloat(svgParent.style.height));
|
|
97
95
|
ctx.clip();
|
|
98
96
|
}
|
|
99
97
|
else {
|
|
100
|
-
ctx.setTransform(1, 0, 0, 1,
|
|
98
|
+
ctx.setTransform(1, 0, 0, 1, left_1, top_1);
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
else {
|
|
104
|
-
ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) +
|
|
105
|
-
(parseFloat(tileParent.style.top)) - extraSpace_1["top"]));
|
|
102
|
+
ctx.setTransform(1, 0, 0, 1, parseFloat(tile.style.left) + left_1, parseFloat(tile.style.top) + top_1);
|
|
106
103
|
}
|
|
107
104
|
ctx.drawImage(tileImg, 0, 0);
|
|
108
105
|
if (i === tileLength_1 + 1) {
|
|
@@ -111,7 +108,7 @@ var PdfExport = /** @class */ (function () {
|
|
|
111
108
|
var x = localStorage.getItem('saved-image-example');
|
|
112
109
|
pdfDocument.pageSettings.orientation = orientation;
|
|
113
110
|
x = x.slice(x.indexOf(',') + 1);
|
|
114
|
-
pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(x), 0, 0, (
|
|
111
|
+
pdfDocument.pages.add().graphics.drawImage(new PdfBitmap(x), 0, 0, (maps.availableSize.width - 60), maps.availableSize.height);
|
|
115
112
|
if (allowDownload) {
|
|
116
113
|
pdfDocument.save(fileName + '.pdf');
|
|
117
114
|
pdfDocument.destroy();
|
|
@@ -128,7 +125,7 @@ var PdfExport = /** @class */ (function () {
|
|
|
128
125
|
}
|
|
129
126
|
else {
|
|
130
127
|
setTimeout(function () {
|
|
131
|
-
var tileSvg = document.getElementById(
|
|
128
|
+
var tileSvg = document.getElementById(maps.element.id + '_Tile_SVG');
|
|
132
129
|
tileImg.src = window.URL.createObjectURL(new Blob([(new XMLSerializer()).serializeToString(tileSvg)], { type: 'image/svg+xml' }));
|
|
133
130
|
}, 300);
|
|
134
131
|
}
|
|
@@ -155,17 +152,12 @@ var PdfExport = /** @class */ (function () {
|
|
|
155
152
|
return 'PdfExport';
|
|
156
153
|
};
|
|
157
154
|
/**
|
|
158
|
-
* To destroy the
|
|
155
|
+
* To destroy the PdfExport.
|
|
159
156
|
*
|
|
160
|
-
* @param {Maps} maps - Specifies the instance of the maps.
|
|
161
157
|
* @returns {void}
|
|
162
158
|
* @private
|
|
163
159
|
*/
|
|
164
|
-
PdfExport.prototype.destroy = function (
|
|
165
|
-
/**
|
|
166
|
-
* Destroy method performed here
|
|
167
|
-
*/
|
|
168
|
-
};
|
|
160
|
+
PdfExport.prototype.destroy = function () { };
|
|
169
161
|
return PdfExport;
|
|
170
162
|
}());
|
|
171
163
|
export { PdfExport };
|