MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLBase/mlXMarkerList.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00009 //
00010 // Defines the classes:
00011 // - XMarker: A general marker with a 6D-position, a 3D-vector and an integer type.
00012 // - XMarkerList: A list of XMarker items
00013 // - XMarkerContainer: A container module for a XMarkerList object
00014 //----------------------------------------------------------------------------------
00015 
00016 
00017 
00018 #ifndef __mlXMarkerList_H
00019 #define __mlXMarkerList_H
00020 
00021 
00022 
00023 // ML includes
00024 #ifndef __mlBaseInit_H
00025 #include "mlBaseInit.h"
00026 #endif
00027 #ifndef __mlModuleIncludes_H
00028 #include "mlModuleIncludes.h"
00029 #endif
00030 #ifndef __mlLinearAlgebra_H
00031 #include "mlLinearAlgebra.h"
00032 #endif
00033 #ifndef __mlTreeNode_H
00034 #include "mlTreeNode.h"
00035 #endif
00036 
00037 
00038 // Local includes
00039 #ifndef __mlListBase_H
00040 #include "mlListBase.h"
00041 #endif
00042 #ifndef __mlListContainer_H
00043 #include "mlListContainer.h"
00044 #endif
00045 
00046 
00047 
00048 ML_START_NAMESPACE
00049 
00050 
00051 
00052 // ------------------------------------------------------------------
00055 // ------------------------------------------------------------------
00056 
00062 class MLBASEEXPORT XMarker : public BaseItem
00063 {
00064 public:
00065 
00067 
00068 
00069   Vector6 pos;   
00070   Vector3 vec;   
00071   int type;   
00072 
00074 
00075 
00077 
00078 
00080   XMarker ()
00081     : pos(0), vec(0), type(0) {}
00083   XMarker (const Vector3 &pos_)
00084     : pos(pos_,0,0,0), vec(0), type(0) {}
00086   XMarker (const Vector6 &pos_)
00087     : pos(pos_), vec(0), type(0) {}
00089   XMarker (const Vector6 &pos_, int type_)
00090     : pos(pos_), vec(0), type(type_) {}
00092   XMarker (const Vector6 &pos_, int type_, const char *name_)
00093     : pos(pos_), vec(0), type(type_) {setName(name_);}
00094 
00096   XMarker (const Vector6 &pos_, const Vector3 &vec_)
00097     : pos(pos_), vec(vec_), type(0) {}
00099   XMarker (const Vector6 &pos_, const Vector3 &vec_, int type_)
00100     : pos(pos_), vec(vec_), type(type_) {}
00102   XMarker (const Vector6 &pos_, const Vector3 &vec_, int type_, const char *name_)
00103     : pos(pos_), vec(vec_), type(type_) {setName(name_);}
00104 
00106   XMarker (const XMarker &marker) : BaseItem() { *this = marker; }
00107 
00109 
00110 
00112   virtual XMarker &operator = (const XMarker &marker);
00113 
00115   bool operator <(const XMarker &) const { return false; }
00116 
00118   bool operator ==(const XMarker &marker) const { return (pos ==  marker.pos) && (vec == marker.vec) && (type == marker.type); }
00119 
00121 
00122 
00123   double &x () { return pos[ML_VX]; }
00124   double &y () { return pos[ML_VY]; }
00125   double &z () { return pos[ML_VZ]; }
00126   double &c () { return pos[ML_VC]; }
00127   double &t () { return pos[ML_VT]; }
00128   double &u () { return pos[ML_VU]; }
00129 
00130   const double &x () const { return pos[ML_VX]; }
00131   const double &y () const { return pos[ML_VY]; }
00132   const double &z () const { return pos[ML_VZ]; }
00133   const double &c () const { return pos[ML_VC]; }
00134   const double &t () const { return pos[ML_VT]; }
00135   const double &u () const { return pos[ML_VU]; }
00136 
00137   double vx () const { return vec[ML_VX]; }
00138   double vy () const { return vec[ML_VY]; }
00139   double vz () const { return vec[ML_VZ]; }
00140 
00142 
00143 
00145 
00146 
00149   virtual char *getPersistentState () const;
00150 
00152   virtual void setPersistentState (const char *state);
00153 
00155   virtual void addStateToTree(TreeNode *parent) const;
00156 
00158   ML_SET_ADDSTATE_VERSION(0);
00159 
00161   virtual void readStateFromTree(TreeNode *parent);
00162 
00164 
00165 
00166 private:
00167 
00169   ML_CLASS_HEADER(XMarker);
00170 
00171 };
00172 
00173 
00174 
00175 // ------------------------------------------------------------------
00178 // ------------------------------------------------------------------
00179 
00182 class MLBASEEXPORT XMarkerList : public BaseListTemplate<XMarker>
00183 {
00184 public:
00185 
00187   XMarkerList () : BaseListTemplate<XMarker>(true) {}
00188 
00195 private:
00196 
00198   ML_CLASS_HEADER(XMarkerList);
00199 
00200 };
00201 
00202 
00203 
00204 // ------------------------------------------------------------------
00207 // ------------------------------------------------------------------
00208 
00211 class MLBASEEXPORT XMarkerListContainer : public ListContainerTemplate<XMarkerList>
00212 {
00213 public:
00214 
00216   XMarkerListContainer ();
00217 
00218 
00219 protected:
00220 
00222 
00223 
00224   virtual bool isPropertyField (Field *field);
00225 
00227   virtual void resetPropertyFields ();
00228 
00230   virtual void updatePropertyFields ();
00231 
00233 
00234 
00236 
00237 
00238 
00239 
00240 
00241   virtual bool modifyItem (MLssize_t index, Field *field, bool fromCurrentItem);
00242 
00244   virtual void copyItemToTemplate (MLssize_t index);
00245 
00247   virtual void copyTemplateToCurrent ();
00248 
00252   virtual void initItem (MLssize_t index);
00253 
00255 
00256 
00257 private:
00258 
00260 
00261 
00262   Vector3Field *_fldPosXYZ;    
00263   FloatField *_fldPosC,      
00264              *_fldPosT,      
00265              *_fldPosU;      
00266   Vector3Field *_fldVec;       
00267   IntField *_fldType;        
00268 
00269   // template fields for initialization of a newly inserted item
00270 
00271   Vector3Field *_fldNewPosXYZ;    
00272   FloatField *_fldNewPosC,      
00273              *_fldNewPosT,      
00274              *_fldNewPosU;      
00275   Vector3Field *_fldNewVec;       
00276   IntField *_fldNewType;        
00277 
00279 
00280 
00282   ML_MODULE_CLASS_HEADER(XMarkerListContainer);
00283 
00284 };
00285 
00286 
00287 
00288 ML_END_NAMESPACE
00289 
00290 #endif // __mlXMarkerList_H