X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_SelectionMgr.cpp;h=bafdeda30423f348fe2e8ca03a30d978d22df891;hb=be7d83df0061448606f62fcb370f59e2617557d1;hp=481db73366a3a4f06714ef767a03a414fbefd2fa;hpb=5d3cd989dcae90a9981d0d874e6fd75676db03d8;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 481db7336..bafdeda30 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -1,24 +1,26 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + #include "XGUI_SelectionMgr.h" #include "XGUI_Workshop.h" -#include "XGUI_MainWindow.h" #include "XGUI_ObjectsBrowser.h" #include "XGUI_SalomeConnector.h" #include "XGUI_ViewerProxy.h" #include "XGUI_Displayer.h" #include "XGUI_Selection.h" +#include + #include -#include +#include #include #include #include #include - - -XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent) : - QObject(theParent), myWorkshop(theParent) +XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent) + : QObject(theParent), + myWorkshop(theParent) { mySelection = new XGUI_Selection(myWorkshop); } @@ -31,33 +33,26 @@ XGUI_SelectionMgr::~XGUI_SelectionMgr() //************************************************************** void XGUI_SelectionMgr::connectViewers() { - connect(myWorkshop->objectBrowser(), SIGNAL(selectionChanged()), - this, SLOT(onObjectBrowserSelection())); + connect(myWorkshop->objectBrowser(), SIGNAL(selectionChanged()), this, + SLOT(onObjectBrowserSelection())); //Connect to other viewers - connect(myWorkshop->viewer(), SIGNAL(selectionChanged()), - this, SLOT(onViewerSelection())); + connect(myWorkshop->viewer(), SIGNAL(selectionChanged()), this, SLOT(onViewerSelection())); } //************************************************************** void XGUI_SelectionMgr::onObjectBrowserSelection() { - QList aObjects = myWorkshop->objectBrowser()->selectedObjects(); - QResultList aResults; - foreach(ObjectPtr aObject, aObjects) { - ResultPtr aRes = boost::dynamic_pointer_cast(aObject); - if (aRes) - aResults.append(aRes); - } + QObjectPtrList aObjects = myWorkshop->objectBrowser()->selectedObjects(); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - aDisplayer->setSelected(aResults); + aDisplayer->setSelected(aObjects); emit selectionChanged(); } //************************************************************** void XGUI_SelectionMgr::onViewerSelection() { - QList aFeatures; + QObjectPtrList aFeatures; Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive(); @@ -65,39 +60,42 @@ void XGUI_SelectionMgr::onViewerSelection() if (aResult) aFeatures.append(aResult); } + bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true); myWorkshop->objectBrowser()->setObjectsSelected(aFeatures); + myWorkshop->objectBrowser()->blockSignals(aBlocked); + emit selectionChanged(); } //************************************************************** /*QFeatureList XGUI_SelectionMgr::selectedFeatures() const -{ - return myWorkshop->objectBrowser()->selectedFeatures(); -} + { + return myWorkshop->objectBrowser()->selectedFeatures(); + } -//************************************************************** -QModelIndexList XGUI_SelectionMgr::selectedIndexes() const -{ - return myWorkshop->objectBrowser()->selectedIndexes(); -} + //************************************************************** + QModelIndexList XGUI_SelectionMgr::selectedIndexes() const + { + return myWorkshop->objectBrowser()->selectedIndexes(); + } -//************************************************************** -void XGUI_SelectionMgr::selectedAISObjects(AIS_ListOfInteractive& theList) const -{ - Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); - theList.Clear(); - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) - theList.Append(aContext->SelectedInteractive()); -} + //************************************************************** + void XGUI_SelectionMgr::selectedAISObjects(AIS_ListOfInteractive& theList) const + { + Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); + theList.Clear(); + for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) + theList.Append(aContext->SelectedInteractive()); + } -//************************************************************** -void XGUI_SelectionMgr::selectedShapes(NCollection_List& theList) const -{ - theList.Clear(); - Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { - TopoDS_Shape aShape = aContext->SelectedShape(); - if (!aShape.IsNull()) - theList.Append(aShape); - } -}*/ + //************************************************************** + void XGUI_SelectionMgr::selectedShapes(NCollection_List& theList) const + { + theList.Clear(); + Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); + for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { + TopoDS_Shape aShape = aContext->SelectedShape(); + if (!aShape.IsNull()) + theList.Append(aShape); + } + }*/