Moby
Visualizable.h
1 /****************************************************************************
2  * Copyright 2006 Evan Drumwright
3  * This library is distributed under the terms of the Apache V2.0
4  * License (obtainable from http://www.apache.org/licenses/LICENSE-2.0).
5  ****************************************************************************/
6 
7 #ifndef _VISUALIZABLE_H
8 #define _VISUALIZABLE_H
9 
10 #include <vector>
11 #include <Ravelin/Pose3d.h>
12 #include <Moby/Types.h>
13 #include <Moby/Base.h>
14 #include <Moby/OSGGroupWrapper.h>
15 
16 namespace osg {
17  class Node;
18  class MatrixTransform;
19  class Group;
20 }
21 
22 namespace Moby {
23 
25 
29 class Visualizable : public virtual Base
30 {
31  public:
32  Visualizable();
33  Visualizable(const Visualizable* v) : Base(v) { }
34  virtual ~Visualizable();
35  virtual void update_visualization();
36  void set_visualization_relative_pose(const Ravelin::Pose3d& P);
37  virtual void set_visualization_data(osg::Node* vdata);
38  virtual void set_visualization_data(OSGGroupWrapperPtr vdata);
39  static osg::Group* construct_from_node(boost::shared_ptr<const XMLTree> node, const std::map<std::string, BasePtr>& id_map);
40  osg::Group* get_visualization_data() const;
41  virtual void save_to_xml(XMLTreePtr node, std::list<boost::shared_ptr<const Base> >& shared_objects) const;
42  virtual void load_from_xml(boost::shared_ptr<const XMLTree> node, std::map<std::string, BasePtr>& id_map);
43 
45  boost::shared_ptr<const Ravelin::Pose3d> get_visualization_pose() { return _vF; }
46 
47  protected:
48 
50  boost::shared_ptr<Ravelin::Pose3d> _vF;
51 
54 }; // end class
55 } // end namespace
56 
57 #endif // (ends #ifndef _VISUALIZABLE_H)
58 
OSGGroupWrapperPtr _vizdata
The underlying visualization data.
Definition: Visualizable.h:53
Class that allows for visualizing simulation data.
Definition: Visualizable.h:29
static osg::Group * construct_from_node(boost::shared_ptr< const XMLTree > node, const std::map< std::string, BasePtr > &id_map)
Utility method for load_from_xml()
Definition: Visualizable.cpp:137
Class from which all Moby classes are derived.
Definition: Base.h:20
boost::shared_ptr< Ravelin::Pose3d > _vF
The relative pose.
Definition: Visualizable.h:50
void set_visualization_relative_pose(const Ravelin::Pose3d &P)
Sets the visualization relative pose.
Definition: Visualizable.cpp:38
virtual void set_visualization_data(osg::Node *vdata)
Sets the visualization data from a node.
Definition: Visualizable.cpp:58
boost::shared_ptr< XMLTree > XMLTreePtr
XML tree smart pointer.
Definition: Types.h:104
virtual void load_from_xml(boost::shared_ptr< const XMLTree > node, std::map< std::string, BasePtr > &id_map)
Implements Base::load_from_xml()
Definition: Visualizable.cpp:219
boost::shared_ptr< OSGGroupWrapper > OSGGroupWrapperPtr
OSGGroupWrapper smart pointer.
Definition: Types.h:101
virtual void save_to_xml(XMLTreePtr node, std::list< boost::shared_ptr< const Base > > &shared_objects) const
Implements Base::save_to_xml()
Definition: Visualizable.cpp:319
osg::Group * get_visualization_data() const
Gets the visualization data for this object.
Definition: Visualizable.cpp:122
virtual void update_visualization()
Updates the visualization using the appropriate transform.
Definition: Visualizable.cpp:98
boost::shared_ptr< const Ravelin::Pose3d > get_visualization_pose()
Gets the pose for this visualizable object.
Definition: Visualizable.h:45