]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Adjust popup
authorapo <apo@opencascade.com>
Wed, 29 Nov 2006 09:19:36 +0000 (09:19 +0000)
committerapo <apo@opencascade.com>
Wed, 29 Nov 2006 09:19:36 +0000 (09:19 +0000)
28 files changed:
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_ClippingDlg.cxx
src/VISUGUI/VisuGUI_CutLinesDlg.cxx
src/VISUGUI/VisuGUI_CutPlanesDlg.cxx
src/VISUGUI/VisuGUI_FieldFilter.cxx
src/VISUGUI/VisuGUI_FieldFilter.h
src/VISUGUI/VisuGUI_InputPane.cxx
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_OffsetDlg.cxx
src/VISUGUI/VisuGUI_Plot3DDlg.cxx
src/VISUGUI/VisuGUI_PopupTools.cxx
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h
src/VISUGUI/VisuGUI_TransparencyDlg.cxx
src/VISUGUI/VisuGUI_TransparencyDlg.h
src/VISUGUI/VisuGUI_ViewTools.cxx
src/VISUGUI/VisuGUI_ViewTools.h
src/VISU_I/VISU_ColoredPrs3dCache_i.cc
src/VISU_I/VISU_ColoredPrs3dFactory.hh
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.hh
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_Prs3d_i.hh
src/VISU_I/VISU_ViewManager_i.cc
src/VISU_I/VISU_ViewManager_i.hh
src/VISU_I/VISU_View_i.cc

index 0c61cec1fc9bcd0c2eb39426bd1481ef21d35e2f..56eeb5942bed40f8f26067d8574c4b3983617881 100644 (file)
@@ -504,9 +504,13 @@ VisuGUI
   if (CheckLock(aStudy,GetDesktop(this)))
     return;
 
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
   // Get selected SObject
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
   if (anIO.IsNull() || !anIO->hasEntry())
     return;
 
@@ -634,28 +638,26 @@ VisuGUI
 
   for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
     Handle(SALOME_InteractiveObject) anIO = it.Value();
-    CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
-    if(CORBA::is_nil(anObject)) 
+    TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+    VISU::Base_i* aBase = anObjectInfo.myBase;
+    if(!aBase) 
       continue;
 
-    VISU::Base_var aBase = VISU::Base::_narrow(anObject);
-    if(!CORBA::is_nil(aBase)){
-      VISU::VISUType aType = aBase->GetType();
-      switch (aType) {
-      case VISU::TCURVE: 
-      case VISU::TCONTAINER: 
-      case VISU::TTABLE: 
-       displayer()->Display(anIO->getEntry());
-       break;
-      default: {
-       VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aBase);
-       if(!CORBA::is_nil(aPrs3d) || aType == VISU::TCOLOREDPRS3DHOLDER){
-         if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
-           displayer()->Display(anIO->getEntry());
-           aViewWindow->highlight(anIO, 1);
-           aViewWindow->getRenderer()->ResetCameraClippingRange();
-           aViewWindow->Repaint();
-         }
+    VISU::VISUType aType = aBase->GetType();
+    switch (aType) {
+    case VISU::TCURVE: 
+    case VISU::TCONTAINER: 
+    case VISU::TTABLE: 
+      displayer()->Display(anIO->getEntry());
+      break;
+    default: {
+      VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
+      if(aPrs3d){
+       if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
+         displayer()->Display(anIO->getEntry());
+         aViewWindow->highlight(anIO, 1);
+         aViewWindow->getRenderer()->ResetCameraClippingRange();
+         aViewWindow->Repaint();
        }
       }}
     }
@@ -677,31 +679,24 @@ VisuGUI
 ::OnErasePrs()
 {
   if(MYDEBUG) MESSAGE("OnErasePrs");
-
   QApplication::setOverrideCursor(Qt::waitCursor);
 
-  //SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  //if (vw)
-  //  vw->unHighlightAll();
-
   SALOME_ListIO aList, aSel;
-  LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
-  mgr->selectedObjects(aSel);
+  LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+  aSelectionMgr->selectedObjects(aSel);
   extractContainers(aSel, aList);
 
   for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
     Handle(SALOME_InteractiveObject) anIO = it.Value();
-    CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
-    //ErasePrs(this, anObject, /*repaint_view_window = */false);
-    ErasePrs(this, anObject, /*repaint_view_window = */true);
+    TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+    VISU::Base_i* aBase = anObjectInfo.myBase;
+    ErasePrs(this, aBase, /*repaint_view_window = */true);
   }
 
-  //if (vw)
-  //  vw->Repaint();
-
   QApplication::restoreOverrideCursor();
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEraseAll()
@@ -727,88 +722,115 @@ VisuGUI
 }
 
 
+namespace
+{
+  //----------------------------------------------------------------------------
+  VISU::Prs3d_i*
+  GetPrsToModify(const SalomeApp_Module* theModule,
+                Handle(SALOME_InteractiveObject)& theIO)
+  {
+    VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
+      return NULL;
+
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    theIO = aSelectionItem.myIO;
+    return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
+  }
+}
+
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEditScalarMap()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEditDeformedShape()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEditScalarMapOnDeformedShape()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEditCutPlanes()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEditCutLines()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEditIsoSurfaces()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEditVectors()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEditStreamLines()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEditPlot3D()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
     EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
 }
 
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnMakeSurfaceframe()
@@ -816,6 +838,7 @@ VisuGUI
   ChangeRepresentation(this, VISU::SURFACEFRAME);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnMakeInsideframe()
@@ -823,6 +846,7 @@ VisuGUI
   ChangeRepresentation(this, VISU::INSIDEFRAME);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnMakeWireframe()
@@ -830,6 +854,7 @@ VisuGUI
   ChangeRepresentation(this, VISU::WIREFRAME);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnMakeSurface()
@@ -837,6 +862,7 @@ VisuGUI
   ChangeRepresentation(this, VISU::SHADED);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnMakePoints()
@@ -844,6 +870,7 @@ VisuGUI
   ChangeRepresentation(this, VISU::POINT);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnMakeShrink()
@@ -851,6 +878,7 @@ VisuGUI
   ChangeRepresentation(this, VISU::SHRINK);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnSetShadingOn()
@@ -858,6 +886,7 @@ VisuGUI
   SetShading(this, true);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnSetShadingOff()
@@ -865,19 +894,48 @@ VisuGUI
   SetShading(this, false);
 }
 
+
+namespace
+{
+  //----------------------------------------------------------------------------
+  bool
+  GetPrs3dSelectionInfo(const SalomeApp_Module* theModule,
+                       VISU::Prs3d_i*& thePrs3d,
+                       SVTK_ViewWindow*& theViewWindow,
+                       VISU_Actor*& thenActor)
+  {
+    VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
+      return false;
+  
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    thePrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+    if(!thePrs3d)
+      return false;
+  
+    theViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if(!theViewWindow)
+      return false;
+  
+    thenActor = FindActor(theViewWindow, thePrs3d);
+    if(!thenActor)
+      return false;
+    
+    return true;
+  }
+}
+
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnChangeColor()
 {
-  SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if(!aViewWindow)
-    return;
-  VISU::Prs3d_i* aPrs3d = GetPrsToModify(this);
-  if(!aPrs3d)
-    return;
-  VISU_Actor* anActor = VISU::FindActor(aViewWindow, aPrs3d);
-  if(!anActor)
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
     return;
+    
   VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
   VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
 
@@ -932,24 +990,21 @@ VisuGUI
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnChangeWireframeColor()
 {
-  SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if(!aViewWindow)
-    return;
-  VISU::Prs3d_i* aPrs3d = GetPrsToModify(this);
-  if(!aPrs3d)
-    return;
-  VISU_Actor* anActor = VISU::FindActor(aViewWindow, aPrs3d);
-  if(!anActor)
-    return;
-  if(aPrs3d->GetType() != VISU::TMESH)
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
     return;
+    
   VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
   if(!aMesh)
     return;
+
   SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
   QColor aColor (int(255*anOldColor.R),
                 int(255*anOldColor.G),
@@ -964,37 +1019,32 @@ VisuGUI
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnChangeOpacity()
 {
-  SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if(!aViewWindow)
-    return;
-  VISU::Prs3d_i* aPrs3d = GetPrsToModify(this);
-  if(!aPrs3d)
-    return;
-  VISU_Actor* anActor = VISU::FindActor(aViewWindow, aPrs3d);
-  if(!anActor)
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
     return;
+  
   VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
   aDialog->show();
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnChangeLines()
 {
-  SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if(!aViewWindow)
-    return;
-  VISU::Prs3d_i* aPrs3d = GetPrsToModify(this);
-  if(!aPrs3d)
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
     return;
-  VISU_Actor* anActor = VISU::FindActor(aViewWindow, aPrs3d);
-  if(!anActor)
-    return;
-
+  
   VisuGUI_CursorDlg* CursorDlg =
     new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
 
@@ -1016,34 +1066,27 @@ VisuGUI
   delete CursorDlg;
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnShowTable()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
-  _PTR(SObject) SO;
-  if ( !CORBA::is_nil( anObject ) ) {
-    VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
-    if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
-      CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
-      if( !CORBA::is_nil( aTable ) ) {
-        VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
-        if ( table ) {
-          SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
-        }
-      }
-    }
-  } else {
-    // possibly this is Table SObject
-    SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
-  }
-
-  if( !IsSObjectTable( SO ) )
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+  if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
+    aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
+  
+  if( !IsSObjectTable( aSObject ) )
     return;
 
   VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
-                                               SO,
+                                               aSObject,
                                                false,
                                                //SAL2670 Orientation of show tables
                                                VisuGUI_TableDlg::ttAuto,
@@ -1051,21 +1094,26 @@ VisuGUI
   dlg->show();
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnCreateTable()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
-  _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
-  _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
-  VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
-  if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+
+  if((aBase && aBase->GetType() == VISU::TCUTLINES) || IsSObjectTable(aSObject)) {
     GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
     UpdateObjBrowser(this);
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnDeleteObjects()
@@ -1096,45 +1144,35 @@ VisuGUI
   aStudyBuilder->NewCommand();
 
   for (i = 0; i < nbSelected; i++) {
-    _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]);
-    if (aSObject) {
-      _PTR(SObject) aRefObj;
-      if (aSObject->ReferencedObject(aRefObj)) {
-        // It can be a reference on curve, published under a container.
-        // In this case the curve should be removed from the container.
-        // See bug 10441.
-        CORBA::Object_var aCorbaObj = VISU::GetSelectedObj(anAppStudy, aRefObj->GetID().c_str());
-        if (!CORBA::is_nil(aCorbaObj)) {
-          VISU::Base_var aVisuObj = VISU::Base::_narrow(aCorbaObj);
-          if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TMESH)
-         {
-           DeleteSObject(this, aCStudy, aRefObj);
-           UpdateObjBrowser(this, true, aRefObj);
+    VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), entries[i]);
+    if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
+      _PTR(SObject) aRefSObject;
+      if (aSObject->ReferencedObject(aRefSObject)) {
+       // It can be a reference on curve, published under a container.
+       // In this case the curve should be removed from the container.
+       // See bug 10441.
+       VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
+       VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
+       if(aRefBase && aRefBase->GetType() == VISU::TMESH){
+         DeleteSObject(this, aCStudy, aRefSObject);
+         UpdateObjBrowser(this, true, aRefSObject);
+       }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
+         CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
+         VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
+         _PTR(SObject) aParentSO = aSObject->GetFather();
+         VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
+         if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
+           if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
+             if(aContainer->GetNbCurves() > 0){
+               aContainer->RemoveCurve(aCurve);
+               UpdateObjBrowser(this, true, aParentSO);
+             }
+           }
          }
-          else if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
-            VISU::Curve_ptr aCurve = VISU::Curve::_narrow(aVisuObj);
-            _PTR(SObject) aParentSO = aSObject->GetFather();
-            aCorbaObj = VISU::GetSelectedObj(anAppStudy, aParentSO->GetID().c_str());
-            if (!CORBA::is_nil(aCorbaObj) && !CORBA::is_nil(aCurve)) {
-              aVisuObj = VISU::Base::_narrow(aCorbaObj);
-              if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
-                // Container object
-                CORBA::Object_ptr aCnt = VISU::Container::_narrow(aVisuObj);
-                if (!CORBA::is_nil(aCnt)) {
-                  VISU::Container_i* aContainer =
-                    dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
-                  if (aContainer && aContainer->GetNbCurves() > 0) {
-                    aContainer->RemoveCurve(aCurve);
-                    UpdateObjBrowser(this, true, aParentSO);
-                  }
-                }
-              }
-            }
-          }
-        }
-      } else {
-        DeleteSObject(this, aCStudy, aSObject);
-        UpdateObjBrowser(this, true, aSObject);
+       }
+      }else{
+       DeleteSObject(this, aCStudy, aSObject);
+       UpdateObjBrowser(this, true, aSObject);
       }
     }
   }
@@ -1144,204 +1182,186 @@ VisuGUI
   mgr->clearSelected();
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnPlotData()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
-  _PTR(SObject) SO;
-  _PTR(GenericAttribute) anAttr;
-  _PTR(AttributeName)    aName;
-  QString SOName;
-  _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
-
-  if ( !CORBA::is_nil( anObject ) ) {
-    VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-    if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
-      // Table (VISU object) is selected
-      CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
-      if( !CORBA::is_nil( aTbl ) ) {
-        VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
-        if ( table ) {
-          _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
-          if ( IsSObjectTable(SO) ) {
-            // get name of SObject
-            if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
-              aName = anAttr;
-              SOName = QString( aName->Value().c_str() );
-            }
-            VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
-            if ( dlg->exec() == QDialog::Accepted ) {
-              if ( !IsStudyLocked( aStudy ) ) {
-                // if study is not locked - create new container, create curves and insert them
-                // into container, then plot container if current viewer is of VIEW_PLOT2D type
-                int horIndex;
-                QValueList<int> verIndices, zIndices;
-                dlg->getCurvesSource( horIndex, verIndices, zIndices );
-                if ( horIndex >= 0 && verIndices.count() > 0 ) {
-                  CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
-                  if( !CORBA::is_nil( aContainer ) ) {
-                    VISU::Container_i* pContainer =
-                      dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
-                    if ( pContainer ) {
-                      for ( int i = 0; i < verIndices.count(); i++ ) {
-                        CORBA::Object_var aNewCurve =
-                          GetVisuGen(this)->CreateCurveWithZ( table->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
-                        if( !CORBA::is_nil( aNewCurve ) ) {
-                          VISU::Curve_i* pCrv =
-                            dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
-                          if ( pCrv ) {
-                            bool isAuto;
-                            int  marker, line, lineWidth;
-                            QColor color;
-                            if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
-                                                         line, lineWidth, color) && !isAuto ) {
-                              SALOMEDS::Color c;
-                              c.R = color.red()  /255.;
-                              c.G = color.green()/255.;
-                              c.B = color.blue() /255.;
-                              pCrv->SetColor( c );
-                              pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
-                              pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
-                            }
-                            pContainer->AddCurve( pCrv->_this() );
-                          }
-                        }
-                      }
-                      UpdateObjBrowser(this);
-                      PlotContainer( this, pContainer, VISU::eDisplay );
-                    }
-                  }
-                }
-              }
-              else {
-                // if study is locked just get curves info and plot them
-                // if current viewer is of VIEW_PLOT2D type
-                QPtrList<Plot2d_Curve> container;
-                dlg->getCurves( container );
-                if ( !container.isEmpty() ) {
-                  GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
-                  GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
-                }
-              }
-            }
-            delete dlg;
-          }
-        }
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
+    if(aBase->GetType() == VISU::TTABLE) {
+      if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
+       _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+       _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
+       if(IsSObjectTable(aSObject)){
+         VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
+         if(aDlg->exec() == QDialog::Accepted){
+           if(!IsStudyLocked(aStudy)){
+             // if study is not locked - create new container, create curves and insert them
+             // into container, then plot container if current viewer is of VIEW_PLOT2D type
+             int horIndex;
+             QValueList<int> verIndices, zIndices;
+             aDlg->getCurvesSource( horIndex, verIndices, zIndices );
+             if( horIndex >= 0 && verIndices.count() > 0 ){
+               CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
+               if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
+                 for( int i = 0; i < verIndices.count(); i++ ){
+                   VISU::Curve_var aCurveObject =
+                     GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
+                   if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
+                     bool isAuto;
+                     int  marker, line, lineWidth;
+                     QColor color;
+                     if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
+                                                   line, lineWidth, color) && !isAuto ) 
+                     {
+                       SALOMEDS::Color c;
+                       c.R = color.red()  /255.;
+                       c.G = color.green()/255.;
+                       c.B = color.blue() /255.;
+                       aCurve->SetColor( c );
+                       aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
+                       aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
+                     }
+                     aContainer->AddCurve(aCurveObject);
+                   }
+                 }
+                 UpdateObjBrowser(this);
+                 PlotContainer( this, aContainer, VISU::eDisplay );
+               }
+             }
+           } else {
+             // get name of SObject
+             QString aSObjectName;
+             _PTR(GenericAttribute) anAttr;
+             if(aSObject->FindAttribute( anAttr, "AttributeName" )){
+               _PTR(AttributeName) aName = anAttr;
+               aSObjectName = QString( aName->Value().c_str() );
+             }
+             // if study is locked just get curves info and plot them
+             // if current viewer is of VIEW_PLOT2D type
+             QPtrList<Plot2d_Curve> container;
+             aDlg->getCurves( container );
+             if ( !container.isEmpty() ) {
+               GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
+               GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
+             }
+           }
+         }
+         delete aDlg;
+       }
       }
     }
-  }
-  else if ( !anIO.IsNull() ) {
+  }else if(!aSelectionItem.myIO.IsNull()){
     // check if Table SObject is selected
-    SO = aStudy->FindObjectID( anIO->getEntry() );
-    if ( IsSObjectTable(SO) ) {
-      // get name of SObject
-      if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
-        aName = anAttr;
-        SOName = QString( aName->Value().c_str() );
-      }
-      VisuGUI_SetupPlot2dDlg* dlg = new VisuGUI_SetupPlot2dDlg( SO, GetDesktop( this ) );
-      if ( dlg->exec() == QDialog::Accepted ) {
-        if ( !IsStudyLocked( aStudy ) ) {
+    _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+    if(IsSObjectTable(aSObject)){
+      VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
+      if(aDlg->exec() == QDialog::Accepted){
+       _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+        if(!IsStudyLocked(aStudy)){
           // if study is not locked - create new table and container objects, create curves
           // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
           int horIndex;
           QValueList<int> verIndices, zIndices;
-          dlg->getCurvesSource( horIndex, verIndices, zIndices );
+          aDlg->getCurvesSource( horIndex, verIndices, zIndices );
           if ( horIndex >= 0 && verIndices.count() > 0 ) {
-            CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
-            CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
-            if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
-              VISU::Table_i*     pTable     = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
-              VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
-
-              if ( pContainer && pTable ) {
-                for ( int i = 0; i < verIndices.count(); i++ ) {
-                  CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurveWithZ
-                    ( pTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
-                  if( !CORBA::is_nil( aNewCurve ) ) {
-                    VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
-                    if ( pCrv ) {
-                      bool isAuto;
-                      int  marker, line, lineWidth;
-                      QColor color;
-                      if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
-                                                   line, lineWidth, color) && !isAuto ) {
-                        SALOMEDS::Color c;
-                        c.R = color.red()/255.;
-                        c.G = color.green()/255.;
-                        c.B = color.blue()/255.;
-                        pCrv->SetColor( c );
-                        pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
-                        pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
-                      }
-                      pContainer->AddCurve( pCrv->_this() );
-                    }
-                  }
-                }
-                UpdateObjBrowser(this);
-                PlotContainer( this, pContainer, VISU::eDisplay );
-              }
-            }
-          }
+            VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
+            if(!CORBA::is_nil(aTableObject)){
+             VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
+              VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
+             for ( int i = 0; i < verIndices.count(); i++ ) {
+               VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
+                 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
+               if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
+                 bool isAuto;
+                 int  marker, line, lineWidth;
+                 QColor color;
+                 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
+                                               line, lineWidth, color) && !isAuto ) 
+                 {
+                   SALOMEDS::Color c;
+                   c.R = color.red()/255.;
+                   c.G = color.green()/255.;
+                   c.B = color.blue()/255.;
+                   aCurve->SetColor( c );
+                   aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
+                   aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
+                 }
+                 aContainerObject->AddCurve(aCurveObject);
+               }
+             }
+             UpdateObjBrowser(this);
+             PlotContainer( this, aContainer, VISU::eDisplay );
+           }
+         }
         } else {
+         // get name of SObject
+         QString aSObjectName;
+         _PTR(GenericAttribute) anAttr;
+         if(aSObject->FindAttribute(anAttr, "AttributeName")){
+           _PTR(AttributeName) aName = anAttr;
+           aSObjectName = QString( aName->Value().c_str() );
+         }
           // if study is locked just get curves info and plot them
           QPtrList<Plot2d_Curve> container;
-          dlg->getCurves( container );
+          aDlg->getCurves( container );
           if ( !container.isEmpty() ) {
             GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
-            GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
+            GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
           }
         }
       }
-      delete dlg;
+      delete aDlg;
     }
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnCurveProperties()
 {
-  LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
-  SALOME_ListIO aListIO;
-  aSelectionMgr->selectedObjects(aListIO);
-  if (aListIO.Extent() != 1) return;
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.size() != 1)
+    return;
 
-  SalomeApp_Study* aAppStudy = GetAppStudy(this);
-  const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
-  CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
-  if (CORBA::is_nil( anObject )) return;
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  if(!aBase) 
+    return;
 
-  VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-  if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
+  if(aBase->GetType() == VISU::TCURVE) {
     // Curve object
-    CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
-    if( !CORBA::is_nil( aCurve ) ) {
-      VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
-      if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
+    if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
+      if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
         Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
 
-        aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
-        aDlg.setMarker( (int)aDSCurve->GetMarker() );
-        SALOMEDS::Color aColor = aDSCurve->GetColor();
+        aDlg.setLine( (int)aCurve->GetLine(), aCurve->GetLineWidth() );
+        aDlg.setMarker( (int)aCurve->GetMarker() );
+        SALOMEDS::Color aColor = aCurve->GetColor();
         aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
         if( aDlg.exec() == QDialog::Accepted ) {
-          aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
-          aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
+          aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
+          aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
           SALOMEDS::Color newColor;
           newColor.R = aDlg.getColor().red()/255.;
           newColor.G = aDlg.getColor().green()/255.;
           newColor.B = aDlg.getColor().blue()/255.;
-          aDSCurve->SetColor( newColor );
-          PlotCurve(this, aDSCurve, VISU::eDisplay);
+          aCurve->SetColor( newColor );
+          PlotCurve(this, aCurve, VISU::eDisplay);
         }
       }
     }
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnClearContainer()
@@ -1349,37 +1369,44 @@ VisuGUI
   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
   if (CheckLock(aCStudy,GetDesktop(this)))
     return;
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (anIO.IsNull() || CORBA::is_nil(anObject))
+
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  if(!aBase)
     return;
 
-  VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-  if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
+  if(aBase->GetType() == VISU::TCONTAINER){
     // Container object
-    CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
-    if (!CORBA::is_nil(aCnt)) {
-      VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
-      if (container && container->GetNbCurves() > 0) {
-        container->Clear();
+    if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
+      if(aContainer && aContainer->GetNbCurves() > 0){
+        aContainer->Clear();
         UpdateObjBrowser(this);
       }
     }
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnEditContainer()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (CORBA::is_nil(anObject)) return;
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  if(!aBase)
+    return;
 
-  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-  if (!aServant.in()) return;
-  VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
-  if (!aContainer) return;
+  VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
+  if(!aContainer) 
+    return;
 
   VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
   aDlg->initFromPrsObject(aContainer);
@@ -1390,6 +1417,7 @@ VisuGUI
   delete aDlg;
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnSaveViewParams()
@@ -1417,6 +1445,7 @@ VisuGUI
   UpdateObjBrowser(this);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnRestoreViewParams()
@@ -1439,6 +1468,7 @@ VisuGUI
     VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnRename()
@@ -1447,15 +1477,18 @@ VisuGUI
   if (CheckLock(aCStudy,GetDesktop(this)))
     return;
 
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-
-  _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
-  if (!aSObj) return;
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+  if(!aSObject)
+    return;
 
   //TEST DU PARENT == VISU
   _PTR(StudyBuilder) aBuilder = aCStudy->NewBuilder();
-  _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObj, "AttributeName");
+  _PTR(GenericAttribute) anAttr = aBuilder->FindOrCreateAttribute(aSObject, "AttributeName");
   if (anAttr) {
     _PTR(AttributeName) aName (anAttr);
     QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
@@ -1463,74 +1496,50 @@ VisuGUI
       QApplication::setOverrideCursor(Qt::waitCursor);
 
       // rename specific objects
-      if (!CORBA::is_nil(anObject)) {
-        VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-        if (!CORBA::is_nil(aVisuObj)) {
-          switch (aVisuObj->GetType()) {
-            case VISU::TCURVE: // Curve object
-            {
-              CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
-              if (!CORBA::is_nil(aCurve)) {
-                VISU::Curve_i* curve =
-                  dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
-                if (curve)
-                  curve->SetName(Name.latin1(), true);
-              }
-              break;
-            }
-            case VISU::TTABLE: // Table object
-            {
-              CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
-              if (!CORBA::is_nil(aTable)) {
-                VISU::Table_i* table =
-                  dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
-                if (table)
-                  table->SetName(Name.latin1(), true);
-              }
-              break;
-            }
-            case VISU::TCONTAINER: // Container object
-            {
-              CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
-              if (!CORBA::is_nil(aContainer)) {
-                VISU::Container_i* container =
-                  dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
-                if (container)
-                  container->SetName(Name.latin1(), true);
-              }
-              break;
-            }
-            default:
-            {
-            }
-          }
-        }
+      if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
+       switch(aBase->GetType()){
+       case VISU::TCURVE: { // Curve object
+         if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
+           aCurve->SetName(Name.latin1(), true);
+         break;
+       }
+       case VISU::TTABLE: { // Table object
+         if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
+           aTable->SetName(Name.latin1(), true);
+         break;
+       }
+       case VISU::TCONTAINER: { // Container object
+         if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
+           aContainer->SetName(Name.latin1(), true);
+         break;
+       }
+       default: {
+       }}
       }
+    }
 
-      // rename the study object
-      aName->SetValue(Name.latin1()); // rename the SObject
-      anIO->setName(Name.latin1()); // rename the InteractiveObject
+    // rename the study object
+    Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+    aName->SetValue(Name.latin1()); // rename the SObject
+    anIO->setName(Name.latin1()); // rename the InteractiveObject
       
-      ViewManagerList pvm_list;
-      getApp()->viewManagers( SPlot2d_Viewer::Type(), pvm_list );
-      for( SUIT_ViewManager* mgr = pvm_list.first(); mgr; mgr = pvm_list.next() )
-      {
-       Plot2d_ViewManager* pvm = dynamic_cast<Plot2d_ViewManager*>( mgr );
-       if( pvm )
-       {
-         SPlot2d_Viewer* pv = dynamic_cast<SPlot2d_Viewer*>( pvm->getViewModel() );
-         if( pv )
-           pv->renameAll( anIO, Name.latin1() );
-       }
+    ViewManagerList aViewManagerList;
+    getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
+    SUIT_ViewManager* aViewManager = aViewManagerList.first();
+    for(; aViewManager; aViewManager = aViewManagerList.next()){
+      if(Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)){
+       if(SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
+         aViewer->renameAll( anIO, Name.latin1() );
       }
+    }
 
-      UpdateObjBrowser(this, false);
+    UpdateObjBrowser(this, false);
 
-      QApplication::restoreOverrideCursor();
-    }
+    QApplication::restoreOverrideCursor();
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnClippingPlanes()
@@ -1538,22 +1547,21 @@ VisuGUI
   new VisuGUI_ClippingDlg (this, "", false);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnSweep()
 {
-  SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
-  if(!aViewWindow)
-    return;
-  VISU::Prs3d_i* aPrs3d = GetPrsToModify(this);
-  if(!aPrs3d)
+  VISU_Actor* anActor = NULL;
+  VISU::Prs3d_i* aPrs3d = NULL;
+  SVTK_ViewWindow* aViewWindow = NULL;
+  if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
     return;
+
   VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
   if(!aScalarMap)
     return;
-  VISU_Actor* anActor = VISU::FindActor(aViewWindow, aPrs3d);
-  if(!anActor)
-    return;
+
   if(!anActor->GetVisibility())
     anActor->VisibilityOn();
 
@@ -1586,6 +1594,7 @@ VisuGUI
   QApplication::restoreOverrideCursor();
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnTimeAnimation()
@@ -1624,7 +1633,7 @@ VisuGUI
   else delete aAnimationDlg;
 }
 
-//************************************************************************
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnShowAnimation()
@@ -1664,22 +1673,6 @@ VisuGUI
   aAnimationDlg->show();
 }
 
-//----------------------------------------------------------------------------
-template<unsigned int colored_prs3d_type_enum> 
-void
-DoSameAs(VISU::Prs3d_i* thePrs3d)
-{
-  typedef typename TL::TColoredEnum2Type<colored_prs3d_type_enum>::TResult TColoredPrs3d;
-  TColoredPrs3d* aColoredPrs3d = dynamic_cast<TColoredPrs3d*>(thePrs3d);
-  TColoredPrs3d* aSameColoredPrs3d = new TColoredPrs3d(VISU::ColoredPrs3d_i::EPublishUnderTimeStamp);
-  aSameColoredPrs3d->SetCResult(aColoredPrs3d->GetCResult());
-  aSameColoredPrs3d->SetMeshName(aColoredPrs3d->GetCMeshName().c_str());
-  aSameColoredPrs3d->SetEntity(aColoredPrs3d->GetEntity());
-  aSameColoredPrs3d->SetFieldName(aColoredPrs3d->GetCFieldName().c_str());
-  aSameColoredPrs3d->SetTimeStampNumber(aColoredPrs3d->GetTimeStampNumber());
-  aSameColoredPrs3d->SameAs(aColoredPrs3d);
-}
-
 //----------------------------------------------------------------------------
 void
 VisuGUI
@@ -1689,54 +1682,55 @@ VisuGUI
   if (CheckLock(aCStudy,GetDesktop(this)))
     return;
 
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (CORBA::is_nil(anObject)) return;
-  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-  if (!aServant.in()) return;
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  if(!aBase)
+    return;
 
-  VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-  if (!aPrsObject) return;
+  VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
+  if(!aPrs3d)
+    return;
 
-  switch (aPrsObject->GetType()) {
-  case VISU::TMESH:
-    {
-      VISU::Mesh_i* aPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
-      VISU::Mesh_i* aSamePrs = new VISU::Mesh_i(aPrs->GetCResult());
-      aSamePrs->SameAs(aPrs);
+  if(aBase->GetType() != VISU::TMESH){
+    VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
+    switch (aBase->GetType()) {
+    case VISU::TSCALARMAP:
+      TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TDEFORMEDSHAPE:
+      TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TSCALARMAPONDEFORMEDSHAPE:
+      TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TCUTPLANES:
+      TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TCUTLINES:
+      TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TISOSURFACE:
+      TSameAsFactory<VISU::TISOSURFACE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TSTREAMLINES:
+      TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TVECTORS:
+      TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
+    case VISU::TPLOT3D:
+      TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp);
+      break;
     }
-    break;
-  case VISU::TSCALARMAP:
-    DoSameAs<VISU::TSCALARMAP>(aPrsObject);
-    break;
-  case VISU::TDEFORMEDSHAPE:
-    DoSameAs<VISU::TDEFORMEDSHAPE>(aPrsObject);
-    break;
-  case VISU::TSCALARMAPONDEFORMEDSHAPE:
-    DoSameAs<VISU::TSCALARMAPONDEFORMEDSHAPE>(aPrsObject);
-    break;
-  case VISU::TCUTPLANES:
-    DoSameAs<VISU::TCUTPLANES>(aPrsObject);
-    break;
-  case VISU::TCUTLINES:
-    DoSameAs<VISU::TCUTLINES>(aPrsObject);
-    break;
-  case VISU::TISOSURFACE:
-    DoSameAs<VISU::TISOSURFACE>(aPrsObject);
-    break;
-  case VISU::TSTREAMLINES:
-    DoSameAs<VISU::TSTREAMLINES>(aPrsObject);
-    break;
-  case VISU::TVECTORS:
-    DoSameAs<VISU::TVECTORS>(aPrsObject);
-    break;
-  case VISU::TPLOT3D:
-    DoSameAs<VISU::TPLOT3D>(aPrsObject);
-    break;
+    UpdateObjBrowser(this);
   }
-  UpdateObjBrowser(this);
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnSelectionInfo()
@@ -1750,6 +1744,7 @@ VisuGUI
                            tr("BUT_OK") );
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnMergeScalarBars()
@@ -1811,6 +1806,7 @@ VisuGUI
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnFreeScalarBars()
@@ -1848,6 +1844,7 @@ VisuGUI
   }
 }
 
+//----------------------------------------------------------------------------
 void
 VisuGUI
 ::OnTranslatePrs()
@@ -1865,8 +1862,8 @@ VisuGUI
     Handle(SALOME_InteractiveObject) anIO = anIter.Value();
     if (anIO->hasEntry()) {
       QString anEntry(anIO->getEntry());
-      CORBA::Object_var anObject = VISU::GetSelectedObj(aStudy, anEntry);
-      if(VISU::Prs3d_i* aPrsObject = VISU::GetPrsToModify(anObject))
+      VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anEntry);
+      if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase))
        aDlg->addPresentation(aPrsObject);
     }
   }
@@ -2642,17 +2639,14 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
        if (isExist && aType == VISU::TCURVE) {
           isCurves = true;
         }  else {
-         CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
-         if (!CORBA::is_nil(anObject)) {
-          VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
-          if (aPrsObject) {
-            if (aPrsObject->GetType() == VISU::TCUTPLANES) {
-              VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
-              if (aCutPrs) {
-                isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
-              }
-            }
-          }
+         VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+         if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
+           if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+             VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
+             if (aCutPrs) {
+               isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
+             }
+           }
          }
        }
       }
@@ -2662,13 +2656,18 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   if (isOneCutPlane)
     action( VISU_PLOT3D_FROM_CUTPLANE )->addTo(theMenu);
 
-  Handle(SALOME_InteractiveObject) anIO;
-  VISU::Storable::TRestoringMap aMap;
-  CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
-
-  if (!CORBA::is_nil(anObject)) {
-    VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObject).in());
-    if (aBase && aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(aSObject);
+  CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+
+  if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
+    if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
       action( VISU_CACHE_PROPERTIES )->addTo(theMenu);
   }
 
@@ -2686,11 +2685,9 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   }
 
   // Check single selection
-  if (aListIO.Extent() != 1) return;
-
-  _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
-  if ( !SO )
+  if (aListIO.Extent() != 1) 
     return;
+
   bool isExist;
   VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
 
@@ -2698,7 +2695,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
     action( VISU_SHOW_ANIMATION )->addTo(theMenu);
 
   } else if (isOBClient) {
-    if (IsSObjectTable(SO)) {
+    if (IsSObjectTable(aSObject)) {
       action( VISU_SHOW_TABLE )->addTo(theMenu);
       action( VISU_CREATE_CURVES )->addTo(theMenu);
       action( VISU_EXPORT_TABLE )->addTo(theMenu);
@@ -2715,7 +2712,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
           action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
         }
       } else {
-        _PTR(SObject) aSFather = SO->GetFather();
+        _PTR(SObject) aSFather = aSObject->GetFather();
         if (aSFather) {
           _PTR(GenericAttribute) anAttr;
           aSFather->FindAttribute(anAttr, "AttributeName");
@@ -3223,14 +3220,13 @@ void VisuGUI::OnPlot3dFromCutPlane()
      aSObject = aCStudy->FindObjectID(anIO->getEntry());
      if ( !aSObject )
        continue;
-     CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
-     if (!CORBA::is_nil(anObject)) {
-       VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
-       if (aPrsObject->GetType() == VISU::TCUTPLANES) {
-         aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
-         if (aCutPrs) 
-           break;
-       }
+     VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+     if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
+       if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+        aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
+        if (aCutPrs) 
+          break;
+       }
      }
    }
  }
@@ -3306,7 +3302,17 @@ void VisuGUI::OnPlot3dFromCutPlane()
 
 void VisuGUI::OnCacheProperties()
 {
-  CORBA::Object_var anObject = GetSelectedObj(this);
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+    return;
+  
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+
+  CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+  if( CORBA::is_nil( anObject ) )
+    return;
+
   VISU::ColoredPrs3dCache_var aCache = VISU::GetInterface<VISU::ColoredPrs3dCache>(anObject);
   if( CORBA::is_nil( aCache ) )
     return;
index 48360aad89ac69935a358ed133ab8283b2ad2c92..9fd8c91ecbcc0065a53dc44bc0122fd899e8e9ce 100644 (file)
@@ -596,18 +596,22 @@ void VisuGUI_ClippingDlg::ClickOnHelp()
 //=================================================================================
 void VisuGUI_ClippingDlg::onSelectionChanged()
 {
-  if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI)) {
-    Handle(SALOME_InteractiveObject) anIO;
-    CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO);
-    if (CORBA::is_nil(anObject)) return;
-    
+  if(SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI)){
+
+    VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(myVisuGUI);
+    if(aSelectionInfo.empty())
+      return;
+
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+    if(!aBase) 
+      return;
+  
+    Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
     if (!anIO.IsNull()) 
       myIO = anIO;
     
-    PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-    if (!aServant.in()) return;
-
-    myPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+    myPrs3d = dynamic_cast<VISU::Prs3d_i*>(aBase);
     if (myPrs3d) {
       std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
       myPlanes.clear();
index c2cb198e0e5d0fd48d7883d897096ed3aa3d199b..6a30c79ca14232a951a77744c5ed541792dbbdae 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "VisuGUI_CutLinesDlg.h"
 
+#include "VISU_ColoredPrs3dFactory.hh"
+
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 #include "VisuGUI_ViewTools.h"
@@ -313,8 +315,7 @@ void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs)
   setOrientation2(thePrs->GetOrientationType2());
 
   hasInit = true;
-  myCutLines = new VISU::CutLines_i(VISU::ColoredPrs3d_i::EDoNotPublish);
-  myCutLines->SameAs(thePrs);
+  myCutLines = VISU::TSameAsFactory<VISU::TCUTLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
   myCutLines->CopyCurvesInverted(thePrs->GetCurvesInverted());
   if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true);
   myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
index 18de422972740868a423f399ce930fe845e41821..5f62ba979d95031d4b1d210565395cc5b787983b 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "VisuGUI_CutPlanesDlg.h"
 
+#include "VISU_ColoredPrs3dFactory.hh"
+
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 #include "VisuGUI_ViewTools.h"
@@ -186,7 +188,7 @@ void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs)
   myPosSpn->setValue(thePrs->GetDisplacement());
   hasInit = true;
   // init table
-  myCutPlanes = new VISU::CutPlanes_i(VISU::ColoredPrs3d_i::EDoNotPublish);
+  myCutPlanes = VISU::TSameAsFactory<VISU::TCUTPLANES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
   myCutPlanes->SameAs(thePrs);
   DrawTable();
 
index d1f22c81c261e5edd0340af9b75110c9ad3eecc8..88c3e3b5e6564887700b0b53fb358443e717795b 100644 (file)
 
 using namespace VISU;
 
-VisuGUI_FieldFilter::VisuGUI_FieldFilter( VISU::VISUType theType ) : 
-  myType( theType )
+VisuGUI_FieldFilter::VisuGUI_FieldFilter( VISU::VISUType theType,
+                                         const QString& thePrs3dEntry ) : 
+  myType( theType ),
+  myPrs3dEntry( thePrs3dEntry )
 {
 }
 
@@ -58,6 +60,9 @@ bool VisuGUI_FieldFilter::isOk( const SUIT_DataOwner* theDataOwner ) const
 
   if( anOwner && anAppStudy )
   {
+    if(myPrs3dEntry == anOwner->entry())
+      return true;
+
     _PTR(Study) aStudy = anAppStudy->studyDS();
     _PTR(SObject) aSObject = aStudy->FindObjectID( anOwner->entry() );
     if (!aSObject)
index b6816e4aa60582183d0abf7cfe1f8a62f5e900a1..21e21aa6b13faa4c38c3e0c58740f3553a86785b 100644 (file)
@@ -33,13 +33,15 @@ class SUIT_DataOwner;
 class VisuGUI_FieldFilter : public SUIT_SelectionFilter
 {
 public:
-  VisuGUI_FieldFilter( VISU::VISUType theType );
+  VisuGUI_FieldFilter( VISU::VISUType theType,
+                      const QString& thePrs3dEntry );
   ~VisuGUI_FieldFilter();
 
   virtual bool     isOk( const SUIT_DataOwner* ) const;
 
 private:
   VISU::VISUType   myType;
+  QString          myPrs3dEntry;
 };
 
 #endif
index f5002c763dbebdff11c24745574423a86647bd0c..db400a6df26db7035f107863c5087a3e70d03d7d 100644 (file)
@@ -85,9 +85,7 @@ VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType, SalomeApp_Module*
   new QLabel( "Time Stamp : ", this );
   myTimeStamps = new QComboBox( this );
 
-  myFieldFilter = new VisuGUI_FieldFilter( theType );
-  GetSelectionMgr( theModule )->installFilter( myFieldFilter );
-
+  myFieldFilter = 0;
   onSelectionChanged();
 
   hide();
@@ -95,12 +93,10 @@ VisuGUI_InputPane::VisuGUI_InputPane( VISU::VISUType theType, SalomeApp_Module*
 
 VisuGUI_InputPane::~VisuGUI_InputPane()
 {
-  GetSelectionMgr( myModule )->removeFilter( myFieldFilter );
-
   if( myFieldFilter )
   {
+    GetSelectionMgr( myModule )->removeFilter( myFieldFilter );
     delete myFieldFilter;
-    myFieldFilter = 0;
   }
 }
 
@@ -196,6 +192,9 @@ void VisuGUI_InputPane::onSelectionChanged()
 
 void VisuGUI_InputPane::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs )
 {
+  myFieldFilter = new VisuGUI_FieldFilter( thePrs->GetType(), thePrs->GetHolderEntry() );
+  GetSelectionMgr( myModule )->installFilter( myFieldFilter );
+
   clear();
 
   CORBA::Long aTimeStampNumber = thePrs->GetTimeStampNumber();
index c073f752f2b9fb31bd1700dcab09ed7091dfe9ec..0406c812f764d7c2d8e284380f2c60299e38d275 100644 (file)
@@ -1050,8 +1050,14 @@ void
 VisuGUI_Module::
 OnEditGaussPoints()
 {
-  Handle(SALOME_InteractiveObject) anIO;
-  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) {
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.empty())
+      return;
+
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+
+  if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aSelectionItem.myObjectInfo.myBase)){
     // Create VVTK_ViewWindow, if it does not exist
     if (VVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this)) {
       EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
@@ -1812,25 +1818,6 @@ void VisuGUI_Module::storeVisualParameters(int savePoint)
   }
 }
 
-// returns VISU_Actor with IO with given entry
-VISU_Actor* getActor( const QString& entry, SVTK_ViewWindow* vtkView )
-{
-  if ( vtkView && !entry.isEmpty() ) {
-    vtkActorCollection* allActors = vtkView->getRenderer()->GetActors();
-    allActors->InitTraversal();
-    while ( vtkActor* actor = allActors->GetNextActor() ) {
-      if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) {
-       if ( vActor->hasIO() ) { // actor corresponds to existing obj
-         Handle(SALOME_InteractiveObject) io = vActor->getIO();
-         if ( entry == io->getEntry() )
-           return vActor;
-       }
-      }
-    }
-  }
-  return 0;
-}
-
 const int ViewerType = 0;
 const int ViewIndex = 1;
 const int ParamName = 2;
@@ -1935,7 +1922,7 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint)
            QMap<QString, VISU_Actor*> viewActorMap;
            if ( vtkActors.contains( entry ) )
              viewActorMap = vtkActors[ entry ];
-           viewActorMap[ viewerTypeIndex ] = getActor( entry, vtkView );
+           viewActorMap[ viewerTypeIndex ] = FindActor( GetAppStudy(this), vtkView, entry );
            vtkActors[ entry ] = viewActorMap;
          }
        }
index 7e535ac60f28d36e7d096f599d0c904a7b2cb481..eb86611ac8e133af45a09d656e5d91466fdbb517 100644 (file)
@@ -179,9 +179,11 @@ bool VisuGUI_OffsetDlg::isToSave() const
 
 void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointType* theOffset)
 {
-  if (myPrsList.count() == 0) return;
+  if (myPrsList.count() == 0) 
+    return;
 
-  if (isToSave()) thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]);
+  if (isToSave()) 
+    thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]);
 
   ViewManagerList aViewManagerList;
   SalomeApp_Application* anApp = myModule->getApp();
@@ -195,15 +197,11 @@ void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointTyp
         if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
          vw->onAdjustTrihedron();
 
-          if (VISU_Actor* anActor = VISU::GetActor(thePrs, vw)) {
+          if (VISU_Actor* anActor = VISU::FindActor(vw, thePrs)) {
             anActor->SetPosition(theOffset);
+           vw->highlight(thePrs->GetIO(), 1);
             vw->getRenderer()->ResetCameraClippingRange();
             vw->Repaint();
-
-            Handle(SALOME_InteractiveObject) anIO;
-            CORBA::Object_var anObject = VISU::GetSelectedObj(myModule, &anIO);
-            if (!CORBA::is_nil(anObject))
-             vw->highlight(anIO, 1);
           }
         }
       }
index bceb5b00ade77516aee2e76bda20f36d0d10f32e..3c4ae0e9b3c1016e4f249dc2027510e8ea1146e7 100644 (file)
@@ -378,7 +378,7 @@ void VisuGUI_Plot3DPane::updatePreview()
     if (!planePreview) {
       myPreviewActor = planePreview = new TPlane(myPrs->GetInput()->GetLength());
       myViewWindow->AddActor(planePreview);
-      fitall = !VISU::GetActor(myPrs, myViewWindow);
+      fitall = !VISU::FindActor(myViewWindow, myPrs);
     }
     // set plane parameters corresponding to control values
     storePrsParams();
index 0708e5768fe2695541957dfab59e174b2b4037d9..2ce90f0c8f361ee72ae0a53f55681d282fbf68e8 100644 (file)
@@ -77,17 +77,19 @@ QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const
 QString VisuGUI_Selection::type( const int ind ) const
 {
   QString aResStr;
-  VISU::Storable::TRestoringMap aMap;
   SalomeApp_Study* aStudy = GetStudy();
   if ( !aStudy )
     return aResStr;
-  CORBA::Object_var anObject = GetSelectedObj( aStudy, entry( ind ), &aMap );  
 
-  VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
-  if ( !CORBA::is_nil( aVisuObj ) ){
-    VISU::VISUType aType = aVisuObj->GetType();
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
+  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+
+  VISU::Base_i* aBase = anObjectInfo.myBase;
+  if(aBase){
+    VISU::VISUType aType = aBase->GetType();
     if(aType == VISU::TCOLOREDPRS3DHOLDER){
-      VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(aVisuObj);
+      CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
+      VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
       aType = aHolder->GetPrsType();
     }
     switch (aType) {
@@ -138,13 +140,15 @@ QString VisuGUI_Selection::type( const int ind ) const
 QString VisuGUI_Selection::nbComponents( const int ind ) const
 {
   QString aResStr;
-  VISU::Storable::TRestoringMap aMap;
   SalomeApp_Study* aStudy = GetStudy();
   if ( !aStudy )
     return aResStr;
-  GetSelectedObj( aStudy, entry( ind ), &aMap );  
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
+  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+
   bool isExist;
-  const QString& aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist);
+  QString aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist);
   if ( isExist )
     aResStr = aVal;
   return aResStr;
@@ -152,10 +156,15 @@ QString VisuGUI_Selection::nbComponents( const int ind ) const
 
 QString VisuGUI_Selection::medEntity( const int ind ) const
 {
+  SalomeApp_Study* aStudy = GetStudy();
+  if ( !aStudy )
+    return QString();
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
+  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+
   bool isExist;
-  VISU::Storable::TRestoringMap aMap;
-  GetSelectedObj( GetStudy(), entry( ind ), &aMap );  
-  const QString& aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist);
+  QString aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist);
   if ( isExist ) {
     using namespace VISU;
     TEntity anEntityId = TEntity(aVal.toInt());
@@ -203,11 +212,13 @@ QString VisuGUI_Selection::medSource( const int ind ) const
 QString VisuGUI_Selection::nbTimeStamps( const int ind ) const
 {
   QString aResStr;
-  VISU::Storable::TRestoringMap aMap;
   SalomeApp_Study* aStudy = GetStudy();
   if ( !aStudy )
     return aResStr;
-  GetSelectedObj( aStudy, entry( ind ), &aMap );  
+
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
+  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+
   bool isExist;
   const QString& aVal = VISU::Storable::FindValue(aMap,"myNbTimeStamps",&isExist);
   if ( isExist )
@@ -215,26 +226,110 @@ QString VisuGUI_Selection::nbTimeStamps( const int ind ) const
   return aResStr;
 }
 
-QString VisuGUI_Selection::representation( const int ind ) const
-{
-  QString aResStr;
 
-  if (SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule)) {
-    if (VISU_Actor* anVISUActor = FindActor(aView, entry(ind).latin1())) {
-      int aRepresent = anVISUActor->GetRepresentation();
-      switch (aRepresent) {
-       ENUM2STRING( aResStr, VISU::POINT );
-       ENUM2STRING( aResStr, VISU::WIREFRAME );
-       ENUM2STRING( aResStr, VISU::SHADED );
-       ENUM2STRING( aResStr, VISU::INSIDEFRAME );
-       ENUM2STRING( aResStr, VISU::SURFACEFRAME );
-      }
+//----------------------------------------------------------------------------
+template<class TPopupFunctor>
+struct TPopupDispatcher
+{
+  QString
+  operator()(const SalomeApp_Module* theModule, 
+            const QString& theEntry)
+  {
+    if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+      QString aType = aViewManager->getType();
+      TPopupFunctor aFunctor;
+      if(aType == SVTK_Viewer::Type())
+       return aFunctor.template Get<SVTK_Viewer>(theModule, theEntry);
+      else if(aType == VVTK_Viewer::Type())
+       return aFunctor.template Get<VVTK_Viewer>(theModule, theEntry);
     }
+    return QString();
+  }    
+};
+
+
+//----------------------------------------------------------------------------
+template<class TViewer>
+bool
+GetPrs3dSelectionInfo(const SalomeApp_Module* theModule,
+                     const QString& theEntry,
+                     VISU::Prs3d_i*& thePrs3d,
+                     SVTK_ViewWindow*& theViewWindow,
+                     VISU_Actor*& thenActor)
+{
+  VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(theModule), theEntry);
+  thePrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
+  if(!thePrs3d)
+    return false;
+  
+  typedef typename TViewer::TViewWindow TViewWindow;
+  theViewWindow = GetActiveViewWindow<TViewWindow>(theModule);
+  if(!theViewWindow)
+    return false;
+  
+  thenActor = FindActor(theViewWindow, thePrs3d);
+  if(!thenActor)
+    return false;
+  
+  return true;
+}
+
+
+//----------------------------------------------------------------------------
+struct TViewFunctor
+{
+  template<class TViewer>
+  QString
+  Get(const SalomeApp_Module* theModule, 
+      const QString& theEntry)
+  {
+    VISU_Actor* anActor = NULL;
+    VISU::Prs3d_i* aPrs3d = NULL;
+    SVTK_ViewWindow* aViewWindow = NULL;
+    if(!GetPrs3dSelectionInfo<TViewer>(theModule, theEntry, aPrs3d, aViewWindow, anActor))
+      return QString();
+    
+    return get(aPrs3d, aViewWindow, anActor);
+  }
+  
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    return QString();
   }
+};
 
-  return aResStr;
+
+//----------------------------------------------------------------------------
+struct TGetRepesentationFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    QString aResStr;
+    switch (theActor->GetRepresentation()) {
+      ENUM2STRING( aResStr, VISU::POINT );
+      ENUM2STRING( aResStr, VISU::WIREFRAME );
+      ENUM2STRING( aResStr, VISU::SHADED );
+      ENUM2STRING( aResStr, VISU::INSIDEFRAME );
+      ENUM2STRING( aResStr, VISU::SURFACEFRAME );
+    }      
+    return aResStr;
+  }
+};
+
+QString VisuGUI_Selection::representation( const int ind ) const
+{
+  return TPopupDispatcher<TGetRepesentationFunctor>()(myModule, entry(ind));
 }
 
+//----------------------------------------------------------------------------
 SalomeApp_Study* VisuGUI_Selection::GetStudy() const
   
 {
@@ -242,6 +337,7 @@ SalomeApp_Study* VisuGUI_Selection::GetStudy() const
   return dynamic_cast<SalomeApp_Study*>( aLightStudy );
 }
 
+//----------------------------------------------------------------------------
 int VisuGUI_Selection::nbChild( const int ind, const bool named ) const
 {
   int cnt = 0;
@@ -262,6 +358,7 @@ int VisuGUI_Selection::nbChild( const int ind, const bool named ) const
   return cnt;
 }
 
+//----------------------------------------------------------------------------
 QString VisuGUI_Selection::nbChildren( const int ind ) const
 {
   QString aResStr;
@@ -269,6 +366,7 @@ QString VisuGUI_Selection::nbChildren( const int ind ) const
   return aResStr;
 }
 
+//----------------------------------------------------------------------------
 QString VisuGUI_Selection::nbNamedChildren( const int ind ) const
 {
   QString aResStr;
@@ -276,92 +374,93 @@ QString VisuGUI_Selection::nbNamedChildren( const int ind ) const
   return aResStr;
 }
 
-namespace
-{
-  struct TIsVisibleFunctor
-  {
-    template<class TViewer>
-    QString
-    Get(VisuGUI* theModule, 
-       const QString& theEntry)
-    {
-      typedef typename TViewer::TViewWindow TViewWindow;
-      if (TViewWindow* aViewWindow = GetActiveViewWindow<TViewWindow>(theModule))
-       if (VISU_Actor* anActor = FindActor(aViewWindow,theEntry.latin1()))
-         return anActor->GetVisibility() ? "true" : "false";
-
-      return QString();
-    }
-  };
 
-  template<class TPopupFunctor>
-  struct TPopupDispatcher
+//----------------------------------------------------------------------------
+struct TIsVisibleFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
   {
-    QString
-    operator()(VisuGUI* theModule, 
-              const QString& theEntry)
-    {
-      if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
-       QString aType = aViewManager->getType();
-       TPopupFunctor aFunctor;
-       if(aType == SVTK_Viewer::Type())
-         return aFunctor.template Get<SVTK_Viewer>(theModule,theEntry);
-       else if(aType == VVTK_Viewer::Type())
-         return aFunctor.template Get<VVTK_Viewer>(theModule,theEntry);
-      }
-      return QString();
-    }    
-  };
-}
+    return theActor->GetVisibility() ? "true" : "false";
+  }
+};
 
 QString VisuGUI_Selection::isVisible( const int ind ) const
 {
-  return TPopupDispatcher<TIsVisibleFunctor>()((VisuGUI*)myModule,entry(ind));
+  return TPopupDispatcher<TIsVisibleFunctor>()(myModule, entry(ind));
 }
 
-QString VisuGUI_Selection::isShrunk( const int ind ) const
-{
-  QString aResStr;
 
-  if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
-    if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
-      if ( anVISUActor->IsShrunkable() )
-       aResStr = anVISUActor->IsShrunk() ? "1" : "0";
+//----------------------------------------------------------------------------
+struct TIsShrunkFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    return theActor->IsShrunk() ? "1" : "0";
+  }
+};
 
-  return aResStr;
+QString VisuGUI_Selection::isShrunk( const int ind ) const
+{
+  return TPopupDispatcher<TIsShrunkFunctor>()(myModule, entry(ind));
 }
 
+
+//----------------------------------------------------------------------------
 QString VisuGUI_Selection::hasActor( const int ind ) const
 {
   return representation( ind ).isEmpty() ? "0" : "1";
 }
 
+
+//----------------------------------------------------------------------------
+struct TIsShadingFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor))
+      return anActor->IsShading() ? "1" : "0";
+    return QString();
+  }
+};
+
 QString VisuGUI_Selection::isShading( const int ind ) const
 {
-  QString aResStr;
-  
-  if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
-    if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
-      if ( VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor) )
-       aResStr = anActor->IsShading() ? "1" : "0";
-  
-  return aResStr;      
+  return TPopupDispatcher<TIsShadingFunctor>()(myModule, entry(ind));
 }
 
-QString VisuGUI_Selection::isScalarMapAct( const int ind ) const
-{
-  QString aResStr;
 
-  if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
-    if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
-    {
-      VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor);
-      aResStr = anActor ? "1" : "0";
-    }
+//----------------------------------------------------------------------------
+struct TIsScalarMapActFunctor: TViewFunctor
+{
+  QString
+  virtual
+  get(VISU::Prs3d_i* thePrs3d,
+      SVTK_ViewWindow* theViewWindow,
+      VISU_Actor* theActor)
+  {
+    return dynamic_cast<VISU_ScalarMapAct*>(theActor)? "1" : "0";
+  }
+};
 
-  return aResStr;
+QString VisuGUI_Selection::isScalarMapAct( const int ind ) const
+{
+  return TPopupDispatcher<TIsScalarMapActFunctor>()(myModule, entry(ind));
 }
 
+
+//----------------------------------------------------------------------------
 bool VisuGUI_Selection::isVisuComponent( const int ind ) const
 {
   SalomeApp_Study* study = GetStudy();
index 140e0edd650ba6eef56b561d11abcc5b605b8489..3a5c5bdfaa707f6dd70b8097371a4ec8928b9d47 100644 (file)
@@ -415,7 +415,7 @@ void VisuGUI_SelectionDlg::onSelectionEvent() {
     myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName);
 
     VISU_Actor* anVISUActor =
-      VISU::FindActor(aViewWindow, aSObject->GetID().c_str());
+      VISU::FindActor(VISU::GetAppStudy(myModule), aViewWindow, aSObject->GetID().c_str());
     if (anVISUActor) {
       vtkFloatingPointType aCoord[6];
       anVISUActor->GetBounds(aCoord);
index 91d6fd39fc44b869568fcf682dc213654a118dc1..876ab8365137b01e6e31f368816c74432241757a 100644 (file)
@@ -360,7 +360,7 @@ void ArrangeDlg::acceptViewWindow()
     for (it = myPrsMap.begin(); it != myPrsMap.end(); ++it) {
       VISU::Prs3d_i* aPrs = it.key();
       Offset& aOffs = myOffsets[it.data()];
-      if (VISU_Actor* anActor = VISU::GetActor(aPrs, myViewWindow))
+      if (VISU_Actor* anActor = VISU::FindActor(myViewWindow, aPrs))
         anActor->SetPosition(aOffs.myOffset);
       if (mySaveChk)
        if (mySaveChk->isChecked())
@@ -375,7 +375,7 @@ void ArrangeDlg::acceptViewWindow()
     QMap<VISU::Prs3d_i*, int>::Iterator it;
     for (it = myPrsMap.begin(), i = 0; it != myPrsMap.end(); ++it, i++) {
       VISU::Prs3d_i* aPrs = it.key();
-      if (VISU_Actor* aActor = VISU::GetActor(aPrs, myViewWindow)) {
+      if (VISU_Actor* aActor = VISU::FindActor(myViewWindow, aPrs)) {
        int aAxis = getAxis();
 
        vtkFloatingPointType aZeroOffset[3];
index 50ad7cfaa708b5f56e284a912d5d24cc31a7f271..17e92c7bdf40bdd5f8f60bbfdb49d6a3ec91067d 100644 (file)
@@ -39,6 +39,7 @@
 #include "VISU_Table_i.hh"
 #include "VISU_Mesh_i.hh"
 #include "VISU_ViewManager_i.hh"
+#include "VISU_ColoredPrs3dHolder_i.hh"
 
 #include "VISU_Actor.h"
 #include "VISU_ScalarMapAct.h"
@@ -269,79 +270,117 @@ namespace VISU
     return aStr;
   }
 
-  //------------------------------------------------------------
-  // Selection
-  CORBA::Object_var
-  GetSelectedObj(const SalomeApp_Study* theStudy,
-                const QString& theEntry,
-                VISU::Storable::TRestoringMap* theMap)
-  {
-    if (!theStudy || theEntry.isEmpty())
-      return CORBA::Object::_nil();
-
-    _PTR(Study) aStudy = GetCStudy(theStudy);
-    _PTR(SObject) aSObject = aStudy->FindObjectID(theEntry.latin1());
-    if (aSObject) {
-      _PTR(GenericAttribute) anAttr;
-      if (theMap && aSObject->FindAttribute(anAttr,"AttributeComment")) {
-       _PTR(AttributeComment) aComment (anAttr);
-       std::string aValue = aComment->Value();
-       QString aString (aValue.c_str());
-       VISU::Storable::StrToMap(aString, *theMap);
-      }
-      return VISU::ClientSObjectToObject(aSObject);
-    }
-    return CORBA::Object::_nil();
-  }
 
-  //------------------------------------------------------------
-  CORBA::Object_var
-  GetSelectedObj(const SalomeApp_Module* theModule,
-                Handle(SALOME_InteractiveObject)* theIO,
-                VISU::Storable::TRestoringMap* theMap)
+  //----------------------------------------------------------------------------
+  // Selection
+  TSelectionInfo
+  GetSelectedObjects(const SalomeApp_Module* theModule)
   {
+    TSelectionInfo aSelectionInfo;
+    const SalomeApp_Study* aStudy = GetAppStudy(theModule);
     LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
     SALOME_ListIO aListIO;
     aSelectionMgr->selectedObjects(aListIO);
     SALOME_ListIteratorOfListIO anIter(aListIO);
     if(anIter.More()){
       Handle(SALOME_InteractiveObject) anIO = anIter.Value();
-      if(theIO)
-       *theIO = anIO;
-      if(anIO->hasEntry())
-       return GetSelectedObj( GetAppStudy(theModule), anIO->getEntry(), theMap );
+      if(anIO->hasEntry()){
+       TObjectInfo anObjectInfo = GetObjectByEntry(aStudy, anIO->getEntry());
+       TSelectionItem aSelectionItem;
+       aSelectionItem.myObjectInfo = anObjectInfo;
+       aSelectionItem.myIO = anIO;
+       aSelectionInfo.push_back(aSelectionItem);
+      }
     }
-    return CORBA::Object::_nil();
+    return aSelectionInfo;
   }
 
-  //------------------------------------------------------------
+
+  //----------------------------------------------------------------------------
+  TObjectInfo
+  GetObjectByEntry(const SalomeApp_Study* theStudy,
+                  const std::string& theEntry)
+  {
+    TObjectInfo anObjectInfo;
+    if(!theStudy || theEntry == "")
+      return anObjectInfo;
+
+    _PTR(Study) aStudy = GetCStudy(theStudy);
+    if(_PTR(SObject) aSObject = aStudy->FindObjectID(theEntry)){
+      anObjectInfo.mySObject = aSObject;
+      CORBA::Object_var anObject = ClientSObjectToObject(aSObject);
+      if(VISU::Base_i* aBase = GetServantInterface<VISU::Base_i>(anObject))
+       anObjectInfo.myBase = aBase;
+    }
+    
+    return anObjectInfo;
+  }
+
+
+  //----------------------------------------------------------------------------
   VISU::Prs3d_i*
-  GetPrsToModify(const SalomeApp_Module* theModule,
-                Handle(SALOME_InteractiveObject)* theIO,
-                VISU::Storable::TRestoringMap* theMap)
+  GetPrs3dToModify(const SalomeApp_Module* theModule,
+                  Base_i* theBase)
   {
-    if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
+    if (CheckLock(GetCStudy(GetAppStudy(theModule)), GetDesktop(theModule)))
       return NULL;
 
-    return GetPrsToModify(GetSelectedObj(theModule, theIO));
+    return GetPrs3dFromBase(theBase);
   }
 
-  //------------------------------------------------------------
+  //----------------------------------------------------------------------------
   VISU::Prs3d_i*
-  GetPrsToModify(CORBA::Object_var theObject)
+  GetPrs3dFromBase(Base_i* theBase)
   {
-    if(VISU::Base_i* aBase = GetServantInterface<VISU::Base_i>(theObject)){
-      if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER){
-       VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(theObject);
-       VISU::ColoredPrs3d_var aColoredPrs3d = aHolder->GetDevice();
-       aBase = dynamic_cast<VISU::Base_i*>(GetServant(aColoredPrs3d).in());
-      }
-      return dynamic_cast<VISU::Prs3d_i*>(aBase);
+    if(theBase && theBase->GetType() == VISU::TCOLOREDPRS3DHOLDER){
+      VISU::ColoredPrs3dHolder_i* aHolder = dynamic_cast<VISU::ColoredPrs3dHolder_i*>(theBase);
+      return aHolder->GetPrs3dDevice();
     }
-    return NULL;
+    return dynamic_cast<VISU::Prs3d_i*>(theBase);
   }
 
-  //------------------------------------------------------------
+  //----------------------------------------------------------------------------
+  Storable::TRestoringMap
+  GetStorableMap(_PTR(SObject) theSObject)
+  {
+    Storable::TRestoringMap aMap;
+    _PTR(GenericAttribute) anAttr;
+    if(theSObject->FindAttribute(anAttr,"AttributeComment")){
+      _PTR(AttributeComment) aComment (anAttr);
+      std::string aValue = aComment->Value();
+      VISU::Storable::StrToMap(aValue.c_str(), aMap);
+    }
+    return aMap;
+  }
+
+  //----------------------------------------------------------------------------
+  bool
+  GetPrs3dSelectionInfo(const SalomeApp_Module* theModule,
+                       VISU::Prs3d_i*& thePrs3d,
+                       SVTK_ViewWindow*& theViewWindow,
+                       VISU_Actor*& thenActor)
+  {
+    VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
+      return false;
+  
+    VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+    thePrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+    if(!thePrs3d)
+      return false;
+  
+    theViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if(!theViewWindow)
+      return false;
+  
+    thenActor = FindActor(theViewWindow, thePrs3d);
+    if(!thenActor)
+      return false;
+    
+    return true;
+  }
+
+  //----------------------------------------------------------------------------
   void
   Add(LightApp_SelectionMgr* theSelectionMgr,
       const Handle(SALOME_InteractiveObject)& theIO)
@@ -491,16 +530,17 @@ namespace VISU
   {
     _PTR(ChildIterator) aChildIter = theStudy->NewChildIterator(theSObject);
     for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
-      _PTR(SObject) aChildSObject = aChildIter->Value();
-      CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject);
-      ErasePrs(theModule, aChildObj, /*repaint_view_window = */false);
+      _PTR(SObject) aSObject = aChildIter->Value();
+      TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(theModule), aSObject->GetID());
+      ErasePrs(theModule, anObjectInfo.myBase, /*repaint_view_window = */false);
     }
 
-    CORBA::Object_var anObj = VISU::ClientSObjectToObject(theSObject);
-    if (!CORBA::is_nil(anObj)) {
-      ErasePrs(theModule, anObj, /*repaint_view_window = */true);
+    TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(theModule), theSObject->GetID());
+    if(anObjectInfo.myBase){
+      ErasePrs(theModule, anObjectInfo.myBase, /*repaint_view_window = */true);
 
-      VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj);
+      CORBA::Object_var anObject = ClientSObjectToObject(theSObject);
+      VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObject);
       if (!CORBA::is_nil(aRemovableObject)) {
         aRemovableObject->RemoveFromStudy();
       }
@@ -535,28 +575,39 @@ namespace VISU
   ChangeRepresentation (const SalomeApp_Module* theModule,
                         VISU::PresentationType  theType)
   {
-    if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)){
-      if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(theModule)){
-       if (VISU_Actor* anActor = GetActor(aPrs3d, aViewWindow)) {
-         switch (theType) {
-         case VISU::SHRINK:
-           if (anActor->IsShrunk())
-             anActor->UnShrink();
-           else
-             anActor->SetShrink();
-           break;
-         default:
-           if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
-             aMesh->SetPresentationType(theType);
-             RecreateActor(theModule, aMesh);
-           } else {
-             anActor->SetRepresentation(theType);
-           }
-         }
-         aViewWindow->Repaint();
-       }
+    TSelectionInfo aSelectionInfo = GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
+      return;
+
+    TSelectionItem aSelectionItem = aSelectionInfo.front();
+    VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+    if(!aPrs3d)
+      return;
+
+    SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if(!aViewWindow)
+      return;
+
+    VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
+    if(!anActor)
+      return;
+
+    switch (theType) {
+    case VISU::SHRINK:
+      if (anActor->IsShrunk())
+       anActor->UnShrink();
+      else
+       anActor->SetShrink();
+      break;
+    default:
+      if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
+       aMesh->SetPresentationType(theType);
+       RecreateActor(theModule, aMesh);
+      } else {
+       anActor->SetRepresentation(theType);
       }
     }
+    aViewWindow->Repaint();
   }
 
   //------------------------------------------------------------
@@ -564,14 +615,26 @@ namespace VISU
   SetShading ( const SalomeApp_Module* theModule,
              bool theOn )
   {
-    if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)){
-      if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(theModule)){
-       if (VISU_Actor* anActor = GetActor(aPrs3d, aViewWindow)) {
-         if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
-           aScalarMapActor->SetShading( theOn );
-       }
-       aViewWindow->Repaint();
-      }
+    TSelectionInfo aSelectionInfo = GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
+      return;
+
+    TSelectionItem aSelectionItem = GetSelectedObjects(theModule).front();
+    VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+    if(!aPrs3d)
+      return;
+
+    SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if(!aViewWindow)
+      return;
+
+    VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
+    if(!anActor)
+      return;
+
+    if(VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor)){
+      aScalarMapActor->SetShading(theOn);
+      aViewWindow->Repaint();
     }
   }
 
@@ -583,10 +646,11 @@ namespace VISU
                  Handle(SALOME_InteractiveObject)& theIO,
                 ColoredPrs3d_i::EPublishInStudyMode& thePublishInStudyMode)
   {
-    CORBA::Object_var anObject = GetSelectedObj(theModule, &theIO);
-    if (!theIO.IsNull() && theIO->hasEntry()){
-      _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
-      theSObject = aStudy->FindObjectID(theIO->getEntry());
+    TSelectionInfo aSelectionInfo = GetSelectedObjects(theModule);
+    if(!aSelectionInfo.empty()){
+      TSelectionItem aSelectionItem = aSelectionInfo.front();
+      theIO = aSelectionItem.myIO;
+      theSObject = aSelectionItem.myObjectInfo.mySObject;
       QString aValue = getValue(theSObject,"myType");
       if (aValue.toInt() == int(VISU::TTIMESTAMP)){
        thePublishInStudyMode = ColoredPrs3d_i::EPublishUnderTimeStamp;
@@ -697,31 +761,13 @@ namespace VISU
 
   //------------------------------------------------------------
   VISU_Actor*
-  FindActor(SVTK_ViewWindow* theViewWindow,
-            const char* theEntry)
+  FindActor(const SalomeApp_Study* theStudy,
+           SVTK_ViewWindow* theViewWindow,
+           const QString& theEntry)
   {
-    using namespace SVTK;
-    if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){
-      if(vtkActorCollection* aCollection = aRenderer->GetActors()){
-        if(VISU_Actor* anActor = Find<VISU_Actor>(aCollection,TIsSameEntry<VISU_Actor>(theEntry))){
-          return anActor;
-        }
-      }
-    }
-    return NULL;
-  }
-
-  //------------------------------------------------------------
-  VISU_Actor*
-  FindActor(SVTK_ViewWindow* theViewWindow,
-            VISU::Prs3d_i* thePrs)
-  {
-    Handle(SALOME_InteractiveObject) anIO = thePrs->GetIO();
-    if(anIO->hasEntry()){
-      std::string anEntry = anIO->getEntry();
-      return FindActor(theViewWindow, anEntry.c_str());
-    }
-    return NULL;
+    TObjectInfo anObjectInfo = GetObjectByEntry(theStudy, theEntry);
+    VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
+    return FindActor(theViewWindow, aPrs3d);
   }
 
   //------------------------------------------------------------
index d05afd289bf7bde7113f244a051869420e9962ca..469c19ce276f5ebc6353fcbdff9b3d3c9e766f75 100644 (file)
@@ -54,8 +54,12 @@ class SalomeApp_Module;
 class SalomeApp_Study;
 class VisuGUI;
 
+#include <vector>
+#include <utility>
+
 namespace VISU 
 {
+  class Base_i;
   class Prs3d_i;
   class Result_i;
   class Table_i;
@@ -64,6 +68,7 @@ namespace VISU
 
   typedef std::vector<SVTK_ViewWindow*> TViewWindows;
 
+  //----------------------------------------------------------------------------
   SUIT_Desktop*                        GetDesktop(const CAM_Module* theModule);
   SalomeApp_Study*                     GetAppStudy(const CAM_Module* theModule);
   _PTR(Study)                          GetCStudy(const SalomeApp_Study* theStudy);
@@ -72,12 +77,14 @@ namespace VISU
   bool                                 CheckLock( _PTR(Study) theStudy,
                                                  QWidget* theWidget );
 
+  //----------------------------------------------------------------------------
   int                                  runAndWait( QDialog* dlg, const bool modal );
 
   void                                 UpdateObjBrowser(SalomeApp_Module* theModule,
                                                        bool theIsUpdateDataModel = true,
                                                        _PTR(SObject) theSObject = _PTR(SObject)());
 
+  //----------------------------------------------------------------------------
   VISU_Gen_i*                          GetVisuGen(const CAM_Module* theModule);
   SALOME_MED::MED_Gen_var              GetMEDEngine();
 
@@ -87,20 +94,37 @@ namespace VISU
   // Selection
   LightApp_SelectionMgr*               GetSelectionMgr(const SalomeApp_Module* theModule);
 
-  CORBA::Object_var                    GetSelectedObj(const SalomeApp_Study* theStudy,
-                                                     const QString& theEntry,
-                                                     VISU::Storable::TRestoringMap* theMap = NULL);
+  //----------------------------------------------------------------------------
+  struct TObjectInfo
+  {
+    Base_i* myBase;
+    _PTR(SObject) mySObject;
+    TObjectInfo():
+      myBase(NULL)
+    {}
+  };
+
+  struct TSelectionItem
+  {
+    TObjectInfo myObjectInfo;
+    Handle(SALOME_InteractiveObject) myIO;
+  };
+
+  typedef std::vector<TSelectionItem>  TSelectionInfo;
 
-  CORBA::Object_var                    GetSelectedObj(const SalomeApp_Module* theModule,
-                                                     Handle(SALOME_InteractiveObject)* theIO = NULL,
-                                                     VISU::Storable::TRestoringMap* theMap = NULL);
+  TSelectionInfo                       GetSelectedObjects(const SalomeApp_Module* theModule);
 
-  VISU::Prs3d_i*                       GetPrsToModify(CORBA::Object_var theObject);
+  TObjectInfo                          GetObjectByEntry(const SalomeApp_Study* theStudy,
+                                                       const std::string& theEntry);
+  
+  VISU::Prs3d_i*                       GetPrs3dToModify(const SalomeApp_Module* theModule,
+                                                       Base_i* theBase);
 
-  VISU::Prs3d_i*                       GetPrsToModify(const SalomeApp_Module* theModule,
-                                                     Handle(SALOME_InteractiveObject)* theIO = NULL,
-                                                     VISU::Storable::TRestoringMap* theMap = NULL);
+  VISU::Prs3d_i*                       GetPrs3dFromBase(Base_i* theBase);
+  
+  Storable::TRestoringMap              GetStorableMap(_PTR(SObject) theSObject);
 
+  //----------------------------------------------------------------------------
   void                                 Add(LightApp_SelectionMgr* theSelectionMgr,
                                           const Handle(SALOME_InteractiveObject)& theIO);
   void                                 Remove(LightApp_SelectionMgr* theSelectionMgr,
@@ -146,8 +170,9 @@ namespace VISU
   void                                 RepaintViewWindows(const SalomeApp_Module* theModule,
                                                          const Handle(SALOME_InteractiveObject)& theIObject);
 
-  VISU_Actor*                          FindActor(SVTK_ViewWindow* theViewWindow,
-                                                const char* theEntry);
+  VISU_Actor*                          FindActor(const SalomeApp_Study* theStudy,
+                                                SVTK_ViewWindow* theViewWindow,
+                                                const QString& theEntry);
   VISU_Actor*                          FindActor(SVTK_ViewWindow* theViewWindow,
                                                 VISU::Prs3d_i* thePrs);
   void                                 RecreateActor(const SalomeApp_Module* theModule,
index e8114766dc8b7fe9dfb7069e55b7b4f291008531..af6de916a173165771285202b69c2af1dbcd0d5b 100644 (file)
@@ -69,6 +69,7 @@ VisuGUI_TransparencyDlg::VisuGUI_TransparencyDlg( VisuGUI* theModule,
                                      WFlags fl)
      : QDialog( VISU::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
                 WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+     myModule(theModule),
      mySelectionMgr( VISU::GetSelectionMgr( theModule ) ),
      myViewWindow( VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule) )
 {
@@ -210,7 +211,7 @@ void VisuGUI_TransparencyDlg::SetTransparency()
     SALOME_ListIteratorOfListIO anIter(aList);
     for (; anIter.More(); anIter.Next()) {
       Handle(SALOME_InteractiveObject) anIO = anIter.Value();
-      VISU_Actor* anActor = VISU::FindActor(myViewWindow, anIO->getEntry());
+      VISU_Actor* anActor = VISU::FindActor(VISU::GetAppStudy(myModule), myViewWindow, anIO->getEntry());
       if (anActor)
        anActor->SetOpacity(opacity);
     }
@@ -243,7 +244,7 @@ void VisuGUI_TransparencyDlg::onSelectionChanged()
     if (aList.Extent() == 1) {
       Handle(SALOME_InteractiveObject) FirstIOS = aList.First();
       if (!FirstIOS.IsNull()) {
-       VISU_Actor* anActor = VISU::FindActor(myViewWindow, FirstIOS->getEntry());
+       VISU_Actor* anActor = VISU::FindActor(VISU::GetAppStudy(myModule), myViewWindow, FirstIOS->getEntry());
        if (anActor)
          opacity = int(anActor->GetOpacity() * 100. + 0.5);
       }
@@ -253,7 +254,7 @@ void VisuGUI_TransparencyDlg::onSelectionChanged()
       for (; It.More(); It.Next()) {
        Handle(SALOME_InteractiveObject) IO = It.Value();
        if (!IO.IsNull()) {
-         VISU_Actor* anActor = VISU::FindActor(myViewWindow, IO->getEntry());
+         VISU_Actor* anActor = VISU::FindActor(VISU::GetAppStudy(myModule), myViewWindow, IO->getEntry());
          if (anActor) {
            int op = int(anActor->GetOpacity() * 100. + 0.5);
            if (setOp < 0)
index 2809a46055777f66492fa586cc4192e79a4aabf5..2bf3ddbb98875c9557f7b1a7c7aef1dbbbf9c6c2 100644 (file)
@@ -36,6 +36,7 @@ class QLabel;
 class QPushButton;
 class QSlider;
 class LightApp_SelectionMgr;
+class SalomeApp_Module;
 class SVTK_Selector;
 class SVTK_ViewWindow;
 class VisuGUI;
@@ -62,6 +63,7 @@ private:
 private :
   LightApp_SelectionMgr*  mySelectionMgr;
   SVTK_ViewWindow*        myViewWindow;
+  const SalomeApp_Module* myModule;
 
   QPushButton*            buttonOk;
   QPushButton*            buttonHelp;
index 966636b4f66792a05cb712730a251f318d92d372..4422d585fd082aec10bb9250c776b592be00434a 100644 (file)
@@ -37,56 +37,51 @@ namespace VISU
 {
   //----------------------------------------------------------------------------
   void
-  ErasePrs3dObject(VisuGUI* theModule,
-                  VISU::Prs3d_ptr thePrs3d, 
-                  bool theDoRepaint)
+  ErasePrs3d(VisuGUI* theModule,
+             VISU::Prs3d_i* thePrs,
+            bool theDoRepaint)
   {
-    if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs3d).in())){
-      SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
-      RemoveScalarBarPosition(theModule, aViewWindow, aPrs3d);
-      ErasePrs3d(theModule, aPrs3d, theDoRepaint);
+    if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)){
+      if(VISU_Actor* anActor = FindActor(aViewWindow, thePrs)){
+        anActor->VisibilityOff();
+       if(theDoRepaint)
+         aViewWindow->Repaint();
+      }
     }
   }
 
   //----------------------------------------------------------------------------
   void
   ErasePrs(VisuGUI* theModule,
-          CORBA::Object_ptr theObject
+          Base_i* theBase
           bool theDoRepaint)
   {
-    if (CORBA::is_nil(theObject))
+    if(!theBase)
       return;
 
-    VISU::Base_var aBase = VISU::Base::_narrow(theObject);
-    if (CORBA::is_nil(aBase)) 
-      return;
-
-    VISU::VISUType aType = aBase->GetType();
-    switch (aType) {
+    switch (theBase->GetType()) {
     case VISU::TCURVE: {
-      if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
+      if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(theBase))
        PlotCurve(theModule, aCurve, VISU::eErase );
       break;
     }
     case VISU::TCONTAINER: {
-      if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
+      if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(theBase))
        PlotContainer(theModule, aContainer, VISU::eErase );
       break;
     }
     case VISU::TTABLE: {
-      if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
+      if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(theBase))
        PlotTable(theModule, aTable, VISU::eErase );
       break;
     }
-    case VISU::TCOLOREDPRS3DHOLDER: {
-      VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(aBase);
-      VISU::ColoredPrs3d_var aPrs3d = aHolder->GetDevice();
-      ErasePrs3dObject(theModule, aPrs3d, theDoRepaint);
-      break;
-    }
     default: {
-      VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aBase);
-      ErasePrs3dObject(theModule, aPrs3d, theDoRepaint);
+      if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(theBase)){
+       if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)){
+         RemoveScalarBarPosition(theModule, aViewWindow, aPrs3d);
+         ErasePrs3d(theModule, aPrs3d, theDoRepaint);
+       }
+      }
     }} // switch (aType)
   }
 
index 1e7c3d0ee5508a89220b6acd2b155b5488af1326..9c7ae8995d72a01a0b607d8b614c285a854c66d9 100644 (file)
@@ -243,24 +243,14 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  inline
   void
   ErasePrs3d(VisuGUI* theModule,
              VISU::Prs3d_i* thePrs,
-            const bool theDoRepaintVW = true)
-  {
-    if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)) {
-      if (VISU_Actor* anActor = FindActor(aViewWindow, thePrs)) {
-        anActor->VisibilityOff();
-       if (theDoRepaintVW)
-         aViewWindow->Repaint();
-      }
-    }
-  }
+            bool theDoRepaint = true);
 
   void
   ErasePrs(VisuGUI* theModule,
-          CORBA::Object_ptr theObject
+          Base_i* theBase
           bool theDoRepaintVW);
 }
 
index 43acacb4042ebe92f56ae8db309d7d0025c70980..47d7f4770b6fb261c3cc5f15c7c357482a6c8bf9 100644 (file)
 #include "VISU_ColoredPrs3dHolder_i.hh"
 #include "VISU_ColoredPrs3dFactory.hh"
 
-#include "VISU_Convertor.hxx"
-#include "VISU_PipeLine.hxx"
-
-#include "VVTK_ViewWindow.h"
-#include "SUIT_ResourceMgr.h"
-
-#include "VISU_Actor.h"
+#include "VISU_ViewManager_i.hh"
 #include "VISU_View_i.hh"
+#include "VISU_Actor.h"
 
 #include "VTKViewer_Algorithm.h"
 #include "SVTK_Functor.h"
 
-#include <vtkActorCollection.h>
+//#include "VISU_Convertor.hxx"
+//#include "VISU_PipeLine.hxx"
+
+#include "VVTK_ViewWindow.h"
+#include "SUIT_ResourceMgr.h"
+
 #include <vtkRenderer.h>
 
 #ifdef _DEBUG_
@@ -333,26 +333,6 @@ VISU::ColoredPrs3dCache_i
 }
 
 
-//----------------------------------------------------------------------------
-namespace VISU
-{
-  struct TIsSamePrs3d
-  {
-    VISU::Prs3d_i* myPrs3d;
-
-    TIsSamePrs3d(VISU::Prs3d_i* thePrs3d):
-      myPrs3d(thePrs3d)
-    {}
-    
-    bool
-    operator()(VISU_Actor* theActor) 
-    {
-      return theActor->GetPrs3d() == myPrs3d;
-    }
-  };
-}
-
-
 //----------------------------------------------------------------------------
 bool
 VISU::ColoredPrs3dCache_i
@@ -393,30 +373,28 @@ VISU::ColoredPrs3dCache_i
       if(SUIT_ViewWindow* aView = aView3d->GetViewWindow()){
        if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aView)){
          // Find actor that corresponds to the holder
-         vtkRenderer* aRenderer = aViewWindow->getRenderer();
-         vtkActorCollection* anActors = aRenderer->GetActors();
-         VISU_Actor* anActor = 
-           SVTK::Find<VISU_Actor>(anActors,
-                                  VISU::TIsSamePrs3d(aLastVisitedPrs3d.GetPointer()));
+         VISU_Actor* anActor = VISU::FindActor(aViewWindow, aLastVisitedPrs3d);
+
          // If the holder was erased from view then do nothing
          if(!anActor || !anActor->GetVisibility())
            return true;
 
          if(aPrs3d != aLastVisitedPrs3d){
            // To erase all actors that corresponds to the holder
+           vtkRenderer* aRenderer = aViewWindow->getRenderer();
+           vtkActorCollection* anActors = aRenderer->GetActors();
            Handle(SALOME_InteractiveObject) anIO = aPrs3d->GetIO();
            SVTK::ForEachIf<VISU_Actor>(anActors,
                                        SVTK::TIsSameIObject<SALOME_Actor>(anIO),
                                        SVTK::TSetVisibility<VISU_Actor>(false));
            // To find the new one that corresponds to fresh presentation
-           VISU_Actor* aNewActor = 
-             SVTK::Find<VISU_Actor>(anActors,
-                                    VISU::TIsSamePrs3d(aPrs3d));
+           VISU_Actor* aNewActor = VISU::FindActor(aViewWindow, aPrs3d);
            if(!aNewActor){
              aNewActor = aPrs3d->CreateActor();
              aViewWindow->AddActor(aNewActor);
            }else
              aNewActor->SetVisibility(true);
+           //anActor->RemoveFromRender();
            aNewActor->DeepCopy(anActor);
          }
          aViewWindow->Repaint();
index 2f0766e6122df5bc473b436dde1d85a22d6de9fd..1dfda5aae3e2558469b1c05f5ac805cfa6e2ccc4 100644 (file)
@@ -278,6 +278,28 @@ namespace VISU
     return dynamic_cast<TColoredPrs3d_i*>(aColoredPrs3d);
   }
 
+
+  //----------------------------------------------------------------------------
+  template<unsigned int colored_prs3d_type_enum>
+  struct TSameAsFactory
+  {
+    typedef typename TL::TColoredEnum2Type<colored_prs3d_type_enum>::TResult TColoredPrs3d;
+
+    TColoredPrs3d*
+    Create(ColoredPrs3d_i* theColoredPrs3d,
+          ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
+    {
+      TColoredPrs3d* aSameColoredPrs3d = new TColoredPrs3d(thePublishInStudyMode);
+      aSameColoredPrs3d->SetCResult(theColoredPrs3d->GetCResult());
+      aSameColoredPrs3d->SetMeshName(theColoredPrs3d->GetCMeshName().c_str());
+      aSameColoredPrs3d->SetEntity(theColoredPrs3d->GetEntity());
+      aSameColoredPrs3d->SetFieldName(theColoredPrs3d->GetCFieldName().c_str());
+      aSameColoredPrs3d->SetTimeStampNumber(theColoredPrs3d->GetTimeStampNumber());
+      aSameColoredPrs3d->SameAs(theColoredPrs3d);
+      return aSameColoredPrs3d;
+    }
+  };
+
   //----------------------------------------------------------------------------
   //! Check is possible to create ColoredPrs3dHolder with the given input
   size_t
index 6dc381dd54023d18281e10a79b2d99a1d4b472f6..c9d6c83e3bc6e1e19bc4e10745c2222e763db677 100644 (file)
@@ -123,11 +123,27 @@ VISU::ColoredPrs3d_i
 }
 
 
+//----------------------------------------------------------------------------
+void 
+VISU::ColoredPrs3d_i
+::OnRestoreInput()
+{
+  TSuperClass::OnRestoreInput();
+  myEntity = myPreviousEntity;
+  myFieldName = myPreviousFieldName;
+  myTimeStampNumber = myPreviousTimeStampNumber;
+}
+
+
 //---------------------------------------------------------------
 bool 
 VISU::ColoredPrs3d_i
 ::OnSetInput()
 {
+  myPreviousEntity = myEntity;
+  myPreviousFieldName = myFieldName;
+  myPreviousTimeStampNumber = myTimeStampNumber;
+
   bool anIsCreatNew = !IsPipeLineExists();
   if(anIsCreatNew)
     CreatePipeLine(NULL); // to create proper pipeline
@@ -379,6 +395,15 @@ VISU::ColoredPrs3d_i
 }
 
 
+//----------------------------------------------------------------------------
+std::string
+VISU::ColoredPrs3d_i
+::GetHolderEntry()
+{
+  return myHolderEntry;
+}
+
+
 //----------------------------------------------------------------------------
 CORBA::Boolean 
 VISU::ColoredPrs3d_i
@@ -387,6 +412,14 @@ VISU::ColoredPrs3d_i
   return myIsTimeStampFixed;
 }
 
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_i::EPublishInStudyMode 
+VISU::ColoredPrs3d_i
+::GetPublishInStudyMode()
+{
+  return myPublishInStudyMode;
+}
+
 //---------------------------------------------------------------
 void
 VISU::ColoredPrs3d_i
index 5fb857813e74ac3d6d60c9bbd756361e3b053682..885429bf0a055e9781fb75c646502902fea10540 100644 (file)
@@ -120,6 +120,10 @@ namespace VISU
     CORBA::Boolean 
     IsTimeStampFixed();
 
+    virtual
+    EPublishInStudyMode
+    GetPublishInStudyMode();
+
     //----------------------------------------------------------------------------
     virtual
     CORBA::Long
@@ -231,6 +235,10 @@ namespace VISU
     void
     SetHolderEntry(const std::string& theEntry);
 
+    virtual
+    std::string
+    GetHolderEntry();
+
     //----------------------------------------------------------------------------
   public:
     /*!
@@ -368,6 +376,11 @@ namespace VISU
     bool 
     SetInput();
 
+    //! Restore input parameters if Apply function fails (redefines Prs3d::OnRestoreInput)
+    virtual 
+    void 
+    OnRestoreInput();
+
     /*!
       Checks whether it is possible to create presentation 
       with the given basic parameters or not.
@@ -423,9 +436,15 @@ namespace VISU
 
   private:
     // Decalare basic input parameters
-    Entity myEntity;
+    VISU::Entity myEntity;
+    VISU::Entity myPreviousEntity;
+
     std::string myFieldName;
+    std::string myPreviousFieldName;
+
     CORBA::Long myTimeStampNumber;
+    CORBA::Long myPreviousTimeStampNumber;
+
     bool myIsTimeStampFixed;
 
     PField myField;
index f972fe8ef3c16795ecd264c8f9140b20a3c285e9..1c84445e61c70d8901ff404ce8ef41913b42d978 100644 (file)
@@ -111,10 +111,30 @@ bool
 VISU::Prs3d_i
 ::SetInput()
 {
+  if(!myResult)
+    return false;
+
+  myPreviousResult = myResult;
+
+  if(myMeshName == "")
+    return false;
+
+  myPreviousMeshName = myMeshName;
+
   return true;
 }
 
 
+//----------------------------------------------------------------------------
+void 
+VISU::Prs3d_i
+::OnRestoreInput()
+{
+  myResult = myPreviousResult;
+  myMeshName = myPreviousMeshName;
+}
+
+
 //----------------------------------------------------------------------------
 CORBA::Boolean 
 VISU::Prs3d_i
@@ -130,6 +150,7 @@ VISU::Prs3d_i
   }catch(...){
     INFOS("Unknown exception was occured!");
   }
+  OnRestoreInput();
   return false;
 }
 
index ae38e76ce62f500231df1a4f7f2d6220d966cfc3..07cdbd8a3d0a8a79609605bb08b1dabffe13abe8 100644 (file)
@@ -224,18 +224,22 @@ namespace VISU
     void
     GetBounds(vtkFloatingPointType aBounds[6]);
 
+    //! Move the 3D presentation according to the given offset parameters
     void
     SetOffset(const CORBA::Float* theOffsets);
 
+    //! Move the 3D presentation according to the given offset parameters
     virtual
     void
     SetOffset(CORBA::Float theDx, 
              CORBA::Float theDy, 
              CORBA::Float theDz);
 
+    //! Gets offset parameters for the 3D presentation
     void
     GetOffset(CORBA::Float* theOffsets);
 
+    //! Gets offset parameters for the 3D presentation
     virtual
     void
     GetOffset(CORBA::Float& theDx, 
@@ -261,16 +265,29 @@ namespace VISU
     GetIO();
 
   protected:
+    /*! 
+      Used in Apply method to get know whether it is possible to create presentation
+      with the input parameters or not. The derived classes can use this method 
+      to customize Apply behaviour.
+    */
     virtual 
     bool 
     SetInput();
 
+    //! Restore input parameters if Apply function fails
+    virtual 
+    void 
+    OnRestoreInput();
+
+    //! Used in derived classes to initilize the myPipeLine member
     void
     SetPipeLine(VISU_PipeLine* thePipeLine);
 
+    //! Used in derived classes to initilize the myPipeLine member
     void
     CreateActor(VISU_Actor* theActor);
 
+    //! Gets or creates VISU_PipeLine instance for actor initilization
     virtual 
     VISU_PipeLine* 
     GetPL();
@@ -280,9 +297,11 @@ namespace VISU
     void
     CheckDataSet();
 
+    //! Used in derived classes to initilize the mySObject member
     void 
     SetSObject(SALOMEDS::SObject_var theSObject);
 
+    //! Used in derived classes to initilize the myIO member
     void
     SetIO(const Handle(SALOME_InteractiveObject)& theIO);
 
@@ -292,7 +311,10 @@ namespace VISU
 
   private:
     Result_i *myResult;
+    Result_i *myPreviousResult;
+
     std::string myMeshName;
+    std::string myPreviousMeshName;
 
     CORBA::Float myOffset[3];
 
index b0fe1cee93b388a09e294381c48129d9213f60f3..439bb3a47c5d615ad984fb1ce4466170a62d7bb4 100644 (file)
@@ -51,6 +51,9 @@
 #include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
@@ -446,17 +449,38 @@ namespace VISU {
     }
   }
 
-  VISU_Actor* GetActor (VISU::Prs3d_i* thePrs3d, SVTK_ViewWindow* theVTKFrame)
+
+  //----------------------------------------------------------------------------
+  struct TIsSamePrs3d
   {
-    vtkActorCollection *anActColl = theVTKFrame->getRenderer()->GetActors();
-    anActColl->InitTraversal();
-    while (vtkActor *anActor = anActColl->GetNextActor())
-      if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
-       if (thePrs3d == anVISUActor->GetPrs3d())
-         return anVISUActor;
-    return NULL;
+    VISU::Prs3d_i* myPrs3d;
+
+    TIsSamePrs3d(VISU::Prs3d_i* thePrs3d):
+      myPrs3d(thePrs3d)
+    {}
+    
+    bool
+    operator()(VISU_Actor* theActor) 
+    {
+      return theActor->GetPrs3d() == myPrs3d;
+    }
+  };
+
+
+  //----------------------------------------------------------------------------
+  VISU_Actor* 
+  FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d)
+  {
+    if(!thePrs3d)
+      return NULL;
+
+    vtkRenderer* aRenderer = theViewWindow->getRenderer();
+    vtkActorCollection* anActors = aRenderer->GetActors();
+    return SVTK::Find<VISU_Actor>(anActors, VISU::TIsSamePrs3d(thePrs3d));
   }
 
+
+  //----------------------------------------------------------------------------
   struct TDeleteActorsEvent: public SALOME_Event
   {
     VISU::Curve_i* myPrs;
index 2fc2255891c7b332c9c70c364e2cac40378fe238..2d489972b81d4318e7bc08ccbd84c0093dfad82e 100644 (file)
@@ -73,7 +73,7 @@ namespace VISU {
   VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs = NULL);
   void UpdatePlot2d (Plot2d_ViewFrame *theView, int theDisplaying, Curve_i* theCurve);
 
-  VISU_Actor* GetActor (VISU::Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow);
+  VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, VISU::Prs3d_i* thePrs3d);
 
   void DeleteActors (VISU::Prs3d_i* thePrs);
   void DeleteActors (VISU::Curve_i* thePrs);
index ef63c4c93e25bc0788ad60465531ed2805a558b4..7b03bad4bc3400edbf98557d0d77560c14d0c151 100644 (file)
@@ -2195,7 +2195,7 @@ namespace VISU {
        if (!aPrs) {
          myError = "Corrupted presentation";
        } else {
-         VISU_Actor* anActor = VISU::GetActor(aPrs, vw);
+         VISU_Actor* anActor = VISU::FindActor(vw, aPrs);
          if (!anActor) {
            myError = "No actor found. Display the presentation at first.";
          } else {