@syncfusion/ej2-maps 30.1.37 → 31.1.17
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/dist/ej2-maps.min.js +1 -1
- package/dist/ej2-maps.umd.min.js +1 -1
- package/dist/global/ej2-maps.min.js +1 -1
- package/dist/global/index.d.ts +1 -1
- 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/dist/ej2-maps.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: ej2-maps.min.js
|
|
3
|
-
* version :
|
|
3
|
+
* version : 31.1.17
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/dist/ej2-maps.umd.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: ej2-maps.umd.min.js
|
|
3
|
-
* version :
|
|
3
|
+
* version : 31.1.17
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: ej2-maps.min.js
|
|
3
|
-
* version :
|
|
3
|
+
* version : 31.1.17
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version :
|
|
3
|
+
* version : 31.1.17
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/dist/ts/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* export all modules from maps component
|
|
3
|
+
*/
|
|
4
|
+
export * from './maps';
|
|
5
|
+
export * from './maps-model';
|
|
6
|
+
export * from './model/interface';
|
|
7
|
+
export * from './model/constants';
|
|
8
|
+
export * from './model/base';
|
|
9
|
+
export * from './model/base-model';
|
|
10
|
+
export * from './utils/enum';
|
|
11
|
+
export * from './utils/helper';
|
|
12
|
+
export * from './layers/layer-panel';
|
|
13
|
+
export * from './layers/bubble';
|
|
14
|
+
export * from './layers/bing-map';
|
|
15
|
+
export * from './layers/marker';
|
|
16
|
+
export * from './layers/polygon';
|
|
17
|
+
export * from './layers/color-mapping';
|
|
18
|
+
export * from './layers/data-label';
|
|
19
|
+
export * from './layers/navigation-selected-line';
|
|
20
|
+
export * from './layers/legend';
|
|
21
|
+
export * from './user-interaction/highlight';
|
|
22
|
+
export * from './user-interaction/selection';
|
|
23
|
+
export * from './user-interaction/tooltip';
|
|
24
|
+
export * from './user-interaction/zoom';
|
|
25
|
+
export * from './user-interaction/annotation';
|
|
26
|
+
export * from './model/print';
|
|
27
|
+
export * from './model/export-image';
|
|
28
|
+
export * from './model/export-pdf';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* export all modules from maps component
|
|
3
|
+
*/
|
|
4
|
+
export * from './maps';
|
|
5
|
+
export * from './maps-model';
|
|
6
|
+
export * from './model/interface';
|
|
7
|
+
export * from './model/constants';
|
|
8
|
+
export * from './model/base';
|
|
9
|
+
export * from './model/base-model';
|
|
10
|
+
export * from './utils/enum';
|
|
11
|
+
export * from './utils/helper';
|
|
12
|
+
export * from './layers/layer-panel';
|
|
13
|
+
export * from './layers/bubble';
|
|
14
|
+
export * from './layers/bing-map';
|
|
15
|
+
export * from './layers/marker';
|
|
16
|
+
export * from './layers/polygon';
|
|
17
|
+
export * from './layers/color-mapping';
|
|
18
|
+
export * from './layers/data-label';
|
|
19
|
+
export * from './layers/navigation-selected-line';
|
|
20
|
+
export * from './layers/legend';
|
|
21
|
+
export * from './user-interaction/highlight';
|
|
22
|
+
export * from './user-interaction/selection';
|
|
23
|
+
export * from './user-interaction/tooltip';
|
|
24
|
+
export * from './user-interaction/zoom';
|
|
25
|
+
export * from './user-interaction/annotation';
|
|
26
|
+
export * from './model/print';
|
|
27
|
+
export * from './model/export-image';
|
|
28
|
+
export * from './model/export-pdf';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Maps } from '../maps';
|
|
2
|
+
import { Tile } from '../index';
|
|
3
|
+
/**
|
|
4
|
+
* Bing map src doc
|
|
5
|
+
*/
|
|
6
|
+
export declare class BingMap {
|
|
7
|
+
/**
|
|
8
|
+
* map instance
|
|
9
|
+
*/
|
|
10
|
+
private maps;
|
|
11
|
+
subDomains: string[];
|
|
12
|
+
imageUrl: string;
|
|
13
|
+
maxZoom: string;
|
|
14
|
+
constructor(maps: Maps);
|
|
15
|
+
getBingMap(tile: Tile, key: string, type: string, language: string, imageUrl: string, subDomains: string[]): string;
|
|
16
|
+
/**
|
|
17
|
+
* @returns {void}
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Maps } from '../maps';
|
|
2
|
+
import { Tile } from '../index';
|
|
3
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Bing map src doc
|
|
7
|
+
*/
|
|
8
|
+
export class BingMap {
|
|
9
|
+
/**
|
|
10
|
+
* map instance
|
|
11
|
+
*/
|
|
12
|
+
private maps: Maps;
|
|
13
|
+
public subDomains: string[];
|
|
14
|
+
public imageUrl: string;
|
|
15
|
+
public maxZoom: string;
|
|
16
|
+
constructor(maps: Maps) {
|
|
17
|
+
this.maps = maps;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public getBingMap(tile: Tile, key: string, type: string, language: string, imageUrl: string, subDomains: string[]): string {
|
|
21
|
+
let quadKey: string = '';
|
|
22
|
+
const maxZoom: number = Math.min(this.maps.tileZoomLevel, parseInt(this.maxZoom, 10));
|
|
23
|
+
for (let i: number = maxZoom; i > 0; i--) {
|
|
24
|
+
let digit: number = 0;
|
|
25
|
+
const mask: number = 1 << (i - 1);
|
|
26
|
+
if ((tile.x & mask) !== 0) {
|
|
27
|
+
digit++;
|
|
28
|
+
}
|
|
29
|
+
if ((tile.y & mask) !== 0) {
|
|
30
|
+
digit += 2;
|
|
31
|
+
}
|
|
32
|
+
quadKey = quadKey + '' + digit;
|
|
33
|
+
}
|
|
34
|
+
if (!isNullOrUndefined(subDomains)) {
|
|
35
|
+
const subDomain: string = subDomains[Math.min(parseInt(quadKey.substr(quadKey.length - 1, 1), 10), subDomains.length)];
|
|
36
|
+
imageUrl = imageUrl.replace('{quadkey}', quadKey).replace('{subdomain}', subDomain);
|
|
37
|
+
return imageUrl += '&mkt=' + language + '&ur=IN&Key=' + key;
|
|
38
|
+
} else {
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @returns {void}
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
public destroy(): void {
|
|
48
|
+
this.maps = null;
|
|
49
|
+
this.subDomains = [];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Maps } from '../../index';
|
|
2
|
+
import { BubbleSettingsModel } from '../index';
|
|
3
|
+
import { LayerSettings } from '../index';
|
|
4
|
+
/**
|
|
5
|
+
* Bubble module class
|
|
6
|
+
*/
|
|
7
|
+
export declare class Bubble {
|
|
8
|
+
private maps;
|
|
9
|
+
/** @private */
|
|
10
|
+
bubbleCollection: object[];
|
|
11
|
+
/**
|
|
12
|
+
* Bubble Id for current layer
|
|
13
|
+
*
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
constructor(maps: Maps);
|
|
18
|
+
/**
|
|
19
|
+
* To render bubble
|
|
20
|
+
*
|
|
21
|
+
* @param {BubbleSettingsModel} bubbleSettings - Specifies the bubble data to be rendered
|
|
22
|
+
* @param {object} shapeData - Specifies the data about the shape
|
|
23
|
+
* @param {string} color - Specifies the color of the bubble
|
|
24
|
+
* @param {number} range - Specifies the range of the bubble
|
|
25
|
+
* @param {number} range.min - Specifies the minimum range of the bubble
|
|
26
|
+
* @param {number} range.max - Specifies the maximum range of the bubble
|
|
27
|
+
* @param {number} bubbleIndex - Specifies the index of the bubble
|
|
28
|
+
* @param {number} dataIndex - Specifies the index of the data
|
|
29
|
+
* @param {number} layerIndex - Specifies the index of the layer
|
|
30
|
+
* @param {LayerSettings} layer - Specifies the layer data
|
|
31
|
+
* @param {Element} group - Specifies the element group
|
|
32
|
+
* @param {string} bubbleID - Specifies the ID of the bubble
|
|
33
|
+
* @returns {void}
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
renderBubble(bubbleSettings: BubbleSettingsModel, shapeData: object, color: string, range: {
|
|
37
|
+
min: number;
|
|
38
|
+
max: number;
|
|
39
|
+
}, bubbleIndex: number, dataIndex: number, layerIndex: number, layer: LayerSettings, group: Element, bubbleID?: string): void;
|
|
40
|
+
private getPoints;
|
|
41
|
+
/**
|
|
42
|
+
* To check and trigger bubble click event.
|
|
43
|
+
*
|
|
44
|
+
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
45
|
+
* @returns {void}
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
bubbleClick(e: PointerEvent): void;
|
|
49
|
+
/**
|
|
50
|
+
* To get bubble from target id.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} target - Specifies the target
|
|
53
|
+
* @returns {object} - Returns the object
|
|
54
|
+
*/
|
|
55
|
+
private getbubble;
|
|
56
|
+
/**
|
|
57
|
+
* To check and trigger bubble move event.
|
|
58
|
+
*
|
|
59
|
+
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
60
|
+
* @retruns {void}
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
bubbleMove(e: PointerEvent): void;
|
|
64
|
+
/**
|
|
65
|
+
* Get module name.
|
|
66
|
+
*
|
|
67
|
+
* @returns {string} - Returns the module name.
|
|
68
|
+
*/
|
|
69
|
+
protected getModuleName(): string;
|
|
70
|
+
/**
|
|
71
|
+
* To destroy the bubble.
|
|
72
|
+
*
|
|
73
|
+
* @returns {void}
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
destroy(): void;
|
|
77
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { Maps } from '../../index';
|
|
2
|
+
import { BubbleSettingsModel, ColorMapping, IBubbleRenderingEventArgs, bubbleRendering } from '../index';
|
|
3
|
+
import { IBubbleClickEventArgs, bubbleClick, LayerSettings, IBubbleMoveEventArgs, bubbleMouseMove } from '../index';
|
|
4
|
+
import { isNullOrUndefined, animationMode } from '@syncfusion/ej2-base';
|
|
5
|
+
import { CircleOption, MapLocation, findMidPointOfPolygon, Point, drawCircle, elementAnimate, getTranslate } from '../utils/helper';
|
|
6
|
+
import { RectOption, Rect, drawRectangle, checkPropertyPath, getZoomTranslate, getRatioOfBubble, maintainSelection,
|
|
7
|
+
getValueFromObject } from '../utils/helper';
|
|
8
|
+
import { BorderModel } from '../model/base-model';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Bubble module class
|
|
12
|
+
*/
|
|
13
|
+
export class Bubble {
|
|
14
|
+
private maps: Maps;
|
|
15
|
+
/** @private */
|
|
16
|
+
public bubbleCollection: object[];
|
|
17
|
+
/**
|
|
18
|
+
* Bubble Id for current layer
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
public id: string = '';
|
|
23
|
+
constructor(maps: Maps) {
|
|
24
|
+
this.maps = maps;
|
|
25
|
+
this.bubbleCollection = [];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* To render bubble
|
|
29
|
+
*
|
|
30
|
+
* @param {BubbleSettingsModel} bubbleSettings - Specifies the bubble data to be rendered
|
|
31
|
+
* @param {object} shapeData - Specifies the data about the shape
|
|
32
|
+
* @param {string} color - Specifies the color of the bubble
|
|
33
|
+
* @param {number} range - Specifies the range of the bubble
|
|
34
|
+
* @param {number} range.min - Specifies the minimum range of the bubble
|
|
35
|
+
* @param {number} range.max - Specifies the maximum range of the bubble
|
|
36
|
+
* @param {number} bubbleIndex - Specifies the index of the bubble
|
|
37
|
+
* @param {number} dataIndex - Specifies the index of the data
|
|
38
|
+
* @param {number} layerIndex - Specifies the index of the layer
|
|
39
|
+
* @param {LayerSettings} layer - Specifies the layer data
|
|
40
|
+
* @param {Element} group - Specifies the element group
|
|
41
|
+
* @param {string} bubbleID - Specifies the ID of the bubble
|
|
42
|
+
* @returns {void}
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
public renderBubble(
|
|
46
|
+
bubbleSettings: BubbleSettingsModel, shapeData: object, color: string, range: { min: number, max: number },
|
|
47
|
+
bubbleIndex: number, dataIndex: number, layerIndex: number, layer: LayerSettings, group: Element, bubbleID? : string
|
|
48
|
+
): void {
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
const layerData: any[] = layer.layerData; const colorValuePath: string = bubbleSettings.colorValuePath;
|
|
51
|
+
const equalValue: string = (!isNullOrUndefined(colorValuePath)) ? ((colorValuePath.indexOf('.') > -1) ?
|
|
52
|
+
(getValueFromObject(shapeData, bubbleSettings.colorValuePath)) : shapeData[colorValuePath as string]) :
|
|
53
|
+
shapeData[colorValuePath as string];
|
|
54
|
+
const colorValue: number = (!isNullOrUndefined(colorValuePath)) ? ((colorValuePath.indexOf('.') > -1) ?
|
|
55
|
+
Number(getValueFromObject(shapeData, bubbleSettings.colorValuePath)) : Number(shapeData[colorValuePath as string])) :
|
|
56
|
+
Number(shapeData[colorValuePath as string]);
|
|
57
|
+
const bubbleValue: number = (!isNullOrUndefined(bubbleSettings.valuePath)) ? ((bubbleSettings.valuePath.indexOf('.') > -1) ?
|
|
58
|
+
Number(getValueFromObject(shapeData, bubbleSettings.valuePath)) : Number(shapeData[bubbleSettings.valuePath])) :
|
|
59
|
+
Number(shapeData[bubbleSettings.valuePath]);
|
|
60
|
+
let opacity: number; let bubbleColor: string;
|
|
61
|
+
if (isNaN(bubbleValue) && isNaN(colorValue) && isNullOrUndefined(equalValue)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
let radius: number = getRatioOfBubble(bubbleSettings.minRadius, bubbleSettings.maxRadius, bubbleValue, range.min, range.max);
|
|
65
|
+
const colorMapping: ColorMapping = new ColorMapping(this.maps);
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
+
const shapeColor: any = colorMapping.getColorByValue(bubbleSettings.colorMapping, colorValue, equalValue);
|
|
68
|
+
// eslint-disable-next-line prefer-const
|
|
69
|
+
bubbleColor = (Object.prototype.toString.call(shapeColor) === '[object Object]' &&
|
|
70
|
+
!isNullOrUndefined(shapeColor['fill'])) ? shapeColor['fill'] : color;
|
|
71
|
+
// eslint-disable-next-line prefer-const
|
|
72
|
+
opacity = (Object.prototype.toString.call(shapeColor) === '[object Object]' &&
|
|
73
|
+
!isNullOrUndefined(shapeColor['opacity'])) ? shapeColor['opacity'] : bubbleSettings.opacity;
|
|
74
|
+
const shapePoints: [MapLocation[]] = [[]]; this.maps.translateType = 'bubble';
|
|
75
|
+
let midIndex: number = 0; let pointsLength: number = 0; let currentLength: number = 0;
|
|
76
|
+
for (let i: number = 0, len: number = layerData.length; i < len; i++) {
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
|
+
let shape: any = layerData[i as number];
|
|
79
|
+
shape = shape['property'];
|
|
80
|
+
const shapePath: string = checkPropertyPath(shapeData[layer.shapeDataPath], layer.shapePropertyPath, shape);
|
|
81
|
+
const shapeDataLayerPathValue: string = !isNullOrUndefined(shapeData[layer.shapeDataPath]) &&
|
|
82
|
+
isNaN(shapeData[layer.shapeDataPath]) ? shapeData[layer.shapeDataPath].toLowerCase() : shapeData[layer.shapeDataPath];
|
|
83
|
+
const shapePathValue: string = !isNullOrUndefined(shape[shapePath as string]) && isNaN(shape[shapePath as string])
|
|
84
|
+
? shape[shapePath as string].toLowerCase() : shape[shapePath as string];
|
|
85
|
+
if (shapeDataLayerPathValue === shapePathValue && (layerData[i as number].type !== 'LineString' && layerData[i as number].type !== 'MultiLineString' && layerData[i as number]['type'] !== 'Point' && layerData[i as number]['type'] !== 'MultiPoint')) {
|
|
86
|
+
if (!layerData[i as number]['_isMultiPolygon']) {
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
|
+
shapePoints.push(this.getPoints(layerData[i as number] as any[], []));
|
|
89
|
+
currentLength = shapePoints[shapePoints.length - 1].length;
|
|
90
|
+
if (pointsLength < currentLength) {
|
|
91
|
+
pointsLength = currentLength;
|
|
92
|
+
midIndex = shapePoints.length - 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
} else {
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
const layer: any[] = <any[]>layerData[i as number];
|
|
98
|
+
for (let j: number = 0; j < layer.length; j++) {
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
+
shapePoints.push(this.getPoints(layer[j as number] as any[], []));
|
|
101
|
+
currentLength = shapePoints[shapePoints.length - 1].length;
|
|
102
|
+
if (pointsLength < currentLength) {
|
|
103
|
+
pointsLength = currentLength;
|
|
104
|
+
midIndex = shapePoints.length - 1;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const projectionType: string = this.maps.projectionType;
|
|
111
|
+
let centerY: number; let eventArgs: IBubbleRenderingEventArgs;
|
|
112
|
+
const bubbleBorder: BorderModel = {
|
|
113
|
+
color: bubbleSettings.border.color, opacity: bubbleSettings.border.opacity,
|
|
114
|
+
width: bubbleSettings.border.width
|
|
115
|
+
};
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
|
+
const center: any = findMidPointOfPolygon(shapePoints[midIndex as number], projectionType, layer.geometryType);
|
|
118
|
+
if (bubbleSettings.visible) {
|
|
119
|
+
if (!isNullOrUndefined(center)) {
|
|
120
|
+
centerY = this.maps.projectionType === 'Mercator' ? center['y'] : (-center['y']);
|
|
121
|
+
eventArgs = {
|
|
122
|
+
cancel: false, name: bubbleRendering, border: bubbleBorder,
|
|
123
|
+
cx: center['x'], cy: centerY, data: shapeData, fill: bubbleColor,
|
|
124
|
+
maps: this.maps, radius: radius
|
|
125
|
+
};
|
|
126
|
+
} else {
|
|
127
|
+
const shapePointsLength: number = shapePoints.length - 1;
|
|
128
|
+
if (shapePoints[shapePointsLength as number]['x'] && shapePoints[shapePointsLength as number]['y']) {
|
|
129
|
+
eventArgs = {
|
|
130
|
+
cancel: false, name: bubbleRendering, border: bubbleBorder,
|
|
131
|
+
cx: shapePoints[shapePointsLength as number]['x'], cy: shapePoints[shapePointsLength as number]['y'],
|
|
132
|
+
data: shapeData, fill: bubbleColor, maps: this.maps,
|
|
133
|
+
radius: radius
|
|
134
|
+
};
|
|
135
|
+
} else {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
140
|
+
this.maps.trigger('bubbleRendering', eventArgs, (bubbleArgs: IBubbleRenderingEventArgs) => {
|
|
141
|
+
if (eventArgs.cancel) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
let bubbleElement: Element;
|
|
145
|
+
eventArgs.border.opacity = isNullOrUndefined(eventArgs.border.opacity) ? opacity : eventArgs.border.opacity;
|
|
146
|
+
if (bubbleSettings.bubbleType === 'Circle') {
|
|
147
|
+
const circle: CircleOption = new CircleOption(
|
|
148
|
+
bubbleID, eventArgs.fill, eventArgs.border, opacity,
|
|
149
|
+
0, 0, eventArgs.radius, null
|
|
150
|
+
);
|
|
151
|
+
bubbleElement = drawCircle(this.maps, circle, group);
|
|
152
|
+
} else {
|
|
153
|
+
const y: number = this.maps.projectionType === 'Mercator' ? (eventArgs.cy - radius) : (eventArgs.cy + radius);
|
|
154
|
+
const rectangle: RectOption = new RectOption(
|
|
155
|
+
bubbleID, eventArgs.fill, eventArgs.border, opacity,
|
|
156
|
+
new Rect(0, 0, radius * 2, radius * 2), 2, 2
|
|
157
|
+
);
|
|
158
|
+
eventArgs.cx -= radius; eventArgs.cy = y;
|
|
159
|
+
bubbleElement = drawRectangle(this.maps, rectangle, group);
|
|
160
|
+
}
|
|
161
|
+
maintainSelection(this.maps.selectedBubbleElementId, this.maps.bubbleSelectionClass, bubbleElement,
|
|
162
|
+
'BubbleselectionMapStyle');
|
|
163
|
+
this.bubbleCollection.push({
|
|
164
|
+
LayerIndex: layerIndex,
|
|
165
|
+
BubbleIndex: bubbleIndex,
|
|
166
|
+
DataIndex: dataIndex,
|
|
167
|
+
element: bubbleElement,
|
|
168
|
+
center: { x: eventArgs.cx, y: eventArgs.cy }
|
|
169
|
+
});
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
171
|
+
let translate: any;
|
|
172
|
+
const animate: boolean = (layer.animationDuration !== 0 || animationMode === 'Enable') || isNullOrUndefined(this.maps.zoomModule);
|
|
173
|
+
if (this.maps.zoomSettings.zoomFactor > 1 && !isNullOrUndefined(this.maps.zoomModule) && !this.maps.isTileMap) {
|
|
174
|
+
translate = getZoomTranslate(this.maps, layer, animate);
|
|
175
|
+
} else {
|
|
176
|
+
translate = getTranslate(this.maps, layer, animate);
|
|
177
|
+
}
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
179
|
+
const bubbleDataSource: any[] = bubbleSettings.dataSource as any[];
|
|
180
|
+
const scale: number = translate['scale']; const transPoint: Point = translate['location'] as Point;
|
|
181
|
+
const position: MapLocation = new MapLocation(
|
|
182
|
+
(this.maps.isTileMap ? ((eventArgs.cx + this.maps.translatePoint.x) * this.maps.tileZoomLevel)
|
|
183
|
+
: ((eventArgs.cx + transPoint.x) * scale)),
|
|
184
|
+
(this.maps.isTileMap ? ((eventArgs.cy + this.maps.translatePoint.y) * this.maps.tileZoomLevel)
|
|
185
|
+
: ((eventArgs.cy + transPoint.y) * scale)));
|
|
186
|
+
bubbleElement.setAttribute('transform', 'translate( ' + (position.x) + ' ' + (position.y) + ' )');
|
|
187
|
+
const bubble: string = (bubbleDataSource.length - 1) === dataIndex ? 'bubble' : null;
|
|
188
|
+
if (bubbleSettings.bubbleType === 'Square') {
|
|
189
|
+
position.x += radius;
|
|
190
|
+
position.y += radius * (this.maps.projectionType === 'Mercator' ? 1 : -1);
|
|
191
|
+
} else {
|
|
192
|
+
radius = 0;
|
|
193
|
+
}
|
|
194
|
+
if (bubbleSettings.animationDuration > 0 || animationMode === 'Enable') {
|
|
195
|
+
elementAnimate(
|
|
196
|
+
bubbleElement, bubbleSettings.animationDelay, bubbleSettings.animationDuration, position, this.maps, bubble, radius
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
203
|
+
private getPoints(shape: any[], points: MapLocation[]): MapLocation[] {
|
|
204
|
+
if (isNullOrUndefined(shape.map)) {
|
|
205
|
+
points = shape['point'];
|
|
206
|
+
} else {
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
208
|
+
shape.map((current: any) => {
|
|
209
|
+
points.push(new Point(current['point']['x'], current['point']['y']));
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
return points;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* To check and trigger bubble click event.
|
|
217
|
+
*
|
|
218
|
+
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
219
|
+
* @returns {void}
|
|
220
|
+
* @private
|
|
221
|
+
*/
|
|
222
|
+
public bubbleClick(e: PointerEvent): void {
|
|
223
|
+
const target: string = (e.target as Element).id;
|
|
224
|
+
if (target.indexOf('_LayerIndex_') === -1) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
228
|
+
const data: any = this.getbubble(target);
|
|
229
|
+
if (isNullOrUndefined(data)) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const eventArgs: IBubbleClickEventArgs = {
|
|
233
|
+
cancel: false, name: bubbleClick, data: data, maps: this.maps,
|
|
234
|
+
target: target, x: e.clientX, y: e.clientY
|
|
235
|
+
};
|
|
236
|
+
this.maps.trigger(bubbleClick, eventArgs);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* To get bubble from target id.
|
|
240
|
+
*
|
|
241
|
+
* @param {string} target - Specifies the target
|
|
242
|
+
* @returns {object} - Returns the object
|
|
243
|
+
*/
|
|
244
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
245
|
+
private getbubble(target: string): any {
|
|
246
|
+
const id: string[] = target.split('_LayerIndex_');
|
|
247
|
+
const index: number = parseInt(id[1].split('_')[0], 10);
|
|
248
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
249
|
+
let data: any;
|
|
250
|
+
if (target.indexOf('_BubbleIndex_') > -1) {
|
|
251
|
+
const layer: LayerSettings = <LayerSettings>this.maps.layers[index as number];
|
|
252
|
+
const bubbleIndex: number = parseInt(id[1].split('_BubbleIndex_')[1], 10);
|
|
253
|
+
const dataIndex: number = parseInt(id[1].split('_BubbleIndex_')[1].split('_dataIndex_')[1], 10);
|
|
254
|
+
if (!isNaN(bubbleIndex as number)) {
|
|
255
|
+
data = layer.bubbleSettings[bubbleIndex as number].dataSource[dataIndex as number];
|
|
256
|
+
return data;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
// eslint-disable-next-line valid-jsdoc
|
|
262
|
+
/**
|
|
263
|
+
* To check and trigger bubble move event.
|
|
264
|
+
*
|
|
265
|
+
* @param {PointerEvent} e - Specifies the pointer event argument.
|
|
266
|
+
* @retruns {void}
|
|
267
|
+
* @private
|
|
268
|
+
*/
|
|
269
|
+
public bubbleMove(e: PointerEvent): void {
|
|
270
|
+
const target: string = (e.target as Element).id;
|
|
271
|
+
if (target.indexOf('_LayerIndex_') === -1) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
275
|
+
const data: any = this.getbubble(target);
|
|
276
|
+
if (isNullOrUndefined(data)) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const eventArgs: IBubbleMoveEventArgs = {
|
|
280
|
+
cancel: false, name: bubbleMouseMove, data: data, maps: this.maps,
|
|
281
|
+
target: target, x: e.clientX, y: e.clientY
|
|
282
|
+
};
|
|
283
|
+
this.maps.trigger(bubbleMouseMove, eventArgs);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Get module name.
|
|
287
|
+
*
|
|
288
|
+
* @returns {string} - Returns the module name.
|
|
289
|
+
*/
|
|
290
|
+
protected getModuleName(): string {
|
|
291
|
+
return 'Bubble';
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* To destroy the bubble.
|
|
296
|
+
*
|
|
297
|
+
* @returns {void}
|
|
298
|
+
* @private
|
|
299
|
+
*/
|
|
300
|
+
public destroy(): void {
|
|
301
|
+
this.bubbleCollection = [];
|
|
302
|
+
this.maps = null;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Maps } from '../../index';
|
|
2
|
+
import { ShapeSettingsModel, ColorMappingSettingsModel, ColorValue } from '../index';
|
|
3
|
+
/**
|
|
4
|
+
* ColorMapping class
|
|
5
|
+
*/
|
|
6
|
+
export declare class ColorMapping {
|
|
7
|
+
constructor(maps: Maps);
|
|
8
|
+
/**
|
|
9
|
+
* To get color based on shape settings.
|
|
10
|
+
*
|
|
11
|
+
* @param { ShapeSettingsModel } shapeSettings - Specifies the shape settings.
|
|
12
|
+
* @param { object } layerData - Specifies the layer data.
|
|
13
|
+
* @param { string } color - Specifies the color.
|
|
14
|
+
* @returns {object} - Returns the object.
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
getShapeColorMapping(shapeSettings: ShapeSettingsModel, layerData: object, color: string): any;
|
|
18
|
+
/**
|
|
19
|
+
* To color by value and color mapping.
|
|
20
|
+
*
|
|
21
|
+
* @param {ColorMappingSettingsModel[]} colorMapping - Specifies the color mapping instance.
|
|
22
|
+
* @param {number} colorValue - Specifies the color value
|
|
23
|
+
* @param {string} equalValue - Specifies the equal value.
|
|
24
|
+
* @returns {any} - Returns the color mapping values.
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
getColorByValue(colorMapping: ColorMappingSettingsModel[], colorValue: number, equalValue: string): any;
|
|
28
|
+
deSaturationColor(colorMapping: ColorMappingSettingsModel, color: string, rangeValue: number, equalValue: string): number;
|
|
29
|
+
rgbToHex(r: number, g: number, b: number): string;
|
|
30
|
+
componentToHex(value: number): string;
|
|
31
|
+
getColor(colorMap: ColorMappingSettingsModel, value: number): string;
|
|
32
|
+
getGradientColor(value: number, colorMap: ColorMappingSettingsModel): ColorValue;
|
|
33
|
+
getPercentageColor(percent: number, previous: string, next: string): ColorValue;
|
|
34
|
+
getPercentage(percent: number, previous: number, next: number): number;
|
|
35
|
+
_colorNameToHex(color: string): string;
|
|
36
|
+
}
|