deeptwins-engine-3d 0.1.30 → 0.1.32

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.
@@ -67,7 +67,7 @@ var PolygonPrimitiveInstance = /*#__PURE__*/function (_BasePrimitiveInstanc) {
67
67
  vertexFormat: currVertexFormat,
68
68
  stRotation: stRotation
69
69
  }, style));
70
- if (materialAppearance) {
70
+ if (materialAppearance && !style.extrudedHeight) {
71
71
  geometry = Cesium.PolygonGeometry.createGeometry(polygonGeometry);
72
72
  geometry.attributes.st = new Cesium.GeometryAttribute({
73
73
  componentDatatype: Cesium.ComponentDatatype.FLOAT,
package/dist/esm/index.js CHANGED
@@ -51,7 +51,7 @@ loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
51
51
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
52
52
  _classCallCheck(this, DeepTwinsEngine3D);
53
53
  });
54
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.30");
54
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.32");
55
55
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
56
56
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
57
57
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -61,6 +61,7 @@ export default class Map extends Cesium.Viewer implements MapContext {
61
61
  flyToGraphicLayers(layers: any[], options: any): void;
62
62
  flyToPoints(geoJson: any, options: any): void;
63
63
  addTrafficHistory(TrafficHistoryLayer: any): any;
64
+ addTerrainUrl(url: string): Promise<unknown>;
64
65
  addTerrain(terrain: any): Promise<unknown>;
65
66
  resetTerrain(): void;
66
67
  showModuleLayer(isShow: boolean): void;
@@ -606,15 +606,33 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
606
606
  return new TrafficHistoryLayer(this);
607
607
  }
608
608
 
609
+ // 添加地形url
610
+ }, {
611
+ key: "addTerrainUrl",
612
+ value: function addTerrainUrl(url) {
613
+ var _this5 = this;
614
+ var terrain = new Cesium.Terrain(Cesium.CesiumTerrainProvider.fromUrl(url));
615
+ this.scene.setTerrain(terrain);
616
+ return new Promise(function (resolve, reject) {
617
+ terrain.readyEvent.addEventListener(function (provider) {
618
+ _this5.scene.globe.enableLighting = true;
619
+ resolve(provider);
620
+ });
621
+ terrain.errorEvent.addEventListener(function (error) {
622
+ reject(error);
623
+ });
624
+ });
625
+ }
626
+
609
627
  // 添加地形
610
628
  }, {
611
629
  key: "addTerrain",
612
630
  value: function addTerrain(terrain) {
613
- var _this5 = this;
631
+ var _this6 = this;
614
632
  this.scene.setTerrain(terrain);
615
633
  return new Promise(function (resolve, reject) {
616
634
  terrain.readyEvent.addEventListener(function (provider) {
617
- _this5.scene.globe.enableLighting = true;
635
+ _this6.scene.globe.enableLighting = true;
618
636
  resolve(provider);
619
637
  });
620
638
  terrain.errorEvent.addEventListener(function (error) {
@@ -11,7 +11,7 @@ export default class BaseVideo {
11
11
  hls: any;
12
12
  private onErrorFun;
13
13
  private _maskImage;
14
- constructor(options: any);
14
+ constructor(map: any, options: any);
15
15
  getMap(): any;
16
16
  _canOperate(): boolean;
17
17
  private _init;
@@ -14,7 +14,7 @@ import * as utils from "../tool/utils";
14
14
 
15
15
  // 视频
16
16
  var BaseVideo = /*#__PURE__*/function () {
17
- function BaseVideo(options) {
17
+ function BaseVideo(map, options) {
18
18
  _classCallCheck(this, BaseVideo);
19
19
  _defineProperty(this, "_mapContext", void 0);
20
20
  _defineProperty(this, "options", void 0);
@@ -28,6 +28,7 @@ var BaseVideo = /*#__PURE__*/function () {
28
28
  _defineProperty(this, "onErrorFun", void 0);
29
29
  _defineProperty(this, "_maskImage", null);
30
30
  this.options = options;
31
+ this._mapContext = map._mapContext;
31
32
  if (options.video) {
32
33
  this.videoType = 'video';
33
34
  }
@@ -3,7 +3,7 @@ export default class VideoProject extends BaseVideo {
3
3
  type: 'fixed' | 'projection';
4
4
  frustum: any;
5
5
  frustumLineLayer: any;
6
- constructor(options: any);
6
+ constructor(map: any, options: any);
7
7
  addToMap(map: any): void;
8
8
  show(isShow: boolean): void;
9
9
  private _drawLine;
@@ -25,10 +25,10 @@ import BaseVideo from "./BaseVideo";
25
25
  var VideoProject = /*#__PURE__*/function (_BaseVideo) {
26
26
  _inherits(VideoProject, _BaseVideo);
27
27
  var _super = _createSuper(VideoProject);
28
- function VideoProject(options) {
28
+ function VideoProject(map, options) {
29
29
  var _this;
30
30
  _classCallCheck(this, VideoProject);
31
- _this = _super.call(this, options);
31
+ _this = _super.call(this, map, options);
32
32
  _defineProperty(_assertThisInitialized(_this), "type", 'fixed');
33
33
  _defineProperty(_assertThisInitialized(_this), "frustum", void 0);
34
34
  _defineProperty(_assertThisInitialized(_this), "frustumLineLayer", void 0);
@@ -41,7 +41,6 @@ var VideoProject = /*#__PURE__*/function (_BaseVideo) {
41
41
  if (!this._canOperate()) {
42
42
  return;
43
43
  }
44
- this._mapContext = map._mapContext;
45
44
  var videoOptions;
46
45
  if (this.videoType === 'video') {
47
46
  this.options.video.autoPlay && this.play();
@@ -1,5 +1,5 @@
1
1
  import BaseVideo from './BaseVideo';
2
2
  export default class VideoTexture extends BaseVideo {
3
- constructor(options: any);
3
+ constructor(map: any, options: any);
4
4
  addToMap(map: any): void;
5
5
  }
@@ -26,9 +26,9 @@ import BaseVideo from "./BaseVideo";
26
26
  var VideoTexture = /*#__PURE__*/function (_BaseVideo) {
27
27
  _inherits(VideoTexture, _BaseVideo);
28
28
  var _super = _createSuper(VideoTexture);
29
- function VideoTexture(options) {
29
+ function VideoTexture(map, options) {
30
30
  _classCallCheck(this, VideoTexture);
31
- return _super.call(this, options);
31
+ return _super.call(this, map, options);
32
32
  }
33
33
  _createClass(VideoTexture, [{
34
34
  key: "addToMap",
@@ -37,7 +37,6 @@ var VideoTexture = /*#__PURE__*/function (_BaseVideo) {
37
37
  if (!this._canOperate()) {
38
38
  return;
39
39
  }
40
- this._mapContext = map._mapContext;
41
40
  var videoOptions;
42
41
  if (this.videoType === 'video') {
43
42
  this.options.video.autoPlay && this.play();
@@ -15,6 +15,7 @@ export default class BaseHeatmap {
15
15
  heatmapEntity: any;
16
16
  heatmapPrimitive: any;
17
17
  constructor(options?: any);
18
+ _init(): void;
18
19
  _canOperate(): boolean;
19
20
  getMap(): any;
20
21
  flyTo(options: any): void;
@@ -19,7 +19,6 @@ import h337 from "../tool/heatmap.js";
19
19
  import * as utils from "../tool/utils";
20
20
  var BaseHeatmap = /*#__PURE__*/function () {
21
21
  function BaseHeatmap() {
22
- var _this$getMap;
23
22
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24
23
  _classCallCheck(this, BaseHeatmap);
25
24
  _defineProperty(this, "_mapContext", void 0);
@@ -40,26 +39,31 @@ var BaseHeatmap = /*#__PURE__*/function () {
40
39
  _options$style = options.style,
41
40
  style = _options$style === void 0 ? {} : _options$style;
42
41
  this.id = uuidv4();
43
- this.style = merge(constant.DEFAULT_HEATMAP_STYLE(), cloneDeep(style));
44
- var el = document.createElement('div');
45
- el.id = this.id;
46
- el.style.cssText = 'width: 100%; height: 100%; pointer-events: none; overflow: hidden; opacity: 0;';
47
- var heatmapContainer = (_this$getMap = this.getMap()) === null || _this$getMap === void 0 || (_this$getMap = _this$getMap.container) === null || _this$getMap === void 0 ? void 0 : _this$getMap.querySelector('#' + constant.HEATMAP_CONTAINER_ID);
48
- if (!heatmapContainer) {
49
- return;
50
- }
51
- heatmapContainer.appendChild(el);
52
- this.heatmapInstance = h337.create(_objectSpread({
53
- container: el
54
- }, this.style));
55
- this.canvasW = this.heatmapInstance._renderer.canvas.width;
56
- this.canvasH = this.heatmapInstance._renderer.canvas.height;
57
42
  this.positions = positions;
58
- this._translatePositions();
43
+ this.style = merge(constant.DEFAULT_HEATMAP_STYLE(), cloneDeep(style));
59
44
  }
60
-
61
- // 是否能进行操作
62
45
  _createClass(BaseHeatmap, [{
46
+ key: "_init",
47
+ value: function _init() {
48
+ var _this$getMap;
49
+ var el = document.createElement('div');
50
+ el.id = this.id;
51
+ el.style.cssText = 'width: 100%; height: 100%; pointer-events: none; overflow: hidden; opacity: 0;';
52
+ var heatmapContainer = (_this$getMap = this.getMap()) === null || _this$getMap === void 0 || (_this$getMap = _this$getMap.container) === null || _this$getMap === void 0 ? void 0 : _this$getMap.querySelector('#' + constant.HEATMAP_CONTAINER_ID);
53
+ if (!heatmapContainer) {
54
+ return;
55
+ }
56
+ heatmapContainer.appendChild(el);
57
+ this.heatmapInstance = h337.create(_objectSpread({
58
+ container: el
59
+ }, this.style));
60
+ this.canvasW = this.heatmapInstance._renderer.canvas.width;
61
+ this.canvasH = this.heatmapInstance._renderer.canvas.height;
62
+ this._translatePositions();
63
+ }
64
+
65
+ // 是否能进行操作
66
+ }, {
63
67
  key: "_canOperate",
64
68
  value: function _canOperate() {
65
69
  if (this.isDestroyed) {
@@ -36,6 +36,7 @@ var Heatmap2d = /*#__PURE__*/function (_BaseHeatmap) {
36
36
  return;
37
37
  }
38
38
  this._mapContext = map._mapContext;
39
+ this._init();
39
40
  if (!this.boundBox) return;
40
41
  var _this$style = this.style,
41
42
  min = _this$style.min,
@@ -36,6 +36,7 @@ var Heatmap3d = /*#__PURE__*/function (_BaseHeatmap) {
36
36
  return;
37
37
  }
38
38
  this._mapContext = map._mapContext;
39
+ this._init();
39
40
  if (!this.boundBox) return;
40
41
  var _this$style = this.style,
41
42
  min = _this$style.min,