deeptwins-engine-3d 0.1.11 → 0.1.13
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/cameraControl/ModelRoamRealTime.d.ts +0 -1
- package/dist/esm/cameraControl/ModelRoamRealTime.js +2 -15
- package/dist/esm/constant.d.ts +11 -0
- package/dist/esm/constant.js +22 -2
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +5 -1
- package/dist/esm/map/Event.d.ts +12 -4
- package/dist/esm/map/Event.js +10 -8
- package/dist/esm/map/Map.js +1 -1
- package/dist/esm/material/ImageGlowingMaterialProperty.d.ts +10 -0
- package/dist/esm/material/ImageGlowingMaterialProperty.js +87 -0
- package/dist/esm/material/VolumeCloud.d.ts +16 -0
- package/dist/esm/material/VolumeCloud.js +115 -0
- package/dist/esm/material/shader/ImageGlowingShader.glsl +23 -0
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +1 -1
|
@@ -81,8 +81,6 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
|
|
|
81
81
|
_defineProperty(this, "historyTrailPositions", []);
|
|
82
82
|
// 轨迹数据更新标志
|
|
83
83
|
_defineProperty(this, "trailDataUpdated", false);
|
|
84
|
-
// 轨迹显示状态
|
|
85
|
-
_defineProperty(this, "trailShowState", true);
|
|
86
84
|
// 帧率更新的事件
|
|
87
85
|
_defineProperty(this, "_eventPostUpdate", void 0);
|
|
88
86
|
// 模型参数
|
|
@@ -194,14 +192,9 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
|
|
|
194
192
|
flyTo = options.flyTo;
|
|
195
193
|
this._mapContext = map._mapContext;
|
|
196
194
|
this.modelOptions = model;
|
|
197
|
-
this.polylineOptions =
|
|
195
|
+
this.polylineOptions = polyline;
|
|
198
196
|
this.flyTo = flyTo || false;
|
|
199
197
|
this._onPositionUpdate = onPositionUpdate;
|
|
200
|
-
|
|
201
|
-
// 初始化轨迹显示状态
|
|
202
|
-
if (this.polylineOptions && typeof this.polylineOptions.show === 'boolean') {
|
|
203
|
-
this.trailShowState = this.polylineOptions.show;
|
|
204
|
-
}
|
|
205
198
|
}
|
|
206
199
|
_createClass(ModelRoamRealTime, [{
|
|
207
200
|
key: "getMap",
|
|
@@ -471,11 +464,7 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
|
|
|
471
464
|
}, false)
|
|
472
465
|
}, currStyle)
|
|
473
466
|
});
|
|
474
|
-
|
|
475
|
-
// 设置初始显示状态
|
|
476
|
-
if (this.polylineLayer) {
|
|
477
|
-
this.polylineLayer.polyline.show = this.trailShowState;
|
|
478
|
-
}
|
|
467
|
+
this.polylineLayer.polyline.show = currStyle.show;
|
|
479
468
|
}
|
|
480
469
|
|
|
481
470
|
/**
|
|
@@ -779,7 +768,6 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
|
|
|
779
768
|
}, {
|
|
780
769
|
key: "showPolylineLayer",
|
|
781
770
|
value: function showPolylineLayer(isShow) {
|
|
782
|
-
this.trailShowState = isShow;
|
|
783
771
|
if (this.polylineLayer) {
|
|
784
772
|
this.polylineLayer.polyline.show = isShow;
|
|
785
773
|
}
|
|
@@ -850,7 +838,6 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
|
|
|
850
838
|
this.segmentCounter = 0;
|
|
851
839
|
this.historyTrailPositions = [];
|
|
852
840
|
this.trailDataUpdated = false;
|
|
853
|
-
this.trailShowState = true;
|
|
854
841
|
}
|
|
855
842
|
}]);
|
|
856
843
|
return ModelRoamRealTime;
|
package/dist/esm/constant.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ export declare const DEFAULT_SKY_BOX: any;
|
|
|
117
117
|
export declare const DEFAULT_POLYLINE_TRAIL_LINK_MATERIAL_STYLE: any;
|
|
118
118
|
export declare const DEFAULT_DYNAMIC_WALL_MATERIAL_STYLE: any;
|
|
119
119
|
export declare const DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE: any;
|
|
120
|
+
export declare const DEFAULT_GLOW_MATERIAL_STYLE: any;
|
|
120
121
|
export declare const GRAPHIC_LAYER_TYPE_TO_CLASS: any;
|
|
121
122
|
export declare const DEFAULT_YJ_LAYER: any;
|
|
122
123
|
export declare const DEFAULT_SNOW: () => {
|
|
@@ -133,6 +134,16 @@ export declare const DEFAULT_FOG: () => {
|
|
|
133
134
|
endDistance: number;
|
|
134
135
|
color: string;
|
|
135
136
|
};
|
|
137
|
+
export declare const DEFAULT_VOLUME_CLOUD: () => {
|
|
138
|
+
show: boolean;
|
|
139
|
+
cloudWidth: number;
|
|
140
|
+
cloudHeight: number;
|
|
141
|
+
color: string;
|
|
142
|
+
noiseDetail: number;
|
|
143
|
+
noiseOffset: number[];
|
|
144
|
+
slice: number;
|
|
145
|
+
brightness: number;
|
|
146
|
+
};
|
|
136
147
|
export declare const CAMERA_EVENT_TYPE: {
|
|
137
148
|
MOVE_START: string;
|
|
138
149
|
MOVE_END: string;
|
package/dist/esm/constant.js
CHANGED
|
@@ -370,8 +370,7 @@ export var DEFAULT_DYNAMIC_WALL_MATERIAL_STYLE = function DEFAULT_DYNAMIC_WALL_M
|
|
|
370
370
|
image: utils.getDeepTwinsFile('Image/wall.png')
|
|
371
371
|
};
|
|
372
372
|
};
|
|
373
|
-
|
|
374
|
-
// 动态墙材质默认的配置
|
|
373
|
+
// 水波纹材质默认的配置
|
|
375
374
|
export var DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE = function DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE() {
|
|
376
375
|
return {
|
|
377
376
|
color: Cesium.Color.BLUE,
|
|
@@ -380,6 +379,13 @@ export var DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE = function DEFAULT_CIRCLE_WAVE_MAT
|
|
|
380
379
|
gradient: 0.1
|
|
381
380
|
};
|
|
382
381
|
};
|
|
382
|
+
// 发光材质默认的配置
|
|
383
|
+
export var DEFAULT_GLOW_MATERIAL_STYLE = function DEFAULT_GLOW_MATERIAL_STYLE() {
|
|
384
|
+
return {
|
|
385
|
+
color: Cesium.Color.WHITE,
|
|
386
|
+
mixRatio: 0.5
|
|
387
|
+
};
|
|
388
|
+
};
|
|
383
389
|
|
|
384
390
|
// 矢量图层类型对应的处理函数
|
|
385
391
|
export var GRAPHIC_LAYER_TYPE_TO_CLASS = {
|
|
@@ -446,6 +452,20 @@ export var DEFAULT_FOG = function DEFAULT_FOG() {
|
|
|
446
452
|
};
|
|
447
453
|
};
|
|
448
454
|
|
|
455
|
+
// 默认体积云
|
|
456
|
+
export var DEFAULT_VOLUME_CLOUD = function DEFAULT_VOLUME_CLOUD() {
|
|
457
|
+
return {
|
|
458
|
+
show: true,
|
|
459
|
+
cloudWidth: 1800,
|
|
460
|
+
cloudHeight: 800,
|
|
461
|
+
color: '#ffffff',
|
|
462
|
+
noiseDetail: 16,
|
|
463
|
+
noiseOffset: [0, 0, 0],
|
|
464
|
+
slice: 0.2,
|
|
465
|
+
brightness: 0.9
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
|
|
449
469
|
// 镜头事件类型
|
|
450
470
|
export var CAMERA_EVENT_TYPE = {
|
|
451
471
|
MOVE_START: 'moveStart',
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare class DeepTwinsEngine3D {
|
|
|
23
23
|
static CircleWaveMaterialProperty: any;
|
|
24
24
|
static PolylineTrailLinkMaterialProperty: any;
|
|
25
25
|
static ImageMaterialProperty: any;
|
|
26
|
+
static VolumeCloud: any;
|
|
26
27
|
static Heatmap2d: any;
|
|
27
28
|
static Heatmap3d: any;
|
|
28
29
|
static PointCluster: any;
|
|
@@ -58,5 +59,6 @@ export declare class DeepTwinsEngine3D {
|
|
|
58
59
|
static BoundingRectangle: any;
|
|
59
60
|
static SplitDirection: any;
|
|
60
61
|
static Kriging: any;
|
|
62
|
+
static ImageGlowingMaterialProperty: any;
|
|
61
63
|
}
|
|
62
64
|
export default DeepTwinsEngine3D;
|
package/dist/esm/index.js
CHANGED
|
@@ -20,8 +20,10 @@ import GroundSkyBox from "./map/GroundSkyBox";
|
|
|
20
20
|
import Map from "./map/Map";
|
|
21
21
|
import CircleWaveMaterialProperty from "./material/CircleWaveMaterialProperty";
|
|
22
22
|
import DynamicWallMaterialProperty from "./material/DynamicWallMaterialProperty";
|
|
23
|
+
import ImageGlowingMaterialProperty from "./material/ImageGlowingMaterialProperty";
|
|
23
24
|
import ImageMaterialProperty from "./material/ImageMaterialProperty";
|
|
24
25
|
import PolylineTrailLinkMaterialProperty from "./material/PolylineTrailLinkMaterialProperty";
|
|
26
|
+
import VolumeCloud from "./material/VolumeCloud";
|
|
25
27
|
import WeatherEffects from "./material/WeatherEffects";
|
|
26
28
|
import * as Measure from "./measure";
|
|
27
29
|
import PositionProperty from "./property/PositionProperty";
|
|
@@ -48,7 +50,7 @@ loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
|
|
|
48
50
|
export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
|
|
49
51
|
_classCallCheck(this, DeepTwinsEngine3D);
|
|
50
52
|
});
|
|
51
|
-
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.
|
|
53
|
+
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.13");
|
|
52
54
|
_defineProperty(DeepTwinsEngine3D, "Map", Map);
|
|
53
55
|
_defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
|
|
54
56
|
_defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
|
|
@@ -71,6 +73,7 @@ _defineProperty(DeepTwinsEngine3D, "DynamicWallMaterialProperty", DynamicWallMat
|
|
|
71
73
|
_defineProperty(DeepTwinsEngine3D, "CircleWaveMaterialProperty", CircleWaveMaterialProperty);
|
|
72
74
|
_defineProperty(DeepTwinsEngine3D, "PolylineTrailLinkMaterialProperty", PolylineTrailLinkMaterialProperty);
|
|
73
75
|
_defineProperty(DeepTwinsEngine3D, "ImageMaterialProperty", ImageMaterialProperty);
|
|
76
|
+
_defineProperty(DeepTwinsEngine3D, "VolumeCloud", VolumeCloud);
|
|
74
77
|
_defineProperty(DeepTwinsEngine3D, "Heatmap2d", Heatmap2d);
|
|
75
78
|
_defineProperty(DeepTwinsEngine3D, "Heatmap3d", Heatmap3d);
|
|
76
79
|
_defineProperty(DeepTwinsEngine3D, "PointCluster", PointCluster);
|
|
@@ -106,4 +109,5 @@ _defineProperty(DeepTwinsEngine3D, "DistanceDisplayCondition", Cesium.DistanceDi
|
|
|
106
109
|
_defineProperty(DeepTwinsEngine3D, "BoundingRectangle", Cesium.BoundingRectangle);
|
|
107
110
|
_defineProperty(DeepTwinsEngine3D, "SplitDirection", Cesium.SplitDirection);
|
|
108
111
|
_defineProperty(DeepTwinsEngine3D, "Kriging", Kriging);
|
|
112
|
+
_defineProperty(DeepTwinsEngine3D, "ImageGlowingMaterialProperty", ImageGlowingMaterialProperty);
|
|
109
113
|
export default DeepTwinsEngine3D;
|
package/dist/esm/map/Event.d.ts
CHANGED
|
@@ -8,10 +8,18 @@ export default class Event {
|
|
|
8
8
|
private _getPickedObject;
|
|
9
9
|
private _notifySubscribers;
|
|
10
10
|
private _subscribe;
|
|
11
|
-
listenToMap(type: any, event: any):
|
|
11
|
+
listenToMap(type: any, event: any): {
|
|
12
|
+
off: () => void;
|
|
13
|
+
};
|
|
12
14
|
listenToCamera(type: any, event: any): any;
|
|
13
15
|
listenToScene(type: any, event: any): any;
|
|
14
|
-
listenToLayer(type: any, event: any, layer: any):
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
listenToLayer(type: any, event: any, layer: any): {
|
|
17
|
+
off: () => void;
|
|
18
|
+
};
|
|
19
|
+
listenToPointCluster(type: any, event: any, cluster: any): {
|
|
20
|
+
off: () => void;
|
|
21
|
+
};
|
|
22
|
+
listenToModelRoam(type: any, event: any, modelRoam: any): {
|
|
23
|
+
off: () => void;
|
|
24
|
+
};
|
|
17
25
|
}
|
package/dist/esm/map/Event.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
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
2
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
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); } }
|
|
6
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; }
|
|
@@ -135,15 +133,19 @@ var Event = /*#__PURE__*/function () {
|
|
|
135
133
|
lastClickTime = now;
|
|
136
134
|
}
|
|
137
135
|
}, type);
|
|
136
|
+
} else if (type === Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK) {
|
|
137
|
+
// 移除 Cesium Viewer 默认的双击缩放
|
|
138
|
+
this.getMap().cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
|
139
|
+
handler.setInputAction(function (e) {
|
|
140
|
+
// 发布订阅
|
|
141
|
+
_this._notifySubscribers(type, e);
|
|
142
|
+
}, type);
|
|
138
143
|
} else {
|
|
139
144
|
handler.setInputAction(function (e) {
|
|
140
145
|
// 发布订阅
|
|
141
146
|
_this._notifySubscribers(type, e);
|
|
142
147
|
}, type);
|
|
143
148
|
}
|
|
144
|
-
handler.__proto__.off = function () {
|
|
145
|
-
handler.removeInputAction(type);
|
|
146
|
-
};
|
|
147
149
|
// 订阅器
|
|
148
150
|
subscriber = {
|
|
149
151
|
handler: handler,
|
|
@@ -161,13 +163,13 @@ var Event = /*#__PURE__*/function () {
|
|
|
161
163
|
if (subscriber.callbacks.size === 0) {
|
|
162
164
|
var _subscriber$handler;
|
|
163
165
|
// 如果没有订阅者了,移除处理器
|
|
164
|
-
(_subscriber$handler = subscriber.handler) === null || _subscriber$handler === void 0 || _subscriber$handler.
|
|
166
|
+
(_subscriber$handler = subscriber.handler) === null || _subscriber$handler === void 0 || _subscriber$handler.removeInputAction(type);
|
|
165
167
|
self._eventSubscriptions.delete(type);
|
|
166
168
|
}
|
|
167
169
|
};
|
|
168
|
-
return
|
|
170
|
+
return {
|
|
169
171
|
off: off
|
|
170
|
-
}
|
|
172
|
+
};
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
// 监听地图事件
|
package/dist/esm/map/Map.js
CHANGED
|
@@ -670,7 +670,7 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
|
|
|
670
670
|
this._eventTrick = [];
|
|
671
671
|
_get(_getPrototypeOf(Map.prototype), "destroy", this).call(this);
|
|
672
672
|
if (this._yunjing) {
|
|
673
|
-
this._yunjing.
|
|
673
|
+
this._yunjing.destroy();
|
|
674
674
|
this._yunjing = null;
|
|
675
675
|
}
|
|
676
676
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import BaseMaterialProperty from './BaseMaterialProperty';
|
|
2
|
+
declare class ImageGlowingMaterialProperty extends BaseMaterialProperty {
|
|
3
|
+
private readonly currStyle;
|
|
4
|
+
constructor(style: any);
|
|
5
|
+
static handleStyle(style: any): any;
|
|
6
|
+
private _init;
|
|
7
|
+
getValue(time: any, result: any): any;
|
|
8
|
+
equals(other: any): boolean;
|
|
9
|
+
}
|
|
10
|
+
export default ImageGlowingMaterialProperty;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var _excluded = ["color"];
|
|
2
|
+
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); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
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); } }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
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
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
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); }
|
|
20
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
21
|
+
import { cloneDeep, isEqual, merge } from 'lodash';
|
|
22
|
+
import { DEFAULT_GLOW_MATERIAL_STYLE } from "../constant";
|
|
23
|
+
import * as utils from "../tool/utils";
|
|
24
|
+
import BaseMaterialProperty from "./BaseMaterialProperty";
|
|
25
|
+
/* babel-plugin-inline-import './shader/ImageGlowingShader.glsl' */
|
|
26
|
+
var ImageGlowingShader = "uniform sampler2D image;\nuniform float glowStrength;\nuniform vec4 color;\nuniform float mixRatio;\n\nczm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n\n // \u91C7\u6837\u56FE\u7247\n vec4 texColor = texture(image, st);\n\n // \u989C\u8272\u6DF7\u5408\uFF1Amix(\u539F\u59CB\u989C\u8272, \u76EE\u6807\u989C\u8272, mixRatio)\n vec3 mixedColor = mix(texColor.rgb, texColor.rgb * color.rgb, mixRatio);\n\n // \u53D1\u5149\u589E\u5F3A\n material.diffuse = mixedColor * glowStrength;\n\n // \u900F\u660E\u5EA6\u968F\u989C\u8272\u53D8\u5316\n material.alpha = texColor.a * mix(color.a, 1.0, 1.0 - mixRatio);\n\n return material;\n}\n";
|
|
27
|
+
var ImageGlowingMaterialProperty = /*#__PURE__*/function (_BaseMaterialProperty) {
|
|
28
|
+
_inherits(ImageGlowingMaterialProperty, _BaseMaterialProperty);
|
|
29
|
+
var _super = _createSuper(ImageGlowingMaterialProperty);
|
|
30
|
+
function ImageGlowingMaterialProperty(style) {
|
|
31
|
+
var _this;
|
|
32
|
+
_classCallCheck(this, ImageGlowingMaterialProperty);
|
|
33
|
+
var mergeStyle = merge(DEFAULT_GLOW_MATERIAL_STYLE(), cloneDeep(style || {}));
|
|
34
|
+
_this = _super.call(this, 'ImageGlowingMaterial', mergeStyle);
|
|
35
|
+
_defineProperty(_assertThisInitialized(_this), "currStyle", void 0);
|
|
36
|
+
_this.currStyle = ImageGlowingMaterialProperty.handleStyle(mergeStyle);
|
|
37
|
+
_this._init();
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 处理参数
|
|
42
|
+
_createClass(ImageGlowingMaterialProperty, [{
|
|
43
|
+
key: "_init",
|
|
44
|
+
value: function _init() {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
Cesium.Material._materialCache.addMaterial(this.type, {
|
|
47
|
+
fabric: {
|
|
48
|
+
type: this.type,
|
|
49
|
+
uniforms: _objectSpread({}, this.currStyle),
|
|
50
|
+
source: ImageGlowingShader
|
|
51
|
+
},
|
|
52
|
+
translucent: function translucent() {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "getValue",
|
|
59
|
+
value: function getValue(time, result) {
|
|
60
|
+
var _Object$keys,
|
|
61
|
+
_this2 = this;
|
|
62
|
+
if (!Cesium.defined(result)) {
|
|
63
|
+
result = {};
|
|
64
|
+
}
|
|
65
|
+
(_Object$keys = Object.keys(this.currStyle)) === null || _Object$keys === void 0 || _Object$keys.forEach(function (key) {
|
|
66
|
+
result[key] = _this2.currStyle[key];
|
|
67
|
+
});
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "equals",
|
|
72
|
+
value: function equals(other) {
|
|
73
|
+
return other instanceof ImageGlowingMaterialProperty && isEqual(this.style, other.style);
|
|
74
|
+
}
|
|
75
|
+
}], [{
|
|
76
|
+
key: "handleStyle",
|
|
77
|
+
value: function handleStyle(style) {
|
|
78
|
+
var color = style.color,
|
|
79
|
+
options = _objectWithoutProperties(style, _excluded);
|
|
80
|
+
var backStyle = _objectSpread({}, options);
|
|
81
|
+
backStyle.color = utils.colorString(color);
|
|
82
|
+
return backStyle;
|
|
83
|
+
}
|
|
84
|
+
}]);
|
|
85
|
+
return ImageGlowingMaterialProperty;
|
|
86
|
+
}(BaseMaterialProperty);
|
|
87
|
+
export default ImageGlowingMaterialProperty;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MapContext } from '../map/Map';
|
|
2
|
+
declare class VolumeCloud {
|
|
3
|
+
_mapContext: MapContext | undefined;
|
|
4
|
+
private _polygon;
|
|
5
|
+
isDestroyed: boolean;
|
|
6
|
+
private _pointGeoJson;
|
|
7
|
+
private _options;
|
|
8
|
+
private _clouds;
|
|
9
|
+
constructor(map: any, { polygon, number, heightRange, ...options }: any);
|
|
10
|
+
private _init;
|
|
11
|
+
getMap(): any;
|
|
12
|
+
private _canOperate;
|
|
13
|
+
show(isShow: boolean): void;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
16
|
+
export default VolumeCloud;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
var _excluded = ["polygon", "number", "heightRange"];
|
|
2
|
+
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); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
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 _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; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
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); }
|
|
11
|
+
import { bbox, randomPoint } from '@turf/turf';
|
|
12
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
13
|
+
import { merge } from 'lodash';
|
|
14
|
+
import { DEFAULT_VOLUME_CLOUD } from "../constant";
|
|
15
|
+
import BaseSource from "../graphicLayer/BaseSource";
|
|
16
|
+
import * as utils from "../tool/utils";
|
|
17
|
+
var VolumeCloud = /*#__PURE__*/function () {
|
|
18
|
+
function VolumeCloud(map, _ref) {
|
|
19
|
+
var polygon = _ref.polygon,
|
|
20
|
+
_ref$number = _ref.number,
|
|
21
|
+
number = _ref$number === void 0 ? 10 : _ref$number,
|
|
22
|
+
_ref$heightRange = _ref.heightRange,
|
|
23
|
+
heightRange = _ref$heightRange === void 0 ? [2000, 3000] : _ref$heightRange,
|
|
24
|
+
options = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
_classCallCheck(this, VolumeCloud);
|
|
26
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
27
|
+
_defineProperty(this, "_polygon", void 0);
|
|
28
|
+
_defineProperty(this, "isDestroyed", false);
|
|
29
|
+
_defineProperty(this, "_pointGeoJson", void 0);
|
|
30
|
+
_defineProperty(this, "_options", void 0);
|
|
31
|
+
_defineProperty(this, "_clouds", void 0);
|
|
32
|
+
this._mapContext = map._mapContext;
|
|
33
|
+
this._polygon = polygon;
|
|
34
|
+
var randomPoints = randomPoint(number, {
|
|
35
|
+
bbox: bbox(polygon)
|
|
36
|
+
});
|
|
37
|
+
randomPoints.features.forEach(function (feature) {
|
|
38
|
+
feature.geometry.coordinates.push(Math.random() * (heightRange[1] - heightRange[0]) + heightRange[0]);
|
|
39
|
+
});
|
|
40
|
+
this._pointGeoJson = randomPoints;
|
|
41
|
+
this._options = merge(DEFAULT_VOLUME_CLOUD(), options);
|
|
42
|
+
this._init();
|
|
43
|
+
}
|
|
44
|
+
_createClass(VolumeCloud, [{
|
|
45
|
+
key: "_init",
|
|
46
|
+
value: function _init() {
|
|
47
|
+
var _this$_options = this._options,
|
|
48
|
+
show = _this$_options.show,
|
|
49
|
+
noiseDetail = _this$_options.noiseDetail,
|
|
50
|
+
noiseOffset = _this$_options.noiseOffset,
|
|
51
|
+
cloudWidth = _this$_options.cloudWidth,
|
|
52
|
+
cloudHeight = _this$_options.cloudHeight,
|
|
53
|
+
color = _this$_options.color,
|
|
54
|
+
slice = _this$_options.slice,
|
|
55
|
+
brightness = _this$_options.brightness;
|
|
56
|
+
this._clouds = this.getMap().scene.primitives.add(new Cesium.CloudCollection({
|
|
57
|
+
show: show,
|
|
58
|
+
noiseDetail: noiseDetail + Math.random(),
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
noiseOffset: utils.arrCartesian3(noiseOffset.map(function (t) {
|
|
61
|
+
return t * Math.random();
|
|
62
|
+
}))
|
|
63
|
+
}));
|
|
64
|
+
var source = BaseSource.geoJsonToGeoCartesian3Array(this._pointGeoJson);
|
|
65
|
+
for (var i = 0; i < source.length; i++) {
|
|
66
|
+
var r = Math.random();
|
|
67
|
+
var position = source[i].positions;
|
|
68
|
+
this._clouds.add({
|
|
69
|
+
position: position,
|
|
70
|
+
scale: new Cesium.Cartesian2(cloudWidth * (0.8 + Math.random() * 0.4), cloudHeight * (0.8 + Math.random() * 0.4)),
|
|
71
|
+
maximumSize: new Cesium.Cartesian3(5 + r * 15, 4 + r * 10, 3 + r * 5),
|
|
72
|
+
slice: slice + Math.random() * 0.3,
|
|
73
|
+
// 调整切分比例范围
|
|
74
|
+
brightness: brightness + Math.random() * 0.4,
|
|
75
|
+
// 亮度变化范围
|
|
76
|
+
color: utils.colorString(color)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "getMap",
|
|
82
|
+
value: function getMap() {
|
|
83
|
+
return this._mapContext && this._mapContext.getMap();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 是否能进行操作
|
|
87
|
+
}, {
|
|
88
|
+
key: "_canOperate",
|
|
89
|
+
value: function _canOperate() {
|
|
90
|
+
if (this.isDestroyed) {
|
|
91
|
+
utils.error('VolumeCloud实例已销毁');
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 显示隐藏
|
|
98
|
+
}, {
|
|
99
|
+
key: "show",
|
|
100
|
+
value: function show(isShow) {
|
|
101
|
+
this._clouds.show = isShow;
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "destroy",
|
|
105
|
+
value: function destroy() {
|
|
106
|
+
if (!this._canOperate()) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
this.isDestroyed = true;
|
|
110
|
+
this.getMap().scene.primitives.remove(this._clouds);
|
|
111
|
+
}
|
|
112
|
+
}]);
|
|
113
|
+
return VolumeCloud;
|
|
114
|
+
}();
|
|
115
|
+
export default VolumeCloud;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
uniform sampler2D image;
|
|
2
|
+
uniform float glowStrength;
|
|
3
|
+
uniform vec4 color;
|
|
4
|
+
uniform float mixRatio;
|
|
5
|
+
|
|
6
|
+
czm_material czm_getMaterial(czm_materialInput materialInput) {
|
|
7
|
+
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
8
|
+
vec2 st = materialInput.st;
|
|
9
|
+
|
|
10
|
+
// 采样图片
|
|
11
|
+
vec4 texColor = texture(image, st);
|
|
12
|
+
|
|
13
|
+
// 颜色混合:mix(原始颜色, 目标颜色, mixRatio)
|
|
14
|
+
vec3 mixedColor = mix(texColor.rgb, texColor.rgb * color.rgb, mixRatio);
|
|
15
|
+
|
|
16
|
+
// 发光增强
|
|
17
|
+
material.diffuse = mixedColor * glowStrength;
|
|
18
|
+
|
|
19
|
+
// 透明度随颜色变化
|
|
20
|
+
material.alpha = texColor.a * mix(color.a, 1.0, 1.0 - mixRatio);
|
|
21
|
+
|
|
22
|
+
return material;
|
|
23
|
+
}
|