deeptwins-engine-3d 0.1.35 → 0.1.37

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.
@@ -36,7 +36,7 @@ var SubmergenceAnalysis = /*#__PURE__*/function () {
36
36
  key: "_canOperate",
37
37
  value: function _canOperate() {
38
38
  if (this.isDestroyed) {
39
- utils.error('Drawer实例已销毁');
39
+ utils.error('SubmergenceAnalysis实例已销毁');
40
40
  return false;
41
41
  }
42
42
  return true;
@@ -0,0 +1,14 @@
1
+ declare class SunLightAnalysis {
2
+ private readonly _mapContext;
3
+ options: any;
4
+ isDestroyed: boolean;
5
+ constructor(map: any, options: any);
6
+ private _canOperate;
7
+ getMap(): any;
8
+ private _create;
9
+ start(): void;
10
+ pause(): void;
11
+ stop(): void;
12
+ destroy(): void;
13
+ }
14
+ export default SunLightAnalysis;
@@ -0,0 +1,91 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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); } }
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; }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
8
+ import * as Cesium from 'deeptwins-cesium';
9
+ import { merge } from 'lodash';
10
+ import { DEFAULT_SUN_ANALYSIS_OPTIONS } from "../constant";
11
+ import * as utils from "../tool/utils";
12
+ var SunLightAnalysis = /*#__PURE__*/function () {
13
+ function SunLightAnalysis(map, options) {
14
+ _classCallCheck(this, SunLightAnalysis);
15
+ _defineProperty(this, "_mapContext", void 0);
16
+ _defineProperty(this, "options", void 0);
17
+ _defineProperty(this, "isDestroyed", false);
18
+ this._mapContext = map._mapContext;
19
+ this.options = merge(DEFAULT_SUN_ANALYSIS_OPTIONS(), options);
20
+ this._create();
21
+ }
22
+
23
+ // 是否能进行操作
24
+ _createClass(SunLightAnalysis, [{
25
+ key: "_canOperate",
26
+ value: function _canOperate() {
27
+ if (this.isDestroyed) {
28
+ utils.error('SunLightAnalysis实例已销毁');
29
+ return false;
30
+ }
31
+ return true;
32
+ }
33
+ }, {
34
+ key: "getMap",
35
+ value: function getMap() {
36
+ return this._mapContext && this._mapContext.getMap();
37
+ }
38
+ }, {
39
+ key: "_create",
40
+ value: function _create() {
41
+ var map = this.getMap();
42
+ map.clock.shouldAnimate = false;
43
+ var _this$options = this.options,
44
+ startTime = _this$options.startTime,
45
+ endTime = _this$options.endTime,
46
+ clockRange = _this$options.clockRange,
47
+ clockStep = _this$options.clockStep,
48
+ multiplier = _this$options.multiplier;
49
+ map.scene.globe.enableLighting = true;
50
+ map.shadows = true;
51
+ map.clock.startTime = Cesium.JulianDate.fromDate(new Date(startTime));
52
+ map.clock.stopTime = Cesium.JulianDate.fromDate(new Date(endTime));
53
+ map.clock.clockRange = clockRange;
54
+ map.clock.clockStep = clockStep;
55
+ map.clock.multiplier = multiplier;
56
+ }
57
+ }, {
58
+ key: "start",
59
+ value: function start() {
60
+ if (!this._canOperate()) return;
61
+ var map = this.getMap();
62
+ map.clock.shouldAnimate = true;
63
+ }
64
+ }, {
65
+ key: "pause",
66
+ value: function pause() {
67
+ if (!this._canOperate()) return;
68
+ var map = this.getMap();
69
+ map.clock.shouldAnimate = false;
70
+ }
71
+ }, {
72
+ key: "stop",
73
+ value: function stop() {
74
+ if (!this._canOperate()) return;
75
+ var map = this.getMap();
76
+ map.clock.currentTime = Cesium.JulianDate.fromDate(new Date(this.options.startTime));
77
+ map.clock.shouldAnimate = false;
78
+ }
79
+ }, {
80
+ key: "destroy",
81
+ value: function destroy() {
82
+ if (!this._canOperate()) return;
83
+ this.isDestroyed = true;
84
+ var map = this.getMap();
85
+ map.clock.shouldAnimate = false;
86
+ map.clock.currentTime = Cesium.JulianDate.fromDate(new Date());
87
+ }
88
+ }]);
89
+ return SunLightAnalysis;
90
+ }();
91
+ export default SunLightAnalysis;
@@ -139,6 +139,13 @@ export declare const DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS: () => {
139
139
  color: string;
140
140
  changeType: string;
141
141
  };
142
+ export declare const DEFAULT_SUN_ANALYSIS_OPTIONS: () => {
143
+ startTime: number;
144
+ endTime: number;
145
+ multiplier: number;
146
+ clockRange: Cesium.ClockRange;
147
+ clockStep: Cesium.ClockStep;
148
+ };
142
149
  export declare const DEFAULT_BASE_LAYER_TYPE: any;
143
150
  export declare const DEFAULT_BASE_LAYER: any;
144
151
  export declare const LAYER_TYPE_TO_CLASS: any;
@@ -222,6 +222,17 @@ export var DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS = function DEFAULT_SUBMERGENCE_A
222
222
  };
223
223
  };
224
224
 
225
+ // 默认日照分析配置选项
226
+ export var DEFAULT_SUN_ANALYSIS_OPTIONS = function DEFAULT_SUN_ANALYSIS_OPTIONS() {
227
+ return {
228
+ startTime: new Date().setHours(8, 0, 0, 0),
229
+ endTime: new Date().setHours(12, 0, 0, 0),
230
+ multiplier: 500,
231
+ clockRange: Cesium.ClockRange.LOOP_STOP,
232
+ clockStep: Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER
233
+ };
234
+ };
235
+
225
236
  // 默认的底图类型
226
237
  export var DEFAULT_BASE_LAYER_TYPE = {
227
238
  GAO_DE_IMG: 'gd_img',
@@ -119,13 +119,21 @@ var BaseLayer = /*#__PURE__*/function () {
119
119
  _this2.primitiveCollection = new BoxPrimitive(_this2._mapContext);
120
120
  },
121
121
  billboardP: function billboardP() {
122
- _this2.primitiveCollection = new Cesium.BillboardCollection();
122
+ var _this2$_mapContext;
123
+ var scene = (_this2$_mapContext = _this2._mapContext) === null || _this2$_mapContext === void 0 || (_this2$_mapContext = _this2$_mapContext.getMap()) === null || _this2$_mapContext === void 0 ? void 0 : _this2$_mapContext.scene;
124
+ _this2.primitiveCollection = new Cesium.BillboardCollection({
125
+ scene: scene
126
+ });
123
127
  },
124
128
  modelP: function modelP() {
125
129
  _this2.primitiveCollection = new ModelPrimitive(_this2._mapContext);
126
130
  },
127
131
  labelP: function labelP() {
128
- _this2.primitiveCollection = new Cesium.LabelCollection();
132
+ var _this2$_mapContext2;
133
+ var scene = (_this2$_mapContext2 = _this2._mapContext) === null || _this2$_mapContext2 === void 0 || (_this2$_mapContext2 = _this2$_mapContext2.getMap()) === null || _this2$_mapContext2 === void 0 ? void 0 : _this2$_mapContext2.scene;
134
+ _this2.primitiveCollection = new Cesium.LabelCollection({
135
+ scene: scene
136
+ });
129
137
  },
130
138
  wallP: function wallP() {
131
139
  _this2.primitiveCollection = new WallPrimitive(_this2._mapContext);
@@ -15,7 +15,7 @@ export default class BaseSource {
15
15
  remove(): void;
16
16
  setData(data: any): this | undefined;
17
17
  _toDestroy(): void;
18
- static analysisSourceType(data: any): "wkt" | "sourceId" | "sourceInstance" | "geoJson" | "other";
18
+ static analysisSourceType(data: any): "other" | "wkt" | "sourceId" | "sourceInstance" | "geoJson";
19
19
  static wktToGeoJon(wkt: string): any;
20
20
  static geoJsonToGeoCartesian3Array(geoJson: any): any[];
21
21
  static handleFeaturePoint(feature: any): any;
@@ -61,7 +61,7 @@ export declare class DeepTwinsEngine3D {
61
61
  static SplitDirection: any;
62
62
  static ImageGlowingMaterialProperty: any;
63
63
  static SubmergenceAnalysis: any;
64
- static Compass: any;
64
+ static SunLightAnalysis: any;
65
65
  static KmlDataSource: any;
66
66
  }
67
67
  export default DeepTwinsEngine3D;
package/dist/esm/index.js CHANGED
@@ -8,6 +8,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
8
8
  //引入cesium基础库
9
9
  import * as Cesium from 'deeptwins-cesium';
10
10
  import SubmergenceAnalysis from "./analyze/SubmergenceAnalysis";
11
+ import SunLightAnalysis from "./analyze/SunLightAnalysis";
11
12
  import ModelRoamHistory from "./cameraControl/ModelRoamHistory";
12
13
  import ModelRoamRealTime from "./cameraControl/ModelRoamRealTime";
13
14
  import Roam from "./cameraControl/Roam";
@@ -33,7 +34,6 @@ import ArcGisLayer from "./tileLayer/ArcGisLayer";
33
34
  import RasterLayer from "./tileLayer/RasterLayer";
34
35
  import WmsLayer from "./tileLayer/WmsLayer";
35
36
  import WmtsLayer from "./tileLayer/WmtsLayer";
36
- import Compass from "./tool/Compass";
37
37
  import TimerInterval from "./tool/TimerInterval";
38
38
  import { ClampToGround, ShapeSection } from "./tool/common";
39
39
  import { loadCss } from "./tool/utils";
@@ -51,11 +51,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
51
51
  // 全局加载css
52
52
  loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
53
53
  // 打印版本信息
54
- console.log('DeepTwinsEngine3D Version:', "0.1.35");
54
+ console.log('DeepTwinsEngine3D Version:', "0.1.37");
55
55
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
56
56
  _classCallCheck(this, DeepTwinsEngine3D);
57
57
  });
58
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.35");
58
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.37");
59
59
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
60
60
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
61
61
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -116,6 +116,6 @@ _defineProperty(DeepTwinsEngine3D, "BoundingRectangle", Cesium.BoundingRectangle
116
116
  _defineProperty(DeepTwinsEngine3D, "SplitDirection", Cesium.SplitDirection);
117
117
  _defineProperty(DeepTwinsEngine3D, "ImageGlowingMaterialProperty", ImageGlowingMaterialProperty);
118
118
  _defineProperty(DeepTwinsEngine3D, "SubmergenceAnalysis", SubmergenceAnalysis);
119
- _defineProperty(DeepTwinsEngine3D, "Compass", Compass);
119
+ _defineProperty(DeepTwinsEngine3D, "SunLightAnalysis", SunLightAnalysis);
120
120
  _defineProperty(DeepTwinsEngine3D, "KmlDataSource", Cesium.KmlDataSource);
121
121
  export default DeepTwinsEngine3D;