Commit 443b9e63 authored by Pierre Kraemer's avatar Pierre Kraemer

grosse mise a jour des Containers, AttributeHandler, etc..

parent 54d09f40
...@@ -536,44 +536,27 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -536,44 +536,27 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 'd': case 'd':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME);
myMap.removeAttribute<PFP::VEC3>(normal) ; myMap.removeAttribute<PFP::VEC3>(normal) ;
myMap.removeAttribute<PFP::VEC3>(laplacian) ; myMap.removeAttribute<PFP::VEC3>(laplacian) ;
AttributeHandler<PFP::VEC3> newPosition = myMap.addAttribute<PFP::VEC3>(FACE_ORBIT, "position") ; AttributeHandler<PFP::VEC3> newPosition = myMap.addAttribute<PFP::VEC3>(FACE_ORBIT, "position") ;
Algo::Geometry::computeCentroidFaces<PFP>(myMap, position, newPosition) ; Algo::Geometry::computeCentroidFaces<PFP>(myMap, position, newPosition) ;
std::vector<std::string> attrNames ; GLint t1 = glutGet(GLUT_ELAPSED_TIME);
for(unsigned int i = 0; i < NB_ORBITS; ++i)
{
AttributeContainer& cont = myMap.getAttributeContainer(i) ;
std::cout << "container " << i << " (" << cont.getNbAttributes() << ") :" << std::endl ;
cont.getAttributesNames(attrNames) ;
for(unsigned int j = 0; j < attrNames.size(); ++j)
std::cout << " -> " << attrNames[j] << std::endl ;
}
std::cout << std::endl ;
Algo::Modelisation::computeDual<PFP>(myMap) ; Algo::Modelisation::computeDual<PFP>(myMap) ;
for(unsigned int i = 0; i < NB_ORBITS; ++i) GLint t2 = glutGet(GLUT_ELAPSED_TIME);
{ GLfloat seconds = (t2 - t1) / 1000.0f;
AttributeContainer& cont = myMap.getAttributeContainer(i) ; std::cout << "dual computation: "<< seconds << "sec" << std::endl;
std::cout << "container " << i << " (" << cont.getNbAttributes() << ") :" << std::endl ;
cont.getAttributesNames(attrNames) ; newPosition = myMap.getAttribute<PFP::VEC3>(FACE_ORBIT, "position") ;
for(unsigned int j = 0; j < attrNames.size(); ++j) myMap.removeAttribute<PFP::VEC3>(newPosition) ;
std::cout << " -> " << attrNames[j] << std::endl ;
}
position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ; position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ;
normal = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ; normal = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ;
laplacian = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ; laplacian = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "dual computation: "<< seconds << "sec" << std::endl;
t1 = glutGet(GLUT_ELAPSED_TIME); t1 = glutGet(GLUT_ELAPSED_TIME);
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ; updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ; updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
...@@ -743,6 +726,7 @@ int main(int argc, char** argv) ...@@ -743,6 +726,7 @@ int main(int argc, char** argv)
std::cerr << "could not import " << filename << std::endl ; std::cerr << "could not import " << filename << std::endl ;
return 1 ; return 1 ;
} }
mgw->position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]) ; mgw->position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME) ; GLint t2 = glutGet(GLUT_ELAPSED_TIME) ;
GLfloat seconds = (t2 - t1) / 1000.0f ; GLfloat seconds = (t2 - t1) / 1000.0f ;
......
...@@ -211,7 +211,7 @@ public: ...@@ -211,7 +211,7 @@ public:
AttributeHandler_IHM() : AttributeHandler<T>() AttributeHandler_IHM() : AttributeHandler<T>()
{} {}
AttributeHandler_IHM(GenericMap* m, unsigned int idAttr) : AttributeHandler<T>(m, idAttr) AttributeHandler_IHM(GenericMap* m, unsigned int orbit, unsigned int index) : AttributeHandler<T>(m, orbit, index)
{} {}
AttributeMultiVector<T>* getDataVector() const AttributeMultiVector<T>* getDataVector() const
......
...@@ -54,14 +54,14 @@ AttributeHandler_IHM<T> ImplicitHierarchicalMap::addAttribute(unsigned int orbit ...@@ -54,14 +54,14 @@ AttributeHandler_IHM<T> ImplicitHierarchicalMap::addAttribute(unsigned int orbit
amv[i] = EMBNULL ; amv[i] = EMBNULL ;
} }
return AttributeHandler_IHM<T>(this, h.id()) ; return AttributeHandler_IHM<T>(this, h.getOrbit(), h.getIndex()) ;
} }
template <typename T> template <typename T>
AttributeHandler_IHM<T> ImplicitHierarchicalMap::getAttribute(unsigned int orbit, const std::string& nameAttr) AttributeHandler_IHM<T> ImplicitHierarchicalMap::getAttribute(unsigned int orbit, const std::string& nameAttr)
{ {
AttributeHandler<T> h = Map2::getAttribute<T>(orbit, nameAttr) ; AttributeHandler<T> h = Map2::getAttribute<T>(orbit, nameAttr) ;
return AttributeHandler_IHM<T>(this, h.id()) ; return AttributeHandler_IHM<T>(this, h.getOrbit(), h.getIndex()) ;
} }
/*************************************************** /***************************************************
...@@ -344,7 +344,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d) ...@@ -344,7 +344,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d)
assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ; assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ;
assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ; assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
unsigned int orbit = AttributeContainer::orbitAttr(this->m_id) ; unsigned int orbit = this->m_orbit ;
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(d, orbit) ; unsigned int index = m->getEmbedding(d, orbit) ;
...@@ -381,7 +381,7 @@ const T& AttributeHandler_IHM<T>::operator[](Dart d) const ...@@ -381,7 +381,7 @@ const T& AttributeHandler_IHM<T>::operator[](Dart d) const
assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ; assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ;
assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ; assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
unsigned int orbit = AttributeContainer::orbitAttr(this->m_id) ; unsigned int orbit = this->m_orbit ;
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(d, orbit) ; unsigned int index = m->getEmbedding(d, orbit) ;
......
...@@ -444,7 +444,7 @@ void computeDual(typename PFP::MAP& map, const FunctorSelect& selected) ...@@ -444,7 +444,7 @@ void computeDual(typename PFP::MAP& map, const FunctorSelect& selected)
for(Dart d = map.begin(); d != map.end(); map.next(d)) for(Dart d = map.begin(); d != map.end(); map.next(d))
{ {
Dart dd = map.alpha1(d) ; Dart dd = map.alpha_1(d) ;
new_phi1[d] = dd ; new_phi1[d] = dd ;
new_phi_1[dd] = d ; new_phi_1[dd] = d ;
} }
...@@ -469,7 +469,6 @@ template <typename PFP, typename EMBV, typename EMB> ...@@ -469,7 +469,6 @@ template <typename PFP, typename EMBV, typename EMB>
void quadranguleFacesVolume(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected) void quadranguleFacesVolume(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected)
{ {
} }
template <typename PFP, typename EMBV, typename EMB> template <typename PFP, typename EMBV, typename EMB>
......
...@@ -36,8 +36,6 @@ namespace Render ...@@ -36,8 +36,6 @@ namespace Render
namespace VBO namespace VBO
{ {
template <typename ATTR_HANDLER> template <typename ATTR_HANDLER>
void MapRender_VBO::updateData(int upType, const ATTR_HANDLER& attrib, ConvertAttrib* conv) void MapRender_VBO::updateData(int upType, const ATTR_HANDLER& attrib, ConvertAttrib* conv)
{ {
...@@ -64,8 +62,6 @@ void MapRender_VBO::updateData(int upType, const ATTR_HANDLER& attrib, ConvertAt ...@@ -64,8 +62,6 @@ void MapRender_VBO::updateData(int upType, const ATTR_HANDLER& attrib, ConvertAt
fillBufferDirect(indexVBO, attrib) ; fillBufferDirect(indexVBO, attrib) ;
} }
template <typename ATTR_HANDLER> template <typename ATTR_HANDLER>
void MapRender_VBO::fillBufferDirect(unsigned int indexVBO, const ATTR_HANDLER& attrib) void MapRender_VBO::fillBufferDirect(unsigned int indexVBO, const ATTR_HANDLER& attrib)
{ {
...@@ -73,7 +69,7 @@ void MapRender_VBO::fillBufferDirect(unsigned int indexVBO, const ATTR_HANDLER& ...@@ -73,7 +69,7 @@ void MapRender_VBO::fillBufferDirect(unsigned int indexVBO, const ATTR_HANDLER&
std::vector<void*> addr; std::vector<void*> addr;
unsigned int byteTableSize; unsigned int byteTableSize;
unsigned int nbb = mv->getStartAddresses(addr, byteTableSize); unsigned int nbb = mv->getBlocksPointers(addr, byteTableSize);
glBindBufferARB(GL_ARRAY_BUFFER, m_VBOBuffers[indexVBO]); glBindBufferARB(GL_ARRAY_BUFFER, m_VBOBuffers[indexVBO]);
glBufferDataARB(GL_ARRAY_BUFFER, nbb * byteTableSize, 0, GL_STREAM_DRAW); glBufferDataARB(GL_ARRAY_BUFFER, nbb * byteTableSize, 0, GL_STREAM_DRAW);
...@@ -88,7 +84,6 @@ void MapRender_VBO::fillBufferDirect(unsigned int indexVBO, const ATTR_HANDLER& ...@@ -88,7 +84,6 @@ void MapRender_VBO::fillBufferDirect(unsigned int indexVBO, const ATTR_HANDLER&
} }
} }
template <typename ATTR_HANDLER> template <typename ATTR_HANDLER>
void MapRender_VBO::fillBufferConvert(unsigned int indexVBO, const ATTR_HANDLER& attrib, ConvertAttrib* conv) void MapRender_VBO::fillBufferConvert(unsigned int indexVBO, const ATTR_HANDLER& attrib, ConvertAttrib* conv)
{ {
...@@ -96,10 +91,10 @@ void MapRender_VBO::fillBufferConvert(unsigned int indexVBO, const ATTR_HANDLER& ...@@ -96,10 +91,10 @@ void MapRender_VBO::fillBufferConvert(unsigned int indexVBO, const ATTR_HANDLER&
std::vector<void*> addr; std::vector<void*> addr;
unsigned int byteTableSize; unsigned int byteTableSize;
unsigned int nbb = mv->getStartAddresses(addr, byteTableSize); unsigned int nbb = mv->getBlocksPointers(addr, byteTableSize);
// alloue la memoire pour le buffer et initialise le conv // alloue la memoire pour le buffer et initialise le conv
conv->reserve(mv->BlockSize()); conv->reserve(mv->getBlockSize());
// bind buffer to update // bind buffer to update
glBindBufferARB(GL_ARRAY_BUFFER, m_VBOBuffers[indexVBO]); glBindBufferARB(GL_ARRAY_BUFFER, m_VBOBuffers[indexVBO]);
...@@ -338,9 +333,6 @@ void MapRender_VBO::initPrimitives(typename PFP::MAP& map, const FunctorSelect& ...@@ -338,9 +333,6 @@ void MapRender_VBO::initPrimitives(typename PFP::MAP& map, const FunctorSelect&
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER, size*sizeof(GLuint), &(tableIndices[0]), GL_STREAM_DRAW); glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER, size*sizeof(GLuint), &(tableIndices[0]), GL_STREAM_DRAW);
} }
template<typename PFP> template<typename PFP>
void MapRender_VBO::initFlatTriangles(typename PFP::MAP& map, const FunctorSelect& good) void MapRender_VBO::initFlatTriangles(typename PFP::MAP& map, const FunctorSelect& good)
{ {
...@@ -393,13 +385,8 @@ void MapRender_VBO::initFlatTriangles(typename PFP::MAP& map, const FunctorSelec ...@@ -393,13 +385,8 @@ void MapRender_VBO::initFlatTriangles(typename PFP::MAP& map, const FunctorSelec
//creating VBO for flat //creating VBO for flat
glBindBufferARB(GL_ARRAY_BUFFER, m_VBOBuffers[FLAT_BUFFER]); glBindBufferARB(GL_ARRAY_BUFFER, m_VBOBuffers[FLAT_BUFFER]);
glBufferDataARB(GL_ARRAY_BUFFER, tableFlat.size() * sizeof(Geom::Vec3f), (char*)(&(tableFlat[0])), GL_STREAM_DRAW); glBufferDataARB(GL_ARRAY_BUFFER, tableFlat.size() * sizeof(Geom::Vec3f), (char*)(&(tableFlat[0])), GL_STREAM_DRAW);
} }
} // namespace VBO } // namespace VBO
} // namespace Render } // namespace Render
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -33,8 +33,6 @@ ...@@ -33,8 +33,6 @@
namespace CGoGN namespace CGoGN
{ {
//WARNING WE USE SHORT INT BLOCK_SIZE MUST BE < 65536
class HoleBlockRef class HoleBlockRef
{ {
protected: protected:
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
/** /**
* affecte un nom de type a l'attribut * affecte un nom de type a l'attribut
*/ */
void setTypeName(const std::string& nameType) { m_name = nameType; } void setTypeName(const std::string& nameType) { m_name = nameType; }
/** /**
* recupere le nom de type affecté à l'attribut * recupere le nom de type affecté à l'attribut
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
/** /**
* Ajout de l'attribut au container (A IMPLEMENTER) * Ajout de l'attribut au container (A IMPLEMENTER)
*/ */
virtual unsigned int addAttribute(AttributeContainer& container, const std::string& attribName)=0; virtual AttributeMultiVectorGen* addAttribute(AttributeContainer& container, const std::string& attribName) = 0;
}; };
/** /**
...@@ -64,7 +64,7 @@ class RegisteredAttribute : public RegisteredBaseAttribute ...@@ -64,7 +64,7 @@ class RegisteredAttribute : public RegisteredBaseAttribute
{ {
public: public:
unsigned int addAttribute(AttributeContainer& container, const std::string& attribName) AttributeMultiVectorGen* addAttribute(AttributeContainer& container, const std::string& attribName)
{ {
return container.addAttribute<T>(attribName); return container.addAttribute<T>(attribName);
} }
......
...@@ -31,35 +31,33 @@ inline AttributeHandler<T> AttribMap::addAttribute(unsigned int orbit, const std ...@@ -31,35 +31,33 @@ inline AttributeHandler<T> AttribMap::addAttribute(unsigned int orbit, const std
if(!isOrbitEmbedded(orbit)) if(!isOrbitEmbedded(orbit))
addEmbedding(orbit) ; addEmbedding(orbit) ;
AttributeContainer& cellCont = m_attribs[orbit] ; AttributeContainer& cellCont = m_attribs[orbit] ;
unsigned int index = cellCont.addAttribute<T>(nameAttr) ; AttributeMultiVector<T>* amv = cellCont.addAttribute<T>(nameAttr) ;
unsigned int idAttr = AttributeContainer::attrId(orbit, index) ; // assume here that we have less than 16M attributes and 255 orbits!! return AttributeHandler<T>(this, amv) ;
return AttributeHandler<T>(this, idAttr) ;
} }
template <typename T> template <typename T>
inline bool AttribMap::removeAttribute(AttributeHandler<T>& attr) inline bool AttribMap::removeAttribute(AttributeHandler<T>& attr)
{ {
assert(attr.isValid() || !"Invalid attribute handler") ; assert(attr.isValid() || !"Invalid attribute handler") ;
unsigned int idAttr = attr.id() ; return m_attribs[attr.getOrbit()].removeAttribute(attr.getIndex()) ;
return m_attribs[AttributeContainer::orbitAttr(idAttr)].removeAttribute(AttributeContainer::indexAttr(idAttr)) ;
} }
template <typename T> template <typename T>
inline AttributeHandler<T> AttribMap::getAttribute(unsigned int orbit, const std::string& nameAttr) inline AttributeHandler<T> AttribMap::getAttribute(unsigned int orbit, const std::string& nameAttr)
{ {
assert(isOrbitEmbedded(orbit) || !"Invalid parameter: orbit not embedded"); assert(isOrbitEmbedded(orbit) || !"Invalid parameter: orbit not embedded");
unsigned int index = m_attribs[orbit].getAttribute(nameAttr) ; AttributeMultiVector<T>& amv = m_attribs[orbit].getDataVector<T>(nameAttr) ;
return AttributeHandler<T>(this, AttributeContainer::attrId(orbit, index)) ; return AttributeHandler<T>(this, &amv) ;
} }
template <typename T> template <typename T>
inline bool AttribMap::swapAttributes(AttributeHandler<T>& attr1, AttributeHandler<T>& attr2) inline bool AttribMap::swapAttributes(AttributeHandler<T>& attr1, AttributeHandler<T>& attr2)
{ {
assert((attr1.isValid() && attr2.isValid()) || !"Invalid attribute handler") ; assert((attr1.isValid() && attr2.isValid()) || !"Invalid attribute handler") ;
assert(AttributeContainer::orbitAttr(attr1.id()) == AttributeContainer::orbitAttr(attr2.id()) || !"Cannot swap attributes of different orbits") ; assert(attr1.getOrbit() == attr2.getOrbit() || !"Cannot swap attributes of different orbits") ;
unsigned int orbit = AttributeContainer::orbitAttr(attr1.id()) ; unsigned int orbit = attr1.getOrbit() ;
unsigned int index1 = AttributeContainer::indexAttr(attr1.id()) ; unsigned int index1 = attr1.getIndex() ;
unsigned int index2 = AttributeContainer::indexAttr(attr2.id()) ; unsigned int index2 = attr2.getIndex() ;
if(index1 != index2) if(index1 != index2)
return m_attribs[orbit].swapAttributes(index1, index2) ; return m_attribs[orbit].swapAttributes(index1, index2) ;
return false ; return false ;
...@@ -69,10 +67,10 @@ template <typename T> ...@@ -69,10 +67,10 @@ template <typename T>
inline bool AttribMap::copyAttribute(AttributeHandler<T>& dst, AttributeHandler<T>& src) inline bool AttribMap::copyAttribute(AttributeHandler<T>& dst, AttributeHandler<T>& src)
{ {
assert((dst.isValid() && src.isValid()) || !"Invalid attribute handler") ; assert((dst.isValid() && src.isValid()) || !"Invalid attribute handler") ;
unsigned int orbit = AttributeContainer::orbitAttr(dst.id()) ; unsigned int orbit = dst.getOrbit() ;
assert(orbit == AttributeContainer::orbitAttr(src.id()) || !"Cannot copy attributes of different orbits") ; assert(orbit == src.getOrbit() || !"Cannot copy attributes of different orbits") ;
unsigned int index_dst = AttributeContainer::indexAttr(dst.id()) ; unsigned int index_dst = dst.getIndex() ;
unsigned int index_src = AttributeContainer::indexAttr(src.id()) ; unsigned int index_src = src.getIndex() ;
if(index_dst != index_src) if(index_dst != index_src)
return m_attribs[orbit].copyAttribute(index_dst, index_src) ; return m_attribs[orbit].copyAttribute(index_dst, index_src) ;
return false ; return false ;
...@@ -92,14 +90,13 @@ inline AttributeMultiVector<Dart>* AttribMap::addRelation(const std::string& nam ...@@ -92,14 +90,13 @@ inline AttributeMultiVector<Dart>* AttribMap::addRelation(const std::string& nam
{ {
AttributeContainer& cont = m_attribs[DART_ORBIT] ; AttributeContainer& cont = m_attribs[DART_ORBIT] ;
unsigned int index = cont.addAttribute<Dart>(name) ; AttributeMultiVector<Dart>* amv = cont.addAttribute<Dart>(name) ;
AttributeMultiVector<Dart>& amv = cont.getDataVector<Dart>(index) ;
// set new relation to fix point for all the darts of the map // set new relation to fix point for all the darts of the map
for(unsigned int i = cont.begin(); i < cont.end(); cont.next(i)) for(unsigned int i = cont.begin(); i < cont.end(); cont.next(i))
amv[i] = i ; amv->operator[](i) = i ;
return &amv ; return amv ;
} }
} // namespace CGoGN } // namespace CGoGN
...@@ -49,24 +49,22 @@ protected: ...@@ -49,24 +49,22 @@ protected:
// we need the map to use dart as index // we need the map to use dart as index
GenericMap* m_map; GenericMap* m_map;
// id of the attribute
unsigned int m_id;
// access to the data // access to the data
AttributeMultiVector<T>* m_attrib; AttributeMultiVector<T>* m_attrib;
protected: protected:
/** /**
* Constructor * Constructor
* @param idAttr identifiant of attribute
* @param m the map which belong attribute * @param m the map which belong attribute
* @param orbit orbit of attribute
* @param orbit index of attribute
*/ */
AttributeHandler(GenericMap* m, unsigned int idAttr) ; AttributeHandler(GenericMap* m, AttributeMultiVector<T>* amv) ;
public: public:
typedef T DATA_TYPE ; typedef T DATA_TYPE ;
AttributeHandler() : m_map(NULL), m_id(AttributeContainer::UNKNOWN), m_attrib(NULL) {} AttributeHandler() : m_map(NULL), m_attrib(NULL) {}
/** /**
* Copy constructor * Copy constructor
...@@ -96,9 +94,14 @@ public: ...@@ -96,9 +94,14 @@ public:
AttributeMultiVector<T>* getDataVector() const ; AttributeMultiVector<T>* getDataVector() const ;
/** /**
* get attribute id * get attribute orbit
*/ */
unsigned int id() const ; unsigned int getOrbit() const ;
/**
* get attribute index
*/
unsigned int getIndex() const ;
/** /**
* get attribute name * get attribute name
...@@ -150,13 +153,13 @@ public: ...@@ -150,13 +153,13 @@ public:
unsigned int begin() const; unsigned int begin() const;
/** /**
* begin of table * end of table
* @return the iterator of the end of container * @return the iterator of the end of container
*/ */
unsigned int end() const; unsigned int end() const;
/** /**
* Next on iterator (equivalent too stl ++) * Next on iterator (equivalent to stl ++)
* @param iter iterator to * @param iter iterator to
*/ */
void next(unsigned int& iter) const; void next(unsigned int& iter) const;
......
...@@ -26,21 +26,15 @@ namespace CGoGN ...@@ -26,21 +26,15 @@ namespace CGoGN
{ {
template <typename T> template <typename T>
AttributeHandler<T>::AttributeHandler(GenericMap* m, unsigned int idAttr): AttributeHandler<T>::AttributeHandler(GenericMap* m, AttributeMultiVector<T>* amv):
m_map(m), m_id(idAttr) m_map(m)
{ {
if(idAttr != AttributeContainer::UNKNOWN) m_attrib = amv ;
{
AttributeMultiVector<T>& atm = m_map->getAttributeVector<T>(m_id);
m_attrib = &atm;
}
else
m_attrib = NULL ;
} }
template <typename T> template <typename T>
AttributeHandler<T>::AttributeHandler(const AttributeHandler<T>& ta): AttributeHandler<T>::AttributeHandler(const AttributeHandler<T>& ta):
m_map(ta.m_map), m_id(ta.m_id), m_attrib(ta.m_attrib) m_map(ta.m_map), m_attrib(ta.m_attrib)
{} {}
template <typename T> template <typename T>
...@@ -48,7 +42,6 @@ inline void AttributeHandler<T>::operator=(const AttributeHandler<T>& ta) ...@@ -48,7 +42,6 @@ inline void AttributeHandler<T>::operator=(const AttributeHandler<T>& ta)
{ {
m_map = ta.m_map ; m_map = ta.m_map ;
m_attrib = ta.m_attrib ; m_attrib = ta.m_attrib ;
m_id = ta.m_id ;
} }
template <typename T> template <typename T>
...@@ -68,31 +61,40 @@ AttributeMultiVector<T>* AttributeHandler<T>::getDataVector() const ...@@ -68,31 +61,40 @@ AttributeMultiVector<T>* AttributeHandler<T>::getDataVector() const
} }
template <typename T> template <typename T>
unsigned int AttributeHandler<T>::id() const unsigned int AttributeHandler<T>::getOrbit() const
{ {
return m_id ; return m_attrib->getOrbit() ;
}
template <typename T>
unsigned int AttributeHandler<T>::getIndex() const
{
return m_attrib->getIndex() ;
} }
template <typename T> template <typename T>
const std::string& AttributeHandler<T>::name() const