cesium-pocket 0.7.2-alpha → 0.7.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-D2dAuEcD.js → CircleDrawer-CF3y41Db.js} +200 -139
- package/analysis.js +5 -0
- package/czml.d.ts +1 -1
- package/czml.js +319 -0
- package/drawer.js +1 -1
- package/gauger.js +1 -1
- package/index.css +1 -1
- package/index.js +842 -1043
- package/package.json +1 -1
- package/{polygonSolid-DpagI6AO.js → polygonSolid-CiAmYON1.js} +157 -138
- package/src/drawer/CP2dDrawer.d.ts +6 -0
- package/src/drawer/DataCenter.d.ts +12 -0
- package/src/drawer/RectDrawer.d.ts +8 -2
- package/src/gauger/util.d.ts +24 -0
- package/submerger-Bqh-bzY0.js +294 -0
- package/src/drawer/util.d.ts +0 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CustomDataSource as
|
|
1
|
+
import { CustomDataSource as O, Cartesian3 as r, JulianDate as U, defined as l, HeightReference as M, Color as E, EntityCollection as N, ScreenSpaceEventType as c, ConstantPositionProperty as f, ScreenSpaceEventHandler as m, VerticalOrigin as G, KeyboardEventModifier as b, PolylineDashMaterialProperty as x, CallbackProperty as D, PolygonHierarchy as B, Cartographic as C, Transforms as F, Matrix4 as w, EllipsoidGeodesic as Q } from "cesium";
|
|
2
2
|
import { toRaw as u } from "vue";
|
|
3
|
-
const
|
|
3
|
+
const h = {
|
|
4
4
|
STOPED: Symbol("STOPED"),
|
|
5
5
|
//未开启状态
|
|
6
6
|
DRAWABLE: Symbol("DRAWABLE"),
|
|
@@ -20,15 +20,15 @@ const l = {
|
|
|
20
20
|
//正在拖拽中
|
|
21
21
|
CTRL_DOWN: Symbol("CTRL_DOWN")
|
|
22
22
|
//正在拖拽中
|
|
23
|
-
},
|
|
23
|
+
}, A = {
|
|
24
24
|
DEL_UNABLED: Symbol("DEL_UNABLED"),
|
|
25
25
|
//不删除
|
|
26
26
|
DEL_ENABLED: Symbol("DEL_ENABLED")
|
|
27
27
|
//可拖拽
|
|
28
28
|
};
|
|
29
|
-
class
|
|
29
|
+
class W {
|
|
30
30
|
constructor(e) {
|
|
31
|
-
this.status =
|
|
31
|
+
this.status = h.STOPED, this.editStatus = o.DRAG_UNABLED, this.delStatus = A.DEL_UNABLED, this.viewer = e;
|
|
32
32
|
}
|
|
33
33
|
getStatus() {
|
|
34
34
|
return this.status;
|
|
@@ -49,22 +49,22 @@ class K {
|
|
|
49
49
|
* 可添加点
|
|
50
50
|
*/
|
|
51
51
|
drawableStatus() {
|
|
52
|
-
this.status =
|
|
52
|
+
this.status = h.DRAWABLE, this.viewer.canvas.style.cursor = "crosshair";
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* 可移动点
|
|
56
56
|
*/
|
|
57
57
|
editableStatus() {
|
|
58
|
-
this.status =
|
|
58
|
+
this.status = h.EDITABLE, this.viewer.canvas.style.cursor = "pointer";
|
|
59
59
|
}
|
|
60
60
|
deletableStatus() {
|
|
61
|
-
this.status =
|
|
61
|
+
this.status = h.DELETABLE, this.viewer.canvas.style.cursor = "grabbing";
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* 停止操作
|
|
65
65
|
*/
|
|
66
66
|
stopStatus() {
|
|
67
|
-
this.status =
|
|
67
|
+
this.status = h.STOPED, this.viewer.canvas.style.cursor = "default";
|
|
68
68
|
}
|
|
69
69
|
//----------------------------------------
|
|
70
70
|
editDragUnable() {
|
|
@@ -80,16 +80,16 @@ class K {
|
|
|
80
80
|
this.editStatus = o.CTRL_DOWN, this.viewer.canvas.style.cursor = "crosshair";
|
|
81
81
|
}
|
|
82
82
|
delUnable() {
|
|
83
|
-
this.delStatus =
|
|
83
|
+
this.delStatus = A.DEL_UNABLED, this.viewer.canvas.style.cursor = "pointer";
|
|
84
84
|
}
|
|
85
85
|
delEnable() {
|
|
86
|
-
this.delStatus =
|
|
86
|
+
this.delStatus = A.DEL_ENABLED, this.viewer.canvas.style.cursor = "grabbing";
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
const
|
|
90
|
-
class S extends
|
|
89
|
+
const K = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAQAElEQVR4AexdfYwkR3V/r3dnb884wUd03O1HTrZj4p09/CFMSBwpkqX8Ayjkj6ALQY6ixHIc8REJRUoiJUK+80eI7QQH28IOR+xIxOGwyCVRIHEE2JgD6cAfCPt2d9b4ZMt3O7uAfUYceG9ndrp4r6d1N7eeme7prq7q6np7VdvdVa/e+73f699M983OTADyIwwIAwMZEIEMpEYmhAEAEYicBcLAEAZEIEPIkSlhQAQi54AwMISBAgUyJKpMCQOOMCACcaRQAtMOAyIQO7xLVEcYEIE4UiiBaYcBEYgd3iWqIwy4KRBHyBWY7jMgAnG/hpJBgQyIQAokV1y7z4AIxP0aSgYFMiACKZBcce0+AyKQLTWUQ2GglwERSC8bsi8MbGFABLKFEDkUBnoZEIH0siH7wsAWBkQgWwiRQ2GglwERSC8bxe6LdwcZEIE4WDSBbI4BEYgBrmfV7PbZjcuvnNqY+73pdv2vplv1g1Ot+uO0fZL6IvWXqZ+ivhF33ucxnnsytj3Ia9kH+2KfBqB7H0IEUsApsOvM2y6d2Zj//Zl2/W464b8btn/h9RCD7yHif4CCOyjkjQhwHQC8k3qd+i9T30F9Iu68z2M8987Y9kZeyz7YF/tk3xyDY3FMWitNMwMiEE2E7m7t/bXpjfqdU636c2PB+HGF6gtKwccA4Goo7udqjsGxOCbHZgy7CUtxIf3yLALJUe9da1e+aaY198dTG/UvBxB+BxD+kh7t357DZcal3WVRbMLAWBgTY2OM3Vn5nYUBEUgG1natX34J3Q/cMvaW9jEF+BAivDeDm0KXMCbGxhgZK2MuNGBFnYtARijsbjW/d6o1/49jY8EzdD/wcVp6MfWyt4sZK2Nm7JxD2QGXCZ8IJEU1+AZ4qjX3QNBW30VQf0FLLqLuWruIsXMOnAvn5FoCNvCKQBJYp5Pppj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iTG5WJhtfQoDPpY3Jtrwmrb3Y6WNABKKPy5E8BeEYP4uk+XLQM7HtSP7FWA8DIhA9PI7s5cTkseMKVeK7D9mGbUcOUNkFZhMTgZjl+7xoq7XGJ0Cp75032HtAc5FN75jsG2VABGKU7n7BkF8b6TdBY8PmaFpa4QyIQAqneHiA5ral/yKLz1Pf2j4fz20dl2ODDIhADJI9MFQY8g17p2e+A92xniHZtcGACMQG61tiNieXlxGBRRLN8D6PRQfyyxwDfSKJQPqQYmNopbbEf4KyQLEX4n3alWabARGI7Qr0xMcg2M+9Z0h2LTMQWI4v4XsYWBlf+CL3niHZtcyACMRyASR8uRkQgZS7PoLOMgO6BGI5DQkvDBTDgAikGF7Fa0UYEIFUpJCSRjEMiECK4VW8VoQBEUhFCilpFMOAAwIpJnHxKgykYUAEkoYlsfGWARGIt6WXxNMwIAJJw5LYeMuACMTb0kviaRjwWyBpGBIbrxkQgXhdfkk+iQERSBJDMu81AyIQr8svyScxIAJJYkjmvWZABFJQ+cVtNRj4OQAAAP//gm46zwAAAAZJREFUAwB1f5TcL2bFTAAAAABJRU5ErkJggg==";
|
|
90
|
+
class S extends W {
|
|
91
91
|
constructor(e) {
|
|
92
|
-
super(e), this.mainData = [], this.dataSource = new
|
|
92
|
+
super(e), this.mainData = [], this.dataSource = new O("drawerDataSource"), this.currentDragPoint = null, this.currentIndex = -1, this.viewer.dataSources.add(this.dataSource);
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* 获取DataSource
|
|
@@ -104,11 +104,31 @@ class S extends K {
|
|
|
104
104
|
*/
|
|
105
105
|
dsToMd() {
|
|
106
106
|
return this.mainData = [], this.dataSource.entities.values.forEach((e) => {
|
|
107
|
-
var
|
|
108
|
-
const t = new r();
|
|
109
|
-
(i
|
|
107
|
+
var a;
|
|
108
|
+
const t = new r(), i = (a = e.position) == null ? void 0 : a.getValue(U.now(), t);
|
|
109
|
+
l(i) && this.mainData.push(this.toPlainCartesian3(i));
|
|
110
110
|
}), this.mainData;
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* 复制成普通坐标对象。
|
|
114
|
+
* 一是去掉挂在上面的附加属性;二是万一外部把响应式代理传进来,
|
|
115
|
+
* 复制后就是普通对象,可以安全地 postMessage 给 Web Worker。
|
|
116
|
+
*/
|
|
117
|
+
toPlainCartesian3(e) {
|
|
118
|
+
return r.clone(e);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 过滤出合法坐标并复制成普通对象。
|
|
122
|
+
* 数组里可能混入 undefined(绘制过程中还没拾取到地表点),
|
|
123
|
+
* 直接交给 Cesium 会抛出 “Cannot set properties of undefined”。
|
|
124
|
+
*/
|
|
125
|
+
toPlainPositions(e) {
|
|
126
|
+
const t = [];
|
|
127
|
+
if (!e) return t;
|
|
128
|
+
for (const i of e)
|
|
129
|
+
i instanceof r && t.push(this.toPlainCartesian3(i));
|
|
130
|
+
return t;
|
|
131
|
+
}
|
|
112
132
|
/**
|
|
113
133
|
* 根据mainData更新dataSource
|
|
114
134
|
* @returns Cartesian3[]
|
|
@@ -133,9 +153,9 @@ class S extends K {
|
|
|
133
153
|
}
|
|
134
154
|
}
|
|
135
155
|
deleteMoveFun(e) {
|
|
136
|
-
if (
|
|
156
|
+
if (A.DEL_UNABLED == super.getDelStatus()) {
|
|
137
157
|
const t = this.viewer.scene.pick(e.endPosition);
|
|
138
|
-
|
|
158
|
+
l(t) && l(t.id) && this.dataSource.entities.contains(u(t.id)) && this.delEnable();
|
|
139
159
|
} else
|
|
140
160
|
this.delUnable();
|
|
141
161
|
}
|
|
@@ -146,10 +166,11 @@ class S extends K {
|
|
|
146
166
|
color: E.TRANSPARENT,
|
|
147
167
|
outlineColor: E.YELLOW,
|
|
148
168
|
outlineWidth: 2,
|
|
149
|
-
heightReference:
|
|
169
|
+
heightReference: M.CLAMP_TO_GROUND
|
|
150
170
|
//贴地
|
|
151
171
|
}, this.dataSource.entities.add({
|
|
152
|
-
|
|
172
|
+
// 复制成普通坐标,避免外部传入的响应式代理流进 Cesium 的几何参数
|
|
173
|
+
position: this.toPlainCartesian3(e),
|
|
153
174
|
point: t,
|
|
154
175
|
properties: {
|
|
155
176
|
entityType: "POINT"
|
|
@@ -174,29 +195,29 @@ class S extends K {
|
|
|
174
195
|
// });
|
|
175
196
|
// }
|
|
176
197
|
}
|
|
177
|
-
class
|
|
198
|
+
class _ extends S {
|
|
178
199
|
constructor(e, t = null) {
|
|
179
|
-
super(e), this.handler = null, this.pointCollection = new
|
|
200
|
+
super(e), this.handler = null, this.pointCollection = new N(), this.addPointFun = this.addBillboardCallback, this.point_L_ClickEvent = () => {
|
|
180
201
|
var i;
|
|
181
202
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
182
|
-
if (
|
|
183
|
-
let
|
|
184
|
-
if (
|
|
185
|
-
let d = this.addPointFun(
|
|
186
|
-
this.mainData.push(
|
|
203
|
+
if (h.DRAWABLE == super.getStatus()) {
|
|
204
|
+
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
205
|
+
if (l(n)) {
|
|
206
|
+
let d = this.addPointFun(n);
|
|
207
|
+
this.mainData.push(n), this.pointCollection.add(d), this.afterAddPointFun && this.afterAddPointFun(d);
|
|
187
208
|
}
|
|
188
|
-
} else if (
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
const
|
|
192
|
-
this.pointCollection.contains(
|
|
209
|
+
} else if (h.DELETABLE == super.getStatus()) {
|
|
210
|
+
const s = this.viewer.scene.pick(a.position);
|
|
211
|
+
if (l(s) && l(s.id)) {
|
|
212
|
+
const n = u(s.id);
|
|
213
|
+
this.pointCollection.contains(n) && A.DEL_ENABLED == super.getDelStatus() && this.deleteBillboard(n);
|
|
193
214
|
}
|
|
194
215
|
}
|
|
195
216
|
}, c.LEFT_CLICK);
|
|
196
217
|
}, this.point_L_DownEvent = () => {
|
|
197
218
|
var i;
|
|
198
219
|
(i = this.handler) == null || i.setInputAction(() => {
|
|
199
|
-
|
|
220
|
+
h.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
200
221
|
}, c.LEFT_DOWN);
|
|
201
222
|
}, this.point_L_UpEvent = () => {
|
|
202
223
|
var i;
|
|
@@ -206,29 +227,29 @@ class Z extends S {
|
|
|
206
227
|
}, this.point_moveEvent = () => {
|
|
207
228
|
var i;
|
|
208
229
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
209
|
-
if (
|
|
230
|
+
if (h.EDITABLE == super.getStatus())
|
|
210
231
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
213
|
-
let
|
|
214
|
-
this.currentDragPoint =
|
|
232
|
+
const s = this.viewer.scene.pick(a.endPosition);
|
|
233
|
+
if (l(s) && l(s.id) && this.pointCollection.contains(u(s.id))) {
|
|
234
|
+
let n = u(s.id);
|
|
235
|
+
this.currentDragPoint = n, this.editDragEnable();
|
|
215
236
|
}
|
|
216
237
|
} else if (o.DRAGING == super.getEditStatus()) {
|
|
217
|
-
const
|
|
218
|
-
|
|
238
|
+
const s = this.viewer.scene.pickPosition(a.endPosition);
|
|
239
|
+
l(s) && this.currentDragPoint && (this.currentDragPoint.position = new f(s), this.editPointFun && this.editPointFun(s, this.currentDragPoint));
|
|
219
240
|
} else
|
|
220
241
|
this.editDragUnable();
|
|
221
|
-
else if (
|
|
222
|
-
if (
|
|
223
|
-
const
|
|
224
|
-
|
|
242
|
+
else if (h.DELETABLE == super.getStatus())
|
|
243
|
+
if (A.DEL_UNABLED == super.getDelStatus()) {
|
|
244
|
+
const s = this.viewer.scene.pick(a.endPosition);
|
|
245
|
+
l(s) && l(s.id) && this.pointCollection.contains(u(s.id)) && this.delEnable();
|
|
225
246
|
} else
|
|
226
247
|
this.delUnable();
|
|
227
248
|
}, c.MOUSE_MOVE);
|
|
228
249
|
}, t && (this.addPointFun = t.addPointFun ? t.addPointFun : this.addBillboardCallback, t.afterAddPointFun && (this.afterAddPointFun = t.afterAddPointFun), t.editPointFun && (this.editPointFun = t.editPointFun), t.delConfirmFun && (this.delConfirmFun = t.delConfirmFun));
|
|
229
250
|
}
|
|
230
251
|
start() {
|
|
231
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
252
|
+
super.drawableStatus(), this.handler || (this.handler = new m(this.viewer.scene.canvas)), this.point_L_ClickEvent(), this.point_L_DownEvent(), this.point_L_UpEvent(), this.point_moveEvent();
|
|
232
253
|
}
|
|
233
254
|
getEntities() {
|
|
234
255
|
return this.pointCollection;
|
|
@@ -247,14 +268,14 @@ class Z extends S {
|
|
|
247
268
|
// 设置经纬度位置 (经度, 纬度, 海拔高度)
|
|
248
269
|
position: e,
|
|
249
270
|
billboard: {
|
|
250
|
-
image:
|
|
271
|
+
image: K,
|
|
251
272
|
// 设置图片显示的宽度和高度 (像素)
|
|
252
273
|
width: 40,
|
|
253
274
|
height: 40,
|
|
254
275
|
// 可选项:缩放倍数
|
|
255
276
|
scale: 1,
|
|
256
|
-
verticalOrigin:
|
|
257
|
-
heightReference:
|
|
277
|
+
verticalOrigin: G.BOTTOM,
|
|
278
|
+
heightReference: M.CLAMP_TO_GROUND
|
|
258
279
|
//贴地
|
|
259
280
|
},
|
|
260
281
|
show: !0
|
|
@@ -266,33 +287,33 @@ class Z extends S {
|
|
|
266
287
|
}) : confirm("确定要删除吗?") && (this.viewer.entities.remove(e), this.dsToMd());
|
|
267
288
|
}
|
|
268
289
|
}
|
|
269
|
-
const
|
|
290
|
+
const L = {
|
|
270
291
|
LINE: Symbol("LINE"),
|
|
271
292
|
//画线模式
|
|
272
293
|
POLYGON: Symbol("POLYGON")
|
|
273
294
|
//画面模式
|
|
274
295
|
};
|
|
275
|
-
class
|
|
296
|
+
class Z extends S {
|
|
276
297
|
constructor(e, t) {
|
|
277
|
-
super(e), this.handler = null, this.mainLineEntity = null, this.mainPolygonEntity = null, this.dashLineEntity = null, this.dashEndData = null, this.drawerMode =
|
|
298
|
+
super(e), this.handler = null, this.mainLineEntity = null, this.mainPolygonEntity = null, this.dashLineEntity = null, this.dashEndData = null, this.drawerMode = L.LINE, this.r_ClickEvent = () => {
|
|
278
299
|
var i;
|
|
279
300
|
(i = this.handler) == null || i.setInputAction(() => {
|
|
280
|
-
|
|
301
|
+
h.DRAWABLE == super.getStatus() && (this.dashLineEntity && (this.viewer.entities.removeById(this.dashLineEntity.id), this.dashLineEntity = null), this.dashEndData = null, this.stopStatus(), this.stopDrawCallbackFun && this.stopDrawCallbackFun());
|
|
281
302
|
}, c.RIGHT_CLICK);
|
|
282
303
|
}, this.l_ClickEvent = () => {
|
|
283
304
|
var i;
|
|
284
305
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
285
|
-
if (
|
|
286
|
-
let
|
|
287
|
-
if (
|
|
288
|
-
const d = this.addPoint(
|
|
289
|
-
this.afterAddPointFun && this.afterAddPointFun(d), this.mainData.push(
|
|
306
|
+
if (h.DRAWABLE == super.getStatus()) {
|
|
307
|
+
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
308
|
+
if (l(n)) {
|
|
309
|
+
const d = this.addPoint(n);
|
|
310
|
+
this.afterAddPointFun && this.afterAddPointFun(d), this.mainData.push(this.toPlainCartesian3(n)), this.syncPreview();
|
|
290
311
|
}
|
|
291
|
-
} else if (
|
|
292
|
-
const
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
this.dataSource.entities.contains(
|
|
312
|
+
} else if (h.DELETABLE == super.getStatus()) {
|
|
313
|
+
const s = this.viewer.scene.pick(a.position);
|
|
314
|
+
if (l(s) && l(s.id)) {
|
|
315
|
+
const n = u(s.id);
|
|
316
|
+
this.dataSource.entities.contains(n) && A.DEL_ENABLED == super.getDelStatus() && this.deletePoint(n);
|
|
296
317
|
}
|
|
297
318
|
}
|
|
298
319
|
}, c.LEFT_CLICK);
|
|
@@ -300,12 +321,12 @@ class V extends S {
|
|
|
300
321
|
var i;
|
|
301
322
|
(i = this.handler) == null || i.setInputAction(
|
|
302
323
|
(a) => {
|
|
303
|
-
if (
|
|
304
|
-
let
|
|
305
|
-
if (
|
|
306
|
-
const d = this.addPoint(
|
|
307
|
-
let g = this.measurePoint(
|
|
308
|
-
this.mainData.splice(g, 0,
|
|
324
|
+
if (h.EDITABLE == super.getStatus()) {
|
|
325
|
+
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
326
|
+
if (l(n)) {
|
|
327
|
+
const d = this.addPoint(n);
|
|
328
|
+
let g = this.measurePoint(n);
|
|
329
|
+
this.mainData.splice(g, 0, this.toPlainCartesian3(n)), this.MdToDs(), this.syncPreview(), this.afterAddPointFun && this.afterAddPointFun(d);
|
|
309
330
|
}
|
|
310
331
|
}
|
|
311
332
|
},
|
|
@@ -315,7 +336,7 @@ class V extends S {
|
|
|
315
336
|
}, this.l_DownEvent = () => {
|
|
316
337
|
var i;
|
|
317
338
|
(i = this.handler) == null || i.setInputAction(() => {
|
|
318
|
-
|
|
339
|
+
h.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.getEntityIndex(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
319
340
|
}, c.LEFT_DOWN);
|
|
320
341
|
}, this.l_UpEvent = () => {
|
|
321
342
|
var i;
|
|
@@ -325,16 +346,16 @@ class V extends S {
|
|
|
325
346
|
}, this.moveEvent = () => {
|
|
326
347
|
var i;
|
|
327
348
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
330
|
-
const
|
|
331
|
-
|
|
349
|
+
const s = this.viewer.camera.getPickRay(a.endPosition);
|
|
350
|
+
if (s) {
|
|
351
|
+
const n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
352
|
+
l(n) && (h.DRAWABLE == super.getStatus() ? (this.dashEndData = this.toPlainCartesian3(n), this.movingCallbackFun && this.movingCallbackFun(n)) : h.EDITABLE == super.getStatus() ? (this.dashLineEntity && (this.dashLineEntity.show = !1), this.editMoveFun(a, n)) : h.DELETABLE == super.getStatus() && (this.dashLineEntity && (this.dashLineEntity.show = !1), this.deleteMoveFun(a)));
|
|
332
353
|
}
|
|
333
354
|
}, c.MOUSE_MOVE);
|
|
334
355
|
}, this.moveCtrlEvent = () => {
|
|
335
356
|
var i;
|
|
336
357
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
337
|
-
this.viewer.camera.getPickRay(a.endPosition) &&
|
|
358
|
+
this.viewer.camera.getPickRay(a.endPosition) && h.EDITABLE == super.getStatus() && this.editCtrlDown();
|
|
338
359
|
}, c.MOUSE_MOVE, b.CTRL);
|
|
339
360
|
}, this.createDashline = () => {
|
|
340
361
|
let i;
|
|
@@ -344,15 +365,16 @@ class V extends S {
|
|
|
344
365
|
new r()
|
|
345
366
|
],
|
|
346
367
|
width: 2,
|
|
347
|
-
material: new
|
|
368
|
+
material: new x({
|
|
348
369
|
color: E.RED,
|
|
349
370
|
dashLength: 15
|
|
350
371
|
}),
|
|
351
372
|
show: !0,
|
|
352
373
|
clampToGround: !0
|
|
353
|
-
}, i.positions = new
|
|
354
|
-
|
|
355
|
-
|
|
374
|
+
}, i.positions = new D(() => {
|
|
375
|
+
const a = this.toPlainPositions(this.mainData), s = a[a.length - 1];
|
|
376
|
+
if (!(!s || !this.dashEndData))
|
|
377
|
+
return [this.toPlainCartesian3(s), this.toPlainCartesian3(this.dashEndData)];
|
|
356
378
|
}, !1), this.dashLineEntity = this.viewer.entities.add({
|
|
357
379
|
polyline: i,
|
|
358
380
|
properties: {
|
|
@@ -362,12 +384,12 @@ class V extends S {
|
|
|
362
384
|
}, 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), t.delConfirmFun && (this.delConfirmFun = t.delConfirmFun));
|
|
363
385
|
}
|
|
364
386
|
start() {
|
|
365
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
387
|
+
super.drawableStatus(), this.handler || (this.handler = new m(this.viewer.scene.canvas)), this.r_ClickEvent(), this.l_ClickEvent(), this.l_ClickCtrlEvent(), this.l_DownEvent(), this.l_UpEvent(), this.moveCtrlEvent(), this.moveEvent();
|
|
366
388
|
}
|
|
367
389
|
getEntity() {
|
|
368
|
-
if (this.drawerMode ===
|
|
390
|
+
if (this.drawerMode === L.LINE)
|
|
369
391
|
return this.mainLineEntity;
|
|
370
|
-
if (this.drawerMode ===
|
|
392
|
+
if (this.drawerMode === L.POLYGON)
|
|
371
393
|
return this.mainPolygonEntity;
|
|
372
394
|
}
|
|
373
395
|
getPositions() {
|
|
@@ -381,36 +403,51 @@ class V extends S {
|
|
|
381
403
|
}
|
|
382
404
|
}
|
|
383
405
|
clearAll() {
|
|
384
|
-
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);
|
|
406
|
+
this.clearAllData(), this.handler = null, this.dashEndData = null, this.mainLineEntity && (this.viewer.entities.removeById(this.mainLineEntity.id), this.mainLineEntity = null), this.mainPolygonEntity && (this.viewer.entities.removeById(this.mainPolygonEntity.id), this.mainPolygonEntity = null), this.dashLineEntity && (this.viewer.entities.removeById(this.dashLineEntity.id), this.dashLineEntity = null);
|
|
385
407
|
}
|
|
386
408
|
measurePoint(e) {
|
|
387
409
|
let t = 1 / 0, i = -1, a = 0;
|
|
388
|
-
for (let
|
|
389
|
-
const d = this.mainData[
|
|
390
|
-
let
|
|
410
|
+
for (let s = 0, n = this.mainData.length; s < n - 1; s++) {
|
|
411
|
+
const d = this.mainData[s], g = this.mainData[s + 1], y = r.subtract(g, d, new r()), R = r.subtract(e, d, new r()), I = r.dot(y, y);
|
|
412
|
+
let v, P;
|
|
391
413
|
if (I === 0)
|
|
392
|
-
|
|
414
|
+
v = r.distance(e, d), P = 0;
|
|
393
415
|
else {
|
|
394
|
-
|
|
395
|
-
const
|
|
416
|
+
P = r.dot(R, y) / I;
|
|
417
|
+
const k = Math.max(0, Math.min(1, P)), T = r.add(
|
|
396
418
|
d,
|
|
397
|
-
r.multiplyByScalar(
|
|
419
|
+
r.multiplyByScalar(y, k, new r()),
|
|
398
420
|
new r()
|
|
399
421
|
);
|
|
400
|
-
|
|
422
|
+
v = r.distance(e, T);
|
|
401
423
|
}
|
|
402
|
-
|
|
424
|
+
v < t && (t = v, i = s, a = P);
|
|
403
425
|
}
|
|
404
426
|
return (a > 1 || a < 0) && (i == 0 ? i = -1 : i == this.mainData.length - 2 && (i = i + 1)), i + 1;
|
|
405
427
|
}
|
|
406
428
|
editMoveFun(e, t) {
|
|
407
429
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
408
430
|
const i = this.viewer.scene.pick(e.endPosition);
|
|
409
|
-
if (
|
|
431
|
+
if (l(i) && l(i.id) && this.dataSource.entities.contains(u(i.id))) {
|
|
410
432
|
let a = u(i.id);
|
|
411
433
|
this.currentDragPoint = a, this.editDragEnable();
|
|
412
434
|
}
|
|
413
|
-
} else o.DRAGING == super.getEditStatus()
|
|
435
|
+
} else if (o.DRAGING == super.getEditStatus()) {
|
|
436
|
+
if (this.currentDragPoint) {
|
|
437
|
+
const i = this.toPlainCartesian3(t);
|
|
438
|
+
this.currentDragPoint.position = new f(i), this.mainData[this.currentIndex] = i, this.editCallbackFun && this.editCallbackFun(i, this.currentIndex);
|
|
439
|
+
}
|
|
440
|
+
} else
|
|
441
|
+
this.editDragUnable();
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* 按当前顶点数创建预览图形。
|
|
445
|
+
* 顶点不够时不创建:面至少要 3 个点、线至少要 2 个点,
|
|
446
|
+
* 否则会生成无效几何,让 Cesium 报错甚至停止渲染。
|
|
447
|
+
*/
|
|
448
|
+
syncPreview() {
|
|
449
|
+
const e = this.toPlainPositions(this.mainData).length;
|
|
450
|
+
!this.mainLineEntity && e >= 2 && this.createMainLine(), !this.dashLineEntity && e >= 1 && this.createDashline(), this.drawerMode === L.POLYGON && !this.mainPolygonEntity && e >= 3 && this.createMainPolygon();
|
|
414
451
|
}
|
|
415
452
|
//创建主线数据
|
|
416
453
|
createMainLine() {
|
|
@@ -424,7 +461,11 @@ class V extends S {
|
|
|
424
461
|
// 是否显示
|
|
425
462
|
show: !0,
|
|
426
463
|
clampToGround: !0
|
|
427
|
-
}, e.positions = new
|
|
464
|
+
}, e.positions = new D(() => {
|
|
465
|
+
const t = this.toPlainPositions(this.mainData);
|
|
466
|
+
if (!(t.length < 2))
|
|
467
|
+
return t;
|
|
468
|
+
}, !1), this.mainLineEntity = this.viewer.entities.add({
|
|
428
469
|
polyline: e,
|
|
429
470
|
properties: {
|
|
430
471
|
entityType: "LINE"
|
|
@@ -438,9 +479,9 @@ class V extends S {
|
|
|
438
479
|
hierarchy: [new r(), new r(), new r()],
|
|
439
480
|
material: E.RED.withAlpha(0.4),
|
|
440
481
|
outline: !1
|
|
441
|
-
}, e.hierarchy = new
|
|
442
|
-
|
|
443
|
-
return this.dashEndData && (
|
|
482
|
+
}, e.hierarchy = new D(() => {
|
|
483
|
+
const t = this.toPlainPositions(this.mainData);
|
|
484
|
+
return this.dashEndData && t.push(this.toPlainCartesian3(this.dashEndData)), new B(t);
|
|
444
485
|
}, !1), this.mainPolygonEntity = this.viewer.entities.add({
|
|
445
486
|
polygon: e,
|
|
446
487
|
properties: {
|
|
@@ -449,20 +490,20 @@ class V extends S {
|
|
|
449
490
|
});
|
|
450
491
|
}
|
|
451
492
|
}
|
|
452
|
-
class
|
|
493
|
+
class V extends S {
|
|
453
494
|
constructor(e, t) {
|
|
454
495
|
super(e), this.handler = null, this.firstPoint = null, this.endPoint = null, this.lineEntity = null, this.polygonEntity = null, this.rect_L_ClickEvent = () => {
|
|
455
496
|
var i;
|
|
456
497
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
457
|
-
if (
|
|
458
|
-
let
|
|
459
|
-
|
|
498
|
+
if (h.DRAWABLE == super.getStatus()) {
|
|
499
|
+
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
500
|
+
l(n) && (this.mainData.length === 0 ? (this.addPoint(n), this.firstPoint = this.toPlainCartesian3(n), this.mainData.push(this.toPlainCartesian3(n)), this.syncPreview()) : (this.addPoint(n), this.endPoint = this.toPlainCartesian3(n), this.stopStatus(), this.initMainData(), this.syncPreview(), this.rectOverFun && this.rectOverFun(this.mainData)));
|
|
460
501
|
}
|
|
461
502
|
}, c.LEFT_CLICK);
|
|
462
503
|
}, this.rect_L_DownEvent = () => {
|
|
463
504
|
var i;
|
|
464
505
|
(i = this.handler) == null || i.setInputAction(() => {
|
|
465
|
-
|
|
506
|
+
h.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.getEntityIndex(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
466
507
|
}, c.LEFT_DOWN);
|
|
467
508
|
}, this.rect_L_UpEvent = () => {
|
|
468
509
|
var i;
|
|
@@ -472,19 +513,19 @@ class X extends S {
|
|
|
472
513
|
}, this.rect_moveEvent = () => {
|
|
473
514
|
var i;
|
|
474
515
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
const
|
|
478
|
-
|
|
516
|
+
const s = this.viewer.camera.getPickRay(a.endPosition);
|
|
517
|
+
if (s) {
|
|
518
|
+
const n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
519
|
+
l(n) && (h.DRAWABLE == super.getStatus() ? this.firstPoint && (this.endPoint = this.toPlainCartesian3(n), this.initMainData(), this.syncPreview(), this.rectMovingFun && this.rectMovingFun(this.mainData)) : h.EDITABLE == super.getStatus() && (this.rectMove(a, n), this.rectEditFun && this.rectEditFun(this.mainData)));
|
|
479
520
|
}
|
|
480
521
|
}, c.MOUSE_MOVE);
|
|
481
522
|
}, 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));
|
|
482
523
|
}
|
|
483
524
|
start() {
|
|
484
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
525
|
+
super.drawableStatus(), this.handler || (this.handler = new m(this.viewer.scene.canvas)), this.rect_L_ClickEvent(), this.rect_L_DownEvent(), this.rect_L_UpEvent(), this.rect_moveEvent();
|
|
485
526
|
}
|
|
486
527
|
getEntity() {
|
|
487
|
-
this.polygonEntity;
|
|
528
|
+
return this.polygonEntity;
|
|
488
529
|
}
|
|
489
530
|
getPositions() {
|
|
490
531
|
return this.dsToMd();
|
|
@@ -495,26 +536,42 @@ class X extends S {
|
|
|
495
536
|
* @param endPoint 结束点坐标
|
|
496
537
|
*/
|
|
497
538
|
setPositions(e, t) {
|
|
498
|
-
this.clearAll(), this.firstPoint =
|
|
539
|
+
this.clearAll(), this.firstPoint = this.toPlainCartesian3(e), this.endPoint = this.toPlainCartesian3(t), this.initMainData(), this.syncPreview();
|
|
499
540
|
}
|
|
500
541
|
clearAll() {
|
|
501
|
-
this.clearAllData(), this.firstPoint =
|
|
542
|
+
this.clearAllData(), this.firstPoint = null, this.endPoint = null, this.mainData = [], this.handler && (this.handler = null), this.polygonEntity && (this.viewer.entities.removeById(this.polygonEntity.id), this.polygonEntity = null), this.lineEntity && (this.viewer.entities.removeById(this.lineEntity.id), this.lineEntity = null);
|
|
502
543
|
}
|
|
503
544
|
rectMove(e, t) {
|
|
504
545
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
505
546
|
const i = this.viewer.scene.pick(e.endPosition);
|
|
506
|
-
if (
|
|
547
|
+
if (l(i) && l(i.id) && this.dataSource.entities.contains(u(i.id))) {
|
|
507
548
|
let a = u(i.id);
|
|
508
549
|
this.currentDragPoint = a, this.editDragEnable();
|
|
509
550
|
}
|
|
510
|
-
} else o.DRAGING == super.getEditStatus()
|
|
551
|
+
} else if (o.DRAGING == super.getEditStatus()) {
|
|
552
|
+
if (this.currentDragPoint) {
|
|
553
|
+
const i = this.toPlainCartesian3(t);
|
|
554
|
+
this.currentDragPoint.position = new f(i), this.currentIndex === 0 ? this.firstPoint = i : this.endPoint = i, this.initMainData(), this.syncPreview();
|
|
555
|
+
}
|
|
556
|
+
} else
|
|
557
|
+
this.editDragUnable();
|
|
511
558
|
}
|
|
512
559
|
initMainData() {
|
|
513
560
|
if (this.firstPoint && this.endPoint) {
|
|
514
|
-
const e =
|
|
561
|
+
const e = C.fromCartesian(this.firstPoint), t = C.fromCartesian(this.endPoint);
|
|
562
|
+
if (!l(e) || !l(t)) return;
|
|
563
|
+
const i = e.longitude, a = e.latitude, s = t.longitude, n = t.latitude, d = r.fromRadians(i, n), g = r.fromRadians(s, a);
|
|
515
564
|
this.mainData[0] = this.firstPoint, this.mainData[1] = d, this.mainData[2] = this.endPoint, this.mainData[3] = g;
|
|
516
565
|
}
|
|
517
566
|
}
|
|
567
|
+
/**
|
|
568
|
+
* 按当前顶点数创建预览图形。
|
|
569
|
+
* 顶点不够时不创建:面至少要 3 个点、线至少要 2 个点,
|
|
570
|
+
* 否则会生成无效几何,让 Cesium 报错甚至停止渲染。
|
|
571
|
+
*/
|
|
572
|
+
syncPreview() {
|
|
573
|
+
!this.lineEntity && this.toPlainPositions(this.mainData).length >= 2 && this.createLine(), !this.polygonEntity && this.toPlainPositions(this.mainData).length >= 3 && this.createPolygon();
|
|
574
|
+
}
|
|
518
575
|
//创建主线数据
|
|
519
576
|
createLine() {
|
|
520
577
|
let e = null;
|
|
@@ -527,7 +584,11 @@ class X extends S {
|
|
|
527
584
|
// 是否显示
|
|
528
585
|
show: !0,
|
|
529
586
|
clampToGround: !0
|
|
530
|
-
}, e.positions = new
|
|
587
|
+
}, e.positions = new D(() => {
|
|
588
|
+
const t = this.toPlainPositions(this.mainData);
|
|
589
|
+
if (!(t.length < 2))
|
|
590
|
+
return [...t, this.toPlainCartesian3(t[0])];
|
|
591
|
+
}, !1), this.lineEntity = this.viewer.entities.add({
|
|
531
592
|
polyline: e,
|
|
532
593
|
properties: {
|
|
533
594
|
entityType: "LINE"
|
|
@@ -541,7 +602,7 @@ class X extends S {
|
|
|
541
602
|
hierarchy: [new r(), new r(), new r()],
|
|
542
603
|
material: E.RED.withAlpha(0.4),
|
|
543
604
|
outline: !1
|
|
544
|
-
}, e.hierarchy = new
|
|
605
|
+
}, e.hierarchy = new D(() => new B(this.toPlainPositions(this.mainData)), !1), this.polygonEntity = this.viewer.entities.add({
|
|
545
606
|
polygon: e,
|
|
546
607
|
properties: {
|
|
547
608
|
entityType: "POLYGON"
|
|
@@ -549,20 +610,20 @@ class X extends S {
|
|
|
549
610
|
});
|
|
550
611
|
}
|
|
551
612
|
}
|
|
552
|
-
class
|
|
613
|
+
class X extends S {
|
|
553
614
|
constructor(e, t) {
|
|
554
615
|
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 = () => {
|
|
555
616
|
var i;
|
|
556
617
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
557
|
-
if (
|
|
558
|
-
let
|
|
559
|
-
|
|
618
|
+
if (h.DRAWABLE == super.getStatus()) {
|
|
619
|
+
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
620
|
+
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.setAngle(), this.stopStatus(), this.circleOverFun && this.circleOverFun(this.firstPoint, this.endPoint)));
|
|
560
621
|
}
|
|
561
622
|
}, c.LEFT_CLICK);
|
|
562
623
|
}, this.circle_L_DownEvent = () => {
|
|
563
624
|
var i;
|
|
564
625
|
(i = this.handler) == null || i.setInputAction(() => {
|
|
565
|
-
|
|
626
|
+
h.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.getEntityIndex(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
566
627
|
}, c.LEFT_DOWN);
|
|
567
628
|
}, this.circle_L_UpEvent = () => {
|
|
568
629
|
var i;
|
|
@@ -572,16 +633,16 @@ class J extends S {
|
|
|
572
633
|
}, this.circle_moveEvent = () => {
|
|
573
634
|
var i;
|
|
574
635
|
(i = this.handler) == null || i.setInputAction((a) => {
|
|
575
|
-
const
|
|
576
|
-
if (
|
|
577
|
-
const
|
|
578
|
-
|
|
636
|
+
const s = this.viewer.camera.getPickRay(a.endPosition);
|
|
637
|
+
if (s) {
|
|
638
|
+
const n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
639
|
+
l(n) && (h.DRAWABLE == super.getStatus() ? this.mainData.length > 0 && (this.endPoint = n, this.countDistance(), this.circleMovingFun && this.circleMovingFun(this.firstPoint, n)) : h.EDITABLE == super.getStatus() && (this.circleMove(a, n), this.circleEditFun && this.circleEditFun(this.firstPoint, this.endPoint)));
|
|
579
640
|
}
|
|
580
641
|
}, c.MOUSE_MOVE);
|
|
581
642
|
}, 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));
|
|
582
643
|
}
|
|
583
644
|
start() {
|
|
584
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
645
|
+
super.drawableStatus(), this.handler || (this.handler = new m(this.viewer.scene.canvas)), this.circle_L_ClickEvent(), this.circle_L_DownEvent(), this.circle_L_UpEvent(), this.circle_moveEvent();
|
|
585
646
|
}
|
|
586
647
|
getEntity() {
|
|
587
648
|
return this.ellipseEntity;
|
|
@@ -596,17 +657,17 @@ class J extends S {
|
|
|
596
657
|
this.clearAllData(), this.firstPoint = new r(), this.endPoint = new r(), this.handler && (this.handler = null), this.ellipseEntity && this.viewer.entities.removeById(this.ellipseEntity.id);
|
|
597
658
|
}
|
|
598
659
|
setAngle() {
|
|
599
|
-
const e =
|
|
660
|
+
const e = F.eastNorthUpToFixedFrame(this.firstPoint.clone()), t = w.inverse(e, new w()), i = w.multiplyByPoint(t, this.endPoint.clone(), new r());
|
|
600
661
|
this.angle = Math.atan2(i.x, i.y);
|
|
601
662
|
}
|
|
602
663
|
circleMove(e, t) {
|
|
603
664
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
604
665
|
const i = this.viewer.scene.pick(e.endPosition);
|
|
605
|
-
if (
|
|
666
|
+
if (l(i) && l(i.id) && this.dataSource.entities.contains(u(i.id))) {
|
|
606
667
|
let a = u(i.id);
|
|
607
668
|
this.currentDragPoint = a, this.editDragEnable();
|
|
608
669
|
}
|
|
609
|
-
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new
|
|
670
|
+
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new f(t), this.currentIndex === 0 ? (this.firstPoint = t, this.ellipseEntity && (this.ellipseEntity.position = new f(this.firstPoint)), this.endPointEntity && (this.updateEndPoint(), this.endPointEntity.position = new f(this.endPoint))) : (this.endPoint = t, this.countDistance())) : this.editDragUnable();
|
|
610
671
|
}
|
|
611
672
|
updateEndPoint() {
|
|
612
673
|
var e = new r(
|
|
@@ -614,12 +675,12 @@ class J extends S {
|
|
|
614
675
|
this.distance * Math.cos(this.angle),
|
|
615
676
|
0
|
|
616
677
|
// 保持水平,如果希望保持高度则设为 localEdge.z
|
|
617
|
-
), t =
|
|
678
|
+
), t = F.eastNorthUpToFixedFrame(this.firstPoint), i = w.multiplyByPointAsVector(t, e, new r());
|
|
618
679
|
this.endPoint = r.add(this.firstPoint, i, new r());
|
|
619
680
|
}
|
|
620
681
|
countDistance() {
|
|
621
682
|
if (this.firstPoint && this.endPoint) {
|
|
622
|
-
const e =
|
|
683
|
+
const e = C.fromCartesian(this.firstPoint), t = C.fromCartesian(this.endPoint), i = new Q(e, t);
|
|
623
684
|
this.distance = i.surfaceDistance;
|
|
624
685
|
}
|
|
625
686
|
}
|
|
@@ -640,8 +701,8 @@ class J extends S {
|
|
|
640
701
|
outline: !0,
|
|
641
702
|
// 是否显示边框
|
|
642
703
|
outlineColor: E.RED
|
|
643
|
-
}, e.semiMinorAxis = e.semiMajorAxis = new
|
|
644
|
-
position: new
|
|
704
|
+
}, e.semiMinorAxis = e.semiMajorAxis = new D(() => this.distance, !1), this.ellipseEntity = this.viewer.entities.add({
|
|
705
|
+
position: new f(this.firstPoint),
|
|
645
706
|
ellipse: e,
|
|
646
707
|
properties: {
|
|
647
708
|
entityType: "ELLIPSE"
|
|
@@ -650,10 +711,10 @@ class J extends S {
|
|
|
650
711
|
}
|
|
651
712
|
}
|
|
652
713
|
export {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
714
|
+
Z as C,
|
|
715
|
+
h as D,
|
|
716
|
+
_ as P,
|
|
717
|
+
V as R,
|
|
718
|
+
X as a,
|
|
719
|
+
L as b
|
|
659
720
|
};
|