@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/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "@jorgmoritz/gis-manager",
|
|
16
|
-
version: "0.1.
|
|
16
|
+
version: "0.1.28"};
|
|
17
17
|
|
|
18
18
|
// src/utils/version.ts
|
|
19
19
|
var version = package_default.version;
|
|
@@ -6738,6 +6738,98 @@ function renderFlightPath(CesiumNS, viewer, options) {
|
|
|
6738
6738
|
}
|
|
6739
6739
|
return entity;
|
|
6740
6740
|
}
|
|
6741
|
+
function renderFlightPathPreview(CesiumNS, viewer, options) {
|
|
6742
|
+
const C = CesiumNS;
|
|
6743
|
+
const entity = renderFlightPath(CesiumNS, viewer, options);
|
|
6744
|
+
const vertexLabelManager = entity._vertexLabelManager;
|
|
6745
|
+
let selectedWaypointIndex = options.initialSelectedIndex ?? null;
|
|
6746
|
+
const polyline = entity.polyline;
|
|
6747
|
+
let positions = [];
|
|
6748
|
+
if (polyline && polyline.positions) {
|
|
6749
|
+
const posValue = polyline.positions.getValue?.(C.JulianDate.now());
|
|
6750
|
+
if (Array.isArray(posValue)) {
|
|
6751
|
+
positions = posValue;
|
|
6752
|
+
}
|
|
6753
|
+
}
|
|
6754
|
+
let waypointDataArray = [];
|
|
6755
|
+
try {
|
|
6756
|
+
const adapterOptions = {
|
|
6757
|
+
CesiumNS,
|
|
6758
|
+
...options.adapterOptions
|
|
6759
|
+
};
|
|
6760
|
+
const converted = convertSinoflyWayline(options.data, adapterOptions);
|
|
6761
|
+
if (converted && converted.waypointData) {
|
|
6762
|
+
waypointDataArray = [...converted.waypointData].sort((a, b) => a.index - b.index);
|
|
6763
|
+
}
|
|
6764
|
+
} catch (e) {
|
|
6765
|
+
console.warn("[renderFlightPathPreview] \u65E0\u6CD5\u83B7\u53D6\u822A\u70B9\u6570\u636E:", e);
|
|
6766
|
+
}
|
|
6767
|
+
const hasHiddenClimb = entity.properties?._hasHiddenClimb?.getValue?.() ?? false;
|
|
6768
|
+
const hiddenClimbIndex = hasHiddenClimb ? 1 : void 0;
|
|
6769
|
+
const updateWaypointHighlight = (newIndex) => {
|
|
6770
|
+
if (!vertexLabelManager || positions.length === 0) return;
|
|
6771
|
+
const editedIndices = /* @__PURE__ */ new Set();
|
|
6772
|
+
vertexLabelManager.recreateAllLabels(positions, editedIndices, newIndex ?? void 0);
|
|
6773
|
+
};
|
|
6774
|
+
if (selectedWaypointIndex !== null) {
|
|
6775
|
+
updateWaypointHighlight(selectedWaypointIndex);
|
|
6776
|
+
}
|
|
6777
|
+
const handler = new C.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
6778
|
+
handler.setInputAction((movement) => {
|
|
6779
|
+
const pickedObject = viewer.scene.pick(movement.position);
|
|
6780
|
+
if (C.defined(pickedObject) && pickedObject.id) {
|
|
6781
|
+
const pickedEntity = pickedObject.id;
|
|
6782
|
+
const properties = pickedEntity.properties;
|
|
6783
|
+
if (properties) {
|
|
6784
|
+
const type = properties._type?.getValue?.(C.JulianDate.now());
|
|
6785
|
+
const ownerId = properties._ownerId?.getValue?.(C.JulianDate.now());
|
|
6786
|
+
const vertexIndex = properties._vertexIndex?.getValue?.(C.JulianDate.now());
|
|
6787
|
+
if (type === "vertex-label" && ownerId === entity.id && vertexIndex !== void 0) {
|
|
6788
|
+
let displayIndex = vertexIndex;
|
|
6789
|
+
if (hiddenClimbIndex === 1) {
|
|
6790
|
+
if (vertexIndex >= 2) {
|
|
6791
|
+
displayIndex = vertexIndex - 2;
|
|
6792
|
+
}
|
|
6793
|
+
} else {
|
|
6794
|
+
displayIndex = vertexIndex;
|
|
6795
|
+
}
|
|
6796
|
+
selectedWaypointIndex = vertexIndex;
|
|
6797
|
+
updateWaypointHighlight(selectedWaypointIndex);
|
|
6798
|
+
if (options.onWaypointClick) {
|
|
6799
|
+
const waypointData = waypointDataArray.find((wp) => wp.index === vertexIndex);
|
|
6800
|
+
options.onWaypointClick(displayIndex, waypointData);
|
|
6801
|
+
}
|
|
6802
|
+
}
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6805
|
+
}, C.ScreenSpaceEventType.LEFT_CLICK);
|
|
6806
|
+
const controller = {
|
|
6807
|
+
setSelectedWaypoint: (index) => {
|
|
6808
|
+
if (index === null) {
|
|
6809
|
+
selectedWaypointIndex = null;
|
|
6810
|
+
updateWaypointHighlight(null);
|
|
6811
|
+
return;
|
|
6812
|
+
}
|
|
6813
|
+
let actualIndex = index;
|
|
6814
|
+
if (hiddenClimbIndex === 1) {
|
|
6815
|
+
actualIndex = index + 2;
|
|
6816
|
+
}
|
|
6817
|
+
selectedWaypointIndex = actualIndex;
|
|
6818
|
+
updateWaypointHighlight(selectedWaypointIndex);
|
|
6819
|
+
},
|
|
6820
|
+
getSelectedWaypoint: () => {
|
|
6821
|
+
if (selectedWaypointIndex === null) return null;
|
|
6822
|
+
if (hiddenClimbIndex === 1) {
|
|
6823
|
+
return selectedWaypointIndex >= 2 ? selectedWaypointIndex - 2 : null;
|
|
6824
|
+
}
|
|
6825
|
+
return selectedWaypointIndex;
|
|
6826
|
+
},
|
|
6827
|
+
destroy: () => {
|
|
6828
|
+
handler.destroy();
|
|
6829
|
+
}
|
|
6830
|
+
};
|
|
6831
|
+
return { entity, controller };
|
|
6832
|
+
}
|
|
6741
6833
|
|
|
6742
6834
|
// src/core/CZMLPathManager.ts
|
|
6743
6835
|
var _CZMLPathManager = class _CZMLPathManager {
|
|
@@ -6821,6 +6913,37 @@ var _CZMLPathManager = class _CZMLPathManager {
|
|
|
6821
6913
|
renderFlightPath(options) {
|
|
6822
6914
|
return renderFlightPath(this.CesiumNS, this.viewer, options);
|
|
6823
6915
|
}
|
|
6916
|
+
/**
|
|
6917
|
+
* 预览模式渲染飞航路线:支持航点点击高亮
|
|
6918
|
+
*
|
|
6919
|
+
* 与 renderFlightPath 不同,此方法返回一个控制器对象,支持:
|
|
6920
|
+
* - 航点点击事件回调
|
|
6921
|
+
* - 程序化设置选中航点(高亮显示)
|
|
6922
|
+
* - 列表与地图双向联动
|
|
6923
|
+
*
|
|
6924
|
+
* @param options 预览选项
|
|
6925
|
+
* @returns 包含实体和控制器的对象
|
|
6926
|
+
*
|
|
6927
|
+
* @example
|
|
6928
|
+
* ```typescript
|
|
6929
|
+
* const { entity, controller } = pathManager.renderFlightPathPreview({
|
|
6930
|
+
* data: sinoflyData,
|
|
6931
|
+
* onWaypointClick: (index, waypoint) => {
|
|
6932
|
+
* console.log('点击了航点', index, waypoint);
|
|
6933
|
+
* },
|
|
6934
|
+
* initialSelectedIndex: 0
|
|
6935
|
+
* });
|
|
6936
|
+
*
|
|
6937
|
+
* // 程序化设置选中航点
|
|
6938
|
+
* controller.setSelectedWaypoint(2);
|
|
6939
|
+
*
|
|
6940
|
+
* // 销毁
|
|
6941
|
+
* controller.destroy();
|
|
6942
|
+
* ```
|
|
6943
|
+
*/
|
|
6944
|
+
renderFlightPathPreview(options) {
|
|
6945
|
+
return renderFlightPathPreview(this.CesiumNS, this.viewer, options);
|
|
6946
|
+
}
|
|
6824
6947
|
resolveEntity(entityOrId) {
|
|
6825
6948
|
return typeof entityOrId === "string" ? this.viewer.entities.getById(entityOrId) : entityOrId;
|
|
6826
6949
|
}
|
|
@@ -9710,6 +9833,20 @@ var CZMLManager = class {
|
|
|
9710
9833
|
renderFlightPath(options) {
|
|
9711
9834
|
return this.pathMgr.renderFlightPath(options);
|
|
9712
9835
|
}
|
|
9836
|
+
/**
|
|
9837
|
+
* 预览模式渲染飞航路线:支持航点点击高亮
|
|
9838
|
+
*
|
|
9839
|
+
* 与 renderFlightPath 不同,此方法返回一个控制器对象,支持:
|
|
9840
|
+
* - 航点点击事件回调
|
|
9841
|
+
* - 程序化设置选中航点(高亮显示)
|
|
9842
|
+
* - 列表与地图双向联动
|
|
9843
|
+
*
|
|
9844
|
+
* @param options 预览选项
|
|
9845
|
+
* @returns 包含实体和控制器的对象
|
|
9846
|
+
*/
|
|
9847
|
+
renderFlightPathPreview(options) {
|
|
9848
|
+
return this.pathMgr.renderFlightPathPreview(options);
|
|
9849
|
+
}
|
|
9713
9850
|
addPathSample(entityOrId, sample) {
|
|
9714
9851
|
return this.pathMgr.addPathSample(entityOrId, sample);
|
|
9715
9852
|
}
|
|
@@ -10774,6 +10911,8 @@ exports.getCesiumIonToken = getCesiumIonToken;
|
|
|
10774
10911
|
exports.globalCameraEventBus = globalCameraEventBus;
|
|
10775
10912
|
exports.globalState = globalState;
|
|
10776
10913
|
exports.placeholder = placeholder;
|
|
10914
|
+
exports.renderFlightPath = renderFlightPath;
|
|
10915
|
+
exports.renderFlightPathPreview = renderFlightPathPreview;
|
|
10777
10916
|
exports.toggle2D3D = toggle2D3D;
|
|
10778
10917
|
exports.version = version;
|
|
10779
10918
|
exports.versionInfo = versionInfo;
|