Commit 4ccf429b authored by Pierre Kraemer's avatar Pierre Kraemer

SCHNApps: add clear function to MapHandler

parent 15a8cad2
......@@ -99,39 +99,11 @@ public:
const AttributeSet& getAttributeSet(unsigned int orbit) const { return m_attribs[orbit]; }
void notifyAttributeModification(const AttributeHandlerGen& attr)
{
QString nameAttr = QString::fromStdString(attr.name());
if(m_vbo.contains(nameAttr))
m_vbo[nameAttr]->updateData(attr);
emit(attributeModified(attr.getOrbit(), nameAttr));
foreach(View* view, l_views)
view->updateGL();
}
void notifyConnectivityModification()
{
if (m_render)
{
m_render->setPrimitiveDirty(Algo::Render::GL2::POINTS);
m_render->setPrimitiveDirty(Algo::Render::GL2::LINES);
m_render->setPrimitiveDirty(Algo::Render::GL2::TRIANGLES);
m_render->setPrimitiveDirty(Algo::Render::GL2::BOUNDARY);
}
for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
{
foreach (CellSelectorGen* cs, m_cellSelectors[orbit])
cs->rebuild();
}
void notifyAttributeModification(const AttributeHandlerGen& attr);
emit(connectivityModified());
void notifyConnectivityModification();
foreach(View* view, l_views)
view->updateGL();
}
void clear(bool removeAttrib);
/*********************************************************
* MANAGE VBOs
......@@ -184,6 +156,7 @@ signals:
void attributeAdded(unsigned int orbit, const QString& nameAttr);
void attributeModified(unsigned int orbit, QString nameAttr);
void attributeRemoved(unsigned int orbit, const QString& nameAttr);
void vboAdded(Utils::VBO* vbo);
void vboRemoved(Utils::VBO* vbo);
......
......@@ -29,6 +29,96 @@ MapHandlerGen::~MapHandlerGen()
delete vbo;
}
/*********************************************************
* MANAGE ATTRIBUTES
*********************************************************/
void MapHandlerGen::notifyAttributeModification(const AttributeHandlerGen& attr)
{
QString nameAttr = QString::fromStdString(attr.name());
if(m_vbo.contains(nameAttr))
m_vbo[nameAttr]->updateData(attr);
emit(attributeModified(attr.getOrbit(), nameAttr));
foreach(View* view, l_views)
view->updateGL();
}
void MapHandlerGen::notifyConnectivityModification()
{
if (m_render)
{
m_render->setPrimitiveDirty(Algo::Render::GL2::POINTS);
m_render->setPrimitiveDirty(Algo::Render::GL2::LINES);
m_render->setPrimitiveDirty(Algo::Render::GL2::TRIANGLES);
m_render->setPrimitiveDirty(Algo::Render::GL2::BOUNDARY);
}
for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
{
foreach (CellSelectorGen* cs, m_cellSelectors[orbit])
cs->rebuild();
}
emit(connectivityModified());
foreach(View* view, l_views)
view->updateGL();
}
void MapHandlerGen::clear(bool removeAttrib)
{
if (m_render)
{
m_render->setPrimitiveDirty(Algo::Render::GL2::POINTS);
m_render->setPrimitiveDirty(Algo::Render::GL2::LINES);
m_render->setPrimitiveDirty(Algo::Render::GL2::TRIANGLES);
m_render->setPrimitiveDirty(Algo::Render::GL2::BOUNDARY);
}
for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
{
foreach (CellSelectorGen* cs, m_cellSelectors[orbit])
cs->rebuild();
}
std::vector<std::string> attrs[NB_ORBITS];
for (unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
{
if(m_map->isOrbitEmbedded(orbit))
{
AttributeContainer& cont = m_map->getAttributeContainer(orbit);
cont.getAttributesNames(attrs[orbit]);
}
}
m_map->clear(removeAttrib);
for (unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
{
for (unsigned int i = 0; i < attrs[orbit].size(); ++i)
{
QString name = QString::fromStdString(attrs[orbit][i]);
if (removeAttrib)
{
if (orbit == VERTEX)
deleteVBO(name);
emit(attributeRemoved(orbit, name));
}
else
{
if (orbit == VERTEX)
updateVBO(name);
emit(attributeModified(orbit, name));
}
}
}
emit(connectivityModified());
}
/*********************************************************
* MANAGE VBOs
*********************************************************/
......
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