@hzab/map-combine 0.4.0-alpha.0 → 0.4.2-alpha.0
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/CHANGELOG.md +9 -0
- package/package.json +1 -4
- package/src/amap/AMap.ts +306 -306
- package/src/amap/AMapEvent.ts +54 -54
- package/src/basic/BasicElement.ts +14 -14
- package/src/basic/BasicMarker.ts +32 -26
- package/src/basic/BasicMouseHandler.ts +4 -4
- package/src/basic/MapCombine.ts +98 -98
- package/src/basic/Point.ts +173 -173
- package/src/basic/PointAggregation.tsx +5 -4
- package/src/basic/Polygon.ts +81 -70
- package/src/basic/Polyline.ts +85 -75
- package/src/basic/ReactPopup.tsx +12 -10
- package/src/cesium/CesiumMap.ts +347 -347
- package/src/cesium/CesiumPoint.ts +69 -69
- package/src/cesium/CesiumPolygon.ts +181 -190
- package/src/cesium/CesiumPolyline.ts +369 -369
- package/src/mine/MineEvent.ts +46 -46
- package/src/mine/MineMap.ts +125 -125
- package/src/mine/MinePoint.ts +70 -78
- package/src/mine/MinePolygon.ts +206 -216
- package/src/mine/MinePolyline.ts +193 -203
- package/src/mine/MineTile3D.ts +7 -11
- package/src/openlayer/OpenlayerEvent.ts +87 -87
- package/src/openlayer/OpenlayerMap.ts +287 -287
- package/src/openlayer/OpenlayerPoint.ts +185 -177
- package/src/openlayer/OpenlayerPolygon.ts +302 -299
- package/src/openlayer/OpenlayerPolyline.ts +303 -289
- package/src/utils/Image.ts +16 -20
- package/src/utils/PolygonEditor.ts +78 -99
- package/src/utils/PolylineEditor.ts +75 -90
- package/src/utils/static.ts +3 -3
package/src/basic/Point.ts
CHANGED
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
import Eventful from "zrender/lib/core/Eventful";
|
|
2
|
-
|
|
3
|
-
import { MapElement, MapElementOption } from "./MapElement";
|
|
4
|
-
import { MapCombine } from "./MapCombine";
|
|
5
|
-
|
|
6
|
-
export interface PointOption<K> extends MapElementOption {
|
|
7
|
-
show: boolean;
|
|
8
|
-
cursor: string;
|
|
9
|
-
coordinates?: number[];
|
|
10
|
-
src: string;
|
|
11
|
-
center: number[];
|
|
12
|
-
size: number[];
|
|
13
|
-
rotation: number;
|
|
14
|
-
editable: boolean;
|
|
15
|
-
userdata: K;
|
|
16
|
-
silent: boolean;
|
|
17
|
-
height: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export class Point<K = undefined> extends MapElement<PointOption<K>> {
|
|
21
|
-
type = "Point";
|
|
22
|
-
event = new Eventful<{
|
|
23
|
-
"data-loaded": () => void;
|
|
24
|
-
"data-update": () => void;
|
|
25
|
-
"pointer-in": () => void;
|
|
26
|
-
"pointer-out": () => void;
|
|
27
|
-
"left-click": () => void;
|
|
28
|
-
"right-click": () => void;
|
|
29
|
-
update: (keys: Set<string>) => void;
|
|
30
|
-
destroy: () => void;
|
|
31
|
-
}>();
|
|
32
|
-
|
|
33
|
-
get userdata() {
|
|
34
|
-
return this._option.userdata;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get cursor() {
|
|
38
|
-
return this._option.cursor;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get show() {
|
|
42
|
-
return this._option.show;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
set show(val) {
|
|
46
|
-
if (this._option.show != val) {
|
|
47
|
-
this._option.show = val;
|
|
48
|
-
this._update("show");
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
get silent() {
|
|
53
|
-
return this._option.silent;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
set silent(val) {
|
|
57
|
-
if (this._option.silent != val) {
|
|
58
|
-
this._option.silent = val;
|
|
59
|
-
this._update("silent");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
get editable() {
|
|
64
|
-
return this._option.editable;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
set editable(val) {
|
|
68
|
-
if (this._option.editable != val) {
|
|
69
|
-
this._option.editable = val;
|
|
70
|
-
this._update("editable");
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
get coordinates() {
|
|
75
|
-
return this._option.coordinates;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
set coordinates(val) {
|
|
79
|
-
if (this._option.coordinates != val) {
|
|
80
|
-
this._option.coordinates = val;
|
|
81
|
-
this._update("coordinates");
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
get src() {
|
|
86
|
-
return this._option.src;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
set src(val) {
|
|
90
|
-
if (this._option.src != val) {
|
|
91
|
-
this._option.src = val;
|
|
92
|
-
this._update("src");
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
get size() {
|
|
97
|
-
return this._option.size;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
set size(val) {
|
|
101
|
-
if (this._option.size != val) {
|
|
102
|
-
this._option.size = val;
|
|
103
|
-
this._update("size");
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
get center() {
|
|
107
|
-
return this._option.center;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
set center(val) {
|
|
111
|
-
if (this._option.center != val) {
|
|
112
|
-
this._option.center = val;
|
|
113
|
-
this._update("center");
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
get height() {
|
|
118
|
-
return this._option.height;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
set height(val) {
|
|
122
|
-
if (this._option.height != val) {
|
|
123
|
-
this._option.height = val;
|
|
124
|
-
this._update("height");
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
get rotation() {
|
|
129
|
-
return this._option.rotation;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
set rotation(val) {
|
|
133
|
-
if (this._option.rotation != val) {
|
|
134
|
-
this._option.rotation = val;
|
|
135
|
-
this._update("rotation");
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
constructor(map: MapCombine, option: Partial<PointOption<K>> = {}) {
|
|
140
|
-
super(map, Object.assign({ ...Point.option }, option));
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
static option: PointOption<undefined> = {
|
|
144
|
-
name: "点",
|
|
145
|
-
show: true,
|
|
146
|
-
src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAIxJREFUOE+tU4ENgCAM6y5TL1MuEy+bmQjChAjIEkKAretIS1DBwAy3pnuXDAvgIGDT+RRfsEtYdZI6mxgoAFQWe6wAcgE0FicgHoA/aJeeF+rs/rBgYI9+u5WIFQa99K9mQwB+j1AjntLfGBlBZCssmoMAGiOkDjWmUvbcK0WVN1PGlS87i63JWTvECRNBLcaa3Jq0AAAAAElFTkSuQmCC",
|
|
147
|
-
center: [0.5, 0.5],
|
|
148
|
-
editable: false,
|
|
149
|
-
size: [16, 16],
|
|
150
|
-
rotation: 0,
|
|
151
|
-
cursor: "pointer",
|
|
152
|
-
userdata: undefined,
|
|
153
|
-
silent: false,
|
|
154
|
-
height:
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
private _needUpdate?: Set<string>;
|
|
158
|
-
private _update(key: string) {
|
|
159
|
-
if (this._needUpdate) {
|
|
160
|
-
this._needUpdate.add(key);
|
|
161
|
-
} else {
|
|
162
|
-
this._needUpdate = new Set([key]);
|
|
163
|
-
setTimeout(() => {
|
|
164
|
-
this.event.trigger("update", this._needUpdate);
|
|
165
|
-
this._needUpdate = undefined;
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
protected _onDestroy(): void {
|
|
171
|
-
this.event.trigger("destroy");
|
|
172
|
-
}
|
|
173
|
-
}
|
|
1
|
+
import Eventful from "zrender/lib/core/Eventful";
|
|
2
|
+
|
|
3
|
+
import { MapElement, MapElementOption } from "./MapElement";
|
|
4
|
+
import { MapCombine } from "./MapCombine";
|
|
5
|
+
|
|
6
|
+
export interface PointOption<K> extends MapElementOption {
|
|
7
|
+
show: boolean;
|
|
8
|
+
cursor: string;
|
|
9
|
+
coordinates?: number[];
|
|
10
|
+
src: string;
|
|
11
|
+
center: number[];
|
|
12
|
+
size: number[];
|
|
13
|
+
rotation: number;
|
|
14
|
+
editable: boolean;
|
|
15
|
+
userdata: K;
|
|
16
|
+
silent: boolean;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class Point<K = undefined> extends MapElement<PointOption<K>> {
|
|
21
|
+
type = "Point";
|
|
22
|
+
event = new Eventful<{
|
|
23
|
+
"data-loaded": () => void;
|
|
24
|
+
"data-update": () => void;
|
|
25
|
+
"pointer-in": () => void;
|
|
26
|
+
"pointer-out": () => void;
|
|
27
|
+
"left-click": () => void;
|
|
28
|
+
"right-click": () => void;
|
|
29
|
+
update: (keys: Set<string>) => void;
|
|
30
|
+
destroy: () => void;
|
|
31
|
+
}>();
|
|
32
|
+
|
|
33
|
+
get userdata() {
|
|
34
|
+
return this._option.userdata;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get cursor() {
|
|
38
|
+
return this._option.cursor;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get show() {
|
|
42
|
+
return this._option.show;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
set show(val) {
|
|
46
|
+
if (this._option.show != val) {
|
|
47
|
+
this._option.show = val;
|
|
48
|
+
this._update("show");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get silent() {
|
|
53
|
+
return this._option.silent;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
set silent(val) {
|
|
57
|
+
if (this._option.silent != val) {
|
|
58
|
+
this._option.silent = val;
|
|
59
|
+
this._update("silent");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get editable() {
|
|
64
|
+
return this._option.editable;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
set editable(val) {
|
|
68
|
+
if (this._option.editable != val) {
|
|
69
|
+
this._option.editable = val;
|
|
70
|
+
this._update("editable");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
get coordinates() {
|
|
75
|
+
return this._option.coordinates;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
set coordinates(val) {
|
|
79
|
+
if (this._option.coordinates != val) {
|
|
80
|
+
this._option.coordinates = val;
|
|
81
|
+
this._update("coordinates");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
get src() {
|
|
86
|
+
return this._option.src;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
set src(val) {
|
|
90
|
+
if (this._option.src != val) {
|
|
91
|
+
this._option.src = val;
|
|
92
|
+
this._update("src");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
get size() {
|
|
97
|
+
return this._option.size;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
set size(val) {
|
|
101
|
+
if (this._option.size != val) {
|
|
102
|
+
this._option.size = val;
|
|
103
|
+
this._update("size");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
get center() {
|
|
107
|
+
return this._option.center;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
set center(val) {
|
|
111
|
+
if (this._option.center != val) {
|
|
112
|
+
this._option.center = val;
|
|
113
|
+
this._update("center");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
get height() {
|
|
118
|
+
return this._option.height;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
set height(val) {
|
|
122
|
+
if (this._option.height != val) {
|
|
123
|
+
this._option.height = val;
|
|
124
|
+
this._update("height");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
get rotation() {
|
|
129
|
+
return this._option.rotation;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
set rotation(val) {
|
|
133
|
+
if (this._option.rotation != val) {
|
|
134
|
+
this._option.rotation = val;
|
|
135
|
+
this._update("rotation");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
constructor(map: MapCombine, option: Partial<PointOption<K>> = {}) {
|
|
140
|
+
super(map, Object.assign({ ...Point.option }, option));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
static option: PointOption<undefined> = {
|
|
144
|
+
name: "点",
|
|
145
|
+
show: true,
|
|
146
|
+
src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAIxJREFUOE+tU4ENgCAM6y5TL1MuEy+bmQjChAjIEkKAretIS1DBwAy3pnuXDAvgIGDT+RRfsEtYdZI6mxgoAFQWe6wAcgE0FicgHoA/aJeeF+rs/rBgYI9+u5WIFQa99K9mQwB+j1AjntLfGBlBZCssmoMAGiOkDjWmUvbcK0WVN1PGlS87i63JWTvECRNBLcaa3Jq0AAAAAElFTkSuQmCC",
|
|
147
|
+
center: [0.5, 0.5],
|
|
148
|
+
editable: false,
|
|
149
|
+
size: [16, 16],
|
|
150
|
+
rotation: 0,
|
|
151
|
+
cursor: "pointer",
|
|
152
|
+
userdata: undefined,
|
|
153
|
+
silent: false,
|
|
154
|
+
height: 3,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
private _needUpdate?: Set<string>;
|
|
158
|
+
private _update(key: string) {
|
|
159
|
+
if (this._needUpdate) {
|
|
160
|
+
this._needUpdate.add(key);
|
|
161
|
+
} else {
|
|
162
|
+
this._needUpdate = new Set([key]);
|
|
163
|
+
setTimeout(() => {
|
|
164
|
+
this.event.trigger("update", this._needUpdate);
|
|
165
|
+
this._needUpdate = undefined;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
protected _onDestroy(): void {
|
|
171
|
+
this.event.trigger("destroy");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -67,6 +67,7 @@ export class PointAggregation {
|
|
|
67
67
|
private _current = 0;
|
|
68
68
|
private _map: MapCombine;
|
|
69
69
|
private _option: PointAggregationOption;
|
|
70
|
+
private _onAfterViewChange;
|
|
70
71
|
|
|
71
72
|
/** 唯一标识 */
|
|
72
73
|
get name() {
|
|
@@ -89,10 +90,10 @@ export class PointAggregation {
|
|
|
89
90
|
this._map = map;
|
|
90
91
|
this._option = option;
|
|
91
92
|
const { event } = map;
|
|
93
|
+
// _onAfterViewChange 解决元素销毁 事件取消监听异常问题
|
|
94
|
+
this._onAfterViewChange = this.onAfterViewChange.bind(this);
|
|
92
95
|
this.onAfterViewChange();
|
|
93
|
-
event.on("view-moveEnd",
|
|
94
|
-
this.onAfterViewChange();
|
|
95
|
-
});
|
|
96
|
+
event.on("view-moveEnd", this._onAfterViewChange);
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
private _turnon(zoom: number) {
|
|
@@ -182,7 +183,7 @@ export class PointAggregation {
|
|
|
182
183
|
/** 销毁组件 */
|
|
183
184
|
destroy() {
|
|
184
185
|
const { event } = this._map;
|
|
185
|
-
event.
|
|
186
|
+
event.off("view-moveEnd", this._onAfterViewChange);
|
|
186
187
|
this._map.elements.delete(this.name);
|
|
187
188
|
this._cache.forEach((e) => {
|
|
188
189
|
e.forEach((f) => {
|
package/src/basic/Polygon.ts
CHANGED
|
@@ -1,180 +1,191 @@
|
|
|
1
|
-
import Eventful from "zrender/lib/core/Eventful"
|
|
1
|
+
import Eventful from "zrender/lib/core/Eventful";
|
|
2
2
|
|
|
3
|
-
import { MapElement, MapElementOption } from "./MapElement"
|
|
4
|
-
import { MapCombine } from "./MapCombine"
|
|
5
|
-
import { ContextMenuItem } from "./ContextMenu"
|
|
3
|
+
import { MapElement, MapElementOption } from "./MapElement";
|
|
4
|
+
import { MapCombine } from "./MapCombine";
|
|
5
|
+
import { ContextMenuItem } from "./ContextMenu";
|
|
6
6
|
|
|
7
7
|
export interface PolygonOption<K> extends MapElementOption {
|
|
8
|
-
show: boolean
|
|
9
|
-
cursor: string
|
|
10
|
-
coordinates?: number[][]
|
|
11
|
-
editable: boolean
|
|
12
|
-
userdata: K
|
|
13
|
-
silent: boolean
|
|
14
|
-
lineWidth: number
|
|
15
|
-
stroke: string
|
|
16
|
-
dash: boolean
|
|
17
|
-
fill: string
|
|
8
|
+
show: boolean;
|
|
9
|
+
cursor: string;
|
|
10
|
+
coordinates?: number[][];
|
|
11
|
+
editable: boolean;
|
|
12
|
+
userdata: K;
|
|
13
|
+
silent: boolean;
|
|
14
|
+
lineWidth: number;
|
|
15
|
+
stroke: string;
|
|
16
|
+
dash: boolean;
|
|
17
|
+
fill: string;
|
|
18
18
|
menu?: ContextMenuItem[];
|
|
19
|
+
height?: number;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export class Polygon<K = undefined> extends MapElement<PolygonOption<K>> {
|
|
22
|
-
type =
|
|
23
|
+
type = "Polygon";
|
|
23
24
|
event = new Eventful<{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}>()
|
|
25
|
+
"data-loaded": () => void;
|
|
26
|
+
"pointer-in": () => void;
|
|
27
|
+
"pointer-out": () => void;
|
|
28
|
+
"left-click": () => void;
|
|
29
|
+
"right-click": () => void;
|
|
30
|
+
"start-edit": () => void;
|
|
31
|
+
"stop-edit": () => void;
|
|
32
|
+
update: (keys: Set<string>) => void;
|
|
33
|
+
destroy: () => void;
|
|
34
|
+
}>();
|
|
34
35
|
|
|
35
36
|
get userdata() {
|
|
36
|
-
return this._option.userdata
|
|
37
|
+
return this._option.userdata;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
get cursor() {
|
|
40
|
-
return this._option.cursor
|
|
41
|
+
return this._option.cursor;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
get show() {
|
|
44
|
-
return this._option.show
|
|
45
|
+
return this._option.show;
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
+
|
|
47
48
|
set show(val) {
|
|
48
49
|
if (this._option.show != val) {
|
|
49
|
-
this._option.show = val
|
|
50
|
-
this._update(
|
|
50
|
+
this._option.show = val;
|
|
51
|
+
this._update("show");
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
get menu() {
|
|
55
|
-
return this._option.menu
|
|
56
|
+
return this._option.menu;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
set menu(val) {
|
|
59
|
-
this._option.menu = val
|
|
60
|
+
this._option.menu = val;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
get silent() {
|
|
63
|
-
return this._option.silent
|
|
64
|
+
return this._option.silent;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
set silent(val) {
|
|
67
68
|
if (this._option.silent != val) {
|
|
68
|
-
this._option.silent = val
|
|
69
|
-
this._update(
|
|
69
|
+
this._option.silent = val;
|
|
70
|
+
this._update("silent");
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
get editable() {
|
|
74
|
-
return this._option.editable
|
|
75
|
+
return this._option.editable;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
set editable(val) {
|
|
78
79
|
if (this._option.editable != val) {
|
|
79
|
-
this._option.editable = val
|
|
80
|
-
this._update(
|
|
80
|
+
this._option.editable = val;
|
|
81
|
+
this._update("editable");
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
get coordinates() {
|
|
85
|
-
return this._option.coordinates
|
|
86
|
+
return this._option.coordinates;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
set coordinates(val) {
|
|
89
90
|
if (this._option.coordinates != val) {
|
|
90
|
-
this._option.coordinates = val
|
|
91
|
-
this._update(
|
|
91
|
+
this._option.coordinates = val;
|
|
92
|
+
this._update("coordinates");
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
get lineWidth() {
|
|
96
|
-
return this._option.lineWidth
|
|
97
|
+
return this._option.lineWidth;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
set lineWidth(val) {
|
|
100
101
|
if (this._option.lineWidth != val) {
|
|
101
|
-
this._option.lineWidth = val
|
|
102
|
-
this._update(
|
|
102
|
+
this._option.lineWidth = val;
|
|
103
|
+
this._update("lineWidth");
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
get stroke() {
|
|
107
|
-
return this._option.stroke
|
|
108
|
+
return this._option.stroke;
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
set stroke(val) {
|
|
111
112
|
if (this._option.stroke != val) {
|
|
112
|
-
this._option.stroke = val
|
|
113
|
-
this._update(
|
|
113
|
+
this._option.stroke = val;
|
|
114
|
+
this._update("stroke");
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
get dash() {
|
|
117
|
-
return this._option.dash
|
|
118
|
+
return this._option.dash;
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
set dash(val) {
|
|
121
122
|
if (this._option.dash != val) {
|
|
122
|
-
this._option.dash = val
|
|
123
|
-
this._update(
|
|
123
|
+
this._option.dash = val;
|
|
124
|
+
this._update("dash");
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
get fill() {
|
|
128
|
-
return this._option.fill
|
|
129
|
+
return this._option.fill;
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
set fill(val) {
|
|
132
133
|
if (this._option.fill != val) {
|
|
133
|
-
this._option.fill = val
|
|
134
|
-
this._update(
|
|
134
|
+
this._option.fill = val;
|
|
135
|
+
this._update("fill");
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
get height() {
|
|
140
|
+
return this._option.height;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
set height(val) {
|
|
144
|
+
if (this._option.height != val) {
|
|
145
|
+
this._option.height = val;
|
|
146
|
+
this._update("height");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
138
149
|
|
|
139
150
|
constructor(map: MapCombine, option: Partial<PolygonOption<K>> = {}) {
|
|
140
|
-
super(map, Object.assign({ ...Polygon.option }, option))
|
|
151
|
+
super(map, Object.assign({ ...Polygon.option }, option));
|
|
141
152
|
}
|
|
142
153
|
|
|
143
154
|
static option: PolygonOption<undefined> = {
|
|
144
|
-
name:
|
|
155
|
+
name: "线",
|
|
145
156
|
show: true,
|
|
146
157
|
editable: false,
|
|
147
|
-
cursor:
|
|
158
|
+
cursor: "pointer",
|
|
148
159
|
userdata: undefined,
|
|
149
160
|
silent: false,
|
|
150
161
|
lineWidth: 2,
|
|
151
|
-
stroke:
|
|
162
|
+
stroke: "#FA792A",
|
|
152
163
|
dash: false,
|
|
153
|
-
fill:
|
|
154
|
-
|
|
164
|
+
fill: "#43F65588",
|
|
165
|
+
height: 1,
|
|
166
|
+
};
|
|
155
167
|
|
|
156
|
-
private _needUpdate?: Set<string
|
|
168
|
+
private _needUpdate?: Set<string>;
|
|
157
169
|
private _update(key: string) {
|
|
158
170
|
if (this._needUpdate) {
|
|
159
|
-
this._needUpdate.add(key)
|
|
171
|
+
this._needUpdate.add(key);
|
|
160
172
|
} else {
|
|
161
|
-
this._needUpdate = new Set([key])
|
|
173
|
+
this._needUpdate = new Set([key]);
|
|
162
174
|
setTimeout(() => {
|
|
163
|
-
this.event.trigger(
|
|
164
|
-
this._needUpdate = undefined
|
|
175
|
+
this.event.trigger("update", this._needUpdate);
|
|
176
|
+
this._needUpdate = undefined;
|
|
165
177
|
});
|
|
166
178
|
}
|
|
167
179
|
}
|
|
168
180
|
|
|
169
181
|
protected _onDestroy(): void {
|
|
170
|
-
this.event.trigger(
|
|
182
|
+
this.event.trigger("destroy");
|
|
171
183
|
}
|
|
172
184
|
|
|
173
|
-
|
|
174
185
|
startEdit() {
|
|
175
|
-
this.event.trigger(
|
|
186
|
+
this.event.trigger("start-edit");
|
|
176
187
|
}
|
|
177
188
|
stopEdit() {
|
|
178
|
-
this.event.trigger(
|
|
189
|
+
this.event.trigger("stop-edit");
|
|
179
190
|
}
|
|
180
|
-
}
|
|
191
|
+
}
|