Corrected bug recently introduced due to small difference in the signature of the flags functions...

This commit is contained in:
Paolo Cignoni 2012-11-07 15:42:14 +00:00
parent 3e81ac032f
commit 1046deb107
3 changed files with 24 additions and 22 deletions

View File

@ -124,17 +124,17 @@ public:
/// checks if the Face is deleted
bool IsD() const {return (this->Flags() & DELETED) != 0;}
bool IsD() const {return (this->cFlags() & DELETED) != 0;}
/// checks if the Face is readable
bool IsR() const {return (this->Flags() & NOTREAD) == 0;}
bool IsR() const {return (this->cFlags() & NOTREAD) == 0;}
/// checks if the Face is modifiable
bool IsW() const {return (this->Flags() & NOTWRITE)== 0;}
bool IsW() const {return (this->cFlags() & NOTWRITE)== 0;}
/// This funcion checks whether the Face is both readable and modifiable
bool IsRW() const {return (this->Flags() & (NOTREAD | NOTWRITE)) == 0;}
bool IsRW() const {return (this->cFlags() & (NOTREAD | NOTWRITE)) == 0;}
/// checks if the Face is Modified
bool IsS() const {return (this->Flags() & SELECTED) != 0;}
bool IsS() const {return (this->cFlags() & SELECTED) != 0;}
/// checks if the Face is Modified
bool IsV() const {return (this->Flags() & VISITED) != 0;}
bool IsV() const {return (this->cFlags() & VISITED) != 0;}
/** Set the flag value
@param flagp Valore da inserire nel flag
@ -168,14 +168,14 @@ public:
void ClearV() {this->Flags() &= ~VISITED;}
/// This function checks if the face is selected
bool IsB(int i) const {return (this->Flags() & (BORDER0<<i)) != 0;}
bool IsB(int i) const {return (this->cFlags() & (BORDER0<<i)) != 0;}
/// This function select the face
void SetB(int i) {this->Flags() |=(BORDER0<<i);}
/// This funcion execute the inverse operation of SetS()
void ClearB(int i) {this->Flags() &= (~(BORDER0<<i));}
/// This function checks if the face is selected
bool IsCrease(int i) const {return (this->Flags() & (CREASE0<<i)) != 0;}
bool IsCrease(int i) const {return (this->cFlags() & (CREASE0<<i)) != 0;}
/// This function select the face
void SetCrease(int i){this->Flags() |=(CREASE0<<i);}
/// This funcion execute the inverse operation of SetS()
@ -184,8 +184,8 @@ public:
/// This function checks if a given side of the face is a feature/internal edge
/// it is used by some importer to mark internal
/// edges of polygonal faces that have been triangulated
bool IsF(int i) const {return (this->Flags() & (FAUX0<<i) ) != 0;}
bool IsAnyF() const {return (this->Flags() & (FAUX0|FAUX1|FAUX2)) != 0;}
bool IsF(int i) const {return (this->cFlags() & (FAUX0<<i) ) != 0;}
bool IsAnyF() const {return (this->cFlags() & (FAUX0|FAUX1|FAUX2)) != 0;}
/// This function select the face
void SetF(int i) {this->Flags() |=(FAUX0<<i);}
/// This funcion execute the inverse operation of SetS()

View File

@ -325,20 +325,22 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
};
/*------------------------- BitFlags -----------------------------------------*/
/*! \brief \em Component: Per face \b Flags
This component stores a 32 bit array of bit flags. These bit flags are used for keeping track of selection, deletion, visiting etc. \sa \ref flags for more details on common uses of flags.
*/
template <class T> class BitFlags: public T {
public:
BitFlags(){_flags=0;}
int &Flags() {return _flags; }
int Flags() const {return _flags; }
const int & cFlags() const {return _flags; }
template <class RightF>
void ImportData(const RightF & rightF){ Flags() = rightF.cFlags();T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
int &Flags() {return _flags; }
int cFlags() const {return _flags; }
template <class RightF>
void ImportData(const RightF & rightF){ Flags() = rightF.cFlags();T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
static bool HasFlags() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
private:
int _flags;
};

View File

@ -47,7 +47,7 @@ template <class TT> class EmptyCore: public TT {
public:
typedef int FlagType;
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
int cFlags() const { return 0; }
int cFlags() const { assert(0); return 0; }
static bool HasFlags() { return false; }
typedef vcg::Point3f CoordType;
@ -281,9 +281,9 @@ public:
BitFlags(){_flags=0;}
typedef int FlagType;
int &Flags() {return _flags; }
int Flags() const {return _flags; }
template < class LeftV>
void ImportData(const LeftV & left ) { if(LeftV::HasFlags()) Flags() = left.Flags(); T::ImportData( left); }
int cFlags() const {return _flags; }
template < class LeftV>
void ImportData(const LeftV & left ) { if(LeftV::HasFlags()) Flags() = left.cFlags(); T::ImportData( left); }
static bool HasFlags() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}