#include "XGUI_Displayer.h"
#include "XGUI_Selection.h"
+#ifndef HAVE_SALOME
#include <AppElements_MainWindow.h>
+#endif
#include <ModelAPI_Feature.h>
#include <ModelAPI_Session.h>
selection()->selectedOwners(aSelectedOwners);
Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
- for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) {
- Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i);
- if (aSelectedOwners.FindIndex(anOwner) > 0)
- continue;
+ if (!aContext.IsNull()) {
+ for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) {
+ Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i);
+ if (aSelectedOwners.FindIndex(anOwner) > 0)
+ continue;
- aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
+ aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
+ }
}
}
void XGUI_SelectionMgr::updateSelectedOwners(bool isUpdateViewer)
{
Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+ if (aContext.IsNull())
+ return;
+
const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
SelectMgr_IndexedMapOfOwner anOwnersToDeselect;
{
QObjectPtrList 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);
+ if (!aContext.IsNull()) {
+ QList<ModuleBase_ViewerPrs> aPresentations = selection()->getSelected(ModuleBase_ISelection::Viewer);
+ foreach(ModuleBase_ViewerPrs aPrs, aPresentations) {
+ if (aPrs.object().get())
+ aFeatures.append(aPrs.object());
+ }
}
bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
myWorkshop->objectBrowser()->setObjectsSelected(aFeatures);
emit selectionChanged();
}
+//**************************************************************
+void XGUI_SelectionMgr::updateSelectionBy(const ModuleBase_ISelection::SelectionPlace& thePlace)
+{
+ QList<ModuleBase_ViewerPrs> aSelectedPrs =
+ myWorkshop->selector()->selection()->getSelected(thePlace);
+ if (thePlace == ModuleBase_ISelection::Browser) {
+ XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ aDisplayer->setSelected(aSelectedPrs);
+ }
+
+}
//**************************************************************
void XGUI_SelectionMgr::clearSelection()
{