Commit adb3b266 authored by Sylvain Thery's avatar Sylvain Thery

MAJ saveMapBin et loadMapBin

parent 8d0fb6f4
......@@ -52,9 +52,13 @@ void Topo3RenderMapD::updateData(typename PFP::MAP& map, const FunctorSelect& go
if (m_attIndex.map() != &map)
{
m_attIndex = map.template addAttribute<unsigned int>(DART, "dart_index");
m_attIndex = map.template getAttribute<unsigned int>(DART, "dart_index");
if (!m_attIndex.isValid())
m_attIndex = map.template addAttribute<unsigned int>(DART, "dart_index");
}
m_nbDarts = 0;
// table of center of volume
......@@ -320,7 +324,9 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go
if (m_attIndex.map() != &map)
{
m_attIndex = map.template addAttribute<unsigned int>(DART, "dart_index");
m_attIndex = map.template getAttribute<unsigned int>(DART, "dart_index");
if (!m_attIndex.isValid())
m_attIndex = map.template addAttribute<unsigned int>(DART, "dart_index");
}
m_nbDarts = 0;
......
......@@ -251,12 +251,19 @@ public:
unsigned int getAttributeBlocksPointers(unsigned int attrIndex, std::vector<T*>& vect_ptr, unsigned int& byteBlockSize);
/**
* fill a vector with attributes' names
* @param vector of names
* @return number of attribute
* fill a vector with attributes names
* @param names vector of names
* @return number of attributes
*/
unsigned int getAttributesNames(std::vector<std::string>& names);
/**
* fill a vector with attribute type names
* @param types vector of type names
* @return number of attributes
*/
unsigned int getAttributesTypes(std::vector<std::string>& types);
/**************************************
* CONTAINER MANAGEMENT *
**************************************/
......@@ -470,17 +477,17 @@ protected:
/**
* load xmlpart of container
*/
bool loadXmlBWF(xmlNodePtr node);
// bool loadXmlBWF(xmlNodePtr node);
/**
* load xmlpart of container
*/
bool loadXmlAN(xmlNodePtr node, unsigned int nbb);
// bool loadXmlAN(xmlNodePtr node, unsigned int nbb);
/**
* load xmlpart of container
*/
bool loadXmlDL(xmlNodePtr node);
// bool loadXmlDL(xmlNodePtr node);
public:
/**
......@@ -488,20 +495,20 @@ public:
* @param writer a xmlTextWriterPtr obj
* @param id the id to save
*/
void saveXml(xmlTextWriterPtr writer, unsigned int id);
// void saveXml(xmlTextWriterPtr writer, unsigned int id);
/**
* get id from xml node
* @param node the node of container node of xml tree
* @return the value of id of the node
*/
static unsigned int getIdXmlNode(xmlNodePtr node);
// static unsigned int getIdXmlNode(xmlNodePtr node);
/**
* load from xml node
* @param node the node of container node of xml tree
*/
bool loadXml(xmlNodePtr node);
// bool loadXml(xmlNodePtr node);
/**
* save binary file
......
......@@ -407,7 +407,6 @@ void AttributeMultiVector<T>::saveBin(CGoGNostream& fs, unsigned int id)
memcpy(buffer+len1,s2,len2);
fs.write(reinterpret_cast<const char*>(buffer),(len1+len2)*sizeof(char));
nbs[0] = m_tableData.size();
nbs[1] = nbs[0] * _BLOCKSIZE_* sizeof(T);
fs.write(reinterpret_cast<const char*>(nbs),2*sizeof(unsigned int));
......
......@@ -66,7 +66,12 @@ public:
AttributeMultiVectorGen* addAttribute(AttributeContainer& container, const std::string& attribName)
{
return container.addAttribute<T>(attribName);
unsigned int id = container.getAttributeIndex(attribName);
// new attribute
if (id == AttributeContainer::UNKNOWN)
return container.addAttribute<T>(attribName);
// or existing one
return container.getDataVector<T>(id);
}
};
......
......@@ -45,6 +45,7 @@ public:
virtual void clear(bool removeAttrib) ;
/****************************************
* ATTRIBUTES MANAGEMENT *
****************************************/
......
......@@ -300,6 +300,13 @@ protected:
*/
AttributeMultiVector<Dart>* addRelation(const std::string& name) ;
/**
* Get attributeMultivector pointer of a relation attribute
* @param anem name of relation
* @return the attribute multi-vector pointer
*/
AttributeMultiVector<Dart>* getRelation(const std::string& name);
/****************************************
* THREAD MANAGEMENT *
****************************************/
......@@ -340,19 +347,24 @@ public:
*/
void update_m_emb_afterLoad();
/**
* update the markTables and recursively from real type the topo shortcut pointers
*/
virtual void update_topo_shortcuts();
/**
* Save map in a XML file
* @param filename the file name
* @return true if OK
*/
bool saveMapXml(const std::string& filename, bool compress = false) ;
// bool saveMapXml(const std::string& filename, bool compress = false) ;
/**
* Load map from a XML file
* @param filename the file name
* @return true if OK
*/
bool loadMapXml(const std::string& filename, bool compress = false) ;
// bool loadMapXml(const std::string& filename, bool compress = false) ;
/**
* Save map in a binary file
......@@ -368,6 +380,11 @@ public:
*/
bool loadMapBin(const std::string& filename) ;
/**
* Dump attributes types and names per orbit
*/
void dumpAttributesAndMarkers();
/****************************************
* DARTS TRAVERSALS *
****************************************/
......
......@@ -211,5 +211,13 @@ inline AttributeMultiVector<Dart>* GenericMap::addRelation(const std::string& na
return amv ;
}
inline AttributeMultiVector<Dart>* GenericMap::getRelation(const std::string& name)
{
AttributeContainer& cont = m_attribs[DART] ;
AttributeMultiVector<Dart>* amv = cont.getDataVector<Dart>(cont.getAttributeIndex(name)) ;
return amv ;
}
} //namespace CGoGN
......@@ -57,6 +57,8 @@ public:
virtual void clear(bool removeAttrib);
virtual void update_topo_shortcuts();
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
......
......@@ -55,6 +55,15 @@ inline void Map1::clear(bool removeAttrib)
init() ;
}
inline void Map1::update_topo_shortcuts()
{
GenericMap::update_topo_shortcuts();
m_phi1 = getRelation("phi1");
m_phi_1 = getRelation("phi_1");
}
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
......
......@@ -63,6 +63,8 @@ public:
virtual void clear(bool removeAttrib);
virtual void update_topo_shortcuts();
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
......
......@@ -54,6 +54,13 @@ inline void Map2::clear(bool removeAttrib)
init() ;
}
inline void Map2::update_topo_shortcuts()
{
Map1::update_topo_shortcuts();
m_phi2 = getRelation("phi2");
}
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
......
......@@ -65,6 +65,8 @@ public:
virtual void clear(bool removeAttrib);
virtual void update_topo_shortcuts();
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
......
......@@ -57,6 +57,13 @@ inline void Map3::clear(bool removeAttrib)
init() ;
}
inline void Map3::update_topo_shortcuts()
{
Map2::update_topo_shortcuts();
m_phi3 = getRelation("phi3");
}
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
......
......@@ -82,6 +82,11 @@ public:
return (m_bits == 0);
}
inline void invert()
{
m_bits = ~m_bits;
}
//! Set given marks to YES
/*! @param m the marks to set
*/
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment