From 88b0df6d6b78aebb3d75077c036f7dfe8cf6d850 Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Tue, 1 Oct 2013 10:40:13 +0200 Subject: [PATCH] mutually exclusive selectors OK & surface deformation OK --- .../include/surface_deformation.h | 2 +- .../surface_deformation/src/surface_deformation.cpp | 13 ++++++++++--- .../src/surface_differentialProperties.cpp | 3 +++ SCHNApps/include/mapHandler.h | 4 +++- SCHNApps/src/mapHandler.cpp | 8 +++++++- SCHNApps/src/view.cpp | 2 +- 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/SCHNApps/Plugins/surface_deformation/include/surface_deformation.h b/SCHNApps/Plugins/surface_deformation/include/surface_deformation.h index d004498e..d881ba13 100644 --- a/SCHNApps/Plugins/surface_deformation/include/surface_deformation.h +++ b/SCHNApps/Plugins/surface_deformation/include/surface_deformation.h @@ -88,7 +88,7 @@ private slots: void attributeAdded(unsigned int orbit, const QString& name); void cellSelectorAdded(unsigned int orbit, const QString& name); void cellSelectorRemoved(unsigned int orbit, const QString& name); - void selectedCellsChanged(); + void selectedCellsChanged(CellSelectorGen *cs); public slots: // slots for Python calls diff --git a/SCHNApps/Plugins/surface_deformation/src/surface_deformation.cpp b/SCHNApps/Plugins/surface_deformation/src/surface_deformation.cpp index 28891615..e05f3a82 100644 --- a/SCHNApps/Plugins/surface_deformation/src/surface_deformation.cpp +++ b/SCHNApps/Plugins/surface_deformation/src/surface_deformation.cpp @@ -232,6 +232,7 @@ void Surface_Deformation_Plugin::mapAdded(MapHandlerGen* map) connect(map, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(attributeAdded(unsigned int, const QString&))); connect(map, SIGNAL(cellSelectorAdded(unsigned int, const QString&)), this, SLOT(cellSelectorAdded(unsigned int, const QString&))); connect(map, SIGNAL(cellSelectorRemoved(unsigned int, const QString&)), this, SLOT(cellSelectorRemoved(unsigned int, const QString&))); + connect(map, SIGNAL(selectedCellsChanged(CellSelectorGen*)), this, SLOT(selectedCellsChanged(CellSelectorGen*))); } void Surface_Deformation_Plugin::mapRemoved(MapHandlerGen* map) @@ -239,6 +240,7 @@ void Surface_Deformation_Plugin::mapRemoved(MapHandlerGen* map) disconnect(map, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(attributeAdded(unsigned int, const QString&))); disconnect(map, SIGNAL(cellSelectorAdded(unsigned int, const QString&)), this, SLOT(cellSelectorAdded(unsigned int, const QString&))); disconnect(map, SIGNAL(cellSelectorRemoved(unsigned int, const QString&)), this, SLOT(cellSelectorRemoved(unsigned int, const QString&))); + disconnect(map, SIGNAL(selectedCellsChanged(CellSelectorGen*)), this, SLOT(selectedCellsChanged(CellSelectorGen*))); } @@ -284,10 +286,15 @@ void Surface_Deformation_Plugin::cellSelectorRemoved(unsigned int orbit, const Q } } -void Surface_Deformation_Plugin::selectedCellsChanged() +void Surface_Deformation_Plugin::selectedCellsChanged(CellSelectorGen* cs) { -// nlMakeCurrent(perMap->nlContext) ; -// nlReset(NL_FALSE) ; + MapHandlerGen* map = static_cast(QObject::sender()); + MapParameters& p = h_parameterSet[map]; + if(p.initialized && (p.handleSelector == cs || p.freeSelector == cs)) + { + nlMakeCurrent(p.nlContext) ; + nlReset(NL_FALSE) ; + } } diff --git a/SCHNApps/Plugins/surface_differentialProperties/src/surface_differentialProperties.cpp b/SCHNApps/Plugins/surface_differentialProperties/src/surface_differentialProperties.cpp index dcf5bd18..c9d474e9 100644 --- a/SCHNApps/Plugins/surface_differentialProperties/src/surface_differentialProperties.cpp +++ b/SCHNApps/Plugins/surface_differentialProperties/src/surface_differentialProperties.cpp @@ -34,6 +34,9 @@ bool Surface_DifferentialProperties_Plugin::enable() connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*))); connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*))); + foreach(MapHandlerGen* map, m_schnapps->getMapSet().values()) + mapAdded(map); + return true; } diff --git a/SCHNApps/include/mapHandler.h b/SCHNApps/include/mapHandler.h index 69cca09e..0979fb13 100644 --- a/SCHNApps/include/mapHandler.h +++ b/SCHNApps/include/mapHandler.h @@ -148,6 +148,8 @@ public slots: CellSelectorGen* getCellSelector(unsigned int orbit, const QString& name) const; const CellSelectorSet& getCellSelectorSet(unsigned int orbit) const { return m_cellSelectors[orbit]; } + void selectedCellsChanged(); + public: template CellSelector* getCellSelector(const QString& name) const; @@ -177,7 +179,7 @@ signals: void cellSelectorAdded(unsigned int orbit, const QString& name); void cellSelectorRemoved(unsigned int orbit, const QString& name); - void selectedCellsChanged(); + void selectedCellsChanged(CellSelectorGen* cs); protected: QString m_name; diff --git a/SCHNApps/src/mapHandler.cpp b/SCHNApps/src/mapHandler.cpp index 5443bbba..0862c877 100644 --- a/SCHNApps/src/mapHandler.cpp +++ b/SCHNApps/src/mapHandler.cpp @@ -129,7 +129,7 @@ CellSelectorGen* MapHandlerGen::addCellSelector(unsigned int orbit, const QStrin m_cellSelectors[orbit].insert(name, cs); emit(cellSelectorAdded(orbit, name)); - connect(cs, SIGNAL(selectedCellsChanged()), this, SIGNAL(selectedCellsChanged())); + connect(cs, SIGNAL(selectedCellsChanged()), this, SLOT(selectedCellsChanged())); return cs; } @@ -156,6 +156,12 @@ CellSelectorGen* MapHandlerGen::getCellSelector(unsigned int orbit, const QStrin return NULL; } +void MapHandlerGen::selectedCellsChanged() +{ + CellSelectorGen* cs = static_cast(QObject::sender()); + emit(selectedCellsChanged(cs)); +} + void MapHandlerGen::updateMutuallyExclusiveSelectors(unsigned int orbit) { QList mex; diff --git a/SCHNApps/src/view.cpp b/SCHNApps/src/view.cpp index c11e646c..aa44ff49 100644 --- a/SCHNApps/src/view.cpp +++ b/SCHNApps/src/view.cpp @@ -137,7 +137,7 @@ void View::linkMap(MapHandlerGen* map) updateGL(); connect(map->getFrame(), SIGNAL(modified()), this, SLOT(updateGL())); - connect(map, SIGNAL(selectedCellsChanged()), this, SLOT(updateGL())); + connect(map, SIGNAL(selectedCellsChanged(CellSelectorGen*)), this, SLOT(updateGL())); if(map->isSelectedMap()) setManipulatedFrame(map->getFrame()); -- GitLab