deeptwins-engine-3d 0.1.50 → 0.1.51

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.
@@ -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): "clampedPolygonGrid" | "wkt" | "sourceId" | "sourceInstance" | "geoJson" | "other";
18
+ static analysisSourceType(data: any): "wkt" | "sourceId" | "sourceInstance" | "geoJson" | "clampedPolygonGrid" | "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
@@ -61,11 +61,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
61
61
  // 全局加载css
62
62
  loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
63
63
  // 打印版本信息
64
- console.log('DeepTwinsEngine3D Version:', "0.1.50");
64
+ console.log('DeepTwinsEngine3D Version:', "0.1.51");
65
65
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
66
66
  _classCallCheck(this, DeepTwinsEngine3D);
67
67
  });
68
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.50");
68
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.51");
69
69
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
70
70
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
71
71
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -10,6 +10,7 @@ export default class Map extends Cesium.Viewer implements MapContext {
10
10
  private _defaultSkybox;
11
11
  private _handleSkyBox;
12
12
  private _yunjing;
13
+ private _hasGSModel;
13
14
  private _event;
14
15
  private _eventTrick;
15
16
  constructor(container: any, options: any);
@@ -76,6 +76,8 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
76
76
  _defineProperty(_assertThisInitialized(_this), "_handleSkyBox", null);
77
77
  // 云镜模型实例
78
78
  _defineProperty(_assertThisInitialized(_this), "_yunjing", void 0);
79
+ // 是否有云镜高斯模型
80
+ _defineProperty(_assertThisInitialized(_this), "_hasGSModel", false);
79
81
  // 事件
80
82
  _defineProperty(_assertThisInitialized(_this), "_event", void 0);
81
83
  // 默认的事件监听
@@ -83,6 +85,7 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
83
85
  // 添加yunjing 模型
84
86
  _defineProperty(_assertThisInitialized(_this), "addModuleLayer", function (moduleLayer) {
85
87
  var yunjing = moduleLayer.addToMap(_assertThisInitialized(_this));
88
+ _this._hasGSModel = true;
86
89
  common.removeYjIcon();
87
90
  return yunjing;
88
91
  });
@@ -94,6 +97,7 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
94
97
  if (deepTwins) {
95
98
  if (deepTwins.moduleLayer) {
96
99
  _this._yunjing = deepTwins.moduleLayer.addToMap(_assertThisInitialized(_this));
100
+ _this._hasGSModel = true;
97
101
  common.removeYjIcon();
98
102
  }
99
103
  } else {
@@ -699,6 +703,7 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
699
703
  this._yunjing.destroy();
700
704
  this._yunjing = null;
701
705
  }
706
+ this._hasGSModel = false;
702
707
  _get(_getPrototypeOf(Map.prototype), "destroy", this).call(this);
703
708
  }
704
709
  }]);
@@ -180,17 +180,22 @@ function _BuildClampedPolygonGridUnified() {
180
180
  // await scene.render();
181
181
  modelClamped = null;
182
182
  _context.prev = 33;
183
- _context.next = 36;
183
+ if (map._hasGSModel) {
184
+ _context.next = 38;
185
+ break;
186
+ }
187
+ _context.next = 37;
184
188
  return scene.clampToHeightMostDetailed(JSON.parse(JSON.stringify(positions3D)));
185
- case 36:
189
+ case 37:
186
190
  modelClamped = _context.sent;
187
- _context.next = 42;
191
+ case 38:
192
+ _context.next = 43;
188
193
  break;
189
- case 39:
190
- _context.prev = 39;
194
+ case 40:
195
+ _context.prev = 40;
191
196
  _context.t0 = _context["catch"](33);
192
197
  modelClamped = null;
193
- case 42:
198
+ case 43:
194
199
  /* ---------------------------------- */
195
200
  /* 8. terrain fallback(只给失败点) */
196
201
  /* ---------------------------------- */
@@ -199,20 +204,20 @@ function _BuildClampedPolygonGridUnified() {
199
204
  });
200
205
  terrainClamped = null;
201
206
  if (!needTerrain) {
202
- _context.next = 50;
207
+ _context.next = 51;
203
208
  break;
204
209
  }
205
210
  cartos = JSON.parse(JSON.stringify(positions3D)).map(function (p) {
206
211
  return Cesium.Cartographic.fromCartesian(p);
207
212
  });
208
- _context.next = 48;
213
+ _context.next = 49;
209
214
  return Cesium.sampleTerrainMostDetailed(map.terrainProvider, cartos);
210
- case 48:
215
+ case 49:
211
216
  sampled = _context.sent;
212
217
  terrainClamped = sampled.map(function (c) {
213
218
  return Cesium.Cartesian3.fromRadians(c.longitude, c.latitude, c.height);
214
219
  });
215
- case 50:
220
+ case 51:
216
221
  /* ---------------------------------- */
217
222
  /* 9. 合并结果(模型优先,terrain 兜底) */
218
223
  /* ---------------------------------- */
@@ -225,21 +230,21 @@ function _BuildClampedPolygonGridUnified() {
225
230
  if (!finalPositions.some(function (p) {
226
231
  return !p;
227
232
  })) {
228
- _context.next = 54;
233
+ _context.next = 55;
229
234
  break;
230
235
  }
231
236
  console.warn('存在无法贴地/贴模型的点,已跳过该 polygon');
232
237
  return _context.abrupt("return", 1);
233
- case 54:
238
+ case 55:
234
239
  finalSource.push(_objectSpread(_objectSpread({}, source[i]), {}, {
235
240
  positions: finalPositions,
236
241
  indices: indices
237
242
  }));
238
- case 55:
243
+ case 56:
239
244
  case "end":
240
245
  return _context.stop();
241
246
  }
242
- }, _loop, null, [[33, 39]]);
247
+ }, _loop, null, [[33, 40]]);
243
248
  });
244
249
  i = 0;
245
250
  case 10: