deeptwins-engine-3d 0.1.12 → 0.1.14

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.
@@ -32,7 +32,6 @@ export default class ModelRoamRealTime {
32
32
  private TRAIL_POSITIONS_THRESHOLD;
33
33
  private historyTrailPositions;
34
34
  private trailDataUpdated;
35
- private trailShowState;
36
35
  private _eventPostUpdate;
37
36
  private modelMatrix;
38
37
  private hpRoll;
@@ -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 = merge(constant.DEFAULT_POLYLINE_PRIMITIVE_OPTIONS(), cloneDeep(polyline || {}));
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;
@@ -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;
@@ -18,6 +18,7 @@ import PolygonEntity from "./graphicLayer/PolygonEntity";
18
18
  import PolygonPrimitiveInstance from "./graphicLayer/PolygonPrimitiveInstance";
19
19
  import PolylineEntity from "./graphicLayer/PolylineEntity";
20
20
  import PolylinePrimitiveInstance from "./graphicLayer/PolylinePrimitiveInstance";
21
+ import PolylineGroundPrimitiveInstance from "./graphicLayer/PolylineGroundPrimitiveInstance";
21
22
  import PolylineVolumeEntity from "./graphicLayer/PolylineVolumeEntity";
22
23
  import PolylineVolumePrimitiveInstance from "./graphicLayer/PolylineVolumePrimitiveInstance";
23
24
  import WallEntity from "./graphicLayer/WallEntity";
@@ -370,8 +371,7 @@ export var DEFAULT_DYNAMIC_WALL_MATERIAL_STYLE = function DEFAULT_DYNAMIC_WALL_M
370
371
  image: utils.getDeepTwinsFile('Image/wall.png')
371
372
  };
372
373
  };
373
-
374
- // 动态墙材质默认的配置
374
+ // 水波纹材质默认的配置
375
375
  export var DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE = function DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE() {
376
376
  return {
377
377
  color: Cesium.Color.BLUE,
@@ -380,6 +380,14 @@ export var DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE = function DEFAULT_CIRCLE_WAVE_MAT
380
380
  gradient: 0.1
381
381
  };
382
382
  };
383
+ // 发光材质默认的配置
384
+ export var DEFAULT_GLOW_MATERIAL_STYLE = function DEFAULT_GLOW_MATERIAL_STYLE() {
385
+ return {
386
+ color: Cesium.Color.WHITE,
387
+ glowStrength: 2,
388
+ mixRatio: 0.5
389
+ };
390
+ };
383
391
 
384
392
  // 矢量图层类型对应的处理函数
385
393
  export var GRAPHIC_LAYER_TYPE_TO_CLASS = {
@@ -398,7 +406,9 @@ export var GRAPHIC_LAYER_TYPE_TO_CLASS = {
398
406
  pointP: PointPrimitive,
399
407
  billboardP: BillboardPrimitive,
400
408
  polylineP: PolylinePrimitiveInstance,
409
+ polylineGroundP: PolylineGroundPrimitiveInstance,
401
410
  polygonP: PolygonPrimitiveInstance,
411
+ polygonGroundP: PolygonPrimitiveInstance,
402
412
  boxP: BoxPrimitiveInstance,
403
413
  modelP: ModelPrimitiveInstance,
404
414
  labelP: LabelPrimitive,
@@ -446,6 +456,20 @@ export var DEFAULT_FOG = function DEFAULT_FOG() {
446
456
  };
447
457
  };
448
458
 
459
+ // 默认体积云
460
+ export var DEFAULT_VOLUME_CLOUD = function DEFAULT_VOLUME_CLOUD() {
461
+ return {
462
+ show: true,
463
+ cloudWidth: 1800,
464
+ cloudHeight: 800,
465
+ color: '#ffffff',
466
+ noiseDetail: 16,
467
+ noiseOffset: [0, 0, 0],
468
+ slice: 0.2,
469
+ brightness: 0.9
470
+ };
471
+ };
472
+
449
473
  // 镜头事件类型
450
474
  export var CAMERA_EVENT_TYPE = {
451
475
  MOVE_START: 'moveStart',
@@ -17,7 +17,9 @@ import BoxPrimitive from "./BoxPrimitive";
17
17
  import EllipsePrimitive from "./EllipsePrimitive";
18
18
  import EllipsoidPrimitive from "./EllipsoidPrimitive";
19
19
  import ModelPrimitive from "./ModelPrimitive";
20
+ import PolygonGroundPrimitive from "./PolygonGroundPrimitive";
20
21
  import PolygonPrimitive from "./PolygonPrimitive";
22
+ import PolylineGroundPrimitive from "./PolylineGroundPrimitive";
21
23
  import PolylinePrimitive from "./PolylinePrimitive";
22
24
  import PolylineVolumePrimitive from "./PolylineVolumePrimitive";
23
25
  import WallPrimitive from "./WallPrimitive";
@@ -105,9 +107,15 @@ var BaseLayer = /*#__PURE__*/function () {
105
107
  polylineP: function polylineP() {
106
108
  _this2.primitiveCollection = new PolylinePrimitive(_this2._mapContext);
107
109
  },
110
+ polylineGroundP: function polylineGroundP() {
111
+ _this2.primitiveCollection = new PolylineGroundPrimitive(_this2._mapContext);
112
+ },
108
113
  polygonP: function polygonP() {
109
114
  _this2.primitiveCollection = new PolygonPrimitive(_this2._mapContext);
110
115
  },
116
+ polygonGroundP: function polygonGroundP() {
117
+ _this2.primitiveCollection = new PolygonGroundPrimitive(_this2._mapContext);
118
+ },
111
119
  boxP: function boxP() {
112
120
  _this2.primitiveCollection = new BoxPrimitive(_this2._mapContext);
113
121
  },
@@ -0,0 +1,5 @@
1
+ import BasePrimitive from './BasePrimitive';
2
+ export default class PolygonGroundPrimitive extends BasePrimitive {
3
+ constructor(mapContext: any);
4
+ createPrimitive(options: any, primitiveInstance: any[]): void;
5
+ }
@@ -0,0 +1,49 @@
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 { cloneDeep, merge } from 'lodash';
19
+ import { DEFAULT_POLYGON_PRIMITIVE_OPTIONS, DEFAULT_PRIMITIVE_OPTIONS } from "../constant";
20
+ import BasePrimitive from "./BasePrimitive";
21
+ var PolygonGroundPrimitive = /*#__PURE__*/function (_BasePrimitive) {
22
+ _inherits(PolygonGroundPrimitive, _BasePrimitive);
23
+ var _super = _createSuper(PolygonGroundPrimitive);
24
+ function PolygonGroundPrimitive(mapContext) {
25
+ _classCallCheck(this, PolygonGroundPrimitive);
26
+ return _super.call(this, mapContext);
27
+ }
28
+ _createClass(PolygonGroundPrimitive, [{
29
+ key: "createPrimitive",
30
+ value: function createPrimitive() {
31
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
32
+ var primitiveInstance = arguments.length > 1 ? arguments[1] : undefined;
33
+ var style = merge(DEFAULT_POLYGON_PRIMITIVE_OPTIONS(), cloneDeep(options.style || {}));
34
+ var primitiveOptions = merge(DEFAULT_PRIMITIVE_OPTIONS(), cloneDeep(options.primitive || {}));
35
+ var appearance = new Cesium.PerInstanceColorAppearance({
36
+ translucent: !!(style !== null && style !== void 0 && style.translucent)
37
+ });
38
+ this.primitive = new Cesium.GroundPrimitive(_objectSpread({
39
+ geometryInstances: primitiveInstance,
40
+ appearance: appearance,
41
+ releaseGeometryInstances: false,
42
+ asynchronous: true
43
+ }, primitiveOptions));
44
+ this.show = !!(style !== null && style !== void 0 && style.show);
45
+ }
46
+ }]);
47
+ return PolygonGroundPrimitive;
48
+ }(BasePrimitive);
49
+ export { PolygonGroundPrimitive as default };
@@ -0,0 +1,5 @@
1
+ import BasePrimitive from './BasePrimitive';
2
+ export default class PolylineGroundPrimitive extends BasePrimitive {
3
+ constructor(map: any);
4
+ createPrimitive(options: any, primitiveInstance: any[]): void;
5
+ }
@@ -0,0 +1,55 @@
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 { cloneDeep, merge } from 'lodash';
19
+ import { DEFAULT_POLYLINE_PRIMITIVE_OPTIONS, DEFAULT_PRIMITIVE_OPTIONS } from "../constant";
20
+ import * as utils from "../tool/utils";
21
+ import BasePrimitive from "./BasePrimitive";
22
+ var PolylineGroundPrimitive = /*#__PURE__*/function (_BasePrimitive) {
23
+ _inherits(PolylineGroundPrimitive, _BasePrimitive);
24
+ var _super = _createSuper(PolylineGroundPrimitive);
25
+ function PolylineGroundPrimitive(map) {
26
+ _classCallCheck(this, PolylineGroundPrimitive);
27
+ return _super.call(this, map);
28
+ }
29
+ _createClass(PolylineGroundPrimitive, [{
30
+ key: "createPrimitive",
31
+ value: function createPrimitive() {
32
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
33
+ var primitiveInstance = arguments.length > 1 ? arguments[1] : undefined;
34
+ var style = merge(DEFAULT_POLYLINE_PRIMITIVE_OPTIONS(), cloneDeep(options.style || {}));
35
+ var primitiveOptions = merge(DEFAULT_PRIMITIVE_OPTIONS(), cloneDeep(options.primitive || {}));
36
+ var appearance = new Cesium.PolylineColorAppearance({
37
+ translucent: !!(style !== null && style !== void 0 && style.translucent)
38
+ });
39
+ if (style !== null && style !== void 0 && style.material) {
40
+ appearance = new Cesium.PolylineMaterialAppearance({
41
+ material: utils.colorMaterialString(style.material)
42
+ });
43
+ }
44
+ this.primitive = new Cesium.GroundPolylinePrimitive(_objectSpread({
45
+ geometryInstances: primitiveInstance,
46
+ appearance: appearance,
47
+ releaseGeometryInstances: false,
48
+ asynchronous: true
49
+ }, primitiveOptions));
50
+ this.show = !!(style !== null && style !== void 0 && style.show);
51
+ }
52
+ }]);
53
+ return PolylineGroundPrimitive;
54
+ }(BasePrimitive);
55
+ export { PolylineGroundPrimitive as default };
@@ -0,0 +1,7 @@
1
+ import BasePrimitiveInstance from './BasePrimitiveInstance';
2
+ export default class PolylineGroundPrimitiveInstance extends BasePrimitiveInstance {
3
+ constructor(options: any);
4
+ static handleOptions(style: any): any;
5
+ private _init;
6
+ updateData(): void;
7
+ }
@@ -0,0 +1,89 @@
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 = ["style"],
3
+ _excluded2 = ["color"];
4
+ 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; }
5
+ 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; }
6
+ 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; }
7
+ 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; }
8
+ 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; }
9
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
+ 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); } }
11
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
+ 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); }
14
+ 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); }
15
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16
+ 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); }; }
17
+ 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); }
18
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
19
+ 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; } }
20
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
21
+ import * as Cesium from 'deeptwins-cesium';
22
+ import { cloneDeep, merge } from 'lodash';
23
+ import { DEFAULT_POLYLINE_PRIMITIVE_OPTIONS } from "../constant";
24
+ import * as utils from "../tool/utils";
25
+ import BasePrimitiveInstance from "./BasePrimitiveInstance";
26
+
27
+ // 线实体图层
28
+ var PolylineGroundPrimitiveInstance = /*#__PURE__*/function (_BasePrimitiveInstanc) {
29
+ _inherits(PolylineGroundPrimitiveInstance, _BasePrimitiveInstanc);
30
+ var _super = _createSuper(PolylineGroundPrimitiveInstance);
31
+ function PolylineGroundPrimitiveInstance(options) {
32
+ var _this;
33
+ _classCallCheck(this, PolylineGroundPrimitiveInstance);
34
+ _this = _super.call(this, options);
35
+ var style = options.style,
36
+ currOptions = _objectWithoutProperties(options, _excluded);
37
+ var mergeStyle = merge(DEFAULT_POLYLINE_PRIMITIVE_OPTIONS(), cloneDeep(style || {}));
38
+ var currStyle = PolylineGroundPrimitiveInstance.handleOptions(mergeStyle);
39
+ _this._init(_objectSpread({
40
+ style: currStyle
41
+ }, currOptions));
42
+ return _this;
43
+ }
44
+
45
+ // 处理参数
46
+ _createClass(PolylineGroundPrimitiveInstance, [{
47
+ key: "_init",
48
+ value:
49
+ // 初始化
50
+ function _init(options) {
51
+ var _options$style = options.style,
52
+ color = _options$style.color,
53
+ width = _options$style.width,
54
+ primitiveInstance = options.primitiveInstance;
55
+ var instance = new Cesium.GeometryInstance({
56
+ id: this.id,
57
+ geometry: new Cesium.GroundPolylineGeometry({
58
+ positions: this.source.positions,
59
+ width: width,
60
+ granularity: 9999.0
61
+ }),
62
+ attributes: {
63
+ color: color
64
+ }
65
+ });
66
+ primitiveInstance.push(instance);
67
+ }
68
+
69
+ // 更新geoJson数据
70
+ }, {
71
+ key: "updateData",
72
+ value: function updateData() {
73
+ console.warn("".concat(this.type, "\u7C7B\u578B\u4E0D\u652F\u6301\u66F4\u65B0\u6570\u636E"));
74
+ }
75
+ }], [{
76
+ key: "handleOptions",
77
+ value: function handleOptions(style) {
78
+ var color = style.color,
79
+ options = _objectWithoutProperties(style, _excluded2);
80
+ var backStyle = _objectSpread({}, options);
81
+ if (color) {
82
+ backStyle.color = utils.colorInstanceString(color);
83
+ }
84
+ return backStyle;
85
+ }
86
+ }]);
87
+ return PolylineGroundPrimitiveInstance;
88
+ }(BasePrimitiveInstance);
89
+ export { PolylineGroundPrimitiveInstance as default };
@@ -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.12");
53
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.14");
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;
@@ -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.destory();
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;