Commit c41b51f0 authored by Sylvain Thery's avatar Sylvain Thery

marker names & load/save/copy ok

parent 3328e365
......@@ -35,3 +35,10 @@ add_executable( Geom_intersectionD ./Geom_intersection.cpp)
target_link_libraries( Geom_intersectionD
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
add_executable( loadSave ./loadSave.cpp)
target_link_libraries( loadSave
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
add_executable( copyfrom ./copyfrom.cpp)
target_link_libraries( copyfrom
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
......@@ -123,6 +123,8 @@ protected:
std::vector< AttributeMultiVector<MarkerBool>* > m_markVectors_free[NB_ORBITS][NB_THREAD] ;
std::mutex m_MarkerStorageMutex[NB_ORBITS];
unsigned int m_nextMarkerId;
/**
* Reserved boundary markers
*/
......@@ -159,7 +161,7 @@ public:
protected:
void init();
void init(bool addBoundaryMarkers=true);
public:
virtual std::string mapTypeName() const = 0 ;
......
......@@ -226,7 +226,16 @@ AttributeMultiVector<MarkerBool>* GenericMap::askMarkVector(unsigned int thread)
else
{
std::lock_guard<std::mutex> lockMV(m_MarkerStorageMutex[ORBIT]);
AttributeMultiVector<MarkerBool>* amv = m_attribs[ORBIT].addAttribute<MarkerBool>("") ;
unsigned int x=m_nextMarkerId++;
std::string number("___");
number[2]= '0'+x%10;
x = x/10;
number[1]= '0'+x%10;
x = x/10;
number[0]= '0'+x%10;
AttributeMultiVector<MarkerBool>* amv = m_attribs[ORBIT].addAttribute<MarkerBool>("marker_" + orbitName(ORBIT) + number);
return amv;
}
}
......
......@@ -54,7 +54,8 @@ std::vector<GenericMap*>* GenericMap::s_instances=NULL;
GenericMap::GenericMap()
GenericMap::GenericMap():
m_nextMarkerId(0)
{
if(m_attributes_registry_map == NULL)
{
......@@ -90,6 +91,8 @@ GenericMap::GenericMap()
registerAttribute<Geom::Matrix33d>(Geom::Matrix33d::CGoGNnameOfType());
registerAttribute<Geom::Matrix44d>(Geom::Matrix44d::CGoGNnameOfType());
registerAttribute<MarkerBool>("MarkerBool");
}
......@@ -163,7 +166,7 @@ GenericMap::~GenericMap()
s_instances->pop_back();
}
void GenericMap::init()
void GenericMap::init(bool addBoundaryMarkers)
{
for(unsigned int i = 0; i < NB_ORBITS; ++i)
{
......@@ -178,8 +181,12 @@ void GenericMap::init()
}
}
m_boundaryMarkers[0] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark0") ;
m_boundaryMarkers[1] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark1") ;
if (addBoundaryMarkers)
{
m_boundaryMarkers[0] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark0") ;
m_boundaryMarkers[1] = m_attribs[DART].addAttribute<MarkerBool>("BoundaryMark1") ;
}
for(std::multimap<AttributeMultiVectorGen*, AttributeHandlerGen*>::iterator it = attributeHandlers.begin(); it != attributeHandlers.end(); ++it)
(*it).second->setInvalid() ;
......
......@@ -136,8 +136,8 @@ bool MapMono::copyFrom(const GenericMap& map)
return false;
}
GenericMap::clear(true);
// add same thread markers than in map (1 in clear)
// clear the map but do not insert boundary markers dart attribute
GenericMap::init(false);
// copy attrib containers
for (unsigned int i = 0; i < NB_ORBITS; ++i)
......
......@@ -323,7 +323,9 @@ bool MapMulti::copyFrom(const GenericMap& map)
return false;
}
GenericMap::clear(true);
// clear the map but do not insert boundary markers dart attribute
GenericMap::init(false);
// load attrib container
for (unsigned int i = 0; i < NB_ORBITS; ++i)
......
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