deeptwins-engine-3d 0.1.40 → 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.
- package/dist/assets/Build/DeepTwins/Image/compass/compass-direction-left-active.png +0 -0
- package/dist/assets/Build/DeepTwins/Image/compass/compass-direction-right-active.png +0 -0
- package/dist/assets/Build/DeepTwins/Image/compass/compass-pitch-down-active.png +0 -0
- package/dist/assets/Build/DeepTwins/Image/compass/compass-pitch-up-active.png +0 -0
- package/dist/assets/Build/DeepTwins/Image/compass/pointer-white.png +0 -0
- package/dist/esm/analyze/ViewshedAnalysis.d.ts +28 -0
- package/dist/esm/analyze/ViewshedAnalysis.js +305 -0
- package/dist/esm/constant.d.ts +14 -1
- package/dist/esm/constant.js +25 -1
- package/dist/esm/deepTwins/index.js +0 -1
- package/dist/esm/drawer/index.d.ts +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/map/GroundSkyBox.js +2 -2
- package/dist/esm/map/Map.d.ts +0 -2
- package/dist/esm/map/Map.js +10 -28
- package/dist/esm/plot/utils/DomUtil.js +1 -1
- package/dist/esm/tileLayer/BarrierLayer.d.ts +6 -3
- package/dist/esm/tileLayer/BarrierLayer.js +30 -13
- package/dist/esm/tool/Compass.js +36 -4
- package/dist/esm/tool/PrimitiveCluster.js +10 -9
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +2 -2
|
@@ -14,6 +14,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
14
14
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
15
|
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); }
|
|
16
16
|
import * as Cesium from 'deeptwins-cesium';
|
|
17
|
+
import * as utils from "../tool/utils";
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* 障碍物图层 - 基于MVT数据渲染障碍物网格
|
|
@@ -32,7 +33,7 @@ import * as Cesium from 'deeptwins-cesium';
|
|
|
32
33
|
var BarrierLayer = /*#__PURE__*/function () {
|
|
33
34
|
/**
|
|
34
35
|
* 创建障碍物图层
|
|
35
|
-
* @param
|
|
36
|
+
* @param map Cesium Viewer实例
|
|
36
37
|
* @param options 配置选项
|
|
37
38
|
* @param options.gridVTLayer GridVTLayer类(从DeepTwins.onLoad中获取)
|
|
38
39
|
* @param options.url MVT数据URL模板,默认为障碍物数据地址
|
|
@@ -44,15 +45,16 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
44
45
|
* @param options.minHeight 最小高度(米),低于此高度的障碍物不渲染,默认0
|
|
45
46
|
* @param options.maxHeight 最大高度(米),高于此高度的障碍物不渲染,默认Infinity
|
|
46
47
|
*/
|
|
47
|
-
function BarrierLayer(
|
|
48
|
+
function BarrierLayer(map) {
|
|
48
49
|
var _this = this;
|
|
49
50
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
50
51
|
_classCallCheck(this, BarrierLayer);
|
|
52
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
53
|
+
_defineProperty(this, "isDestroyed", false);
|
|
51
54
|
_defineProperty(this, "_gridVTLayer", null);
|
|
52
|
-
_defineProperty(this, "_viewer", null);
|
|
53
55
|
_defineProperty(this, "_options", {});
|
|
54
56
|
_defineProperty(this, "_heightColors", []);
|
|
55
|
-
this.
|
|
57
|
+
this._mapContext = map._mapContext;
|
|
56
58
|
if (!options.gridVTLayer) {
|
|
57
59
|
console.error('BarrierLayer: 请提供gridVTLayer参数,可通过DeepTwins.onLoad获取');
|
|
58
60
|
return;
|
|
@@ -85,7 +87,7 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
85
87
|
// 创建 GridVTLayer
|
|
86
88
|
var customPrimitiveCallbacks = {
|
|
87
89
|
createPrimitives: function createPrimitives(tileNum, renderData, viewer) {
|
|
88
|
-
var targetViewer = viewer || _this.
|
|
90
|
+
var targetViewer = viewer || _this.getMap();
|
|
89
91
|
return _this._createPrimitives(tileNum, renderData, targetViewer);
|
|
90
92
|
},
|
|
91
93
|
destroyPrimitives: function destroyPrimitives(tileNum, primitives) {
|
|
@@ -102,7 +104,7 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
106
|
this._gridVTLayer = new GridVTLayer({
|
|
105
|
-
viewer: this.
|
|
107
|
+
viewer: this.getMap(),
|
|
106
108
|
url: this._options.url,
|
|
107
109
|
cacheSize: this._options.cacheSize,
|
|
108
110
|
dataZooms: this._options.dataZooms,
|
|
@@ -119,11 +121,27 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
* 创建primitives
|
|
124
|
-
* 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
|
|
125
|
-
*/
|
|
124
|
+
// 是否能进行操作
|
|
126
125
|
_createClass(BarrierLayer, [{
|
|
126
|
+
key: "_canOperate",
|
|
127
|
+
value: function _canOperate() {
|
|
128
|
+
if (this.isDestroyed) {
|
|
129
|
+
utils.error('SubmergenceAnalysis实例已销毁');
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "getMap",
|
|
136
|
+
value: function getMap() {
|
|
137
|
+
return this._mapContext && this._mapContext.getMap();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 创建primitives
|
|
142
|
+
* 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
|
|
143
|
+
*/
|
|
144
|
+
}, {
|
|
127
145
|
key: "_createPrimitives",
|
|
128
146
|
value: function _createPrimitives(tileNum, renderData, viewer) {
|
|
129
147
|
var features = (renderData === null || renderData === void 0 ? void 0 : renderData.default) || [];
|
|
@@ -169,7 +187,7 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
169
187
|
closed: true
|
|
170
188
|
})
|
|
171
189
|
});
|
|
172
|
-
var targetViewer = viewer || this.
|
|
190
|
+
var targetViewer = viewer || this.getMap();
|
|
173
191
|
targetViewer.scene.primitives.add(primitive);
|
|
174
192
|
primitives.push(primitive);
|
|
175
193
|
}
|
|
@@ -186,8 +204,7 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
186
204
|
if (!(primitives !== null && primitives !== void 0 && primitives.length)) return;
|
|
187
205
|
primitives.forEach(function (primitive) {
|
|
188
206
|
primitive.show = false;
|
|
189
|
-
_this2.
|
|
190
|
-
primitive.destroy();
|
|
207
|
+
_this2.getMap().scene.primitives.remove(primitive);
|
|
191
208
|
});
|
|
192
209
|
primitives.length = 0;
|
|
193
210
|
}
|
package/dist/esm/tool/Compass.js
CHANGED
|
@@ -65,17 +65,25 @@ var Compass = /*#__PURE__*/function () {
|
|
|
65
65
|
el.appendChild(bg);
|
|
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');
|
|
70
|
+
leftDirection.src = leftDirectionImg;
|
|
69
71
|
el.appendChild(leftDirection);
|
|
70
72
|
|
|
71
73
|
// 左箭头持续旋转
|
|
74
|
+
leftDirection.onmouseenter = function () {
|
|
75
|
+
leftDirection.src = leftDirectionActiveImg;
|
|
76
|
+
};
|
|
72
77
|
leftDirection.onmousedown = function () {
|
|
78
|
+
leftDirection.src = leftDirectionActiveImg;
|
|
73
79
|
_this2._startContinuousRotation(1);
|
|
74
80
|
};
|
|
75
81
|
leftDirection.onmouseup = function () {
|
|
82
|
+
leftDirection.src = leftDirectionImg;
|
|
76
83
|
_this2._stopContinuousRotation();
|
|
77
84
|
};
|
|
78
85
|
leftDirection.onmouseleave = function () {
|
|
86
|
+
leftDirection.src = leftDirectionImg;
|
|
79
87
|
_this2._stopContinuousRotation();
|
|
80
88
|
};
|
|
81
89
|
this.compassEl.leftDirection = leftDirection;
|
|
@@ -86,44 +94,68 @@ var Compass = /*#__PURE__*/function () {
|
|
|
86
94
|
this.compassEl.pointer = pointer;
|
|
87
95
|
var rightDirection = document.createElement('img');
|
|
88
96
|
rightDirection.className = 'deeptwins-compass-right-direction';
|
|
89
|
-
|
|
97
|
+
var rightDirectionImg = getDeepTwinsFile('Image/compass/compass-direction-right.png');
|
|
98
|
+
var rightDirectionActiveImg = getDeepTwinsFile('Image/compass/compass-direction-right-active.png');
|
|
99
|
+
rightDirection.src = rightDirectionImg;
|
|
90
100
|
el.appendChild(rightDirection);
|
|
91
101
|
// 右箭头持续旋转
|
|
102
|
+
rightDirection.onmouseenter = function () {
|
|
103
|
+
rightDirection.src = rightDirectionActiveImg;
|
|
104
|
+
};
|
|
92
105
|
rightDirection.onmousedown = function () {
|
|
106
|
+
rightDirection.src = rightDirectionActiveImg;
|
|
93
107
|
_this2._startContinuousRotation(-1);
|
|
94
108
|
};
|
|
95
109
|
rightDirection.onmouseup = function () {
|
|
110
|
+
rightDirection.src = rightDirectionImg;
|
|
96
111
|
_this2._stopContinuousRotation();
|
|
97
112
|
};
|
|
98
113
|
rightDirection.onmouseleave = function () {
|
|
114
|
+
rightDirection.src = rightDirectionImg;
|
|
99
115
|
_this2._stopContinuousRotation();
|
|
100
116
|
};
|
|
101
117
|
this.compassEl.rightDirection = rightDirection;
|
|
102
118
|
var pitchUp = document.createElement('img');
|
|
103
119
|
pitchUp.className = 'deeptwins-compass-pitch-up';
|
|
104
|
-
|
|
120
|
+
var pitchUpImg = getDeepTwinsFile('Image/compass/compass-pitch-up.png');
|
|
121
|
+
var pitchUpActiveImg = getDeepTwinsFile('Image/compass/compass-pitch-up-active.png');
|
|
122
|
+
pitchUp.src = pitchUpImg;
|
|
105
123
|
el.appendChild(pitchUp);
|
|
124
|
+
pitchUp.onmouseenter = function () {
|
|
125
|
+
pitchUp.src = pitchUpActiveImg;
|
|
126
|
+
};
|
|
106
127
|
pitchUp.onmousedown = function () {
|
|
128
|
+
pitchUp.src = pitchUpActiveImg;
|
|
107
129
|
_this2._startContinuousPitch(1);
|
|
108
130
|
};
|
|
109
131
|
pitchUp.onmouseup = function () {
|
|
132
|
+
pitchUp.src = pitchUpImg;
|
|
110
133
|
_this2._stopContinuousPitch();
|
|
111
134
|
};
|
|
112
135
|
pitchUp.onmouseleave = function () {
|
|
136
|
+
pitchUp.src = pitchUpImg;
|
|
113
137
|
_this2._stopContinuousPitch();
|
|
114
138
|
};
|
|
115
139
|
this.compassEl.pitchUp = pitchUp;
|
|
116
140
|
var pitchDown = document.createElement('img');
|
|
117
141
|
pitchDown.className = 'deeptwins-compass-pitch-down';
|
|
118
|
-
|
|
142
|
+
var pitchDownImg = getDeepTwinsFile('Image/compass/compass-pitch-down.png');
|
|
143
|
+
var pitchDownActiveImg = getDeepTwinsFile('Image/compass/compass-pitch-down-active.png');
|
|
144
|
+
pitchDown.src = pitchDownImg;
|
|
119
145
|
el.appendChild(pitchDown);
|
|
146
|
+
pitchDown.onmouseenter = function () {
|
|
147
|
+
pitchDown.src = pitchDownActiveImg;
|
|
148
|
+
};
|
|
120
149
|
pitchDown.onmousedown = function () {
|
|
150
|
+
pitchDown.src = pitchDownActiveImg;
|
|
121
151
|
_this2._startContinuousPitch(-1);
|
|
122
152
|
};
|
|
123
153
|
pitchDown.onmouseup = function () {
|
|
154
|
+
pitchDown.src = pitchDownImg;
|
|
124
155
|
_this2._stopContinuousPitch();
|
|
125
156
|
};
|
|
126
157
|
pitchDown.onmouseleave = function () {
|
|
158
|
+
pitchDown.src = pitchDownImg;
|
|
127
159
|
_this2._stopContinuousPitch();
|
|
128
160
|
};
|
|
129
161
|
this.compassEl.pitchDown = pitchDown;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as Cesium from 'deeptwins-cesium';
|
|
3
|
-
import { Billboard, BillboardCollection, BoundingRectangle, Cartesian2, Cartesian3,
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
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 =
|
|
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;
|