commit
						a9c19ea5e2
					
				@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					build
 | 
				
			||||||
 | 
					*.pro.user*
 | 
				
			||||||
 | 
					*/third_party
 | 
				
			||||||
 | 
					!*/third_party/.gitkeep
 | 
				
			||||||
@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					QT       += core gui widgets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CONFIG += c++17
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# You can make your code fail to compile if it uses deprecated APIs.
 | 
				
			||||||
 | 
					# In order to do so, uncomment the following line.
 | 
				
			||||||
 | 
					#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SOURCES += \
 | 
				
			||||||
 | 
					    main.cpp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					HEADERS +=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FORMS +=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					INCLUDEPATH += $$PWD/third_party/include
 | 
				
			||||||
 | 
					LIBS += -L$$PWD/third_party/lib -losgViewerd \
 | 
				
			||||||
 | 
					                    -losgd \
 | 
				
			||||||
 | 
					                    -losgDBd \
 | 
				
			||||||
 | 
					                    -losgUtild \
 | 
				
			||||||
 | 
					                    -losgGAd \
 | 
				
			||||||
 | 
					                    -losgEarthd \
 | 
				
			||||||
 | 
					                    -losgEarthUtild \
 | 
				
			||||||
 | 
					                    -lOpenThreadsd \
 | 
				
			||||||
 | 
					                    -losgTextd \
 | 
				
			||||||
 | 
					                    -losgEarthSymbologyd \
 | 
				
			||||||
 | 
					                    -losgEarthAnnotationd \
 | 
				
			||||||
 | 
					                    -losgEarthFeaturesd \
 | 
				
			||||||
 | 
					                    -losgFXd \
 | 
				
			||||||
 | 
					                    -losgWidgetd \
 | 
				
			||||||
 | 
					                    -losgManipulatord
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Default rules for deployment.
 | 
				
			||||||
 | 
					qnx: target.path = /tmp/$${TARGET}/bin
 | 
				
			||||||
 | 
					else: unix:!android: target.path = /opt/$${TARGET}/bin
 | 
				
			||||||
 | 
					!isEmpty(target.path): INSTALLS += target
 | 
				
			||||||
@ -0,0 +1,66 @@
 | 
				
			|||||||
 | 
					#include <osgEarth/Map>
 | 
				
			||||||
 | 
					#include <osgEarthDrivers/gdal/GDALOptions>
 | 
				
			||||||
 | 
					#include <osgEarthDrivers/mbtiles/MBTilesOptions>
 | 
				
			||||||
 | 
					#include <osgEarthUtil/EarthManipulator>
 | 
				
			||||||
 | 
					#include <osgViewer/Viewer>
 | 
				
			||||||
 | 
					#include <QString>
 | 
				
			||||||
 | 
					#include <QtGlobal>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    Q_UNUSED(argc);
 | 
				
			||||||
 | 
					    Q_UNUSED(argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    osgViewer::Viewer viewer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    viewer.setUpViewInWindow(0, 100, 800, 600);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    viewer.setReleaseContextAtEndOfFrameHint(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 添加操作器
 | 
				
			||||||
 | 
					    viewer.setCameraManipulator(new osgEarth::Util::EarthManipulator());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /// 在旧版本的osgEarth中需通过options来指定使用的哪种ImageLayer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 创建GDAL图层
 | 
				
			||||||
 | 
					    osgEarth::Drivers::GDALOptions options;
 | 
				
			||||||
 | 
					    options.url() = osgEarth::URI("D:/Code/freespace/JGisEngine/data/image_3d_globel.tif");
 | 
				
			||||||
 | 
					    osg::ref_ptr<osgEarth::ImageLayer> imagelayer = new osgEarth::ImageLayer(
 | 
				
			||||||
 | 
					        osgEarth::ImageLayerOptions("gdal", options));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 创建MB图层
 | 
				
			||||||
 | 
					    osgEarth::Drivers::MBTilesTileSourceOptions mbOpt;
 | 
				
			||||||
 | 
					    mbOpt.filename()
 | 
				
			||||||
 | 
					        = "D:/Share/Map/MBTiles/satellite-google-gcj02-zxy-all-9-sc-15-cd-18-3h-21.mbtiles";
 | 
				
			||||||
 | 
					    mbOpt.format() = "png";
 | 
				
			||||||
 | 
					    mbOpt.computeLevels() = false;
 | 
				
			||||||
 | 
					    mbOpt.maxDataLevel() = 21;
 | 
				
			||||||
 | 
					    mbOpt.minValidValue() = 4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    osg::ref_ptr<osgEarth::ImageLayer> MBImagelayer = new osgEarth::ImageLayer(
 | 
				
			||||||
 | 
					        osgEarth::ImageLayerOptions("mb", mbOpt));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //    string mbtilesFilename = "D:/codes/osgEarth-Projects/osgearth3.4/data/world_countries.mbtiles";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //    osg::ref_ptr<MBTilesImageLayer> mbtLayer = new MBTilesImageLayer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //    mbtLayer->setURL(osgEarth::URI(mbtilesFilename));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //    osgEarth::GeoExtent mbtExtent = mbtLayer->getExtent();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 添加图层到Map
 | 
				
			||||||
 | 
					    osg::ref_ptr<osgEarth::Map> map = new osgEarth::Map();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //    map->addImageLayer(imagelayer);
 | 
				
			||||||
 | 
					    map->addImageLayer(MBImagelayer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 添加Map到Node
 | 
				
			||||||
 | 
					    osg::ref_ptr<osgEarth::MapNode> mapNode = new osgEarth::MapNode(map);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 添加到场景
 | 
				
			||||||
 | 
					    viewer.setSceneData(mapNode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    viewer.realize();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return viewer.run();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					QT       += core gui widgets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CONFIG += c++17
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					HEADERS +=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SOURCES += \
 | 
				
			||||||
 | 
					    main.cpp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					INCLUDEPATH += $$PWD/third_party/include
 | 
				
			||||||
 | 
					LIBS += -L$$PWD/third_party/lib -losgViewerd \
 | 
				
			||||||
 | 
					                                -losgd \
 | 
				
			||||||
 | 
					                                -losgDBd \
 | 
				
			||||||
 | 
					                                -losgUtild \
 | 
				
			||||||
 | 
					                                -losgGAd \
 | 
				
			||||||
 | 
					                                -losgFXd \
 | 
				
			||||||
 | 
					                                -losgEarthd \
 | 
				
			||||||
 | 
					                                -lOpenThreadsd \
 | 
				
			||||||
 | 
					                                -losgTextd \
 | 
				
			||||||
 | 
					                                -losgManipulatord
 | 
				
			||||||
@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int main() {}
 | 
				
			||||||
@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					TEMPLATE = subdirs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SUBDIRS = 210 \
 | 
				
			||||||
 | 
					    320
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DEFINES += readme.md
 | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue