@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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as Cesium from 'cesium';
2
- export { V as VertexDetailInfo, b as VertexDragMoveInfo, a as VertexOperationInfo, c as WaypointBatchUpdate, W as WaypointUpdateData } from './VertexDetailInfo-CProWwqv.cjs';
2
+ export { V as VertexDetailInfo, b as VertexDragMoveInfo, a as VertexOperationInfo, c as WaypointBatchUpdate, W as WaypointUpdateData } from './VertexDetailInfo-Cz9y16HG.cjs';
3
3
 
4
4
  interface InitOptions {
5
5
  appName?: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as Cesium from 'cesium';
2
- export { V as VertexDetailInfo, b as VertexDragMoveInfo, a as VertexOperationInfo, c as WaypointBatchUpdate, W as WaypointUpdateData } from './VertexDetailInfo-CProWwqv.js';
2
+ export { V as VertexDetailInfo, b as VertexDragMoveInfo, a as VertexOperationInfo, c as WaypointBatchUpdate, W as WaypointUpdateData } from './VertexDetailInfo-Cz9y16HG.js';
3
3
 
4
4
  interface InitOptions {
5
5
  appName?: string;
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
11
11
  // package.json
12
12
  var package_default = {
13
13
  name: "@jorgmoritz/gis-manager",
14
- version: "0.1.25"};
14
+ version: "0.1.26"};
15
15
 
16
16
  // src/utils/version.ts
17
17
  var version = package_default.version;
@@ -2934,11 +2934,11 @@ var AirplaneCursor = class {
2934
2934
  setPos(addVec(pose.position, C.Cartesian3.multiplyByScalar(e3, step, new C.Cartesian3())));
2935
2935
  moved = true;
2936
2936
  }
2937
- if (this.keysPressed.has("z")) {
2937
+ if (this.keysPressed.has("c")) {
2938
2938
  setPos(addVec(pose.position, C.Cartesian3.multiplyByScalar(u3, step, new C.Cartesian3())));
2939
2939
  moved = true;
2940
2940
  }
2941
- if (this.keysPressed.has("c")) {
2941
+ if (this.keysPressed.has("z")) {
2942
2942
  setPos(addVec(pose.position, C.Cartesian3.multiplyByScalar(u3, -step, new C.Cartesian3())));
2943
2943
  moved = true;
2944
2944
  }
@@ -4969,6 +4969,10 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
4969
4969
  } catch {
4970
4970
  }
4971
4971
  };
4972
+ const getTotalDistance = () => {
4973
+ if (positions.length < 2) return 0;
4974
+ return calculatePathDistance(CesiumNS, positions, positions.length - 1, hiddenClimbIndex);
4975
+ };
4972
4976
  const vertexInsertionHandler = new VertexInsertionHandler({
4973
4977
  CesiumNS,
4974
4978
  layer,
@@ -4979,6 +4983,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
4979
4983
  if (!cursorStart) cursorStart = positions[hiddenClimbIndex === 1 ? 1 : 0];
4980
4984
  let airplaneCursor;
4981
4985
  const insertVertex = (insertAt, p3, poseOrient) => {
4986
+ console.log("[PathEditing] \u63D2\u5165\u9876\u70B9\u524D positions \u957F\u5EA6:", positions.length, "insertAt:", insertAt);
4982
4987
  const actualIndex = vertexInsertionHandler.insertVertex(
4983
4988
  insertAt,
4984
4989
  p3,
@@ -4994,6 +4999,8 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
4994
4999
  airplaneCursor,
4995
5000
  poseOrient
4996
5001
  );
5002
+ console.log("[PathEditing] \u63D2\u5165\u9876\u70B9\u540E positions \u957F\u5EA6:", positions.length, "actualIndex:", actualIndex);
5003
+ entity.polyline.positions = new C.CallbackProperty(() => positions.slice(), false);
4997
5004
  setActiveIndex(actualIndex);
4998
5005
  createOrUpdateMarkerForIndex(actualIndex);
4999
5006
  };
@@ -5024,6 +5031,7 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5024
5031
  } catch {
5025
5032
  }
5026
5033
  }
5034
+ console.log("[PathEditing] \u5220\u9664\u9876\u70B9\u524D positions \u957F\u5EA6:", positions.length, "deleteAt:", deleteAt);
5027
5035
  positions.splice(deleteAt, 1);
5028
5036
  handles.splice(deleteAt, 1);
5029
5037
  headings.splice(deleteAt, 1);
@@ -5031,6 +5039,8 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5031
5039
  rolls.splice(deleteAt, 1);
5032
5040
  fovs.splice(deleteAt, 1);
5033
5041
  heightMarkers.splice(deleteAt, 1);
5042
+ console.log("[PathEditing] \u5220\u9664\u9876\u70B9\u540E positions \u957F\u5EA6:", positions.length);
5043
+ entity.polyline.positions = new C.CallbackProperty(() => positions.slice(), false);
5034
5044
  const newEditedIndices = /* @__PURE__ */ new Set();
5035
5045
  editedIndices.forEach((idx) => {
5036
5046
  if (idx < deleteAt) {
@@ -5153,7 +5163,9 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5153
5163
  totalVerticesBefore: totalBefore,
5154
5164
  totalVerticesAfter: totalAfter,
5155
5165
  newVertex,
5156
- timestamp: /* @__PURE__ */ new Date()
5166
+ timestamp: /* @__PURE__ */ new Date(),
5167
+ totalDistance: getTotalDistance()
5168
+ // 🆕 航线总里程
5157
5169
  };
5158
5170
  options.onVertexInsertDetail(operationInfo);
5159
5171
  } catch (error) {
@@ -5174,7 +5186,9 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5174
5186
  displayNumber,
5175
5187
  totalVerticesBefore: totalBefore,
5176
5188
  totalVerticesAfter: totalAfter,
5177
- timestamp: /* @__PURE__ */ new Date()
5189
+ timestamp: /* @__PURE__ */ new Date(),
5190
+ totalDistance: getTotalDistance()
5191
+ // 🆕 航线总里程
5178
5192
  };
5179
5193
  options.onVertexDeleteDetail(operationInfo);
5180
5194
  } catch (error) {
@@ -5254,7 +5268,9 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5254
5268
  totalVerticesAfter: positions.length,
5255
5269
  newVertex: vertexInfo,
5256
5270
  newPosition: finalPosition,
5257
- timestamp: /* @__PURE__ */ new Date()
5271
+ timestamp: /* @__PURE__ */ new Date(),
5272
+ totalDistance: getTotalDistance()
5273
+ // 🆕 航线总里程
5258
5274
  };
5259
5275
  options.onVertexDragCompleteDetail(operationInfo);
5260
5276
  } catch (error) {
@@ -5283,6 +5299,18 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5283
5299
  );
5284
5300
  const cleanupSession = () => {
5285
5301
  setActiveIndex(void 0);
5302
+ try {
5303
+ handles.forEach((handle) => {
5304
+ if (handle) {
5305
+ try {
5306
+ layer.entities.remove(handle);
5307
+ } catch {
5308
+ }
5309
+ }
5310
+ });
5311
+ handles.length = 0;
5312
+ } catch {
5313
+ }
5286
5314
  try {
5287
5315
  heightMarkers.forEach((m) => m?.destroy());
5288
5316
  } catch {
@@ -5607,7 +5635,55 @@ function startPathEditing(CesiumNS, viewer, entityOrId, options) {
5607
5635
  /**
5608
5636
  * 🆕 获取游标当前姿态(包含高度)
5609
5637
  */
5610
- getCursorPose: () => airplaneCursor?.getPose()
5638
+ getCursorPose: () => airplaneCursor?.getPose(),
5639
+ /**
5640
+ * 🆕 动态更新爬升高度(climbHeight)
5641
+ * 更新隐藏爬升点(index 1)的高度,实现安全飞行高度的动态调节
5642
+ * @param climbHeight 新的爬升高度(米)
5643
+ * @returns 是否更新成功
5644
+ */
5645
+ updateClimbHeight: function(climbHeight) {
5646
+ if (hiddenClimbIndex !== 1 || positions.length < 2) {
5647
+ console.warn("[updateClimbHeight] No hidden climb point exists");
5648
+ return false;
5649
+ }
5650
+ try {
5651
+ const startPos = positions[0];
5652
+ const startCarto = C.Cartographic.fromCartesian(startPos);
5653
+ const newAltitude = startCarto.height + climbHeight;
5654
+ const success = this.updateWaypointAltitude(1, newAltitude);
5655
+ if (success) {
5656
+ try {
5657
+ entity.properties._climbHeight = climbHeight;
5658
+ } catch {
5659
+ }
5660
+ console.log("[updateClimbHeight] \u2705 \u722C\u5347\u9AD8\u5EA6\u5DF2\u66F4\u65B0:", climbHeight, "\u7C73");
5661
+ }
5662
+ return success;
5663
+ } catch (error) {
5664
+ console.error("[updateClimbHeight] Error:", error);
5665
+ return false;
5666
+ }
5667
+ },
5668
+ /**
5669
+ * 🆕 获取起飞点信息
5670
+ * @returns 起飞点的经纬度和高度
5671
+ */
5672
+ getStartPoint: () => {
5673
+ if (positions.length < 1) return null;
5674
+ try {
5675
+ const startPos = positions[0];
5676
+ const carto = C.Cartographic.fromCartesian(startPos);
5677
+ return {
5678
+ position: startPos,
5679
+ latitude: C.Math.toDegrees(carto.latitude),
5680
+ longitude: C.Math.toDegrees(carto.longitude),
5681
+ altitude: carto.height
5682
+ };
5683
+ } catch {
5684
+ return null;
5685
+ }
5686
+ }
5611
5687
  };
5612
5688
  }
5613
5689
  function fovToFocalLength(fovDeg) {
@@ -5783,6 +5859,7 @@ function startPathDrawing(CesiumNS, viewer, options, onComplete) {
5783
5859
  const DEFAULT_MAIN_WIDTH = options?.width ?? 6;
5784
5860
  let startCartographic;
5785
5861
  let hasStart = false;
5862
+ let createdEntity = void 0;
5786
5863
  const getPositionFromMouse = (movement) => {
5787
5864
  const scene = viewer.scene;
5788
5865
  const winPos = movement?.position ?? movement?.endPosition ?? movement;
@@ -5883,6 +5960,7 @@ function startPathDrawing(CesiumNS, viewer, options, onComplete) {
5883
5960
  _hasHiddenClimb: climbHeight > 0
5884
5961
  }
5885
5962
  });
5963
+ createdEntity = created;
5886
5964
  try {
5887
5965
  tempHandles.forEach((hh, idx) => {
5888
5966
  try {
@@ -5919,8 +5997,21 @@ function startPathDrawing(CesiumNS, viewer, options, onComplete) {
5919
5997
  } else {
5920
5998
  editOptions.preview = { enabled: true };
5921
5999
  }
5922
- if (options?.onVertexSelectDetail) {
5923
- editOptions.onVertexSelectDetail = options.onVertexSelectDetail;
6000
+ const autoOpts = typeof auto === "object" ? auto : {};
6001
+ if (autoOpts.onVertexSelectDetail) {
6002
+ editOptions.onVertexSelectDetail = autoOpts.onVertexSelectDetail;
6003
+ }
6004
+ if (autoOpts.onVertexDragMoveDetail) {
6005
+ editOptions.onVertexDragMoveDetail = autoOpts.onVertexDragMoveDetail;
6006
+ }
6007
+ if (autoOpts.onVertexDragCompleteDetail) {
6008
+ editOptions.onVertexDragCompleteDetail = autoOpts.onVertexDragCompleteDetail;
6009
+ }
6010
+ if (autoOpts.onVertexInsertDetail) {
6011
+ editOptions.onVertexInsertDetail = autoOpts.onVertexInsertDetail;
6012
+ }
6013
+ if (autoOpts.onVertexDeleteDetail) {
6014
+ editOptions.onVertexDeleteDetail = autoOpts.onVertexDeleteDetail;
5924
6015
  }
5925
6016
  const editSession = startPathEditing(CesiumNS, viewer, created, editOptions);
5926
6017
  if (editSession && options?.onEditingStarted) {
@@ -5946,6 +6037,12 @@ function startPathDrawing(CesiumNS, viewer, options, onComplete) {
5946
6037
  handler?.destroy();
5947
6038
  } catch {
5948
6039
  }
6040
+ if (createdEntity) {
6041
+ try {
6042
+ layer.entities.remove(createdEntity);
6043
+ } catch {
6044
+ }
6045
+ }
5949
6046
  }
5950
6047
  };
5951
6048
  }