cesium-pocket 0.5.2-alpha → 0.5.4-alpha
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/{CircleDrawer-49m1zEV5.js → CircleDrawer-DClMwtZ9.js} +182 -122
- package/{PolygonGaguger-Clq33-3p.js → PolygonGaguger-Brzz7_9X.js} +165 -159
- package/README.md +8 -5
- package/drawer.js +1 -1
- package/gauger.js +1 -1
- package/index.js +2 -2
- package/package.json +4 -3
- package/src/drawer/CP2dDrawer.d.ts +8 -5
- package/src/drawer/DataCenter.d.ts +11 -5
- package/src/drawer/DrawerStatus.d.ts +3 -1
- package/src/drawer/PointDrawer.d.ts +2 -2
- package/src/gauger/LineGaguger.d.ts +24 -5
- package/src/gauger/PolygonGaguger.d.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CustomDataSource as
|
|
2
|
-
import { toRaw as
|
|
1
|
+
import { CustomDataSource as O, Cartesian3 as r, JulianDate as U, defined as h, HeightReference as M, Color as E, EntityCollection as N, ScreenSpaceEventType as c, ConstantPositionProperty as A, ScreenSpaceEventHandler as C, VerticalOrigin as G, KeyboardEventModifier as b, PolylineDashMaterialProperty as x, CallbackProperty as p, PolygonHierarchy as B, Cartographic as P, Transforms as F, Matrix4 as m, EllipsoidGeodesic as Q } from "cesium";
|
|
2
|
+
import { toRaw as u } from "vue";
|
|
3
3
|
const l = {
|
|
4
4
|
STOPED: Symbol("STOPED"),
|
|
5
5
|
//未开启状态
|
|
@@ -7,8 +7,8 @@ const l = {
|
|
|
7
7
|
//可绘绘制状态
|
|
8
8
|
EDITABLE: Symbol("EDITABLE"),
|
|
9
9
|
//可编辑经纬度状态
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
INSERT: Symbol("INSERT"),
|
|
11
|
+
//可插入节点状态
|
|
12
12
|
DELETABLE: Symbol("DELETABLE")
|
|
13
13
|
//可删除状态
|
|
14
14
|
}, o = {
|
|
@@ -16,17 +16,19 @@ const l = {
|
|
|
16
16
|
//不可拖拽
|
|
17
17
|
DRAG_ENABLED: Symbol("DRAG_ENABLED"),
|
|
18
18
|
//可拖拽
|
|
19
|
-
DRAGING: Symbol("DRAGING")
|
|
19
|
+
DRAGING: Symbol("DRAGING"),
|
|
20
20
|
//正在拖拽中
|
|
21
|
-
|
|
21
|
+
CTRL_DOWN: Symbol("CTRL_DOWN")
|
|
22
|
+
//正在拖拽中
|
|
23
|
+
}, D = {
|
|
22
24
|
DEL_UNABLED: Symbol("DEL_UNABLED"),
|
|
23
25
|
//不删除
|
|
24
26
|
DEL_ENABLED: Symbol("DEL_ENABLED")
|
|
25
27
|
//可拖拽
|
|
26
28
|
};
|
|
27
|
-
class
|
|
29
|
+
class W {
|
|
28
30
|
constructor(e) {
|
|
29
|
-
this.status = l.STOPED, this.editStatus = o.DRAG_UNABLED, this.delStatus =
|
|
31
|
+
this.status = l.STOPED, this.editStatus = o.DRAG_UNABLED, this.delStatus = D.DEL_UNABLED, this.viewer = e;
|
|
30
32
|
}
|
|
31
33
|
getStatus() {
|
|
32
34
|
return this.status;
|
|
@@ -74,18 +76,20 @@ class k {
|
|
|
74
76
|
editDraging() {
|
|
75
77
|
this.editStatus = o.DRAGING, this.viewer.canvas.style.cursor = "move";
|
|
76
78
|
}
|
|
77
|
-
|
|
79
|
+
editCtrlDown() {
|
|
80
|
+
this.editStatus = o.CTRL_DOWN, this.viewer.canvas.style.cursor = "crosshair";
|
|
81
|
+
}
|
|
78
82
|
delUnable() {
|
|
79
|
-
this.delStatus =
|
|
83
|
+
this.delStatus = D.DEL_UNABLED, this.viewer.canvas.style.cursor = "pointer";
|
|
80
84
|
}
|
|
81
85
|
delEnable() {
|
|
82
|
-
this.delStatus =
|
|
86
|
+
this.delStatus = D.DEL_ENABLED, this.viewer.canvas.style.cursor = "grabbing";
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
|
-
const
|
|
86
|
-
class
|
|
89
|
+
const K = "data:image/png;base64,iVBORw0KG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jl+7xoq7XGJ0Cp75032HtAc5FN75jsG2VABGKU7n7BkF8b6TdBY8PmaFpa4QyIQAqneHiA5ral/yKLz1Pf2j4fz20dl2ODDIhADJI9MFQY8g17p2e+A92xniHZtcGACMQG61tiNieXlxGBRRLN8D6PRQfyyxwDfSKJQPqQYmNopbbEf4KyQLEX4n3alWabARGI7Qr0xMcg2M+9Z0h2LTMQWI4v4XsYWBlf+CL3niHZtcyACMRyASR8uRkQgZS7PoLOMgO6BGI5DQkvDBTDgAikGF7Fa0UYEIFUpJCSRjEMiECK4VW8VoQBEUhFCilpFMOAAwIpJnHxKgykYUAEkoYlsfGWARGIt6WXxNMwIAJJw5LYeMuACMTb0kviaRjwWyBpGBIbrxkQgXhdfkk+iQERSBJDMu81AyIQr8svyScxIAJJYkjmvWZABFJQ+cVtNRj4OQAAAP//gm46zwAAAAZJREFUAwB1f5TcL2bFTAAAAABJRU5ErkJggg==";
|
|
90
|
+
class S extends W {
|
|
87
91
|
constructor(e) {
|
|
88
|
-
super(e), this.mainData = [], this.dataSource = new
|
|
92
|
+
super(e), this.mainData = [], this.dataSource = new O("drawerDataSource"), this.currentDragPoint = null, this.currentIndex = -1, this.delConfirmFun = this.delCallback, this.viewer.dataSources.add(this.dataSource);
|
|
89
93
|
}
|
|
90
94
|
/**
|
|
91
95
|
* 获取DataSource
|
|
@@ -95,16 +99,28 @@ class w extends k {
|
|
|
95
99
|
return this.dataSource;
|
|
96
100
|
}
|
|
97
101
|
/**
|
|
98
|
-
*
|
|
102
|
+
* 根据dataSource更新mainData
|
|
99
103
|
* @returns Cartesian3[]
|
|
100
104
|
*/
|
|
101
|
-
|
|
105
|
+
dsToMd() {
|
|
102
106
|
return this.mainData = [], this.dataSource.entities.values.forEach((e) => {
|
|
103
107
|
var i;
|
|
104
108
|
const t = new r();
|
|
105
|
-
(i = e.position) == null || i.getValue(
|
|
109
|
+
(i = e.position) == null || i.getValue(U.now(), t), this.mainData.push(t);
|
|
106
110
|
}), this.mainData;
|
|
107
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* 根据mainData更新dataSource
|
|
114
|
+
* @returns Cartesian3[]
|
|
115
|
+
*/
|
|
116
|
+
MdToDs() {
|
|
117
|
+
this.dataSource.entities.removeAll();
|
|
118
|
+
for (let e = 0, t = this.mainData.length; e < t; e++) {
|
|
119
|
+
const i = this.mainData[e];
|
|
120
|
+
this.addPoint(i);
|
|
121
|
+
}
|
|
122
|
+
return this.dataSource;
|
|
123
|
+
}
|
|
108
124
|
clearAllData() {
|
|
109
125
|
this.mainData = [], this.currentDragPoint = null, this.currentIndex = -1, this.dataSource && this.viewer.dataSources.remove(this.dataSource, !0), super.stopStatus();
|
|
110
126
|
}
|
|
@@ -117,9 +133,9 @@ class w extends k {
|
|
|
117
133
|
}
|
|
118
134
|
}
|
|
119
135
|
deleteMoveFun(e) {
|
|
120
|
-
if (
|
|
136
|
+
if (D.DEL_UNABLED == super.getDelStatus()) {
|
|
121
137
|
const t = this.viewer.scene.pick(e.endPosition);
|
|
122
|
-
h(t) && h(t.id) && this.dataSource.entities.contains(
|
|
138
|
+
h(t) && h(t.id) && this.dataSource.entities.contains(u(t.id)) && this.delEnable();
|
|
123
139
|
} else
|
|
124
140
|
this.delUnable();
|
|
125
141
|
}
|
|
@@ -127,10 +143,10 @@ class w extends k {
|
|
|
127
143
|
let t = null;
|
|
128
144
|
return this.point ? t = this.point : t = {
|
|
129
145
|
pixelSize: 6,
|
|
130
|
-
color:
|
|
131
|
-
outlineColor:
|
|
146
|
+
color: E.TRANSPARENT,
|
|
147
|
+
outlineColor: E.YELLOW,
|
|
132
148
|
outlineWidth: 2,
|
|
133
|
-
heightReference:
|
|
149
|
+
heightReference: M.CLAMP_TO_GROUND
|
|
134
150
|
//贴地
|
|
135
151
|
}, this.dataSource.entities.add({
|
|
136
152
|
position: e,
|
|
@@ -144,7 +160,7 @@ class w extends k {
|
|
|
144
160
|
//在删除状态下,删除节点
|
|
145
161
|
deletePoint(e) {
|
|
146
162
|
this.delConfirmFun && this.delConfirmFun().then((t) => {
|
|
147
|
-
t && (this.dataSource.entities.remove(e), this.
|
|
163
|
+
t && (this.dataSource.entities.remove(e), this.dsToMd(), this.delCallbackFun && this.delCallbackFun());
|
|
148
164
|
});
|
|
149
165
|
}
|
|
150
166
|
delCallback() {
|
|
@@ -154,22 +170,22 @@ class w extends k {
|
|
|
154
170
|
});
|
|
155
171
|
}
|
|
156
172
|
}
|
|
157
|
-
class
|
|
173
|
+
class _ extends S {
|
|
158
174
|
constructor(e, t = null) {
|
|
159
|
-
super(e), this.handler = null, this.pointCollection = new
|
|
175
|
+
super(e), this.handler = null, this.pointCollection = new N(), this.addPointFun = this.addBillboardCallback, this.point_L_ClickEvent = () => {
|
|
160
176
|
var i;
|
|
161
177
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
162
178
|
if (l.DRAWABLE == super.getStatus()) {
|
|
163
|
-
let
|
|
164
|
-
if (h(
|
|
165
|
-
let
|
|
166
|
-
this.mainData.push(
|
|
179
|
+
let n = this.viewer.camera.getPickRay(a.position), s = this.viewer.scene.globe.pick(n, this.viewer.scene);
|
|
180
|
+
if (h(s)) {
|
|
181
|
+
let d = this.addPointFun(s);
|
|
182
|
+
this.mainData.push(s), this.pointCollection.add(d), this.afterAddPointFun && this.afterAddPointFun(d);
|
|
167
183
|
}
|
|
168
184
|
} else if (l.DELETABLE == super.getStatus()) {
|
|
169
|
-
const
|
|
170
|
-
if (h(
|
|
171
|
-
const
|
|
172
|
-
this.pointCollection.contains(
|
|
185
|
+
const n = this.viewer.scene.pick(a.position);
|
|
186
|
+
if (h(n) && h(n.id)) {
|
|
187
|
+
const s = u(n.id);
|
|
188
|
+
this.pointCollection.contains(s) && D.DEL_ENABLED == super.getDelStatus() && this.deleteBillboard(s);
|
|
173
189
|
}
|
|
174
190
|
}
|
|
175
191
|
}, c.LEFT_CLICK);
|
|
@@ -188,27 +204,27 @@ class O extends w {
|
|
|
188
204
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
189
205
|
if (l.EDITABLE == super.getStatus())
|
|
190
206
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
191
|
-
const
|
|
192
|
-
if (h(
|
|
193
|
-
let
|
|
194
|
-
this.currentDragPoint =
|
|
207
|
+
const n = this.viewer.scene.pick(a.endPosition);
|
|
208
|
+
if (h(n) && h(n.id) && this.pointCollection.contains(u(n.id))) {
|
|
209
|
+
let s = u(n.id);
|
|
210
|
+
this.currentDragPoint = s, this.editDragEnable();
|
|
195
211
|
}
|
|
196
212
|
} else if (o.DRAGING == super.getEditStatus()) {
|
|
197
|
-
const
|
|
198
|
-
h(
|
|
213
|
+
const n = this.viewer.scene.pickPosition(a.endPosition);
|
|
214
|
+
h(n) && this.currentDragPoint && (this.currentDragPoint.position = new A(n), this.editPointFun && this.editPointFun(n, this.currentDragPoint));
|
|
199
215
|
} else
|
|
200
216
|
this.editDragUnable();
|
|
201
217
|
else if (l.DELETABLE == super.getStatus())
|
|
202
|
-
if (
|
|
203
|
-
const
|
|
204
|
-
h(
|
|
218
|
+
if (D.DEL_UNABLED == super.getDelStatus()) {
|
|
219
|
+
const n = this.viewer.scene.pick(a.endPosition);
|
|
220
|
+
h(n) && h(n.id) && this.pointCollection.contains(u(n.id)) && this.delEnable();
|
|
205
221
|
} else
|
|
206
222
|
this.delUnable();
|
|
207
223
|
}, c.MOUSE_MOVE);
|
|
208
224
|
}, t && (this.addPointFun = t.addPointFun ? t.addPointFun : this.addBillboardCallback, this.delConfirmFun = t.delConfirmFun ? t.delConfirmFun : this.delCallback, t.afterAddPointFun && (this.afterAddPointFun = t.afterAddPointFun), t.editPointFun && (this.editPointFun = t.editPointFun));
|
|
209
225
|
}
|
|
210
226
|
start() {
|
|
211
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
227
|
+
super.drawableStatus(), this.handler || (this.handler = new C(this.viewer.scene.canvas)), this.point_L_ClickEvent(), this.point_L_DownEvent(), this.point_L_UpEvent(), this.point_moveEvent();
|
|
212
228
|
}
|
|
213
229
|
getEntities() {
|
|
214
230
|
return this.pointCollection;
|
|
@@ -227,14 +243,14 @@ class O extends w {
|
|
|
227
243
|
// 设置经纬度位置 (经度, 纬度, 海拔高度)
|
|
228
244
|
position: e,
|
|
229
245
|
billboard: {
|
|
230
|
-
image:
|
|
246
|
+
image: K,
|
|
231
247
|
// 设置图片显示的宽度和高度 (像素)
|
|
232
248
|
width: 40,
|
|
233
249
|
height: 40,
|
|
234
250
|
// 可选项:缩放倍数
|
|
235
251
|
scale: 1,
|
|
236
|
-
verticalOrigin:
|
|
237
|
-
heightReference:
|
|
252
|
+
verticalOrigin: G.BOTTOM,
|
|
253
|
+
heightReference: M.CLAMP_TO_GROUND
|
|
238
254
|
//贴地
|
|
239
255
|
},
|
|
240
256
|
show: !0
|
|
@@ -242,37 +258,56 @@ class O extends w {
|
|
|
242
258
|
}
|
|
243
259
|
deleteBillboard(e) {
|
|
244
260
|
this.delConfirmFun ? this.delConfirmFun().then((t) => {
|
|
245
|
-
t && (this.viewer.entities.remove(e), this.
|
|
246
|
-
}) : confirm("确定要删除吗?") && (this.viewer.entities.remove(e), this.
|
|
261
|
+
t && (this.viewer.entities.remove(e), this.dsToMd());
|
|
262
|
+
}) : confirm("确定要删除吗?") && (this.viewer.entities.remove(e), this.dsToMd());
|
|
247
263
|
}
|
|
248
264
|
}
|
|
249
|
-
const
|
|
265
|
+
const L = {
|
|
250
266
|
LINE: Symbol("LINE"),
|
|
251
267
|
//画线模式
|
|
252
268
|
POLYGON: Symbol("POLYGON")
|
|
253
269
|
//画面模式
|
|
254
270
|
};
|
|
255
|
-
class
|
|
271
|
+
class Z extends S {
|
|
256
272
|
constructor(e, t = null) {
|
|
257
|
-
super(e), this.handler = null, this.mainLineEntity = null, this.mainPolygonEntity = null, this.dashLineEntity = null, this.dashEndData = null, this.drawerMode =
|
|
273
|
+
super(e), this.handler = null, this.mainLineEntity = null, this.mainPolygonEntity = null, this.dashLineEntity = null, this.dashEndData = null, this.drawerMode = L.LINE, this.r_ClickEvent = () => {
|
|
258
274
|
var i;
|
|
259
275
|
(i = this.handler) == null || i.setInputAction(() => {
|
|
260
|
-
l.DRAWABLE == super.getStatus() && (this.dashLineEntity && this.viewer.entities.removeById(this.dashLineEntity.id), this.dashEndData = null, this.stopStatus(), this.
|
|
276
|
+
l.DRAWABLE == super.getStatus() && (this.dashLineEntity && this.viewer.entities.removeById(this.dashLineEntity.id), this.dashEndData = null, this.stopStatus(), this.stopDrawCallbackFun && this.stopDrawCallbackFun());
|
|
261
277
|
}, c.RIGHT_CLICK);
|
|
262
278
|
}, this.l_ClickEvent = () => {
|
|
263
279
|
var i;
|
|
264
280
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
265
281
|
if (l.DRAWABLE == super.getStatus()) {
|
|
266
|
-
let
|
|
267
|
-
|
|
282
|
+
let n = this.viewer.camera.getPickRay(a.position), s = this.viewer.scene.globe.pick(n, this.viewer.scene);
|
|
283
|
+
if (h(s)) {
|
|
284
|
+
const d = this.addPoint(s);
|
|
285
|
+
this.afterAddPointFun && this.afterAddPointFun(d), this.mainData.push(s), this.mainData.length > 0 && (this.mainLineEntity || this.createMainLine(), this.dashLineEntity || this.createDashline(), this.mainData.length > 1 && this.drawerMode === L.POLYGON && !this.mainPolygonEntity && this.createMainPolygon());
|
|
286
|
+
}
|
|
268
287
|
} else if (l.DELETABLE == super.getStatus()) {
|
|
269
|
-
const
|
|
270
|
-
if (h(
|
|
271
|
-
const
|
|
272
|
-
this.dataSource.entities.contains(
|
|
288
|
+
const n = this.viewer.scene.pick(a.position);
|
|
289
|
+
if (h(n) && h(n.id)) {
|
|
290
|
+
const s = u(n.id);
|
|
291
|
+
this.dataSource.entities.contains(s) && D.DEL_ENABLED == super.getDelStatus() && this.deletePoint(s);
|
|
273
292
|
}
|
|
274
293
|
}
|
|
275
294
|
}, c.LEFT_CLICK);
|
|
295
|
+
}, this.l_ClickCtrlEvent = () => {
|
|
296
|
+
var i;
|
|
297
|
+
(i = this.handler) == null || i.setInputAction(
|
|
298
|
+
(a) => {
|
|
299
|
+
if (l.EDITABLE == super.getStatus()) {
|
|
300
|
+
let n = this.viewer.camera.getPickRay(a.position), s = this.viewer.scene.globe.pick(n, this.viewer.scene);
|
|
301
|
+
if (h(s)) {
|
|
302
|
+
const d = this.addPoint(s);
|
|
303
|
+
let g = this.measurePoint(s);
|
|
304
|
+
this.mainData.splice(g, 0, s), this.MdToDs(), this.afterAddPointFun && this.afterAddPointFun(d);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
c.LEFT_CLICK,
|
|
309
|
+
b.CTRL
|
|
310
|
+
);
|
|
276
311
|
}, this.l_DownEvent = () => {
|
|
277
312
|
var i;
|
|
278
313
|
(i = this.handler) == null || i.setInputAction(() => {
|
|
@@ -286,12 +321,17 @@ class T extends w {
|
|
|
286
321
|
}, this.moveEvent = () => {
|
|
287
322
|
var i;
|
|
288
323
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
289
|
-
const
|
|
290
|
-
if (
|
|
291
|
-
const
|
|
292
|
-
h(
|
|
324
|
+
const n = this.viewer.camera.getPickRay(a.endPosition);
|
|
325
|
+
if (n) {
|
|
326
|
+
const s = this.viewer.scene.globe.pick(n, this.viewer.scene);
|
|
327
|
+
h(s) && (l.DRAWABLE == super.getStatus() ? (this.dashEndData = s, this.movingCallbackFun && this.movingCallbackFun(s)) : l.EDITABLE == super.getStatus() ? (this.dashLineEntity.show = !1, this.editMoveFun(a, s)) : l.DELETABLE == super.getStatus() && (this.dashLineEntity.show = !1, this.deleteMoveFun(a)));
|
|
293
328
|
}
|
|
294
329
|
}, c.MOUSE_MOVE);
|
|
330
|
+
}, this.moveCtrlEvent = () => {
|
|
331
|
+
var i;
|
|
332
|
+
(i = this.handler) == null || i.setInputAction((a) => {
|
|
333
|
+
this.viewer.camera.getPickRay(a.endPosition) && l.EDITABLE == super.getStatus() && this.editCtrlDown();
|
|
334
|
+
}, c.MOUSE_MOVE, b.CTRL);
|
|
295
335
|
}, this.createDashline = () => {
|
|
296
336
|
let i;
|
|
297
337
|
this.deshline ? i = this.deshline : i = {
|
|
@@ -300,46 +340,66 @@ class T extends w {
|
|
|
300
340
|
new r()
|
|
301
341
|
],
|
|
302
342
|
width: 2,
|
|
303
|
-
material: new
|
|
304
|
-
color:
|
|
343
|
+
material: new x({
|
|
344
|
+
color: E.RED,
|
|
305
345
|
dashLength: 15
|
|
306
346
|
}),
|
|
307
347
|
show: !0,
|
|
308
348
|
clampToGround: !0
|
|
309
|
-
}, i.positions = new
|
|
310
|
-
let a = this.mainData.length,
|
|
311
|
-
return
|
|
349
|
+
}, i.positions = new p(() => {
|
|
350
|
+
let a = this.mainData.length, n = this.mainData[a - 1];
|
|
351
|
+
return n || (n = this.mainData[a - 2]), this.dashEndData ? [n, this.dashEndData] : [n, new r()];
|
|
312
352
|
}, !1), this.dashLineEntity = this.viewer.entities.add({
|
|
313
353
|
polyline: i,
|
|
314
354
|
properties: {
|
|
315
355
|
entityType: "DASHLINE"
|
|
316
356
|
}
|
|
317
357
|
});
|
|
318
|
-
}, t && (t.drawerMode && (this.drawerMode = t.drawerMode), this.point = t.point, this.polyline = t.polyline, this.deshline = t.deshline, this.polygon = t.polygon, t.afterAddPointFun && (this.afterAddPointFun = t.afterAddPointFun), t.movingCallbackFun && (this.movingCallbackFun = t.movingCallbackFun), t.editCallbackFun && (this.editCallbackFun = t.editCallbackFun), t.delCallbackFun && (this.delCallbackFun = t.delCallbackFun), t.
|
|
358
|
+
}, t && (t.drawerMode && (this.drawerMode = t.drawerMode), this.point = t.point, this.polyline = t.polyline, this.deshline = t.deshline, this.polygon = t.polygon, t.afterAddPointFun && (this.afterAddPointFun = t.afterAddPointFun), t.movingCallbackFun && (this.movingCallbackFun = t.movingCallbackFun), t.editCallbackFun && (this.editCallbackFun = t.editCallbackFun), t.delCallbackFun && (this.delCallbackFun = t.delCallbackFun), t.stopDrawCallbackFun && (this.stopDrawCallbackFun = t.stopDrawCallbackFun), this.delConfirmFun = t.delConfirmFun ? t.delConfirmFun : this.delCallback);
|
|
319
359
|
}
|
|
320
360
|
start() {
|
|
321
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
361
|
+
super.drawableStatus(), this.handler || (this.handler = new C(this.viewer.scene.canvas)), this.r_ClickEvent(), this.l_ClickEvent(), this.l_ClickCtrlEvent(), this.l_DownEvent(), this.l_UpEvent(), this.moveCtrlEvent(), this.moveEvent();
|
|
322
362
|
}
|
|
323
363
|
getEntity() {
|
|
324
|
-
if (this.drawerMode ===
|
|
364
|
+
if (this.drawerMode === L.LINE)
|
|
325
365
|
return this.mainLineEntity;
|
|
326
|
-
if (this.drawerMode ===
|
|
366
|
+
if (this.drawerMode === L.POLYGON)
|
|
327
367
|
return this.mainPolygonEntity;
|
|
328
368
|
}
|
|
329
369
|
getPositions() {
|
|
330
|
-
return this.
|
|
370
|
+
return this.dsToMd();
|
|
331
371
|
}
|
|
332
372
|
clearAll() {
|
|
333
373
|
this.clearAllData(), this.handler = null, this.mainLineEntity && this.viewer.entities.removeById(this.mainLineEntity.id), this.mainPolygonEntity && this.viewer.entities.removeById(this.mainPolygonEntity.id), this.dashLineEntity && this.viewer.entities.removeById(this.dashLineEntity.id);
|
|
334
374
|
}
|
|
375
|
+
measurePoint(e) {
|
|
376
|
+
let t = 1 / 0, i = -1, a = 0;
|
|
377
|
+
for (let n = 0, s = this.mainData.length; n < s - 1; n++) {
|
|
378
|
+
const d = this.mainData[n], g = this.mainData[n + 1], v = r.subtract(g, d, new r()), R = r.subtract(e, d, new r()), I = r.dot(v, v);
|
|
379
|
+
let y, w;
|
|
380
|
+
if (I === 0)
|
|
381
|
+
y = r.distance(e, d), w = 0;
|
|
382
|
+
else {
|
|
383
|
+
w = r.dot(R, v) / I;
|
|
384
|
+
const k = Math.max(0, Math.min(1, w)), T = r.add(
|
|
385
|
+
d,
|
|
386
|
+
r.multiplyByScalar(v, k, new r()),
|
|
387
|
+
new r()
|
|
388
|
+
);
|
|
389
|
+
y = r.distance(e, T);
|
|
390
|
+
}
|
|
391
|
+
y < t && (t = y, i = n, a = w);
|
|
392
|
+
}
|
|
393
|
+
return (a > 1 || a < 0) && (i == 0 ? i = -1 : i == this.mainData.length - 2 && (i = i + 1)), i + 1;
|
|
394
|
+
}
|
|
335
395
|
editMoveFun(e, t) {
|
|
336
396
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
337
397
|
const i = this.viewer.scene.pick(e.endPosition);
|
|
338
|
-
if (h(i) && h(i.id) && this.dataSource.entities.contains(
|
|
339
|
-
let a =
|
|
398
|
+
if (h(i) && h(i.id) && this.dataSource.entities.contains(u(i.id))) {
|
|
399
|
+
let a = u(i.id);
|
|
340
400
|
this.currentDragPoint = a, this.editDragEnable();
|
|
341
401
|
}
|
|
342
|
-
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new
|
|
402
|
+
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new A(t), this.mainData[this.currentIndex] = t, this.editCallbackFun && this.editCallbackFun(t, this.currentIndex)) : this.editDragUnable();
|
|
343
403
|
}
|
|
344
404
|
//创建主线数据
|
|
345
405
|
createMainLine() {
|
|
@@ -349,11 +409,11 @@ class T extends w {
|
|
|
349
409
|
// 宽度
|
|
350
410
|
width: 2,
|
|
351
411
|
// 线的颜色
|
|
352
|
-
material:
|
|
412
|
+
material: E.RED,
|
|
353
413
|
// 是否显示
|
|
354
414
|
show: !0,
|
|
355
415
|
clampToGround: !0
|
|
356
|
-
}, e.positions = new
|
|
416
|
+
}, e.positions = new p(() => this.mainData, !1), this.mainLineEntity = this.viewer.entities.add({
|
|
357
417
|
polyline: e,
|
|
358
418
|
properties: {
|
|
359
419
|
entityType: "LINE"
|
|
@@ -365,11 +425,11 @@ class T extends w {
|
|
|
365
425
|
let e;
|
|
366
426
|
this.polygon ? e = this.polygon : e = {
|
|
367
427
|
hierarchy: [new r(), new r(), new r()],
|
|
368
|
-
material:
|
|
428
|
+
material: E.RED.withAlpha(0.4),
|
|
369
429
|
outline: !1
|
|
370
|
-
}, e.hierarchy = new
|
|
430
|
+
}, e.hierarchy = new p(() => {
|
|
371
431
|
let t = this.mainData;
|
|
372
|
-
return this.dashEndData && (t = [...this.mainData, this.dashEndData]), new
|
|
432
|
+
return this.dashEndData && (t = [...this.mainData, this.dashEndData]), new B(t);
|
|
373
433
|
}, !1), this.mainPolygonEntity = this.viewer.entities.add({
|
|
374
434
|
polygon: e,
|
|
375
435
|
properties: {
|
|
@@ -378,14 +438,14 @@ class T extends w {
|
|
|
378
438
|
});
|
|
379
439
|
}
|
|
380
440
|
}
|
|
381
|
-
class
|
|
441
|
+
class V extends S {
|
|
382
442
|
constructor(e, t = null) {
|
|
383
443
|
super(e), this.handler = null, this.firstPoint = null, this.endPoint = null, this.lineEntity = null, this.polygonEntity = null, this.rect_L_ClickEvent = () => {
|
|
384
444
|
var i;
|
|
385
445
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
386
446
|
if (l.DRAWABLE == super.getStatus()) {
|
|
387
|
-
let
|
|
388
|
-
h(
|
|
447
|
+
let n = this.viewer.camera.getPickRay(a.position), s = this.viewer.scene.globe.pick(n, this.viewer.scene);
|
|
448
|
+
h(s) && (this.mainData.length === 0 ? (this.addPoint(s), this.firstPoint = s, this.mainData.push(s), this.createLine(), this.createPolygon()) : (this.addPoint(s), this.endPoint = s, this.stopStatus(), this.initMainData(), this.rectOverFun && this.rectOverFun(this.mainData)));
|
|
389
449
|
}
|
|
390
450
|
}, c.LEFT_CLICK);
|
|
391
451
|
}, this.rect_L_DownEvent = () => {
|
|
@@ -401,22 +461,22 @@ class x extends w {
|
|
|
401
461
|
}, this.rect_moveEvent = () => {
|
|
402
462
|
var i;
|
|
403
463
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
406
|
-
const
|
|
407
|
-
h(
|
|
464
|
+
const n = this.viewer.camera.getPickRay(a.endPosition);
|
|
465
|
+
if (n) {
|
|
466
|
+
const s = this.viewer.scene.globe.pick(n, this.viewer.scene);
|
|
467
|
+
h(s) && (l.DRAWABLE == super.getStatus() ? this.firstPoint && (this.endPoint = s, this.initMainData(), this.rectMovingFun && this.rectMovingFun(this.mainData)) : l.EDITABLE == super.getStatus() && (this.rectMove(a, s), this.rectEditFun && this.rectEditFun(this.mainData)));
|
|
408
468
|
}
|
|
409
469
|
}, c.MOUSE_MOVE);
|
|
410
470
|
}, t && (this.point = t.point, this.polyline = t.polyline, this.polygon = t.polygon, t.rectOverFun && (this.rectOverFun = t.rectOverFun), t.rectMovingFun && (this.rectMovingFun = t.rectMovingFun), t.rectEditFun && (this.rectEditFun = t.rectEditFun));
|
|
411
471
|
}
|
|
412
472
|
start() {
|
|
413
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
473
|
+
super.drawableStatus(), this.handler || (this.handler = new C(this.viewer.scene.canvas)), this.rect_L_ClickEvent(), this.rect_L_DownEvent(), this.rect_L_UpEvent(), this.rect_moveEvent();
|
|
414
474
|
}
|
|
415
475
|
getEntity() {
|
|
416
476
|
this.polygonEntity;
|
|
417
477
|
}
|
|
418
478
|
getPositions() {
|
|
419
|
-
return this.
|
|
479
|
+
return this.dsToMd();
|
|
420
480
|
}
|
|
421
481
|
clearAll() {
|
|
422
482
|
this.clearAllData(), this.firstPoint = new r(), this.endPoint = new r(), this.mainData = [], this.handler && (this.handler = null), this.polygonEntity && this.viewer.entities.removeById(this.polygonEntity.id), this.lineEntity && this.viewer.entities.removeById(this.lineEntity.id);
|
|
@@ -424,16 +484,16 @@ class x extends w {
|
|
|
424
484
|
rectMove(e, t) {
|
|
425
485
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
426
486
|
const i = this.viewer.scene.pick(e.endPosition);
|
|
427
|
-
if (h(i) && h(i.id) && this.dataSource.entities.contains(
|
|
428
|
-
let a =
|
|
487
|
+
if (h(i) && h(i.id) && this.dataSource.entities.contains(u(i.id))) {
|
|
488
|
+
let a = u(i.id);
|
|
429
489
|
this.currentDragPoint = a, this.editDragEnable();
|
|
430
490
|
}
|
|
431
|
-
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new
|
|
491
|
+
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new A(t), this.currentIndex === 0 ? this.firstPoint = t : this.endPoint = t, this.initMainData()) : this.editDragUnable();
|
|
432
492
|
}
|
|
433
493
|
initMainData() {
|
|
434
494
|
if (this.firstPoint && this.endPoint) {
|
|
435
|
-
const e =
|
|
436
|
-
this.mainData[0] = this.firstPoint, this.mainData[1] =
|
|
495
|
+
const e = P.fromCartesian(this.firstPoint), t = e.longitude, i = e.latitude, a = P.fromCartesian(this.endPoint), n = a.longitude, s = a.latitude, d = r.fromRadians(t, s), g = r.fromRadians(n, i);
|
|
496
|
+
this.mainData[0] = this.firstPoint, this.mainData[1] = d, this.mainData[2] = this.endPoint, this.mainData[3] = g;
|
|
437
497
|
}
|
|
438
498
|
}
|
|
439
499
|
//创建主线数据
|
|
@@ -444,11 +504,11 @@ class x extends w {
|
|
|
444
504
|
// 宽度
|
|
445
505
|
width: 2,
|
|
446
506
|
// 线的颜色
|
|
447
|
-
material:
|
|
507
|
+
material: E.RED,
|
|
448
508
|
// 是否显示
|
|
449
509
|
show: !0,
|
|
450
510
|
clampToGround: !0
|
|
451
|
-
}, e.positions = new
|
|
511
|
+
}, e.positions = new p(() => [...this.mainData, this.mainData[0]], !1), this.lineEntity = this.viewer.entities.add({
|
|
452
512
|
polyline: e,
|
|
453
513
|
properties: {
|
|
454
514
|
entityType: "LINE"
|
|
@@ -460,9 +520,9 @@ class x extends w {
|
|
|
460
520
|
let e = null;
|
|
461
521
|
this.polygon ? e = this.polygon : e = {
|
|
462
522
|
hierarchy: [new r(), new r(), new r()],
|
|
463
|
-
material:
|
|
523
|
+
material: E.RED.withAlpha(0.4),
|
|
464
524
|
outline: !1
|
|
465
|
-
}, e.hierarchy = new
|
|
525
|
+
}, e.hierarchy = new p(() => new B(this.mainData), !1), this.polygonEntity = this.viewer.entities.add({
|
|
466
526
|
polygon: e,
|
|
467
527
|
properties: {
|
|
468
528
|
entityType: "POLYGON"
|
|
@@ -470,14 +530,14 @@ class x extends w {
|
|
|
470
530
|
});
|
|
471
531
|
}
|
|
472
532
|
}
|
|
473
|
-
class
|
|
533
|
+
class X extends S {
|
|
474
534
|
constructor(e, t = null) {
|
|
475
535
|
super(e), this.handler = null, this.firstPoint = new r(), this.endPoint = new r(), this.distance = 0, this.angle = 0, this.endPointEntity = null, this.ellipseEntity = null, this.circle_L_ClickEvent = () => {
|
|
476
536
|
var i;
|
|
477
537
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
478
538
|
if (l.DRAWABLE == super.getStatus()) {
|
|
479
|
-
let
|
|
480
|
-
h(
|
|
539
|
+
let n = this.viewer.camera.getPickRay(a.position), s = this.viewer.scene.globe.pick(n, this.viewer.scene);
|
|
540
|
+
h(s) && (this.mainData.length === 0 ? (this.addPoint(s), this.mainData.push(s), this.firstPoint = s, this.createCircle()) : (this.endPoint = s, this.mainData.push(s), this.endPointEntity = this.addPoint(s), this.setAngle(), this.stopStatus(), this.circleOverFun && this.circleOverFun(this.firstPoint, this.endPoint)));
|
|
481
541
|
}
|
|
482
542
|
}, c.LEFT_CLICK);
|
|
483
543
|
}, this.circle_L_DownEvent = () => {
|
|
@@ -493,38 +553,38 @@ class Q extends w {
|
|
|
493
553
|
}, this.circle_moveEvent = () => {
|
|
494
554
|
var i;
|
|
495
555
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
496
|
-
const
|
|
497
|
-
if (
|
|
498
|
-
const
|
|
499
|
-
h(
|
|
556
|
+
const n = this.viewer.camera.getPickRay(a.endPosition);
|
|
557
|
+
if (n) {
|
|
558
|
+
const s = this.viewer.scene.globe.pick(n, this.viewer.scene);
|
|
559
|
+
h(s) && (l.DRAWABLE == super.getStatus() ? this.mainData.length > 0 && (this.endPoint = s, this.countDistance(), this.circleMovingFun && this.circleMovingFun(this.firstPoint, s)) : l.EDITABLE == super.getStatus() && (this.circleMove(a, s), this.circleEditFun && this.circleEditFun(this.firstPoint, this.endPoint)));
|
|
500
560
|
}
|
|
501
561
|
}, c.MOUSE_MOVE);
|
|
502
562
|
}, t && (this.point = t.point, this.ellipse = t.ellipse, t.circleOverFun && (this.circleOverFun = t.circleOverFun), t.circleMovingFun && (this.circleMovingFun = t.circleMovingFun), t.circleEditFun && (this.circleEditFun = t.circleEditFun));
|
|
503
563
|
}
|
|
504
564
|
start() {
|
|
505
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
565
|
+
super.drawableStatus(), this.handler || (this.handler = new C(this.viewer.scene.canvas)), this.circle_L_ClickEvent(), this.circle_L_DownEvent(), this.circle_L_UpEvent(), this.circle_moveEvent();
|
|
506
566
|
}
|
|
507
567
|
getEntity() {
|
|
508
568
|
return this.ellipseEntity;
|
|
509
569
|
}
|
|
510
570
|
getPositions() {
|
|
511
|
-
return this.
|
|
571
|
+
return this.dsToMd();
|
|
512
572
|
}
|
|
513
573
|
clearAll() {
|
|
514
574
|
this.clearAllData(), this.firstPoint = new r(), this.endPoint = new r(), this.handler && (this.handler = null), this.ellipseEntity && this.viewer.entities.removeById(this.ellipseEntity.id);
|
|
515
575
|
}
|
|
516
576
|
setAngle() {
|
|
517
|
-
const e =
|
|
577
|
+
const e = F.eastNorthUpToFixedFrame(this.firstPoint.clone()), t = m.inverse(e, new m()), i = m.multiplyByPoint(t, this.endPoint.clone(), new r());
|
|
518
578
|
this.angle = Math.atan2(i.x, i.y);
|
|
519
579
|
}
|
|
520
580
|
circleMove(e, t) {
|
|
521
581
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
522
582
|
const i = this.viewer.scene.pick(e.endPosition);
|
|
523
|
-
if (h(i) && h(i.id) && this.dataSource.entities.contains(
|
|
524
|
-
let a =
|
|
583
|
+
if (h(i) && h(i.id) && this.dataSource.entities.contains(u(i.id))) {
|
|
584
|
+
let a = u(i.id);
|
|
525
585
|
this.currentDragPoint = a, this.editDragEnable();
|
|
526
586
|
}
|
|
527
|
-
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new
|
|
587
|
+
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new A(t), this.currentIndex === 0 ? (this.firstPoint = t, this.ellipseEntity && (this.ellipseEntity.position = new A(this.firstPoint)), this.endPointEntity && (this.updateEndPoint(), this.endPointEntity.position = new A(this.endPoint))) : (this.endPoint = t, this.countDistance())) : this.editDragUnable();
|
|
528
588
|
}
|
|
529
589
|
updateEndPoint() {
|
|
530
590
|
var e = new r(
|
|
@@ -532,12 +592,12 @@ class Q extends w {
|
|
|
532
592
|
this.distance * Math.cos(this.angle),
|
|
533
593
|
0
|
|
534
594
|
// 保持水平,如果希望保持高度则设为 localEdge.z
|
|
535
|
-
), t =
|
|
595
|
+
), t = F.eastNorthUpToFixedFrame(this.firstPoint), i = m.multiplyByPointAsVector(t, e, new r());
|
|
536
596
|
this.endPoint = r.add(this.firstPoint, i, new r());
|
|
537
597
|
}
|
|
538
598
|
countDistance() {
|
|
539
599
|
if (this.firstPoint && this.endPoint) {
|
|
540
|
-
const e =
|
|
600
|
+
const e = P.fromCartesian(this.firstPoint), t = P.fromCartesian(this.endPoint), i = new Q(e, t);
|
|
541
601
|
this.distance = i.surfaceDistance;
|
|
542
602
|
}
|
|
543
603
|
}
|
|
@@ -549,7 +609,7 @@ class Q extends w {
|
|
|
549
609
|
// 短半轴(米)
|
|
550
610
|
semiMajorAxis: 1,
|
|
551
611
|
// 长半轴(米)— 两者相等即为圆
|
|
552
|
-
material:
|
|
612
|
+
material: E.RED.withAlpha(0.6),
|
|
553
613
|
// 填充颜色,半透明
|
|
554
614
|
height: 0,
|
|
555
615
|
// 椭圆所在高度(米),可选
|
|
@@ -557,9 +617,9 @@ class Q extends w {
|
|
|
557
617
|
// 拉伸高度,>0 会形成圆柱体,设为0则为平面
|
|
558
618
|
outline: !0,
|
|
559
619
|
// 是否显示边框
|
|
560
|
-
outlineColor:
|
|
561
|
-
}, e.semiMinorAxis = e.semiMajorAxis = new
|
|
562
|
-
position: new
|
|
620
|
+
outlineColor: E.RED
|
|
621
|
+
}, e.semiMinorAxis = e.semiMajorAxis = new p(() => this.distance, !1), this.ellipseEntity = this.viewer.entities.add({
|
|
622
|
+
position: new A(this.firstPoint),
|
|
563
623
|
ellipse: e,
|
|
564
624
|
properties: {
|
|
565
625
|
entityType: "ELLIPSE"
|
|
@@ -568,10 +628,10 @@ class Q extends w {
|
|
|
568
628
|
}
|
|
569
629
|
}
|
|
570
630
|
export {
|
|
571
|
-
|
|
631
|
+
Z as C,
|
|
572
632
|
l as D,
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
633
|
+
_ as P,
|
|
634
|
+
V as R,
|
|
635
|
+
X as a,
|
|
636
|
+
L as b
|
|
577
637
|
};
|