deeptwins-engine-3d 0.1.39 → 0.1.41
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/YunJing/yunjing-cesium-plugins.min.js +1 -0
- package/dist/assets/Build/DeepTwins/YunJing/yunjing-for-cesium.js +1 -1
- package/dist/esm/analyze/ViewshedAnalysis.d.ts +0 -0
- package/dist/esm/analyze/ViewshedAnalysis.js +442 -0
- package/dist/esm/constant.d.ts +14 -1
- package/dist/esm/constant.js +25 -1
- package/dist/esm/deepTwins/index.d.ts +2 -1
- package/dist/esm/deepTwins/index.js +21 -4
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +5 -2
- package/dist/esm/map/Map.d.ts +0 -2
- package/dist/esm/map/Map.js +3 -21
- package/dist/esm/tileLayer/BarrierLayer.d.ts +76 -0
- package/dist/esm/tileLayer/BarrierLayer.js +298 -0
- package/dist/esm/tool/Compass.js +20 -4
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 障碍物图层 - 基于MVT数据渲染障碍物网格
|
|
3
|
+
*
|
|
4
|
+
* 使用方式:
|
|
5
|
+
* ```js
|
|
6
|
+
* const DeepTwins = new DeepTwinsEngine3D.DeepTwins();
|
|
7
|
+
* DeepTwins.onLoad(async ({ gridVTLayer }) => {
|
|
8
|
+
* const barrierLayer = new BarrierLayer(viewer, {
|
|
9
|
+
* gridVTLayer: gridVTLayer,
|
|
10
|
+
* url: 'https://...',
|
|
11
|
+
* });
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export default class BarrierLayer {
|
|
16
|
+
private readonly _mapContext;
|
|
17
|
+
isDestroyed: boolean;
|
|
18
|
+
private _gridVTLayer;
|
|
19
|
+
private _options;
|
|
20
|
+
private _heightColors;
|
|
21
|
+
private static readonly DEFAULT_HEIGHT_COLORS;
|
|
22
|
+
/**
|
|
23
|
+
* 创建障碍物图层
|
|
24
|
+
* @param map Cesium Viewer实例
|
|
25
|
+
* @param options 配置选项
|
|
26
|
+
* @param options.gridVTLayer GridVTLayer类(从DeepTwins.onLoad中获取)
|
|
27
|
+
* @param options.url MVT数据URL模板,默认为障碍物数据地址
|
|
28
|
+
* @param options.dataType 数据类型,默认为'barrier'
|
|
29
|
+
* @param options.zooms 缩放级别范围,默认[10, 22]
|
|
30
|
+
* @param options.dataZooms 数据缩放级别,默认[16, 16]
|
|
31
|
+
* @param options.cacheSize 缓存大小,默认20
|
|
32
|
+
* @param options.heightColors 高度颜色映射数组,默认使用内置颜色
|
|
33
|
+
* @param options.minHeight 最小高度(米),低于此高度的障碍物不渲染,默认0
|
|
34
|
+
* @param options.maxHeight 最大高度(米),高于此高度的障碍物不渲染,默认Infinity
|
|
35
|
+
*/
|
|
36
|
+
constructor(map: any, options?: any);
|
|
37
|
+
private _canOperate;
|
|
38
|
+
getMap(): any;
|
|
39
|
+
/**
|
|
40
|
+
* 创建primitives
|
|
41
|
+
* 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
|
|
42
|
+
*/
|
|
43
|
+
private _createPrimitives;
|
|
44
|
+
/**
|
|
45
|
+
* 销毁primitives
|
|
46
|
+
*/
|
|
47
|
+
private _destroyPrimitives;
|
|
48
|
+
/**
|
|
49
|
+
* 显示primitives
|
|
50
|
+
*/
|
|
51
|
+
private _showPrimitives;
|
|
52
|
+
/**
|
|
53
|
+
* 隐藏primitives
|
|
54
|
+
*/
|
|
55
|
+
private _hidePrimitives;
|
|
56
|
+
/**
|
|
57
|
+
* 更新primitives
|
|
58
|
+
*/
|
|
59
|
+
private _updatePrimitives;
|
|
60
|
+
/**
|
|
61
|
+
* 显示图层
|
|
62
|
+
*/
|
|
63
|
+
show(): void;
|
|
64
|
+
/**
|
|
65
|
+
* 隐藏图层
|
|
66
|
+
*/
|
|
67
|
+
hide(): void;
|
|
68
|
+
/**
|
|
69
|
+
* 销毁图层
|
|
70
|
+
*/
|
|
71
|
+
destroy(): void;
|
|
72
|
+
/**
|
|
73
|
+
* 获取底层GridVTLayer实例
|
|
74
|
+
*/
|
|
75
|
+
getGridVTLayer(): any;
|
|
76
|
+
}
|
|
@@ -0,0 +1,298 @@
|
|
|
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
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); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
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; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
17
|
+
import * as utils from "../tool/utils";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 障碍物图层 - 基于MVT数据渲染障碍物网格
|
|
21
|
+
*
|
|
22
|
+
* 使用方式:
|
|
23
|
+
* ```js
|
|
24
|
+
* const DeepTwins = new DeepTwinsEngine3D.DeepTwins();
|
|
25
|
+
* DeepTwins.onLoad(async ({ gridVTLayer }) => {
|
|
26
|
+
* const barrierLayer = new BarrierLayer(viewer, {
|
|
27
|
+
* gridVTLayer: gridVTLayer,
|
|
28
|
+
* url: 'https://...',
|
|
29
|
+
* });
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
var BarrierLayer = /*#__PURE__*/function () {
|
|
34
|
+
/**
|
|
35
|
+
* 创建障碍物图层
|
|
36
|
+
* @param map Cesium Viewer实例
|
|
37
|
+
* @param options 配置选项
|
|
38
|
+
* @param options.gridVTLayer GridVTLayer类(从DeepTwins.onLoad中获取)
|
|
39
|
+
* @param options.url MVT数据URL模板,默认为障碍物数据地址
|
|
40
|
+
* @param options.dataType 数据类型,默认为'barrier'
|
|
41
|
+
* @param options.zooms 缩放级别范围,默认[10, 22]
|
|
42
|
+
* @param options.dataZooms 数据缩放级别,默认[16, 16]
|
|
43
|
+
* @param options.cacheSize 缓存大小,默认20
|
|
44
|
+
* @param options.heightColors 高度颜色映射数组,默认使用内置颜色
|
|
45
|
+
* @param options.minHeight 最小高度(米),低于此高度的障碍物不渲染,默认0
|
|
46
|
+
* @param options.maxHeight 最大高度(米),高于此高度的障碍物不渲染,默认Infinity
|
|
47
|
+
*/
|
|
48
|
+
function BarrierLayer(map) {
|
|
49
|
+
var _this = this;
|
|
50
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
51
|
+
_classCallCheck(this, BarrierLayer);
|
|
52
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
53
|
+
_defineProperty(this, "isDestroyed", false);
|
|
54
|
+
_defineProperty(this, "_gridVTLayer", null);
|
|
55
|
+
_defineProperty(this, "_options", {});
|
|
56
|
+
_defineProperty(this, "_heightColors", []);
|
|
57
|
+
this._mapContext = map._mapContext;
|
|
58
|
+
if (!options.gridVTLayer) {
|
|
59
|
+
console.error('BarrierLayer: 请提供gridVTLayer参数,可通过DeepTwins.onLoad获取');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
var GridVTLayer = options.gridVTLayer;
|
|
63
|
+
|
|
64
|
+
// 验证并设置 dataZooms
|
|
65
|
+
var dataZooms = options.dataZooms || [16, 16];
|
|
66
|
+
if (!Array.isArray(dataZooms) || dataZooms.length !== 2) {
|
|
67
|
+
console.warn('BarrierLayer: dataZooms 应该是 [minZoom, maxZoom] 格式的数组,使用默认值 [16, 16]');
|
|
68
|
+
dataZooms = [16, 16];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 设置颜色配置
|
|
72
|
+
if (options.heightColors && Array.isArray(options.heightColors)) {
|
|
73
|
+
this._heightColors = options.heightColors;
|
|
74
|
+
} else {
|
|
75
|
+
this._heightColors = _toConsumableArray(BarrierLayer.DEFAULT_HEIGHT_COLORS);
|
|
76
|
+
}
|
|
77
|
+
this._options = _objectSpread({
|
|
78
|
+
url: options.url || 'https://amappc.oss-cn-zhangjiakou.aliyuncs.com/yunjing/data/dikong/barrier/mvt/{z}_{x}_{y}.mvt',
|
|
79
|
+
dataType: options.dataType || 'barrier',
|
|
80
|
+
zooms: options.zooms || [10, 22],
|
|
81
|
+
dataZooms: dataZooms,
|
|
82
|
+
cacheSize: options.cacheSize || 20,
|
|
83
|
+
minHeight: options.minHeight !== undefined ? options.minHeight : 0,
|
|
84
|
+
maxHeight: options.maxHeight !== undefined ? options.maxHeight : Infinity
|
|
85
|
+
}, options);
|
|
86
|
+
|
|
87
|
+
// 创建 GridVTLayer
|
|
88
|
+
var customPrimitiveCallbacks = {
|
|
89
|
+
createPrimitives: function createPrimitives(tileNum, renderData, viewer) {
|
|
90
|
+
var targetViewer = viewer || _this.getMap();
|
|
91
|
+
return _this._createPrimitives(tileNum, renderData, targetViewer);
|
|
92
|
+
},
|
|
93
|
+
destroyPrimitives: function destroyPrimitives(tileNum, primitives) {
|
|
94
|
+
return _this._destroyPrimitives(tileNum, primitives);
|
|
95
|
+
},
|
|
96
|
+
showPrimitives: function showPrimitives(tileNum, primitives) {
|
|
97
|
+
return _this._showPrimitives(tileNum, primitives);
|
|
98
|
+
},
|
|
99
|
+
hidePrimitives: function hidePrimitives(tileNum, primitives) {
|
|
100
|
+
return _this._hidePrimitives(tileNum, primitives);
|
|
101
|
+
},
|
|
102
|
+
updatePrimitives: function updatePrimitives(tileNum, primitives) {
|
|
103
|
+
return _this._updatePrimitives(tileNum, primitives);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
this._gridVTLayer = new GridVTLayer({
|
|
107
|
+
viewer: this.getMap(),
|
|
108
|
+
url: this._options.url,
|
|
109
|
+
cacheSize: this._options.cacheSize,
|
|
110
|
+
dataZooms: this._options.dataZooms,
|
|
111
|
+
zooms: this._options.zooms,
|
|
112
|
+
dataType: this._options.dataType,
|
|
113
|
+
customPrimitive: customPrimitiveCallbacks
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// 默认显示图层
|
|
117
|
+
if (typeof this._gridVTLayer.show === 'function') {
|
|
118
|
+
this._gridVTLayer.show();
|
|
119
|
+
} else if (this._gridVTLayer.visible !== undefined) {
|
|
120
|
+
this._gridVTLayer.visible = true;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// 是否能进行操作
|
|
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
|
+
}, {
|
|
145
|
+
key: "_createPrimitives",
|
|
146
|
+
value: function _createPrimitives(tileNum, renderData, viewer) {
|
|
147
|
+
var features = (renderData === null || renderData === void 0 ? void 0 : renderData.default) || [];
|
|
148
|
+
var instances = [];
|
|
149
|
+
var minHeight = this._options.minHeight || 0;
|
|
150
|
+
var maxHeight = this._options.maxHeight !== undefined ? this._options.maxHeight : Infinity;
|
|
151
|
+
for (var i = 0; i < features.length; i++) {
|
|
152
|
+
var feature = features[i];
|
|
153
|
+
if (!feature || !feature.lnglat || !feature.gridSize) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
var lnglat = [feature.lnglat[0], feature.lnglat[1], feature.lnglat[2]];
|
|
157
|
+
|
|
158
|
+
// 根据高度范围过滤障碍物
|
|
159
|
+
var height = lnglat[2];
|
|
160
|
+
if (height < minHeight || height > maxHeight) {
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
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());
|
|
164
|
+
|
|
165
|
+
// 根据高度计算颜色索引
|
|
166
|
+
var colorIndex = Math.floor(feature.lnglat[2] / 7.66 / 3);
|
|
167
|
+
var clampedIndex = Math.max(0, Math.min(colorIndex, this._heightColors.length - 1));
|
|
168
|
+
var color = this._heightColors[clampedIndex] || '#d8daeb';
|
|
169
|
+
var instance = new Cesium.GeometryInstance({
|
|
170
|
+
geometry: Cesium.BoxGeometry.fromDimensions({
|
|
171
|
+
vertexFormat: Cesium.VertexFormat.POSITION_AND_NORMAL,
|
|
172
|
+
dimensions: new Cesium.Cartesian3(feature.gridSize[0], feature.gridSize[1], feature.gridSize[2])
|
|
173
|
+
}),
|
|
174
|
+
modelMatrix: modelMatrix,
|
|
175
|
+
attributes: {
|
|
176
|
+
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromCssColorString(color))
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
instances.push(instance);
|
|
180
|
+
}
|
|
181
|
+
var primitives = [];
|
|
182
|
+
if (instances.length > 0) {
|
|
183
|
+
var primitive = new Cesium.Primitive({
|
|
184
|
+
geometryInstances: instances,
|
|
185
|
+
appearance: new Cesium.PerInstanceColorAppearance({
|
|
186
|
+
translucent: false,
|
|
187
|
+
closed: true
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
var targetViewer = viewer || this.getMap();
|
|
191
|
+
targetViewer.scene.primitives.add(primitive);
|
|
192
|
+
primitives.push(primitive);
|
|
193
|
+
}
|
|
194
|
+
return primitives;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* 销毁primitives
|
|
199
|
+
*/
|
|
200
|
+
}, {
|
|
201
|
+
key: "_destroyPrimitives",
|
|
202
|
+
value: function _destroyPrimitives(tileNum, primitives) {
|
|
203
|
+
var _this2 = this;
|
|
204
|
+
if (!(primitives !== null && primitives !== void 0 && primitives.length)) return;
|
|
205
|
+
primitives.forEach(function (primitive) {
|
|
206
|
+
primitive.show = false;
|
|
207
|
+
_this2.getMap().scene.primitives.remove(primitive);
|
|
208
|
+
});
|
|
209
|
+
primitives.length = 0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* 显示primitives
|
|
214
|
+
*/
|
|
215
|
+
}, {
|
|
216
|
+
key: "_showPrimitives",
|
|
217
|
+
value: function _showPrimitives(tileNum, primitives) {
|
|
218
|
+
primitives.forEach(function (primitive) {
|
|
219
|
+
if (primitive) {
|
|
220
|
+
primitive.show = true;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* 隐藏primitives
|
|
227
|
+
*/
|
|
228
|
+
}, {
|
|
229
|
+
key: "_hidePrimitives",
|
|
230
|
+
value: function _hidePrimitives(tileNum, primitives) {
|
|
231
|
+
primitives.forEach(function (primitive) {
|
|
232
|
+
primitive.show = false;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* 更新primitives
|
|
238
|
+
*/
|
|
239
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
240
|
+
}, {
|
|
241
|
+
key: "_updatePrimitives",
|
|
242
|
+
value: function _updatePrimitives(_tileNum, _primitives) {
|
|
243
|
+
// 预留接口,可根据需要实现更新逻辑
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* 显示图层
|
|
248
|
+
*/
|
|
249
|
+
}, {
|
|
250
|
+
key: "show",
|
|
251
|
+
value: function show() {
|
|
252
|
+
if (this._gridVTLayer) {
|
|
253
|
+
if (typeof this._gridVTLayer.show === 'function') {
|
|
254
|
+
this._gridVTLayer.show();
|
|
255
|
+
} else if (this._gridVTLayer.visible !== undefined) {
|
|
256
|
+
this._gridVTLayer.visible = true;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* 隐藏图层
|
|
263
|
+
*/
|
|
264
|
+
}, {
|
|
265
|
+
key: "hide",
|
|
266
|
+
value: function hide() {
|
|
267
|
+
if (this._gridVTLayer) {
|
|
268
|
+
this._gridVTLayer.hide();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* 销毁图层
|
|
274
|
+
*/
|
|
275
|
+
}, {
|
|
276
|
+
key: "destroy",
|
|
277
|
+
value: function destroy() {
|
|
278
|
+
if (this._gridVTLayer) {
|
|
279
|
+
var _this$_gridVTLayer$de, _this$_gridVTLayer;
|
|
280
|
+
(_this$_gridVTLayer$de = (_this$_gridVTLayer = this._gridVTLayer).destroy) === null || _this$_gridVTLayer$de === void 0 || _this$_gridVTLayer$de.call(_this$_gridVTLayer);
|
|
281
|
+
this._gridVTLayer = null;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* 获取底层GridVTLayer实例
|
|
287
|
+
*/
|
|
288
|
+
}, {
|
|
289
|
+
key: "getGridVTLayer",
|
|
290
|
+
value: function getGridVTLayer() {
|
|
291
|
+
return this._gridVTLayer;
|
|
292
|
+
}
|
|
293
|
+
}]);
|
|
294
|
+
return BarrierLayer;
|
|
295
|
+
}();
|
|
296
|
+
// 默认高度颜色映射(从低到高)
|
|
297
|
+
_defineProperty(BarrierLayer, "DEFAULT_HEIGHT_COLORS", ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'].reverse());
|
|
298
|
+
export { BarrierLayer as default };
|
package/dist/esm/tool/Compass.js
CHANGED
|
@@ -65,17 +65,21 @@ 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
|
+
leftDirection.src = leftDirectionImg;
|
|
69
70
|
el.appendChild(leftDirection);
|
|
70
71
|
|
|
71
72
|
// 左箭头持续旋转
|
|
72
73
|
leftDirection.onmousedown = function () {
|
|
74
|
+
leftDirection.src = getDeepTwinsFile('Image/compass/compass-direction-left-active.png');
|
|
73
75
|
_this2._startContinuousRotation(1);
|
|
74
76
|
};
|
|
75
77
|
leftDirection.onmouseup = function () {
|
|
78
|
+
leftDirection.src = leftDirectionImg;
|
|
76
79
|
_this2._stopContinuousRotation();
|
|
77
80
|
};
|
|
78
81
|
leftDirection.onmouseleave = function () {
|
|
82
|
+
leftDirection.src = leftDirectionImg;
|
|
79
83
|
_this2._stopContinuousRotation();
|
|
80
84
|
};
|
|
81
85
|
this.compassEl.leftDirection = leftDirection;
|
|
@@ -86,44 +90,56 @@ var Compass = /*#__PURE__*/function () {
|
|
|
86
90
|
this.compassEl.pointer = pointer;
|
|
87
91
|
var rightDirection = document.createElement('img');
|
|
88
92
|
rightDirection.className = 'deeptwins-compass-right-direction';
|
|
89
|
-
|
|
93
|
+
var rightDirectionImg = getDeepTwinsFile('Image/compass/compass-direction-right.png');
|
|
94
|
+
rightDirection.src = rightDirectionImg;
|
|
90
95
|
el.appendChild(rightDirection);
|
|
91
96
|
// 右箭头持续旋转
|
|
92
97
|
rightDirection.onmousedown = function () {
|
|
98
|
+
rightDirection.src = getDeepTwinsFile('Image/compass/compass-direction-right-active.png');
|
|
93
99
|
_this2._startContinuousRotation(-1);
|
|
94
100
|
};
|
|
95
101
|
rightDirection.onmouseup = function () {
|
|
102
|
+
rightDirection.src = rightDirectionImg;
|
|
96
103
|
_this2._stopContinuousRotation();
|
|
97
104
|
};
|
|
98
105
|
rightDirection.onmouseleave = function () {
|
|
106
|
+
rightDirection.src = rightDirectionImg;
|
|
99
107
|
_this2._stopContinuousRotation();
|
|
100
108
|
};
|
|
101
109
|
this.compassEl.rightDirection = rightDirection;
|
|
102
110
|
var pitchUp = document.createElement('img');
|
|
103
111
|
pitchUp.className = 'deeptwins-compass-pitch-up';
|
|
104
|
-
|
|
112
|
+
var pitchUpImg = getDeepTwinsFile('Image/compass/compass-pitch-up.png');
|
|
113
|
+
pitchUp.src = pitchUpImg;
|
|
105
114
|
el.appendChild(pitchUp);
|
|
106
115
|
pitchUp.onmousedown = function () {
|
|
116
|
+
pitchUp.src = getDeepTwinsFile('Image/compass/compass-pitch-up-active.png');
|
|
107
117
|
_this2._startContinuousPitch(1);
|
|
108
118
|
};
|
|
109
119
|
pitchUp.onmouseup = function () {
|
|
120
|
+
pitchUp.src = pitchUpImg;
|
|
110
121
|
_this2._stopContinuousPitch();
|
|
111
122
|
};
|
|
112
123
|
pitchUp.onmouseleave = function () {
|
|
124
|
+
pitchUp.src = pitchUpImg;
|
|
113
125
|
_this2._stopContinuousPitch();
|
|
114
126
|
};
|
|
115
127
|
this.compassEl.pitchUp = pitchUp;
|
|
116
128
|
var pitchDown = document.createElement('img');
|
|
117
129
|
pitchDown.className = 'deeptwins-compass-pitch-down';
|
|
118
|
-
|
|
130
|
+
var pitchDownImg = getDeepTwinsFile('Image/compass/compass-pitch-down.png');
|
|
131
|
+
pitchDown.src = pitchDownImg;
|
|
119
132
|
el.appendChild(pitchDown);
|
|
120
133
|
pitchDown.onmousedown = function () {
|
|
134
|
+
pitchDown.src = getDeepTwinsFile('Image/compass/compass-pitch-down-active.png');
|
|
121
135
|
_this2._startContinuousPitch(-1);
|
|
122
136
|
};
|
|
123
137
|
pitchDown.onmouseup = function () {
|
|
138
|
+
pitchDown.src = pitchDownImg;
|
|
124
139
|
_this2._stopContinuousPitch();
|
|
125
140
|
};
|
|
126
141
|
pitchDown.onmouseleave = function () {
|
|
142
|
+
pitchDown.src = pitchDownImg;
|
|
127
143
|
_this2._stopContinuousPitch();
|
|
128
144
|
};
|
|
129
145
|
this.compassEl.pitchDown = pitchDown;
|