deeptwins-engine-3d 0.1.41 → 0.1.43

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.
Files changed (33) hide show
  1. package/dist/esm/analyze/ViewshedAnalysis.d.ts +28 -0
  2. package/dist/esm/analyze/ViewshedAnalysis.js +291 -442
  3. package/dist/esm/constant.d.ts +44 -6
  4. package/dist/esm/constant.js +86 -7
  5. package/dist/esm/deepTwins/index.js +2 -1
  6. package/dist/esm/graphicLayer/BaseSource.d.ts +1 -1
  7. package/dist/esm/index.d.ts +5 -1
  8. package/dist/esm/index.js +13 -6
  9. package/dist/esm/lowAltitude/BarrierLayer.d.ts +29 -0
  10. package/dist/esm/{tileLayer → lowAltitude}/BarrierLayer.js +39 -165
  11. package/dist/esm/lowAltitude/BaseGridMvtLayer.d.ts +34 -0
  12. package/dist/esm/lowAltitude/BaseGridMvtLayer.js +122 -0
  13. package/dist/esm/lowAltitude/FlightPlanning.d.ts +27 -0
  14. package/dist/esm/lowAltitude/FlightPlanning.js +426 -0
  15. package/dist/esm/{visualization/Airspace.d.ts → lowAltitude/GridDraw.d.ts} +2 -1
  16. package/dist/esm/{visualization/Airspace.js → lowAltitude/GridDraw.js} +9 -9
  17. package/dist/esm/lowAltitude/PoiLayer.d.ts +13 -0
  18. package/dist/esm/lowAltitude/PoiLayer.js +74 -0
  19. package/dist/esm/lowAltitude/RiskEvaluation.d.ts +0 -0
  20. package/dist/esm/lowAltitude/RiskEvaluation.js +0 -0
  21. package/dist/esm/lowAltitude/VisitLayer.d.ts +26 -0
  22. package/dist/esm/lowAltitude/VisitLayer.js +180 -0
  23. package/dist/esm/map/GroundSkyBox.js +2 -2
  24. package/dist/esm/map/Map.js +10 -10
  25. package/dist/esm/plot/utils/DomUtil.js +1 -1
  26. package/dist/esm/tool/Compass.js +20 -4
  27. package/dist/esm/tool/PrimitiveCluster.js +10 -9
  28. package/dist/esm/tool/common.d.ts +1 -1
  29. package/dist/esm/tool/common.js +1 -1
  30. package/dist/esm/visualization/FrustumWithCamera.js +10 -8
  31. package/dist/umd/deeptwins-engine-3d.min.js +1 -1
  32. package/package.json +2 -2
  33. package/dist/esm/tileLayer/BarrierLayer.d.ts +0 -76
@@ -0,0 +1,74 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ import * as utils from "../tool/utils";
9
+ var PoiLayer = /*#__PURE__*/function () {
10
+ function PoiLayer(map) {
11
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12
+ _classCallCheck(this, PoiLayer);
13
+ _defineProperty(this, "_mapContext", void 0);
14
+ _defineProperty(this, "isDestroyed", false);
15
+ _defineProperty(this, "options", {});
16
+ _defineProperty(this, "poiLayer", null);
17
+ this._mapContext = map._mapContext;
18
+ this.options = options;
19
+ if (!options.poiLayer) {
20
+ utils.error('请提供poiLayer参数,可通过DeepTwins.onLoad获取');
21
+ return;
22
+ }
23
+ this._create();
24
+ }
25
+
26
+ // 是否能进行操作
27
+ _createClass(PoiLayer, [{
28
+ key: "_canOperate",
29
+ value: function _canOperate() {
30
+ if (this.isDestroyed) {
31
+ utils.error('SubmergenceAnalysis实例已销毁');
32
+ return false;
33
+ }
34
+ return true;
35
+ }
36
+ }, {
37
+ key: "getMap",
38
+ value: function getMap() {
39
+ return this._mapContext && this._mapContext.getMap();
40
+ }
41
+ }, {
42
+ key: "_create",
43
+ value: function _create() {
44
+ if (!this._canOperate()) return;
45
+ var YunJingPoiLayer = this.options.poiLayer;
46
+ var layer = new YunJingPoiLayer({
47
+ viewer: this.getMap(),
48
+ poiTileset: this.options.poiTileset,
49
+ roadTileset: this.options.roadTileset
50
+ });
51
+ this.poiLayer = this.getMap().scene.primitives.add(layer);
52
+ }
53
+ }, {
54
+ key: "show",
55
+ value: function show(isShow) {
56
+ if (!this._canOperate()) return;
57
+ if (this.poiLayer) {
58
+ this.poiLayer.show = isShow;
59
+ }
60
+ }
61
+ }, {
62
+ key: "destroy",
63
+ value: function destroy() {
64
+ if (!this._canOperate()) return;
65
+ this.isDestroyed = true;
66
+ if (this.poiLayer) {
67
+ this.getMap().scene.primitives.remove(this.poiLayer);
68
+ this.poiLayer = null;
69
+ }
70
+ }
71
+ }]);
72
+ return PoiLayer;
73
+ }();
74
+ export default PoiLayer;
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ import BaseGridMvtLayer from './BaseGridMvtLayer';
2
+ declare class VisitLayer extends BaseGridMvtLayer {
3
+ constructor(map: any, options?: any);
4
+ /**
5
+ * 创建primitives
6
+ * 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
7
+ */
8
+ private _createPrimitives;
9
+ /**
10
+ * 销毁primitives
11
+ */
12
+ private _destroyPrimitives;
13
+ /**
14
+ * 显示primitives
15
+ */
16
+ private _showPrimitives;
17
+ /**
18
+ * 隐藏primitives
19
+ */
20
+ private _hidePrimitives;
21
+ /**
22
+ * 更新primitives
23
+ */
24
+ private _updatePrimitives;
25
+ }
26
+ export default VisitLayer;
@@ -0,0 +1,180 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
14
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
15
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
17
+ import * as Cesium from 'deeptwins-cesium';
18
+ import BaseGridMvtLayer from "./BaseGridMvtLayer";
19
+
20
+ // 客流图层 - 基于MVT数据渲染网格
21
+ var VisitLayer = /*#__PURE__*/function (_BaseGridMvtLayer) {
22
+ _inherits(VisitLayer, _BaseGridMvtLayer);
23
+ var _super = _createSuper(VisitLayer);
24
+ function VisitLayer(map) {
25
+ var _this;
26
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
27
+ _classCallCheck(this, VisitLayer);
28
+ _this = _super.call(this, map, _objectSpread({
29
+ dataType: 'flow'
30
+ }, options));
31
+ _this.createMvtLayer({
32
+ createPrimitives: function createPrimitives(tileNum, renderData, viewer) {
33
+ var targetViewer = viewer || _this.getMap();
34
+ return _this._createPrimitives(tileNum, renderData, targetViewer);
35
+ },
36
+ destroyPrimitives: function destroyPrimitives(tileNum, primitives) {
37
+ return _this._destroyPrimitives(tileNum, primitives);
38
+ },
39
+ showPrimitives: function showPrimitives(tileNum, primitives) {
40
+ return _this._showPrimitives(tileNum, primitives);
41
+ },
42
+ hidePrimitives: function hidePrimitives(tileNum, primitives) {
43
+ return _this._hidePrimitives(tileNum, primitives);
44
+ },
45
+ updatePrimitives: function updatePrimitives(tileNum, primitives) {
46
+ return _this._updatePrimitives(tileNum, primitives);
47
+ }
48
+ });
49
+ return _this;
50
+ }
51
+
52
+ /**
53
+ * 创建primitives
54
+ * 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
55
+ */
56
+ _createClass(VisitLayer, [{
57
+ key: "_createPrimitives",
58
+ value: function _createPrimitives(tileNum, renderData, viewer) {
59
+ if (!this._isViewerReady()) {
60
+ return [];
61
+ }
62
+ var heightColors = this.options.heightColors;
63
+ var features = (renderData === null || renderData === void 0 ? void 0 : renderData.default) || [];
64
+ var instances = [];
65
+ for (var i = 0; i < features.length; i++) {
66
+ var _feature$properties;
67
+ var feature = features[i];
68
+ if (!feature || !feature.lnglat || !feature.gridSize) {
69
+ continue;
70
+ }
71
+ if (!this._isViewerReady()) {
72
+ return [];
73
+ }
74
+ var lnglat = [feature.lnglat[0], feature.lnglat[1], 100];
75
+ var modelMatrix = Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(lnglat[0], lnglat[1], lnglat[2])), new Cesium.Cartesian3(0, 0, 0), new Cesium.Matrix4());
76
+ var flowValue = ((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.flow) || 0;
77
+ var colorIndex = Math.floor(flowValue / 150);
78
+ var color = heightColors[colorIndex] || '#d8daeb';
79
+ var instance = new Cesium.GeometryInstance({
80
+ geometry: Cesium.BoxGeometry.fromDimensions({
81
+ vertexFormat: Cesium.VertexFormat.POSITION_AND_NORMAL,
82
+ dimensions: new Cesium.Cartesian3(feature.gridSize[0], feature.gridSize[1], feature.gridSize[1])
83
+ }),
84
+ modelMatrix: modelMatrix,
85
+ attributes: {
86
+ color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromCssColorString(color))
87
+ }
88
+ });
89
+ instances.push(instance);
90
+ }
91
+ if (!this._isViewerReady() || instances.length === 0) {
92
+ return [];
93
+ }
94
+ var primitive = new Cesium.Primitive({
95
+ geometryInstances: instances,
96
+ appearance: new Cesium.PerInstanceColorAppearance({
97
+ translucent: false,
98
+ closed: true
99
+ })
100
+ });
101
+ if (this._isViewerReady()) {
102
+ viewer.scene.primitives.add(primitive);
103
+ }
104
+ return [primitive];
105
+ }
106
+
107
+ /**
108
+ * 销毁primitives
109
+ */
110
+ }, {
111
+ key: "_destroyPrimitives",
112
+ value: function _destroyPrimitives(tileNum, primitives) {
113
+ var _this2 = this;
114
+ if (!(primitives !== null && primitives !== void 0 && primitives.length)) return;
115
+ primitives.forEach(function (primitive) {
116
+ if (!primitive) {
117
+ return;
118
+ }
119
+ try {
120
+ primitive.show = false;
121
+ if (_this2._isViewerReady()) {
122
+ var isDestroyed = typeof primitive.isDestroyed === 'function' ? primitive.isDestroyed() : false;
123
+ if (!isDestroyed) {
124
+ _this2.getMap().scene.primitives.remove(primitive);
125
+ }
126
+ if (typeof primitive.destroy === 'function' && !isDestroyed) {
127
+ primitive.destroy();
128
+ }
129
+ }
130
+ } catch (error) {
131
+ console.warn('销毁 primitive 失败', error);
132
+ }
133
+ });
134
+ primitives.length = 0;
135
+ }
136
+
137
+ /**
138
+ * 显示primitives
139
+ */
140
+ }, {
141
+ key: "_showPrimitives",
142
+ value: function _showPrimitives(tileNum, primitives) {
143
+ if (!(primitives !== null && primitives !== void 0 && primitives.length)) {
144
+ return;
145
+ }
146
+ primitives.forEach(function (primitive) {
147
+ if (primitive && typeof primitive.isDestroyed === 'function' && !primitive.isDestroyed()) {
148
+ primitive.show = true;
149
+ }
150
+ });
151
+ }
152
+
153
+ /**
154
+ * 隐藏primitives
155
+ */
156
+ }, {
157
+ key: "_hidePrimitives",
158
+ value: function _hidePrimitives(tileNum, primitives) {
159
+ if (!(primitives !== null && primitives !== void 0 && primitives.length)) {
160
+ return;
161
+ }
162
+ primitives.forEach(function (primitive) {
163
+ if (primitive && typeof primitive.isDestroyed === 'function' && !primitive.isDestroyed()) {
164
+ primitive.show = false;
165
+ }
166
+ });
167
+ }
168
+
169
+ /**
170
+ * 更新primitives
171
+ */
172
+ }, {
173
+ key: "_updatePrimitives",
174
+ value: function _updatePrimitives(_tileNum, _primitives) {
175
+ // 预留接口,可根据需要实现更新逻辑
176
+ }
177
+ }]);
178
+ return VisitLayer;
179
+ }(BaseGridMvtLayer);
180
+ export default VisitLayer;
@@ -9,7 +9,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
9
9
  import * as Cesium from 'deeptwins-cesium';
10
10
  var BoxGeometry = Cesium.BoxGeometry;
11
11
  var Cartesian3 = Cesium.Cartesian3;
12
- var defaultValue = Cesium.defaultValue;
13
12
  var defined = Cesium.defined;
14
13
  var destroyObject = Cesium.destroyObject;
15
14
  var DeveloperError = Cesium.DeveloperError;
@@ -39,6 +38,7 @@ var skyboxMatrix3 = new Matrix3();
39
38
  */
40
39
  var GroundSkyBox = /*#__PURE__*/function () {
41
40
  function GroundSkyBox(options) {
41
+ var _options$show;
42
42
  _classCallCheck(this, GroundSkyBox);
43
43
  _defineProperty(this, "sources", void 0);
44
44
  _defineProperty(this, "show", true);
@@ -55,7 +55,7 @@ var GroundSkyBox = /*#__PURE__*/function () {
55
55
  }
56
56
  this.sources = options.sources;
57
57
  this._sources = undefined;
58
- this.show = defaultValue(options.show, true);
58
+ this.show = (_options$show = options.show) !== null && _options$show !== void 0 ? _options$show : true;
59
59
  this._command = new DrawCommand({
60
60
  modelMatrix: Matrix4.clone(Matrix4.IDENTITY),
61
61
  owner: this
@@ -80,11 +80,11 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
80
80
  _defineProperty(_assertThisInitialized(_this), "_event", void 0);
81
81
  // 默认的事件监听
82
82
  _defineProperty(_assertThisInitialized(_this), "_eventTrick", []);
83
- // 添加yunjing module
83
+ // 添加yunjing 模型
84
84
  _defineProperty(_assertThisInitialized(_this), "addModuleLayer", function (moduleLayer) {
85
- _this._yunjing = _this._yunjing || moduleLayer.addToMap(_assertThisInitialized(_this));
85
+ var yunjing = moduleLayer.addToMap(_assertThisInitialized(_this));
86
86
  common.removeYjIcon();
87
- return _this._yunjing;
87
+ return yunjing;
88
88
  });
89
89
  _this._mapContext = {
90
90
  getMap: _this.getMap.bind(_assertThisInitialized(_this))
@@ -244,11 +244,11 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
244
244
  !isNil(resolutionScale) && (this.resolutionScale = resolutionScale);
245
245
 
246
246
  // scene
247
- !isNil(showSun) && (this.scene.sun.show = showSun);
248
- !isNil(showMoon) && (this.scene.moon.show = showMoon);
249
- !isNil(showSkyBox) && (this.scene.skyBox.show = showSkyBox);
247
+ !isNil(showSun) && this.scene.sun && (this.scene.sun.show = showSun);
248
+ !isNil(showMoon) && this.scene.moon && (this.scene.moon.show = showMoon);
249
+ !isNil(showSkyBox) && this.scene.skyBox && (this.scene.skyBox.show = showSkyBox);
250
250
  !isNil(fog) && (this.scene.fog.enabled = fog);
251
- !isNil(skyAtmosphere) && (this.scene.skyAtmosphere.show = skyAtmosphere);
251
+ !isNil(skyAtmosphere) && this.scene.skyAtmosphere && (this.scene.skyAtmosphere.show = skyAtmosphere);
252
252
  !isNil(requestRenderMode) && (this.scene.requestRenderMode = requestRenderMode);
253
253
  if (!isNil(postProcessStages)) {
254
254
  for (var key in postProcessStages) {
@@ -307,7 +307,7 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
307
307
  value: function removeGroundSkyBox() {
308
308
  this.showGroundSkyBox = false;
309
309
  this.scene.skyBox = this._defaultSkybox;
310
- this.scene.skyAtmosphere.show = true;
310
+ this.scene.skyAtmosphere && (this.scene.skyAtmosphere.show = true);
311
311
  this.camera.changed.removeEventListener(this._handleSkyBox);
312
312
  this._handleSkyBox = null;
313
313
  }
@@ -320,10 +320,10 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
320
320
  var cameraHeight = Cesium.Cartographic.fromCartesian(position).height;
321
321
  if (cameraHeight < 240000) {
322
322
  this.scene.skyBox = skyBox;
323
- this.scene.skyAtmosphere.show = false;
323
+ this.scene.skyAtmosphere && (this.scene.skyAtmosphere.show = false);
324
324
  } else {
325
325
  this.scene.skyBox = this._defaultSkybox;
326
- this.scene.skyAtmosphere.show = true;
326
+ this.scene.skyAtmosphere && (this.scene.skyAtmosphere.show = true);
327
327
  }
328
328
  }
329
329
 
@@ -42,7 +42,7 @@ export var LabelAttributeForm = /*#__PURE__*/function () {
42
42
  }
43
43
  this._customDiv.style.top = this._winPos.y + 'px';
44
44
  this._customDiv.style.left = this._winPos.x + 'px';
45
- this._customDiv.innerHTML = " \n <div>\n <span class=\"title\">\u5BF9\u8C61\u7F16\u53F7\uFF1A</span>\n <span>".concat(this._id, "</span>\n </div>\n <div>\n <span class=\"title\">\u6587\u5B57\u6807\u7B7E\uFF1A</span>\n <input type=\"text\" id=\"text-value\" value=\"").concat(this._text, "\" />\n </div>\n <div>\n <span class=\"title\">\u7ECF\u7EAC\u5750\u6807\uFF1A</span>\n <input type=\"text\" id=\"coor-xy\" value=\"").concat(this._coord.x, ",").concat(this._coord.y, "\" />\n </div>\n <div>\n <span class=\"title\">\u5B57\u4F53\u5927\u5C0F\uFF1A</span>\n <input type=\"number\" id=\"font-size\" value=\"").concat(this._size, "\" />\n </div>\n <div class=\"label-ar-tool-box\">\n <button id=\"label_edit_ok\">\u786E\u8BA4</button>\n <button id=\"label_edit_no\">\u53D6\u6D88</button>\n </div>");
45
+ this._customDiv.innerHTML = "\n <div>\n <span class=\"title\">\u5BF9\u8C61\u7F16\u53F7\uFF1A</span>\n <span>".concat(this._id, "</span>\n </div>\n <div>\n <span class=\"title\">\u6587\u5B57\u6807\u7B7E\uFF1A</span>\n <input type=\"text\" id=\"text-value\" value=\"").concat(this._text, "\" />\n </div>\n <div>\n <span class=\"title\">\u7ECF\u7EAC\u5750\u6807\uFF1A</span>\n <input type=\"text\" id=\"coor-xy\" value=\"").concat(this._coord.x, ",").concat(this._coord.y, "\" />\n </div>\n <div>\n <span class=\"title\">\u5B57\u4F53\u5927\u5C0F\uFF1A</span>\n <input type=\"number\" id=\"font-size\" value=\"").concat(this._size, "\" />\n </div>\n <div class=\"label-ar-tool-box\">\n <button id=\"label_edit_ok\">\u786E\u8BA4</button>\n <button id=\"label_edit_no\">\u53D6\u6D88</button>\n </div>");
46
46
  this.initEvent();
47
47
  }
48
48
  }, {
@@ -66,12 +66,16 @@ var Compass = /*#__PURE__*/function () {
66
66
  var leftDirection = document.createElement('img');
67
67
  leftDirection.className = 'deeptwins-compass-left-direction';
68
68
  var leftDirectionImg = getDeepTwinsFile('Image/compass/compass-direction-left.png');
69
+ var leftDirectionActiveImg = getDeepTwinsFile('Image/compass/compass-direction-left-active.png');
69
70
  leftDirection.src = leftDirectionImg;
70
71
  el.appendChild(leftDirection);
71
72
 
72
73
  // 左箭头持续旋转
74
+ leftDirection.onmouseenter = function () {
75
+ leftDirection.src = leftDirectionActiveImg;
76
+ };
73
77
  leftDirection.onmousedown = function () {
74
- leftDirection.src = getDeepTwinsFile('Image/compass/compass-direction-left-active.png');
78
+ leftDirection.src = leftDirectionActiveImg;
75
79
  _this2._startContinuousRotation(1);
76
80
  };
77
81
  leftDirection.onmouseup = function () {
@@ -91,11 +95,15 @@ var Compass = /*#__PURE__*/function () {
91
95
  var rightDirection = document.createElement('img');
92
96
  rightDirection.className = 'deeptwins-compass-right-direction';
93
97
  var rightDirectionImg = getDeepTwinsFile('Image/compass/compass-direction-right.png');
98
+ var rightDirectionActiveImg = getDeepTwinsFile('Image/compass/compass-direction-right-active.png');
94
99
  rightDirection.src = rightDirectionImg;
95
100
  el.appendChild(rightDirection);
96
101
  // 右箭头持续旋转
102
+ rightDirection.onmouseenter = function () {
103
+ rightDirection.src = rightDirectionActiveImg;
104
+ };
97
105
  rightDirection.onmousedown = function () {
98
- rightDirection.src = getDeepTwinsFile('Image/compass/compass-direction-right-active.png');
106
+ rightDirection.src = rightDirectionActiveImg;
99
107
  _this2._startContinuousRotation(-1);
100
108
  };
101
109
  rightDirection.onmouseup = function () {
@@ -110,10 +118,14 @@ var Compass = /*#__PURE__*/function () {
110
118
  var pitchUp = document.createElement('img');
111
119
  pitchUp.className = 'deeptwins-compass-pitch-up';
112
120
  var pitchUpImg = getDeepTwinsFile('Image/compass/compass-pitch-up.png');
121
+ var pitchUpActiveImg = getDeepTwinsFile('Image/compass/compass-pitch-up-active.png');
113
122
  pitchUp.src = pitchUpImg;
114
123
  el.appendChild(pitchUp);
124
+ pitchUp.onmouseenter = function () {
125
+ pitchUp.src = pitchUpActiveImg;
126
+ };
115
127
  pitchUp.onmousedown = function () {
116
- pitchUp.src = getDeepTwinsFile('Image/compass/compass-pitch-up-active.png');
128
+ pitchUp.src = pitchUpActiveImg;
117
129
  _this2._startContinuousPitch(1);
118
130
  };
119
131
  pitchUp.onmouseup = function () {
@@ -128,10 +140,14 @@ var Compass = /*#__PURE__*/function () {
128
140
  var pitchDown = document.createElement('img');
129
141
  pitchDown.className = 'deeptwins-compass-pitch-down';
130
142
  var pitchDownImg = getDeepTwinsFile('Image/compass/compass-pitch-down.png');
143
+ var pitchDownActiveImg = getDeepTwinsFile('Image/compass/compass-pitch-down-active.png');
131
144
  pitchDown.src = pitchDownImg;
132
145
  el.appendChild(pitchDown);
146
+ pitchDown.onmouseenter = function () {
147
+ pitchDown.src = pitchDownActiveImg;
148
+ };
133
149
  pitchDown.onmousedown = function () {
134
- pitchDown.src = getDeepTwinsFile('Image/compass/compass-pitch-down-active.png');
150
+ pitchDown.src = pitchDownActiveImg;
135
151
  _this2._startContinuousPitch(-1);
136
152
  };
137
153
  pitchDown.onmouseup = function () {
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import * as Cesium from 'deeptwins-cesium';
3
- import { Billboard, BillboardCollection, BoundingRectangle, Cartesian2, Cartesian3, defaultValue, defined, Event, Label, LabelCollection, Matrix4, PointPrimitive, PointPrimitiveCollection, SceneMode } from 'deeptwins-cesium';
3
+ import { Billboard, BillboardCollection, BoundingRectangle, Cartesian2, Cartesian3, defined, Event, Label, LabelCollection, Matrix4, PointPrimitive, PointPrimitiveCollection, SceneMode } from 'deeptwins-cesium';
4
4
  import KDBush from 'kdbush';
5
5
 
6
6
  /**
@@ -21,13 +21,14 @@ import KDBush from 'kdbush';
21
21
  * @demo {@link https://sandcastle.cesium.com/index.html?src=Clustering.html|Cesium Sandcastle Clustering Demo}
22
22
  */
23
23
  function PrimitiveCluster(options) {
24
- options = defaultValue(options, defaultValue.EMPTY_OBJECT);
25
- this._enabled = defaultValue(options.enabled, false);
26
- this._pixelRange = defaultValue(options.pixelRange, 80);
27
- this._minimumClusterSize = defaultValue(options.minimumClusterSize, 2);
28
- this._clusterBillboards = defaultValue(options.clusterBillboards, true);
29
- this._clusterLabels = defaultValue(options.clusterLabels, true);
30
- this._clusterPoints = defaultValue(options.clusterPoints, true);
24
+ var _options, _options$enabled, _options$pixelRange, _options$minimumClust, _options$clusterBillb, _options$clusterLabel, _options$clusterPoint, _options$show;
25
+ options = (_options = options) !== null && _options !== void 0 ? _options : {};
26
+ this._enabled = (_options$enabled = options.enabled) !== null && _options$enabled !== void 0 ? _options$enabled : false;
27
+ this._pixelRange = (_options$pixelRange = options.pixelRange) !== null && _options$pixelRange !== void 0 ? _options$pixelRange : 80;
28
+ this._minimumClusterSize = (_options$minimumClust = options.minimumClusterSize) !== null && _options$minimumClust !== void 0 ? _options$minimumClust : 2;
29
+ this._clusterBillboards = (_options$clusterBillb = options.clusterBillboards) !== null && _options$clusterBillb !== void 0 ? _options$clusterBillb : true;
30
+ this._clusterLabels = (_options$clusterLabel = options.clusterLabels) !== null && _options$clusterLabel !== void 0 ? _options$clusterLabel : true;
31
+ this._clusterPoints = (_options$clusterPoint = options.clusterPoints) !== null && _options$clusterPoint !== void 0 ? _options$clusterPoint : true;
31
32
  this._labelCollection = undefined;
32
33
  this._billboardCollection = undefined;
33
34
  this._pointCollection = undefined;
@@ -52,7 +53,7 @@ function PrimitiveCluster(options) {
52
53
  * @type {boolean}
53
54
  * @default true
54
55
  */
55
- this.show = defaultValue(options.show, true);
56
+ this.show = (_options$show = options.show) !== null && _options$show !== void 0 ? _options$show : true;
56
57
  }
57
58
  function expandBoundingBox(bbox, pixelRange) {
58
59
  bbox.x -= pixelRange;
@@ -17,7 +17,7 @@ export declare const lineClampToGroundSplit: ({ map, pos1, pos2, splitNum, }: {
17
17
  */
18
18
  export declare const findWindowPositionByPixelInterval: (startPosition: Cartesian2, endPosition: Cartesian2, interval: number) => Cartesian2;
19
19
  export declare class ShapeSection {
20
- static circleSection(radius: number): Cesium.Cartesian2[];
20
+ static circleSection(radius: number, segments?: number): Cesium.Cartesian2[];
21
21
  static rectangleSection(width: number, height: number): Cesium.Cartesian2[];
22
22
  static triangleSection(base: number, height: number): Cesium.Cartesian2[];
23
23
  }
@@ -81,8 +81,8 @@ export var ShapeSection = /*#__PURE__*/function () {
81
81
  value:
82
82
  // 圆形截面(单位米)
83
83
  function circleSection(radius) {
84
+ var segments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 360;
84
85
  var shape = [];
85
- var segments = 360;
86
86
  for (var i = 0; i < segments; i++) {
87
87
  var angle = i / segments * Math.PI * 2; // 角度
88
88
  shape.push(new Cesium.Cartesian2(Math.cos(angle) * radius, Math.sin(angle) * radius));
@@ -52,7 +52,9 @@ var FrustumWithCamera = /*#__PURE__*/function (_BaseFrustum) {
52
52
  _this$options$outline = _this$options.outline,
53
53
  outline = _this$options$outline === void 0 ? true : _this$options$outline,
54
54
  _this$options$outline2 = _this$options.outlineColor,
55
- outlineColor = _this$options$outline2 === void 0 ? '#ffffff' : _this$options$outline2;
55
+ outlineColor = _this$options$outline2 === void 0 ? '#ffffff' : _this$options$outline2,
56
+ _this$options$camera = _this$options.camera,
57
+ camera = _this$options$camera === void 0 ? this.getMap().camera : _this$options$camera;
56
58
  var _position = _slicedToArray(position, 3),
57
59
  lng = _position[0],
58
60
  lat = _position[1],
@@ -60,19 +62,19 @@ var FrustumWithCamera = /*#__PURE__*/function (_BaseFrustum) {
60
62
  var positionCartesian3 = utils.lngLatAltToCartesian3(lng, lat, alt);
61
63
  var frustum = new Cesium.PerspectiveFrustum({
62
64
  // 查看的视场角,绕Z轴旋转,以弧度方式输入
63
- fov: fov ? utils.toRadians(fov) : this.getMap().camera.frustum.fov,
65
+ fov: fov ? utils.toRadians(fov) : camera.frustum.fov,
64
66
  // 视锥体的宽度/高度
65
- aspectRatio: aspectRatio ? aspectRatio : this.getMap().camera.frustum.aspectRatio,
67
+ aspectRatio: aspectRatio ? aspectRatio : camera.frustum.aspectRatio,
66
68
  // 近面距视点的距离
67
- near: near ? near : this.getMap().camera.frustum.near,
69
+ near: near ? near : camera.frustum.near,
68
70
  // 远面距视点的距离
69
- far: far ? far : this.getMap().camera.frustum.far
71
+ far: far ? far : camera.frustum.far
70
72
  });
71
73
 
72
74
  // 计算摄像机的方向四元数
73
- var direction = Cesium.Cartesian3.clone(this.getMap().camera.directionWC);
74
- var up = Cesium.Cartesian3.clone(this.getMap().camera.upWC);
75
- var right = Cesium.Cartesian3.clone(this.getMap().camera.rightWC);
75
+ var direction = Cesium.Cartesian3.clone(camera.directionWC);
76
+ var up = Cesium.Cartesian3.clone(camera.upWC);
77
+ var right = Cesium.Cartesian3.clone(camera.rightWC);
76
78
  var rotationMatrix = new Cesium.Matrix3();
77
79
  Cesium.Matrix3.setColumn(rotationMatrix, 0, right, rotationMatrix); // X 轴
78
80
  Cesium.Matrix3.setColumn(rotationMatrix, 1, up, rotationMatrix); // Y 轴