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

surface selection almost ok

parent 54850cac
......@@ -63,6 +63,7 @@ private slots:
void selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur);
void mapAdded(MapHandlerGen* map);
void mapRemoved(MapHandlerGen* map);
void updateSelectedCellsRendering();
// slots called from MapHandler signals
void attributeAdded(unsigned int orbit, const QString& name);
......
......@@ -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(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(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())
mapAdded(map);
......@@ -53,10 +54,10 @@ void Surface_Selection_Plugin::disable()
delete m_selectedVerticesVBO;
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(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(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)
......@@ -257,12 +258,7 @@ void Surface_Selection_Plugin::mousePress(View* view, QMouseEvent* event)
break;
}
}
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);
updateSelectedCellsRendering();
}
break;
}
......@@ -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&)));
}
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) :
connect(list_maps, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(mapCheckStateChanged(QListWidgetItem*)));
connect(list_vertexAttributes, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(vertexAttributeCheckStateChanged(QListWidgetItem*)));
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*)));
connect(tabWidget_mapInfo, SIGNAL(currentChanged(int)), this, SLOT(selectedSelectorChanged()));
connect(list_dartSelectors, SIGNAL(itemSelectionChanged()), this, SLOT(selectedSelectorChanged()));
connect(list_dartSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
......@@ -51,6 +49,10 @@ ControlDock_MapTab::ControlDock_MapTab(SCHNApps* s) :
connect(list_volumeSelectors, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(selectorCheckStateChanged(QListWidgetItem*)));
connect(button_volumeAddSelector, SIGNAL(clicked()), this, SLOT(addSelector()));
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()
......
......@@ -35,7 +35,6 @@ View::View(const QString& name, SCHNApps* s, const QGLWidget* shareWidget) :
m_currentCamera = m_schnapps->addCamera();
connect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*,MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*,MapHandlerGen*)));
connect(m_schnapps, SIGNAL(selectedCellSelectorChanged(CellSelectorGen*)), this, SLOT(updateGL()));
}
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