view.h

Go to the documentation of this file.
00001 //--------------------------------------------------
00011 //---------------------------------------------------
00012 
00013 #ifndef IMEDGINE_VIEW_H
00014 #define IMEDGINE_VIEW_H
00015 
00016 //Internal includes
00017 #include "../global/global_definitions.h"
00018 #include "../exceptions/null_pointer_exception.h"
00019 #include "../exceptions/invalid_cast_exception.h"
00020 
00021 //Coin includes
00022 #include <Inventor/nodes/SoSeparator.h>
00023 #include <Inventor/nodes/SoOrthographicCamera.h>
00024 
00025 class QWidget;
00026 
00027 namespace imedgine 
00028 { 
00029   class DataViewMediator; 
00030 
00031   //--------------------------------------------------
00034 
00035   //--------------------------------------------------
00050   //--------------------------------------------------
00051 
00052   class View
00053   {
00054   public:
00055     
00056     //--------------------------------------------------
00059        
00060     View(view_type type);
00061     
00062     //--------------------------------------------------
00065        
00066     virtual ~View();
00067     
00068     //--------------------------------------------------
00071      
00072     virtual view_pointer_type clone() const = 0;
00073     
00074     //--------------------------------------------------
00079               
00080     unsigned int getViewID() const;   
00081     
00082     //--------------------------------------------------
00088           
00089     view_type getType() const;
00090     
00091     //--------------------------------------------------
00095     
00096     virtual void setParent(QWidget* view_parent);
00097             
00098     //--------------------------------------------------
00102     
00103     virtual void setDataset(dataset_pointer_type dataset)
00104         throw(NullPointerException, InvalidCastException); 
00105 
00106     //--------------------------------------------------
00111     
00112     virtual void onDataChangedEvent(dataset_attribute_type changed_attribute);
00113     
00114     //--------------------------------------------------
00117     
00118     virtual void onDatasetDeletion(dataset_key_type) {}
00119     
00120     //--------------------------------------------------
00125     
00126     virtual void updateView()
00127         throw(NullPointerException) = 0; 
00128     
00129     //--------------------------------------------------
00133     
00134     void registerDataViewMediator(DataViewMediator* data_view_mediator);
00135               
00136     //--------------------------------------------------
00139     
00140     void deregisterDataViewMediator();   
00141   
00142     SoSeparator* getSceneGraph() const { return root_; }    
00143     
00144     SoSeparator* getStaticSceneSeparator() const { return static_sep_; } 
00145     
00146     SoCamera* getStaticCamera() const { return static_camera_; }
00147     
00148   protected:
00149       
00150     //--------------------------------------------------
00153     
00154     View(View const& src);
00155     
00156     //--------------------------------------------------
00160 
00161     virtual void createSceneGraph();    
00162     
00163     //--------------------------------------------------
00170     
00171     virtual void notifyDataChangedEvent(dataset_attribute_type changed_attribute);
00172        
00173     //--------------------------------------------------
00176     
00177     QWidget* view_parent_;
00178     
00179     //--------------------------------------------------
00182     
00183     DataViewMediator* data_view_mediator_;
00184     
00185     //--------------------------------------------------
00188     
00189     SoSeparator* root_;  
00190   
00191     //---------------------------------------------------
00195     
00196     SoSeparator* dynamic_sep_;      
00197     
00198     //---------------------------------------------------
00202     
00203     SoSeparator* static_sep_;  
00204     
00205     //---------------------------------------------------
00209     
00210     SoOrthographicCamera* static_camera_;    
00211     
00212     //--------------------------------------------------
00215      
00216     dataset_key_type dataset_key_;
00217      
00218   private:
00219     
00220     //--------------------------------------------------
00223     
00224     View& operator = (View const&)
00225     {
00226       return(*this);
00227     }
00228     
00229     //---------------------------------------------------
00231     
00232     view_type type_;
00233     
00234     //---------------------------------------------------
00236     
00237     unsigned int view_id_;
00238     
00239     //---------------------------------------------------
00242     
00243     static unsigned int num_constructed_views_;
00244   };
00245 
00246 }
00247 
00248 #endif // IMEDGINEVIEW_H

Generated on Sun Aug 13 18:19:41 2006 for iMEDgine by  doxygen 1.4.6