近日把一个开源项目SinianGIS移植到3.1版本的OsgEarth,升级过程中总结了一些2.x升级到3.1版本的注意事项。
2.x | 3.1 |
(Symbology, Annotations, Features)引用路径变化 | 原来的osgEarth::Symbology::xxx 更改为osgEarth::xxx |
fast_map | UnorderedMap |
TerrainEffects | 被移除 |
getProfile() | getTilingProfile() |
new ImageLayer | ImageLayer::create 或者 new ImageLayer |
ImageLayerOptions | ImageLayer::Options |
MapNodeOptions | MapNode::Options |
LabelSource、MapFrame | 被移除 |
FeatureSourceFactory / OGRFeatureOptions | OGRFeatureSource (osgearth_callouts sample) osg::ref_ptr<OGRFeatureSource> featureData = new OGRFeatureSource(); |
Map::isGeocentric() | MapNode::isGeocentric() |
TerrainLayer | TileLayer/TileSourceImageLayer/TileSourceElevationLayer... |
earth file: <sky> | <sky_simple> |
osgQt | osgQOpenGL |
osgEarthDrivers/gdal osgEarthDrivers/bing osgEarthDrivers/arcgis osgEarthDrivers/FeatureSourceLayer | osgEarth/Gdal osgEarth/Bing osgEarth/ArcGISServer osgEarth/FeatureSource |
oe_VP->heading() = heading.toDouble(); oe_VP->pitch() = pitch.toDouble(); oe_VP->range() = range.toDouble(); | vp->setHeading(Angle(0, Units::BAM)); vp->setPitch(Angle(-90, Units::BAM)); vp->setRange(Distance(16000, Units::METERS)); 需引用using namespace osgEarth::Util; |
3.1发现的问题:
打开光照会出现光照不均匀显示
https://github.com/gwaldron/osgearth/issues/1699
解决方法:
Osg编译时打开GL3编译开关,\include\osg\GL头文件加入:
#define OSG_GL3_AVAILABLE
项目源码:
osgEarthTest: osgEarth3.1与各种UI框架集成的示例代码 (gitee.com)
效果图: