Ignore:
Timestamp:
Sep 18, 2014 2:01:56 PM (6 years ago)
Author:
ldelgass
Message:

Add resources directory command line option, preliminary testing of new map
coords syntax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/Renderer.cpp

    r4632 r4635  
    7878     (((t2).tv_sec - (t1).tv_sec))*1.0e+3 + (double)((t2).tv_usec - (t1).tv_usec)/1.0e+3)
    7979
    80 #define BASE_IMAGE "/usr/share/osgearth/data/world.tif"
    81 #define PIN_ICON "/usr/share/osgearth/data/placemark32.png"
     80#define BASE_IMAGE "world.tif"
     81#define PIN_ICON "placemark32.png"
    8282
    8383using namespace GeoVis;
     
    107107        TRACE("Setting base URI: %s", _baseURI.c_str());
    108108    }
    109 
    110 #if 0
    111     initViewer();
    112 
    113     osgEarth::MapOptions mapOpts;
    114     mapOpts.coordSysType() = osgEarth::MapOptions::CSTYPE_PROJECTED;
    115     mapOpts.profile() = osgEarth::ProfileOptions("global-mercator");
    116     osgEarth::Map *map = new osgEarth::Map(mapOpts);
    117     _map = map;
    118     osgEarth::Drivers::GDALOptions bopts;
    119     bopts.url() = BASE_IMAGE;
    120     addImageLayer("base", bopts);
    121 #ifdef USE_OSGEARTH_TRUNK
    122     osgEarth::Drivers::MPTerrainEngine::MPTerrainEngineOptions mpOpt;
    123 #else
    124     osgEarth::Drivers::MPTerrainEngineOptions mpOpt;
    125 #endif
    126     // Set background layer color
    127     mpOpt.color() = osg::Vec4(1, 1, 1, 1);
    128     //mpOpt.minLOD() = 1;
    129     osgEarth::MapNodeOptions mapNodeOpts(mpOpt);
    130     mapNodeOpts.enableLighting() = false;
    131     osgEarth::MapNode *mapNode = new osgEarth::MapNode(map, mapNodeOpts);
    132     _mapNode = mapNode;
    133     _sceneRoot = new osg::Group;
    134     _sceneRoot->addChild(mapNode);
    135     _viewer->setSceneData(_sceneRoot.get());
    136 
    137     initEarthManipulator();
    138     initControls();
    139 
    140     finalizeViewer();
    141 #endif
    142 
    143 #ifdef DEBUG
    144     if (_viewer.valid() && _viewer->getViewerStats() != NULL) {
    145         TRACE("Enabling stats");
    146         _viewer->getViewerStats()->collectStats("scene", true);
    147     }
    148 #endif
    149 #if 0
    150     if (_viewer.valid()) {
    151         osgViewer::ViewerBase::Windows windows;
    152         _viewer->getWindows(windows);
    153         if (windows.size() == 1) {
    154             windows[0]->setSyncToVBlank(false);
    155         } else {
    156             ERROR("Num windows: %lu", windows.size());
    157         }
    158     }
    159 #endif
    160109}
    161110
     
    179128
    180129    TRACE("Leave");
     130}
     131
     132std::string Renderer::getBaseImage()
     133{
     134    std::ostringstream oss;
     135    oss << _resourcePath << "/" << BASE_IMAGE;
     136    return oss.str();
     137}
     138
     139std::string Renderer::getPinIcon()
     140{
     141    std::ostringstream oss;
     142    oss << _resourcePath << "/" << PIN_ICON;
     143    return oss.str();
    181144}
    182145
     
    301264    _viewer->addEventHandler(_stateManip);
    302265    //_viewer->addEventHandler(new osgViewer::StatsHandler());
     266
     267#ifdef DEBUG
     268    if (_viewer->getViewerStats() != NULL) {
     269        TRACE("Enabling stats");
     270        _viewer->getViewerStats()->collectStats("scene", true);
     271    }
     272#endif
     273#if 0
     274    osgViewer::ViewerBase::Windows windows;
     275    _viewer->getWindows(windows);
     276    if (windows.size() == 1) {
     277        windows[0]->setSyncToVBlank(false);
     278    } else {
     279        ERROR("Num windows: %lu", windows.size());
     280    }
     281#endif
    303282}
    304283
     
    709688    _map = map;
    710689    osgEarth::Drivers::GDALOptions bopts;
    711     bopts.url() = BASE_IMAGE;
     690    bopts.url() = getBaseImage();
    712691    addImageLayer("base", bopts);
    713692#ifdef USE_OSGEARTH_TRUNK
     
    12551234
    12561235    osgEarth::Symbology::Style pin;
    1257     pin.getOrCreate<osgEarth::Symbology::IconSymbol>()->url()->setLiteral(PIN_ICON);
     1236    pin.getOrCreate<osgEarth::Symbology::IconSymbol>()->url()->setLiteral(getPinIcon());
    12581237    osgEarth::Annotation::AnnotationNode *anno = new osgEarth::Annotation::PlaceNode(_mapNode, osgEarth::GeoPoint(geoSRS, longitude, latitude), labelText, pin);
    12591238    _placeNodes->addChild(anno);
Note: See TracChangeset for help on using the changeset viewer.