diff --git a/SCHNApps/Plugins/surface_selection/include/surface_selection.h b/SCHNApps/Plugins/surface_selection/include/surface_selection.h index 9b2bc93daba778aec74960bd19557a5435307f3c..63a6c4f29cae4c43059ce3418b4aeb27cc1748b6 100644 --- a/SCHNApps/Plugins/surface_selection/include/surface_selection.h +++ b/SCHNApps/Plugins/surface_selection/include/surface_selection.h @@ -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); diff --git a/SCHNApps/Plugins/surface_selection/src/surface_selection.cpp b/SCHNApps/Plugins/surface_selection/src/surface_selection.cpp index db8f23346751be9d426512cd17055d5a28da4fda..957bb04ea94773f05315fe0f2ccc8a73effd66ac 100644 --- a/SCHNApps/Plugins/surface_selection/src/surface_selection.cpp +++ b/SCHNApps/Plugins/surface_selection/src/surface_selection.cpp @@ -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& selectedCells = selector->getSelectedCells(); - std::vector selectedPoints; - for(std::vector::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& selectedCells = selector->getSelectedCells(); + switch(orbit) + { + case VERTEX : { + std::vector selectedPoints; + for(std::vector::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(); + } +} + diff --git a/SCHNApps/src/controlDock_mapTab.cpp b/SCHNApps/src/controlDock_mapTab.cpp index e648a58ec312fcc11fdc1ca4e95d3d33776f5f40..8d53a5155807214ba7bc35a07c88b18b97df89fa 100644 --- a/SCHNApps/src/controlDock_mapTab.cpp +++ b/SCHNApps/src/controlDock_mapTab.cpp @@ -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() diff --git a/SCHNApps/src/view.cpp b/SCHNApps/src/view.cpp index 5e7d58ff48f9ccb70d9a35678e5361821587350c..817204366fc6168d4ac6cb5937d06a21ebfcd6b7 100644 --- a/SCHNApps/src/view.cpp +++ b/SCHNApps/src/view.cpp @@ -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()