Commit 5b65878e authored by Pierre Kraemer's avatar Pierre Kraemer

surface selection almost ok

parent 54850cac
...@@ -63,6 +63,7 @@ private slots: ...@@ -63,6 +63,7 @@ private slots:
void selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur); void selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur);
void mapAdded(MapHandlerGen* map); void mapAdded(MapHandlerGen* map);
void mapRemoved(MapHandlerGen* map); void mapRemoved(MapHandlerGen* map);
void updateSelectedCellsRendering();
// slots called from MapHandler signals // slots called from MapHandler signals
void attributeAdded(unsigned int orbit, const QString& name); void attributeAdded(unsigned int orbit, const QString& name);
......
...@@ -38,6 +38,7 @@ bool Surface_Selection_Plugin::enable() ...@@ -38,6 +38,7 @@ bool Surface_Selection_Plugin::enable()
connect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*, MapHandlerGen*))); connect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)));
connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*))); connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*))); connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
connect(m_schnapps, SIGNAL(selectedCellSelectorChanged(CellSelectorGen*)), this, SLOT(updateSelectedCellsRendering()));
foreach(MapHandlerGen* map, m_schnapps->getMapSet().values()) foreach(MapHandlerGen* map, m_schnapps->getMapSet().values())
mapAdded(map); mapAdded(map);
...@@ -53,10 +54,10 @@ void Surface_Selection_Plugin::disable() ...@@ -53,10 +54,10 @@ void Surface_Selection_Plugin::disable()
delete m_selectedVerticesVBO; delete m_selectedVerticesVBO;
delete m_selectionSphereVBO; delete m_selectionSphereVBO;
disconnect(m_schnapps, SIGNAL(selectedViewChanged(View*, View*)), this, SLOT(selectedViewChanged(View*, View*)));
disconnect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*, MapHandlerGen*))); disconnect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)));
disconnect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*))); disconnect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
disconnect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*))); disconnect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
disconnect(m_schnapps, SIGNAL(selectedCellSelectorChanged(CellSelectorGen*)), this, SLOT(updateSelectedCellsRendering()));
} }
void Surface_Selection_Plugin::draw(View *view) void Surface_Selection_Plugin::draw(View *view)
...@@ -257,12 +258,7 @@ void Surface_Selection_Plugin::mousePress(View* view, QMouseEvent* event) ...@@ -257,12 +258,7 @@ void Surface_Selection_Plugin::mousePress(View* view, QMouseEvent* event)
break; break;
} }
} }
updateSelectedCellsRendering();
const std::vector<Dart>& selectedCells = selector->getSelectedCells();
std::vector<PFP2::VEC3> selectedPoints;
for(std::vector<Dart>::const_iterator it = selectedCells.begin(); it != selectedCells.end(); ++it)
selectedPoints.push_back(p.positionAttribute[*it]);
m_selectedVerticesVBO->updateData(selectedPoints);
} }
break; break;
} }
...@@ -408,6 +404,40 @@ void Surface_Selection_Plugin::mapRemoved(MapHandlerGen* map) ...@@ -408,6 +404,40 @@ void Surface_Selection_Plugin::mapRemoved(MapHandlerGen* map)
disconnect(map, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(attributeAdded(unsigned int, const QString&))); disconnect(map, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(attributeAdded(unsigned int, const QString&)));
} }
void Surface_Selection_Plugin::updateSelectedCellsRendering()
{
MapHandlerGen* mh = m_schnapps->getSelectedMap();
const MapParameters& p = h_parameterSet[mh];
if(p.positionAttribute.isValid())
{
unsigned int orbit = m_schnapps->getCurrentOrbit();
CellSelectorGen* selector = m_schnapps->getSelectedSelector(orbit);
const std::vector<Dart>& selectedCells = selector->getSelectedCells();
switch(orbit)
{
case VERTEX : {
std::vector<PFP2::VEC3> selectedPoints;
for(std::vector<Dart>::const_iterator it = selectedCells.begin(); it != selectedCells.end(); ++it)
selectedPoints.push_back(p.positionAttribute[*it]);
m_selectedVerticesVBO->updateData(selectedPoints);
break;
}
case EDGE : {
break;
}
case FACE : {
break;
}
}
}
foreach(View* view, l_views)
{
if(view->isLinkedToMap(mh))
view->updateGL();
}
}
......
...@@ -23,9 +23,7 @@ ControlDock_MapTab::ControlDock_MapTab(SCHNApps* s) : ...@@ -23,9 +23,7 @@ ControlDock_MapTab::ControlDock_MapTab(SCHNApps* s) :
connect(list_maps, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(mapCheckStateChanged(QListWidgetItem*))); connect(list_maps, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(mapCheckStateChanged(QListWidgetItem*)));
connect(list_vertexAttributes, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(vertexAttributeCheckStateChanged(QListWidgetItem*))); connect(list_vertexAttributes, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(vertexAttributeCheckStateChanged(QListWidgetItem*)));
connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*))); connect(tabWidget_mapInfo, SIGNAL(currentChanged(int)), this, SLOT(selectedSelectorChanged()));
connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
connect(m_schnapps, SIGNAL(selectedViewChanged(View*,View*)), this, SLOT(selectedViewChanged(View*,View*)));
connect(list_dartSelectors, SIGNAL(itemSelectionChanged()), this, SLOT(selectedSelectorChanged())); connect(list_dartSelectors, SIGNAL(itemSelectionChanged()), this, SLOT(selectedSelectorChanged()));
connect(list_dartSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*))); connect(list_dartSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
...@@ -51,6 +49,10 @@ ControlDock_MapTab::ControlDock_MapTab(SCHNApps* s) : ...@@ -51,6 +49,10 @@ ControlDock_MapTab::ControlDock_MapTab(SCHNApps* s) :
connect(list_volumeSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*))); connect(list_volumeSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
connect(button_volumeAddSelector, SIGNAL(clicked()), this, SLOT(addSelector())); connect(button_volumeAddSelector, SIGNAL(clicked()), this, SLOT(addSelector()));
connect(button_volumeRemoveSelector, SIGNAL(clicked()), this, SLOT(removeSelector())); connect(button_volumeRemoveSelector, SIGNAL(clicked()), this, SLOT(removeSelector()));
connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
connect(m_schnapps, SIGNAL(selectedViewChanged(View*,View*)), this, SLOT(selectedViewChanged(View*,View*)));
} }
unsigned int ControlDock_MapTab::getCurrentOrbit() unsigned int ControlDock_MapTab::getCurrentOrbit()
......
...@@ -35,7 +35,6 @@ View::View(const QString& name, SCHNApps* s, const QGLWidget* shareWidget) : ...@@ -35,7 +35,6 @@ View::View(const QString& name, SCHNApps* s, const QGLWidget* shareWidget) :
m_currentCamera = m_schnapps->addCamera(); m_currentCamera = m_schnapps->addCamera();
connect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*,MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*,MapHandlerGen*))); connect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*,MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*,MapHandlerGen*)));
connect(m_schnapps, SIGNAL(selectedCellSelectorChanged(CellSelectorGen*)), this, SLOT(updateGL()));
} }
View::~View() View::~View()
......
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