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
00025 #define __VCG_EDGE_PLUS
00026
00027
00028
00029
00030 #include <vcg/complex/all_types.h>
00031
00032 #include <vcg/simplex/edge/component.h>
00033 #include <vcg/container/derivation_chain.h>
00034
00035 namespace vcg {
00036
00037
00038
00039
00040
00041
00042
00043 template <class UserTypes>
00044 class EdgeTypeHolder: public UserTypes{
00045 public:
00046
00047 template < class LeftV>
00048 void ImportData(const LeftV & ) { }
00049 static void Name(std::vector<std::string> & name){}
00050
00051 };
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 template <class UserTypes>
00066 class EdgeBase: public edge::EmptyEFAdj<
00067 edge::EmptyEVAdj<
00068 edge::EmptyEEAdj<
00069 edge::EmptyEHAdj<
00070 edge::EmptyBitFlags<
00071 EdgeTypeHolder < UserTypes> > > > > >{};
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 template <class UserTypes,
00087 template <typename> class A, template <typename> class B,
00088 template <typename> class C, template <typename> class D,
00089 template <typename> class E, template <typename> class F,
00090 template <typename> class G, template <typename> class H,
00091 template <typename> class I, template <typename> class J,
00092 template <typename> class K>
00093 class EdgeArityMax: public K<Arity10<EdgeBase<UserTypes>, A, B, C, D, E, F, G, H, I, J> > {
00094
00095
00096 public:
00097
00098
00099 enum {
00100
00101 DELETED = 0x0001,
00102 NOTREAD = 0x0002,
00103 NOTWRITE = 0x0004,
00104 MODIFIED = 0x0008,
00105 VISITED = 0x0010,
00106 SELECTED = 0x0020,
00107 BORDER = 0x0100,
00108 USER0 = 0x0200
00109 };
00110
00111 inline int & UberFlags () { return this->Flags(); }
00112 inline int UberFlags() const { return this->Flags(); }
00113
00114 bool IsD() const {return (this->Flags() & DELETED) != 0;}
00115 bool IsR() const {return (this->Flags() & NOTREAD) == 0;}
00116 bool IsW() const {return (this->Flags() & NOTWRITE)== 0;}
00117 bool IsRW() const {return (this->Flags() & (NOTREAD | NOTWRITE)) == 0;}
00118 bool IsS() const {return (this->Flags() & SELECTED) != 0;}
00119 bool IsB() const {return (this->Flags() & BORDER) != 0;}
00120 bool IsV() const {return (this->Flags() & VISITED) != 0;}
00121
00122
00126 void SetFlags(int flagp) {this->Flags()=flagp;}
00127
00131 void ClearFlags() {this->Flags()=0;}
00132 void SetD() {this->Flags() |=DELETED;}
00133 void ClearD() {this->Flags() &=(~DELETED);}
00134 void SetR() {this->Flags() &=(~NOTREAD);}
00135 void ClearR() {this->Flags() |=NOTREAD;}
00136 void ClearW() {this->Flags() |=NOTWRITE;}
00137 void SetW() {this->Flags() &=(~NOTWRITE);}
00138 void SetS() {this->Flags() |=SELECTED;}
00139 void ClearS() {this->Flags() &= ~SELECTED;}
00140 void SetB() {this->Flags() |=BORDER;}
00141 void ClearB() {this->Flags() &=~BORDER;}
00142 void SetV() {this->Flags() |=VISITED;}
00143 void ClearV() {this->Flags() &=~VISITED;}
00144
00146 static int &LastBitFlag()
00147 {
00148 static int b =USER0;
00149 return b;
00150 }
00151
00153 static inline int NewBitFlag()
00154 {
00155 LastBitFlag()=LastBitFlag()<<1;
00156 return LastBitFlag();
00157 }
00158
00159 static inline bool DeleteBitFlag(int bitval)
00160 {
00161 if(LastBitFlag()==bitval) {
00162 LastBitFlag()= LastBitFlag()>>1;
00163 return true;
00164 }
00165 assert(0);
00166 return false;
00167 }
00169 bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
00171 void SetUserBit(int userBit){this->Flags() |=userBit;}
00173 void ClearUserBit(int userBit){this->Flags() &= (~userBit);}
00174
00175 template<class BoxType>
00176 void GetBBox( BoxType & bb ) const {
00177 bb.SetNull();
00178 bb.Add(this->cP(0));
00179 bb.Add(this->cP(1));
00180 }
00181
00182 };
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214 template <class UserTypes,
00215 template <typename> class A = DefaultDeriver, template <typename> class B = DefaultDeriver,
00216 template <typename> class C = DefaultDeriver, template <typename> class D = DefaultDeriver,
00217 template <typename> class E = DefaultDeriver, template <typename> class F = DefaultDeriver,
00218 template <typename> class G = DefaultDeriver, template <typename> class H = DefaultDeriver,
00219 template <typename> class I = DefaultDeriver, template <typename> class J = DefaultDeriver,
00220 template <typename> class K = DefaultDeriver>
00221 class Edge: public EdgeArityMax<UserTypes, A, B, C, D, E, F, G, H, I, J, K> {
00222 public: typedef AllTypes::AEdgeType IAm; typedef UserTypes TypesPool;};
00223
00224 }
00225 #endif