X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_SelectionMgr.cpp;h=9f830a74ec5757257915168ab59afcb277ad6e58;hb=a3b2736968186ac435b1e05e530c40becbc82301;hp=0bba0d847e44253acc5379e70d42b3c64deef85b;hpb=0ff644739fa90d6f15d410f69e41bb5d1cddc25a;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 0bba0d847..9f830a74e 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -1,9 +1,11 @@ #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 #include @@ -28,20 +30,16 @@ 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 + QFeatureList aFeatures = selectedFeatures(); + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + aDisplayer->setSelected(aFeatures); emit selectionChanged(); } @@ -49,7 +47,9 @@ void XGUI_SelectionMgr::onObjectBrowserSelection() //************************************************************** void XGUI_SelectionMgr::onViewerSelection() { - // TODO: Highliht selected objects in Object Browser + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + QFeatureList aFeatures = aDisplayer->selectedFeatures(); + myWorkshop->objectBrowser()->setFeaturesSelected(aFeatures); emit selectionChanged(); } @@ -62,36 +62,26 @@ QFeatureList XGUI_SelectionMgr::selectedFeatures() const //************************************************************** QModelIndexList XGUI_SelectionMgr::selectedIndexes() const { - return myWorkshop->objectBrowser()->selectionModel()->selectedIndexes(); + return myWorkshop->objectBrowser()->selectedIndexes(); } //************************************************************** void XGUI_SelectionMgr::selectedAISObjects(AIS_ListOfInteractive& theList) const { - if (myWorkshop->isSalomeMode()) { - Handle(AIS_InteractiveContext) aContext = myWorkshop->salomeConnector()->AISContext(); - theList.Clear(); - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) - theList.Append(aContext->SelectedInteractive()); - } else { - XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); - aViewer->getSelectedObjects(theList); - } + 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 { - if (myWorkshop->isSalomeMode()) { - theList.Clear(); - Handle(AIS_InteractiveContext) aContext = myWorkshop->salomeConnector()->AISContext(); - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { - TopoDS_Shape aShape = aContext->SelectedShape(); - if (!aShape.IsNull()) - theList.Append(aShape); - } - } else { - XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); - aViewer->getSelectedShapes(theList); + 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); } -} \ No newline at end of file +}