3.2直接可以通过mapnode节点转坐标系,不需要判断是二维还是三维
// 通过mapNode获取到空间坐标系类
osgEarth::SpatialReference* geoSRS = mapNode->getMapSRS();
// 在 osgEarth::SpatialReference 类中,有几种获取坐标系的方式:
// 地理坐标系,一般高度。
getGeographicSRS();
// 大地测量坐标系,获取内容同上,但是z值为:大地椭球之上的z值.
// 当存在地形数据时,此方法用的较多。
getGeodeticSRS();
// 获取与此SRS椭球体关联的地心参考系。代码中,用的较少
getGeocentricSRS();
const SpatialReference* geoSRS = mapNode->getMapSRS()->getGeographicSRS();
GeoTransform* transform = new GeoTransform();
transform->setPosition(GeoPoint(geoSRS, 100, 30,1000));
transform->addChild(cow.get());
root->addChild(transform);