|
struct QueryElevationHandler : public osgGA::GUIEventHandler
{
bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
if (ea.getEventType() == ea.MOVE || ea.getEventType() == ea.DRAG)
{
osg::Vec3d world;
//得到世界坐标
if ( _mapNode->getTerrain()->getWorldCoordsUnderMouse(aa.asView(), ea.getX(), ea.getY(), world) )
{
//得到经纬高,map.x(),map.y(),map.z();
GeoPoint map;
map.fromWorld( _mapNode->getMapSRS(), world );
}
}
return false;
}
}; |
|