Commit 639d734d authored by Sylvain Thery's avatar Sylvain Thery

update load/save

parent 073beee4
......@@ -819,6 +819,17 @@ void Clipping::importMesh(std::string& filename)
else
position = myMap.getAttribute<PFP::VEC3>(VERTEX , attrNames[0]) ;
}
if(extension == std::string(".map"))
{
if(!myMap.loadMapBin(filename))
{
CGoGNerr << "could not import " << filename << CGoGNendl ;
return;
}
else
position = myMap.getAttribute<PFP::VEC3>(VERTEX , "position") ;
}
updateVBOprimitives(Algo::Render::GL2::TRIANGLES | Algo::Render::GL2::LINES | Algo::Render::GL2::POINTS) ;
......
......@@ -340,7 +340,7 @@ public:
* @param name the name
* @ return true if node has the good name
*/
bool chechXmlNode(xmlNodePtr node, const std::string& name) ;
// bool chechXmlNode(xmlNodePtr node, const std::string& name) ;
/**
* update the pointer of embedding vector after loading
......
......@@ -25,10 +25,10 @@
namespace CGoGN
{
inline bool GenericMap::chechXmlNode(xmlNodePtr node, const std::string& name)
{
return (strcmp((char*)(node->name),(char*)(name.c_str())) == 0);
}
//inline bool GenericMap::chechXmlNode(xmlNodePtr node, const std::string& name)
//{
// return (strcmp((char*)(node->name),(char*)(name.c_str())) == 0);
//}
/****************************************
* DARTS MANAGEMENT *
......
......@@ -594,12 +594,16 @@ void AttributeContainer::saveBin(CGoGNostream& fs, unsigned int id)
fs.write(reinterpret_cast<const char*>(&bufferui[0]), bufferui.size()*sizeof(unsigned int));
unsigned int i = 0;
for(std::vector<AttributeMultiVectorGen*>::iterator it = m_tableAttribs.begin(); it != m_tableAttribs.end(); ++it)
{
if (*it != NULL)
(*it)->saveBin(fs, i++);
else
{
CGoGNerr << "PB saving, NULL ptr in m_tableAttribs" << CGoGNendl;
i++;
}
}
//en binaire les blocks de ref
......
......@@ -336,19 +336,6 @@ bool GenericMap::saveMapBin(const std::string& filename)
m_attribs[i].saveBin(fs,i);
}
// save marksets and boundary marker
// std::vector<unsigned int> buffer;
// buffer.reserve(NB_ORBITS+1);
// for (unsigned int i=0; i<NB_ORBITS; ++i)
// {
// buffer.push_back(m_marksets[i][0].getMarkVal());
// }
// buffer.push_back(m_boundaryMarker.getMarkVal()); // save m_boundaryMarker
// fs.write(reinterpret_cast<const char*>(&(buffer[0])), buffer.size()*sizeof(unsigned int));
unsigned int mv = m_boundaryMarker.getMarkVal();
fs.write(reinterpret_cast<const char*>(&mv), sizeof(unsigned int));
return true;
}
......@@ -379,15 +366,11 @@ bool GenericMap::loadMapBin(const std::string& filename)
// Check map type
buff_str = std::string(buff+32);
// CGoGNout << "Map type file = "<< buff_str<< CGoGNendl;
std::string localType = this->mapTypeName();
// localType = localType.substr(0,localType.size()-1);
std::string fileType = buff_str;
std::cout << "localType = "<< localType << " / fileType = " <<fileType<< std::endl;
if (fileType != localType)
{
CGoGNerr << "Not possible to load "<< fileType<< " into "<< localType << " object"<<CGoGNendl;
......@@ -410,15 +393,10 @@ bool GenericMap::loadMapBin(const std::string& filename)
m_attribs[id].loadBin(fs);
}
// load boundary marker
unsigned int mv;
fs.read(reinterpret_cast<char*>(&mv), sizeof(unsigned int));
m_boundaryMarker.setMarkVal(mv);
// retrieve m_embeddings (from m_attribs[DART]
update_m_emb_afterLoad();
update_topo_shortcuts(); // recursive call from real type of map down to GenericMap
// recursive call from real type of map (for topo relation attributes pointers) down to GenericMap ( for Marker_cleaning & pointers)
update_topo_shortcuts();
return true;
......
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