cesium-pocket 0.2.1-alpha → 0.3.1-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-DbOS8_ZI.js +565 -0
- package/drawer.d.ts +7 -0
- package/drawer.js +9 -0
- package/index.d.ts +1 -1
- package/index.js +7 -4
- package/package.json +4 -4
- package/src/drawer/CP2dDrawer.d.ts +37 -0
- package/src/drawer/CircleDrawer.d.ts +29 -0
- package/src/drawer/DataCenter.d.ts +29 -0
- package/src/drawer/DrawerStatus.d.ts +65 -0
- package/src/drawer/PointDrawer.d.ts +25 -0
- package/src/drawer/RectDrawer.d.ts +28 -0
- package/PolygonDrawer-cdggtCBL.js +0 -415
- package/measure.d.ts +0 -4
- package/measure.js +0 -6
- package/src/measure/DrawerStatus.d.ts +0 -42
- package/src/measure/LineDrawer.d.ts +0 -28
- package/src/measure/PointDrawer.d.ts +0 -32
- package/src/measure/PolygonDrawer.d.ts +0 -16
- package/src/measure/util.d.ts +0 -9
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import { CustomDataSource as C, Cartesian3 as r, JulianDate as I, defined as l, ConstantPositionProperty as E, HeightReference as S, Color as u, EntityCollection as B, ScreenSpaceEventType as c, ScreenSpaceEventHandler as w, VerticalOrigin as R, PolylineDashMaterialProperty as M, CallbackProperty as A, PolygonHierarchy as P, Cartographic as y, Transforms as b, Matrix4 as g, EllipsoidGeodesic as k } from "cesium";
|
|
2
|
+
import { toRaw as d } from "vue";
|
|
3
|
+
const h = {
|
|
4
|
+
STOPED: Symbol("STOPED"),
|
|
5
|
+
//未开启状态
|
|
6
|
+
DRAWABLE: Symbol("DRAWABLE"),
|
|
7
|
+
//可绘绘制状态
|
|
8
|
+
EDITABLE: Symbol("EDITABLE"),
|
|
9
|
+
//可编辑经纬度状态
|
|
10
|
+
HIGHTABLE: Symbol("HIGHTABLE"),
|
|
11
|
+
//可编辑经纬度状态
|
|
12
|
+
DELETABLE: Symbol("DELETABLE")
|
|
13
|
+
//可删除状态
|
|
14
|
+
}, o = {
|
|
15
|
+
DRAG_UNABLED: Symbol("DRAG_UNABLED"),
|
|
16
|
+
//不可拖拽
|
|
17
|
+
DRAG_ENABLED: Symbol("DRAG_ENABLED"),
|
|
18
|
+
//可拖拽
|
|
19
|
+
DRAGING: Symbol("DRAGING")
|
|
20
|
+
//正在拖拽中
|
|
21
|
+
}, p = {
|
|
22
|
+
DEL_UNABLED: Symbol("DEL_UNABLED"),
|
|
23
|
+
//不删除
|
|
24
|
+
DEL_ENABLED: Symbol("DEL_ENABLED")
|
|
25
|
+
//可拖拽
|
|
26
|
+
};
|
|
27
|
+
class G {
|
|
28
|
+
constructor(e) {
|
|
29
|
+
this.status = h.STOPED, this.editStatus = o.DRAG_UNABLED, this.delStatus = p.DEL_UNABLED, this.viewer = e;
|
|
30
|
+
}
|
|
31
|
+
getStatus() {
|
|
32
|
+
return this.status;
|
|
33
|
+
}
|
|
34
|
+
getEditStatus() {
|
|
35
|
+
return this.editStatus;
|
|
36
|
+
}
|
|
37
|
+
getDelStatus() {
|
|
38
|
+
return this.delStatus;
|
|
39
|
+
}
|
|
40
|
+
setEditStatus() {
|
|
41
|
+
this.editableStatus();
|
|
42
|
+
}
|
|
43
|
+
setDelStatus() {
|
|
44
|
+
this.deletableStatus();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 可添加点
|
|
48
|
+
*/
|
|
49
|
+
drawableStatus() {
|
|
50
|
+
this.status = h.DRAWABLE, this.viewer.canvas.style.cursor = "crosshair";
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 可移动点
|
|
54
|
+
*/
|
|
55
|
+
editableStatus() {
|
|
56
|
+
this.status = h.EDITABLE, this.viewer.canvas.style.cursor = "pointer";
|
|
57
|
+
}
|
|
58
|
+
deletableStatus() {
|
|
59
|
+
this.status = h.DELETABLE, this.viewer.canvas.style.cursor = "grabbing";
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 停止操作
|
|
63
|
+
*/
|
|
64
|
+
stopStatus() {
|
|
65
|
+
this.status = h.STOPED, this.viewer.canvas.style.cursor = "default";
|
|
66
|
+
}
|
|
67
|
+
//----------------------------------------
|
|
68
|
+
editDragUnable() {
|
|
69
|
+
this.editStatus = o.DRAG_UNABLED, this.viewer.canvas.style.cursor = "pointer";
|
|
70
|
+
}
|
|
71
|
+
editDragEnable() {
|
|
72
|
+
this.editStatus = o.DRAG_ENABLED, this.viewer.canvas.style.cursor = "grab";
|
|
73
|
+
}
|
|
74
|
+
editDraging() {
|
|
75
|
+
this.editStatus = o.DRAGING, this.viewer.canvas.style.cursor = "move";
|
|
76
|
+
}
|
|
77
|
+
//------------------------
|
|
78
|
+
delUnable() {
|
|
79
|
+
this.delStatus = p.DEL_UNABLED, this.viewer.canvas.style.cursor = "pointer";
|
|
80
|
+
}
|
|
81
|
+
delEnable() {
|
|
82
|
+
this.delStatus = p.DEL_ENABLED, this.viewer.canvas.style.cursor = "grabbing";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const U = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAQAElEQVR4AexdfYwkR3V/r3dnb884wUd03O1HTrZj4p09/CFMSBwpkqX8Ayjkj6ALQY6ixHIc8REJRUoiJUK+80eI7QQH28IOR+xIxOGwyCVRIHEE2JgD6cAfCPt2d9b4ZMt3O7uAfUYceG9ndrp4r6d1N7eeme7prq7q6np7VdvdVa/e+73f699M983OTADyIwwIAwMZEIEMpEYmhAEAEYicBcLAEAZEIEPIkSlhQAQi54AwMISBAgUyJKpMCQOOMCACcaRQAtMOAyIQO7xLVEcYEIE4UiiBaYcBEYgd3iWqIwy4KRBHyBWY7jMgAnG/hpJBgQyIQAokV1y7z4AIxP0aSgYFMiACKZBcce0+AyKQLTWUQ2GglwERSC8bsi8MbGFABLKFEDkUBnoZEIH0siH7wsAWBkQgWwiRQ2GglwERSC8bxe6Ld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AwB1f5TcL2bFTAAAAABJRU5ErkJggg==";
|
|
86
|
+
class L extends G {
|
|
87
|
+
constructor(e) {
|
|
88
|
+
super(e), this.mainData = [], this.dataSource = new C("drawerDataSource"), this.currentDragPoint = null, this.currentIndex = -1, this.delCallbackFun = this.delCallback, this.viewer.dataSources.add(this.dataSource);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 获取DataSource
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
94
|
+
getDataSource() {
|
|
95
|
+
return this.dataSource;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 获取所有节点数据
|
|
99
|
+
* @returns Cartesian3[]
|
|
100
|
+
*/
|
|
101
|
+
refreshPositionsData() {
|
|
102
|
+
return this.mainData = [], this.dataSource.entities.values.forEach((e) => {
|
|
103
|
+
var t;
|
|
104
|
+
const i = new r();
|
|
105
|
+
(t = e.position) == null || t.getValue(I.now(), i), this.mainData.push(i);
|
|
106
|
+
}), this.mainData;
|
|
107
|
+
}
|
|
108
|
+
clearAllData() {
|
|
109
|
+
this.mainData = [], this.currentDragPoint = null, this.currentIndex = -1, this.dataSource && this.viewer.dataSources.remove(this.dataSource, !0), super.stopStatus();
|
|
110
|
+
}
|
|
111
|
+
getEntityIndex() {
|
|
112
|
+
var e;
|
|
113
|
+
for (let i = 0, t = this.dataSource.entities.values.length; i < t; i++)
|
|
114
|
+
if (this.dataSource.entities.values[i].id == ((e = this.currentDragPoint) == null ? void 0 : e.id)) {
|
|
115
|
+
this.currentIndex = i;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
editMoveFun(e, i) {
|
|
120
|
+
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
121
|
+
const t = this.viewer.scene.pick(e.endPosition);
|
|
122
|
+
if (l(t) && l(t.id) && this.dataSource.entities.contains(d(t.id))) {
|
|
123
|
+
let a = d(t.id);
|
|
124
|
+
this.currentDragPoint = a, this.editDragEnable();
|
|
125
|
+
}
|
|
126
|
+
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new E(i), this.mainData[this.currentIndex] = i) : this.editDragUnable();
|
|
127
|
+
}
|
|
128
|
+
deleteMoveFun(e) {
|
|
129
|
+
if (p.DEL_UNABLED == super.getDelStatus()) {
|
|
130
|
+
const i = this.viewer.scene.pick(e.endPosition);
|
|
131
|
+
l(i) && l(i.id) && this.dataSource.entities.contains(d(i.id)) && this.delEnable();
|
|
132
|
+
} else
|
|
133
|
+
this.delUnable();
|
|
134
|
+
}
|
|
135
|
+
addPoint(e) {
|
|
136
|
+
let i = null;
|
|
137
|
+
return this.point ? i = this.point : i = {
|
|
138
|
+
pixelSize: 6,
|
|
139
|
+
color: u.TRANSPARENT,
|
|
140
|
+
outlineColor: u.YELLOW,
|
|
141
|
+
outlineWidth: 2,
|
|
142
|
+
heightReference: S.CLAMP_TO_GROUND
|
|
143
|
+
//贴地
|
|
144
|
+
}, this.dataSource.entities.add({
|
|
145
|
+
position: e,
|
|
146
|
+
point: i,
|
|
147
|
+
properties: {
|
|
148
|
+
entityType: "POINT"
|
|
149
|
+
},
|
|
150
|
+
show: !0
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
//在删除状态下,删除节点
|
|
154
|
+
deletePoint(e) {
|
|
155
|
+
this.delCallbackFun && this.delCallbackFun().then((i) => {
|
|
156
|
+
i && (this.dataSource.entities.remove(e), this.refreshPositionsData());
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
delCallback() {
|
|
160
|
+
return new Promise((e) => {
|
|
161
|
+
const i = confirm("确定删除吗?");
|
|
162
|
+
e(!!i);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
class T extends L {
|
|
167
|
+
constructor(e, i = null) {
|
|
168
|
+
super(e), this.handler = null, this.pointCollection = new B(), this.billboardCallbackFun = this.addBillboardCallback, this.point_L_ClickEvent = () => {
|
|
169
|
+
var t;
|
|
170
|
+
(t = this.handler) == null || t.setInputAction((a) => {
|
|
171
|
+
if (h.DRAWABLE == super.getStatus()) {
|
|
172
|
+
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
173
|
+
if (l(n)) {
|
|
174
|
+
let v = this.billboardCallbackFun(n);
|
|
175
|
+
this.mainData.push(n), this.pointCollection.add(v);
|
|
176
|
+
}
|
|
177
|
+
} else if (h.DELETABLE == super.getStatus()) {
|
|
178
|
+
const s = this.viewer.scene.pick(a.position);
|
|
179
|
+
if (l(s) && l(s.id)) {
|
|
180
|
+
const n = d(s.id);
|
|
181
|
+
this.pointCollection.contains(n) && p.DEL_ENABLED == super.getDelStatus() && this.deleteBillboard(n);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}, c.LEFT_CLICK);
|
|
185
|
+
}, this.point_L_DownEvent = () => {
|
|
186
|
+
var t;
|
|
187
|
+
(t = this.handler) == null || t.setInputAction(() => {
|
|
188
|
+
h.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
189
|
+
}, c.LEFT_DOWN);
|
|
190
|
+
}, this.point_L_UpEvent = () => {
|
|
191
|
+
var t;
|
|
192
|
+
(t = this.handler) == null || t.setInputAction((a) => {
|
|
193
|
+
if (o.DRAGING == super.getEditStatus()) {
|
|
194
|
+
const s = this.viewer.scene.pickPosition(a.endPosition);
|
|
195
|
+
l(s) && this.editCallbackFun && this.editCallbackFun(s), this.editDragUnable(), this.currentDragPoint = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0;
|
|
196
|
+
}
|
|
197
|
+
}, c.LEFT_UP);
|
|
198
|
+
}, this.point_moveEvent = () => {
|
|
199
|
+
var t;
|
|
200
|
+
(t = this.handler) == null || t.setInputAction((a) => {
|
|
201
|
+
if (h.EDITABLE == super.getStatus())
|
|
202
|
+
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
203
|
+
const s = this.viewer.scene.pick(a.endPosition);
|
|
204
|
+
if (l(s) && l(s.id) && this.pointCollection.contains(d(s.id))) {
|
|
205
|
+
let n = d(s.id);
|
|
206
|
+
this.currentDragPoint = n, this.editDragEnable();
|
|
207
|
+
}
|
|
208
|
+
} else if (o.DRAGING == super.getEditStatus()) {
|
|
209
|
+
const s = this.viewer.scene.pickPosition(a.endPosition);
|
|
210
|
+
l(s) && this.currentDragPoint && (this.currentDragPoint.position = new E(s));
|
|
211
|
+
} else
|
|
212
|
+
this.editDragUnable();
|
|
213
|
+
else if (h.DELETABLE == super.getStatus())
|
|
214
|
+
if (p.DEL_UNABLED == super.getDelStatus()) {
|
|
215
|
+
const s = this.viewer.scene.pick(a.endPosition);
|
|
216
|
+
l(s) && l(s.id) && this.pointCollection.contains(d(s.id)) && this.delEnable();
|
|
217
|
+
} else
|
|
218
|
+
this.delUnable();
|
|
219
|
+
}, c.MOUSE_MOVE);
|
|
220
|
+
}, i && (this.billboardCallbackFun = i.billboardCallbackFun ? i.billboardCallbackFun : this.addBillboardCallback, this.delCallbackFun = i.delCallbackFun ? i.delCallbackFun : this.delCallback, i.editCallbackFun && (this.editCallbackFun = i.editCallbackFun));
|
|
221
|
+
}
|
|
222
|
+
start() {
|
|
223
|
+
super.drawableStatus(), this.handler || (this.handler = new w(this.viewer.scene.canvas)), this.point_L_ClickEvent(), this.point_L_DownEvent(), this.point_L_UpEvent(), this.point_moveEvent();
|
|
224
|
+
}
|
|
225
|
+
getEntity() {
|
|
226
|
+
return this.pointCollection;
|
|
227
|
+
}
|
|
228
|
+
clearAll() {
|
|
229
|
+
var e;
|
|
230
|
+
this.clearAllData(), this.billboardCallbackFun = this.addBillboardCallback;
|
|
231
|
+
for (let i = 0, t = this.pointCollection.values.length; i < t; i++) {
|
|
232
|
+
const a = this.pointCollection.values[i];
|
|
233
|
+
this.viewer.entities.removeById(a.id);
|
|
234
|
+
}
|
|
235
|
+
(e = this.handler) == null || e.destroy();
|
|
236
|
+
}
|
|
237
|
+
addBillboardCallback(e) {
|
|
238
|
+
return this.viewer.entities.add({
|
|
239
|
+
// 设置经纬度位置 (经度, 纬度, 海拔高度)
|
|
240
|
+
position: e,
|
|
241
|
+
billboard: {
|
|
242
|
+
image: U,
|
|
243
|
+
// 设置图片显示的宽度和高度 (像素)
|
|
244
|
+
width: 40,
|
|
245
|
+
height: 40,
|
|
246
|
+
// 可选项:缩放倍数
|
|
247
|
+
scale: 1,
|
|
248
|
+
verticalOrigin: R.BOTTOM,
|
|
249
|
+
heightReference: S.CLAMP_TO_GROUND
|
|
250
|
+
//贴地
|
|
251
|
+
},
|
|
252
|
+
show: !0
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
deleteBillboard(e) {
|
|
256
|
+
this.delCallbackFun ? this.delCallbackFun().then((i) => {
|
|
257
|
+
i && (this.dataSource.entities.remove(e), this.refreshPositionsData());
|
|
258
|
+
}) : confirm("确定要删除吗?") && (this.viewer.entities.remove(e), this.refreshPositionsData());
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const f = {
|
|
262
|
+
LINE: Symbol("LINE"),
|
|
263
|
+
//画线模式
|
|
264
|
+
POLYGON: Symbol("POLYGON")
|
|
265
|
+
//画面模式
|
|
266
|
+
};
|
|
267
|
+
class O extends L {
|
|
268
|
+
constructor(e, i = null) {
|
|
269
|
+
super(e), this.handler = null, this.mainLineEntity = null, this.mainPolygonEntity = null, this.dashLineEntity = null, this.dashEndData = new r(), this.drawerMode = f.LINE, this.line_L_ClickEvent = () => {
|
|
270
|
+
var t;
|
|
271
|
+
(t = this.handler) == null || t.setInputAction((a) => {
|
|
272
|
+
if (h.DRAWABLE == super.getStatus()) {
|
|
273
|
+
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
274
|
+
l(n) && (this.addPoint(n), this.mainData.push(n), this.mainData.length > 0 && (this.mainLineEntity || this.createMainLine(), this.dashLineEntity || this.createDashline(), this.mainData.length > 2 && this.drawerMode === f.POLYGON && !this.mainPolygonEntity && this.createMainPolygon()));
|
|
275
|
+
} else if (h.DELETABLE == super.getStatus()) {
|
|
276
|
+
const s = this.viewer.scene.pick(a.position);
|
|
277
|
+
if (l(s) && l(s.id)) {
|
|
278
|
+
const n = d(s.id);
|
|
279
|
+
this.dataSource.entities.contains(n) && p.DEL_ENABLED == super.getDelStatus() && this.deletePoint(n);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, c.LEFT_CLICK);
|
|
283
|
+
}, this.line_L_DownEvent = () => {
|
|
284
|
+
var t;
|
|
285
|
+
(t = this.handler) == null || t.setInputAction(() => {
|
|
286
|
+
h.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.getEntityIndex(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
287
|
+
}, c.LEFT_DOWN);
|
|
288
|
+
}, this.line_L_UpEvent = () => {
|
|
289
|
+
var t;
|
|
290
|
+
(t = this.handler) == null || t.setInputAction(() => {
|
|
291
|
+
o.DRAGING == super.getEditStatus() && (this.editDragUnable(), this.currentDragPoint = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0);
|
|
292
|
+
}, c.LEFT_UP);
|
|
293
|
+
}, this.line_moveEvent = () => {
|
|
294
|
+
var t;
|
|
295
|
+
(t = this.handler) == null || t.setInputAction((a) => {
|
|
296
|
+
const s = this.viewer.camera.getPickRay(a.endPosition);
|
|
297
|
+
if (s) {
|
|
298
|
+
const n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
299
|
+
l(n) && (h.DRAWABLE == super.getStatus() ? this.dashEndData = n : h.EDITABLE == super.getStatus() ? (this.dashLineEntity.show = !1, this.editMoveFun(a, n)) : h.DELETABLE == super.getStatus() && (this.dashLineEntity.show = !1, this.deleteMoveFun(a)));
|
|
300
|
+
}
|
|
301
|
+
}, c.MOUSE_MOVE);
|
|
302
|
+
}, this.createDashline = () => {
|
|
303
|
+
let t;
|
|
304
|
+
this.deshline ? t = this.deshline : t = {
|
|
305
|
+
positions: [
|
|
306
|
+
new r(),
|
|
307
|
+
new r()
|
|
308
|
+
],
|
|
309
|
+
width: 2,
|
|
310
|
+
material: new M({
|
|
311
|
+
color: u.RED,
|
|
312
|
+
dashLength: 15
|
|
313
|
+
}),
|
|
314
|
+
show: !0,
|
|
315
|
+
clampToGround: !0
|
|
316
|
+
}, t.positions = new A(() => {
|
|
317
|
+
let a = this.mainData.length, s = this.mainData[a - 1];
|
|
318
|
+
return s || (s = this.mainData[a - 2]), this.dashEndData || console.log("发生错误了dashEndData"), [s, this.dashEndData];
|
|
319
|
+
}, !1), this.dashLineEntity = this.viewer.entities.add({
|
|
320
|
+
polyline: t,
|
|
321
|
+
properties: {
|
|
322
|
+
entityType: "DASHLINE"
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}, i && (i.drawerMode && (this.drawerMode = i.drawerMode), this.point = i.point, this.polyline = i.polyline, this.deshline = i.deshline, this.polygon = i.polygon, this.delCallbackFun = i.delCallbackFun ? i.delCallbackFun : this.delCallback);
|
|
326
|
+
}
|
|
327
|
+
start() {
|
|
328
|
+
super.drawableStatus(), this.handler || (this.handler = new w(this.viewer.scene.canvas)), this.line_L_ClickEvent(), this.line_L_DownEvent(), this.line_L_UpEvent(), this.line_moveEvent();
|
|
329
|
+
}
|
|
330
|
+
getEntity() {
|
|
331
|
+
if (this.drawerMode === f.LINE)
|
|
332
|
+
return this.mainLineEntity;
|
|
333
|
+
if (this.drawerMode === f.POLYGON)
|
|
334
|
+
return this.mainPolygonEntity;
|
|
335
|
+
}
|
|
336
|
+
clearAll() {
|
|
337
|
+
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);
|
|
338
|
+
}
|
|
339
|
+
//创建主线数据
|
|
340
|
+
createMainLine() {
|
|
341
|
+
let e;
|
|
342
|
+
this.polyline ? e = this.polyline : e = {
|
|
343
|
+
positions: [new r(), new r()],
|
|
344
|
+
// 宽度
|
|
345
|
+
width: 2,
|
|
346
|
+
// 线的颜色
|
|
347
|
+
material: u.RED,
|
|
348
|
+
// 是否显示
|
|
349
|
+
show: !0,
|
|
350
|
+
clampToGround: !0
|
|
351
|
+
}, e.positions = new A(() => this.mainData, !1), this.mainLineEntity = this.viewer.entities.add({
|
|
352
|
+
polyline: e,
|
|
353
|
+
properties: {
|
|
354
|
+
entityType: "LINE"
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
//创建主面数据
|
|
359
|
+
createMainPolygon() {
|
|
360
|
+
let e;
|
|
361
|
+
this.polygon ? e = this.polygon : e = {
|
|
362
|
+
hierarchy: [new r(), new r(), new r()],
|
|
363
|
+
material: u.RED.withAlpha(0.4),
|
|
364
|
+
outline: !1
|
|
365
|
+
}, e.hierarchy = new A(() => new P(this.mainData), !1), this.mainPolygonEntity = this.viewer.entities.add({
|
|
366
|
+
polygon: e,
|
|
367
|
+
properties: {
|
|
368
|
+
entityType: "POLYGON"
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
class x extends L {
|
|
374
|
+
//主面对象
|
|
375
|
+
constructor(e, i = null) {
|
|
376
|
+
super(e), this.handler = null, this.firstPoint = null, this.endPoint = null, this.lineEntity = null, this.polygonEntity = null, this.rect_L_ClickEvent = () => {
|
|
377
|
+
var t;
|
|
378
|
+
(t = this.handler) == null || t.setInputAction((a) => {
|
|
379
|
+
if (h.DRAWABLE == super.getStatus()) {
|
|
380
|
+
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
381
|
+
l(n) && (this.mainData.length === 0 ? (this.addPoint(n), this.firstPoint = n, this.mainData.push(n), this.createLine(), this.createPolygon()) : (this.addPoint(n), this.endPoint = n, this.stopStatus()));
|
|
382
|
+
}
|
|
383
|
+
}, c.LEFT_CLICK);
|
|
384
|
+
}, this.rect_L_DownEvent = () => {
|
|
385
|
+
var t;
|
|
386
|
+
(t = this.handler) == null || t.setInputAction(() => {
|
|
387
|
+
h.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.getEntityIndex(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
388
|
+
}, c.LEFT_DOWN);
|
|
389
|
+
}, this.rect_L_UpEvent = () => {
|
|
390
|
+
var t;
|
|
391
|
+
(t = this.handler) == null || t.setInputAction(() => {
|
|
392
|
+
o.DRAGING == super.getEditStatus() && (this.editDragUnable(), this.currentDragPoint = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0);
|
|
393
|
+
}, c.LEFT_UP);
|
|
394
|
+
}, this.rect_moveEvent = () => {
|
|
395
|
+
var t;
|
|
396
|
+
(t = this.handler) == null || t.setInputAction((a) => {
|
|
397
|
+
const s = this.viewer.camera.getPickRay(a.endPosition);
|
|
398
|
+
if (s) {
|
|
399
|
+
const n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
400
|
+
l(n) && (h.DRAWABLE == super.getStatus() ? this.firstPoint && (this.endPoint = n, this.initMainData()) : h.EDITABLE == super.getStatus() && this.rectMove(a, n));
|
|
401
|
+
}
|
|
402
|
+
}, c.MOUSE_MOVE);
|
|
403
|
+
}, i && (this.point = i.point, this.polyline = i.polyline, this.polygon = i.polygon);
|
|
404
|
+
}
|
|
405
|
+
start() {
|
|
406
|
+
super.drawableStatus(), this.handler || (this.handler = new w(this.viewer.scene.canvas)), this.rect_L_ClickEvent(), this.rect_L_DownEvent(), this.rect_L_UpEvent(), this.rect_moveEvent();
|
|
407
|
+
}
|
|
408
|
+
getEntity() {
|
|
409
|
+
this.polygonEntity;
|
|
410
|
+
}
|
|
411
|
+
clearAll() {
|
|
412
|
+
this.clearAllData(), this.firstPoint = new r(), this.endPoint = new r(), this.handler && (this.handler = null), this.polygonEntity && this.viewer.entities.removeById(this.polygonEntity.id), this.lineEntity && this.viewer.entities.removeById(this.lineEntity.id);
|
|
413
|
+
}
|
|
414
|
+
rectMove(e, i) {
|
|
415
|
+
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
416
|
+
const t = this.viewer.scene.pick(e.endPosition);
|
|
417
|
+
if (l(t) && l(t.id) && this.dataSource.entities.contains(d(t.id))) {
|
|
418
|
+
let a = d(t.id);
|
|
419
|
+
this.currentDragPoint = a, this.editDragEnable();
|
|
420
|
+
}
|
|
421
|
+
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new E(i), this.currentIndex === 0 ? this.firstPoint = i : this.endPoint = i, this.initMainData()) : this.editDragUnable();
|
|
422
|
+
}
|
|
423
|
+
initMainData() {
|
|
424
|
+
if (this.firstPoint && this.endPoint) {
|
|
425
|
+
const e = y.fromCartesian(this.firstPoint), i = e.longitude, t = e.latitude, a = y.fromCartesian(this.endPoint), s = a.longitude, n = a.latitude, v = r.fromRadians(i, n), m = r.fromRadians(s, t);
|
|
426
|
+
this.mainData[0] = this.firstPoint, this.mainData[1] = v, this.mainData[2] = this.endPoint, this.mainData[3] = m;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
//创建主线数据
|
|
430
|
+
createLine() {
|
|
431
|
+
let e = null;
|
|
432
|
+
this.polyline ? e = this.polyline : e = {
|
|
433
|
+
positions: [new r(), new r()],
|
|
434
|
+
// 宽度
|
|
435
|
+
width: 2,
|
|
436
|
+
// 线的颜色
|
|
437
|
+
material: u.RED,
|
|
438
|
+
// 是否显示
|
|
439
|
+
show: !0,
|
|
440
|
+
clampToGround: !0
|
|
441
|
+
}, e.positions = new A(() => [...this.mainData, this.mainData[0]], !1), this.lineEntity = this.viewer.entities.add({
|
|
442
|
+
polyline: e,
|
|
443
|
+
properties: {
|
|
444
|
+
entityType: "LINE"
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
//创建主面数据
|
|
449
|
+
createPolygon() {
|
|
450
|
+
let e = null;
|
|
451
|
+
this.polygon ? e = this.polygon : e = {
|
|
452
|
+
hierarchy: [new r(), new r(), new r()],
|
|
453
|
+
material: u.RED.withAlpha(0.4),
|
|
454
|
+
outline: !1
|
|
455
|
+
}, e.hierarchy = new A(() => new P(this.mainData), !1), this.polygonEntity = this.viewer.entities.add({
|
|
456
|
+
polygon: e,
|
|
457
|
+
properties: {
|
|
458
|
+
entityType: "POLYGON"
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
class Q extends L {
|
|
464
|
+
//主线对象
|
|
465
|
+
constructor(e, i = null) {
|
|
466
|
+
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 = () => {
|
|
467
|
+
var t;
|
|
468
|
+
(t = this.handler) == null || t.setInputAction((a) => {
|
|
469
|
+
if (h.DRAWABLE == super.getStatus()) {
|
|
470
|
+
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
471
|
+
l(n) && (this.mainData.length === 0 ? (this.addPoint(n), this.mainData.push(n), this.firstPoint = n, this.createCircle()) : (this.endPoint = n, this.mainData.push(n), this.endPointEntity = this.addPoint(n), this.getAngle(), this.stopStatus()));
|
|
472
|
+
}
|
|
473
|
+
}, c.LEFT_CLICK);
|
|
474
|
+
}, this.circle_L_DownEvent = () => {
|
|
475
|
+
var t;
|
|
476
|
+
(t = this.handler) == null || t.setInputAction(() => {
|
|
477
|
+
h.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.getEntityIndex(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
478
|
+
}, c.LEFT_DOWN);
|
|
479
|
+
}, this.circle_L_UpEvent = () => {
|
|
480
|
+
var t;
|
|
481
|
+
(t = this.handler) == null || t.setInputAction(() => {
|
|
482
|
+
o.DRAGING == super.getEditStatus() && (this.editDragUnable(), this.currentDragPoint = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0);
|
|
483
|
+
}, c.LEFT_UP);
|
|
484
|
+
}, this.circle_moveEvent = () => {
|
|
485
|
+
var t;
|
|
486
|
+
(t = this.handler) == null || t.setInputAction((a) => {
|
|
487
|
+
const s = this.viewer.camera.getPickRay(a.endPosition);
|
|
488
|
+
if (s) {
|
|
489
|
+
const n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
490
|
+
l(n) && (h.DRAWABLE == super.getStatus() ? this.mainData.length > 0 && (this.endPoint = n, this.countDistance()) : h.EDITABLE == super.getStatus() && this.circleMove(a, n));
|
|
491
|
+
}
|
|
492
|
+
}, c.MOUSE_MOVE);
|
|
493
|
+
}, i && (this.point = i.point, this.ellipse = i.ellipse);
|
|
494
|
+
}
|
|
495
|
+
start() {
|
|
496
|
+
super.drawableStatus(), this.handler || (this.handler = new w(this.viewer.scene.canvas)), this.circle_L_ClickEvent(), this.circle_L_DownEvent(), this.circle_L_UpEvent(), this.circle_moveEvent();
|
|
497
|
+
}
|
|
498
|
+
getEntity() {
|
|
499
|
+
return this.ellipse;
|
|
500
|
+
}
|
|
501
|
+
clearAll() {
|
|
502
|
+
this.clearAllData(), this.firstPoint = new r(), this.endPoint = new r(), this.handler && (this.handler = null), this.ellipseEntity && this.viewer.entities.removeById(this.ellipseEntity.id);
|
|
503
|
+
}
|
|
504
|
+
getAngle() {
|
|
505
|
+
const e = b.eastNorthUpToFixedFrame(this.firstPoint.clone()), i = g.inverse(e, new g()), t = g.multiplyByPoint(i, this.endPoint.clone(), new r());
|
|
506
|
+
this.angle = Math.atan2(t.x, t.y);
|
|
507
|
+
}
|
|
508
|
+
circleMove(e, i) {
|
|
509
|
+
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
510
|
+
const t = this.viewer.scene.pick(e.endPosition);
|
|
511
|
+
if (l(t) && l(t.id) && this.dataSource.entities.contains(d(t.id))) {
|
|
512
|
+
let a = d(t.id);
|
|
513
|
+
this.currentDragPoint = a, this.editDragEnable();
|
|
514
|
+
}
|
|
515
|
+
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new E(i), this.currentIndex === 0 ? (this.firstPoint = i, this.ellipseEntity && (this.ellipseEntity.position = new E(this.firstPoint)), this.endPointEntity && (this.updateEndPoint(), this.endPointEntity.position = new E(this.endPoint))) : (this.endPoint = i, this.countDistance())) : this.editDragUnable();
|
|
516
|
+
}
|
|
517
|
+
updateEndPoint() {
|
|
518
|
+
var e = new r(
|
|
519
|
+
this.distance * Math.sin(this.angle),
|
|
520
|
+
this.distance * Math.cos(this.angle),
|
|
521
|
+
0
|
|
522
|
+
// 保持水平,如果希望保持高度则设为 localEdge.z
|
|
523
|
+
), i = b.eastNorthUpToFixedFrame(this.firstPoint), t = g.multiplyByPointAsVector(i, e, new r());
|
|
524
|
+
this.endPoint = r.add(this.firstPoint, t, new r());
|
|
525
|
+
}
|
|
526
|
+
countDistance() {
|
|
527
|
+
if (this.firstPoint && this.endPoint) {
|
|
528
|
+
const e = y.fromCartesian(this.firstPoint), i = y.fromCartesian(this.endPoint), t = new k(e, i);
|
|
529
|
+
this.distance = t.surfaceDistance;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
//创建主面数据
|
|
533
|
+
createCircle() {
|
|
534
|
+
let e = null;
|
|
535
|
+
this.ellipse ? e = this.ellipse : e = {
|
|
536
|
+
semiMinorAxis: 1,
|
|
537
|
+
// 短半轴(米)
|
|
538
|
+
semiMajorAxis: 1,
|
|
539
|
+
// 长半轴(米)— 两者相等即为圆
|
|
540
|
+
material: u.RED.withAlpha(0.6),
|
|
541
|
+
// 填充颜色,半透明
|
|
542
|
+
height: 0,
|
|
543
|
+
// 椭圆所在高度(米),可选
|
|
544
|
+
extrudedHeight: 0,
|
|
545
|
+
// 拉伸高度,>0 会形成圆柱体,设为0则为平面
|
|
546
|
+
outline: !0,
|
|
547
|
+
// 是否显示边框
|
|
548
|
+
outlineColor: u.RED
|
|
549
|
+
}, e.semiMinorAxis = e.semiMajorAxis = new A(() => this.distance, !1), this.ellipseEntity = this.viewer.entities.add({
|
|
550
|
+
position: new E(this.firstPoint),
|
|
551
|
+
ellipse: e,
|
|
552
|
+
properties: {
|
|
553
|
+
entityType: "ELLIPSE"
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
export {
|
|
559
|
+
O as C,
|
|
560
|
+
h as D,
|
|
561
|
+
T as P,
|
|
562
|
+
x as R,
|
|
563
|
+
Q as a,
|
|
564
|
+
f as b
|
|
565
|
+
};
|
package/drawer.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PointDrawer } from './src/drawer/PointDrawer.ts';
|
|
2
|
+
import { CP2dDrawer, CP2dOptions, DRAWER_MODE, DRAWER_MODE_TYPE } from './src/drawer/CP2dDrawer.ts';
|
|
3
|
+
import { RectDrawer, RectOptions } from './src/drawer/RectDrawer.ts';
|
|
4
|
+
import { CircleDrawer, CircleOptions } from './src/drawer/CircleDrawer.ts';
|
|
5
|
+
import { DelCallbackFn } from './src/drawer/DataCenter.ts';
|
|
6
|
+
import { DRAW_STATUS, DRAW_STATUS_TYPE } from './src/drawer/DrawerStatus.ts';
|
|
7
|
+
export { PointDrawer, CP2dDrawer, RectDrawer, CircleDrawer, DRAW_STATUS, type DRAW_STATUS_TYPE, DRAWER_MODE, type DRAWER_MODE_TYPE, type CircleOptions, type RectOptions, type CP2dOptions, type DelCallbackFn };
|
package/drawer.js
ADDED
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as PA from "three";
|
|
|
3
3
|
import { TrianglesDrawMode as tP, TriangleFanDrawMode as EA, TriangleStripDrawMode as SA, Loader as sP, LoaderUtils as F, FileLoader as qA, Color as S, LinearSRGBColorSpace as H, SpotLight as BP, PointLight as rP, DirectionalLight as vP, MeshBasicMaterial as W, SRGBColorSpace as R, MeshPhysicalMaterial as y, Vector2 as VA, Matrix4 as tA, Vector3 as K, Quaternion as hA, InstancedMesh as gP, InstancedBufferAttribute as CP, Object3D as JA, TextureLoader as DP, ImageBitmapLoader as wP, BufferAttribute as BA, InterleavedBuffer as QP, InterleavedBufferAttribute as cP, LinearMipmapLinearFilter as YA, NearestMipmapLinearFilter as IP, LinearMipmapNearestFilter as EP, NearestMipmapNearestFilter as zP, LinearFilter as zA, NearestFilter as NA, RepeatWrapping as TA, MirroredRepeatWrapping as TP, ClampToEdgeWrapping as lP, PointsMaterial as oP, Material as rA, LineBasicMaterial as aP, MeshStandardMaterial as KA, DoubleSide as MP, PropertyBinding as uP, BufferGeometry as pP, SkinnedMesh as bP, Mesh as iP, LineSegments as fP, Line as UP, LineLoop as yP, Points as dP, Group as vA, PerspectiveCamera as jP, MathUtils as HP, OrthographicCamera as mP, Skeleton as kP, AnimationClip as LP, Bone as OP, InterpolateDiscrete as SP, InterpolateLinear as XA, ColorManagement as MA, Texture as uA, VectorKeyframeTrack as pA, NumberKeyframeTrack as bA, QuaternionKeyframeTrack as iA, FrontSide as qP, Interpolant as VP, Box3 as hP, Sphere as JP } from "three";
|
|
4
4
|
import { Viewer as h, Math as _, Cartesian2 as eA, Cartesian3 as L, Cartographic as ZA, SceneTransforms as YP, Ray as NP, Color as KP, ScreenSpaceEventType as gA, ScreenSpaceEventHandler as XP, createWorldTerrainAsync as ZP, EllipsoidTerrainProvider as GP, WebMapTileServiceImageryProvider as Y, Credit as N } from "cesium";
|
|
5
5
|
import { P as G, a as fA, b as xP, c as WP, d as FP, C as UA } from "./index-CcaLwHv1.js";
|
|
6
|
-
import {
|
|
6
|
+
import { C as Mn, a as un, b as pn, D as bn, P as fn, R as Un } from "./CircleDrawer-DbOS8_ZI.js";
|
|
7
7
|
function yA(D, A) {
|
|
8
8
|
if (A === tP)
|
|
9
9
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), D;
|
|
@@ -2397,11 +2397,14 @@ const He = /* @__PURE__ */ q({
|
|
|
2397
2397
|
D.component(A, P);
|
|
2398
2398
|
}), D), ln = { install: cn };
|
|
2399
2399
|
export {
|
|
2400
|
-
Mn as
|
|
2400
|
+
Mn as CP2dDrawer,
|
|
2401
|
+
un as CircleDrawer,
|
|
2402
|
+
pn as DRAWER_MODE,
|
|
2403
|
+
bn as DRAW_STATUS,
|
|
2401
2404
|
fA as PIN_CATEGORY,
|
|
2402
2405
|
G as PIN_MODE,
|
|
2403
|
-
|
|
2404
|
-
|
|
2406
|
+
fn as PointDrawer,
|
|
2407
|
+
Un as RectDrawer,
|
|
2405
2408
|
me as cpCompass,
|
|
2406
2409
|
Ve as cpCoord,
|
|
2407
2410
|
Fe as cpOverlay,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cesium-pocket",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1-alpha",
|
|
4
4
|
"description": "cesium的插件库;基于vue3的开发",
|
|
5
5
|
"module": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"import": "./tianmap.js",
|
|
18
18
|
"types": "./tianmap.d.ts"
|
|
19
19
|
},
|
|
20
|
-
"./
|
|
21
|
-
"import": "./
|
|
22
|
-
"types": "./
|
|
20
|
+
"./drawer": {
|
|
21
|
+
"import": "./drawer.js",
|
|
22
|
+
"types": "./drawer.d.ts"
|
|
23
23
|
},
|
|
24
24
|
"./*": "./*"
|
|
25
25
|
},
|