Visualizable.h

00001 /****************************************************************************
00002  * Copyright 2006 Evan Drumwright
00003  * This library is distributed under the terms of the GNU General Public 
00004  * License (found in COPYING).
00005  ****************************************************************************/
00006 
00007 #ifndef _VISUALIZABLE_H
00008 #define _VISUALIZABLE_H
00009 
00010 #include <vector>
00011 #include <Physsim/Types.h>
00012 #include <Physsim/Base.h>
00013 #include <Physsim/Matrix4.h>
00014 #include <Physsim/SoSeparatorWrapper.h>
00015 
00016 class SoNode;
00017 class SoSeparator;
00018 class SoTransform;
00019 
00020 namespace Physsim {
00021 
00023 
00027 class Visualizable : public Base 
00028 {
00029         public:
00030                 Visualizable();
00031                 Visualizable(const Visualizable* v) : Base(v) { }
00032                 virtual ~Visualizable(); 
00033                 virtual void clone(BasePtr& cloned, bimap<BasePtr, BasePtr>* obj_map = NULL) const;
00034                 virtual void load_state(BaseConstPtr object, bimap<BasePtr, BasePtr>* correspondence = NULL);
00035                 virtual void save_state(BasePtr object, bimap<BasePtr, BasePtr>* correspondence = NULL) const;
00036                 virtual void update_visualization();
00037                 virtual void set_visualization_data(SoNode* vdata); 
00038                 virtual void set_visualization_data(SoSeparatorWrapperPtr vdata); 
00039                 virtual void save_to_xml(XMLTreePtr node, std::list<BaseConstPtr>& shared_objects) const;
00040                 virtual void load_from_xml(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00041                 static SoSeparator* construct_from_node(XMLTreeConstPtr node, const std::map<std::string, BasePtr>& id_map);
00042 
00044 
00048                 void set_visualization_transform(const Matrix4& T) { _transform = T; }
00049 
00051                 SoNode* get_visualization_data() const { return (SoNode*) _separator; }
00052 
00053         protected:
00054 
00056                 SoSeparatorWrapperPtr _vizdata;
00057 
00059                 SoSeparator* _separator;
00060 
00062                 SoTransform* _vtransform;
00063 
00064         private:
00065 
00067                 Matrix4 _transform;
00068 
00070                 static const unsigned SEPARATOR_INDEX = 1;
00071 }; // end class
00072 
00073 } // end namespace
00074 
00075 #endif
00076 

Generated on Wed Oct 24 14:54:22 2007 for Physsim by  doxygen 1.5.1