deeptwins-engine-3d 0.1.61 → 0.1.62
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/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import "./global.css";
|
|
|
22
22
|
import BarrierLayer from "./lowAltitude/BarrierLayer";
|
|
23
23
|
import FlightPlanning from "./lowAltitude/FlightPlanning";
|
|
24
24
|
import FlightRiskEvaluation from "./lowAltitude/FlightRiskEvaluation";
|
|
25
|
+
import FactorLayer from "./lowAltitude/FactorLayer";
|
|
25
26
|
import GridDraw from "./lowAltitude/GridDraw";
|
|
26
27
|
import PoiLayer from "./lowAltitude/PoiLayer";
|
|
27
28
|
import VisitLayer from "./lowAltitude/VisitLayer";
|
|
@@ -62,11 +63,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
|
|
|
62
63
|
// 全局加载css
|
|
63
64
|
loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
|
|
64
65
|
// 打印版本信息
|
|
65
|
-
console.log('DeepTwinsEngine3D Version:', "0.1.
|
|
66
|
+
console.log('DeepTwinsEngine3D Version:', "0.1.62");
|
|
66
67
|
export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
|
|
67
68
|
_classCallCheck(this, DeepTwinsEngine3D);
|
|
68
69
|
});
|
|
69
|
-
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.
|
|
70
|
+
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.62");
|
|
70
71
|
_defineProperty(DeepTwinsEngine3D, "Map", Map);
|
|
71
72
|
_defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
|
|
72
73
|
_defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
|
|
@@ -74,6 +75,7 @@ _defineProperty(DeepTwinsEngine3D, "WmsLayer", WmsLayer);
|
|
|
74
75
|
_defineProperty(DeepTwinsEngine3D, "WmtsLayer", WmtsLayer);
|
|
75
76
|
_defineProperty(DeepTwinsEngine3D, "ArcGisLayer", ArcGisLayer);
|
|
76
77
|
_defineProperty(DeepTwinsEngine3D, "BarrierLayer", BarrierLayer);
|
|
78
|
+
_defineProperty(DeepTwinsEngine3D, "FactorLayer", FactorLayer);
|
|
77
79
|
_defineProperty(DeepTwinsEngine3D, "DeepTwins", DeepTwins);
|
|
78
80
|
_defineProperty(DeepTwinsEngine3D, "WeatherEffects", WeatherEffects);
|
|
79
81
|
_defineProperty(DeepTwinsEngine3D, "Drawer", Drawer);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import BaseGridMvtLayer from './BaseGridMvtLayer';
|
|
2
|
+
/**
|
|
3
|
+
* 要素图层 - 基于背景MVT数据筛选地面网格进行渲染
|
|
4
|
+
*/
|
|
5
|
+
declare class FactorLayer extends BaseGridMvtLayer {
|
|
6
|
+
constructor(map: any, options?: any);
|
|
7
|
+
/**
|
|
8
|
+
* 创建 primitives
|
|
9
|
+
*/
|
|
10
|
+
private _createPrimitives;
|
|
11
|
+
/**
|
|
12
|
+
* 对当前要素过滤并指定颜色
|
|
13
|
+
*/
|
|
14
|
+
private _colorFeature;
|
|
15
|
+
/**
|
|
16
|
+
* 销毁 primitives
|
|
17
|
+
*/
|
|
18
|
+
private _destroyPrimitives;
|
|
19
|
+
/**
|
|
20
|
+
* 显示 primitives
|
|
21
|
+
*/
|
|
22
|
+
private _showPrimitives;
|
|
23
|
+
/**
|
|
24
|
+
* 隐藏 primitives
|
|
25
|
+
*/
|
|
26
|
+
private _hidePrimitives;
|
|
27
|
+
/**
|
|
28
|
+
* 更新 primitives
|
|
29
|
+
*/
|
|
30
|
+
private _updatePrimitives;
|
|
31
|
+
}
|
|
32
|
+
export default FactorLayer;
|
|
@@ -0,0 +1,199 @@
|
|
|
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
|
+
/**
|
|
21
|
+
* 要素图层 - 基于背景MVT数据筛选地面网格进行渲染
|
|
22
|
+
*/
|
|
23
|
+
var FactorLayer = /*#__PURE__*/function (_BaseGridMvtLayer) {
|
|
24
|
+
_inherits(FactorLayer, _BaseGridMvtLayer);
|
|
25
|
+
var _super = _createSuper(FactorLayer);
|
|
26
|
+
function FactorLayer(map) {
|
|
27
|
+
var _this;
|
|
28
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
29
|
+
_classCallCheck(this, FactorLayer);
|
|
30
|
+
_this = _super.call(this, map, _objectSpread({
|
|
31
|
+
dataType: 'background',
|
|
32
|
+
displayHeight: 100,
|
|
33
|
+
boxHeight: 10
|
|
34
|
+
}, options));
|
|
35
|
+
_this.createMvtLayer({
|
|
36
|
+
createPrimitives: function createPrimitives(_tileNum, renderData, viewer) {
|
|
37
|
+
var targetViewer = viewer || _this.getMap();
|
|
38
|
+
return _this._createPrimitives(renderData, targetViewer);
|
|
39
|
+
},
|
|
40
|
+
destroyPrimitives: function destroyPrimitives(_tileNum, primitives) {
|
|
41
|
+
return _this._destroyPrimitives(primitives);
|
|
42
|
+
},
|
|
43
|
+
showPrimitives: function showPrimitives(_tileNum, primitives) {
|
|
44
|
+
return _this._showPrimitives(primitives);
|
|
45
|
+
},
|
|
46
|
+
hidePrimitives: function hidePrimitives(_tileNum, primitives) {
|
|
47
|
+
return _this._hidePrimitives(primitives);
|
|
48
|
+
},
|
|
49
|
+
updatePrimitives: function updatePrimitives(_tileNum, _primitives) {
|
|
50
|
+
return _this._updatePrimitives(_tileNum, _primitives);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return _this;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 创建 primitives
|
|
58
|
+
*/
|
|
59
|
+
_createClass(FactorLayer, [{
|
|
60
|
+
key: "_createPrimitives",
|
|
61
|
+
value: function _createPrimitives(renderData, viewer) {
|
|
62
|
+
var _this$options$display, _this$options$boxHeig;
|
|
63
|
+
if (!this._isViewerReady()) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
var features = (renderData === null || renderData === void 0 ? void 0 : renderData.default) || [];
|
|
67
|
+
var instances = [];
|
|
68
|
+
var displayHeight = (_this$options$display = this.options.displayHeight) !== null && _this$options$display !== void 0 ? _this$options$display : 100;
|
|
69
|
+
var boxHeight = (_this$options$boxHeig = this.options.boxHeight) !== null && _this$options$boxHeig !== void 0 ? _this$options$boxHeig : 10;
|
|
70
|
+
for (var i = 0; i < features.length; i++) {
|
|
71
|
+
var feature = features[i];
|
|
72
|
+
if (!feature || !feature.lnglat || !feature.gridSize) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
var color = this._colorFeature(feature) ? Cesium.Color.fromCssColorString(this._colorFeature(feature)) : null;
|
|
76
|
+
if (!color) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(feature.lnglat[0], feature.lnglat[1], displayHeight));
|
|
80
|
+
var instance = new Cesium.GeometryInstance({
|
|
81
|
+
geometry: Cesium.BoxGeometry.fromDimensions({
|
|
82
|
+
vertexFormat: Cesium.VertexFormat.POSITION_AND_NORMAL,
|
|
83
|
+
dimensions: new Cesium.Cartesian3(feature.gridSize[0], feature.gridSize[1], boxHeight)
|
|
84
|
+
}),
|
|
85
|
+
modelMatrix: modelMatrix,
|
|
86
|
+
attributes: {
|
|
87
|
+
color: Cesium.ColorGeometryInstanceAttribute.fromColor(color)
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
instances.push(instance);
|
|
91
|
+
}
|
|
92
|
+
if (!this._isViewerReady() || instances.length === 0) {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
var primitive = new Cesium.Primitive({
|
|
96
|
+
geometryInstances: instances,
|
|
97
|
+
appearance: new Cesium.PerInstanceColorAppearance({
|
|
98
|
+
translucent: false,
|
|
99
|
+
closed: true
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
if (this._isViewerReady()) {
|
|
103
|
+
viewer.scene.primitives.add(primitive);
|
|
104
|
+
}
|
|
105
|
+
return [primitive];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 对当前要素过滤并指定颜色
|
|
110
|
+
*/
|
|
111
|
+
}, {
|
|
112
|
+
key: "_colorFeature",
|
|
113
|
+
value: function _colorFeature(feature) {
|
|
114
|
+
var _this$options;
|
|
115
|
+
var properties = (feature === null || feature === void 0 ? void 0 : feature.properties) || {};
|
|
116
|
+
if (typeof ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.colorFeature) === 'function') {
|
|
117
|
+
var _this$options2;
|
|
118
|
+
return (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.colorFeature(properties, feature);
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 销毁 primitives
|
|
125
|
+
*/
|
|
126
|
+
}, {
|
|
127
|
+
key: "_destroyPrimitives",
|
|
128
|
+
value: function _destroyPrimitives(primitives) {
|
|
129
|
+
var _this2 = this;
|
|
130
|
+
if (!(primitives !== null && primitives !== void 0 && primitives.length)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
primitives.forEach(function (primitive) {
|
|
134
|
+
if (!primitive) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
primitive.show = false;
|
|
139
|
+
if (_this2._isViewerReady()) {
|
|
140
|
+
var isDestroyed = typeof primitive.isDestroyed === 'function' ? primitive.isDestroyed() : false;
|
|
141
|
+
if (!isDestroyed) {
|
|
142
|
+
_this2.getMap().scene.primitives.remove(primitive);
|
|
143
|
+
}
|
|
144
|
+
if (typeof primitive.destroy === 'function' && !isDestroyed) {
|
|
145
|
+
primitive.destroy();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.warn('销毁绿地 primitive 失败', error);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
primitives.length = 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 显示 primitives
|
|
157
|
+
*/
|
|
158
|
+
}, {
|
|
159
|
+
key: "_showPrimitives",
|
|
160
|
+
value: function _showPrimitives(primitives) {
|
|
161
|
+
if (!(primitives !== null && primitives !== void 0 && primitives.length)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
primitives.forEach(function (primitive) {
|
|
165
|
+
if (primitive && typeof primitive.isDestroyed === 'function' && !primitive.isDestroyed()) {
|
|
166
|
+
primitive.show = true;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* 隐藏 primitives
|
|
173
|
+
*/
|
|
174
|
+
}, {
|
|
175
|
+
key: "_hidePrimitives",
|
|
176
|
+
value: function _hidePrimitives(primitives) {
|
|
177
|
+
if (!(primitives !== null && primitives !== void 0 && primitives.length)) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
primitives.forEach(function (primitive) {
|
|
181
|
+
if (primitive && typeof primitive.isDestroyed === 'function' && !primitive.isDestroyed()) {
|
|
182
|
+
primitive.show = false;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 更新 primitives
|
|
189
|
+
*/
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
191
|
+
}, {
|
|
192
|
+
key: "_updatePrimitives",
|
|
193
|
+
value: function _updatePrimitives(_tileNum, _primitives) {
|
|
194
|
+
// 预留接口,可根据需要实现更新逻辑
|
|
195
|
+
}
|
|
196
|
+
}]);
|
|
197
|
+
return FactorLayer;
|
|
198
|
+
}(BaseGridMvtLayer);
|
|
199
|
+
export default FactorLayer;
|