deeptwins-engine-3d 0.1.33 → 0.1.34
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/esm/analyze/SubmergenceAnalysis.d.ts +19 -0
- package/dist/esm/analyze/SubmergenceAnalysis.js +137 -0
- package/dist/esm/constant.d.ts +8 -0
- package/dist/esm/constant.js +17 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +4 -2
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare class SubmergenceAnalysis {
|
|
2
|
+
private readonly _mapContext;
|
|
3
|
+
options: any;
|
|
4
|
+
isDestroyed: boolean;
|
|
5
|
+
extent: any;
|
|
6
|
+
private _layer;
|
|
7
|
+
private _timer;
|
|
8
|
+
private _currWaterHeight;
|
|
9
|
+
constructor(map: any, extent: any, options?: any);
|
|
10
|
+
private _canOperate;
|
|
11
|
+
getMap(): any;
|
|
12
|
+
private _createEntity;
|
|
13
|
+
flyTo(): void;
|
|
14
|
+
start(): void;
|
|
15
|
+
pause(): void;
|
|
16
|
+
stop(): void;
|
|
17
|
+
private destroy;
|
|
18
|
+
}
|
|
19
|
+
export default SubmergenceAnalysis;
|
|
@@ -0,0 +1,137 @@
|
|
|
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 Cesium from 'deeptwins-cesium';
|
|
9
|
+
import { merge } from 'lodash';
|
|
10
|
+
import { DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS } from "../constant";
|
|
11
|
+
import TimerInterval from "../tool/TimerInterval";
|
|
12
|
+
import * as utils from "../tool/utils";
|
|
13
|
+
|
|
14
|
+
// 淹没分析
|
|
15
|
+
var SubmergenceAnalysis = /*#__PURE__*/function () {
|
|
16
|
+
function SubmergenceAnalysis(map, extent) {
|
|
17
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
18
|
+
_classCallCheck(this, SubmergenceAnalysis);
|
|
19
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
20
|
+
_defineProperty(this, "options", void 0);
|
|
21
|
+
_defineProperty(this, "isDestroyed", false);
|
|
22
|
+
_defineProperty(this, "extent", void 0);
|
|
23
|
+
// 范围 geojson类型
|
|
24
|
+
_defineProperty(this, "_layer", void 0);
|
|
25
|
+
_defineProperty(this, "_timer", void 0);
|
|
26
|
+
_defineProperty(this, "_currWaterHeight", void 0);
|
|
27
|
+
this._mapContext = map._mapContext;
|
|
28
|
+
this.extent = extent;
|
|
29
|
+
this.options = merge(DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS(), options);
|
|
30
|
+
this._currWaterHeight = this.options.waterHeight;
|
|
31
|
+
this._createEntity();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 是否能进行操作
|
|
35
|
+
_createClass(SubmergenceAnalysis, [{
|
|
36
|
+
key: "_canOperate",
|
|
37
|
+
value: function _canOperate() {
|
|
38
|
+
if (this.isDestroyed) {
|
|
39
|
+
utils.error('Drawer实例已销毁');
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: "getMap",
|
|
46
|
+
value: function getMap() {
|
|
47
|
+
return this._mapContext && this._mapContext.getMap();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//创建淹没实体
|
|
51
|
+
}, {
|
|
52
|
+
key: "_createEntity",
|
|
53
|
+
value: function _createEntity() {
|
|
54
|
+
var _this = this;
|
|
55
|
+
if (!this._canOperate()) return;
|
|
56
|
+
this._layer = this.getMap().addGraphicLayer(this.extent, {
|
|
57
|
+
type: 'polygon',
|
|
58
|
+
style: {
|
|
59
|
+
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
60
|
+
perPositionHeight: false,
|
|
61
|
+
material: this.options.color,
|
|
62
|
+
extrudedHeight: new Cesium.CallbackProperty(function () {
|
|
63
|
+
return _this._currWaterHeight;
|
|
64
|
+
}, false)
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "flyTo",
|
|
70
|
+
value: function flyTo() {
|
|
71
|
+
if (!this._canOperate()) return;
|
|
72
|
+
this._layer && this._layer.flyTo();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//开始
|
|
76
|
+
}, {
|
|
77
|
+
key: "start",
|
|
78
|
+
value: function start() {
|
|
79
|
+
var _this2 = this;
|
|
80
|
+
if (!this._canOperate()) return;
|
|
81
|
+
this._timer = new TimerInterval(function () {
|
|
82
|
+
var sp = _this2.options.speed / 50;
|
|
83
|
+
if (_this2.options.changeType == 'up') {
|
|
84
|
+
_this2._currWaterHeight += sp;
|
|
85
|
+
if (_this2._currWaterHeight > _this2.options.targetHeight) {
|
|
86
|
+
_this2._currWaterHeight = _this2.options.targetHeight; //给个最大值
|
|
87
|
+
window.clearInterval(_this2._timer);
|
|
88
|
+
_this2.options.onComplete && _this2.options.onComplete();
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
_this2._currWaterHeight -= sp;
|
|
92
|
+
if (_this2._currWaterHeight < _this2.options.targetHeight) {
|
|
93
|
+
_this2._currWaterHeight = _this2.options.targetHeight; //给个最大值
|
|
94
|
+
window.clearInterval(_this2._timer);
|
|
95
|
+
_this2.options.onComplete && _this2.options.onComplete();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
_this2.options.onChange && _this2.options.onChange(_this2._currWaterHeight);
|
|
99
|
+
}, 20);
|
|
100
|
+
this._timer.start(true);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// 暂停
|
|
104
|
+
}, {
|
|
105
|
+
key: "pause",
|
|
106
|
+
value: function pause() {
|
|
107
|
+
if (!this._canOperate()) return;
|
|
108
|
+
this._timer && this._timer.stop();
|
|
109
|
+
this._timer = null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// 停止
|
|
113
|
+
}, {
|
|
114
|
+
key: "stop",
|
|
115
|
+
value: function stop() {
|
|
116
|
+
if (!this._canOperate()) return;
|
|
117
|
+
this._timer && this._timer.stop();
|
|
118
|
+
this._timer = null;
|
|
119
|
+
this._currWaterHeight = this.options.waterHeight;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
//关闭
|
|
123
|
+
}, {
|
|
124
|
+
key: "destroy",
|
|
125
|
+
value: function destroy() {
|
|
126
|
+
if (!this._canOperate()) return;
|
|
127
|
+
this.isDestroyed = true;
|
|
128
|
+
this._timer && this._timer.stop();
|
|
129
|
+
this._timer = null;
|
|
130
|
+
this._currWaterHeight = null;
|
|
131
|
+
this._layer && this._layer.remove();
|
|
132
|
+
this._layer = null;
|
|
133
|
+
}
|
|
134
|
+
}]);
|
|
135
|
+
return SubmergenceAnalysis;
|
|
136
|
+
}();
|
|
137
|
+
export default SubmergenceAnalysis;
|
package/dist/esm/constant.d.ts
CHANGED
|
@@ -131,6 +131,14 @@ export declare const DEFAULT_VIDEO_TEXTURE_HLS: () => {
|
|
|
131
131
|
width: number;
|
|
132
132
|
height: number;
|
|
133
133
|
};
|
|
134
|
+
export declare const DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS: () => {
|
|
135
|
+
startHeight: number;
|
|
136
|
+
targetHeight: number;
|
|
137
|
+
waterHeight: number;
|
|
138
|
+
speed: number;
|
|
139
|
+
color: string;
|
|
140
|
+
changeType: string;
|
|
141
|
+
};
|
|
134
142
|
export declare const DEFAULT_BASE_LAYER_TYPE: any;
|
|
135
143
|
export declare const DEFAULT_BASE_LAYER: any;
|
|
136
144
|
export declare const LAYER_TYPE_TO_CLASS: any;
|
package/dist/esm/constant.js
CHANGED
|
@@ -205,6 +205,23 @@ export var DEFAULT_VIDEO_TEXTURE_HLS = function DEFAULT_VIDEO_TEXTURE_HLS() {
|
|
|
205
205
|
};
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
+
// 默认淹没分析配置选项 SubmergenceAnalysis
|
|
209
|
+
export var DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS = function DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS() {
|
|
210
|
+
return {
|
|
211
|
+
startHeight: 0,
|
|
212
|
+
// 开始高度
|
|
213
|
+
targetHeight: 100,
|
|
214
|
+
// 目标高度
|
|
215
|
+
waterHeight: 0,
|
|
216
|
+
// 水面高度
|
|
217
|
+
speed: 1,
|
|
218
|
+
// 速度
|
|
219
|
+
color: '#409DFD',
|
|
220
|
+
// 颜色
|
|
221
|
+
changeType: 'up' // 变化类型 up/down
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
|
|
208
225
|
// 默认的底图类型
|
|
209
226
|
export var DEFAULT_BASE_LAYER_TYPE = {
|
|
210
227
|
GAO_DE_IMG: 'gd_img',
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
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
8
|
//引入cesium基础库
|
|
9
9
|
import * as Cesium from 'deeptwins-cesium';
|
|
10
|
+
import SubmergenceAnalysis from "./analyze/SubmergenceAnalysis";
|
|
10
11
|
import ModelRoamHistory from "./cameraControl/ModelRoamHistory";
|
|
11
12
|
import ModelRoamRealTime from "./cameraControl/ModelRoamRealTime";
|
|
12
13
|
import Roam from "./cameraControl/Roam";
|
|
@@ -49,11 +50,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
|
|
|
49
50
|
// 全局加载css
|
|
50
51
|
loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
|
|
51
52
|
// 打印版本信息
|
|
52
|
-
console.log('DeepTwinsEngine3D Version:', "0.1.
|
|
53
|
+
console.log('DeepTwinsEngine3D Version:', "0.1.34");
|
|
53
54
|
export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
|
|
54
55
|
_classCallCheck(this, DeepTwinsEngine3D);
|
|
55
56
|
});
|
|
56
|
-
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.
|
|
57
|
+
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.34");
|
|
57
58
|
_defineProperty(DeepTwinsEngine3D, "Map", Map);
|
|
58
59
|
_defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
|
|
59
60
|
_defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
|
|
@@ -113,4 +114,5 @@ _defineProperty(DeepTwinsEngine3D, "DistanceDisplayCondition", Cesium.DistanceDi
|
|
|
113
114
|
_defineProperty(DeepTwinsEngine3D, "BoundingRectangle", Cesium.BoundingRectangle);
|
|
114
115
|
_defineProperty(DeepTwinsEngine3D, "SplitDirection", Cesium.SplitDirection);
|
|
115
116
|
_defineProperty(DeepTwinsEngine3D, "ImageGlowingMaterialProperty", ImageGlowingMaterialProperty);
|
|
117
|
+
_defineProperty(DeepTwinsEngine3D, "SubmergenceAnalysis", SubmergenceAnalysis);
|
|
116
118
|
export default DeepTwinsEngine3D;
|