@jorgmoritz/gis-manager 0.1.26 → 0.1.27

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.
@@ -1,5 +1,5 @@
1
1
  import * as Cesium from 'cesium';
2
- import { V as VertexDetailInfo, a as VertexOperationInfo } from '../VertexDetailInfo-CProWwqv.cjs';
2
+ import { V as VertexDetailInfo, a as VertexOperationInfo } from '../VertexDetailInfo-Cz9y16HG.cjs';
3
3
 
4
4
  /**
5
5
  * 🎨 GisViewer 组件 - Vue3 声明式地图容器
@@ -1,5 +1,5 @@
1
1
  import * as Cesium from 'cesium';
2
- import { V as VertexDetailInfo, a as VertexOperationInfo } from '../VertexDetailInfo-CProWwqv.js';
2
+ import { V as VertexDetailInfo, a as VertexOperationInfo } from '../VertexDetailInfo-Cz9y16HG.js';
3
3
 
4
4
  /**
5
5
  * 🎨 GisViewer 组件 - Vue3 声明式地图容器
package/dist/vue/index.js CHANGED
@@ -2890,11 +2890,11 @@ var AirplaneCursor = class {
2890
2890
  setPos(addVec(pose.position, C.Cartesian3.multiplyByScalar(e3, step, new C.Cartesian3())));
2891
2891
  moved = true;
2892
2892
  }
2893
- if (this.keysPressed.has("z")) {
2893
+ if (this.keysPressed.has("c")) {
2894
2894
  setPos(addVec(pose.position, C.Cartesian3.multiplyByScalar(u3, step, new C.Cartesian3())));
2895
2895
  moved = true;
2896
2896
  }
2897
- if (this.keysPressed.has("c")) {
2897
+ if (this.keysPressed.has("z")) {
2898
2898
  setPos(addVec(pose.position, C.Cartesian3.multiplyByScalar(u3, -step, new C.Cartesian3())));
2899
2899
  moved = true;
2900
2900
  }
@@ -4925,6 +4925,10 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
4925
4925
  } catch {
4926
4926
  }
4927
4927
  };
4928
+ const getTotalDistance = () => {
4929
+ if (positions.length < 2) return 0;
4930
+ return calculatePathDistance(CesiumNS, positions, positions.length - 1, hiddenClimbIndex);
4931
+ };
4928
4932
  const vertexInsertionHandler = new VertexInsertionHandler({
4929
4933
  CesiumNS,
4930
4934
  layer,
@@ -4935,6 +4939,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
4935
4939
  if (!cursorStart) cursorStart = positions[hiddenClimbIndex === 1 ? 1 : 0];
4936
4940
  let airplaneCursor;
4937
4941
  const insertVertex = (insertAt, p3, poseOrient) => {
4942
+ console.log("[PathEditing] \u63D2\u5165\u9876\u70B9\u524D positions \u957F\u5EA6:", positions.length, "insertAt:", insertAt);
4938
4943
  const actualIndex = vertexInsertionHandler.insertVertex(
4939
4944
  insertAt,
4940
4945
  p3,
@@ -4950,6 +4955,8 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
4950
4955
  airplaneCursor,
4951
4956
  poseOrient
4952
4957
  );
4958
+ console.log("[PathEditing] \u63D2\u5165\u9876\u70B9\u540E positions \u957F\u5EA6:", positions.length, "actualIndex:", actualIndex);
4959
+ entity.polyline.positions = new C.CallbackProperty(() => positions.slice(), false);
4953
4960
  setActiveIndex(actualIndex);
4954
4961
  createOrUpdateMarkerForIndex(actualIndex);
4955
4962
  };
@@ -4980,6 +4987,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
4980
4987
  } catch {
4981
4988
  }
4982
4989
  }
4990
+ console.log("[PathEditing] \u5220\u9664\u9876\u70B9\u524D positions \u957F\u5EA6:", positions.length, "deleteAt:", deleteAt);
4983
4991
  positions.splice(deleteAt, 1);
4984
4992
  handles.splice(deleteAt, 1);
4985
4993
  headings.splice(deleteAt, 1);
@@ -4987,6 +4995,8 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
4987
4995
  rolls.splice(deleteAt, 1);
4988
4996
  fovs.splice(deleteAt, 1);
4989
4997
  heightMarkers.splice(deleteAt, 1);
4998
+ console.log("[PathEditing] \u5220\u9664\u9876\u70B9\u540E positions \u957F\u5EA6:", positions.length);
4999
+ entity.polyline.positions = new C.CallbackProperty(() => positions.slice(), false);
4990
5000
  const newEditedIndices = /* @__PURE__ */ new Set();
4991
5001
  editedIndices.forEach((idx) => {
4992
5002
  if (idx < deleteAt) {
@@ -5109,7 +5119,9 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5109
5119
  totalVerticesBefore: totalBefore,
5110
5120
  totalVerticesAfter: totalAfter,
5111
5121
  newVertex,
5112
- timestamp: /* @__PURE__ */ new Date()
5122
+ timestamp: /* @__PURE__ */ new Date(),
5123
+ totalDistance: getTotalDistance()
5124
+ // 🆕 航线总里程
5113
5125
  };
5114
5126
  options.onVertexInsertDetail(operationInfo);
5115
5127
  } catch (error) {
@@ -5130,7 +5142,9 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5130
5142
  displayNumber,
5131
5143
  totalVerticesBefore: totalBefore,
5132
5144
  totalVerticesAfter: totalAfter,
5133
- timestamp: /* @__PURE__ */ new Date()
5145
+ timestamp: /* @__PURE__ */ new Date(),
5146
+ totalDistance: getTotalDistance()
5147
+ // 🆕 航线总里程
5134
5148
  };
5135
5149
  options.onVertexDeleteDetail(operationInfo);
5136
5150
  } catch (error) {
@@ -5210,7 +5224,9 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5210
5224
  totalVerticesAfter: positions.length,
5211
5225
  newVertex: vertexInfo,
5212
5226
  newPosition: finalPosition,
5213
- timestamp: /* @__PURE__ */ new Date()
5227
+ timestamp: /* @__PURE__ */ new Date(),
5228
+ totalDistance: getTotalDistance()
5229
+ // 🆕 航线总里程
5214
5230
  };
5215
5231
  options.onVertexDragCompleteDetail(operationInfo);
5216
5232
  } catch (error) {
@@ -5239,6 +5255,18 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5239
5255
  );
5240
5256
  const cleanupSession = () => {
5241
5257
  setActiveIndex(void 0);
5258
+ try {
5259
+ handles.forEach((handle) => {
5260
+ if (handle) {
5261
+ try {
5262
+ layer.entities.remove(handle);
5263
+ } catch {
5264
+ }
5265
+ }
5266
+ });
5267
+ handles.length = 0;
5268
+ } catch {
5269
+ }
5242
5270
  try {
5243
5271
  heightMarkers.forEach((m) => m?.destroy());
5244
5272
  } catch {
@@ -5563,7 +5591,55 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5563
5591
  /**
5564
5592
  * 🆕 获取游标当前姿态(包含高度)
5565
5593
  */
5566
- getCursorPose: () => airplaneCursor?.getPose()
5594
+ getCursorPose: () => airplaneCursor?.getPose(),
5595
+ /**
5596
+ * 🆕 动态更新爬升高度(climbHeight)
5597
+ * 更新隐藏爬升点(index 1)的高度,实现安全飞行高度的动态调节
5598
+ * @param climbHeight 新的爬升高度(米)
5599
+ * @returns 是否更新成功
5600
+ */
5601
+ updateClimbHeight: function(climbHeight) {
5602
+ if (hiddenClimbIndex !== 1 || positions.length < 2) {
5603
+ console.warn("[updateClimbHeight] No hidden climb point exists");
5604
+ return false;
5605
+ }
5606
+ try {
5607
+ const startPos = positions[0];
5608
+ const startCarto = C.Cartographic.fromCartesian(startPos);
5609
+ const newAltitude = startCarto.height + climbHeight;
5610
+ const success = this.updateWaypointAltitude(1, newAltitude);
5611
+ if (success) {
5612
+ try {
5613
+ entity.properties._climbHeight = climbHeight;
5614
+ } catch {
5615
+ }
5616
+ console.log("[updateClimbHeight] \u2705 \u722C\u5347\u9AD8\u5EA6\u5DF2\u66F4\u65B0:", climbHeight, "\u7C73");
5617
+ }
5618
+ return success;
5619
+ } catch (error) {
5620
+ console.error("[updateClimbHeight] Error:", error);
5621
+ return false;
5622
+ }
5623
+ },
5624
+ /**
5625
+ * 🆕 获取起飞点信息
5626
+ * @returns 起飞点的经纬度和高度
5627
+ */
5628
+ getStartPoint: () => {
5629
+ if (positions.length < 1) return null;
5630
+ try {
5631
+ const startPos = positions[0];
5632
+ const carto = C.Cartographic.fromCartesian(startPos);
5633
+ return {
5634
+ position: startPos,
5635
+ latitude: C.Math.toDegrees(carto.latitude),
5636
+ longitude: C.Math.toDegrees(carto.longitude),
5637
+ altitude: carto.height
5638
+ };
5639
+ } catch {
5640
+ return null;
5641
+ }
5642
+ }
5567
5643
  };
5568
5644
  }
5569
5645
  function fovToFocalLength(fovDeg) {
@@ -5739,6 +5815,7 @@ function startPathDrawing(CesiumNS, viewer, options, onComplete) {
5739
5815
  const DEFAULT_MAIN_WIDTH = options?.width ?? 6;
5740
5816
  let startCartographic;
5741
5817
  let hasStart = false;
5818
+ let createdEntity = void 0;
5742
5819
  const getPositionFromMouse = (movement) => {
5743
5820
  const scene = viewer.scene;
5744
5821
  const winPos = movement?.position ?? movement?.endPosition ?? movement;
@@ -5839,6 +5916,7 @@ function startPathDrawing(CesiumNS, viewer, options, onComplete) {
5839
5916
  _hasHiddenClimb: climbHeight > 0
5840
5917
  }
5841
5918
  });
5919
+ createdEntity = created;
5842
5920
  try {
5843
5921
  tempHandles.forEach((hh, idx) => {
5844
5922
  try {
@@ -5875,8 +5953,21 @@ function startPathDrawing(CesiumNS, viewer, options, onComplete) {
5875
5953
  } else {
5876
5954
  editOptions.preview = { enabled: true };
5877
5955
  }
5878
- if (options?.onVertexSelectDetail) {
5879
- editOptions.onVertexSelectDetail = options.onVertexSelectDetail;
5956
+ const autoOpts = typeof auto === "object" ? auto : {};
5957
+ if (autoOpts.onVertexSelectDetail) {
5958
+ editOptions.onVertexSelectDetail = autoOpts.onVertexSelectDetail;
5959
+ }
5960
+ if (autoOpts.onVertexDragMoveDetail) {
5961
+ editOptions.onVertexDragMoveDetail = autoOpts.onVertexDragMoveDetail;
5962
+ }
5963
+ if (autoOpts.onVertexDragCompleteDetail) {
5964
+ editOptions.onVertexDragCompleteDetail = autoOpts.onVertexDragCompleteDetail;
5965
+ }
5966
+ if (autoOpts.onVertexInsertDetail) {
5967
+ editOptions.onVertexInsertDetail = autoOpts.onVertexInsertDetail;
5968
+ }
5969
+ if (autoOpts.onVertexDeleteDetail) {
5970
+ editOptions.onVertexDeleteDetail = autoOpts.onVertexDeleteDetail;
5880
5971
  }
5881
5972
  const editSession = startPathEditing(CesiumNS, viewer, created, editOptions);
5882
5973
  if (editSession && options?.onEditingStarted) {
@@ -5902,6 +5993,12 @@ function startPathDrawing(CesiumNS, viewer, options, onComplete) {
5902
5993
  handler?.destroy();
5903
5994
  } catch {
5904
5995
  }
5996
+ if (createdEntity) {
5997
+ try {
5998
+ layer.entities.remove(createdEntity);
5999
+ } catch {
6000
+ }
6001
+ }
5905
6002
  }
5906
6003
  };
5907
6004
  }