deeptwins-engine-3d 0.1.16 → 0.1.18

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.
@@ -403,6 +403,9 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
403
403
  if (_this2.flyTo) {
404
404
  _this2._flyToModel();
405
405
  }
406
+ if (_this2.follow) {
407
+ _this2.updateCameraView();
408
+ }
406
409
  _this2.modelLayer.activeAnimations.addAll({
407
410
  loop: Cesium.ModelAnimationLoop.REPEAT,
408
411
  multiplier: 2
@@ -768,6 +771,7 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
768
771
  }, {
769
772
  key: "showPolylineLayer",
770
773
  value: function showPolylineLayer(isShow) {
774
+ this.polylineOptions.show = isShow;
771
775
  if (this.polylineLayer) {
772
776
  this.polylineLayer.polyline.show = isShow;
773
777
  }
@@ -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): "other" | "wkt" | "sourceId" | "sourceInstance" | "geoJson";
18
+ static analysisSourceType(data: any): "wkt" | "sourceId" | "sourceInstance" | "geoJson" | "other";
19
19
  static wktToGeoJon(wkt: string): any;
20
20
  static geoJsonToGeoCartesian3Array(geoJson: any): any[];
21
21
  static handleFeaturePoint(feature: any): any;
package/dist/esm/index.js CHANGED
@@ -50,7 +50,7 @@ loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
50
50
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
51
51
  _classCallCheck(this, DeepTwinsEngine3D);
52
52
  });
53
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.16");
53
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.18");
54
54
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
55
55
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
56
56
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -59,6 +59,7 @@ export default class Map extends Cesium.Viewer implements MapContext {
59
59
  destroyGraphicLayer(): void;
60
60
  flyToGraphicLayer(layer: any, options: any): void;
61
61
  flyToGraphicLayers(layers: any[], options: any): void;
62
+ flyToPoints(geoJson: any, options: any): void;
62
63
  addTrafficHistory(TrafficHistoryLayer: any): any;
63
64
  addTerrain(terrain: any): Promise<unknown>;
64
65
  resetTerrain(): void;
@@ -23,8 +23,10 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
23
23
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
24
24
  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); }
25
25
  import * as Cesium from 'deeptwins-cesium';
26
- import { isNil, merge, round } from 'lodash';
26
+ import { flattenDeep, isNil, merge, round } from 'lodash';
27
+ import { v4 as uuidv4 } from 'uuid';
27
28
  import * as constant from "../constant";
29
+ import BaseSource from "../graphicLayer/BaseSource";
28
30
  import GraphicLayerCollection from "../graphicLayer/GraphicLayerCollection";
29
31
  import * as common from "../tool/common";
30
32
  import * as utils from "../tool/utils";
@@ -128,7 +130,7 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
128
130
  key: "_createHtmlContainer",
129
131
  value: function _createHtmlContainer() {
130
132
  var el = document.createElement('div');
131
- el.id = "".concat(constant.HTML_CONTAINER_ID, "_").concat(this.container.id);
133
+ el.id = constant.HTML_CONTAINER_ID;
132
134
  el.style.cssText = 'position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none; overflow: hidden;';
133
135
  this.container.appendChild(el);
134
136
  }
@@ -138,7 +140,7 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
138
140
  key: "_createHeatMapContainer",
139
141
  value: function _createHeatMapContainer() {
140
142
  var el = document.createElement('div');
141
- el.id = "".concat(constant.HEATMAP_CONTAINER_ID, "_").concat(this.container.id);
143
+ el.id = constant.HEATMAP_CONTAINER_ID;
142
144
  el.style.cssText = 'position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none; overflow: hidden; opacity: 0;';
143
145
  this.container.appendChild(el);
144
146
  }
@@ -148,7 +150,7 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
148
150
  key: "_createVideoContainer",
149
151
  value: function _createVideoContainer() {
150
152
  var el = document.createElement('div');
151
- el.id = "".concat(constant.VIDEO_CONTAINER_ID, "_").concat(this.container.id);
153
+ el.id = constant.VIDEO_CONTAINER_ID;
152
154
  el.style.cssText = 'position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none; overflow: hidden; display: none';
153
155
  this.container.appendChild(el);
154
156
  }
@@ -582,6 +584,21 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
582
584
  this.graphicLayerCollection.flyToLayers(layers, options);
583
585
  }
584
586
 
587
+ // 飞行至多个点位的视角
588
+ }, {
589
+ key: "flyToPoints",
590
+ value: function flyToPoints(geoJson, options) {
591
+ var source = new BaseSource({
592
+ id: uuidv4(),
593
+ source: geoJson,
594
+ mapContext: this._mapContext
595
+ });
596
+ var positions = flattenDeep(source.source.map(function (t) {
597
+ return t.positions;
598
+ }));
599
+ utils.cameraFlyToPositions(this.getMap().camera, positions, options);
600
+ }
601
+
585
602
  // 添加路况
586
603
  }, {
587
604
  key: "addTrafficHistory",