Commit 7de130a9 authored by Pierre Kraemer's avatar Pierre Kraemer

update cell selectors after map connectivity update

parent faa28e5c
......@@ -51,7 +51,7 @@ public:
virtual void keyPress(View* view, QKeyEvent* event);
virtual void keyRelease(View* view, QKeyEvent* event);
virtual void mousePress(View* view, QMouseEvent* event);
virtual void mouseRelease(View* view, QMouseEvent* event);
virtual void mouseRelease(View* view, QMouseEvent* event) {}
virtual void mouseMove(View* view, QMouseEvent* event);
virtual void wheelEvent(View* view, QWheelEvent* event);
......@@ -66,6 +66,7 @@ private slots:
// slots called from MapHandler signals
void selectedMapAttributeAdded(unsigned int orbit, const QString& name);
void selectedMapAttributeModified(unsigned int orbit, const QString& name);
void selectedMapConnectivityModified();
public slots:
// slots for Python calls
......
......@@ -48,6 +48,7 @@ bool Surface_Selection_Plugin::enable()
{
connect(cur, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(selectedMapAttributeAdded(unsigned int, const QString&)));
connect(cur, SIGNAL(attributeModified(unsigned int, const QString&)), this, SLOT(selectedMapAttributeModified(unsigned int, const QString&)));
connect(cur, SIGNAL(connectivityModified()), this, SLOT(selectedMapConnectivityModified()));
m_selectionRadius = cur->getBBdiagSize() / 50.0f;
}
......@@ -339,11 +340,6 @@ void Surface_Selection_Plugin::mousePress(View* view, QMouseEvent* event)
}
}
void Surface_Selection_Plugin::mouseRelease(View* view, QMouseEvent* event)
{
}
void Surface_Selection_Plugin::mouseMove(View* view, QMouseEvent* event)
{
if(m_selecting)
......@@ -427,11 +423,13 @@ void Surface_Selection_Plugin::selectedMapChanged(MapHandlerGen *prev, MapHandle
{
disconnect(prev, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(selectedMapAttributeAdded(unsigned int, const QString&)));
disconnect(prev, SIGNAL(attributeModified(unsigned int, const QString&)), this, SLOT(selectedMapAttributeModified(unsigned int, const QString&)));
disconnect(prev, SIGNAL(connectivityModified()), this, SLOT(selectedMapConnectivityModified()));
}
if(cur)
{
connect(cur, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(selectedMapAttributeAdded(unsigned int, const QString&)));
connect(cur, SIGNAL(attributeModified(unsigned int, const QString&)), this, SLOT(selectedMapAttributeModified(unsigned int, const QString&)));
connect(cur, SIGNAL(connectivityModified()), this, SLOT(selectedMapConnectivityModified()));
m_selectionRadius = cur->getBBdiagSize() / 50.0f;
}
}
......@@ -517,6 +515,14 @@ void Surface_Selection_Plugin::selectedMapAttributeModified(unsigned int orbit,
}
}
void Surface_Selection_Plugin::selectedMapConnectivityModified()
{
MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());
const MapParameters& p = h_parameterSet[map];
if(p.positionAttribute.isValid())
updateSelectedCellsRendering();
}
......
......@@ -56,6 +56,8 @@ public:
virtual bool isSelected(Dart d) = 0;
virtual void rebuild() = 0;
inline void setMutuallyExclusive(bool b) { m_isMutuallyExclusive = b; }
inline bool isMutuallyExclusive() const { return m_isMutuallyExclusive; }
inline void setMutuallyExclusiveSet(const QList<CellSelectorGen*>& mex)
......@@ -111,8 +113,8 @@ public:
{
if(!m_cm.isMarked(d))
{
m_cells.push_back(d);
m_cm.mark(d);
m_cells.push_back(d);
if(m_isMutuallyExclusive && !m_mutuallyExclusive.empty())
{
foreach(CellSelectorGen* cs, m_mutuallyExclusive)
......@@ -155,6 +157,18 @@ public:
return m_cm.isMarked(d);
}
void rebuild()
{
m_cells.clear();
TraversorCell<GenericMap, ORBIT> t(m_map, true);
for(Dart d = t.begin(); d != t.end(); d = t.next())
{
if(m_cm.isMarked(d))
m_cells.push_back(d);
}
emit(selectedCellsChanged());
}
private:
GenericMap& m_map;
CellMarker<ORBIT> m_cm;
......
......@@ -118,6 +118,12 @@ public:
m_render->setPrimitiveDirty(Algo::Render::GL2::TRIANGLES);
}
for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
{
foreach (CellSelectorGen* cs, m_cellSelectors[orbit])
cs->rebuild();
}
emit(connectivityModified());
foreach(View* view, l_views)
......
......@@ -309,6 +309,7 @@ public:
this->m_markVector->operator[](*it).unsetMark(this->m_mark) ;
}
};
/**
* class that allows the marking of Darts
* the marked Darts are stored to optimize the unmarking task at destruction
......@@ -362,6 +363,7 @@ public:
return m_markedDarts;
}
};
/**
* class that allows the marking of cells
* the markers are not unmarked at destruction
......
......@@ -65,7 +65,7 @@ public:
template <unsigned int ORBIT>
class TraversorCell<GenericMap,ORBIT> //: public Traversor<GenericMap>
class TraversorCell<GenericMap, ORBIT> //: public Traversor<GenericMap>
{
private:
GenericMap& m ;
......
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