Changeset 4282 for trunk/packages
- Timestamp:
- Mar 27, 2014, 7:17:47 PM (11 years ago)
- Location:
- trunk/packages/vizservers/geovis
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/geovis/Renderer.cpp
r4273 r4282 29 29 #include <osgEarth/ModelLayer> 30 30 #include <osgEarthUtil/EarthManipulator> 31 #if OSGEARTH_MIN_VERSION_REQUIRED(2, 5, 1) 32 #include <osgEarthUtil/Sky> 33 #else 34 #include <osgEarthUtil/SkyNode> 35 #endif 31 36 #include <osgEarthUtil/AutoClipPlaneHandler> 32 37 #include <osgEarthUtil/MouseCoordsTool> … … 63 68 _captureCallback = new ScreenCaptureCallback(); 64 69 _viewer->getCamera()->setPostDrawCallback(_captureCallback.get()); 70 #if 1 65 71 osgEarth::MapOptions mapOpts; 66 72 mapOpts.coordSysType() = osgEarth::MapOptions::CSTYPE_PROJECTED; … … 89 95 _mouseCoordsTool->addCallback(_coordsCallback); 90 96 _viewer->addEventHandler(_mouseCoordsTool); 97 #else 98 _sceneRoot = new osg::Group; 99 _viewer->setSceneData(_sceneRoot.get()); 100 #endif 91 101 _viewer->getCamera()->setNearFarRatio(0.00002); 92 102 _viewer->getCamera()->setSmallFeatureCullingPixelSize(-1.0f); … … 234 244 _viewer->removeEventHandler(_mouseCoordsTool.get()); 235 245 _mouseCoordsTool = new osgEarth::Util::MouseCoordsTool(mapNode); 246 if (!_coordsCallback.valid()) { 247 _coordsCallback = new MouseCoordsCallback(); 248 } 236 249 _mouseCoordsTool->addCallback(_coordsCallback.get()); 250 _viewer->addEventHandler(_mouseCoordsTool.get()); 251 237 252 if (_clipPlaneCullCallback.valid()) { 238 253 _viewer->getCamera()->removeCullCallback(_clipPlaneCullCallback.get()); … … 243 258 _viewer->getCamera()->addCullCallback(_clipPlaneCullCallback.get()); 244 259 } 245 _viewer->addEventHandler(_mouseCoordsTool.get());246 260 _viewer->setSceneData(_sceneRoot.get()); 247 261 _manipulator = new osgEarth::Util::EarthManipulator; … … 302 316 osgEarth::MapNode *mapNode = new osgEarth::MapNode(map, mapNodeOpts); 303 317 _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 } 305 329 if (_mouseCoordsTool.valid()) 306 330 _viewer->removeEventHandler(_mouseCoordsTool.get()); 307 331 _mouseCoordsTool = new osgEarth::Util::MouseCoordsTool(mapNode); 332 if (!_coordsCallback.valid()) { 333 _coordsCallback = new MouseCoordsCallback(); 334 } 308 335 _mouseCoordsTool->addCallback(_coordsCallback.get()); 309 336 _viewer->addEventHandler(_mouseCoordsTool.get()); … … 534 561 // XXX: GDAL does not report vertical datum, it should be specified here 535 562 osgEarth::ElevationLayerOptions layerOpts(name, opts); 536 //layerOpts.verticalDatum() = ""; 563 // Common options: geodetic (default), egm96, egm84, egm2008 564 //layerOpts.verticalDatum() = "egm96"; 537 565 _map->addElevationLayer(new osgEarth::ElevationLayer(layerOpts)); 538 566 _needsRedraw = true; … … 747 775 void Renderer::setThrowingEnabled(bool state) 748 776 { 749 _manipulator->getSettings()->setThrowingEnabled(state); 777 if (_manipulator.valid()) { 778 _manipulator->getSettings()->setThrowingEnabled(state); 779 } 750 780 } 751 781 … … 776 806 void Renderer::mouseMotion(double x, double y) 777 807 { 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 } 785 817 } 786 818 } -
trunk/packages/vizservers/geovis/Renderer.h
r4273 r4282 282 282 bool getMousePoint(double *x, double *y, double *z) 283 283 { 284 return _coordsCallback->report(x, y, z);284 return (_coordsCallback.valid() && _coordsCallback->report(x, y, z)); 285 285 } 286 286 -
trunk/packages/vizservers/geovis/RendererCmd.cpp
r4273 r4282 918 918 { 919 919 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) { 923 923 return TCL_ERROR; 924 924 } -
trunk/packages/vizservers/geovis/geovis_protocol.txt
r4262 r4282 62 62 map layer add <type> <url> ... <layerName> 63 63 <type> = image|wms|tms|elevation|point|polygon|line|text 64 65 Specific layer types: 64 66 map layer add image <url> <layerName> 65 67 Add a GDAL image layer from a file or URL
Note: See TracChangeset
for help on using the changeset viewer.