deeptwins-engine-3d 0.1.68 → 0.1.70
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/fire.png +0 -0
- package/dist/assets/Build/DeepTwins/Image/fountain.png +0 -0
- package/dist/assets/Build/DeepTwins/Image/smoke.png +0 -0
- package/dist/esm/analyze/LineOfSightAnalysis.d.ts +44 -0
- package/dist/esm/analyze/LineOfSightAnalysis.js +326 -0
- package/dist/esm/analyze/TerrainExcavationAnalysis.d.ts +59 -0
- package/dist/esm/analyze/TerrainExcavationAnalysis.js +612 -0
- package/dist/esm/constant.d.ts +88 -0
- package/dist/esm/constant.js +132 -0
- package/dist/esm/drawCommand/viewShed/RectangularSensorPrimitive.d.ts +3 -0
- package/dist/esm/drawCommand/viewShed/RectangularSensorPrimitive.js +56 -21
- package/dist/esm/drawCommand/viewShed/config.d.ts +2 -2
- package/dist/esm/drawCommand/viewShed/config.js +2 -2
- package/dist/esm/index.d.ts +15 -0
- package/dist/esm/index.js +24 -2
- package/dist/esm/map/Map.d.ts +2 -0
- package/dist/esm/map/Map.js +32 -0
- package/dist/esm/particle/BaseParticle.d.ts +61 -0
- package/dist/esm/particle/BaseParticle.js +196 -0
- package/dist/esm/particle/FireParticle.d.ts +8 -0
- package/dist/esm/particle/FireParticle.js +65 -0
- package/dist/esm/particle/FountainParticle.d.ts +10 -0
- package/dist/esm/particle/FountainParticle.js +80 -0
- package/dist/esm/particle/SmokeParticle.d.ts +8 -0
- package/dist/esm/particle/SmokeParticle.js +65 -0
- package/dist/esm/particle/common.d.ts +18 -0
- package/dist/esm/particle/common.js +23 -0
- package/dist/esm/particle/index.d.ts +5 -0
- package/dist/esm/particle/index.js +5 -0
- package/dist/esm/tileLayer/CustomRasterLayer.d.ts +184 -0
- package/dist/esm/tileLayer/CustomRasterLayer.js +773 -0
- package/dist/esm/visualization/DynamicWater.d.ts +39 -0
- package/dist/esm/visualization/DynamicWater.js +289 -0
- package/dist/esm/visualization/MigrationEffect.d.ts +36 -0
- package/dist/esm/visualization/MigrationEffect.js +397 -0
- package/dist/esm/visualization/RadarScan.d.ts +39 -0
- package/dist/esm/visualization/RadarScan.js +333 -0
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +5 -2
- package/dist/esm/sceneFusion/Airway.d.ts +0 -0
- package/dist/esm/sceneFusion/Airway.js +0 -692
package/dist/esm/map/Map.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export default class Map extends Cesium.Viewer implements MapContext {
|
|
|
42
42
|
roll: number;
|
|
43
43
|
};
|
|
44
44
|
setCameraView(cameraView: any, options?: any): void;
|
|
45
|
+
setCameraViewByBbox(bbox: number[], options?: any): void;
|
|
45
46
|
cancelCameraFly(): void;
|
|
46
47
|
completeCameraFly(): void;
|
|
47
48
|
setDefaultLayer(name: string, index?: number): Cesium.ImageryLayerCollection | undefined;
|
|
@@ -78,6 +79,7 @@ export default class Map extends Cesium.Viewer implements MapContext {
|
|
|
78
79
|
private _getPluginKey;
|
|
79
80
|
private _isSamePlugin;
|
|
80
81
|
private _findPluginEntry;
|
|
82
|
+
getPlugin(plugin: any): any;
|
|
81
83
|
addPlugins(plugins: any): any;
|
|
82
84
|
removePlugins(plugins: any): any;
|
|
83
85
|
destroy(): void;
|
package/dist/esm/map/Map.js
CHANGED
|
@@ -428,6 +428,24 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
|
|
|
428
428
|
}, options));
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
// 设置相机到bbox范围
|
|
432
|
+
}, {
|
|
433
|
+
key: "setCameraViewByBbox",
|
|
434
|
+
value: function setCameraViewByBbox(bbox) {
|
|
435
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
436
|
+
if (!Array.isArray(bbox) || bbox.length < 4) return;
|
|
437
|
+
var _bbox = _slicedToArray(bbox, 4),
|
|
438
|
+
west = _bbox[0],
|
|
439
|
+
south = _bbox[1],
|
|
440
|
+
east = _bbox[2],
|
|
441
|
+
north = _bbox[3];
|
|
442
|
+
var isValidBbox = [west, south, east, north].every(Number.isFinite);
|
|
443
|
+
if (!isValidBbox) return;
|
|
444
|
+
this.camera.flyTo(_objectSpread({
|
|
445
|
+
destination: Cesium.Rectangle.fromDegrees(west, south, east, north)
|
|
446
|
+
}, options));
|
|
447
|
+
}
|
|
448
|
+
|
|
431
449
|
// 取消镜头的飞行和setCameraView等操作
|
|
432
450
|
}, {
|
|
433
451
|
key: "cancelCameraFly",
|
|
@@ -781,6 +799,20 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
|
|
|
781
799
|
}
|
|
782
800
|
}
|
|
783
801
|
|
|
802
|
+
// 获取插件实例
|
|
803
|
+
}, {
|
|
804
|
+
key: "getPlugin",
|
|
805
|
+
value: function getPlugin(plugin) {
|
|
806
|
+
var _this$_findPluginEntr;
|
|
807
|
+
if (isNil(plugin)) {
|
|
808
|
+
return undefined;
|
|
809
|
+
}
|
|
810
|
+
if (typeof plugin === 'string') {
|
|
811
|
+
return this._plugins[plugin];
|
|
812
|
+
}
|
|
813
|
+
return (_this$_findPluginEntr = this._findPluginEntry(plugin)) === null || _this$_findPluginEntr === void 0 ? void 0 : _this$_findPluginEntr.instance;
|
|
814
|
+
}
|
|
815
|
+
|
|
784
816
|
// 添加自定义插件
|
|
785
817
|
}, {
|
|
786
818
|
key: "addPlugins",
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/// <reference path="../typings.d.ts" />
|
|
2
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
3
|
+
import { MapContext } from '../map/Map';
|
|
4
|
+
export type ParticlePosition = Cesium.Cartesian3 | [number, number] | [number, number, number];
|
|
5
|
+
export type ParticleColor = string | Cesium.Color;
|
|
6
|
+
export type ParticleImageSize = Cesium.Cartesian2 | [number, number];
|
|
7
|
+
export interface BaseParticleOptions {
|
|
8
|
+
show?: boolean;
|
|
9
|
+
position?: ParticlePosition;
|
|
10
|
+
heading?: number;
|
|
11
|
+
pitch?: number;
|
|
12
|
+
roll?: number;
|
|
13
|
+
updateCallback?: Cesium.ParticleSystem.updateCallback;
|
|
14
|
+
emitter?: Cesium.ParticleEmitter;
|
|
15
|
+
emissionRate?: number;
|
|
16
|
+
bursts?: Cesium.ParticleBurst[];
|
|
17
|
+
loop?: boolean;
|
|
18
|
+
scale?: number;
|
|
19
|
+
startScale?: number;
|
|
20
|
+
endScale?: number;
|
|
21
|
+
color?: ParticleColor;
|
|
22
|
+
startColor?: ParticleColor;
|
|
23
|
+
endColor?: ParticleColor;
|
|
24
|
+
image?: any;
|
|
25
|
+
imageSize?: ParticleImageSize;
|
|
26
|
+
minimumImageSize?: ParticleImageSize;
|
|
27
|
+
maximumImageSize?: ParticleImageSize;
|
|
28
|
+
sizeInMeters?: boolean;
|
|
29
|
+
speed?: number;
|
|
30
|
+
minimumSpeed?: number;
|
|
31
|
+
maximumSpeed?: number;
|
|
32
|
+
lifetime?: number;
|
|
33
|
+
particleLife?: number;
|
|
34
|
+
minimumParticleLife?: number;
|
|
35
|
+
maximumParticleLife?: number;
|
|
36
|
+
mass?: number;
|
|
37
|
+
minimumMass?: number;
|
|
38
|
+
maximumMass?: number;
|
|
39
|
+
}
|
|
40
|
+
export default class BaseParticle {
|
|
41
|
+
_mapContext: MapContext | undefined;
|
|
42
|
+
particleSystem: Cesium.ParticleSystem | null;
|
|
43
|
+
options: BaseParticleOptions;
|
|
44
|
+
isDestroyed: boolean;
|
|
45
|
+
constructor(map: any, options?: BaseParticleOptions);
|
|
46
|
+
getMap(): any;
|
|
47
|
+
getPrimitive(): Cesium.ParticleSystem | null;
|
|
48
|
+
show(isShow: boolean): void;
|
|
49
|
+
destroy(): void;
|
|
50
|
+
private _assertMap;
|
|
51
|
+
private _canOperate;
|
|
52
|
+
private _createParticleSystem;
|
|
53
|
+
private _resolveParticleOptions;
|
|
54
|
+
private _resolveModelMatrix;
|
|
55
|
+
private _resolveEmitterModelMatrix;
|
|
56
|
+
private _createCameraViewEmitterModelMatrix;
|
|
57
|
+
private _hasEmitterOrientation;
|
|
58
|
+
private _resolvePosition;
|
|
59
|
+
private _resolveColor;
|
|
60
|
+
private _resolveImageSize;
|
|
61
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
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); }
|
|
5
|
+
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; }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
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
|
+
import { getInternalParticleOptions, omitExternalMatrixOptions } from "./common";
|
|
19
|
+
var CAMERA_HEADING_OFFSET_DEGREES = 90;
|
|
20
|
+
var EMITTER_FORWARD_AXIS_CORRECTION = Cesium.Matrix3.fromRotationY(Cesium.Math.PI_OVER_TWO);
|
|
21
|
+
var BaseParticle = /*#__PURE__*/function () {
|
|
22
|
+
function BaseParticle(map) {
|
|
23
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
24
|
+
_classCallCheck(this, BaseParticle);
|
|
25
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
26
|
+
_defineProperty(this, "particleSystem", null);
|
|
27
|
+
_defineProperty(this, "options", void 0);
|
|
28
|
+
_defineProperty(this, "isDestroyed", false);
|
|
29
|
+
this._assertMap(map);
|
|
30
|
+
this._mapContext = map._mapContext || {
|
|
31
|
+
getMap: function getMap() {
|
|
32
|
+
return map;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var internalOptions = getInternalParticleOptions(options);
|
|
36
|
+
var safeOptions = omitExternalMatrixOptions(options);
|
|
37
|
+
this.options = safeOptions;
|
|
38
|
+
this.particleSystem = this._createParticleSystem(safeOptions, internalOptions);
|
|
39
|
+
this.getMap().scene.primitives.add(this.particleSystem);
|
|
40
|
+
}
|
|
41
|
+
_createClass(BaseParticle, [{
|
|
42
|
+
key: "getMap",
|
|
43
|
+
value: function getMap() {
|
|
44
|
+
return this._mapContext && this._mapContext.getMap();
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "getPrimitive",
|
|
48
|
+
value: function getPrimitive() {
|
|
49
|
+
return this.particleSystem;
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "show",
|
|
53
|
+
value: function show(isShow) {
|
|
54
|
+
if (!this._canOperate()) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.particleSystem && (this.particleSystem.show = isShow);
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
key: "destroy",
|
|
61
|
+
value: function destroy() {
|
|
62
|
+
var _map$scene;
|
|
63
|
+
if (this.isDestroyed) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.isDestroyed = true;
|
|
67
|
+
var primitive = this.particleSystem;
|
|
68
|
+
var map = this.getMap();
|
|
69
|
+
if (primitive && map !== null && map !== void 0 && (_map$scene = map.scene) !== null && _map$scene !== void 0 && (_map$scene = _map$scene.primitives) !== null && _map$scene !== void 0 && _map$scene.contains(primitive)) {
|
|
70
|
+
map.scene.primitives.remove(primitive);
|
|
71
|
+
} else if (primitive && !primitive.isDestroyed()) {
|
|
72
|
+
primitive.destroy();
|
|
73
|
+
}
|
|
74
|
+
this.particleSystem = null;
|
|
75
|
+
this._mapContext = undefined;
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "_assertMap",
|
|
79
|
+
value: function _assertMap(map) {
|
|
80
|
+
var _map$scene2;
|
|
81
|
+
if (!(map !== null && map !== void 0 && (_map$scene2 = map.scene) !== null && _map$scene2 !== void 0 && _map$scene2.primitives)) {
|
|
82
|
+
throw new Error('BaseParticle需要传入有效的Cesium Viewer实例');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "_canOperate",
|
|
87
|
+
value: function _canOperate() {
|
|
88
|
+
if (this.isDestroyed) {
|
|
89
|
+
utils.error('BaseParticle实例已销毁');
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "_createParticleSystem",
|
|
96
|
+
value: function _createParticleSystem(options, internalOptions) {
|
|
97
|
+
return new Cesium.ParticleSystem(this._resolveParticleOptions(options, internalOptions));
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "_resolveParticleOptions",
|
|
101
|
+
value: function _resolveParticleOptions(options, internalOptions) {
|
|
102
|
+
var particleInputOptions = _objectSpread({}, options);
|
|
103
|
+
delete particleInputOptions.heading;
|
|
104
|
+
delete particleInputOptions.pitch;
|
|
105
|
+
delete particleInputOptions.roll;
|
|
106
|
+
var particleOptions = _objectSpread(_objectSpread({}, particleInputOptions), {}, {
|
|
107
|
+
modelMatrix: this._resolveModelMatrix(options, internalOptions),
|
|
108
|
+
color: this._resolveColor(particleInputOptions.color),
|
|
109
|
+
startColor: this._resolveColor(particleInputOptions.startColor),
|
|
110
|
+
endColor: this._resolveColor(particleInputOptions.endColor),
|
|
111
|
+
imageSize: this._resolveImageSize(particleInputOptions.imageSize),
|
|
112
|
+
minimumImageSize: this._resolveImageSize(particleInputOptions.minimumImageSize),
|
|
113
|
+
maximumImageSize: this._resolveImageSize(particleInputOptions.maximumImageSize)
|
|
114
|
+
});
|
|
115
|
+
var emitterModelMatrix = this._resolveEmitterModelMatrix(options, internalOptions);
|
|
116
|
+
if (emitterModelMatrix) {
|
|
117
|
+
return _objectSpread(_objectSpread({}, particleOptions), {}, {
|
|
118
|
+
emitterModelMatrix: emitterModelMatrix
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return particleOptions;
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
key: "_resolveModelMatrix",
|
|
125
|
+
value: function _resolveModelMatrix(options, internalOptions) {
|
|
126
|
+
if (internalOptions !== null && internalOptions !== void 0 && internalOptions.modelMatrix) {
|
|
127
|
+
return Cesium.Matrix4.clone(internalOptions.modelMatrix);
|
|
128
|
+
}
|
|
129
|
+
if (options.position) {
|
|
130
|
+
return Cesium.Transforms.eastNorthUpToFixedFrame(this._resolvePosition(options.position));
|
|
131
|
+
}
|
|
132
|
+
return Cesium.Matrix4.clone(Cesium.Matrix4.IDENTITY);
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "_resolveEmitterModelMatrix",
|
|
136
|
+
value: function _resolveEmitterModelMatrix(options, internalOptions) {
|
|
137
|
+
if (internalOptions !== null && internalOptions !== void 0 && internalOptions.emitterModelMatrix) {
|
|
138
|
+
return Cesium.Matrix4.clone(internalOptions.emitterModelMatrix);
|
|
139
|
+
}
|
|
140
|
+
if (!this._hasEmitterOrientation(options)) {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
return this._createCameraViewEmitterModelMatrix(options);
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "_createCameraViewEmitterModelMatrix",
|
|
147
|
+
value: function _createCameraViewEmitterModelMatrix(options) {
|
|
148
|
+
var headingPitchRoll = Cesium.HeadingPitchRoll.fromDegrees((options.heading || 0) - CAMERA_HEADING_OFFSET_DEGREES, options.pitch || 0, options.roll || 0);
|
|
149
|
+
var cameraViewRotation = Cesium.Matrix3.fromHeadingPitchRoll(headingPitchRoll);
|
|
150
|
+
var emitterRotation = Cesium.Matrix3.multiply(cameraViewRotation, EMITTER_FORWARD_AXIS_CORRECTION, new Cesium.Matrix3());
|
|
151
|
+
return Cesium.Matrix4.fromRotationTranslation(emitterRotation, Cesium.Cartesian3.ZERO);
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: "_hasEmitterOrientation",
|
|
155
|
+
value: function _hasEmitterOrientation(options) {
|
|
156
|
+
return options.heading !== undefined || options.pitch !== undefined || options.roll !== undefined;
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "_resolvePosition",
|
|
160
|
+
value: function _resolvePosition(position) {
|
|
161
|
+
if (position instanceof Cesium.Cartesian3) {
|
|
162
|
+
return Cesium.Cartesian3.clone(position);
|
|
163
|
+
}
|
|
164
|
+
var _position = _slicedToArray(position, 3),
|
|
165
|
+
lng = _position[0],
|
|
166
|
+
lat = _position[1],
|
|
167
|
+
_position$ = _position[2],
|
|
168
|
+
alt = _position$ === void 0 ? 0 : _position$;
|
|
169
|
+
return Cesium.Cartesian3.fromDegrees(lng, lat, alt);
|
|
170
|
+
}
|
|
171
|
+
}, {
|
|
172
|
+
key: "_resolveColor",
|
|
173
|
+
value: function _resolveColor(color) {
|
|
174
|
+
if (!color) {
|
|
175
|
+
return color;
|
|
176
|
+
}
|
|
177
|
+
return utils.colorString(color);
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
key: "_resolveImageSize",
|
|
181
|
+
value: function _resolveImageSize(imageSize) {
|
|
182
|
+
if (!imageSize) {
|
|
183
|
+
return imageSize;
|
|
184
|
+
}
|
|
185
|
+
if (imageSize instanceof Cesium.Cartesian2) {
|
|
186
|
+
return Cesium.Cartesian2.clone(imageSize);
|
|
187
|
+
}
|
|
188
|
+
var _imageSize = _slicedToArray(imageSize, 2),
|
|
189
|
+
width = _imageSize[0],
|
|
190
|
+
height = _imageSize[1];
|
|
191
|
+
return new Cesium.Cartesian2(width, height);
|
|
192
|
+
}
|
|
193
|
+
}]);
|
|
194
|
+
return BaseParticle;
|
|
195
|
+
}();
|
|
196
|
+
export { BaseParticle as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import BaseParticle, { BaseParticleOptions } from './BaseParticle';
|
|
2
|
+
export type FireParticleOptions = BaseParticleOptions & {
|
|
3
|
+
emitterRadius?: number;
|
|
4
|
+
};
|
|
5
|
+
export default class FireParticle extends BaseParticle {
|
|
6
|
+
constructor(map: any, options?: FireParticleOptions);
|
|
7
|
+
private static _resolveOptions;
|
|
8
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
var _excluded = ["emitter", "emitterRadius"];
|
|
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 _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; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
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); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
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); }
|
|
13
|
+
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); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
+
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); }; }
|
|
16
|
+
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); }
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
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; } }
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
21
|
+
import { colorString, getDeepTwinsFile } from "../tool/utils";
|
|
22
|
+
import BaseParticle from "./BaseParticle";
|
|
23
|
+
var DEFAULT_FIRE_PARTICLE_OPTIONS = {
|
|
24
|
+
image: getDeepTwinsFile('Image/fire.png'),
|
|
25
|
+
emissionRate: 80,
|
|
26
|
+
loop: true,
|
|
27
|
+
startColor: colorString('#FFD95CE6'),
|
|
28
|
+
endColor: colorString('#E51A0000'),
|
|
29
|
+
startScale: 1.0,
|
|
30
|
+
endScale: 3.5,
|
|
31
|
+
minimumImageSize: new Cesium.Cartesian2(1.0, 1.0),
|
|
32
|
+
maximumImageSize: new Cesium.Cartesian2(2.8, 2.8),
|
|
33
|
+
sizeInMeters: true,
|
|
34
|
+
minimumSpeed: 1.0,
|
|
35
|
+
maximumSpeed: 4.0,
|
|
36
|
+
minimumParticleLife: 0.8,
|
|
37
|
+
maximumParticleLife: 1.8,
|
|
38
|
+
minimumMass: 0.8,
|
|
39
|
+
maximumMass: 1.2,
|
|
40
|
+
emitterRadius: 1.5
|
|
41
|
+
};
|
|
42
|
+
var FireParticle = /*#__PURE__*/function (_BaseParticle) {
|
|
43
|
+
_inherits(FireParticle, _BaseParticle);
|
|
44
|
+
var _super = _createSuper(FireParticle);
|
|
45
|
+
function FireParticle(map) {
|
|
46
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
47
|
+
_classCallCheck(this, FireParticle);
|
|
48
|
+
var particleOptions = FireParticle._resolveOptions(options);
|
|
49
|
+
return _super.call(this, map, particleOptions);
|
|
50
|
+
}
|
|
51
|
+
_createClass(FireParticle, null, [{
|
|
52
|
+
key: "_resolveOptions",
|
|
53
|
+
value: function _resolveOptions(options) {
|
|
54
|
+
var nextOptions = _objectSpread(_objectSpread({}, DEFAULT_FIRE_PARTICLE_OPTIONS), options);
|
|
55
|
+
var emitter = nextOptions.emitter,
|
|
56
|
+
emitterRadius = nextOptions.emitterRadius,
|
|
57
|
+
particleOptions = _objectWithoutProperties(nextOptions, _excluded);
|
|
58
|
+
return _objectSpread(_objectSpread({}, particleOptions), {}, {
|
|
59
|
+
emitter: emitter || new Cesium.CircleEmitter(emitterRadius)
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
63
|
+
return FireParticle;
|
|
64
|
+
}(BaseParticle);
|
|
65
|
+
export { FireParticle as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import BaseParticle, { BaseParticleOptions } from './BaseParticle';
|
|
2
|
+
export type FountainParticleOptions = BaseParticleOptions & {
|
|
3
|
+
emitterAngle?: number;
|
|
4
|
+
gravity?: number;
|
|
5
|
+
};
|
|
6
|
+
export default class FountainParticle extends BaseParticle {
|
|
7
|
+
constructor(map: any, options?: FountainParticleOptions);
|
|
8
|
+
private static _resolveOptions;
|
|
9
|
+
private static _createGravityCallback;
|
|
10
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
var _excluded = ["emitter", "emitterAngle", "gravity", "updateCallback"];
|
|
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 _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; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
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); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
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); }
|
|
13
|
+
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); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
+
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); }; }
|
|
16
|
+
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); }
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
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; } }
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
21
|
+
import { colorString, getDeepTwinsFile } from "../tool/utils";
|
|
22
|
+
import BaseParticle from "./BaseParticle";
|
|
23
|
+
var DEFAULT_FOUNTAIN_GRAVITY = 9.8;
|
|
24
|
+
var FOUNTAIN_GRAVITY_SCRATCH = new Cesium.Cartesian3();
|
|
25
|
+
var DEFAULT_FOUNTAIN_PARTICLE_OPTIONS = {
|
|
26
|
+
image: getDeepTwinsFile('Image/fountain.png'),
|
|
27
|
+
emissionRate: 180,
|
|
28
|
+
loop: true,
|
|
29
|
+
startColor: colorString('#BDEBFFFF'),
|
|
30
|
+
endColor: colorString('#FFFFFF00'),
|
|
31
|
+
startScale: 0.6,
|
|
32
|
+
endScale: 1.8,
|
|
33
|
+
minimumImageSize: new Cesium.Cartesian2(0.3, 0.3),
|
|
34
|
+
maximumImageSize: new Cesium.Cartesian2(1.1, 1.1),
|
|
35
|
+
sizeInMeters: true,
|
|
36
|
+
minimumSpeed: 6.0,
|
|
37
|
+
maximumSpeed: 12.0,
|
|
38
|
+
minimumParticleLife: 1.2,
|
|
39
|
+
maximumParticleLife: 2.4,
|
|
40
|
+
minimumMass: 0.8,
|
|
41
|
+
maximumMass: 1.2,
|
|
42
|
+
emitterAngle: Cesium.Math.toRadians(25),
|
|
43
|
+
gravity: DEFAULT_FOUNTAIN_GRAVITY
|
|
44
|
+
};
|
|
45
|
+
var FountainParticle = /*#__PURE__*/function (_BaseParticle) {
|
|
46
|
+
_inherits(FountainParticle, _BaseParticle);
|
|
47
|
+
var _super = _createSuper(FountainParticle);
|
|
48
|
+
function FountainParticle(map) {
|
|
49
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
50
|
+
_classCallCheck(this, FountainParticle);
|
|
51
|
+
var particleOptions = FountainParticle._resolveOptions(options);
|
|
52
|
+
return _super.call(this, map, particleOptions);
|
|
53
|
+
}
|
|
54
|
+
_createClass(FountainParticle, null, [{
|
|
55
|
+
key: "_resolveOptions",
|
|
56
|
+
value: function _resolveOptions(options) {
|
|
57
|
+
var nextOptions = _objectSpread(_objectSpread({}, DEFAULT_FOUNTAIN_PARTICLE_OPTIONS), options);
|
|
58
|
+
var emitter = nextOptions.emitter,
|
|
59
|
+
emitterAngle = nextOptions.emitterAngle,
|
|
60
|
+
gravity = nextOptions.gravity,
|
|
61
|
+
updateCallback = nextOptions.updateCallback,
|
|
62
|
+
particleOptions = _objectWithoutProperties(nextOptions, _excluded);
|
|
63
|
+
return _objectSpread(_objectSpread({}, particleOptions), {}, {
|
|
64
|
+
emitter: emitter || new Cesium.ConeEmitter(emitterAngle),
|
|
65
|
+
updateCallback: updateCallback || FountainParticle._createGravityCallback(gravity !== null && gravity !== void 0 ? gravity : DEFAULT_FOUNTAIN_GRAVITY)
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "_createGravityCallback",
|
|
70
|
+
value: function _createGravityCallback(gravity) {
|
|
71
|
+
return function (particle, dt) {
|
|
72
|
+
var gravityVector = Cesium.Cartesian3.normalize(particle.position, FOUNTAIN_GRAVITY_SCRATCH);
|
|
73
|
+
Cesium.Cartesian3.multiplyByScalar(gravityVector, -gravity * dt, gravityVector);
|
|
74
|
+
particle.velocity = Cesium.Cartesian3.add(particle.velocity, gravityVector, particle.velocity);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}]);
|
|
78
|
+
return FountainParticle;
|
|
79
|
+
}(BaseParticle);
|
|
80
|
+
export { FountainParticle as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import BaseParticle, { BaseParticleOptions } from './BaseParticle';
|
|
2
|
+
export type SmokeParticleOptions = BaseParticleOptions & {
|
|
3
|
+
emitterRadius?: number;
|
|
4
|
+
};
|
|
5
|
+
export default class SmokeParticle extends BaseParticle {
|
|
6
|
+
constructor(map: any, options?: SmokeParticleOptions);
|
|
7
|
+
private static _resolveOptions;
|
|
8
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
var _excluded = ["emitter", "emitterRadius"];
|
|
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 _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; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
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); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
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); }
|
|
13
|
+
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); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
+
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); }; }
|
|
16
|
+
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); }
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
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; } }
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
21
|
+
import { colorString, getDeepTwinsFile } from "../tool/utils";
|
|
22
|
+
import BaseParticle from "./BaseParticle";
|
|
23
|
+
var DEFAULT_SMOKE_PARTICLE_OPTIONS = {
|
|
24
|
+
image: getDeepTwinsFile('Image/smoke.png'),
|
|
25
|
+
emissionRate: 45,
|
|
26
|
+
loop: true,
|
|
27
|
+
startColor: colorString('#B8B8B8A6'),
|
|
28
|
+
endColor: colorString('#3F3F3F00'),
|
|
29
|
+
startScale: 1.2,
|
|
30
|
+
endScale: 6.0,
|
|
31
|
+
minimumImageSize: new Cesium.Cartesian2(1.0, 1.0),
|
|
32
|
+
maximumImageSize: new Cesium.Cartesian2(3.0, 3.0),
|
|
33
|
+
sizeInMeters: true,
|
|
34
|
+
minimumSpeed: 0.4,
|
|
35
|
+
maximumSpeed: 1.6,
|
|
36
|
+
minimumParticleLife: 2.0,
|
|
37
|
+
maximumParticleLife: 4.0,
|
|
38
|
+
minimumMass: 0.8,
|
|
39
|
+
maximumMass: 1.5,
|
|
40
|
+
emitterRadius: 2
|
|
41
|
+
};
|
|
42
|
+
var SmokeParticle = /*#__PURE__*/function (_BaseParticle) {
|
|
43
|
+
_inherits(SmokeParticle, _BaseParticle);
|
|
44
|
+
var _super = _createSuper(SmokeParticle);
|
|
45
|
+
function SmokeParticle(map) {
|
|
46
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
47
|
+
_classCallCheck(this, SmokeParticle);
|
|
48
|
+
var particleOptions = SmokeParticle._resolveOptions(options);
|
|
49
|
+
return _super.call(this, map, particleOptions);
|
|
50
|
+
}
|
|
51
|
+
_createClass(SmokeParticle, null, [{
|
|
52
|
+
key: "_resolveOptions",
|
|
53
|
+
value: function _resolveOptions(options) {
|
|
54
|
+
var nextOptions = _objectSpread(_objectSpread({}, DEFAULT_SMOKE_PARTICLE_OPTIONS), options);
|
|
55
|
+
var emitter = nextOptions.emitter,
|
|
56
|
+
emitterRadius = nextOptions.emitterRadius,
|
|
57
|
+
particleOptions = _objectWithoutProperties(nextOptions, _excluded);
|
|
58
|
+
return _objectSpread(_objectSpread({}, particleOptions), {}, {
|
|
59
|
+
emitter: emitter || new Cesium.CircleEmitter(emitterRadius)
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
63
|
+
return SmokeParticle;
|
|
64
|
+
}(BaseParticle);
|
|
65
|
+
export { SmokeParticle as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference path="../typings.d.ts" />
|
|
2
|
+
import type { Matrix4 } from 'deeptwins-cesium';
|
|
3
|
+
import type { BaseParticleOptions } from './BaseParticle';
|
|
4
|
+
export interface BaseParticleInternalOptions {
|
|
5
|
+
modelMatrix?: Matrix4;
|
|
6
|
+
emitterModelMatrix?: Matrix4;
|
|
7
|
+
}
|
|
8
|
+
export declare const PARTICLE_INTERNAL_OPTIONS: unique symbol;
|
|
9
|
+
type MatrixExternalOptions = {
|
|
10
|
+
modelMatrix?: Matrix4;
|
|
11
|
+
emitterModelMatrix?: Matrix4;
|
|
12
|
+
};
|
|
13
|
+
export declare const createInternalParticleOptions: <T extends BaseParticleOptions>(options: T, internalOptions: BaseParticleInternalOptions) => T & BaseParticleOptions & {
|
|
14
|
+
[PARTICLE_INTERNAL_OPTIONS]?: BaseParticleInternalOptions | undefined;
|
|
15
|
+
};
|
|
16
|
+
export declare const getInternalParticleOptions: (options: BaseParticleOptions) => BaseParticleInternalOptions | undefined;
|
|
17
|
+
export declare const omitExternalMatrixOptions: <T extends BaseParticleOptions>(options: T) => T & MatrixExternalOptions;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
export var PARTICLE_INTERNAL_OPTIONS = Symbol('PARTICLE_INTERNAL_OPTIONS');
|
|
8
|
+
export var createInternalParticleOptions = function createInternalParticleOptions(options, internalOptions) {
|
|
9
|
+
var nextOptions = _objectSpread({}, options);
|
|
10
|
+
Object.defineProperty(nextOptions, PARTICLE_INTERNAL_OPTIONS, {
|
|
11
|
+
value: internalOptions
|
|
12
|
+
});
|
|
13
|
+
return nextOptions;
|
|
14
|
+
};
|
|
15
|
+
export var getInternalParticleOptions = function getInternalParticleOptions(options) {
|
|
16
|
+
return options[PARTICLE_INTERNAL_OPTIONS];
|
|
17
|
+
};
|
|
18
|
+
export var omitExternalMatrixOptions = function omitExternalMatrixOptions(options) {
|
|
19
|
+
var safeOptions = _objectSpread({}, options);
|
|
20
|
+
delete safeOptions.modelMatrix;
|
|
21
|
+
delete safeOptions.emitterModelMatrix;
|
|
22
|
+
return safeOptions;
|
|
23
|
+
};
|