Salome HOME
INT PAL: 0052664: SIGSEGV at attempt to open 'View' menu when not OCC, VTK or Plot2D...
[modules/geom.git] / src / DisplayGUI / DisplayGUI.cxx
index 0ef6fcdfe14d03599d0bf493f0826012f7dbd1c0..edbeca37877ce70bf66a43cd56229def3f004feb 100644 (file)
@@ -1,62 +1,76 @@
-//  GEOM GEOMGUI : GUI for Geometry component
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  File   : DisplayGUI.cxx
-//  Author : Damien COQUERET
-//  Module : GEOM
-//  $Header: 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : DisplayGUI.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 
 #include "DisplayGUI.h"
+#include <GeometryGUI.h>
+#include "GeometryGUI_Operations.h"
+#include <GEOM_Constants.h>
+#include <GEOM_Displayer.h>
+#include <GEOM_AISShape.hxx>
+#include <GEOM_Actor.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_OverrideCursor.h>
+
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewModel.h>
 
-#include "QAD_RightFrame.h"
-#include "GEOM_AssemblyBuilder.h"
-#include "VTKViewer_ViewFrame.h"
-#include "OCCViewer_ViewFrame.h"
-#include "OCCViewer_Viewer3d.h"
-#include "SALOMEGUI_ImportOperation.h"
-#include "SALOME_ListIteratorOfListIO.hxx"
+#include <SALOME_ListIO.hxx>
+
+#include <SVTK_ViewWindow.h>
+#include <SVTK_View.h>
+#include <SVTK_ViewModel.h>
+#include <SOCC_ViewModel.h>
+#include <SVTK_Prs.h>
+#include <SOCC_Prs.h>
+
+#include <QtxActionMenuMgr.h>
+
+#include <SalomeApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Study.h>
 
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 
-#include "utilities.h"
+#include <vtkActorCollection.h>
+#include <vtkRenderer.h>
 
-using namespace std;
+#include <QAction>
 
 //=======================================================================
-// function : DisplayGUI()
+// function : DisplayGUI::DisplayGUI()
 // purpose  : Constructor
 //=======================================================================
-DisplayGUI::DisplayGUI() :
-  QObject()
+DisplayGUI::DisplayGUI( GeometryGUI* parent ) : GEOMGUI( parent )
 {
-  myGeomBase = new GEOMBase();
-  myGeomGUI = GEOMContext::GetGeomGUI();
-  myGeom = myGeomGUI->myComponentGeom;
 }
 
-
 //=======================================================================
-// function : ~DisplayGUI()
+// function : DisplayGUI::~DisplayGUI()
 // purpose  : Destructor
 //=======================================================================
 DisplayGUI::~DisplayGUI()
@@ -65,952 +79,599 @@ DisplayGUI::~DisplayGUI()
 
 
 //=======================================================================
-// function : OnGUIEvent()
-// purpose  : 
+// function : DisplayGUI::OnGUIEvent()
+// purpose  : Dispatch menu command
 //=======================================================================
-bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
+bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
 {
-  DisplayGUI* myDisplayGUI = new DisplayGUI();
-
-  switch (theCommandID)
-    {
-    case 211: // MENU VIEW - WIREFRAME/SHADING
-      {
-       if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
-         QApplication::setOverrideCursor(waitCursor);
-
-         VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
-         int themode = myRenderInter->GetDisplayMode();
-         if(themode==0) {
-           myRenderInter->SetDisplayMode(1);
-           QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME"));
-         } 
-         else {
-           myRenderInter->SetDisplayMode(0);
-           QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING"));
-         }
-
-         QApplication::restoreOverrideCursor();          
-       } 
-       else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
-         QApplication::setOverrideCursor(Qt::waitCursor);
-
-         OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-         Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
-         AIS_DisplayMode mode = (AIS_DisplayMode)ic->DisplayMode();
-         AIS_DisplayMode newmode = (mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame);
-
-         AIS_ListOfInteractive List;
-         ic->DisplayedObjects(List);
-         AIS_ListOfInteractive List1;
-         ic->ObjectsInCollector(List1);
-         List.Append(List1);
-         
-         AIS_ListIteratorOfListOfInteractive ite(List);
-         while(ite.More()) {
-           if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
-             Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
-             ic->SetDisplayMode(aSh,Standard_Integer(newmode),true);
-           }
-           ite.Next();
-         }
-
-         ic->SetDisplayMode(newmode, Standard_False);
-         if(newmode == 1)
-           QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME"));
-         else
-           QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING"));
-         
-         QApplication::restoreOverrideCursor();
-       }
-       break;
-      }
-    case 212: // MENU VIEW - DISPLAY ALL
-      {
-       myDisplayGUI->OnDisplayAll();
-       break;
-      }
-    case 213: // MENU VIEW - DISPLAY ONLY
-      {
-       if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
-         myDisplayGUI->OnVTKDisplayOnly();
-       else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
-         myDisplayGUI->OnDisplayOnly();        
-       break;
-      }
-    case 214: // MENU VIEW - ERASE ALL
-      {
-       if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
-         ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll();
-       else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
-         OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-         Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
-
-         ic->EraseAll(Standard_True, Standard_False);
-         ic->Display(v3d->getTrihedron());
-       }
-       break;
-      }
-    case 215: // MENU VIEW - ERASE ONLY
-      {
-       myDisplayGUI->OnErase();
-       break;
-      }
-    case 8031: // POPUP VIEWER - WIREFRAME/SHADING
-      {
-       if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
-         // VTK
-         VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-         
-         SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
-         SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-         
-         QApplication::setOverrideCursor(Qt::waitCursor);
-         for(;It.More();It.Next()) {
-           Handle(SALOME_InteractiveObject) IOS = It.Value();
-           myRenderInter->SwitchRepresentation(IOS, false);
-         }
-         myRenderInter->Render();
-         QApplication::restoreOverrideCursor();
-       }
-       else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
-         QApplication::setOverrideCursor(Qt::waitCursor);
-         SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
-         OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-         Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
-         SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-         for(;It.More();It.Next()) {
-           Handle(SALOME_InteractiveObject) IObject = It.Value();
-           Standard_Boolean found;
-           Handle(GEOM_AISShape) Shape = myDisplayGUI->myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true);
-            if(!Shape.IsNull()) {
-             AIS_DisplayMode mode = (AIS_DisplayMode)Shape->DisplayMode();
-             if(mode == -1)
-               mode = (AIS_DisplayMode)ic->DisplayMode();
-
-             ic->SetDisplayMode(Shape, mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame, false);
-           }
-         }
-         ic->UpdateCurrentViewer();
-       }
-       QApplication::restoreOverrideCursor();
-       break;
-      }
-    default:
-      {
-       parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
-       break;
-      }
-    }
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if (!app) return false;
+
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  if ( !appStudy ) return false;
+
+  LightApp_SelectionMgr *Sel = app->selectionMgr();
+  SALOME_ListIO selected;
+  Sel->selectedObjects( selected );
+
+  switch ( theCommandID ) {
+  case GEOMOp::OpDMWireframe:         // MENU VIEW - DISPLAY MODE - WIREFRAME
+    SetDisplayMode( 0 );
+    break;
+  case GEOMOp::OpDMShading:           // MENU VIEW - DISPLAY MODE - SHADING
+    SetDisplayMode( 1 );
+    break;
+  case GEOMOp::OpDMShadingWithEdges:  // MENU VIEW - DISPLAY MODE - SHADING WITH EDGES
+    SetDisplayMode( 2 );
+    break;
+  case GEOMOp::OpDMTexture:           // MENU VIEW - DISPLAY MODE - TEXTURE
+    SetDisplayMode( 3 );
+    break;
+  case GEOMOp::OpShowAll:        // MENU VIEW - SHOW ALL
+    getGeometryGUI()->EmitSignalDeactivateDialog();
+    DisplayAll();
+    break;
+  case GEOMOp::OpShowOnly:       // POPUP MENU - SHOW ONLY
+    getGeometryGUI()->EmitSignalDeactivateDialog();
+    DisplayOnly();
+    break;
+  case GEOMOp::OpShowOnlyChildren: // POPUP MENU - SHOW ONLY CHILDREN
+    getGeometryGUI()->EmitSignalDeactivateDialog();
+    DisplayOnlyChildren();
+    break;
+  case GEOMOp::OpHideAll:        // MENU VIEW - HIDE ALL
+    EraseAll();
+    break;
+  case GEOMOp::OpHide:           // POPUP MENU - HIDE
+    Erase();
+    break;
+  case GEOMOp::OpShow:           // POPUP MENU - SHOW
+    getGeometryGUI()->EmitSignalDeactivateDialog();
+    Display();
+    break;
+  case GEOMOp::OpSwitchVectors:  // MENU VIEW - DISPLAY MODE - SHOW EDGE DIRECTION
+    SetVectorMode(!GetVectorMode());
+    getGeometryGUI()->action( GEOMOp::OpSwitchVectors )->setText
+      ( GetVectorMode() ? tr("MEN_VECTOR_MODE_ON") : tr( "MEN_VECTOR_MODE_OFF" ) );
+    getGeometryGUI()->menuMgr()->update();
+    break;
+  case GEOMOp::OpSwitchVertices:  // MENU VIEW - DISPLAY MODE - SHOW/HIDE VERTICES
+    SetVerticesMode(!GetVerticesMode());
+    getGeometryGUI()->action( GEOMOp::OpSwitchVertices )->setText
+      ( GetVerticesMode() ? tr("MEN_VERTICES_MODE_ON") : tr( "MEN_VERTICES_MODE_OFF" ) );
+    getGeometryGUI()->menuMgr()->update();
+    break;
+  case GEOMOp::OpSwitchName:  // MENU VIEW - DISPLAY MODE - SHOW/HIDE NAME
+    SetNameMode(!GetNameMode());
+    getGeometryGUI()->action( GEOMOp::OpSwitchName )->setText
+      ( GetNameMode() ? tr("MEN_NAME_MODE_ON") : tr( "MEN_NAME_MODE_OFF" ) );
+    getGeometryGUI()->menuMgr()->update();
+    break;
+  case GEOMOp::OpWireframe:      // POPUP MENU - DISPLAY MODE - WIREFRAME
+    ChangeDisplayMode( 0 );
+    break;
+  case GEOMOp::OpShading:        // POPUP MENU - DISPLAY MODE - SHADING
+    ChangeDisplayMode( 1 );
+    break;
+  case GEOMOp::OpShadingWithEdges: // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES
+    ChangeDisplayMode( 2 );
+    break;
+  case GEOMOp::OpTexture:        // POPUP MENU - DISPLAY MODE - TEXTURE
+    ChangeDisplayMode( 3 );
+    break;
+  case GEOMOp::OpVectors:        // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
+    ChangeDisplayMode( 4 );
+    break;
+  case GEOMOp::OpVertices:       // POPUP MENU - DISPLAY MODE - SHOW VERTICES
+    ChangeDisplayMode( 5 );
+    break;
+  case GEOMOp::OpShowName:       // POPUP MENU - DISPLAY MODE - SHOW NAME
+    ChangeDisplayMode( 6 );
+    break;
+  default:
+    app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
+    break;
+  }
+  Sel->setSelectedObjects( selected );
+  GEOM_Displayer( appStudy ).UpdateColorScale();
   return true;
 }
 
-
-//=================================================================================
-// function : BuildPresentation()
-// purpose  : static
-//=================================================================================
-void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
+//=====================================================================================
+// function : DisplayGUI::DisplayAll()
+// purpose  : Display all GEOM objects
+//=====================================================================================
+void DisplayGUI::DisplayAll()
 {
-  DisplayGUI* myDisplayGUI = new DisplayGUI();
-
-  SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-  
-  OCCViewer_Viewer3d* v3d;
-  Handle(AIS_InteractiveContext) ic;
-  vtkRenderer* Renderer;
-
-  if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
-    v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-    ic = v3d->getAISContext();
-  } 
-  else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
-    Renderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
-  } 
-  else
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  if ( !appStudy ) return;
+  _PTR(Study) aStudy = appStudy->studyDS();
+  if ( !aStudy ) return;
+  _PTR(SComponent) SC ( aStudy->FindComponent( "GEOM" ) );
+  if ( !SC )
     return;
 
-  if(theIO.IsNull())
-    MESSAGE("BuildPresentation(): null SALOME_InteractiveObject passed")
+  SALOME_ListIO listIO;
+  _PTR(ChildIterator) anIter ( aStudy->NewChildIterator( SC ) );
+  anIter->InitEx( true );
 
-  Standard_Boolean testResult;
-  GEOM::GEOM_Shape_var myGeomShape = myDisplayGUI->myGeomBase->ConvertIOinGEOMShape(theIO, testResult);
-  if(!testResult)
-    return;
+  SUIT_OverrideCursor wc;
 
-  if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
-    // VTK
-         
-    SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
-           
-    SALOMEDS::SObject_var obj = aStudy->FindObjectID(theIO->getEntry());
-
-    VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
-    SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::AttributeName_var aName;
-    SALOMEDS::AttributeIOR_var anIOR;
-        
-    if(myRenderInter->isInViewer(theIO)) {
-      myRenderInter->Display(theIO, false);
-    }
-    else {
-      // Create new actor
-      if(!obj->_is_nil()) {
-       if(obj->FindAttribute(anAttr, "AttributeIOR")) {
-         // this SObject may be GEOM module root SObject
-
-         bool useSubItems = false;
-         SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj);
-         if(myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) {
-           while (anIter->More() && !useSubItems) {
-             SALOMEDS::SObject_var subobj = anIter->Value();
-             SALOMEDS::GenericAttribute_var aTmpAttr;
-             if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
-               if (!myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) {
-                 anAttr = aTmpAttr;
-                 obj = subobj;
-                 useSubItems = true;
-               } 
-               else 
-                 anIter->Next();
-             } 
-             else 
-               anIter->Next();
-           }
-         }
-
-         while(useSubItems?anIter->More():!anAttr->_is_nil()) { 
-           anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-           GEOM::GEOM_Shape_var aShape = myDisplayGUI->myGeom->GetIORFromString(anIOR->Value());
-           TopoDS_Shape Shape = myDisplayGUI->myGeomGUI->GetShapeReader().GetShape(myDisplayGUI->myGeom,aShape);
-           
-           if(obj->FindAttribute(anAttr, "AttributeName")) {
-             aName = SALOMEDS::AttributeName::_narrow(anAttr);
-             
-             vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
-             vtkActorCollection* theAllActors = theRenderer->GetActors();
-             theAllActors->InitTraversal();
-             vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
-             Handle(SALOME_InteractiveObject) anIObj;
-             // don't create new study object if it already exists
-             bool isDisplayed = false;
-             while(!(actor==NULL)) {
-               SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
-               if(Gactor!=NULL) {
-                 if(Gactor->hasIO()) {
-                   if(strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
-                     isDisplayed = true;
-                     anIObj = Gactor->getIO();
-                     if(!anIObj.IsNull()) myRenderInter->Display(anIObj, false);
-                   }
-                 }
-               }
-               actor=(vtkActor*)(theAllActors->GetNextActor());
-             }
-             if(!isDisplayed) {
-               // open transaction
-               QAD_Operation* op = new SALOMEGUI_ImportOperation( QAD_Application::getDesktop()->getActiveStudy() );
-               op->start();
-               
-               SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
-               aStudyBuilder->Addreference(newObj1, obj);
-               // commit transaction
-               op->finish();
-               
-               vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
-               int themode = myRenderInter->GetDisplayMode();
-               
-               vtkActorCollection* theActors = 
-                 GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True);
-               theActors->InitTraversal();
-               vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
-               while(!(anActor==NULL)) {
-                 GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
-                 Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(),"GEOM");
-                 IO->setEntry(obj->GetID());
-                 GActor->setIO(IO);
-                 GActor->setName(theIO->getName());
-                 
-                 theRenderer->AddActor(GActor);
-                 //              renWin->Render();
-                 anActor = (vtkActor*)theActors->GetNextActor();
-               }
-             }
-           }
-           // next item iteration
-           if(useSubItems) {
-             anIter->Next();
-             anAttr = SALOMEDS::GenericAttribute::_nil();
-             while(anIter->More() && anAttr->_is_nil()) {
-               SALOMEDS::SObject_var subobject = anIter->Value();
-               SALOMEDS::GenericAttribute_var aTmpAttribute;
-               if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
-                 anAttr = aTmpAttribute;
-                 obj = subobject;
-               } 
-               else
-                 anIter->Next();
-             }
-           } 
-           else
-             anAttr = SALOMEDS::GenericAttribute::_nil();
-         }
-       }
-      }
-    }
-    // No viewer update should be done here!
-    //myRenderInter->Render();
-    //QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser( true );
-  } 
-  else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
-    SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
-    SALOMEDS::GenericAttribute_var anAttr;
-    SALOMEDS::AttributeName_var aName;
-    SALOMEDS::AttributeIOR_var anIOR;
-
-    if(v3d->isInViewer(theIO, true)) {
-      Standard_Boolean found;
-      Handle(GEOM_AISShape) aSh = myDisplayGUI->myGeomBase->ConvertIOinGEOMAISShape(theIO, found, true);
-      if(found) {
-       ic->Display(aSh, false);
-       ic->AddOrRemoveCurrentObject(aSh, false);
-      }
-      
+  while( anIter->More() ) {
+    _PTR(SObject) valSO ( anIter->Value() );
+    _PTR(SObject) refSO;
+    if ( !valSO->ReferencedObject( refSO ) ) {
+      listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
+                                                  SC->ComponentDataType().c_str(),
+                                                  valSO->GetName().c_str()) );
     } 
-    else {
-      SALOMEDS::SObject_var obj = aStudy->FindObjectID(theIO->getEntry());           
-      if(!obj->_is_nil()) {
-       MESSAGE("BuildPresentation(): SObject not null")
-       if(obj->FindAttribute(anAttr, "AttributeIOR")) {
-         MESSAGE("BuildPresentation(): SObject has IOR")
-         // this SObject may be GEOM module root SObject
-
-         bool useSubItems = false;
-         SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj);
-         if(myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) {
-           while(anIter->More() && !useSubItems) {
-             SALOMEDS::SObject_var subobj = anIter->Value();
-             SALOMEDS::GenericAttribute_var aTmpAttr;
-             if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
-               if(!myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) {
-                 anAttr = aTmpAttr;
-                 obj = subobj;
-                 useSubItems = true;
-               } 
-               else
-                 anIter->Next();
-             } 
-             else 
-               anIter->Next();
-           }
-         }
-
-         while(useSubItems?anIter->More():!anAttr->_is_nil()) { 
-           anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-           GEOM::GEOM_Shape_var aShape = myDisplayGUI->myGeom->GetIORFromString(anIOR->Value());
-           TopoDS_Shape Shape = myDisplayGUI->myGeomGUI->GetShapeReader().GetShape(myDisplayGUI->myGeom,aShape);
-           if(Shape.IsNull())
-             MESSAGE("BuildPresentation(): TopoDS_Shape is null!")
-           if(obj->FindAttribute(anAttr, "AttributeName")) {
-             MESSAGE("BuildPresentation(): SObject has Name")
-             aName = SALOMEDS::AttributeName::_narrow(anAttr);
-             // searchin for already displayed objects with the same shape
-             AIS_ListOfInteractive aDisplayed;
-             ic->DisplayedObjects(aDisplayed);
-             AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
-             Handle(AIS_Shape) anAISShape;
-             for(;anIObjects.More();anIObjects.Next()) {
-               anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
-               if(!anAISShape.IsNull()) {
-                 if(anAISShape->Shape().IsSame(Shape)) 
-                   break;
-                 anAISShape.Nullify();
-               }
-             }
-             if(!anAISShape.IsNull()) {
-               if(!ic->IsDisplayed(anAISShape)) 
-                 ic->Display(anAISShape, false);
-             } 
-             else {
-               if(!useSubItems) {
-                 // open transaction
-                 QAD_Operation* op = new SALOMEGUI_ImportOperation( QAD_Application::getDesktop()->getActiveStudy() );
-                 op->start();
-                 if (fatherSF->_is_nil())
-                   MESSAGE("BuildPresentation(): fatherSF is nil!")
-                 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
-                 aStudyBuilder->Addreference(newObj1, obj);
-                 // commit transaction
-                 op->finish();
-               }
-               Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
-               aSh->SetShadingColor(myDisplayGUI->myGeomBase->myShadingColor);
-               aSh->SetInfiniteState(Shape.Infinite());
-               Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(), "GEOM");
-               IO->setEntry(obj->GetID());
-               aSh->setIO(IO);
-               aSh->setName(aName->Value());
-               ic->Display(aSh, false);
-               if(!useSubItems) 
-                 ic->AddOrRemoveCurrentObject(aSh, false);
-             }
-           }
-           // next item iteration
-           if(useSubItems) {
-             anIter->Next();
-             anAttr=SALOMEDS::GenericAttribute::_nil();
-             while (anIter->More() && anAttr->_is_nil()) {
-               SALOMEDS::SObject_var subobject = anIter->Value();
-               SALOMEDS::GenericAttribute_var aTmpAttribute;
-               if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
-                 anAttr = aTmpAttribute;
-                 obj = subobject;
-               } 
-               else 
-                 anIter->Next();
-             }
-           } 
-           else 
-             anAttr = SALOMEDS::GenericAttribute::_nil();
-         }
-       }
+    anIter->Next();
+  }
+  GEOM_Displayer( appStudy ).Display( listIO, true );
+}
+
+//=====================================================================================
+// function : DisplayGUI::EraseAll()
+// purpose  : Erase all GEOM objects
+//=====================================================================================
+void DisplayGUI::EraseAll()
+{
+  SUIT_OverrideCursor wc;
+
+  SUIT_Application* app = getGeometryGUI()->getApp();
+  if ( app ) {
+    SUIT_ViewWindow* vw = app->desktop()->activeWindow();
+    if ( vw ) {
+      SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+      SUIT_ViewManager* vman = vw->getViewManager();
+      if ( vman->getType() == OCCViewer_Viewer::Type() || 
+           vman->getType() == SVTK_Viewer::Type() ) {
+        GEOM_Displayer( appStudy ).EraseAll(true);
       }
     }
-    // No viewer update should be done here!
-    //QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser( true );
-    //ic->UpdateCurrentViewer();
   }
 }
 
+//=====================================================================================
+// function : DisplayGUI::DisplayOnly()
+// purpose  : Display selected GEOM objects and erase other
+//=====================================================================================
+void DisplayGUI::DisplayOnly()
+{
+  EraseAll();
+  Display();
+}
 
 //=====================================================================================
-// function : OnDisplayAll()
-// purpose  :
+// function : DisplayGUI::DisplayOnlyChildren()
+// purpose  : Display only children of selected GEOM objects and erase other
 //=====================================================================================
-void DisplayGUI::OnDisplayAll(bool onlyPreviousDisplayedObject)
+void DisplayGUI::DisplayOnlyChildren()
 {
-  if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
-    OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-    Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
-
-    //myContext->Display(v3d->getTrihedron());
-
-    if(!onlyPreviousDisplayedObject) {
-      SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-      SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM");
-      SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SC);
-      for(; it->More();it->Next()) {
-       SALOMEDS::SObject_var CSO = it->Value();
-       SALOMEDS::AttributeIOR_var anIOR;
-       SALOMEDS::GenericAttribute_var anAttr;
-       if(CSO->FindAttribute(anAttr, "AttributeIOR")) {
-         anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-         Standard_Boolean testResult;
-         Handle(GEOM_AISShape) aSh = myGeomBase->ConvertIORinGEOMAISShape(anIOR->Value(), testResult);
-         if(testResult)
-           myContext->Display(aSh);
-         else {
-           GEOM::GEOM_Shape_ptr aShape = myGeom->GetIORFromString(anIOR->Value());
-           bool AddInSt = myGeomBase->mySettings_AddInStudy;
-           myGeomBase->mySettings_AddInStudy = false;
-           myGeomBase->Display(aShape);
-           myGeomBase->mySettings_AddInStudy = AddInSt;
-         }
-       }
-      }
-    }
-    else {
-      AIS_ListOfInteractive aListDisplayedObject;
-      myContext->DisplayedObjects(aListDisplayedObject);
-      AIS_ListIteratorOfListOfInteractive ite(aListDisplayedObject);
-      while(ite.More()) {
-       if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
-         Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
-         if (aSh->hasIO()) {
-           Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
-           if (v3d->isInViewer(GIO,true))
-             myContext->Display(aSh);
-         }
-       }
-       ite.Next();
+  EraseAll();
+
+  SALOME_ListIO listIO;
+
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if (!app) return;
+
+  SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
+  if (!anActiveStudy) return;
+
+  LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+  if (!aSelMgr) return;
+
+  // get selection
+  SALOME_ListIO aList;
+  //aSelMgr->selectedObjects(aList);
+  aSelMgr->selectedObjects(aList, "ObjectBrowser", false);
+  SALOME_ListIteratorOfListIO It (aList);
+
+  SUIT_OverrideCursor wc;
+
+  for (; It.More(); It.Next()) {
+    Handle(SALOME_InteractiveObject) anIObject = It.Value();
+    if (anIObject->hasEntry()) {
+      _PTR(SObject) SO (anActiveStudy->studyDS()->FindObjectID(anIObject->getEntry()));
+      if (SO) {
+        _PTR(SComponent) SC (SO->GetFatherComponent());
+        if (QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str())) {
+          // if component is selected, pass it
+        }
+        else {
+          _PTR(ChildIterator) anIter (anActiveStudy->studyDS()->NewChildIterator(SO));
+          anIter->InitEx(true);
+          while (anIter->More()) {
+            _PTR(SObject) valSO (anIter->Value());
+            _PTR(SObject) refSO;
+            if (!valSO->ReferencedObject(refSO)) {
+              listIO.Append(new SALOME_InteractiveObject(valSO->GetID().c_str(),
+                                                         SC->ComponentDataType().c_str(),
+                                                         valSO->GetName().c_str()));
+            }
+            anIter->Next();
+          }
+        }
       }
     }
   }
-  else if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
-    SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-    SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM");
-    SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SC);
-    for(; it->More();it->Next()) {
-      SALOMEDS::SObject_var CSO = it->Value();
-      SALOMEDS::AttributeIOR_var anIOR;
-      SALOMEDS::GenericAttribute_var anAttr;
-      if(CSO->FindAttribute(anAttr, "AttributeIOR")) {
-       anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-       Standard_Boolean testResult;
-       GEOM_Actor* aSh = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), testResult);
-       if(testResult) {
-         Handle(SALOME_InteractiveObject) IObject = aSh->getIO();
-         ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->Display(IObject);
-       }
-       else {
-         GEOM::GEOM_Shape_ptr aShape = myGeom->GetIORFromString(anIOR->Value());
-         bool AddInSt = myGeomBase->mySettings_AddInStudy;
-         myGeomBase->mySettings_AddInStudy = false;
-         myGeomBase->Display(aShape);
-         myGeomBase->mySettings_AddInStudy = AddInSt;
-       }
+  GEOM_Displayer(anActiveStudy).Display(listIO, true);
+}
+
+//=====================================================================================
+// function : DisplayGUI::Display()
+// purpose  : Display selected GEOM objects
+//=====================================================================================
+void DisplayGUI::Display()
+{
+  SALOME_ListIO listIO;
+
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  if ( !anActiveStudy ) return;
+
+  //get SalomeApp selection manager
+  LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+  if ( !aSelMgr ) return;
+
+  SALOME_ListIO aList;
+  aSelMgr->selectedObjects( aList );
+  SALOME_ListIteratorOfListIO It( aList );
+
+  SUIT_OverrideCursor wc;
+
+  for( ;It.More();It.Next() ) {
+    Handle(SALOME_InteractiveObject) anIObject = It.Value();
+    if ( anIObject->hasEntry() ) {
+      _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) );
+      if ( SO && QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) {
+        _PTR(SComponent) SC ( SO->GetFatherComponent() );
+        // if component is selected
+        listIO.Clear();
+        _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) );
+        anIter->InitEx( true );
+        while( anIter->More() ) {
+          _PTR(SObject) valSO ( anIter->Value() );
+          _PTR(SObject) refSO;
+          if ( !valSO->ReferencedObject( refSO ) ) {
+            listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
+                                                        SC->ComponentDataType().c_str(),
+                                                        valSO->GetName().c_str()) );
+          }
+          anIter->Next();
+        }
+        break;
+      }
+      else {
+        listIO.Append( anIObject );
       }
     }
+    else {
+      listIO.Append( anIObject );
+    }
   }
-  return;
+  GEOM_Displayer( anActiveStudy ).Display( listIO, true );
 }
 
 
 //=====================================================================================
-// function : OnVTKDisplayOnly()
-// purpose  :
+// function : DisplayGUI::Erase()
+// purpose  : Erase selected GEOM objects
 //=====================================================================================
-void DisplayGUI::OnVTKDisplayOnly()
+void DisplayGUI::Erase()
 {
-  QApplication::setOverrideCursor(Qt::waitCursor);
-
-  // Erase all not selected actors
-  vtkRenderer* aren = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
-  vtkActorCollection* theActors = aren->GetActors();
-  theActors->InitTraversal();
-  vtkActor *ac = theActors->GetNextActor();
-  while(!(ac==NULL)) {
-    if(ac->IsA("SALOME_Actor")) {
-      SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(ac);
-      if(!anActor->isHighlighted())
-       anActor->VisibilityOff();
-    }
-    ac = theActors->GetNextActor();
-  }
-
-  // Display selection
-  SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-  SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
-  SALOMEDS::GenericAttribute_var anAttr;
-  SALOMEDS::AttributeName_var aName;
-  SALOMEDS::AttributeIOR_var anIOR;
-
-  SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
-  SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-         
-  for(;It.More();It.Next()) {
-    Handle(SALOME_InteractiveObject) IObject = It.Value();
-    SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
-
-    VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
-    if(myRenderInter->isInViewer(IObject)) {
-      myRenderInter->Display(IObject);
+  SALOME_ListIO listIO;
+
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  if ( !anActiveStudy ) return;
+
+  //get SalomeApp selection manager
+  LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+  if ( !aSelMgr ) return;
+
+  SALOME_ListIO aList;
+  aSelMgr->selectedObjects( aList );
+  SALOME_ListIteratorOfListIO It( aList );
+
+  SUIT_OverrideCursor wc;
+
+  for( ; It.More(); It.Next() ) {
+    Handle(SALOME_InteractiveObject) anIObject = It.Value();
+    if ( anIObject->hasEntry() ) {
+      _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) );
+      if ( SO && QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) {
+        _PTR(SComponent) SC ( SO->GetFatherComponent() );
+        // if component is selected
+        listIO.Clear();
+        _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) );
+        anIter->InitEx( true );
+        while( anIter->More() ) {
+          _PTR(SObject) valSO ( anIter->Value() );
+          _PTR(SObject) refSO;
+          if ( !valSO->ReferencedObject( refSO ) ) {
+            listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
+                                                        SC->ComponentDataType().c_str(),
+                                                        valSO->GetName().c_str()) );
+          }
+          anIter->Next();
+        }
+        break;
+      }
+      else {
+        listIO.Append( anIObject );
+      }
     }
     else {
-      // Create new actor
-      if(!obj->_is_nil()) {
-       if(!obj->FindAttribute(anAttr, "AttributeIOR")) 
-         break;
-       // If selected object contains displayable subobjects, then do nothing
-       SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj);
-       SALOMEDS::GenericAttribute_var aTmpAttr;
-       
-       anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-       GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value());
-       if(CORBA::is_nil(aShape)) continue;
-       TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
-
-       if(obj->FindAttribute(anAttr, "AttributeName")) {
-          aName = SALOMEDS::AttributeName::_narrow(anAttr);
-         // open transaction
-         QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
-         op->start();
-
-         SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
-         aStudyBuilder->Addreference(newObj1, obj);
-         // commit transaction
-         op->finish();
-                 
-         vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
-         int themode = myRenderInter->GetDisplayMode();
-         vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(Shape, 0, themode, Standard_True);
-         theActors->InitTraversal();
-         vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
-         while(!(anActor==NULL)) {
-           GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
-           GActor->setIO(IObject);
-           GActor->setName(IObject->getName());
-                   
-           theRenderer->AddActor(GActor);
-           vtkRenderWindow *renWin = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->GetRenderWindow();
-           renWin->Render();
-           anActor = (vtkActor*)theActors->GetNextActor();
-         }
-       }
-      }
+      listIO.Append( anIObject );
     }
   }
-  QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(true);
 
-  QApplication::restoreOverrideCursor();
-  return;                     
-}    
+  SUIT_ViewWindow* viewWindow = app->desktop()->activeWindow();
+  bool aIsForced = true;
+  if(viewWindow->getViewManager()->getType() == SVTK_Viewer::Type())
+    aIsForced = false;
 
+  GEOM_Displayer(anActiveStudy).Erase( listIO, aIsForced);
+  getGeometryGUI()->getApp()->selectionMgr()->clearSelected();
+}
 
 //=====================================================================================
-// function : OnDisplayOnly()
-// purpose  :
+// function : DisplayGUI::SetDisplayMode()
+// purpose  : Set display mode for the viewer (current viewer if <viewWindow> - 0 )
 //=====================================================================================
-void DisplayGUI::OnDisplayOnly()
+void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
 {
-  if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
-    return;
+  SUIT_OverrideCursor wc;
 
-  OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-  SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-  Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-
-  AIS_ListOfInteractive List;
-  ic->DisplayedObjects(List);
-  AIS_ListIteratorOfListOfInteractive ite(List);
-  while(ite.More()) {
-    if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
-      Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
-      if (!ic->IsSelected( aSh )) {
-       ic->Erase(aSh, Standard_True, Standard_True);
-      }
-    }
-    ite.Next();
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  if ( !viewWindow ) 
+    viewWindow = app->desktop()->activeWindow();
+
+  SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+  if ( !aStudy ) return;
+
+  GEOM_Displayer displayer( aStudy );
+
+  int mgrId = viewWindow->getViewManager()->getGlobalId();
+
+  SALOME_View* window = displayer.GetActiveView();
+  if ( !window ) return;
+
+  SALOME_ListIO anIOlst;
+  window->GetVisible( anIOlst );
+
+  for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
+    Handle( SALOME_InteractiveObject ) io = It.Value();
+    aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), mode );
+    displayer.Redisplay( io, false );
   }
+  displayer.UpdateViewer();
+  GeometryGUI::Modified();
+}
 
-  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-  SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
-
-  SALOME_ListIteratorOfListIO It1(Sel->StoredIObjects());
-  for(;It1.More();It1.Next()) {
-    Handle(SALOME_InteractiveObject) IObject = It1.Value();
-
-    SALOMEDS::SObject_var fatherSF = 
-      aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
-    if(v3d->isInViewer(IObject, true)) {
-      AIS_ListOfInteractive List1;
-      ic->ObjectsInCollector(List1);
-      AIS_ListIteratorOfListOfInteractive ite1(List1);
-      while(ite1.More()) {
-       if(ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
-         Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value());
-         if (aSh->hasIO()) {
-           Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
-           if (IObject->isSame(GIO)) {
-             ic->Display(aSh);
-             ic->AddOrRemoveCurrentObject(aSh, true);
-             break;
-           }
-         }
-       }
-       ite1.Next();
-      }
-    }
-    else {
-      if (IObject->hasEntry()) {
-       SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
-        SALOMEDS::GenericAttribute_var anAttr;
-        SALOMEDS::AttributeName_var aName;
-        SALOMEDS::AttributeIOR_var anIOR;
-       if (!obj->_is_nil()) {
-         if (obj->FindAttribute(anAttr, "AttributeIOR")) {
-           // this SObject may be GEOM module root SObject
-
-           anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-           GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value());
-           if(CORBA::is_nil(aShape)) continue;
-           TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
-           
-           if(obj->FindAttribute(anAttr, "AttributeName")) {
-             aName = SALOMEDS::AttributeName::_narrow(anAttr);
-             // open transaction
-             QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
-             op->start();
-             
-             SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
-             aStudyBuilder->Addreference(newObj1, obj);
-             // commit transaction
-             op->finish();
-           }
-           
-           Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
-           Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myGeomGUI->GetFatherior(),"GEOM");
-               
-           IO->setEntry(obj->GetID());
-           aSh->setIO(IO);
-           aSh->setName(aName->Value());
-           ic->Display(aSh);
-           ic->AddOrRemoveCurrentObject(aSh, true);
-         }
-       }  
-      }
-    }
+//=====================================================================================
+// function : DisplayGUI::SetVectorsMode()
+// purpose  : Set vector mode for the viewer
+//=====================================================================================
+void DisplayGUI::SetVectorMode( const bool mode, SUIT_ViewWindow* viewWindow )
+{
+  SUIT_OverrideCursor wc;
+
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+  if ( !aStudy ) return;
+
+  if ( !viewWindow ) 
+    viewWindow = app->desktop()->activeWindow();
+
+  GEOM_Displayer displayer( aStudy );
+
+  viewWindow->setProperty( "VectorsMode", mode );
+
+  int aMgrId = viewWindow->getViewManager()->getGlobalId();
+
+  SALOME_View* window = displayer.GetActiveView();
+  if ( !window ) return;
+
+  SALOME_ListIO anIOlst;
+  window->GetVisible( anIOlst );
+
+  for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
+    Handle( SALOME_InteractiveObject ) io = It.Value();
+    aStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), mode );
+    displayer.Redisplay( io, false );
   }
+  displayer.UpdateViewer();
+  GeometryGUI::Modified();
 }
 
+//=====================================================================================
+// function : DisplayGUI::GetVectorMode()
+// purpose  : Get the "show edge direction" mode of the viewer
+//=====================================================================================
+int DisplayGUI::GetVectorMode( SUIT_ViewWindow* viewWindow )
+{
+  if ( !viewWindow ) 
+    viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
+  return viewWindow->property( "VectorsMode" ).toBool();
+}
 
 //=====================================================================================
-// function : OnErase()
-// purpose  :
+// function : DisplayGUI::SetVerticesMode()
+// purpose  : Set vertices mode for the viewer
 //=====================================================================================
-void DisplayGUI::OnErase()
+void DisplayGUI::SetVerticesMode( const bool mode, SUIT_ViewWindow* viewWindow )
 {
-  SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-  SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
-  if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
-    // VTK
-    SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-    Handle(SALOME_InteractiveObject) anIObject;
-    for(;It.More();It.Next()) {
-      anIObject = It.Value();
-      VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-
-      if(myRenderInter->isInViewer(anIObject)) {
-       myRenderInter->Erase(anIObject);
-      } 
-      else {
-       SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry());
-       SALOMEDS::GenericAttribute_var anAttr;
-       SALOMEDS::AttributeIOR_var anIOR;
-       if(!obj->_is_nil()) {
-         if(obj->FindAttribute(anAttr, "AttributeIOR")) {
-           // this SObject may be GEOM module root SObject
-           SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj);
-           bool useSubItems = false;
-           while(anIter->More() && !useSubItems) {
-             SALOMEDS::SObject_var subobj = anIter->Value();
-             SALOMEDS::GenericAttribute_var aTmpAttr;
-             if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
-               anAttr = aTmpAttr;
-               obj = subobj;
-               useSubItems = true;
-             } 
-             else
-               anIter->Next();
-           }
-
-           while(useSubItems?anIter->More():!anAttr->_is_nil()) { 
-             anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-             GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value());
-             TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
-             if(obj->FindAttribute(anAttr, "AttributeName")) {
-               // searchin for already displayed objects with the same shape
-               vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
-               vtkActorCollection* theAllActors = theRenderer->GetActors();
-               theAllActors->InitTraversal();
-               vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
-               Handle(SALOME_InteractiveObject) anIObj;
-               // don't create new study object if it already exists
-               bool isDisplayed = false;
-               while(!(actor==NULL)) {
-                 SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
-                 if(Gactor!=NULL) {
-                   if(Gactor->hasIO()) {
-                     if(strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
-                       isDisplayed = true;
-                       anIObj = Gactor->getIO();
-                       if(!anIObj.IsNull())
-                         myRenderInter->Erase(anIObj);
-                     }
-                   }
-                 }
-                 actor=(vtkActor*)(theAllActors->GetNextActor());
-               }
-             }
-             if(useSubItems) {
-               anIter->Next();
-               anAttr=SALOMEDS::GenericAttribute::_nil();
-               while(anIter->More() && anAttr->_is_nil()) {
-                 SALOMEDS::SObject_var subobject = anIter->Value();
-                 SALOMEDS::GenericAttribute_var aTmpAttribute;
-                 if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
-                   anAttr = aTmpAttribute;
-                   obj = subobject;
-                 }
-                 else
-                   anIter->Next();
-               }
-             } 
-             else
-               anAttr = SALOMEDS::GenericAttribute::_nil();
-           } 
-         }
-       }
-      }
-    }
-  }
-  else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
-    // OCC
-    OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-    Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-    SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-    Handle(SALOME_InteractiveObject) anIObject;
-    for(;It.More();It.Next()) {
-      anIObject = It.Value();
-      if(v3d->isInViewer(anIObject, true)) {
-       Standard_Boolean found;
-       Handle(GEOM_AISShape) aSh = myGeomBase->ConvertIOinGEOMAISShape(anIObject, found, true);
-       if(found) {
-         ic->Erase(aSh);
-         ic->AddOrRemoveCurrentObject(aSh, true);
-       }
-      } 
-      else {
-       SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry());
-       SALOMEDS::GenericAttribute_var anAttr;
-       SALOMEDS::AttributeIOR_var anIOR;
-       if(!obj->_is_nil()) {
-         if(obj->FindAttribute(anAttr, "AttributeIOR")) {
-           // this SObject may be GEOM module root SObject
-           SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj);
-           bool useSubItems = false;
-           while(anIter->More() && !useSubItems) {
-             SALOMEDS::SObject_var subobj = anIter->Value();
-             SALOMEDS::GenericAttribute_var aTmpAttr;
-             if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
-               anAttr = aTmpAttr;
-               obj = subobj;
-               useSubItems = true;
-             } 
-             else
-               anIter->Next();
-           }
-
-           while(useSubItems?anIter->More():!anAttr->_is_nil()) { 
-             anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-             GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value());
-             TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
-             if(obj->FindAttribute(anAttr, "AttributeName")) {
-               // searchin for already displayed objects with the same shape
-               AIS_ListOfInteractive aDisplayed;
-               ic->DisplayedObjects(aDisplayed);
-               AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
-               Handle(AIS_Shape) anAISShape;
-               for(;anIObjects.More();anIObjects.Next()) {
-                 anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
-                 if(!anAISShape.IsNull()) {
-                   if(anAISShape->Shape().IsSame(Shape))
-                     break;
-                   anAISShape.Nullify();
-                 }
-               }
-               if(!anAISShape.IsNull()) {
-                 if(ic->IsDisplayed(anAISShape)) 
-                   ic->Erase(anAISShape);
-               }
-             }
-             if(useSubItems) {
-               anIter->Next();
-               anAttr=SALOMEDS::GenericAttribute::_nil();
-               while(anIter->More() && anAttr->_is_nil()) {
-                 SALOMEDS::SObject_var subobject = anIter->Value();
-                 SALOMEDS::GenericAttribute_var aTmpAttribute;
-                 if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
-                   anAttr = aTmpAttribute;
-                   obj = subobject;
-                 }
-                 else
-                   anIter->Next();
-               }
-             }
-             else
-               anAttr = SALOMEDS::GenericAttribute::_nil();
-           }
-         }
-       }
-      }
-    }
+  SUIT_OverrideCursor wc;
+
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+  if ( !aStudy ) return;
+
+  if ( !viewWindow ) 
+    viewWindow = app->desktop()->activeWindow();
+
+  GEOM_Displayer displayer( aStudy );
+
+  viewWindow->setProperty( "VerticesMode", mode );
+
+  int aMgrId = viewWindow->getViewManager()->getGlobalId();
+
+  SALOME_View* window = displayer.GetActiveView();
+  if ( !window ) return;
+
+  SALOME_ListIO anIOlst;
+  window->GetVisible( anIOlst );
+
+  for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
+    Handle( SALOME_InteractiveObject ) io = It.Value();
+    aStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::Vertices ), mode );
+    displayer.Redisplay( io, false );
   }
-  Sel->ClearIObjects();
+  displayer.UpdateViewer();
+  GeometryGUI::Modified();
 }
 
+//=====================================================================================
+// function : DisplayGUI::GetVerticesMode()
+// purpose  : Get the "show vertices" mode of the viewer
+//=====================================================================================
+int DisplayGUI::GetVerticesMode( SUIT_ViewWindow* viewWindow )
+{
+  if ( !viewWindow ) 
+    viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
+  return viewWindow->property( "VerticesMode" ).toBool();
+}
 
 //=====================================================================================
-// function : PrepareSubShapeSelection()
-// purpose  : (localContextId of the method is opened and defined here)
+// function : DisplayGUI::SetNameMode()
+// purpose  : Set name mode for the viewer
 //=====================================================================================
-bool DisplayGUI::PrepareSubShapeSelection(const int SubShapeType, Standard_Integer& returnLocalContextId)
+void DisplayGUI::SetNameMode( const bool mode, SUIT_ViewWindow* viewWindow )
 {
-  //* Test the type of viewer */
-  if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
-    return false;
-  
-  OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-  Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-  
-  /* local context opening */
-  //myGeomBase->SetDisplayedObjectList();
-  this->OnDisplayOnly();
-
-  returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False);
-  SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
-  SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
-  for(;It.More();It.Next()) {
-    Handle(SALOME_InteractiveObject) IObject = It.Value();
-    Standard_Boolean found;
-    Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(IObject, found);
-    if(found && SubShapeType >= Shape->Shape().ShapeType()) {
-      ic->Load(Shape, (8 - SubShapeType), Standard_True);
-      ic->HilightWithColor(Shape, Quantity_NOC_RED);
-    }
+  SUIT_OverrideCursor();
+
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+  if ( !aStudy ) return;
+
+  if ( !viewWindow )
+    viewWindow = app->desktop()->activeWindow();
+
+  viewWindow->setProperty( "NameMode", mode );
+
+  GEOM_Displayer displayer( aStudy );
+
+  int aMgrId = viewWindow->getViewManager()->getGlobalId();
+
+  SALOME_View* window = displayer.GetActiveView();
+  if ( !window ) return;
+
+  SALOME_ListIO anIOlst;
+  window->GetVisible( anIOlst );
+
+  for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
+    Handle( SALOME_InteractiveObject ) io = It.Value();
+    aStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::ShowName ), mode );
+    displayer.Redisplay( io, false );
   }
-  QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_SUBSHAPES"));
-  return true;
+  displayer.UpdateViewer();
+  GeometryGUI::Modified();
 }
 
-
 //=====================================================================================
-// function : PrepareSubShapeSelectionArgumentShape()
-// purpose  : ( localContextId of the method is opened and defined here )
+// function : DisplayGUI::GetNameMode()
+// purpose  : Get the "show name" mode of the viewer
 //=====================================================================================
-bool DisplayGUI::PrepareSubShapeSelectionArgumentShape(const TopoDS_Shape& aShape,const int SubShapeType, Standard_Integer& returnLocalContextId)
+int DisplayGUI::GetNameMode( SUIT_ViewWindow* viewWindow )
 {
-  //* Test the type of viewer */
-  if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
-    return false;
-  
-  if(aShape.IsNull())
-    return false ;
-  
-  OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-  Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-  
-  /* local context opening */
-  //myGeomBase->SetDisplayedObjectList();
-  this->OnDisplayOnly();
-  
-  returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False) ;
-  
-  Handle(GEOM_AISShape) Shape = new GEOM_AISShape(aShape, "");  
-  ic->Display(Shape, 0, (8 - SubShapeType));
-
-  //  Not Load(...) but Display(...)
-  //  ic->Load(Shape, (8 - SubShapeType), Standard_True);
-  ic->HilightWithColor(Shape, Quantity_NOC_RED);
-  
-  QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_SUBSHAPES"));
-  return true;
+  if ( !viewWindow )
+    viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
+  return viewWindow->property( "NameMode" ).toBool();
 }
 
+//=====================================================================================
+// function : DisplayGUI::ChangeDisplayMode()
+// purpose  : Set display mode for selected objects in the viewer given
+//            (current viewer if <viewWindow> = 0 )
+//=====================================================================================
+void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
+{
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  if ( !viewWindow ) 
+    viewWindow = app->desktop()->activeWindow();
+
+  LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+  if ( !aSelMgr ) return;
+
+  SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+  if ( !aStudy ) return;
+
+  SUIT_OverrideCursor wc;
+
+  SALOME_ListIO selected;
+  aSelMgr->selectedObjects( selected );
+  if ( selected.IsEmpty() ) return;
+
+  GEOM_Displayer displayer( aStudy );
+
+  int mgrId = viewWindow->getViewManager()->getGlobalId();
+
+  QVariant v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), QVariant() );
+  bool vectorMode =  v.isValid() ? !v.toBool() : false;
+  v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Vertices ), QVariant() );
+  bool verticesMode =  v.isValid() ? !v.toBool() : false;
+  v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::ShowName ), QVariant() );
+  bool nameMode =  v.isValid() ? !v.toBool() : false;
+
+  for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+    Handle( SALOME_InteractiveObject ) io = It.Value();
+    if ( mode == 0 || mode == 1 || mode == 2 || mode == 3 ) {
+      aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), mode );
+    }
+    else if ( mode == 4 ) {
+      aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), vectorMode );
+    }
+    else if ( mode == 5 ) {
+      aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::Vertices ), verticesMode );
+    }
+    else if ( mode == 6 ) {
+      aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::ShowName ), nameMode );
+    }
+    displayer.Redisplay( io, false );
+  }
+  displayer.UpdateViewer();
+  GeometryGUI::Modified();
+}
 
 //=====================================================================================
 // EXPORTED METHODS
 //=====================================================================================
 extern "C"
 {
-  bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
-  {return DisplayGUI::OnGUIEvent(theCommandID, parent);}
-  
-  void BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
-  {return DisplayGUI::BuildPresentation(theIO);}
+#ifdef WIN32
+  __declspec( dllexport )
+#endif
+  GEOMGUI* GetLibGUI( GeometryGUI* parent )
+  {
+    return new DisplayGUI( parent );
+  }
 }