X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_SelectionMgr.cpp;h=caf78cededfa473823d177c7ad21591edcd6f852;hb=880a5c5b031fe9bbd7833fa3918af3e216d98d34;hp=8365772e730cff18b9dcd7a22ba5c38fdab27eeb;hpb=7c008126286a78ecb31e217b97070f8dcfa56e7c;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 8365772e7..caf78cede 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -1,25 +1,31 @@ #include "XGUI_SelectionMgr.h" + #include "XGUI_Workshop.h" #include "XGUI_MainWindow.h" #include "XGUI_ObjectsBrowser.h" -#include "XGUI_Viewer.h" #include "XGUI_SalomeConnector.h" #include "XGUI_ViewerProxy.h" +#include "XGUI_Displayer.h" +#include "XGUI_Selection.h" #include #include #include #include +#include +#include XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent) : QObject(theParent), myWorkshop(theParent) { + mySelection = new XGUI_Selection(myWorkshop); } XGUI_SelectionMgr::~XGUI_SelectionMgr() { + delete mySelection; } //************************************************************** @@ -29,33 +35,39 @@ void XGUI_SelectionMgr::connectViewers() this, SLOT(onObjectBrowserSelection())); //Connect to other viewers - if (myWorkshop->isSalomeMode()) { - connect(myWorkshop, SIGNAL(salomeViewerSelection()), - this, SLOT(onViewerSelection())); - } else { - connect(myWorkshop->mainWindow()->viewer(), SIGNAL(selectionChanged()), - this, SLOT(onViewerSelection())); - } + connect(myWorkshop->viewer(), SIGNAL(selectionChanged()), + this, SLOT(onViewerSelection())); } //************************************************************** void XGUI_SelectionMgr::onObjectBrowserSelection() { - - // TODO: Highliht selected objects in Viewer 3d - + QList aObjects = myWorkshop->objectBrowser()->selectedObjects(); + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + aDisplayer->setSelected(aObjects); emit selectionChanged(); } //************************************************************** void XGUI_SelectionMgr::onViewerSelection() { - // TODO: Highliht selected objects in Object Browser + QList aFeatures; + Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); + for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { + Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive(); + ObjectPtr aResult = myWorkshop->displayer()->getObject(anIO); + 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 +/*QFeatureList XGUI_SelectionMgr::selectedFeatures() const { return myWorkshop->objectBrowser()->selectedFeatures(); } @@ -63,7 +75,7 @@ QFeatureList XGUI_SelectionMgr::selectedFeatures() const //************************************************************** QModelIndexList XGUI_SelectionMgr::selectedIndexes() const { - return myWorkshop->objectBrowser()->selectionModel()->selectedIndexes(); + return myWorkshop->objectBrowser()->selectedIndexes(); } //************************************************************** @@ -85,4 +97,4 @@ void XGUI_SelectionMgr::selectedShapes(NCollection_List& theList) if (!aShape.IsNull()) theList.Append(aShape); } -} +}*/