跟进代码。 首先osgearthviewer程序加载earth的方式分为两种: 1.根据earth文件(load方式) 2.使用SDK加载(create方式) 我们使用earth文件是load方式,直接看load函数,定位到这个位置 //load an earth file, and support all or our example command-line options//and earth file <external> tagsosg::Node* node =...
跟进代码。 首先osgearthviewer程序加载earth的方式分为两种: 1.根据earth文件(load方式) 2.使用SDK加载(create方式) 我们使用earth文件是load方式,直接看load函数,定位到这个位置 //load an earth file, and support all or our example command-line options//and earth file <external> tagsosg::Node* node =...
url() = "D:/Work/SinianGIS/bin/Resource/baseMap.jpg"; osg::ref_ptr<osgEarth::ImageLayer> imgLayer = new osgEarth::ImageLayer("BlueMarble", gdal); map->addLayer(imgLayer); AddModel(map, mapNode); osgViewer::Viewer viewer; viewer.getCamera()->setClearColor(osg::Vec4(0, 0, 0,...
具体的实现代码如下: #include <Windows.h>#include <iostream>#include <string>#include <osgViewer/Viewer>#include <osgDB/ReadFile>#include <osgEarth/MapNode>#include <osgEarthDrivers/gdal/GDALOptions>#include <osgEarthDrivers/cache_filesystem/FileSystemCache>#include <osgEarth/ImageLayer>#include <...
osgViewer::Viewer* GetViewer(); private: HWND m_hWnd; osg::ref_ptr<osgViewer::Viewer> m_viewer; osg::ref_ptr<osg::Group> m_root; osg::ref_ptr<osgEarth::MapNode> m_mapNode; osg::ref_ptr<osgEarth::EarthManipulator> m_em; ...
拷贝后目录结构如下: 打开命令行,进入D:\codes\osgEarth-Projects\osgearth3.4\build\bin\Release 执行命令 .\osgearth_viewer.exe ..\tests\simple.earth 一切顺利的话会出现地球如下: 【done】即使是第二次编译安装,仍然大约花了8个小时的时间。祝大家好运。
osg::ref_ptr<osgEarth::MapNode> rootMapNode = new osgEarth::MapNode(rootMap.get()); rootMap->addLayer(gdalLayer); rootMap->addLayer(someLayer); viewer.setSceneData(rootMapNode); //? what return Metrics::run(viewer); } 【done】...
在OsgEarth27程序目录中,找到运行程序"IxEarthViewer.exe"文件所在目录(例如:C:\OsgEarth27\Bin\ReleaseWin32),如下图所示。运行程序文件 复制"IxEarthViewer.exe"文件所在目录路径,这样可以方便在命令窗口中快速粘贴目录位置,然后输入"IxEarthViewer.exe ../map.earth"命令,如下图所示。输入命令 执行命令...
这段代码首先包含了必要的头文件,然后创建了一个Viewer对象。通过调用Viewer的setSceneData方法,并传入osgDB::readNodeFile函数的结果,我们可以加载并设置场景数据。最后,调用Viewer的run方法开始渲染和显示场景。在这个例子中,我们假设存在一个名为"tree.osg"的场景文件,它包含了构建场景所需的各种节点和属性。4 ...
osgViewer::Viewer viewer; viewer.setSceneData(mapNode); osg::ref_ptr< osgEarth::Util::EarthManipulator> mainManipulator = new osgEarth::Util::EarthManipulator; viewer.setCameraManipulator(mainManipulator); viewer.setUpViewInWindow(100, 100, 800, 600); ...