openlayers-5 - ol-cesium:有没有办法在 ol-cesium 中选择一个特征并将其追溯到 openlayers 特征?
问题描述
我有一个 geojson 作为特征向量添加到 openlayer。其属性部分中的所有 geojson 都有一些附加信息,我想在单击 3d 空间中的功能(例如弹出窗口)时显示这些信息。我使用 ol-cesium 覆盖示例创建了一个 pop,但没有办法仅在启用 3d(ol-cesium) 的情况下获取 feature-geojson 属性。是否有任何方法可以获取单击 3d 空间中的功能的功能详细信息?
解决方案
想通了,我想我必须做一些这样的想法。
private getOlFeatureFromMouseLocationInOLCS(cesiumMouseEvent: any): OlFeature | undefined {
if (cesiumMouseEvent.position.x === 0 && cesiumMouseEvent.position.y === 0) {
return;
}
/**
//hoping the below two lines have bee defined early on .
this._ol3d = new OLCesium({ map: this._currentMap });
this.scene = this._ol3d.getCesiumScene();
**/
const pickedFeature = this.scene.pick(cesiumMouseEvent.position);
let olFeature: OlFeature;
if (pickedFeature.primitive) {
olFeature = (pickedFeature.primitive.olFeature)?pickedFeature.primitive.olFeature as OlFeature : undefined;
} else {
olFeature = undefined;
}
return olFeature;
}
推荐阅读
- amazon-web-services - 使用 --no-verify-ssl 通过 aws cli 将数据复制到 s3。安全与否?
- http - Golang 在服务器运行时得到 404
- javascript - FCM 本站已在后台更新
- react-native - 使用 Apollo 客户端和 Apollo Server 的 React Native 应用程序的 Mutation 类型的未知参数“on field”
- c++ - 使用需要函数指针的 C 库时的 C++ 习惯用法?
- c# - 测试有 null IdentityResult
- machine-learning - Keras 标记化(适合文本)
- python - 使用 SIM800c GSM 模块进行网络定位的 Python 代码
- pdf - SSRS - “打印我们将为您的报告创建一个便于打印的 PDF 版本。”
- spring - 访问 BeanDefinitionRegistryPostProcessor 中的弹簧加载属性