cesium-pocket 0.7.0-alpha → 0.7.2-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/czml.d.ts +2 -0
- package/gauger.d.ts +5 -1
- package/gauger.js +10 -6
- package/index.js +91 -87
- package/package.json +5 -1
- package/polygonSolid-DpagI6AO.js +794 -0
- package/src/czml/path/pathHeightEditor.d.ts +204 -0
- package/src/czml/path/pathHeightMath.d.ts +89 -0
- package/src/gauger/circleSolid.d.ts +6 -0
- package/src/gauger/heightPole.d.ts +43 -0
- package/src/gauger/polygonSolid.d.ts +6 -0
- package/src/gauger/pullColumn.d.ts +37 -0
- package/src/gauger/rectSolid.d.ts +6 -0
- package/src/gauger/util.d.ts +8 -1
- package/PolygonGaguger-C8cFLW0V.js +0 -509
|
@@ -1,509 +0,0 @@
|
|
|
1
|
-
import { Cartographic as v, EllipsoidGeodesic as Y, Cartesian3 as g, BoundingSphere as N, Transforms as y, Matrix4 as M, CustomDataSource as L, ConstantPositionProperty as d, ConstantProperty as u, Color as c, Cartesian2 as B, VerticalOrigin as F, HorizontalOrigin as T, LabelStyle as x, Math as k } from "cesium";
|
|
2
|
-
import { a as j, R as U, P as W, D as G, C as O, b as Z } from "./CircleDrawer-D2dAuEcD.js";
|
|
3
|
-
const A = (n, t) => {
|
|
4
|
-
const l = v.fromCartesian(n), e = v.fromCartesian(t);
|
|
5
|
-
return new Y(l, e).surfaceDistance;
|
|
6
|
-
}, I = (n, t) => {
|
|
7
|
-
const l = new g();
|
|
8
|
-
return g.add(n, t, l), g.divideByScalar(l, 2, l), l;
|
|
9
|
-
}, p = (n) => {
|
|
10
|
-
let t = "";
|
|
11
|
-
return n > 1e3 * 100 ? t = (n / 1e3).toFixed(0) + " 公里" : n > 1e3 ? t = (n / 1e3).toFixed(2) + " 公里" : t = n.toFixed(2) + " 米", t;
|
|
12
|
-
}, C = (n) => {
|
|
13
|
-
if (!n || n.length === 0) return null;
|
|
14
|
-
let t = 0, l = 0, e = 0;
|
|
15
|
-
const i = n.length;
|
|
16
|
-
return n.forEach((a) => {
|
|
17
|
-
t += a.x, l += a.y, e += a.z;
|
|
18
|
-
}), new g(
|
|
19
|
-
t / i,
|
|
20
|
-
l / i,
|
|
21
|
-
e / i
|
|
22
|
-
);
|
|
23
|
-
}, m = (n) => {
|
|
24
|
-
if (n.length < 3) return "0平方米";
|
|
25
|
-
const l = N.fromPoints(n).center, e = y.eastNorthUpToFixedFrame(l), i = M.inverse(e, new M()), s = n.map(
|
|
26
|
-
(r) => M.multiplyByPoint(i, r, new g())
|
|
27
|
-
);
|
|
28
|
-
let a = 0;
|
|
29
|
-
for (let r = 0; r < s.length; r++) {
|
|
30
|
-
const o = (r + 1) % s.length;
|
|
31
|
-
a += s[r].x * s[o].y, a -= s[o].x * s[r].y;
|
|
32
|
-
}
|
|
33
|
-
return a = Math.abs(a / 2), P(a);
|
|
34
|
-
}, P = (n) => {
|
|
35
|
-
let t = "";
|
|
36
|
-
return n > 1e3 * 1e3 * 1e3 ? t = (n / 1e3 / 1e3 / 1e4).toFixed(2) + "万平方公里" : n > 1e3 * 100 ? t = (n / 1e3 / 1e3).toFixed(2) + "平方公里" : t = n.toFixed(0) + "平方米", t;
|
|
37
|
-
};
|
|
38
|
-
class H {
|
|
39
|
-
constructor(t, l) {
|
|
40
|
-
this.tmpDistanceLabel = null, this.tmpAreaLabel = null, this.distanceLabel = null, this.areaLabel = null, this.dataSource = new L("gagugerDataSource"), this.assistDataSource = new L("assistDataSource"), this.circleEditFun = (e, i) => {
|
|
41
|
-
let s = 0;
|
|
42
|
-
if (this.distanceLabel) {
|
|
43
|
-
s = A(e, i);
|
|
44
|
-
const a = "半径:" + p(s);
|
|
45
|
-
this.distanceLabel.position = new d(i), this.distanceLabel.label && (this.distanceLabel.label.text = new u(a));
|
|
46
|
-
}
|
|
47
|
-
if (this.areaLabel) {
|
|
48
|
-
const a = window.Math.PI * s * s, r = "面积:" + P(a);
|
|
49
|
-
this.areaLabel.position = new d(e), this.areaLabel.label && (this.areaLabel.label.text = new u(r));
|
|
50
|
-
}
|
|
51
|
-
}, this.circleMovingFun = (e, i) => {
|
|
52
|
-
let s = 0;
|
|
53
|
-
if (this.tmpDistanceLabel) {
|
|
54
|
-
s = A(e, i);
|
|
55
|
-
const a = "半径:" + p(s);
|
|
56
|
-
this.tmpDistanceLabel.show = !0, this.tmpDistanceLabel.position = new d(i), this.tmpDistanceLabel.label && (this.tmpDistanceLabel.label.text = new u(a));
|
|
57
|
-
}
|
|
58
|
-
if (this.tmpAreaLabel) {
|
|
59
|
-
const a = window.Math.PI * s * s, r = "面积:" + P(a);
|
|
60
|
-
this.tmpAreaLabel.position = new d(e), this.tmpAreaLabel.label && (this.tmpAreaLabel.label.text = new u(r));
|
|
61
|
-
}
|
|
62
|
-
}, this.circleOverFun = (e, i) => {
|
|
63
|
-
this.tmpDistanceLabel.show = !1, this.tmpAreaLabel.show = !1;
|
|
64
|
-
const s = this.createTextLabel(new g(), "", c.DARKRED), a = this.createTextLabel(new g(), "", c.BLACK);
|
|
65
|
-
this.distanceLabel = this.assistDataSource.entities.add(s), this.areaLabel = this.assistDataSource.entities.add(a), this.circleEditFun(e, i);
|
|
66
|
-
}, this.createTextLabel = (e, i, s = c.DARKRED, a = -20) => {
|
|
67
|
-
const r = {
|
|
68
|
-
text: i,
|
|
69
|
-
font: "12px sans-serif bold",
|
|
70
|
-
fillColor: c.WHITE,
|
|
71
|
-
showBackground: !0,
|
|
72
|
-
backgroundColor: s,
|
|
73
|
-
style: x.FILL_AND_OUTLINE,
|
|
74
|
-
horizontalOrigin: T.CENTER,
|
|
75
|
-
verticalOrigin: F.CENTER,
|
|
76
|
-
pixelOffset: new B(0, a),
|
|
77
|
-
//偏移量
|
|
78
|
-
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
79
|
-
};
|
|
80
|
-
return {
|
|
81
|
-
position: e,
|
|
82
|
-
label: r
|
|
83
|
-
};
|
|
84
|
-
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(l);
|
|
85
|
-
}
|
|
86
|
-
start() {
|
|
87
|
-
var e;
|
|
88
|
-
(e = this.circleDrawer) == null || e.start();
|
|
89
|
-
const t = this.createTextLabel(new g(), "", c.DARKRED.withAlpha(0.6)), l = this.createTextLabel(new g(), "", c.BLACK.withAlpha(0.6));
|
|
90
|
-
this.tmpDistanceLabel = this.assistDataSource.entities.add(t), this.tmpAreaLabel = this.assistDataSource.entities.add(l);
|
|
91
|
-
}
|
|
92
|
-
getStatus() {
|
|
93
|
-
var t;
|
|
94
|
-
(t = this.circleDrawer) == null || t.getStatus();
|
|
95
|
-
}
|
|
96
|
-
setEditStatus() {
|
|
97
|
-
var t;
|
|
98
|
-
(t = this.circleDrawer) == null || t.setEditStatus();
|
|
99
|
-
}
|
|
100
|
-
clearAll() {
|
|
101
|
-
var t;
|
|
102
|
-
(t = this.circleDrawer) == null || t.clearAll(), this.dataSource.entities.removeAll(), this.assistDataSource.entities.removeAll();
|
|
103
|
-
}
|
|
104
|
-
init(t) {
|
|
105
|
-
let e = { ...{
|
|
106
|
-
circleEditFun: this.circleEditFun,
|
|
107
|
-
circleMovingFun: this.circleMovingFun,
|
|
108
|
-
circleOverFun: this.circleOverFun
|
|
109
|
-
}, ...t };
|
|
110
|
-
this.circleDrawer = new j(this.viewer, e);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
class K {
|
|
114
|
-
constructor(t, l) {
|
|
115
|
-
this.tmpLabel = null, this.totalLabel = null, this.dataSource = new L("gagugerDataSource"), this.assistDataSource = new L("assistDataSource"), this.rectEditFun = (e) => {
|
|
116
|
-
if (this.totalLabel) {
|
|
117
|
-
const i = C(e), s = "面积:" + m(e);
|
|
118
|
-
i && (this.totalLabel.show = !0, this.totalLabel.position = new d(i), this.totalLabel.label && (this.totalLabel.label.text = new u(s)));
|
|
119
|
-
}
|
|
120
|
-
}, this.rectMovingFun = (e) => {
|
|
121
|
-
if (this.tmpLabel) {
|
|
122
|
-
const i = C(e), s = "面积:" + m(e);
|
|
123
|
-
i && (this.tmpLabel.show = !0, this.tmpLabel.position = new d(i), this.tmpLabel.label && (this.tmpLabel.label.text = new u(s)));
|
|
124
|
-
}
|
|
125
|
-
}, this.rectOverFun = (e) => {
|
|
126
|
-
if (this.tmpLabel && (this.tmpLabel.show = !1), !this.totalLabel) {
|
|
127
|
-
const i = C(e), s = "面积:" + m(e);
|
|
128
|
-
if (i) {
|
|
129
|
-
const a = this.createTextlabel(i, s, c.BLACK);
|
|
130
|
-
this.totalLabel = this.assistDataSource.entities.add(a);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}, this.createTextlabel = (e, i, s = c.DARKRED, a = 0) => {
|
|
134
|
-
const r = {
|
|
135
|
-
text: i,
|
|
136
|
-
font: "12px sans-serif bold",
|
|
137
|
-
fillColor: c.WHITE,
|
|
138
|
-
showBackground: !0,
|
|
139
|
-
backgroundColor: s,
|
|
140
|
-
style: x.FILL_AND_OUTLINE,
|
|
141
|
-
horizontalOrigin: T.CENTER,
|
|
142
|
-
verticalOrigin: F.CENTER,
|
|
143
|
-
pixelOffset: new B(0, a),
|
|
144
|
-
//偏移量
|
|
145
|
-
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
146
|
-
};
|
|
147
|
-
return {
|
|
148
|
-
position: e,
|
|
149
|
-
label: r
|
|
150
|
-
};
|
|
151
|
-
}, this.createTmplabel = () => {
|
|
152
|
-
let i = {
|
|
153
|
-
position: new g(),
|
|
154
|
-
label: {
|
|
155
|
-
text: "",
|
|
156
|
-
font: "12px sans-serif bold",
|
|
157
|
-
fillColor: c.WHITE,
|
|
158
|
-
showBackground: !0,
|
|
159
|
-
backgroundColor: c.BLACK.withAlpha(0.6),
|
|
160
|
-
style: x.FILL_AND_OUTLINE,
|
|
161
|
-
horizontalOrigin: T.LEFT,
|
|
162
|
-
verticalOrigin: F.BOTTOM,
|
|
163
|
-
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
164
|
-
},
|
|
165
|
-
show: !1
|
|
166
|
-
};
|
|
167
|
-
return this.assistDataSource.entities.add(i);
|
|
168
|
-
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(l);
|
|
169
|
-
}
|
|
170
|
-
start() {
|
|
171
|
-
var t;
|
|
172
|
-
(t = this.rectDrawer) == null || t.start(), this.tmpLabel = this.createTmplabel();
|
|
173
|
-
}
|
|
174
|
-
getStatus() {
|
|
175
|
-
var t;
|
|
176
|
-
(t = this.rectDrawer) == null || t.getStatus();
|
|
177
|
-
}
|
|
178
|
-
setEditStatus() {
|
|
179
|
-
var t;
|
|
180
|
-
(t = this.rectDrawer) == null || t.setEditStatus();
|
|
181
|
-
}
|
|
182
|
-
clearAll() {
|
|
183
|
-
var t;
|
|
184
|
-
(t = this.rectDrawer) == null || t.clearAll(), this.dataSource.entities.removeAll(), this.assistDataSource.entities.removeAll();
|
|
185
|
-
}
|
|
186
|
-
init(t) {
|
|
187
|
-
let e = { ...{
|
|
188
|
-
rectEditFun: this.rectEditFun,
|
|
189
|
-
rectMovingFun: this.rectMovingFun,
|
|
190
|
-
rectOverFun: this.rectOverFun
|
|
191
|
-
}, ...t };
|
|
192
|
-
this.rectDrawer = new U(this.viewer, e);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAMgCAYAAABYroDnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4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96OyxFMdT1B/XHV05BRtXtU9nOO7GL77RAhzr5wchvupoRbsc4sMZEy5eN8rUaNxsUYvjCHycuqo3QrySSt1ur1sJ+kWIay1uH433Yx2uc/nCnKtdfHTOpSblubTKnU1lskypsJYqwZ200sX4Pq101+dYvmNF+TreV5mVqitz9hMbaWSuFd1e68k2bj4vUf8Utw9Qt3Y7mdZ36ofHqbScTj3DiSVB76X+4n+V6R8BBgDKRo2v+bLvIgAAAABJRU5ErkJggg==";
|
|
196
|
-
class J {
|
|
197
|
-
constructor(t, l) {
|
|
198
|
-
this.editCallback = (e, i) => {
|
|
199
|
-
const s = this.getLonLatStr(e);
|
|
200
|
-
i.label && i.label.text && (i.label.text = new u(s));
|
|
201
|
-
}, this.billboardCallback = (e) => {
|
|
202
|
-
const i = this.getLonLatStr(e);
|
|
203
|
-
return this.viewer.entities.add({
|
|
204
|
-
position: e,
|
|
205
|
-
label: {
|
|
206
|
-
text: i,
|
|
207
|
-
font: "500 14px Helvetica",
|
|
208
|
-
style: x.FILL,
|
|
209
|
-
fillColor: c.WHITE,
|
|
210
|
-
outlineColor: c.BLACK,
|
|
211
|
-
pixelOffset: new B(0, -90),
|
|
212
|
-
//偏移量
|
|
213
|
-
showBackground: !0,
|
|
214
|
-
backgroundColor: c.ORANGERED,
|
|
215
|
-
horizontalOrigin: T.LEFT
|
|
216
|
-
},
|
|
217
|
-
billboard: {
|
|
218
|
-
image: V,
|
|
219
|
-
width: 30,
|
|
220
|
-
height: 100,
|
|
221
|
-
scale: 1,
|
|
222
|
-
verticalOrigin: F.BOTTOM
|
|
223
|
-
},
|
|
224
|
-
show: !0
|
|
225
|
-
});
|
|
226
|
-
}, this.viewer = t, l ? (this.addPointFun = l.addBillboardFun ? l.addBillboardFun : this.billboardCallback, this.editPointFun = l.editPointFun ? l.editPointFun : this.editCallback, this.delConfirmFun = l.delConfirmFun) : (this.addPointFun = this.billboardCallback, this.editPointFun = this.editCallback), this.init();
|
|
227
|
-
}
|
|
228
|
-
start() {
|
|
229
|
-
var t;
|
|
230
|
-
(t = this.pointDrawer) == null || t.start();
|
|
231
|
-
}
|
|
232
|
-
getStatus() {
|
|
233
|
-
var t;
|
|
234
|
-
(t = this.pointDrawer) == null || t.getStatus();
|
|
235
|
-
}
|
|
236
|
-
setEditStatus() {
|
|
237
|
-
var t;
|
|
238
|
-
(t = this.pointDrawer) == null || t.setEditStatus();
|
|
239
|
-
}
|
|
240
|
-
setDelStatus() {
|
|
241
|
-
var t;
|
|
242
|
-
(t = this.pointDrawer) == null || t.setDelStatus();
|
|
243
|
-
}
|
|
244
|
-
clearAll() {
|
|
245
|
-
var t;
|
|
246
|
-
(t = this.pointDrawer) == null || t.clearAll();
|
|
247
|
-
}
|
|
248
|
-
getEntities() {
|
|
249
|
-
var t;
|
|
250
|
-
return (t = this.pointDrawer) == null ? void 0 : t.getEntities();
|
|
251
|
-
}
|
|
252
|
-
init() {
|
|
253
|
-
let t = {
|
|
254
|
-
addPointFun: this.addPointFun,
|
|
255
|
-
editPointFun: this.editPointFun
|
|
256
|
-
};
|
|
257
|
-
this.delConfirmFun && (t.delConfirmFun = this.delConfirmFun), this.pointDrawer = new W(this.viewer, t);
|
|
258
|
-
}
|
|
259
|
-
getLonLatStr(t) {
|
|
260
|
-
const l = v.fromCartesian(t), e = k.toDegrees(l.longitude), i = k.toDegrees(l.latitude);
|
|
261
|
-
return `${e.toFixed(2)}, ${i.toFixed(2)}`;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
class Q {
|
|
265
|
-
constructor(t, l) {
|
|
266
|
-
this.tmpLabel = null, this.totalLabel = null, this.itemDisSource = new L("itemDisDataSource"), this.totalDisSource = new L("totalDisSource"), this.afterAddPointFun = (e) => {
|
|
267
|
-
var i, s, a;
|
|
268
|
-
if (((i = this.lineDrawer) == null ? void 0 : i.getStatus()) == G.DRAWABLE) {
|
|
269
|
-
const r = (s = e.position) == null ? void 0 : s.getValue(), o = this.lineDrawer.getPositions();
|
|
270
|
-
let b = o.length;
|
|
271
|
-
if (b > 1) {
|
|
272
|
-
const D = I(o[b - 2], r), S = A(o[b - 2], r), h = p(S);
|
|
273
|
-
let w = this.createTextlabel(D, h);
|
|
274
|
-
this.itemDisSource.entities.add(w);
|
|
275
|
-
}
|
|
276
|
-
} else ((a = this.lineDrawer) == null ? void 0 : a.getStatus()) == G.EDITABLE && this.reCreateAll();
|
|
277
|
-
}, this.movingCallbackFun = (e) => {
|
|
278
|
-
if (this.tmpLabel) {
|
|
279
|
-
const i = this.lineDrawer.getPositions(), s = i[i.length - 1];
|
|
280
|
-
let a = A(s, e), r = p(a);
|
|
281
|
-
this.tmpLabel.show = !0, this.tmpLabel.position = new d(e), this.tmpLabel.label && (this.tmpLabel.label.text = new u(r));
|
|
282
|
-
}
|
|
283
|
-
}, this.editCallbackFun = (e, i) => {
|
|
284
|
-
const s = this.lineDrawer.getPositions();
|
|
285
|
-
let a = -1, r = -1, o = 0, b = 0;
|
|
286
|
-
if (i > 0) {
|
|
287
|
-
a = i;
|
|
288
|
-
const h = this.itemDisSource.entities.values[i - 1], w = s[i - 1], f = I(w, e);
|
|
289
|
-
o = A(w, e);
|
|
290
|
-
const E = p(o);
|
|
291
|
-
h.position = new d(f), h.label.text = new u(E);
|
|
292
|
-
}
|
|
293
|
-
if (i < s.length - 1) {
|
|
294
|
-
r = i + 1;
|
|
295
|
-
const h = this.itemDisSource.entities.values[i], w = s[i + 1], f = I(e, w);
|
|
296
|
-
b = A(e, w);
|
|
297
|
-
const E = p(b);
|
|
298
|
-
h.position = new d(f), h.label.text = new u(E);
|
|
299
|
-
}
|
|
300
|
-
i == s.length - 1 && this.totalLabel && (this.totalLabel.position = new d(e));
|
|
301
|
-
let D = 0;
|
|
302
|
-
for (let h = 1, w = s.length; h < w; h++) {
|
|
303
|
-
if (a == h || r == h)
|
|
304
|
-
continue;
|
|
305
|
-
const f = s[h - 1], E = s[h], R = A(f, E);
|
|
306
|
-
D += R;
|
|
307
|
-
}
|
|
308
|
-
D += o, D += b;
|
|
309
|
-
let S = "共:" + p(D);
|
|
310
|
-
this.totalLabel && (this.totalLabel.label.text = new u(S));
|
|
311
|
-
}, this.stopDrawCallbackFun = () => {
|
|
312
|
-
if (this.tmpLabel && (this.tmpLabel.show = !1), !this.totalLabel) {
|
|
313
|
-
const e = this.lineDrawer.getPositions();
|
|
314
|
-
let i = 0, s = e.length;
|
|
315
|
-
for (let o = 1; o < s; o++) {
|
|
316
|
-
const b = e[o - 1], D = e[o], S = A(b, D);
|
|
317
|
-
i += S;
|
|
318
|
-
}
|
|
319
|
-
let a = "共:" + p(i), r = this.createTextlabel(e[s - 1], a, c.BLACK, -20);
|
|
320
|
-
this.totalLabel = this.totalDisSource.entities.add(r);
|
|
321
|
-
}
|
|
322
|
-
}, this.createTextlabel = (e, i, s = c.DARKRED, a = 0) => {
|
|
323
|
-
const r = {
|
|
324
|
-
text: i,
|
|
325
|
-
font: "12px sans-serif bold",
|
|
326
|
-
fillColor: c.WHITE,
|
|
327
|
-
showBackground: !0,
|
|
328
|
-
backgroundColor: s,
|
|
329
|
-
style: x.FILL_AND_OUTLINE,
|
|
330
|
-
horizontalOrigin: T.CENTER,
|
|
331
|
-
verticalOrigin: F.CENTER,
|
|
332
|
-
pixelOffset: new B(0, a),
|
|
333
|
-
//偏移量
|
|
334
|
-
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
335
|
-
};
|
|
336
|
-
return {
|
|
337
|
-
position: e,
|
|
338
|
-
label: r
|
|
339
|
-
};
|
|
340
|
-
}, this.reCreateAll = () => {
|
|
341
|
-
this.itemDisSource.entities.removeAll(), this.totalDisSource.entities.removeAll();
|
|
342
|
-
const e = this.lineDrawer.getPositions();
|
|
343
|
-
let i = 0, s = e.length;
|
|
344
|
-
for (let o = 1; o < s; o++) {
|
|
345
|
-
const b = e[o - 1], D = e[o], S = I(b, D), h = A(b, D);
|
|
346
|
-
i += h;
|
|
347
|
-
let w = p(h), f = this.createTextlabel(S, w);
|
|
348
|
-
this.itemDisSource.entities.add(f);
|
|
349
|
-
}
|
|
350
|
-
let a = "共:" + p(i), r = this.createTextlabel(e[s - 1], a, c.BLACK, -20);
|
|
351
|
-
this.totalLabel = this.totalDisSource.entities.add(r);
|
|
352
|
-
}, this.viewer = t, this.viewer.dataSources.add(this.itemDisSource), this.viewer.dataSources.add(this.totalDisSource), this.init(l);
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* 开始绘制
|
|
356
|
-
*/
|
|
357
|
-
start() {
|
|
358
|
-
var t;
|
|
359
|
-
(t = this.lineDrawer) == null || t.start();
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* 获取状态
|
|
363
|
-
*/
|
|
364
|
-
getStatus() {
|
|
365
|
-
var t;
|
|
366
|
-
(t = this.lineDrawer) == null || t.getStatus();
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* 进入编辑状态
|
|
370
|
-
*/
|
|
371
|
-
setEditStatus() {
|
|
372
|
-
var t;
|
|
373
|
-
(t = this.lineDrawer) == null || t.setEditStatus(), this.stopDrawCallbackFun();
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* 进入删除状态
|
|
377
|
-
*/
|
|
378
|
-
setDelStatus() {
|
|
379
|
-
var t;
|
|
380
|
-
(t = this.lineDrawer) == null || t.setDelStatus(), this.stopDrawCallbackFun();
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* 全部清理
|
|
384
|
-
*/
|
|
385
|
-
clearAll() {
|
|
386
|
-
var t;
|
|
387
|
-
(t = this.lineDrawer) == null || t.clearAll(), this.itemDisSource.entities.removeAll(), this.totalDisSource.entities.removeAll();
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* 初始化
|
|
391
|
-
* @param options
|
|
392
|
-
*/
|
|
393
|
-
init(t) {
|
|
394
|
-
let e = { ...{
|
|
395
|
-
afterAddPointFun: this.afterAddPointFun,
|
|
396
|
-
movingCallbackFun: this.movingCallbackFun,
|
|
397
|
-
editCallbackFun: this.editCallbackFun,
|
|
398
|
-
stopDrawCallbackFun: this.stopDrawCallbackFun,
|
|
399
|
-
delCallbackFun: this.reCreateAll
|
|
400
|
-
}, ...t };
|
|
401
|
-
this.lineDrawer = new O(this.viewer, e);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
class q {
|
|
405
|
-
constructor(t, l) {
|
|
406
|
-
this.tmpLabel = null, this.totalLabel = null, this.openTmpLabel = !1, this.dataSource = new L("gagugerDataSource"), this.assistDataSource = new L("totalAreaDataSource"), this.afterAddPointFun = () => {
|
|
407
|
-
var e, i;
|
|
408
|
-
((e = this.polygonDrawer) == null ? void 0 : e.getStatus()) == G.DRAWABLE ? this.polygonDrawer.getPositions().length > 1 && (this.openTmpLabel = !0) : ((i = this.polygonDrawer) == null ? void 0 : i.getStatus()) == G.EDITABLE && this.reCreateAll();
|
|
409
|
-
}, this.movingCallbackFun = (e) => {
|
|
410
|
-
if (this.openTmpLabel && this.tmpLabel) {
|
|
411
|
-
const s = [...this.polygonDrawer.getPositions(), e], a = C(s), r = "面积:" + m(s);
|
|
412
|
-
a && (this.tmpLabel.show = !0, this.tmpLabel.position = new d(a), this.tmpLabel.label && (this.tmpLabel.label.text = new u(r)));
|
|
413
|
-
}
|
|
414
|
-
}, this.editCallbackFun = (e) => {
|
|
415
|
-
if (this.openTmpLabel && this.totalLabel) {
|
|
416
|
-
const s = [...this.polygonDrawer.getPositions(), e], a = C(s), r = "面积:" + m(s);
|
|
417
|
-
a && (this.totalLabel.show = !0, this.totalLabel.position = new d(a), this.totalLabel.label && (this.totalLabel.label.text = new u(r)));
|
|
418
|
-
}
|
|
419
|
-
}, this.stopDrawCallbackFun = () => {
|
|
420
|
-
if (this.tmpLabel && (this.tmpLabel.show = !1), !this.totalLabel) {
|
|
421
|
-
const e = this.polygonDrawer.getPositions(), i = C(e), s = "面积:" + m(e);
|
|
422
|
-
if (i) {
|
|
423
|
-
const a = this.createTextlabel(i, s, c.BLACK);
|
|
424
|
-
this.totalLabel = this.assistDataSource.entities.add(a);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}, this.createTextlabel = (e, i, s = c.DARKRED, a = 0) => {
|
|
428
|
-
const r = {
|
|
429
|
-
text: i,
|
|
430
|
-
font: "12px sans-serif bold",
|
|
431
|
-
fillColor: c.WHITE,
|
|
432
|
-
showBackground: !0,
|
|
433
|
-
backgroundColor: s,
|
|
434
|
-
style: x.FILL_AND_OUTLINE,
|
|
435
|
-
horizontalOrigin: T.CENTER,
|
|
436
|
-
verticalOrigin: F.CENTER,
|
|
437
|
-
pixelOffset: new B(0, a),
|
|
438
|
-
//偏移量
|
|
439
|
-
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
440
|
-
};
|
|
441
|
-
return {
|
|
442
|
-
position: e,
|
|
443
|
-
label: r
|
|
444
|
-
};
|
|
445
|
-
}, this.createTmplabel = () => {
|
|
446
|
-
let i = {
|
|
447
|
-
position: new g(),
|
|
448
|
-
label: {
|
|
449
|
-
text: "",
|
|
450
|
-
font: "12px sans-serif bold",
|
|
451
|
-
fillColor: c.WHITE,
|
|
452
|
-
showBackground: !0,
|
|
453
|
-
backgroundColor: c.BLACK.withAlpha(0.6),
|
|
454
|
-
style: x.FILL_AND_OUTLINE,
|
|
455
|
-
horizontalOrigin: T.CENTER,
|
|
456
|
-
verticalOrigin: F.CENTER,
|
|
457
|
-
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
458
|
-
},
|
|
459
|
-
show: !1
|
|
460
|
-
};
|
|
461
|
-
return this.assistDataSource.entities.add(i);
|
|
462
|
-
}, this.reCreateAll = () => {
|
|
463
|
-
this.dataSource.entities.removeAll(), this.assistDataSource.entities.removeAll();
|
|
464
|
-
const e = this.polygonDrawer.getPositions(), i = C(e), s = m(e);
|
|
465
|
-
if (i) {
|
|
466
|
-
const a = this.createTextlabel(i, s, c.BLACK);
|
|
467
|
-
this.totalLabel = this.assistDataSource.entities.add(a);
|
|
468
|
-
}
|
|
469
|
-
}, this.viewer = t, this.viewer.dataSources.add(this.dataSource), this.viewer.dataSources.add(this.assistDataSource), this.init(l);
|
|
470
|
-
}
|
|
471
|
-
start() {
|
|
472
|
-
var t;
|
|
473
|
-
(t = this.polygonDrawer) == null || t.start(), this.tmpLabel = this.createTmplabel();
|
|
474
|
-
}
|
|
475
|
-
getStatus() {
|
|
476
|
-
var t;
|
|
477
|
-
(t = this.polygonDrawer) == null || t.getStatus();
|
|
478
|
-
}
|
|
479
|
-
setEditStatus() {
|
|
480
|
-
var t;
|
|
481
|
-
(t = this.polygonDrawer) == null || t.setEditStatus(), this.stopDrawCallbackFun();
|
|
482
|
-
}
|
|
483
|
-
setDelStatus() {
|
|
484
|
-
var t;
|
|
485
|
-
(t = this.polygonDrawer) == null || t.setDelStatus(), this.stopDrawCallbackFun();
|
|
486
|
-
}
|
|
487
|
-
clearAll() {
|
|
488
|
-
var t;
|
|
489
|
-
(t = this.polygonDrawer) == null || t.clearAll(), this.dataSource.entities.removeAll(), this.assistDataSource.entities.removeAll();
|
|
490
|
-
}
|
|
491
|
-
init(t) {
|
|
492
|
-
let e = { ...{
|
|
493
|
-
drawerMode: Z.POLYGON,
|
|
494
|
-
afterAddPointFun: this.afterAddPointFun,
|
|
495
|
-
movingCallbackFun: this.movingCallbackFun,
|
|
496
|
-
editCallbackFun: this.editCallbackFun,
|
|
497
|
-
stopDrawCallbackFun: this.stopDrawCallbackFun,
|
|
498
|
-
delCallbackFun: this.reCreateAll
|
|
499
|
-
}, ...t };
|
|
500
|
-
this.polygonDrawer = new O(this.viewer, e);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
export {
|
|
504
|
-
H as C,
|
|
505
|
-
Q as L,
|
|
506
|
-
J as P,
|
|
507
|
-
K as R,
|
|
508
|
-
q as a
|
|
509
|
-
};
|