]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL16066
authorapo <apo@opencascade.com>
Fri, 25 May 2007 14:17:44 +0000 (14:17 +0000)
committerapo <apo@opencascade.com>
Fri, 25 May 2007 14:17:44 +0000 (14:17 +0000)
 - IOLS. Selection info: no Data on elements

src/VISUGUI/VisuGUI_Selection.cxx

index ea34da3943de4ddf205323c51e5210adda57ba26..1df05ba618e067d2519bf4915bde317bb0f86d99 100644 (file)
@@ -360,7 +360,8 @@ template<class TData> QString getVector(TData* theData, int theId){
 
 void VisuGUI_SelectionDlg::onSelectionEvent() {
   SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(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<SalomeApp_Application*>
-    (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<SalomeApp_Study*>(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<VISU::Prs3d_i*>(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<SVTK_ViewWindow>(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<SalomeApp_Study*>(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<VISU::Prs3d_i*>(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);