@jorgmoritz/gis-manager 0.1.28 → 0.1.29
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.cjs +140 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +139 -1
- package/dist/index.d.ts +139 -1
- package/dist/index.js +139 -2
- package/dist/index.js.map +1 -1
- package/dist/vue/index.cjs +137 -0
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +137 -0
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/vue/index.cjs
CHANGED
|
@@ -6676,6 +6676,98 @@ function renderFlightPath(CesiumNS, viewer, options) {
|
|
|
6676
6676
|
}
|
|
6677
6677
|
return entity;
|
|
6678
6678
|
}
|
|
6679
|
+
function renderFlightPathPreview(CesiumNS, viewer, options) {
|
|
6680
|
+
const C = CesiumNS;
|
|
6681
|
+
const entity = renderFlightPath(CesiumNS, viewer, options);
|
|
6682
|
+
const vertexLabelManager = entity._vertexLabelManager;
|
|
6683
|
+
let selectedWaypointIndex = options.initialSelectedIndex ?? null;
|
|
6684
|
+
const polyline = entity.polyline;
|
|
6685
|
+
let positions = [];
|
|
6686
|
+
if (polyline && polyline.positions) {
|
|
6687
|
+
const posValue = polyline.positions.getValue?.(C.JulianDate.now());
|
|
6688
|
+
if (Array.isArray(posValue)) {
|
|
6689
|
+
positions = posValue;
|
|
6690
|
+
}
|
|
6691
|
+
}
|
|
6692
|
+
let waypointDataArray = [];
|
|
6693
|
+
try {
|
|
6694
|
+
const adapterOptions = {
|
|
6695
|
+
CesiumNS,
|
|
6696
|
+
...options.adapterOptions
|
|
6697
|
+
};
|
|
6698
|
+
const converted = convertSinoflyWayline(options.data, adapterOptions);
|
|
6699
|
+
if (converted && converted.waypointData) {
|
|
6700
|
+
waypointDataArray = [...converted.waypointData].sort((a, b) => a.index - b.index);
|
|
6701
|
+
}
|
|
6702
|
+
} catch (e) {
|
|
6703
|
+
console.warn("[renderFlightPathPreview] \u65E0\u6CD5\u83B7\u53D6\u822A\u70B9\u6570\u636E:", e);
|
|
6704
|
+
}
|
|
6705
|
+
const hasHiddenClimb = entity.properties?._hasHiddenClimb?.getValue?.() ?? false;
|
|
6706
|
+
const hiddenClimbIndex = hasHiddenClimb ? 1 : void 0;
|
|
6707
|
+
const updateWaypointHighlight = (newIndex) => {
|
|
6708
|
+
if (!vertexLabelManager || positions.length === 0) return;
|
|
6709
|
+
const editedIndices = /* @__PURE__ */ new Set();
|
|
6710
|
+
vertexLabelManager.recreateAllLabels(positions, editedIndices, newIndex ?? void 0);
|
|
6711
|
+
};
|
|
6712
|
+
if (selectedWaypointIndex !== null) {
|
|
6713
|
+
updateWaypointHighlight(selectedWaypointIndex);
|
|
6714
|
+
}
|
|
6715
|
+
const handler = new C.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
6716
|
+
handler.setInputAction((movement) => {
|
|
6717
|
+
const pickedObject = viewer.scene.pick(movement.position);
|
|
6718
|
+
if (C.defined(pickedObject) && pickedObject.id) {
|
|
6719
|
+
const pickedEntity = pickedObject.id;
|
|
6720
|
+
const properties = pickedEntity.properties;
|
|
6721
|
+
if (properties) {
|
|
6722
|
+
const type = properties._type?.getValue?.(C.JulianDate.now());
|
|
6723
|
+
const ownerId = properties._ownerId?.getValue?.(C.JulianDate.now());
|
|
6724
|
+
const vertexIndex = properties._vertexIndex?.getValue?.(C.JulianDate.now());
|
|
6725
|
+
if (type === "vertex-label" && ownerId === entity.id && vertexIndex !== void 0) {
|
|
6726
|
+
let displayIndex = vertexIndex;
|
|
6727
|
+
if (hiddenClimbIndex === 1) {
|
|
6728
|
+
if (vertexIndex >= 2) {
|
|
6729
|
+
displayIndex = vertexIndex - 2;
|
|
6730
|
+
}
|
|
6731
|
+
} else {
|
|
6732
|
+
displayIndex = vertexIndex;
|
|
6733
|
+
}
|
|
6734
|
+
selectedWaypointIndex = vertexIndex;
|
|
6735
|
+
updateWaypointHighlight(selectedWaypointIndex);
|
|
6736
|
+
if (options.onWaypointClick) {
|
|
6737
|
+
const waypointData = waypointDataArray.find((wp) => wp.index === vertexIndex);
|
|
6738
|
+
options.onWaypointClick(displayIndex, waypointData);
|
|
6739
|
+
}
|
|
6740
|
+
}
|
|
6741
|
+
}
|
|
6742
|
+
}
|
|
6743
|
+
}, C.ScreenSpaceEventType.LEFT_CLICK);
|
|
6744
|
+
const controller = {
|
|
6745
|
+
setSelectedWaypoint: (index) => {
|
|
6746
|
+
if (index === null) {
|
|
6747
|
+
selectedWaypointIndex = null;
|
|
6748
|
+
updateWaypointHighlight(null);
|
|
6749
|
+
return;
|
|
6750
|
+
}
|
|
6751
|
+
let actualIndex = index;
|
|
6752
|
+
if (hiddenClimbIndex === 1) {
|
|
6753
|
+
actualIndex = index + 2;
|
|
6754
|
+
}
|
|
6755
|
+
selectedWaypointIndex = actualIndex;
|
|
6756
|
+
updateWaypointHighlight(selectedWaypointIndex);
|
|
6757
|
+
},
|
|
6758
|
+
getSelectedWaypoint: () => {
|
|
6759
|
+
if (selectedWaypointIndex === null) return null;
|
|
6760
|
+
if (hiddenClimbIndex === 1) {
|
|
6761
|
+
return selectedWaypointIndex >= 2 ? selectedWaypointIndex - 2 : null;
|
|
6762
|
+
}
|
|
6763
|
+
return selectedWaypointIndex;
|
|
6764
|
+
},
|
|
6765
|
+
destroy: () => {
|
|
6766
|
+
handler.destroy();
|
|
6767
|
+
}
|
|
6768
|
+
};
|
|
6769
|
+
return { entity, controller };
|
|
6770
|
+
}
|
|
6679
6771
|
|
|
6680
6772
|
// src/core/CZMLPathManager.ts
|
|
6681
6773
|
var _CZMLPathManager = class _CZMLPathManager {
|
|
@@ -6759,6 +6851,37 @@ var _CZMLPathManager = class _CZMLPathManager {
|
|
|
6759
6851
|
renderFlightPath(options) {
|
|
6760
6852
|
return renderFlightPath(this.CesiumNS, this.viewer, options);
|
|
6761
6853
|
}
|
|
6854
|
+
/**
|
|
6855
|
+
* 预览模式渲染飞航路线:支持航点点击高亮
|
|
6856
|
+
*
|
|
6857
|
+
* 与 renderFlightPath 不同,此方法返回一个控制器对象,支持:
|
|
6858
|
+
* - 航点点击事件回调
|
|
6859
|
+
* - 程序化设置选中航点(高亮显示)
|
|
6860
|
+
* - 列表与地图双向联动
|
|
6861
|
+
*
|
|
6862
|
+
* @param options 预览选项
|
|
6863
|
+
* @returns 包含实体和控制器的对象
|
|
6864
|
+
*
|
|
6865
|
+
* @example
|
|
6866
|
+
* ```typescript
|
|
6867
|
+
* const { entity, controller } = pathManager.renderFlightPathPreview({
|
|
6868
|
+
* data: sinoflyData,
|
|
6869
|
+
* onWaypointClick: (index, waypoint) => {
|
|
6870
|
+
* console.log('点击了航点', index, waypoint);
|
|
6871
|
+
* },
|
|
6872
|
+
* initialSelectedIndex: 0
|
|
6873
|
+
* });
|
|
6874
|
+
*
|
|
6875
|
+
* // 程序化设置选中航点
|
|
6876
|
+
* controller.setSelectedWaypoint(2);
|
|
6877
|
+
*
|
|
6878
|
+
* // 销毁
|
|
6879
|
+
* controller.destroy();
|
|
6880
|
+
* ```
|
|
6881
|
+
*/
|
|
6882
|
+
renderFlightPathPreview(options) {
|
|
6883
|
+
return renderFlightPathPreview(this.CesiumNS, this.viewer, options);
|
|
6884
|
+
}
|
|
6762
6885
|
resolveEntity(entityOrId) {
|
|
6763
6886
|
return typeof entityOrId === "string" ? this.viewer.entities.getById(entityOrId) : entityOrId;
|
|
6764
6887
|
}
|
|
@@ -9648,6 +9771,20 @@ var CZMLManager = class {
|
|
|
9648
9771
|
renderFlightPath(options) {
|
|
9649
9772
|
return this.pathMgr.renderFlightPath(options);
|
|
9650
9773
|
}
|
|
9774
|
+
/**
|
|
9775
|
+
* 预览模式渲染飞航路线:支持航点点击高亮
|
|
9776
|
+
*
|
|
9777
|
+
* 与 renderFlightPath 不同,此方法返回一个控制器对象,支持:
|
|
9778
|
+
* - 航点点击事件回调
|
|
9779
|
+
* - 程序化设置选中航点(高亮显示)
|
|
9780
|
+
* - 列表与地图双向联动
|
|
9781
|
+
*
|
|
9782
|
+
* @param options 预览选项
|
|
9783
|
+
* @returns 包含实体和控制器的对象
|
|
9784
|
+
*/
|
|
9785
|
+
renderFlightPathPreview(options) {
|
|
9786
|
+
return this.pathMgr.renderFlightPathPreview(options);
|
|
9787
|
+
}
|
|
9651
9788
|
addPathSample(entityOrId, sample) {
|
|
9652
9789
|
return this.pathMgr.addPathSample(entityOrId, sample);
|
|
9653
9790
|
}
|