- Timestamp:
- Apr 1, 2014 7:22:56 PM (10 years ago)
- Location:
- trunk/packages/vizservers/geovis
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/geovis/Renderer.cpp
r4310 r4312 569 569 } 570 570 571 void Renderer::saveNamedViewpoint(const char *name) 572 { 573 _viewpoints[name] = getViewpoint(); 574 } 575 576 bool Renderer::restoreNamedViewpoint(const char *name, double durationSecs) 577 { 578 ViewpointHashmap::iterator itr = _viewpoints.find(name); 579 if (itr != _viewpoints.end()) { 580 setViewpoint(itr->second, durationSecs); 581 return true; 582 } else { 583 ERROR("Unknown viewpoint: '%s'", name); 584 return false; 585 } 586 } 587 571 588 void Renderer::setViewpoint(const osgEarth::Viewpoint& v, double durationSecs) 572 589 { -
trunk/packages/vizservers/geovis/Renderer.h
r4310 r4312 149 149 public: 150 150 typedef std::string ColorMapId; 151 typedef std::string ViewpointId; 151 152 152 153 enum GraticuleType { … … 300 301 // Camera 301 302 303 void saveNamedViewpoint(const char *name); 304 305 bool restoreNamedViewpoint(const char *name, double durationSecs); 306 302 307 osgEarth::Viewpoint getViewpoint(); 303 308 … … 357 362 private: 358 363 typedef std::tr1::unordered_map<ColorMapId, osg::ref_ptr<osg::TransferFunction1D> > ColorMapHashmap; 364 typedef std::tr1::unordered_map<ViewpointId, osgEarth::Viewpoint> ViewpointHashmap; 359 365 360 366 void initViewer(); … … 399 405 osg::ref_ptr<osgGA::StateSetManipulator> _stateManip; 400 406 osg::ref_ptr<osgEarth::Util::VerticalScale> _verticalScale; 407 ViewpointHashmap _viewpoints; 401 408 }; 402 409 -
trunk/packages/vizservers/geovis/RendererCmd.cpp
r4310 r4312 209 209 210 210 static int 211 CameraSaveViewpointOp(ClientData clientData, Tcl_Interp *interp, int objc, 212 Tcl_Obj *const *objv) 213 { 214 char *name = Tcl_GetString(objv[2]); 215 216 g_renderer->saveNamedViewpoint(name); 217 return TCL_OK; 218 } 219 220 static int 221 CameraRestoreViewpointOp(ClientData clientData, Tcl_Interp *interp, int objc, 222 Tcl_Obj *const *objv) 223 { 224 char *name = Tcl_GetString(objv[2]); 225 226 double duration = 0.0; 227 if (objc > 3) { 228 if (Tcl_GetDoubleFromObj(interp, objv[3], &duration) != TCL_OK) { 229 return TCL_ERROR; 230 } 231 } 232 if (!g_renderer->restoreNamedViewpoint(name, duration)) { 233 Tcl_AppendResult(interp, "camera viewpoint \"", name, 234 "\" not found", (char*)NULL); 235 return TCL_ERROR; 236 } 237 return TCL_OK; 238 } 239 240 static int 211 241 CameraThrowOp(ClientData clientData, Tcl_Interp *interp, int objc, 212 242 Tcl_Obj *const *objv) … … 237 267 238 268 static CmdSpec cameraOps[] = { 239 {"orient", 1, CameraOrientOp, 6, 6, "qw qx qy qz"}, 240 {"pan", 1, CameraPanOp, 4, 4, "panX panY"}, 241 {"reset", 2, CameraResetOp, 2, 3, "?all?"}, 242 {"rotate", 2, CameraRotateOp, 4, 4, "azimuth elevation"}, 243 {"throw", 1, CameraThrowOp, 3, 3, "bool"}, 244 {"zoom", 1, CameraZoomOp, 3, 3, "zoomAmount"} 269 {"orient", 1, CameraOrientOp, 6, 6, "qw qx qy qz"}, 270 {"pan", 1, CameraPanOp, 4, 4, "panX panY"}, 271 {"reset", 4, CameraResetOp, 2, 3, "?all?"}, 272 {"restore", 4, CameraRestoreViewpointOp, 3, 4, "name ?duration?"}, 273 {"rotate", 2, CameraRotateOp, 4, 4, "azimuth elevation"}, 274 {"save", 1, CameraSaveViewpointOp, 3, 3, "name"}, 275 {"throw", 1, CameraThrowOp, 3, 3, "bool"}, 276 {"zoom", 1, CameraZoomOp, 3, 3, "zoomAmount"} 245 277 }; 246 278 static int nCameraOps = NumCmdSpecs(cameraOps);
Note: See TracChangeset
for help on using the changeset viewer.