cesium-pocket 0.5.2-alpha → 0.5.3-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-Cl5jgThe.js} +135 -78
- package/{PolygonGaguger-Clq33-3p.js → PolygonGaguger-CjUuWtEz.js} +1 -1
- 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 +3 -0
- package/src/drawer/DataCenter.d.ts +7 -2
- package/src/drawer/DrawerStatus.d.ts +3 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomDataSource 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 P, VerticalOrigin as G, KeyboardEventModifier as b, PolylineDashMaterialProperty as x, CallbackProperty as f, PolygonHierarchy as B, Cartographic as L, Transforms as F, Matrix4 as w, EllipsoidGeodesic as Q } from "cesium";
|
|
2
2
|
import { toRaw as d } from "vue";
|
|
3
3
|
const l = {
|
|
4
4
|
STOPED: Symbol("STOPED"),
|
|
@@ -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,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAQAElEQVR4AexdfYwkR3V/r3dnb884wUd03O1HTrZj4p09/CFMSBwpkqX8Ayjkj6ALQY6ixHIc8REJRUoiJUK+80e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GACMQG61tiNieXlxGBRRLN8D6PRQfyyxwDfSKJQPqQYmNopbbEf4KyQLEX4n3alWabARGI7Qr0xMcg2M+9Z0h2LTMQWI4v4XsYWBlf+CL3niHZtcyACMRyASR8uRkQgZS7PoLOMgO6BGI5DQkvDBTDgAikGF7Fa0UYEIFUpJCSRjEMiECK4VW8VoQBEUhFCilpFMOAAwIpJnHxKgykYUAEkoYlsfGWARGIt6WXxNMwIAJJw5LYeMuACMTb0kviaRjwWyBpGBIbrxkQgXhdfkk+iQERSBJDMu81AyIQr8svyScxIAJJYkjmvWZABFJQ+cVtNRj4OQAAAP//gm46zwAAAAZJREFUAwB1f5TcL2bFTAAAAABJRU5ErkJggg==";
|
|
90
|
+
class C 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,7 +133,7 @@ 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
138
|
h(t) && h(t.id) && this.dataSource.entities.contains(d(t.id)) && this.delEnable();
|
|
123
139
|
} else
|
|
@@ -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 C {
|
|
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
179
|
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
164
180
|
if (h(n)) {
|
|
165
|
-
let
|
|
166
|
-
this.mainData.push(n), this.pointCollection.add(
|
|
181
|
+
let u = this.addPointFun(n);
|
|
182
|
+
this.mainData.push(n), this.pointCollection.add(u), this.afterAddPointFun && this.afterAddPointFun(n);
|
|
167
183
|
}
|
|
168
184
|
} else if (l.DELETABLE == super.getStatus()) {
|
|
169
185
|
const s = this.viewer.scene.pick(a.position);
|
|
170
186
|
if (h(s) && h(s.id)) {
|
|
171
187
|
const n = d(s.id);
|
|
172
|
-
this.pointCollection.contains(n) &&
|
|
188
|
+
this.pointCollection.contains(n) && D.DEL_ENABLED == super.getDelStatus() && this.deleteBillboard(n);
|
|
173
189
|
}
|
|
174
190
|
}
|
|
175
191
|
}, c.LEFT_CLICK);
|
|
@@ -195,11 +211,11 @@ class O extends w {
|
|
|
195
211
|
}
|
|
196
212
|
} else if (o.DRAGING == super.getEditStatus()) {
|
|
197
213
|
const s = this.viewer.scene.pickPosition(a.endPosition);
|
|
198
|
-
h(s) && this.currentDragPoint && (this.currentDragPoint.position = new
|
|
214
|
+
h(s) && this.currentDragPoint && (this.currentDragPoint.position = new A(s), this.editPointFun && this.editPointFun(s, this.currentDragPoint));
|
|
199
215
|
} else
|
|
200
216
|
this.editDragUnable();
|
|
201
217
|
else if (l.DELETABLE == super.getStatus())
|
|
202
|
-
if (
|
|
218
|
+
if (D.DEL_UNABLED == super.getDelStatus()) {
|
|
203
219
|
const s = this.viewer.scene.pick(a.endPosition);
|
|
204
220
|
h(s) && h(s.id) && this.pointCollection.contains(d(s.id)) && this.delEnable();
|
|
205
221
|
} else
|
|
@@ -208,7 +224,7 @@ class O extends w {
|
|
|
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 P(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,19 +258,19 @@ 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 m = {
|
|
250
266
|
LINE: Symbol("LINE"),
|
|
251
267
|
//画线模式
|
|
252
268
|
POLYGON: Symbol("POLYGON")
|
|
253
269
|
//画面模式
|
|
254
270
|
};
|
|
255
|
-
class
|
|
271
|
+
class Z extends C {
|
|
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 = m.LINE, this.r_ClickEvent = () => {
|
|
258
274
|
var i;
|
|
259
275
|
(i = this.handler) == null || i.setInputAction(() => {
|
|
260
276
|
l.DRAWABLE == super.getStatus() && (this.dashLineEntity && this.viewer.entities.removeById(this.dashLineEntity.id), this.dashEndData = null, this.stopStatus(), this.overCallbackFun && this.overCallbackFun());
|
|
@@ -264,15 +280,31 @@ class T extends w {
|
|
|
264
280
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
265
281
|
if (l.DRAWABLE == super.getStatus()) {
|
|
266
282
|
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
267
|
-
h(n) && (this.addPoint(n), this.afterAddPointFun && this.afterAddPointFun(n), this.mainData.push(n), this.mainData.length > 0 && (this.mainLineEntity || this.createMainLine(), this.dashLineEntity || this.createDashline(), this.mainData.length > 1 && this.drawerMode ===
|
|
283
|
+
h(n) && (this.addPoint(n), this.afterAddPointFun && this.afterAddPointFun(n), this.mainData.push(n), this.mainData.length > 0 && (this.mainLineEntity || this.createMainLine(), this.dashLineEntity || this.createDashline(), this.mainData.length > 1 && this.drawerMode === m.POLYGON && !this.mainPolygonEntity && this.createMainPolygon()));
|
|
268
284
|
} else if (l.DELETABLE == super.getStatus()) {
|
|
269
285
|
const s = this.viewer.scene.pick(a.position);
|
|
270
286
|
if (h(s) && h(s.id)) {
|
|
271
287
|
const n = d(s.id);
|
|
272
|
-
this.dataSource.entities.contains(n) &&
|
|
288
|
+
this.dataSource.entities.contains(n) && D.DEL_ENABLED == super.getDelStatus() && this.deletePoint(n);
|
|
273
289
|
}
|
|
274
290
|
}
|
|
275
291
|
}, c.LEFT_CLICK);
|
|
292
|
+
}, this.l_ClickCtrlEvent = () => {
|
|
293
|
+
var i;
|
|
294
|
+
(i = this.handler) == null || i.setInputAction(
|
|
295
|
+
(a) => {
|
|
296
|
+
if (l.EDITABLE == super.getStatus()) {
|
|
297
|
+
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
298
|
+
if (h(n)) {
|
|
299
|
+
this.addPoint(n), this.afterAddPointFun && this.afterAddPointFun(n);
|
|
300
|
+
let u = this.measurePoint(n);
|
|
301
|
+
this.mainData.splice(u, 0, n), this.MdToDs();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
c.LEFT_CLICK,
|
|
306
|
+
b.CTRL
|
|
307
|
+
);
|
|
276
308
|
}, this.l_DownEvent = () => {
|
|
277
309
|
var i;
|
|
278
310
|
(i = this.handler) == null || i.setInputAction(() => {
|
|
@@ -292,6 +324,11 @@ class T extends w {
|
|
|
292
324
|
h(n) && (l.DRAWABLE == super.getStatus() ? (this.dashEndData = n, this.movingCallbackFun && this.movingCallbackFun(n)) : l.EDITABLE == super.getStatus() ? (this.dashLineEntity.show = !1, this.editMoveFun(a, n)) : l.DELETABLE == super.getStatus() && (this.dashLineEntity.show = !1, this.deleteMoveFun(a)));
|
|
293
325
|
}
|
|
294
326
|
}, c.MOUSE_MOVE);
|
|
327
|
+
}, this.moveCtrlEvent = () => {
|
|
328
|
+
var i;
|
|
329
|
+
(i = this.handler) == null || i.setInputAction((a) => {
|
|
330
|
+
this.viewer.camera.getPickRay(a.endPosition) && l.EDITABLE == super.getStatus() && this.editCtrlDown();
|
|
331
|
+
}, c.MOUSE_MOVE, b.CTRL);
|
|
295
332
|
}, this.createDashline = () => {
|
|
296
333
|
let i;
|
|
297
334
|
this.deshline ? i = this.deshline : i = {
|
|
@@ -300,13 +337,13 @@ class T extends w {
|
|
|
300
337
|
new r()
|
|
301
338
|
],
|
|
302
339
|
width: 2,
|
|
303
|
-
material: new
|
|
304
|
-
color:
|
|
340
|
+
material: new x({
|
|
341
|
+
color: E.RED,
|
|
305
342
|
dashLength: 15
|
|
306
343
|
}),
|
|
307
344
|
show: !0,
|
|
308
345
|
clampToGround: !0
|
|
309
|
-
}, i.positions = new
|
|
346
|
+
}, i.positions = new f(() => {
|
|
310
347
|
let a = this.mainData.length, s = this.mainData[a - 1];
|
|
311
348
|
return s || (s = this.mainData[a - 2]), this.dashEndData ? [s, this.dashEndData] : [s, new r()];
|
|
312
349
|
}, !1), this.dashLineEntity = this.viewer.entities.add({
|
|
@@ -318,20 +355,40 @@ class T extends w {
|
|
|
318
355
|
}, 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.overCallbackFun && (this.overCallbackFun = t.overCallbackFun), this.delConfirmFun = t.delConfirmFun ? t.delConfirmFun : this.delCallback);
|
|
319
356
|
}
|
|
320
357
|
start() {
|
|
321
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
358
|
+
super.drawableStatus(), this.handler || (this.handler = new P(this.viewer.scene.canvas)), this.r_ClickEvent(), this.l_ClickEvent(), this.l_ClickCtrlEvent(), this.l_DownEvent(), this.l_UpEvent(), this.moveCtrlEvent(), this.moveEvent();
|
|
322
359
|
}
|
|
323
360
|
getEntity() {
|
|
324
|
-
if (this.drawerMode ===
|
|
361
|
+
if (this.drawerMode === m.LINE)
|
|
325
362
|
return this.mainLineEntity;
|
|
326
|
-
if (this.drawerMode ===
|
|
363
|
+
if (this.drawerMode === m.POLYGON)
|
|
327
364
|
return this.mainPolygonEntity;
|
|
328
365
|
}
|
|
329
366
|
getPositions() {
|
|
330
|
-
return this.
|
|
367
|
+
return this.dsToMd();
|
|
331
368
|
}
|
|
332
369
|
clearAll() {
|
|
333
370
|
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
371
|
}
|
|
372
|
+
measurePoint(e) {
|
|
373
|
+
let t = 1 / 0, i = -1, a = 0;
|
|
374
|
+
for (let s = 0, n = this.mainData.length; s < n - 1; s++) {
|
|
375
|
+
const u = this.mainData[s], S = this.mainData[s + 1], g = r.subtract(S, u, new r()), R = r.subtract(e, u, new r()), I = r.dot(g, g);
|
|
376
|
+
let v, y;
|
|
377
|
+
if (I === 0)
|
|
378
|
+
v = r.distance(e, u), y = 0;
|
|
379
|
+
else {
|
|
380
|
+
y = r.dot(R, g) / I;
|
|
381
|
+
const k = Math.max(0, Math.min(1, y)), T = r.add(
|
|
382
|
+
u,
|
|
383
|
+
r.multiplyByScalar(g, k, new r()),
|
|
384
|
+
new r()
|
|
385
|
+
);
|
|
386
|
+
v = r.distance(e, T);
|
|
387
|
+
}
|
|
388
|
+
v < t && (t = v, i = s, a = y);
|
|
389
|
+
}
|
|
390
|
+
return (a > 1 || a < 0) && (i == 0 ? i = -1 : i == this.mainData.length - 2 && (i = i + 1)), i + 1;
|
|
391
|
+
}
|
|
335
392
|
editMoveFun(e, t) {
|
|
336
393
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
337
394
|
const i = this.viewer.scene.pick(e.endPosition);
|
|
@@ -339,7 +396,7 @@ class T extends w {
|
|
|
339
396
|
let a = d(i.id);
|
|
340
397
|
this.currentDragPoint = a, this.editDragEnable();
|
|
341
398
|
}
|
|
342
|
-
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new
|
|
399
|
+
} 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
400
|
}
|
|
344
401
|
//创建主线数据
|
|
345
402
|
createMainLine() {
|
|
@@ -349,11 +406,11 @@ class T extends w {
|
|
|
349
406
|
// 宽度
|
|
350
407
|
width: 2,
|
|
351
408
|
// 线的颜色
|
|
352
|
-
material:
|
|
409
|
+
material: E.RED,
|
|
353
410
|
// 是否显示
|
|
354
411
|
show: !0,
|
|
355
412
|
clampToGround: !0
|
|
356
|
-
}, e.positions = new
|
|
413
|
+
}, e.positions = new f(() => this.mainData, !1), this.mainLineEntity = this.viewer.entities.add({
|
|
357
414
|
polyline: e,
|
|
358
415
|
properties: {
|
|
359
416
|
entityType: "LINE"
|
|
@@ -365,11 +422,11 @@ class T extends w {
|
|
|
365
422
|
let e;
|
|
366
423
|
this.polygon ? e = this.polygon : e = {
|
|
367
424
|
hierarchy: [new r(), new r(), new r()],
|
|
368
|
-
material:
|
|
425
|
+
material: E.RED.withAlpha(0.4),
|
|
369
426
|
outline: !1
|
|
370
|
-
}, e.hierarchy = new
|
|
427
|
+
}, e.hierarchy = new f(() => {
|
|
371
428
|
let t = this.mainData;
|
|
372
|
-
return this.dashEndData && (t = [...this.mainData, this.dashEndData]), new
|
|
429
|
+
return this.dashEndData && (t = [...this.mainData, this.dashEndData]), new B(t);
|
|
373
430
|
}, !1), this.mainPolygonEntity = this.viewer.entities.add({
|
|
374
431
|
polygon: e,
|
|
375
432
|
properties: {
|
|
@@ -378,7 +435,7 @@ class T extends w {
|
|
|
378
435
|
});
|
|
379
436
|
}
|
|
380
437
|
}
|
|
381
|
-
class
|
|
438
|
+
class V extends C {
|
|
382
439
|
constructor(e, t = null) {
|
|
383
440
|
super(e), this.handler = null, this.firstPoint = null, this.endPoint = null, this.lineEntity = null, this.polygonEntity = null, this.rect_L_ClickEvent = () => {
|
|
384
441
|
var i;
|
|
@@ -410,13 +467,13 @@ class x extends w {
|
|
|
410
467
|
}, 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
468
|
}
|
|
412
469
|
start() {
|
|
413
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
470
|
+
super.drawableStatus(), this.handler || (this.handler = new P(this.viewer.scene.canvas)), this.rect_L_ClickEvent(), this.rect_L_DownEvent(), this.rect_L_UpEvent(), this.rect_moveEvent();
|
|
414
471
|
}
|
|
415
472
|
getEntity() {
|
|
416
473
|
this.polygonEntity;
|
|
417
474
|
}
|
|
418
475
|
getPositions() {
|
|
419
|
-
return this.
|
|
476
|
+
return this.dsToMd();
|
|
420
477
|
}
|
|
421
478
|
clearAll() {
|
|
422
479
|
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);
|
|
@@ -428,12 +485,12 @@ class x extends w {
|
|
|
428
485
|
let a = d(i.id);
|
|
429
486
|
this.currentDragPoint = a, this.editDragEnable();
|
|
430
487
|
}
|
|
431
|
-
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new
|
|
488
|
+
} 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
489
|
}
|
|
433
490
|
initMainData() {
|
|
434
491
|
if (this.firstPoint && this.endPoint) {
|
|
435
|
-
const e =
|
|
436
|
-
this.mainData[0] = this.firstPoint, this.mainData[1] =
|
|
492
|
+
const e = L.fromCartesian(this.firstPoint), t = e.longitude, i = e.latitude, a = L.fromCartesian(this.endPoint), s = a.longitude, n = a.latitude, u = r.fromRadians(t, n), S = r.fromRadians(s, i);
|
|
493
|
+
this.mainData[0] = this.firstPoint, this.mainData[1] = u, this.mainData[2] = this.endPoint, this.mainData[3] = S;
|
|
437
494
|
}
|
|
438
495
|
}
|
|
439
496
|
//创建主线数据
|
|
@@ -444,11 +501,11 @@ class x extends w {
|
|
|
444
501
|
// 宽度
|
|
445
502
|
width: 2,
|
|
446
503
|
// 线的颜色
|
|
447
|
-
material:
|
|
504
|
+
material: E.RED,
|
|
448
505
|
// 是否显示
|
|
449
506
|
show: !0,
|
|
450
507
|
clampToGround: !0
|
|
451
|
-
}, e.positions = new
|
|
508
|
+
}, e.positions = new f(() => [...this.mainData, this.mainData[0]], !1), this.lineEntity = this.viewer.entities.add({
|
|
452
509
|
polyline: e,
|
|
453
510
|
properties: {
|
|
454
511
|
entityType: "LINE"
|
|
@@ -460,9 +517,9 @@ class x extends w {
|
|
|
460
517
|
let e = null;
|
|
461
518
|
this.polygon ? e = this.polygon : e = {
|
|
462
519
|
hierarchy: [new r(), new r(), new r()],
|
|
463
|
-
material:
|
|
520
|
+
material: E.RED.withAlpha(0.4),
|
|
464
521
|
outline: !1
|
|
465
|
-
}, e.hierarchy = new
|
|
522
|
+
}, e.hierarchy = new f(() => new B(this.mainData), !1), this.polygonEntity = this.viewer.entities.add({
|
|
466
523
|
polygon: e,
|
|
467
524
|
properties: {
|
|
468
525
|
entityType: "POLYGON"
|
|
@@ -470,7 +527,7 @@ class x extends w {
|
|
|
470
527
|
});
|
|
471
528
|
}
|
|
472
529
|
}
|
|
473
|
-
class
|
|
530
|
+
class X extends C {
|
|
474
531
|
constructor(e, t = null) {
|
|
475
532
|
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
533
|
var i;
|
|
@@ -502,19 +559,19 @@ class Q extends w {
|
|
|
502
559
|
}, 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
560
|
}
|
|
504
561
|
start() {
|
|
505
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
562
|
+
super.drawableStatus(), this.handler || (this.handler = new P(this.viewer.scene.canvas)), this.circle_L_ClickEvent(), this.circle_L_DownEvent(), this.circle_L_UpEvent(), this.circle_moveEvent();
|
|
506
563
|
}
|
|
507
564
|
getEntity() {
|
|
508
565
|
return this.ellipseEntity;
|
|
509
566
|
}
|
|
510
567
|
getPositions() {
|
|
511
|
-
return this.
|
|
568
|
+
return this.dsToMd();
|
|
512
569
|
}
|
|
513
570
|
clearAll() {
|
|
514
571
|
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
572
|
}
|
|
516
573
|
setAngle() {
|
|
517
|
-
const e =
|
|
574
|
+
const e = F.eastNorthUpToFixedFrame(this.firstPoint.clone()), t = w.inverse(e, new w()), i = w.multiplyByPoint(t, this.endPoint.clone(), new r());
|
|
518
575
|
this.angle = Math.atan2(i.x, i.y);
|
|
519
576
|
}
|
|
520
577
|
circleMove(e, t) {
|
|
@@ -524,7 +581,7 @@ class Q extends w {
|
|
|
524
581
|
let a = d(i.id);
|
|
525
582
|
this.currentDragPoint = a, this.editDragEnable();
|
|
526
583
|
}
|
|
527
|
-
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new
|
|
584
|
+
} 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
585
|
}
|
|
529
586
|
updateEndPoint() {
|
|
530
587
|
var e = new r(
|
|
@@ -532,12 +589,12 @@ class Q extends w {
|
|
|
532
589
|
this.distance * Math.cos(this.angle),
|
|
533
590
|
0
|
|
534
591
|
// 保持水平,如果希望保持高度则设为 localEdge.z
|
|
535
|
-
), t =
|
|
592
|
+
), t = F.eastNorthUpToFixedFrame(this.firstPoint), i = w.multiplyByPointAsVector(t, e, new r());
|
|
536
593
|
this.endPoint = r.add(this.firstPoint, i, new r());
|
|
537
594
|
}
|
|
538
595
|
countDistance() {
|
|
539
596
|
if (this.firstPoint && this.endPoint) {
|
|
540
|
-
const e =
|
|
597
|
+
const e = L.fromCartesian(this.firstPoint), t = L.fromCartesian(this.endPoint), i = new Q(e, t);
|
|
541
598
|
this.distance = i.surfaceDistance;
|
|
542
599
|
}
|
|
543
600
|
}
|
|
@@ -549,7 +606,7 @@ class Q extends w {
|
|
|
549
606
|
// 短半轴(米)
|
|
550
607
|
semiMajorAxis: 1,
|
|
551
608
|
// 长半轴(米)— 两者相等即为圆
|
|
552
|
-
material:
|
|
609
|
+
material: E.RED.withAlpha(0.6),
|
|
553
610
|
// 填充颜色,半透明
|
|
554
611
|
height: 0,
|
|
555
612
|
// 椭圆所在高度(米),可选
|
|
@@ -557,9 +614,9 @@ class Q extends w {
|
|
|
557
614
|
// 拉伸高度,>0 会形成圆柱体,设为0则为平面
|
|
558
615
|
outline: !0,
|
|
559
616
|
// 是否显示边框
|
|
560
|
-
outlineColor:
|
|
561
|
-
}, e.semiMinorAxis = e.semiMajorAxis = new
|
|
562
|
-
position: new
|
|
617
|
+
outlineColor: E.RED
|
|
618
|
+
}, e.semiMinorAxis = e.semiMajorAxis = new f(() => this.distance, !1), this.ellipseEntity = this.viewer.entities.add({
|
|
619
|
+
position: new A(this.firstPoint),
|
|
563
620
|
ellipse: e,
|
|
564
621
|
properties: {
|
|
565
622
|
entityType: "ELLIPSE"
|
|
@@ -568,10 +625,10 @@ class Q extends w {
|
|
|
568
625
|
}
|
|
569
626
|
}
|
|
570
627
|
export {
|
|
571
|
-
|
|
628
|
+
Z as C,
|
|
572
629
|
l as D,
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
630
|
+
_ as P,
|
|
631
|
+
V as R,
|
|
632
|
+
X as a,
|
|
633
|
+
m as b
|
|
577
634
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Cartographic as G, EllipsoidGeodesic as R, Cartesian3 as b, BoundingSphere as N, Transforms as Y, Matrix4 as B, CustomDataSource as L, ConstantPositionProperty as d, ConstantProperty as u, Color as o, Cartesian2 as I, VerticalOrigin as S, HorizontalOrigin as f, LabelStyle as C, Math as O } from "cesium";
|
|
2
|
-
import { a as y, R as j, P as U, C as P, b as W } from "./CircleDrawer-
|
|
2
|
+
import { a as y, R as j, P as U, C as P, b as W } from "./CircleDrawer-Cl5jgThe.js";
|
|
3
3
|
const A = (r, t) => {
|
|
4
4
|
const l = G.fromCartesian(r), e = G.fromCartesian(t);
|
|
5
5
|
return new R(l, e).surfaceDistance;
|
package/README.md
CHANGED
|
@@ -37,7 +37,10 @@ yarn add @types/three //ts语言需要
|
|
|
37
37
|
|
|
38
38
|
## 3. 推荐技术栈:
|
|
39
39
|
<p>推荐使用vue3 + vite + ts + cesium + threejs</p>
|
|
40
|
-
<p>vue >=3.3
|
|
40
|
+
<p>vue >=3.3</p>
|
|
41
|
+
<p>vite >=4.0</p>
|
|
42
|
+
<p>cesium >= 1.139</p>
|
|
43
|
+
<p>three >= r174</p>
|
|
41
44
|
|
|
42
45
|
|
|
43
46
|
## 4. 导入方式:
|
|
@@ -45,7 +48,7 @@ yarn add @types/three //ts语言需要
|
|
|
45
48
|
```
|
|
46
49
|
//业务组件内
|
|
47
50
|
import 'cesium-pocket/index.css'
|
|
48
|
-
import { cpCompass, cpRuler, cpCoord,
|
|
51
|
+
import { cpCompass, cpRuler, cpCoord,cpOverlay, cpPin } from 'cesium-pocket' //罗盘、比例尺、中心点实时坐标,覆盖面板,大头针
|
|
49
52
|
```
|
|
50
53
|
|
|
51
54
|
全局导入:
|
|
@@ -60,7 +63,7 @@ app.use(CesiumPocket)
|
|
|
60
63
|
|
|
61
64
|
## 4. 参考资料:
|
|
62
65
|
<p>cesium相关内容请参考 <a href="https://cesium.com">cesium官网</a></p>
|
|
63
|
-
<p>
|
|
66
|
+
<p>three相关内容请参考 <a href="https://threejs.org/">threejs官网</a></p>
|
|
64
67
|
<p>css相关内容请参考 <a href="https://www.runoob.com/css/css-tutorial.html">菜鸟教程css</a></p>
|
|
65
|
-
<p>
|
|
66
|
-
<p>
|
|
68
|
+
<p>js相关内容请参考 <a href="https://www.runoob.com/js/js-tutorial.html">菜鸟教程js</a></p>
|
|
69
|
+
<p>vue3相关内容请参考 <a href="https://www.runoob.com/vue3/vue3-tutorial.html">菜鸟教程vue3</a></p>
|
package/drawer.js
CHANGED
package/gauger.js
CHANGED
package/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import * as IA from "three";
|
|
|
3
3
|
import { TrianglesDrawMode as aP, TriangleFanDrawMode as UA, TriangleStripDrawMode as AP, Loader as uP, LoaderUtils as gA, FileLoader as PP, Color as F, LinearSRGBColorSpace as J, SpotLight as pP, PointLight as iP, DirectionalLight as MP, MeshBasicMaterial as vA, SRGBColorSpace as wA, MeshPhysicalMaterial as q, Vector2 as eP, Matrix4 as TA, Vector3 as PA, Quaternion as tP, InstancedMesh as bP, InstancedBufferAttribute as fP, Object3D as nP, TextureLoader as dP, ImageBitmapLoader as mP, BufferAttribute as oA, InterleavedBuffer as yP, InterleavedBufferAttribute as UP, LinearMipmapLinearFilter as sP, NearestMipmapLinearFilter as jP, LinearMipmapNearestFilter as kP, NearestMipmapNearestFilter as LP, LinearFilter as jA, NearestFilter as rP, RepeatWrapping as kA, MirroredRepeatWrapping as SP, ClampToEdgeWrapping as HP, PointsMaterial as OP, Material as aA, LineBasicMaterial as qP, MeshStandardMaterial as BP, DoubleSide as hP, PropertyBinding as VP, BufferGeometry as JP, SkinnedMesh as KP, Mesh as YP, LineSegments as NP, Line as ZP, LineLoop as xP, Points as GP, Group as uA, PerspectiveCamera as XP, MathUtils as WP, OrthographicCamera as FP, Skeleton as RP, AnimationClip as _P, Bone as $P, InterpolateDiscrete as Ae, InterpolateLinear as vP, ColorManagement as JA, Texture as KA, VectorKeyframeTrack as YA, NumberKeyframeTrack as NA, QuaternionKeyframeTrack as ZA, FrontSide as Pe, Interpolant as ee, Box3 as te, Sphere as ne } from "three";
|
|
4
4
|
import { Viewer as x, Math as cA, Cartesian2 as QA, Cartesian3 as Y, Cartographic as gP, SceneTransforms as se, Ray as re, Color as Be, ScreenSpaceEventType as pA, ScreenSpaceEventHandler as ve, createWorldTerrainAsync as ge, EllipsoidTerrainProvider as Ce, WebMapTileServiceImageryProvider as _, Credit as $, JulianDate as V, CzmlDataSource as we } from "cesium";
|
|
5
5
|
import { P as rA, a as xA, b as ce, c as De, d as Ie, C as GA } from "./index-CcaLwHv1.js";
|
|
6
|
-
import { C as un, a as pn, b as Mn, D as bn, P as fn, R as dn } from "./CircleDrawer-
|
|
7
|
-
import { C as yn, L as Un, P as jn, a as kn, R as Ln } from "./PolygonGaguger-
|
|
6
|
+
import { C as un, a as pn, b as Mn, D as bn, P as fn, R as dn } from "./CircleDrawer-Cl5jgThe.js";
|
|
7
|
+
import { C as yn, L as Un, P as jn, a as kn, R as Ln } from "./PolygonGaguger-CjUuWtEz.js";
|
|
8
8
|
function XA(w, A) {
|
|
9
9
|
if (A === aP)
|
|
10
10
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), w;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cesium-pocket",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3-alpha",
|
|
4
4
|
"description": "cesium的插件库;基于vue3的开发",
|
|
5
5
|
"module": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
"cesium",
|
|
35
35
|
"pocket",
|
|
36
36
|
"vue3",
|
|
37
|
+
"WEBGIS",
|
|
37
38
|
"czml",
|
|
39
|
+
"三维",
|
|
38
40
|
"组件库",
|
|
39
|
-
"
|
|
40
|
-
"三维"
|
|
41
|
+
"数字孪生"
|
|
41
42
|
],
|
|
42
43
|
"author": "nineamgo",
|
|
43
44
|
"license": "Apache 2.0",
|
|
@@ -36,9 +36,12 @@ export declare class CP2dDrawer extends DataCenter {
|
|
|
36
36
|
clearAll(): void;
|
|
37
37
|
private r_ClickEvent;
|
|
38
38
|
private l_ClickEvent;
|
|
39
|
+
private l_ClickCtrlEvent;
|
|
39
40
|
private l_DownEvent;
|
|
40
41
|
private l_UpEvent;
|
|
41
42
|
private moveEvent;
|
|
43
|
+
private moveCtrlEvent;
|
|
44
|
+
private measurePoint;
|
|
42
45
|
protected editMoveFun(event: any, cartesian: Cartesian3): void;
|
|
43
46
|
private createMainLine;
|
|
44
47
|
private createMainPolygon;
|
|
@@ -22,10 +22,15 @@ export declare class DataCenter extends DrawerStatus {
|
|
|
22
22
|
*/
|
|
23
23
|
getDataSource(): any;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 根据dataSource更新mainData
|
|
26
26
|
* @returns Cartesian3[]
|
|
27
27
|
*/
|
|
28
|
-
protected
|
|
28
|
+
protected dsToMd(): Cartesian3[];
|
|
29
|
+
/**
|
|
30
|
+
* 根据mainData更新dataSource
|
|
31
|
+
* @returns Cartesian3[]
|
|
32
|
+
*/
|
|
33
|
+
protected MdToDs(): any;
|
|
29
34
|
protected clearAllData(): void;
|
|
30
35
|
protected getEntityIndex(): void;
|
|
31
36
|
protected deleteMoveFun(event: any): void;
|
|
@@ -6,7 +6,7 @@ export declare const DRAW_STATUS: {
|
|
|
6
6
|
readonly STOPED: symbol;
|
|
7
7
|
readonly DRAWABLE: symbol;
|
|
8
8
|
readonly EDITABLE: symbol;
|
|
9
|
-
readonly
|
|
9
|
+
readonly INSERT: symbol;
|
|
10
10
|
readonly DELETABLE: symbol;
|
|
11
11
|
};
|
|
12
12
|
export type DRAW_STATUS_TYPE = typeof DRAW_STATUS[keyof typeof DRAW_STATUS];
|
|
@@ -17,6 +17,7 @@ export declare const EDIT_STATUS: {
|
|
|
17
17
|
readonly DRAG_UNABLED: symbol;
|
|
18
18
|
readonly DRAG_ENABLED: symbol;
|
|
19
19
|
readonly DRAGING: symbol;
|
|
20
|
+
readonly CTRL_DOWN: symbol;
|
|
20
21
|
};
|
|
21
22
|
export type EDIT_STATUS_TYPE = typeof EDIT_STATUS[keyof typeof EDIT_STATUS];
|
|
22
23
|
export declare const HIGHT_STATUS: {
|
|
@@ -60,6 +61,7 @@ export declare class DrawerStatus {
|
|
|
60
61
|
protected editDragUnable(): void;
|
|
61
62
|
protected editDragEnable(): void;
|
|
62
63
|
protected editDraging(): void;
|
|
64
|
+
protected editCtrlDown(): void;
|
|
63
65
|
protected delUnable(): void;
|
|
64
66
|
protected delEnable(): void;
|
|
65
67
|
}
|