deeptwins-engine-3d 0.1.65 → 0.1.67

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.
Files changed (68) hide show
  1. package/dist/esm/constant.d.ts +10 -0
  2. package/dist/esm/constant.js +10 -1
  3. package/dist/esm/drawCommand/viewShed/RectangularSensorPrimitive.d.ts +1 -0
  4. package/dist/esm/drawCommand/viewShed/ViewShedAnalyserLayer.d.ts +1 -0
  5. package/dist/esm/drawer/common.d.ts +1 -0
  6. package/dist/esm/drawer/coordinate.d.ts +1 -0
  7. package/dist/esm/drawer/index.d.ts +1 -1
  8. package/dist/esm/drawer/shape/BaseShape.d.ts +1 -0
  9. package/dist/esm/graphicLayer/BaseLayer.d.ts +23 -0
  10. package/dist/esm/graphicLayer/BaseLayer.js +387 -65
  11. package/dist/esm/graphicLayer/BasePrimitiveInstance.d.ts +0 -1
  12. package/dist/esm/graphicLayer/BasePrimitiveInstance.js +0 -7
  13. package/dist/esm/graphicLayer/BaseSource.d.ts +1 -1
  14. package/dist/esm/graphicLayer/BoxPrimitiveInstance.d.ts +0 -1
  15. package/dist/esm/graphicLayer/BoxPrimitiveInstance.js +4 -8
  16. package/dist/esm/graphicLayer/EllipsePrimitiveInstance.d.ts +0 -1
  17. package/dist/esm/graphicLayer/EllipsePrimitiveInstance.js +5 -9
  18. package/dist/esm/graphicLayer/EllipsoidPrimitiveInstance.d.ts +0 -1
  19. package/dist/esm/graphicLayer/EllipsoidPrimitiveInstance.js +5 -9
  20. package/dist/esm/graphicLayer/GraphicLayerCollection.js +20 -27
  21. package/dist/esm/graphicLayer/ModelPrimitiveInstance.d.ts +0 -1
  22. package/dist/esm/graphicLayer/ModelPrimitiveInstance.js +0 -7
  23. package/dist/esm/graphicLayer/PolygonGroundPrimitiveImageMaterialInstance.js +5 -2
  24. package/dist/esm/graphicLayer/PolygonPrimitiveImageMaterialInstance.js +5 -2
  25. package/dist/esm/graphicLayer/PolygonPrimitiveInstance.d.ts +0 -1
  26. package/dist/esm/graphicLayer/PolygonPrimitiveInstance.js +5 -9
  27. package/dist/esm/graphicLayer/PolylineGroundPrimitiveInstance.d.ts +0 -1
  28. package/dist/esm/graphicLayer/PolylineGroundPrimitiveInstance.js +4 -8
  29. package/dist/esm/graphicLayer/PolylinePrimitiveInstance.d.ts +0 -1
  30. package/dist/esm/graphicLayer/PolylinePrimitiveInstance.js +4 -8
  31. package/dist/esm/graphicLayer/PolylineVolumePrimitiveInstance.d.ts +0 -1
  32. package/dist/esm/graphicLayer/PolylineVolumePrimitiveInstance.js +4 -8
  33. package/dist/esm/graphicLayer/WallPrimitiveInstance.d.ts +0 -1
  34. package/dist/esm/graphicLayer/WallPrimitiveInstance.js +4 -8
  35. package/dist/esm/index.d.ts +2 -0
  36. package/dist/esm/index.js +6 -2
  37. package/dist/esm/map/Map.d.ts +9 -0
  38. package/dist/esm/map/Map.js +115 -2
  39. package/dist/esm/material/AtmosphericDispersion.d.ts +71 -0
  40. package/dist/esm/material/AtmosphericDispersion.js +485 -33
  41. package/dist/esm/material/GlobalVolumetricCloud.d.ts +117 -0
  42. package/dist/esm/material/GlobalVolumetricCloud.js +219 -223
  43. package/dist/esm/material/WeatherEffects.d.ts +64 -14
  44. package/dist/esm/material/WeatherEffects.js +279 -95
  45. package/dist/esm/material/entity/ImageMaterialProperty.d.ts +1 -0
  46. package/dist/esm/material/shader/AtmosphericShader.glsl +244 -0
  47. package/dist/esm/material/shader/RainShader.glsl +44 -6
  48. package/dist/esm/material/shader/lightning.glsl +70 -0
  49. package/dist/esm/measure/BaseDraw.d.ts +1 -0
  50. package/dist/esm/measure/types.d.ts +1 -0
  51. package/dist/esm/measure/utils.d.ts +1 -0
  52. package/dist/esm/sceneFusion/Airway.d.ts +0 -0
  53. package/dist/esm/sceneFusion/Airway.js +692 -0
  54. package/dist/esm/tileLayer/ArcGisLayer.d.ts +1 -0
  55. package/dist/esm/tileLayer/ImageryLayer.d.ts +1 -0
  56. package/dist/esm/tileLayer/MvtVectorLoad.d.ts +13 -0
  57. package/dist/esm/tileLayer/MvtVectorLoad.js +245 -49
  58. package/dist/esm/tool/common.d.ts +1 -0
  59. package/dist/esm/tool/utils.d.ts +1 -0
  60. package/dist/esm/typings.d.ts +8 -0
  61. package/dist/esm/visualization/BaseHeatmap.d.ts +5 -0
  62. package/dist/esm/visualization/BaseHeatmap.js +54 -12
  63. package/dist/esm/visualization/Heatmap2d.d.ts +1 -0
  64. package/dist/esm/visualization/Heatmap2d.js +17 -26
  65. package/dist/esm/visualization/Heatmap3d.d.ts +8 -2
  66. package/dist/esm/visualization/Heatmap3d.js +195 -59
  67. package/dist/umd/deeptwins-engine-3d.min.js +1 -1
  68. package/package.json +1 -1
@@ -1,5 +1,9 @@
1
1
  var _excluded = ["camera", "deepTwins", "scene", "clock", "globe", "cameraController", "resolutionScale"];
2
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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."); }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3
7
  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; }
4
8
  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; }
5
9
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -83,6 +87,8 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
83
87
  _defineProperty(_assertThisInitialized(_this), "_event", void 0);
84
88
  // 默认的事件监听
85
89
  _defineProperty(_assertThisInitialized(_this), "_eventTrick", []);
90
+ // 插件
91
+ _defineProperty(_assertThisInitialized(_this), "_plugins", {});
86
92
  // 添加yunjing 模型
87
93
  _defineProperty(_assertThisInitialized(_this), "addModuleLayer", function (moduleLayer) {
88
94
  var yunjing = moduleLayer.addToMap(_assertThisInitialized(_this));
@@ -715,10 +721,116 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
715
721
  }
716
722
  }
717
723
  }, {
718
- key: "destroy",
724
+ key: "_normalizePlugins",
719
725
  value:
726
+ // 规范插件
727
+ function _normalizePlugins(plugins) {
728
+ if (isNil(plugins)) {
729
+ return [];
730
+ }
731
+ return flattenDeep([plugins]).filter(Boolean);
732
+ }
733
+
734
+ // 获取插件构造器
735
+ }, {
736
+ key: "_getPluginConstructor",
737
+ value: function _getPluginConstructor(plugin) {
738
+ return typeof plugin === 'function' ? plugin : plugin === null || plugin === void 0 ? void 0 : plugin.constructor;
739
+ }
740
+
741
+ // 获取插件key
742
+ }, {
743
+ key: "_getPluginKey",
744
+ value: function _getPluginKey(plugin) {
745
+ var pluginConstructor = this._getPluginConstructor(plugin);
746
+ if (pluginConstructor !== null && pluginConstructor !== void 0 && pluginConstructor.name) {
747
+ return pluginConstructor.name;
748
+ }
749
+ throw new Error("Unable to get plugin \"".concat(plugin.name, "\""));
750
+ }
751
+
752
+ // 判断插件是否已存在
753
+ }, {
754
+ key: "_isSamePlugin",
755
+ value: function _isSamePlugin(pluginInstance, plugin) {
756
+ return pluginInstance === plugin || typeof plugin === 'function' && (pluginInstance === null || pluginInstance === void 0 ? void 0 : pluginInstance.constructor) === plugin;
757
+ }
758
+
759
+ // 查找插件
760
+ }, {
761
+ key: "_findPluginEntry",
762
+ value: function _findPluginEntry(plugin) {
763
+ var pluginKey = this._getPluginKey(plugin);
764
+ if (pluginKey && this._plugins[pluginKey]) {
765
+ return {
766
+ key: pluginKey,
767
+ instance: this._plugins[pluginKey]
768
+ };
769
+ }
770
+ var entries = Object.entries(this._plugins);
771
+ for (var i = 0; i < entries.length; i++) {
772
+ var _entries$i = _slicedToArray(entries[i], 2),
773
+ key = _entries$i[0],
774
+ pluginInstance = _entries$i[1];
775
+ if (this._isSamePlugin(pluginInstance, plugin)) {
776
+ return {
777
+ key: key,
778
+ instance: pluginInstance
779
+ };
780
+ }
781
+ }
782
+ }
783
+
784
+ // 添加自定义插件
785
+ }, {
786
+ key: "addPlugins",
787
+ value: function addPlugins(plugins) {
788
+ var _this7 = this;
789
+ var pluginList = this._normalizePlugins(plugins);
790
+ var instances = pluginList.map(function (plugin) {
791
+ var existsPlugin = _this7._findPluginEntry(plugin);
792
+ if (existsPlugin) {
793
+ return existsPlugin.instance;
794
+ }
795
+ var pluginInstance = typeof plugin === 'function' ? new plugin(_this7) : plugin;
796
+ var pluginKey = _this7._getPluginKey(plugin);
797
+ _this7._plugins[pluginKey] = pluginInstance;
798
+ return pluginInstance;
799
+ }).filter(Boolean);
800
+ return Array.isArray(plugins) ? instances : instances[0];
801
+ }
802
+
803
+ // 移除自定义插件
804
+ }, {
805
+ key: "removePlugins",
806
+ value: function removePlugins(plugins) {
807
+ var _this8 = this;
808
+ var pluginList = this._normalizePlugins(plugins);
809
+ var removedPlugins = [];
810
+ pluginList.forEach(function (plugin) {
811
+ var existsPlugin = _this8._findPluginEntry(plugin);
812
+ if (!existsPlugin) {
813
+ return;
814
+ }
815
+ var key = existsPlugin.key,
816
+ instance = existsPlugin.instance;
817
+ if (!(key in _this8._plugins)) {
818
+ return;
819
+ }
820
+ delete _this8._plugins[key];
821
+ var pluginInstance = instance;
822
+ if (typeof (pluginInstance === null || pluginInstance === void 0 ? void 0 : pluginInstance.destroy) === 'function') {
823
+ pluginInstance.destroy();
824
+ }
825
+ removedPlugins.push(pluginInstance);
826
+ });
827
+ return Array.isArray(plugins) ? removedPlugins : removedPlugins[0];
828
+ }
829
+
720
830
  // 销毁
721
- function destroy() {
831
+ }, {
832
+ key: "destroy",
833
+ value: function destroy() {
722
834
  this._eventTrick.forEach(function (t) {
723
835
  t.off();
724
836
  });
@@ -728,6 +840,7 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
728
840
  this._yunjing = null;
729
841
  }
730
842
  this._hasGSModel = false;
843
+ this.removePlugins(Object.values(this._plugins));
731
844
  _get(_getPrototypeOf(Map.prototype), "destroy", this).call(this);
732
845
  }
733
846
  }]);
@@ -0,0 +1,71 @@
1
+ /// <reference path="../typings.d.ts" />
2
+ import * as Cesium from 'deeptwins-cesium';
3
+ import { MapContext } from '../map/Map';
4
+ interface AtmosphericDispersionParams {
5
+ u_threshold: number;
6
+ u_blendFactor: number;
7
+ u_lightIntensity: number;
8
+ u_scatterStrength: number;
9
+ u_tonemapExposure: number;
10
+ u_mieExtinctionStrength: number;
11
+ u_fogOpacity: number;
12
+ u_fogPower: number;
13
+ u_clearMixBias: number;
14
+ }
15
+ interface AtmosphericDispersionZoomDampingOptions {
16
+ enableZoomDamping: boolean;
17
+ dampingStartPitchDeg: number;
18
+ dampingFullPitchDeg: number;
19
+ minZoomScale: number;
20
+ }
21
+ type AtmosphericDispersionClockText = `${number}:${number}:${number}`;
22
+ type AtmosphericDispersionClockOption = 'auto' | AtmosphericDispersionClockText;
23
+ interface AtmosphericDispersionClockOptions {
24
+ clock: AtmosphericDispersionClockOption;
25
+ }
26
+ type AtmosphericDispersionOptions = Partial<AtmosphericDispersionParams & AtmosphericDispersionZoomDampingOptions & AtmosphericDispersionClockOptions>;
27
+ export declare class AtmosphericDispersion {
28
+ _mapContext: MapContext | undefined;
29
+ params: AtmosphericDispersionParams;
30
+ originalOptions: AtmosphericDispersionOptions;
31
+ atmosphericDispersion: Cesium.PostProcessStage | null;
32
+ zoomDampingOptions: AtmosphericDispersionZoomDampingOptions;
33
+ clockOption: AtmosphericDispersionClockOption;
34
+ private _cameraChangedHandler;
35
+ private readonly _zoomDampingOwnerId;
36
+ private readonly _clockControlOwnerId;
37
+ constructor(map: any, options?: AtmosphericDispersionOptions);
38
+ getMap(): any;
39
+ private _buildParams;
40
+ private _buildZoomDampingOptions;
41
+ private _normalizeClockText;
42
+ private _buildClockOption;
43
+ private _initialize;
44
+ private _getCameraController;
45
+ private _getZoomDampingControllerState;
46
+ private _normalizeZoomFactor;
47
+ private _getClockControlState;
48
+ private _getEffectiveClockOption;
49
+ private _buildClockCurrentTime;
50
+ private _startClockAutoSync;
51
+ private _stopClockAutoSync;
52
+ private _syncSceneClockControl;
53
+ private _applyClockControl;
54
+ private _releaseClockControl;
55
+ private _syncClockControlState;
56
+ private _bindCameraChangedHandler;
57
+ private _unbindCameraChangedHandler;
58
+ private _handleCameraChanged;
59
+ private _computeDampedZoomFactor;
60
+ private _syncControllerZoomFactor;
61
+ private _applyZoomDamping;
62
+ private _releaseZoomDamping;
63
+ private _syncZoomDampingState;
64
+ updateParameters(params: AtmosphericDispersionOptions): this;
65
+ resetParameters(): this;
66
+ show(): this;
67
+ hide(): this;
68
+ isEnabled(): boolean;
69
+ destroy(): void;
70
+ }
71
+ export default AtmosphericDispersion;