00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __VCG_MESH
00024 #error "This file should not be included alone. It is automatically included by complex.h"
00025 #endif
00026 #ifndef __VCG_EDGE_PLUS
00027 #define __VCG_EDGE_PLUS
00028 namespace vcg {
00029
00030
00031
00032
00033
00034
00035 template <class UserTypes>
00036 class EdgeTypeHolder: public UserTypes{
00037 public:
00038
00039 template < class LeftV>
00040 void ImportData(const LeftV & ) { }
00041 static void Name(std::vector<std::string> & ){}
00042
00043 };
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 template <class UserTypes,
00080 template <typename> class A, template <typename> class B,
00081 template <typename> class C, template <typename> class D,
00082 template <typename> class E, template <typename> class F,
00083 template <typename> class G, template <typename> class H,
00084 template <typename> class I, template <typename> class J >
00085 class EdgeArityMax: public Arity10<edge::EmptyCore<UserTypes>, A, B, C, D, E, F, G, H, I, J> {
00086
00087
00088 public:
00089
00090
00091 enum {
00092
00093 DELETED = 0x0001,
00094 NOTREAD = 0x0002,
00095 NOTWRITE = 0x0004,
00096 MODIFIED = 0x0008,
00097 VISITED = 0x0010,
00098 SELECTED = 0x0020,
00099 BORDER = 0x0100,
00100 USER0 = 0x0200
00101 };
00102
00103 bool IsD() const {return (this->Flags() & DELETED) != 0;}
00104 bool IsR() const {return (this->Flags() & NOTREAD) == 0;}
00105 bool IsW() const {return (this->Flags() & NOTWRITE)== 0;}
00106 bool IsRW() const {return (this->Flags() & (NOTREAD | NOTWRITE)) == 0;}
00107 bool IsS() const {return (this->Flags() & SELECTED) != 0;}
00108 bool IsB() const {return (this->Flags() & BORDER) != 0;}
00109 bool IsV() const {return (this->Flags() & VISITED) != 0;}
00110
00111
00115 void SetFlags(int flagp) {this->Flags()=flagp;}
00116
00120 void ClearFlags() {this->Flags()=0;}
00121 void SetD() {this->Flags() |=DELETED;}
00122 void ClearD() {this->Flags() &=(~DELETED);}
00123 void SetR() {this->Flags() &=(~NOTREAD);}
00124 void ClearR() {this->Flags() |=NOTREAD;}
00125 void ClearW() {this->Flags() |=NOTWRITE;}
00126 void SetW() {this->Flags() &=(~NOTWRITE);}
00127 void SetS() {this->Flags() |=SELECTED;}
00128 void ClearS() {this->Flags() &= ~SELECTED;}
00129 void SetB() {this->Flags() |=BORDER;}
00130 void ClearB() {this->Flags() &=~BORDER;}
00131 void SetV() {this->Flags() |=VISITED;}
00132 void ClearV() {this->Flags() &=~VISITED;}
00133
00135 static int &FirstUnusedBitFlag()
00136 {
00137 static int b =USER0;
00138 return b;
00139 }
00140
00142 static inline int NewBitFlag()
00143 {
00144 int bitForTheUser = FirstUnusedBitFlag();
00145 FirstUnusedBitFlag()=FirstUnusedBitFlag()<<1;
00146 return bitForTheUser;
00147 }
00148
00150
00151 static inline bool DeleteBitFlag(int bitval)
00152 {
00153 if(FirstUnusedBitFlag()>>1==bitval) {
00154 FirstUnusedBitFlag() = FirstUnusedBitFlag()>>1;
00155 return true;
00156 }
00157 assert(0);
00158 return false;
00159 }
00160
00162 bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
00163
00165 void SetUserBit(int userBit){this->Flags() |=userBit;}
00166
00168 void ClearUserBit(int userBit){this->Flags() &= (~userBit);}
00169
00170 template<class BoxType>
00171 void GetBBox( BoxType & bb ) const {
00172 bb.SetNull();
00173 bb.Add(this->cP(0));
00174 bb.Add(this->cP(1));
00175 }
00176
00177 };
00178
00179
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 template <class UserTypes,
00210 template <typename> class A = DefaultDeriver, template <typename> class B = DefaultDeriver,
00211 template <typename> class C = DefaultDeriver, template <typename> class D = DefaultDeriver,
00212 template <typename> class E = DefaultDeriver, template <typename> class F = DefaultDeriver,
00213 template <typename> class G = DefaultDeriver, template <typename> class H = DefaultDeriver,
00214 template <typename> class I = DefaultDeriver, template <typename> class J = DefaultDeriver >
00215 class Edge: public EdgeArityMax<UserTypes, A, B, C, D, E, F, G, H, I, J> {
00216 public: typedef AllTypes::AEdgeType IAm; typedef UserTypes TypesPool;};
00217
00218 }
00219 #endif