00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __VCG_EDGE_PLUS_COMPONENT
00025 #define __VCG_EDGE_PLUS_COMPONENT
00026 #include <vector>
00027 #include <string>
00028
00029
00030 #include <vcg/space/color4.h>
00031
00032 namespace vcg {
00033 namespace edge {
00034
00035
00036
00037
00038
00039
00040
00041 template <class T> class EmptyVertexRef: public T {
00042 public:
00043
00044
00045 inline typename T::VertexType * & V( const int j ) { assert(0); static typename T::VertexType *vp=0; return vp; }
00046 inline typename T::VertexType * const & V( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
00047 inline typename T::VertexType * cV( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
00048 inline typename T::CoordType & P( const int j ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
00049 inline const typename T::CoordType & P( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
00050 inline const typename T::CoordType &cP( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
00051 template <class LeftF>
00052 void ImportData(const LeftF & leftF) {T::ImportData(leftF);}
00053 static bool HasVertexRef() { return false; }
00054 static void Name(std::vector<std::string> & name){T::Name(name);}
00055
00056 };
00057 template <class T> class VertexRef: public T {
00058 public:
00059 VertexRef(){
00060 v[0]=0;
00061 v[1]=0;
00062 }
00063
00064 inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<2); return v[j]; }
00065 inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<2); return v[j]; }
00066 inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<2); return v[j]; }
00067
00068
00069 inline typename T::CoordType & P( const int j ) { assert(j>=0 && j<2); return v[j]->P(); }
00070 inline const typename T::CoordType &cP( const int j ) const { assert(j>=0 && j<2); return v[j]->cP(); }
00071
00075 inline typename T::VertexType * & V0( const int j ) { return V(j);}
00076 inline typename T::VertexType * & V1( const int j ) { return V((j+1)%2);}
00077 inline const typename T::VertexType * const & V0( const int j ) const { return V(j);}
00078 inline const typename T::VertexType * const & V1( const int j ) const { return V((j+1)%2);}
00079 inline const typename T::VertexType * const & cV0( const int j ) const { return cV(j);}
00080 inline const typename T::VertexType * const & cV1( const int j ) const { return cV((j+1)%2);}
00081
00083 inline typename T::CoordType & P0( const int j ) { return V(j)->P();}
00084 inline typename T::CoordType & P1( const int j ) { return V((j+1)%2)->P();}
00085 inline const typename T::CoordType & P0( const int j ) const { return V(j)->P();}
00086 inline const typename T::CoordType & P1( const int j ) const { return V((j+1)%2)->P();}
00087 inline const typename T::CoordType & cP0( const int j ) const { return cV(j)->P();}
00088 inline const typename T::CoordType & cP1( const int j ) const { return cV((j+1)%2)->P();}
00089
00090 inline typename T::VertexType * & UberV( const int j ) { assert(j>=0 && j<2); return v[j]; }
00091 inline const typename T::VertexType * const & UberV( const int j ) const { assert(j>=0 && j<2); return v[j]; }
00092
00093 template <class LeftF>
00094 void ImportData(const LeftF & leftF){ T::ImportData(leftF);}
00095
00096 static bool HasVertexRef() { return true; }
00097 static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);}
00098
00099
00100 private:
00101 typename T::VertexType *v[2];
00102 };
00103
00104
00105
00106
00107
00108 template <class T> class EmptyMark: public T {
00109 public:
00110 static bool HasMark() { return false; }
00111 static bool HasMarkOcc() { return false; }
00112 inline void InitIMark() { }
00113 inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
00114 inline const int & IMark() const {return 0;}
00115 template < class LeftV>
00116 void ImportData(const LeftV & left ) { T::ImportData( left); }
00117 static void Name(std::vector<std::string> & name){T::Name(name);}
00118
00119 };
00120 template <class T> class Mark: public T {
00121 public:
00122 static bool HasMark() { return true; }
00123 static bool HasMarkOcc() { return true; }
00124 inline void InitIMark() { _imark = 0; }
00125 inline int & IMark() { return _imark;}
00126 inline const int & IMark() const {return _imark;}
00127 template < class LeftV>
00128 void ImportData(const LeftV & left ) { IMark() = left.IMark(); T::ImportData( left); }
00129 static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
00130
00131 private:
00132 int _imark;
00133 };
00134
00135
00136 template <class T> class EmptyBitFlags: public T {
00137 public:
00138 typedef int FlagType;
00140 int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
00141 int Flags() const { return 0; }
00142 template < class LeftV>
00143 void ImportData(const LeftV & left ) { T::ImportData( left); }
00144 static bool HasFlags() { return false; }
00145 static void Name(std::vector<std::string> & name){T::Name(name);}
00146
00147 };
00148
00149 template <class T> class BitFlags: public T {
00150 public:
00151 BitFlags(){_flags=0;}
00152 typedef int FlagType;
00153 int &Flags() {return _flags; }
00154 int Flags() const {return _flags; }
00155 template < class LeftV>
00156 void ImportData(const LeftV & left ) { Flags() = left.Flags(); T::ImportData( left); }
00157 static bool HasFlags() { return true; }
00158 static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
00159
00160 private:
00161 int _flags;
00162 };
00163
00164
00165
00166 template <class T> class EmptyColorQuality: public T {
00167 public:
00168 typedef float QualityType;
00169 QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
00170 static bool HasQuality() { return false; }
00171
00172 typedef vcg::Color4b ColorType;
00173 ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
00174 template < class LeftV>
00175 void ImportData(const LeftV & left ) { T::ImportData( left); }
00176 static bool HasColor() { return false; }
00177 static void Name(std::vector<std::string> & name){T::Name(name);}
00178 };
00179
00180
00181
00182 template <class A, class T> class Color: public T {
00183 public:
00184 Color():_color(vcg::Color4b::White) {}
00185 typedef A ColorType;
00186 ColorType &C() { return _color; }
00187 const ColorType &C() const { return _color; }
00188 const ColorType &cC() const { return _color; }
00189 template < class LeftV>
00190 void ImportData(const LeftV & left ) { C() = left.cC(); T::ImportData( left); }
00191 static bool HasColor() { return true; }
00192 static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
00193
00194 private:
00195 ColorType _color;
00196 };
00197
00198 template <class TT> class Color4b: public edge::Color<vcg::Color4b, TT> {
00199 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4b"));TT::Name(name);}
00200 };
00201
00202
00203
00204 template <class A, class TT> class Quality: public TT {
00205 public:
00206 typedef A QualityType;
00207 QualityType &Q() { return _quality; }
00208 const QualityType & cQ() const {return _quality; }
00209 template < class LeftV>
00210 void ImportData(const LeftV & left ) { Q() = left.cQ(); TT::ImportData( left); }
00211 static bool HasQuality() { return true; }
00212 static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
00213
00214 private:
00215 QualityType _quality;
00216 };
00217
00218 template <class TT> class Qualitys: public Quality<short, TT> {
00219 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualitys"));TT::Name(name);}
00220 };
00221 template <class TT> class Qualityf: public Quality<float, TT> {
00222 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityf"));TT::Name(name);}
00223 };
00224 template <class TT> class Qualityd: public Quality<double, TT> {
00225 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityd"));TT::Name(name);}
00226 };
00227
00228
00229 template <class T> class EmptyEVAdj: public T {
00230 public:
00231 typename T::VertexPointer &EVp(const int &) { static typename T::VertexPointer ep=0; assert(0); return ep; }
00232 typename T::VertexPointer const cEVp(const int &) const { static typename T::VertexPointer ep=0; assert(0); return ep; }
00233 typename T::VertexPointer &V(const int &i) { return EVp(i);}
00234 typename T::VertexPointer const cV(const int &i) const { return cEVp(i); }
00235 template < class LeftV>
00236 void ImportData(const LeftV & left ) { T::ImportData( left); }
00237 static bool HasEVAdjacency() { return false; }
00238 static bool HasEVAdjacencyOcc() { return false; }
00239 static void Name(std::vector<std::string> & name){ T::Name(name);}
00240 };
00241
00242 template <class T> class EVAdj: public T {
00243 public:
00244 EVAdj(){_vp[0]= _vp[1] =0;}
00245 typename T::VertexPointer & EVp(const int & i) {return _vp[i]; }
00246 typename T::VertexPointer const cEVp(const int & i) const {return _vp[i]; }
00247 typename T::VertexPointer &V(const int &i) { return EVp(i);}
00248 typename T::VertexPointer const cV(const int &i) const { return cEVp(i); }
00249
00250 template < class LeftV>
00251 void ImportData(const LeftV & left ) { T::ImportData( left); }
00252 static bool HasEVAdjacency() { return true; }
00253 static bool HasEVAdjacencyOcc() { return true; }
00254 static void Name(std::vector<std::string> & name){name.push_back(std::string("EVAdj"));T::Name(name);}
00255
00256 private:
00257 typename T::VertexPointer _vp[2] ;
00258 };
00259
00260
00261
00262 template <class T> class EmptyEEAdj: public T {
00263 public:
00264 typename T::EdgePointer &EEp(const int & ) { static typename T::EdgePointer ep=0; assert(0); return ep; }
00265 const typename T::EdgePointer cEEp(const int & ) const { static typename T::EdgePointer ep=0; assert(0); return ep; }
00266 int &EEi(const int &){static int z=0; assert(0); return z;};
00267 const int &cEEi(const int &) const {static int z=0; assert(0); return z;};
00268 template < class LeftV>
00269 void ImportData(const LeftV & left ) { T::ImportData( left); }
00270 static bool HasEEAdjacency() { return false; }
00271 static bool HasEEAdjacencyOcc() { return false; }
00272 static void Name(std::vector<std::string> & name){ T::Name(name);}
00273 };
00274
00275 template <class T> class EEAdj: public T {
00276 public:
00277 EEAdj(){_ep=0;}
00278 typename T::EdgePointer &EEp(const int & i) {return _ep[i]; }
00279 typename T::EdgePointer cEEp(const int & i) {return _ep[i]; }
00280 int &EEi(const int & i){ return _zp[i];};
00281 const int &cEEi(const int &i ){return _zp[i];};
00282
00283 template < class LeftV>
00284 void ImportData(const LeftV & left ) { T::ImportData( left); }
00285 static bool HasEEAdjacency() { return true; }
00286 static bool HasEEAdjacencyOcc() { return true; }
00287 static void Name(std::vector<std::string> & name){name.push_back(std::string("EEAdj"));T::Name(name);}
00288
00289 private:
00290 typename T::EdgePointer _ep[2] ;
00291 int _zp[2] ;
00292 };
00293
00294
00295
00296 template <class T> class EmptyEHAdj: public T {
00297 public:
00298 typename T::HEdgePointer &EHp( ) { static typename T::HEdgePointer hp=0; assert(0); return hp; }
00299 const typename T::HEdgePointer cEHp( ) const { static typename T::HEdgePointer hp=0; assert(0); return hp; }
00300
00301 template < class LeftV>
00302 void ImportData(const LeftV & left ) { T::ImportData( left); }
00303 static bool HasEHAdjacency() { return false; }
00304 static bool HasEHAdjacencyOcc() { return false; }
00305 static void Name(std::vector<std::string> & name){ T::Name(name);}
00306 };
00307
00308 template <class T> class EHAdj: public T {
00309 public:
00310 EHAdj(){_hp=0;}
00311 typename T::HEdgePointer &EHp( ) {return _hp ; }
00312 const typename T::HEdgePointer cEHp( ) const {return _hp ; }
00313
00314 template < class LeftV>
00315 void ImportData(const LeftV & left ) { T::ImportData( left); }
00316 static bool HasEHAdjacency() { return true; }
00317 static bool HasEHAdjacencyOcc() { return true; }
00318 static void Name(std::vector<std::string> & name){name.push_back(std::string("EHAdj"));T::Name(name);}
00319
00320 private:
00321 typename T::HEdgePointer _hp ;
00322 };
00323
00324
00325
00326
00327 template <class T> class EmptyETAdj: public T {
00328 public:
00329 typename T::TetraPointer &ETp() { static typename T::TetraPointer tp = 0; assert(0); return tp; }
00330 typename T::TetraPointer cETp() { static typename T::TetraPointer tp = 0; assert(0); return tp; }
00331 int &VTi() { static int z = 0; return z; };
00332 static bool HasETAdjacency() { return false; }
00333 static bool HasETAdjacencyOcc() { return false; }
00334 static void Name( std::vector< std::string > & name ) { T::Name(name); }
00335 };
00336
00337 template <class T> class ETAdj: public T {
00338 public:
00339 ETAdj() { _tp = 0; }
00340 typename T::TetraPointer &ETp() { return _tp; }
00341 typename T::TetraPointer cETp() { return _tp; }
00342 int &ETi() {return _zp; }
00343 static bool HasETAdjacency() { return true; }
00344 static bool HasETAdjacencyOcc() { return true; }
00345 static void Name( std::vector< std::string > & name ) { name.push_back( std::string("ETAdj") ); T::Name(name); }
00346
00347 private:
00348 typename T::TetraPointer _tp ;
00349 int _zp ;
00350 };
00351
00352
00353
00354
00355
00356 template <class T> class EmptyEFAdj: public T {
00357 public:
00358 typename T::FacePointer &EFp() { static typename T::FacePointer fp=0; assert(0); return fp; }
00359 const typename T::FacePointer cEFp() const { static typename T::FacePointer fp=0; assert(0); return fp; }
00360 int &EFi() {static int z=0; return z;};
00361 const int &cEFi() const {static int z=0; return z;};
00362 template < class LeftV>
00363 void ImportData(const LeftV & left ) { T::ImportData( left); }
00364 static bool HasEFAdjacency() { return false; }
00365 static bool HasEFAdjacencyOcc() { return false; }
00366 static void Name(std::vector<std::string> & name){ T::Name(name);}
00367 };
00368
00369 template <class T> class EFAdj: public T {
00370 public:
00371 EFAdj(){_fp=0;}
00372 typename T::FacePointer &EFp() {return _fp; }
00373 const typename T::FacePointer cEFp() const {return _fp; }
00374 int &EFi() {static int z=0; return z;};
00375 const int &cEFi() const {return _zp; }
00376 template < class LeftV>
00377 void ImportData(const LeftV & left ) { T::ImportData( left); }
00378 static bool HasEFAdjacency() { return true; }
00379 static bool HasEFAdjacencyOcc() { return true; }
00380 static void Name(std::vector<std::string> & name){name.push_back(std::string("EFAdj"));T::Name(name);}
00381
00382 private:
00383 typename T::FacePointer _fp ;
00384 int _zp ;
00385 };
00386
00387
00388 }
00389 }
00390 #endif