我有一个geojson被添加为openlayer的特征向量。在其3D空间中单击某个要素(例如弹出窗口)时,我想在其属性部分中的所有geojson中显示一些其他信息。我使用ol-cesium覆盖示例创建了一个pop,但是没有一种方法仅在启用3d(ol-cesium)的情况下获得feature-geojson属性。 单击3d空间中的特征时,是否有任何方法来获得特征详细信息?
答案 0 :(得分:0)
弄清楚了,我想我必须做些这样的思考。
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;
}