From e039b9fc604eab135e624e30bb527e92d1dc6275 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 25 May 2007 14:17:44 +0000 Subject: [PATCH] Fix for Bug IPAL16066 - IOLS. Selection info: no Data on elements --- src/VISUGUI/VisuGUI_Selection.cxx | 83 ++++++++++--------------------- 1 file changed, 27 insertions(+), 56 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index ea34da39..1df05ba6 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -360,7 +360,8 @@ template QString getVector(TData* theData, int theId){ void VisuGUI_SelectionDlg::onSelectionEvent() { SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule); - if (!aViewWindow) return; + if (!aViewWindow) + return; switch (aViewWindow->SelectionMode()) { case NodeSelection: @@ -372,44 +373,30 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { return; } - if (myFl) return; + if (myFl) + return; myFl = true; int aType = myWidgetStack->id(myWidgetStack->visibleWidget()); - SalomeApp_Application* anApp = dynamic_cast - (SUIT_Session::session()->activeApplication()); - SVTK_Selector* aSelector = aViewWindow->GetSelector(); - VISU::Prs3d_i* aPrs3d = NULL; _PTR(SObject) aSObject; + VISU::Prs3d_i* aPrs3d = NULL; Handle(SALOME_InteractiveObject) anIO; - SALOME_ListIO aListIO; - mySelectionMgr->selectedObjects(aListIO); - - if (aListIO.Extent() == 1) { - anIO = aListIO.First(); - - if (anIO->hasEntry()) { - SalomeApp_Study* theStudy = dynamic_cast(anApp->activeStudy()); - _PTR(Study) aStudy = theStudy->studyDS(); - aSObject = aStudy->FindObjectID(anIO->getEntry()); - - if (aSObject) { - CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject); - - if (!CORBA::is_nil(anObject)) { - PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); - - if (aServant.in()) { - aPrs3d = dynamic_cast(aServant.in()); - } - } - } + VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(myModule); + if(aSelectionInfo.size() == 1){ + // Get selected SObject + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); + VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo; + aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase); + if(aPrs3d){ + anIO = aSelectionItem.myIO; + aSObject = anObjectInfo.mySObject; } } + if (aPrs3d) { VISU::Storable::TRestoringMap aMap; @@ -595,44 +582,30 @@ bool onIdEdit (const QString& theText, TGetVTKIdMethod theMethod, bool theIsCell, const SalomeApp_Module* theModule, - LightApp_SelectionMgr* theSelectionMgr, QLabel* theMeshName, QString theValue, QLabel* theFieldName) { - SalomeApp_Application* anApp = theModule->getApp(); SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(theModule); - if (!aViewWindow) return false; + if (!aViewWindow) + return false; SVTK_Selector* aSelector = aViewWindow->GetSelector(); + _PTR(SObject) aSObject; VISU::Prs3d_i* aPrs3d = NULL; Handle(SALOME_InteractiveObject) anIO; - SALOME_ListIO aListIO; - theSelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type()); - - if (aListIO.Extent() == 1) { - anIO = aListIO.First(); - - if (anIO->hasEntry()) { - SalomeApp_Study* theStudy = dynamic_cast(anApp->activeStudy()); - _PTR(Study) aStudy = theStudy->studyDS(); - _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry()); - - if (aSObject) { - CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject); - - if (!CORBA::is_nil(anObject)) { - PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); - - if (aServant.in()) { - aPrs3d = dynamic_cast(aServant.in()); - } - } - } + VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule); + if(aSelectionInfo.size() == 1){ + // Get selected SObject + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); + VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo; + aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase); + if(aPrs3d){ + anIO = aSelectionItem.myIO; + aSObject = anObjectInfo.mySObject; } } - if (aPrs3d) { int anObjId = theText.toInt(); VISU_PipeLine* aPipeLine = aPrs3d->GetPipeLine(); @@ -662,7 +635,6 @@ void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText) aMethod, false, myModule, - mySelectionMgr, myMeshName, tr("WRN_NO_AVAILABLE_DATA"), myFieldName); @@ -681,7 +653,6 @@ void VisuGUI_SelectionDlg::onCellIdEdit (const QString& theText) aMethod, true, myModule, - mySelectionMgr, myMeshName, tr("WRN_NO_AVAILABLE_DATA"), myFieldName); -- 2.39.2