Changeset 4282 for trunk/packages


Ignore:
Timestamp:
Mar 27, 2014, 7:17:47 PM (11 years ago)
Author:
ldelgass
Message:

Add some tests for NULL pointers, fix argument indices in map terain linecolor
(still not implemented)

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

Legend:

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

    r4273 r4282  
    2929#include <osgEarth/ModelLayer>
    3030#include <osgEarthUtil/EarthManipulator>
     31#if OSGEARTH_MIN_VERSION_REQUIRED(2, 5, 1)
     32#include <osgEarthUtil/Sky>
     33#else
     34#include <osgEarthUtil/SkyNode>
     35#endif
    3136#include <osgEarthUtil/AutoClipPlaneHandler>
    3237#include <osgEarthUtil/MouseCoordsTool>
     
    6368    _captureCallback = new ScreenCaptureCallback();
    6469    _viewer->getCamera()->setPostDrawCallback(_captureCallback.get());
     70#if 1
    6571    osgEarth::MapOptions mapOpts;
    6672    mapOpts.coordSysType() = osgEarth::MapOptions::CSTYPE_PROJECTED;
     
    8995    _mouseCoordsTool->addCallback(_coordsCallback);
    9096    _viewer->addEventHandler(_mouseCoordsTool);
     97#else
     98    _sceneRoot = new osg::Group;
     99    _viewer->setSceneData(_sceneRoot.get());
     100#endif
    91101    _viewer->getCamera()->setNearFarRatio(0.00002);
    92102    _viewer->getCamera()->setSmallFeatureCullingPixelSize(-1.0f);
     
    234244        _viewer->removeEventHandler(_mouseCoordsTool.get());
    235245    _mouseCoordsTool = new osgEarth::Util::MouseCoordsTool(mapNode);
     246    if (!_coordsCallback.valid()) {
     247        _coordsCallback = new MouseCoordsCallback();
     248    }
    236249    _mouseCoordsTool->addCallback(_coordsCallback.get());
     250    _viewer->addEventHandler(_mouseCoordsTool.get());
     251
    237252    if (_clipPlaneCullCallback.valid()) {
    238253        _viewer->getCamera()->removeCullCallback(_clipPlaneCullCallback.get());
     
    243258        _viewer->getCamera()->addCullCallback(_clipPlaneCullCallback.get());
    244259    }
    245     _viewer->addEventHandler(_mouseCoordsTool.get());
    246260    _viewer->setSceneData(_sceneRoot.get());
    247261    _manipulator = new osgEarth::Util::EarthManipulator;
     
    302316    osgEarth::MapNode *mapNode = new osgEarth::MapNode(map, mapNodeOpts);
    303317    _mapNode = mapNode;
    304     _sceneRoot = mapNode;
     318    if (_map->isGeocentric()) {
     319#if OSGEARTH_MIN_VERSION_REQUIRED(2, 5, 1)
     320        osgEarth::Util::SkyNode *sky = new osgEarth::Util::SkyNode::create(mapNode);
     321        sky->addChild(mapNode);
     322        _sceneRoot = sky;
     323#else
     324        _sceneRoot = mapNode;
     325#endif
     326    } else {
     327        _sceneRoot = mapNode;
     328    }
    305329    if (_mouseCoordsTool.valid())
    306330        _viewer->removeEventHandler(_mouseCoordsTool.get());
    307331    _mouseCoordsTool = new osgEarth::Util::MouseCoordsTool(mapNode);
     332    if (!_coordsCallback.valid()) {
     333        _coordsCallback = new MouseCoordsCallback();
     334    }
    308335    _mouseCoordsTool->addCallback(_coordsCallback.get());
    309336    _viewer->addEventHandler(_mouseCoordsTool.get());
     
    534561    // XXX: GDAL does not report vertical datum, it should be specified here
    535562    osgEarth::ElevationLayerOptions layerOpts(name, opts);
    536     //layerOpts.verticalDatum() = "";
     563    // Common options: geodetic (default), egm96, egm84, egm2008
     564    //layerOpts.verticalDatum() = "egm96";
    537565    _map->addElevationLayer(new osgEarth::ElevationLayer(layerOpts));
    538566    _needsRedraw = true;
     
    747775void Renderer::setThrowingEnabled(bool state)
    748776{
    749     _manipulator->getSettings()->setThrowingEnabled(state);
     777    if (_manipulator.valid()) {
     778        _manipulator->getSettings()->setThrowingEnabled(state);
     779    }
    750780}
    751781
     
    776806void Renderer::mouseMotion(double x, double y)
    777807{
    778     //getEventQueue()->mouseMotion((float)x, (float)y);
    779     //return;
    780     osgEarth::GeoPoint map;
    781     if (mapMouseCoords(x, y, map)) {
    782         _coordsCallback->set(map, _viewer.get(), _mapNode);
    783     } else {
    784         _coordsCallback->reset(_viewer.get(), _mapNode);
     808    if (_coordsCallback.valid()) {
     809        //getEventQueue()->mouseMotion((float)x, (float)y);
     810        //return;
     811        osgEarth::GeoPoint map;
     812        if (mapMouseCoords(x, y, map)) {
     813            _coordsCallback->set(map, _viewer.get(), _mapNode);
     814        } else {
     815            _coordsCallback->reset(_viewer.get(), _mapNode);
     816        }
    785817    }
    786818}
  • trunk/packages/vizservers/geovis/Renderer.h

    r4273 r4282  
    282282    bool getMousePoint(double *x, double *y, double *z)
    283283    {
    284         return _coordsCallback->report(x, y, z);
     284        return (_coordsCallback.valid() && _coordsCallback->report(x, y, z));
    285285    }
    286286
  • trunk/packages/vizservers/geovis/RendererCmd.cpp

    r4273 r4282  
    918918{
    919919    float color[3];
    920     if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK ||
    921         GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK ||
    922         GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) {
     920    if (GetFloatFromObj(interp, objv[3], &color[0]) != TCL_OK ||
     921        GetFloatFromObj(interp, objv[4], &color[1]) != TCL_OK ||
     922        GetFloatFromObj(interp, objv[5], &color[2]) != TCL_OK) {
    923923        return TCL_ERROR;
    924924    }
  • trunk/packages/vizservers/geovis/geovis_protocol.txt

    r4262 r4282  
    6262map layer add <type> <url> ... <layerName>
    6363    <type> = image|wms|tms|elevation|point|polygon|line|text
     64
     65Specific layer types:
    6466map layer add image <url> <layerName>
    6567    Add a GDAL image layer from a file or URL
Note: See TracChangeset for help on using the changeset viewer.