Changeset 4305 for trunk/packages


Ignore:
Timestamp:
Mar 31, 2014 5:30:04 PM (10 years ago)
Author:
ldelgass
Message:

Fix(?) middle/right mouse interaction through the hub, seems an Alt modifier is
added to these mouse events, so add bindings that recognize the modifier.

Location:
trunk/packages/vizservers/geovis
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/geovis/Renderer.cpp

    r4293 r4305  
    1010#include <cassert>
    1111#include <cmath>
     12#include <cstdlib>
    1213
    1314#include <GL/gl.h>
     
    1819
    1920#include <osgGA/StateSetManipulator>
     21#include <osgGA/GUIEventAdapter>
    2022
    2123#include <osgEarth/Version>
     
    6264    _minFrameTime = 1.0/30.0;
    6365    _lastFrameTime = _minFrameTime;
     66
     67    char *base = getenv("MAP_BASE_URI");
     68    if (base != NULL) {
     69        _baseURI = base;
     70        TRACE("Setting base URI: %s", _baseURI.c_str());
     71    }
    6472
    6573#if 0
     
    8593    _viewer->setSceneData(_sceneRoot.get());
    8694
    87     _manipulator = new osgEarth::Util::EarthManipulator;
    88     _viewer->setCameraManipulator(_manipulator.get());
     95    initEarthManipulator();
    8996
    9097    _coordsCallback = new MouseCoordsCallback();
     
    251258}
    252259
     260void Renderer::initEarthManipulator()
     261{
     262    _manipulator = new osgEarth::Util::EarthManipulator;
     263    osgEarth::Util::EarthManipulator::Settings *settings = _manipulator->getSettings();
     264    settings->bindMouse(osgEarth::Util::EarthManipulator::ACTION_ROTATE,
     265                        osgGA::GUIEventAdapter::MIDDLE_MOUSE_BUTTON,
     266                        osgGA::GUIEventAdapter::MODKEY_ALT);
     267    osgEarth::Util::EarthManipulator::ActionOptions options;
     268    options.clear();
     269    options.add(osgEarth::Util::EarthManipulator::OPTION_CONTINUOUS, true);
     270    settings->bindMouse(osgEarth::Util::EarthManipulator::ACTION_ZOOM,
     271                        osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON,
     272                        osgGA::GUIEventAdapter::MODKEY_ALT, options);
     273    _manipulator->applySettings(settings);
     274    _viewer->setCameraManipulator(_manipulator.get());
     275    _manipulator->setNode(NULL);
     276    _manipulator->setNode(_sceneRoot.get());
     277    _manipulator->computeHomePosition();
     278}
     279
    253280void Renderer::loadEarthFile(const char *path)
    254281{
     
    287314    }
    288315    _viewer->setSceneData(_sceneRoot.get());
    289     _manipulator = new osgEarth::Util::EarthManipulator;
    290     _viewer->setCameraManipulator(_manipulator.get());
    291     _manipulator->setNode(NULL);
    292     _manipulator->setNode(_sceneRoot.get());
    293     _manipulator->computeHomePosition();
     316    initEarthManipulator();
    294317    _viewer->home();
    295318    finalizeViewer();
     
    332355    initViewer();
    333356
     357    //mapOpts.referenceURI() = _baseURI;
    334358    osgEarth::Map *map = new osgEarth::Map(mapOpts);
    335359    _map = map;
     
    384408    }
    385409    _viewer->setSceneData(_sceneRoot.get());
    386     _manipulator = new osgEarth::Util::EarthManipulator;
    387     _viewer->setCameraManipulator(_manipulator.get());
    388     _manipulator->setNode(NULL);
    389     _manipulator->setNode(_sceneRoot.get());
    390     _manipulator->computeHomePosition();
     410    initEarthManipulator();
    391411    _viewer->home();
    392412
     
    454474        }
    455475    } else {
    456         ERROR("Can't get terrain lighting uniform");
     476        ERROR("Can't find terrain engine container");
    457477    }
    458478#else
  • trunk/packages/vizservers/geovis/Renderer.h

    r4297 r4305  
    336336    void finalizeViewer();
    337337
     338    void initEarthManipulator();
     339
    338340    void initColorMaps();
    339341
     
    354356
    355357    ColorMapHashmap _colorMaps;
     358
     359    std::string _baseURI;
    356360
    357361    osg::ref_ptr<osg::Node> _sceneRoot;
  • trunk/packages/vizservers/geovis/RendererCmd.cpp

    r4299 r4305  
    634634        ls->stroke()->color() = osgEarth::Symbology::Color::Black;
    635635        ls->stroke()->width() = 2.0f;
    636 
     636#if 0
     637        osgEarth::Symbology::AltitudeSymbol *alt = style.getOrCreateSymbol<osgEarth::Symbology::AltitudeSymbol>();
     638        alt->clamping() = osgEarth::Symbology::AltitudeSymbol::CLAMP_TO_TERRAIN;
     639        //alt->technique() = osgEarth::Symbology::AltitudeSymbol::TECHNIQUE_DRAPE;
     640        alt->technique() = osgEarth::Symbology::AltitudeSymbol::TECHNIQUE_GPU;
     641#endif
     642#if 1
    637643        osgEarth::Symbology::RenderSymbol* rs = style.getOrCreateSymbol<osgEarth::Symbology::RenderSymbol>();
    638644        rs->depthOffset()->enabled() = true;
    639645        rs->depthOffset()->minBias() = 1000;
    640 
     646#endif
    641647        osgEarth::Drivers::FeatureGeomModelOptions geomOpts;
    642648        geomOpts.featureOptions() = opts;
Note: See TracChangeset for help on using the changeset viewer.