deeptwins-engine-3d 0.1.41 → 0.1.42

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.
@@ -18,7 +18,7 @@ export declare const MULTI_POINT_SHAPE_TYPES: {
18
18
  readonly POLYLINE: "polyline";
19
19
  readonly POLYGON: "polygon";
20
20
  };
21
- export declare const MULTI_POINT_SHAPES: ("polygon" | "polyline")[];
21
+ export declare const MULTI_POINT_SHAPES: ("polyline" | "polygon")[];
22
22
  declare class Drawer implements DrawContext {
23
23
  private readonly _mapContext;
24
24
  private readonly _drawContext;
@@ -65,5 +65,6 @@ export declare class DeepTwinsEngine3D {
65
65
  static SunLightAnalysis: any;
66
66
  static KmlDataSource: any;
67
67
  static Compass: any;
68
+ static ViewshedAnalysis: any;
68
69
  }
69
70
  export default DeepTwinsEngine3D;
package/dist/esm/index.js CHANGED
@@ -9,7 +9,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
9
9
  import * as Cesium from 'deeptwins-cesium';
10
10
  import SubmergenceAnalysis from "./analyze/SubmergenceAnalysis";
11
11
  import SunLightAnalysis from "./analyze/SunLightAnalysis";
12
- // import ViewshedAnalysis from './analyze/ViewshedAnalysis';
12
+ import ViewshedAnalysis from "./analyze/ViewshedAnalysis";
13
13
  import ModelRoamHistory from "./cameraControl/ModelRoamHistory";
14
14
  import ModelRoamRealTime from "./cameraControl/ModelRoamRealTime";
15
15
  import Roam from "./cameraControl/Roam";
@@ -54,11 +54,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
54
54
  // 全局加载css
55
55
  loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
56
56
  // 打印版本信息
57
- console.log('DeepTwinsEngine3D Version:', "0.1.41");
57
+ console.log('DeepTwinsEngine3D Version:', "0.1.42");
58
58
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
59
59
  _classCallCheck(this, DeepTwinsEngine3D);
60
60
  });
61
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.41");
61
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.42");
62
62
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
63
63
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
64
64
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -123,4 +123,5 @@ _defineProperty(DeepTwinsEngine3D, "SubmergenceAnalysis", SubmergenceAnalysis);
123
123
  _defineProperty(DeepTwinsEngine3D, "SunLightAnalysis", SunLightAnalysis);
124
124
  _defineProperty(DeepTwinsEngine3D, "KmlDataSource", Cesium.KmlDataSource);
125
125
  _defineProperty(DeepTwinsEngine3D, "Compass", Compass);
126
+ _defineProperty(DeepTwinsEngine3D, "ViewshedAnalysis", ViewshedAnalysis);
126
127
  export default DeepTwinsEngine3D;
@@ -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
@@ -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;