deeptwins-engine-3d 0.1.17 → 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.
@@ -222,9 +222,6 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
222
222
  this.receivedPositions.push(newPosition);
223
223
  this.currentPos = Cesium.Cartesian3.fromDegrees(newPosition.lng, newPosition.lat, newPosition.alt);
224
224
  this.initModel(newPosition);
225
- if (this.follow) {
226
- this.updateCameraView();
227
- }
228
225
  if (this._onPositionUpdate) {
229
226
  this._onPositionUpdate({
230
227
  lng: newPosition.lng,
@@ -406,6 +403,9 @@ var ModelRoamRealTime = /*#__PURE__*/function () {
406
403
  if (_this2.flyTo) {
407
404
  _this2._flyToModel();
408
405
  }
406
+ if (_this2.follow) {
407
+ _this2.updateCameraView();
408
+ }
409
409
  _this2.modelLayer.activeAnimations.addAll({
410
410
  loop: Cesium.ModelAnimationLoop.REPEAT,
411
411
  multiplier: 2
@@ -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.17");
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";
@@ -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",