Salome HOME
Unicode support: correct handling of unicode on GUI level
[modules/gui.git] / src / SOCC / SOCC_ViewModel.cxx
index 60c0a880ee362d21d42f9cf94cd5cc309bc57d00..aa9ed64b2ae762a1e6ff5c917690352d20bc55fa 100755 (executable)
-// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-// 
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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.
-// 
-// 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 
+// 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.
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
+// 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/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-#include "SOCC_ViewModel.h"\r
-\r
-#include "SOCC_Prs.h"\r
-#include "SOCC_ViewWindow.h"\r
-\r
-#include "SUIT_Session.h"\r
-#include "SUIT_Application.h"\r
-\r
-//#include "ToolsGUI.h"\r
-\r
-// Temporarily commented to avoid awful dependecy on SALOMEDS\r
-// TODO: better mechanism of storing display/erse status in a study\r
-// should be provided...\r
-//#include <SALOMEconfig.h>\r
-//#include CORBA_CLIENT_HEADER(SALOMEDS)\r
-\r
-#include <AIS_ListIteratorOfListOfInteractive.hxx>\r
-#include <Visual3d_View.hxx>\r
-\r
-#include <SALOME_AISShape.hxx>\r
-#include <SALOME_AISObject.hxx>\r
-\r
-// Temporarily commented to avoid awful dependecy on SALOMEDS\r
-// TODO: better mechanism of storing display/erse status in a study\r
-// should be provided...\r
-//#include <Utils_ORB_INIT.hxx>\r
-//#include <Utils_SINGLETON.hxx>\r
-//#include <SALOME_ModuleCatalog_impl.hxx>\r
-//#include <SALOME_NamingService.hxx>\r
-\r
-//#include "SALOMEDSClient.hxx"\r
-//#include "SALOMEDS_StudyManager.hxx"\r
-\r
-#include <AIS_TypeOfIso.hxx>\r
-\r
-// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study.\r
-// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from \r
-// SALOMEDS::StudyManager - no linkage with SalomeApp. \r
-\r
-// Temporarily commented to avoid awful dependecy on SALOMEDS\r
-// TODO: better mechanism of storing display/erse status in a study\r
-// should be provided...\r
-//static _PTR(Study) getStudyDS() \r
-//{\r
-//  SALOMEDSClient_Study* aStudy = NULL;\r
-//  _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );\r
-\r
-  // get id of SUIT_Study, if it's a SalomeApp_Study, it will return\r
-  //    id of its underlying SALOMEDS::Study\r
-//  SUIT_Application* app = SUIT_Session::session()->activeApplication();\r
-//  if ( !app )  return _PTR(Study)(aStudy); \r
-//  SUIT_Study* stud = app->activeStudy();\r
-//  if ( !stud ) return _PTR(Study)(aStudy);  \r
-//  const int id = stud->id(); // virtual method, must return SALOMEDS_Study id\r
-  // get SALOMEDS_Study with this id from StudyMgr\r
-//  return aMgr->GetStudyByID( id );\r
-//}\r
-\r
-SOCC_Viewer::SOCC_Viewer( bool DisplayTrihedron )\r
-: OCCViewer_Viewer( DisplayTrihedron )\r
-{\r
-}\r
-\r
-SOCC_Viewer::~SOCC_Viewer()\r
-{\r
-}\r
-\r
-bool SOCC_Viewer::highlight( const Handle(SALOME_InteractiveObject)& obj,\r
-                             bool hilight, bool upd )\r
-{\r
-  bool isInLocal = getAISContext()->HasOpenedContext();\r
-  //SUIT_Study* ActiveStudy = SUIT_Application::getDesktop()->getActiveStudy();\r
-  //SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );\r
-\r
-  AIS_ListOfInteractive List;\r
-  getAISContext()->DisplayedObjects(List);\r
-  \r
-  AIS_ListIteratorOfListOfInteractive ite(List);\r
-  for ( ; ite.More(); ite.Next() )\r
-  {\r
-    Handle(SALOME_InteractiveObject) anObj =\r
-      Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );\r
-\r
-    if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )\r
-    {\r
-      if ( !isInLocal )\r
-          OCCViewer_Viewer::highlight( ite.Value(), hilight, false );\r
-      // highlight subshapes only when local selection is active\r
-      else\r
-      {\r
-        /*if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISShape ) ) )\r
-        {\r
-          Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast( ite.Value() );\r
-          TColStd_IndexedMapOfInteger MapIndex;\r
-          Sel->GetIndex( IObject, MapIndex );\r
-          aSh->highlightSubShapes( MapIndex, highlight );\r
-        }*/\r
-      }\r
-      break;\r
-    }\r
-  }\r
-    \r
-  if( upd )\r
-    update();\r
-    \r
-  return false;\r
-}\r
-\r
-bool SOCC_Viewer::isInViewer( const Handle(SALOME_InteractiveObject)& obj,\r
-                              bool onlyInViewer )\r
-{\r
-  AIS_ListOfInteractive List;\r
-  getAISContext()->DisplayedObjects(List);\r
-\r
-  if( !onlyInViewer ) {\r
-    AIS_ListOfInteractive List1;\r
-    getAISContext()->ObjectsInCollector(List1);\r
-    List.Append(List1);\r
-  }\r
-\r
-  AIS_ListIteratorOfListOfInteractive ite(List);\r
-  for ( ; ite.More(); ite.Next() )\r
-  {\r
-    Handle(SALOME_InteractiveObject) anObj =\r
-        Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );\r
-\r
-    if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )\r
-      return true;\r
-  }\r
-  return false;\r
-}\r
-\r
-bool SOCC_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& obj )\r
-{\r
-  AIS_ListOfInteractive List;\r
-  getAISContext()->DisplayedObjects( List );\r
-\r
-  AIS_ListIteratorOfListOfInteractive ite( List );\r
-  for ( ; ite.More(); ite.Next() )\r
-  {\r
-    Handle(SALOME_InteractiveObject) anObj =\r
-      Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );\r
-\r
-    if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )\r
-      return getAISContext()->IsDisplayed( ite.Value() );\r
-  }\r
-  \r
-  return false;\r
-}\r
-\r
-void SOCC_Viewer::setColor( const Handle(SALOME_InteractiveObject)& obj,\r
-                            const QColor& color, bool update )\r
-{\r
-  AIS_ListOfInteractive List;\r
-  getAISContext()->DisplayedObjects(List);\r
-  \r
-  AIS_ListIteratorOfListOfInteractive ite(List);\r
-  for ( ; ite.More(); ite.Next() )\r
-  {\r
-    Handle(SALOME_InteractiveObject) anObj =\r
-        Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );\r
-\r
-    if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )\r
-    {\r
-      OCCViewer_Viewer::setColor( ite.Value(), color, update );\r
-      return;\r
-    }\r
-  }\r
-}\r
-\r
-void SOCC_Viewer::switchRepresentation( const Handle(SALOME_InteractiveObject)& obj,\r
-                                        int mode, bool update )\r
-{\r
-  AIS_ListOfInteractive List;\r
-  getAISContext()->DisplayedObjects(List);\r
-  \r
-  AIS_ListIteratorOfListOfInteractive ite(List);\r
-  for ( ; ite.More(); ite.Next() )\r
-  {\r
-    Handle(SALOME_InteractiveObject) anObj =\r
-        Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );\r
-\r
-    if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )\r
-    {\r
-      OCCViewer_Viewer::switchRepresentation( ite.Value(), mode, update );\r
-      return;\r
-    }\r
-  }\r
-}\r
-\r
-void SOCC_Viewer::setTransparency( const Handle(SALOME_InteractiveObject)& obj,\r
-                                   float trans, bool update )\r
-{\r
-  AIS_ListOfInteractive List;\r
-  getAISContext()->DisplayedObjects( List );\r
-  \r
-  AIS_ListIteratorOfListOfInteractive ite( List );\r
-  for ( ; ite.More(); ite.Next() )\r
-  {\r
-    Handle(SALOME_InteractiveObject) anObj =\r
-        Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );\r
-\r
-    if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )\r
-    {\r
-      OCCViewer_Viewer::setTransparency( ite.Value(), trans, update );\r
-      return;\r
-    }\r
-  }\r
-}\r
-\r
-void SOCC_Viewer::rename( const Handle(SALOME_InteractiveObject)& obj,\r
-                          const QString& name )\r
-{\r
-  AIS_ListOfInteractive List;\r
-  getAISContext()->DisplayedObjects(List);\r
-  \r
-  AIS_ListIteratorOfListOfInteractive ite(List);\r
-  while (ite.More())\r
-  {\r
-    if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape)))\r
-    {\r
-      Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite.Value());\r
-      \r
-      if ( aSh->hasIO() )\r
-      {\r
-        Handle(SALOME_InteractiveObject) IO = aSh->getIO();\r
-        if ( IO->isSame( obj ) )\r
-        {\r
-          aSh->setName( (char*)name.latin1() );\r
-          break;\r
-        }\r
-      }\r
-    }\r
-    else if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )\r
-    {\r
-      Handle(SALOME_AISObject) aSh = Handle(SALOME_AISObject)::DownCast( ite.Value() );\r
-\r
-      // Add code here, if someone create a MODULE_AISObject.\r
-    }\r
-    ite.Next();\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : Display\r
-// Purpose : Display presentation\r
-//=======================================================================\r
-void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )\r
-{\r
-  // try do downcast object\r
-  const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );\r
-  if ( !anOCCPrs || anOCCPrs->IsNull() )\r
-    return;\r
-\r
-  // get SALOMEDS Study\r
-  // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-  // TODO: better mechanism of storing display/erse status in a study\r
-  // should be provided...\r
-  //  _PTR(Study) study(getStudyDS());\r
-\r
-  // get context\r
-  Handle (AIS_InteractiveContext) ic = getAISContext();\r
-\r
-  // get all displayed objects\r
-  AIS_ListOfInteractive List;\r
-  ic->DisplayedObjects( List );\r
-  // get objects in the collector\r
-  AIS_ListOfInteractive ListCollector;\r
-  ic->ObjectsInCollector( ListCollector );\r
-\r
-  // get objects to be displayed\r
-  AIS_ListOfInteractive anAISObjects;\r
-  anOCCPrs->GetObjects( anAISObjects );\r
-\r
-  AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );\r
-  for ( ; aIter.More(); aIter.Next() )\r
-  {\r
-    Handle(AIS_InteractiveObject) anAIS = aIter.Value();\r
-    if ( !anAIS.IsNull() )\r
-    {\r
-      // try to find presentation in the viewer\r
-      bool bDisplayed = false;\r
-      AIS_ListIteratorOfListOfInteractive ite( List );\r
-      for ( ; ite.More(); ite.Next() )\r
-      {\r
-        // compare presentations by handles\r
-        // if the object is already displayed - nothing to do more\r
-        if ( ite.Value() == anAIS )\r
-        {\r
-          // Deactivate object if necessary\r
-          if ( !anOCCPrs->ToActivate() )\r
-            ic->Deactivate( anAIS );\r
-          bDisplayed = true;\r
-          break;\r
-        }\r
-      }\r
-\r
-      if ( bDisplayed )\r
-        continue;\r
-\r
-      // then try to find presentation in the collector\r
-      bDisplayed = false;\r
-      ite.Initialize( ListCollector );\r
-      for ( ; ite.More(); ite.Next() )\r
-      {\r
-        // compare presentations by handles\r
-        // if the object is in collector - display it\r
-        if ( ite.Value() == anAIS )\r
-        {\r
-          ic->DisplayFromCollector( anAIS, false );\r
-\r
-          // Deactivate object if necessary\r
-          if ( !anOCCPrs->ToActivate() )\r
-            ic->Deactivate( anAIS );\r
-          bDisplayed = true;\r
-\r
-          // Set visibility flag\r
-         // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-         // TODO: better mechanism of storing display/erse status in a study\r
-         // should be provided...\r
-         //Handle(SALOME_InteractiveObject) anObj =\r
-          //  Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );\r
-          //if ( !anObj.IsNull() && anObj->hasEntry() )\r
-          //{\r
-         //  if ( study )\r
-         //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );\r
-         //}\r
-          break;\r
-        }\r
-      }\r
-      if ( bDisplayed )\r
-        continue;\r
-\r
-      // if object is not displayed and not found in the collector - display it\r
-      if ( anAIS->IsKind( STANDARD_TYPE(AIS_Trihedron) ) )\r
-      {\r
-        Handle(AIS_Trihedron) aTrh = Handle(AIS_Trihedron)::DownCast( anAIS );\r
-        double aNewSize = 100, aSize = 100;\r
-        getTrihedronSize( aNewSize, aSize );\r
-        aTrh->SetSize( aTrh == getTrihedron() ? aNewSize : 0.5 * aNewSize );\r
-      }\r
-\r
-      ic->Display( anAIS, false );\r
-\r
-      // Set visibility flag\r
-      // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-      // TODO: better mechanism of storing display/erse status in a study\r
-      // should be provided...\r
-      //Handle(SALOME_InteractiveObject) anObj =\r
-      //  Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );\r
-      //if ( !anObj.IsNull() && anObj->hasEntry() )\r
-      //{\r
-      //  if ( study  )\r
-      //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );\r
-      //}\r
-\r
-      // Deactivate object if necessary\r
-      if ( !anOCCPrs->ToActivate() )\r
-        ic->Deactivate( anAIS );\r
-    }\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : Erase\r
-// Purpose : Erase presentation\r
-//=======================================================================\r
-void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced )\r
-{\r
-  // try do downcast object\r
-  const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );\r
-  if ( !anOCCPrs || anOCCPrs->IsNull() )\r
-    return;\r
-\r
-  // get SALOMEDS Study\r
-  // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-  // TODO: better mechanism of storing display/erse status in a study\r
-  // should be provided...\r
-  //  _PTR(Study) study(getStudyDS());\r
-\r
-  // get context\r
-  Handle(AIS_InteractiveContext) ic = getAISContext();\r
-\r
-  // get objects to be erased\r
-  AIS_ListOfInteractive anAISObjects;\r
-  anOCCPrs->GetObjects( anAISObjects );\r
-\r
-  AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );\r
-  for ( ; aIter.More(); aIter.Next() ) {\r
-    Handle(AIS_InteractiveObject) anAIS = aIter.Value();\r
-    if ( !anAIS.IsNull() ) {\r
-      // erase the object from context : move it to collector\r
-      ic->Erase( anAIS, false, forced ? false : true );\r
-\r
-      // Set visibility flag if necessary\r
-      // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-      // TODO: better mechanism of storing display/erse status in a study\r
-      // should be provided...\r
-      //if ( !forced )\r
-      //{\r
-      //  Handle(SALOME_InteractiveObject) anObj =\r
-      //    Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );\r
-      //  if ( !anObj.IsNull() && anObj->hasEntry() )\r
-      //  {\r
-      //  if ( study )\r
-      //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );\r
-      //  }\r
-      //}\r
-    }\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : EraseAll\r
-// Purpose : Erase all presentations\r
-//=======================================================================\r
-void SOCC_Viewer::EraseAll( const bool forced )\r
-{\r
-  // get SALOMEDS Study\r
-  // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-  // TODO: better mechanism of storing display/erse status in a study\r
-  // should be provided...\r
-  //  _PTR(Study) study(getStudyDS());\r
-\r
-  // get context\r
-  Handle(AIS_InteractiveContext) ic = getAISContext();\r
-\r
-  // check if trihedron is displayed\r
-  Standard_Boolean isTrihedronDisplayed = ic->IsDisplayed( getTrihedron() );\r
-\r
-  // get objects to be erased (all currently displayed objects)\r
-  AIS_ListOfInteractive aList;\r
-  ic->DisplayedObjects( aList );\r
-  AIS_ListIteratorOfListOfInteractive anIter( aList );\r
-  for ( ; anIter.More(); anIter.Next() ) {\r
-    if ( isTrihedronDisplayed && anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_Trihedron ) )\r
-      continue;\r
-\r
-    // erase an object\r
-    Handle(AIS_InteractiveObject) anIO = anIter.Value();\r
-    ic->Erase( anIO, false, forced ? false : true );\r
-    \r
-    // Set visibility flag if necessary\r
-    // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-    // TODO: better mechanism of storing display/erse status in a study\r
-    // should be provided...\r
-    //if ( !forced ) {\r
-    //  Handle(SALOME_InteractiveObject) anObj =\r
-    // Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );\r
-\r
-    //  if ( !anObj.IsNull() && anObj->hasEntry() ) {\r
-    // if ( study )\r
-    //   ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );\r
-    //  }\r
-    //}\r
-  }\r
-\r
-  // display trihedron if necessary\r
-  if ( isTrihedronDisplayed )\r
-    getAISContext()->Display( getTrihedron() );\r
-  else\r
-    Repaint();\r
-}\r
-\r
-//=======================================================================\r
-// name    : CreatePrs\r
-// Purpose : Create presentation corresponding to the entry\r
-//=======================================================================\r
-SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )\r
-{\r
-  SOCC_Prs* prs = new SOCC_Prs();\r
-  if ( entry )\r
-  {\r
-    // get context\r
-    Handle(AIS_InteractiveContext) ic = getAISContext();\r
-\r
-    // get displayed objects\r
-    AIS_ListOfInteractive List;\r
-    ic->DisplayedObjects( List );\r
-    // get objects in the collector\r
-    AIS_ListOfInteractive ListCollector;\r
-    ic->ObjectsInCollector( ListCollector );\r
-    List.Append( ListCollector );\r
-\r
-    AIS_ListIteratorOfListOfInteractive ite( List );\r
-    for ( ; ite.More(); ite.Next() )\r
-    {\r
-      Handle(SALOME_InteractiveObject) anObj =\r
-        Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );\r
-\r
-      if ( !anObj.IsNull() && anObj->hasEntry() && strcmp( anObj->getEntry(), entry ) == 0 )\r
-        prs->AddObject( ite.Value() );\r
-    }\r
-  }\r
-  return prs;\r
-}\r
-\r
-//=======================================================================\r
-// name    : LocalSelection\r
-// Purpose : Activates selection of sub shapes\r
-//=======================================================================\r
-void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )\r
-{\r
-  Handle(AIS_InteractiveContext) ic = getAISContext();\r
-  \r
-  const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( thePrs );\r
-  if ( ic.IsNull() )\r
-    return;\r
-  \r
-  // Open local context if there is no one\r
-  bool allObjects = thePrs == 0 || thePrs->IsNull();\r
-  if ( !ic->HasOpenedContext() ) {\r
-    ic->ClearCurrents( false );\r
-    ic->OpenLocalContext( allObjects, true, true );\r
-  }\r
-\r
-  AIS_ListOfInteractive anObjs;\r
-  // Get objects to be activated\r
-  if ( allObjects ) \r
-    ic->DisplayedObjects( anObjs );\r
-  else\r
-    anOCCPrs->GetObjects( anObjs );\r
-\r
-  // Activate selection of objects from prs\r
-  AIS_ListIteratorOfListOfInteractive aIter( anObjs );\r
-  for ( ; aIter.More(); aIter.Next() ) {\r
-    Handle(AIS_InteractiveObject) anAIS = aIter.Value();\r
-    if ( !anAIS.IsNull() )\r
-    {\r
-      if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )\r
-      {\r
-        ic->Load( anAIS, -1, false );\r
-        ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) );\r
-      }\r
-      else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )\r
-      {\r
-        ic->Load( anAIS, -1, false );\r
-        ic->Activate( anAIS, theMode );\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : GlobalSelection\r
-// Purpose : Deactivates selection of sub shapes\r
-//=======================================================================\r
-void SOCC_Viewer::GlobalSelection( const bool update ) const\r
-{\r
-  Handle(AIS_InteractiveContext) ic = getAISContext();\r
-  if ( !ic.IsNull() )\r
-  {\r
-    ic->CloseAllContexts( false );\r
-    if ( update )\r
-      ic->CurrentViewer()->Redraw();\r
-  }\r
-}\r
-\r
-//=======================================================================\r
-// name    : BeforeDisplay\r
-// Purpose : Axiluary method called before displaying of objects\r
-//=======================================================================\r
-void  SOCC_Viewer::BeforeDisplay( SALOME_Displayer* d )\r
-{\r
-  d->BeforeDisplay( this, SALOME_OCCViewType() );\r
-}\r
-\r
-//=======================================================================\r
-// name    : AfterDisplay\r
-// Purpose : Axiluary method called after displaying of objects\r
-//=======================================================================\r
-void SOCC_Viewer::AfterDisplay( SALOME_Displayer* d )\r
-{\r
-  d->AfterDisplay( this, SALOME_OCCViewType() );\r
-}\r
-\r
-//=======================================================================\r
-// name    : getTrihedronSize\r
-// Purpose : Get new and current trihedron size corresponding to the\r
-//           current model size\r
-//=======================================================================\r
-bool SOCC_Viewer::getTrihedronSize( double& theNewSize, double& theSize )\r
-{\r
-  theNewSize = 100;\r
-  theSize = 100;\r
-\r
-  //SRN: BUG IPAL8996, a usage of method ActiveView without an initialization\r
-  Handle(V3d_Viewer) viewer = getViewer3d();\r
-  viewer->InitActiveViews();\r
-  if(!viewer->MoreActiveViews()) return false;\r
-\r
-  Handle(V3d_View) view3d = viewer->ActiveView();\r
-  //SRN: END of fix\r
-\r
-  if ( view3d.IsNull() )\r
-    return false;\r
-\r
-  double Xmin = 0, Ymin = 0, Zmin = 0, Xmax = 0, Ymax = 0, Zmax = 0;\r
-  double aMaxSide;\r
-\r
-  view3d->View()->MinMaxValues( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );\r
-\r
-  if ( Xmin == RealFirst() || Ymin == RealFirst() || Zmin == RealFirst() ||\r
-       Xmax == RealLast()  || Ymax == RealLast()  || Zmax == RealLast() )\r
-    return false;\r
-\r
-  aMaxSide = Xmax - Xmin;\r
-  if ( aMaxSide < Ymax -Ymin ) aMaxSide = Ymax -Ymin;\r
-  if ( aMaxSide < Zmax -Zmin ) aMaxSide = Zmax -Zmin;\r
-\r
-  float aSizeInPercents = SUIT_Session::session()->resourceMgr()->doubleValue("Viewer","TrihedronSize", 105.);\r
-\r
-  static float EPS = 5.0E-3;\r
-  theSize = getTrihedron()->Size();\r
-  theNewSize = aMaxSide*aSizeInPercents / 100.0;\r
-\r
-  return fabs( theNewSize - theSize ) > theSize * EPS ||\r
-         fabs( theNewSize - theSize) > theNewSize * EPS;\r
-}\r
-\r
-//=======================================================================\r
-// name    : Repaint\r
-// Purpose : \r
-//=======================================================================\r
-void SOCC_Viewer::Repaint()\r
-{\r
-//  onAdjustTrihedron();\r
-  getViewer3d()->Update();\r
-}\r
-\r
-//=======================================================================\r
-// name    : createView\r
-// Purpose : create SOCC_ViewWindow\r
-//=======================================================================\r
-SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )\r
-{\r
-  SOCC_ViewWindow* view = new SOCC_ViewWindow(theDesktop, this);\r
-  initView( view );\r
-  return view;\r
-}\r
+
+#include "SOCC_ViewModel.h"
+
+#include "SOCC_Prs.h"
+#include "SOCC_ViewWindow.h"
+
+#include "SUIT_Session.h"
+#include "SUIT_ResourceMgr.h"
+//#include "SUIT_Application.h"
+
+//#include "ToolsGUI.h"
+
+// Temporarily commented to avoid awful dependecy on SALOMEDS
+// TODO: better mechanism of storing display/erse status in a study
+// should be provided...
+//#include <SALOMEconfig.h>
+//#include CORBA_CLIENT_HEADER(SALOMEDS)
+
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
+
+#include <SALOME_AISShape.hxx>
+#include <SALOME_AISObject.hxx>
+#include <SALOME_InteractiveObject.hxx>
+#include <SALOME_ListIO.hxx>
+
+#include <AIS_TypeOfIso.hxx>
+#include <Precision.hxx>
+
+#include <algorithm>
+
+/*!
+  Constructor
+  \param DisplayTrihedron - is trihedron displayed
+*/
+SOCC_Viewer::SOCC_Viewer( bool DisplayTrihedron )
+: OCCViewer_Viewer( DisplayTrihedron )
+{
+}
+
+/*!
+  Destructor
+*/
+SOCC_Viewer::~SOCC_Viewer()
+{
+}
+
+/*!
+  Hilights/unhilights object in viewer
+  \param obj - object to be updated
+  \param hilight - if it is true, object will be hilighted, otherwise it will be unhilighted
+  \param update - update current viewer
+*/
+bool SOCC_Viewer::highlight( const Handle(SALOME_InteractiveObject)& obj,
+                             bool hilight, bool upd )
+{
+  bool isInLocal = getAISContext()->HasOpenedContext();
+  //SUIT_Study* ActiveStudy = SUIT_Application::getDesktop()->getActiveStudy();
+  //SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
+
+  AIS_ListOfInteractive List;
+  getAISContext()->DisplayedObjects(List);
+  
+  AIS_ListIteratorOfListOfInteractive ite(List);
+  for ( ; ite.More(); ite.Next() )
+  {
+    Handle(SALOME_InteractiveObject) anObj =
+      Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+    if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )
+    {
+      if ( !isInLocal )
+          OCCViewer_Viewer::highlight( ite.Value(), hilight, false );
+      // highlight sub-shapes only when local selection is active
+      else
+      {
+        /*if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISShape ) ) )
+        {
+          Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast( ite.Value() );
+          TColStd_IndexedMapOfInteger MapIndex;
+          Sel->GetIndex( IObject, MapIndex );
+          aSh->highlightSubShapes( MapIndex, highlight );
+        }*/
+      }
+      break;
+    }
+  }
+    
+  if( upd )
+    update();
+    
+  return false;
+}
+
+/*!
+  \return true if object is in viewer or in collector
+  \param obj - object to be checked
+  \param onlyInViewer - search object only in viewer (so object must be displayed)
+*/
+bool SOCC_Viewer::isInViewer( const Handle(SALOME_InteractiveObject)& obj,
+                              bool onlyInViewer )
+{
+  AIS_ListOfInteractive List;
+  getAISContext()->DisplayedObjects(List);
+  AIS_ListIteratorOfListOfInteractive ite(List);
+  for ( ; ite.More(); ite.Next() )
+  {
+    Handle(SALOME_InteractiveObject) anObj =
+        Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+    if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )
+      return true;
+  }
+  return false;
+}
+
+/*!
+  \return true if object is displayed in viewer
+  \param obj - object to be checked
+*/
+bool SOCC_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& obj )
+{
+
+  std::map< std::string , std::vector<Handle(AIS_InteractiveObject)> >::iterator it=entry2aisobjects.find(obj->getEntry());
+  if(it != entry2aisobjects.end())
+    {
+      // get context
+      Handle (AIS_InteractiveContext) ic = getAISContext();
+      std::vector<Handle(AIS_InteractiveObject)>& List = it->second;
+      for( unsigned int ind = 0; ind < List.size(); ind++ )
+        {
+          Handle(AIS_InteractiveObject) anAIS=List[ind];
+          if(ic->IsDisplayed(anAIS))
+            return true;
+        }
+  }
+  
+  return false;
+}
+
+/*!
+  Sets color of object
+  \param obj - object to be updated
+  \param color - new color
+  \param update - update current viewer
+*/
+void SOCC_Viewer::setColor( const Handle(SALOME_InteractiveObject)& obj,
+                            const QColor& color, bool update )
+{
+  if(obj.IsNull() || !obj->hasEntry() )
+    return;
+
+  if(entry2aisobjects.count(obj->getEntry())>0)
+    {
+      // get context
+      Handle (AIS_InteractiveContext) ic = getAISContext();
+      std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[obj->getEntry()];
+      for( unsigned int ind = 0; ind < List.size(); ind++ )
+        {
+          Handle(AIS_InteractiveObject) anAIS=List[ind];
+          if( !anAIS.IsNull() && ic->IsDisplayed(anAIS))
+            OCCViewer_Viewer::setColor( anAIS, color, update );
+        }
+    }
+}
+
+/*!
+  Changes display mode of object
+  \param obj - object to be processed
+  \param mode - new display mode
+  \param update - update current viewer
+*/
+void SOCC_Viewer::switchRepresentation( const Handle(SALOME_InteractiveObject)& obj,
+                                        int mode, bool update )
+{
+  if(obj.IsNull() || !obj->hasEntry() )
+    return;
+
+  if(entry2aisobjects.count(obj->getEntry())>0)
+    {
+      // get context
+      Handle (AIS_InteractiveContext) ic = getAISContext();
+      std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[obj->getEntry()];
+      for( unsigned int ind = 0; ind < List.size(); ind++ )
+        {
+          Handle(AIS_InteractiveObject) anAIS=List[ind];
+          if( !anAIS.IsNull() && ic->IsDisplayed(anAIS))
+            OCCViewer_Viewer::switchRepresentation( anAIS, mode, update );
+        }
+    }
+}
+
+/*!
+  Changes transparency of object
+  \param obj - object to be processed
+  \param trans - new transparency
+  \param update - update current viewer
+*/
+void SOCC_Viewer::setTransparency( const Handle(SALOME_InteractiveObject)& obj,
+                                   float trans, bool update )
+{
+  if(obj.IsNull() || !obj->hasEntry() )
+    return;
+
+  if(entry2aisobjects.count(obj->getEntry())>0)
+    {
+      // get context
+      Handle (AIS_InteractiveContext) ic = getAISContext();
+      std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[obj->getEntry()];
+      for( unsigned int ind = 0; ind < List.size(); ind++ )
+        {
+          Handle(AIS_InteractiveObject) anAIS=List[ind];
+          if( !anAIS.IsNull() && ic->IsDisplayed(anAIS))
+            OCCViewer_Viewer::setTransparency( anAIS, trans, update );
+        }
+    }
+}
+
+/*!
+  Changes name of object
+  \param obj - object to be renamed
+  \param name - new name
+*/
+void SOCC_Viewer::rename( const Handle(SALOME_InteractiveObject)& obj,
+                          const QString& name )
+{
+  AIS_ListOfInteractive List;
+  getAISContext()->DisplayedObjects(List);
+  
+  AIS_ListIteratorOfListOfInteractive ite(List);
+  while (ite.More())
+  {
+    if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape)))
+    {
+      Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite.Value());
+      
+      if ( aSh->hasIO() )
+      {
+        Handle(SALOME_InteractiveObject) IO = aSh->getIO();
+        if ( IO->isSame( obj ) )
+        {
+          aSh->setName( name.toUtf8().data() );
+          break;
+        }
+      }
+    }
+    else if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
+    {
+      Handle(SALOME_AISObject) aSh = Handle(SALOME_AISObject)::DownCast( ite.Value() );
+
+      // Add code here, if someone create a MODULE_AISObject.
+    }
+    ite.Next();
+  }
+}
+
+
+/*!
+  Display presentation
+  \param prs - presentation
+*/
+void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
+{
+  // try do downcast object
+  const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
+  if ( !anOCCPrs || anOCCPrs->IsNull() )
+    return;
+
+  // get context
+  Handle (AIS_InteractiveContext) ic = getAISContext();
+
+  // get objects to be displayed
+  AIS_ListOfInteractive anAISObjects;
+  anOCCPrs->GetObjects( anAISObjects );
+
+  AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
+  for ( ; aIter.More(); aIter.Next() )
+  {
+    Handle(AIS_InteractiveObject) anAIS = aIter.Value();
+    if ( !anAIS.IsNull() )
+    {
+      // try to find presentation in the viewer
+
+      // if the object is already displayed - nothing to do more
+      if(ic->IsDisplayed(anAIS))
+        {
+          // Deactivate object if necessary
+          if ( !anOCCPrs->ToActivate() )
+            ic->Deactivate( anAIS );
+          continue;
+        }
+
+      // if object is not displayed and not found in the collector - display it
+      if ( anAIS->IsKind( STANDARD_TYPE(AIS_Trihedron) ) )
+      {
+        Handle(AIS_Trihedron) aTrh = Handle(AIS_Trihedron)::DownCast( anAIS );
+        double aNewSize = 100, aSize = 100;
+        computeTrihedronSize( aNewSize, aSize );
+        aTrh->SetSize( aTrh == getTrihedron() ? aNewSize : 0.5 * aNewSize );
+      }
+
+      ic->Display( anAIS, false );
+      Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast (anAIS);
+      if (!aSh.IsNull())
+      {
+        aSh->SetClippable (prs->IsClippable());
+        applyExistingClipPlanesToObject (anAIS);
+        bool top = (aSh->isTopLevel() && aSh->switchTopLevel());
+             ic->SetZLayer( aSh, top ? getTopLayerId() : 0 );
+                   if(!aSh->toActivate())
+        {
+                           ic->Deactivate( aSh );
+                   }
+      }
+
+      //Register anAIS (if it has an entry) in entry2aisobjects map
+      Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
+      if ( !anObj.IsNull() && anObj->hasEntry())
+        {
+          std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[anObj->getEntry()];
+          int found=0;
+          for ( unsigned int ind = 0; ind < List.size(); ind++ )
+          {
+            if(List[ind] == anAIS)
+              {
+                found=1;
+                break;
+              }
+          }
+          if(!found)
+            {
+              List.push_back(anAIS);
+            }
+        }
+
+      // Set visibility flag
+      // Temporarily commented to avoid awful dependecy on SALOMEDS
+      // TODO: better mechanism of storing display/erse status in a study
+      // should be provided...
+      //Handle(SALOME_InteractiveObject) anObj =
+      //  Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
+      //if ( !anObj.IsNull() && anObj->hasEntry() )
+      //{
+      //  ToolsGUI::SetVisibility( anObj->getEntry(), true, this );
+      //}
+
+      // Deactivate object if necessary
+      if ( !anOCCPrs->ToActivate() )
+        ic->Deactivate( anAIS );
+    }
+  }
+  updateTrihedron();
+}
+
+
+/*!
+  Erase presentation
+  \param prs - presentation
+  \param forced - removes object from context
+*/
+void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced )
+{
+  // try do downcast object
+  const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
+  if ( !anOCCPrs || anOCCPrs->IsNull() )
+    return;
+
+  // get context
+  Handle(AIS_InteractiveContext) ic = getAISContext();
+
+  // get objects to be erased
+  AIS_ListOfInteractive anAISObjects;
+  anOCCPrs->GetObjects( anAISObjects );
+
+  AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
+  for ( ; aIter.More(); aIter.Next() ) {
+    Handle(AIS_InteractiveObject) anAIS = aIter.Value();
+    if ( !anAIS.IsNull() ) {
+      // erase the object from context : move it to collector
+      ic->Erase( anAIS, false );
+      // Set visibility flag if necessary
+      // Temporarily commented to avoid awful dependecy on SALOMEDS
+      // TODO: better mechanism of storing display/erse status in a study
+      // should be provided...
+      //if ( !forced )
+      //{
+      //  Handle(SALOME_InteractiveObject) anObj =
+      //    Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
+      //  if ( !anObj.IsNull() && anObj->hasEntry() )
+      //  {
+      //    ToolsGUI::SetVisibility( anObj->getEntry(), true, this );
+      //  }
+      //}
+    }
+  }
+  updateTrihedron();
+}
+
+
+/*!
+  Erase all presentations
+  \param forced - removes all objects from context
+*/
+void SOCC_Viewer::EraseAll( SALOME_Displayer* d, const bool forced )
+{
+  // get context
+  Handle(AIS_InteractiveContext) ic = getAISContext();
+
+  // check if trihedron is displayed
+  Standard_Boolean isTrihedronDisplayed = ic->IsDisplayed( getTrihedron() );
+
+  // get objects to be erased (all currently displayed objects)
+  AIS_ListOfInteractive aList;
+  ic->DisplayedObjects( aList );
+  AIS_ListIteratorOfListOfInteractive anIter( aList );
+  for ( ; anIter.More(); anIter.Next() ) {
+    if ( (isTrihedronDisplayed && anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_Trihedron ) ) )
+      continue;
+
+    // erase an object
+    Handle(AIS_InteractiveObject) anIO = anIter.Value();
+    ic->Erase( anIO, false );
+    
+    // Set visibility flag if necessary
+    // Temporarily commented to avoid awful dependecy on SALOMEDS
+    // TODO: better mechanism of storing display/erse status in a study
+    // should be provided...
+    //if ( !forced ) {
+    //  Handle(SALOME_InteractiveObject) anObj =
+    //  Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
+
+    //  if ( !anObj.IsNull() && anObj->hasEntry() ) {
+    //    ToolsGUI::SetVisibility( anObj->getEntry(), true, this );
+    //  }
+    //}
+  }
+
+  SALOME_View::EraseAll( d, forced );
+
+  Repaint();
+  updateTrihedron();
+}
+
+/*!
+  Create presentation corresponding to the entry
+  \param entry - entry
+*/
+SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )
+{
+  SOCC_Prs* prs = new SOCC_Prs(entry);
+  if ( entry )
+  {
+    if(entry2aisobjects.count(entry)>0)
+      {
+        //ais object exists
+        std::vector<Handle(AIS_InteractiveObject)> List = entry2aisobjects[entry];
+        // get context
+        Handle(AIS_InteractiveContext) ic = getAISContext();
+        //add all ais
+        for ( unsigned int ind = 0; ind < List.size(); ind++ )
+          {
+            Handle(AIS_InteractiveObject) anAIS=List[ind];
+            if(ic->IsDisplayed(anAIS))
+              {
+                prs->AddObject( anAIS );
+              }
+          }
+      }
+  }
+  return prs;
+}
+
+/*!
+  Activates selection of sub-shapes
+*/
+void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const std::list<int> modes )
+{
+  Handle(AIS_InteractiveContext) ic = getAISContext();
+  
+  const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( thePrs );
+  if ( ic.IsNull() )
+    return;
+  
+  // Open local context if there is no one
+  bool allObjects = thePrs == 0 || thePrs->IsNull();
+  if ( !ic->HasOpenedContext() ) {
+    ic->ClearCurrents( false );
+    ic->OpenLocalContext( Standard_False, Standard_True, Standard_True );
+  }
+
+  AIS_ListOfInteractive anObjs;
+  // Get objects to be activated
+  if ( allObjects ) 
+    ic->DisplayedObjects( anObjs );
+  else
+    anOCCPrs->GetObjects( anObjs );
+
+  std::list<int> sel_modes;
+  for ( int i = TopAbs_COMPOUND; i < TopAbs_SHAPE; i++ )
+    if ( std::find(modes.begin(), modes.end(), (int)TopAbs_SHAPE) != modes.end() || std::find(modes.begin(), modes.end(), i) != modes.end())
+      sel_modes.push_back(i);
+
+  // Activate selection of objects from prs
+  AIS_ListIteratorOfListOfInteractive aIter( anObjs );
+  for ( ; aIter.More(); aIter.Next() ) {
+    Handle(AIS_InteractiveObject) anAIS = aIter.Value();
+    if ( !anAIS.IsNull() )
+    {
+      std::list<int>::const_iterator it;
+      if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
+      {
+        ic->Load( anAIS, -1, false );
+        for( it = sel_modes.begin(); it != sel_modes.end(); ++it )
+          ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)*it ) );
+      }
+      else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )
+      {
+        ic->Load( anAIS, -1, false );
+        for( it = sel_modes.begin(); it != sel_modes.end(); ++it )
+          ic->Activate( anAIS, *it );
+      }
+    }
+  }
+}
+
+/*!
+  Activates selection of sub-shapes
+*/
+void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
+{
+  std::list<int> modes;
+  modes.push_back( theMode );
+  LocalSelection( thePrs, modes );
+}
+
+/*!
+  Deactivates selection of sub-shapes
+*/
+void SOCC_Viewer::GlobalSelection( const bool update ) const
+{
+  Handle(AIS_InteractiveContext) ic = getAISContext();
+  if ( !ic.IsNull() )
+  {
+    ic->CloseAllContexts( false );
+    if ( update )
+      ic->CurrentViewer()->Redraw();
+  }
+}
+
+
+/*!
+  \Collect objects visible in viewer
+  \param theList - visible objects collection
+*/
+void SOCC_Viewer::GetVisible( SALOME_ListIO& theList )
+{
+  AIS_ListOfInteractive List;
+  getAISContext()->DisplayedObjects(List);
+  
+  AIS_ListIteratorOfListOfInteractive ite(List);
+  for ( ; ite.More(); ite.Next() )
+  {
+    Handle(SALOME_InteractiveObject) anObj =
+        Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
+
+    if ( !anObj.IsNull() && anObj->hasEntry() )
+      theList.Append( anObj );
+  }
+}
+
+/*!
+  Updates current viewer
+*/
+void SOCC_Viewer::Repaint()
+{
+//  onAdjustTrihedron();
+  getViewer3d()->Update();
+}
+
+
+/*!
+  create SOCC_ViewWindow
+*/
+/*SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )
+{
+  SOCC_ViewWindow* view = new SOCC_ViewWindow(theDesktop, this);
+  //initView( view );
+  initView( view->getView(OCCViewer_ViewFrame::MAIN_VIEW) );
+  return view;
+  }*/
+
+/* 
+ * Returns a new OCCViewer_ViewWindow instance which will be placed as a sub window in ViewFrame
+ */
+OCCViewer_ViewWindow* SOCC_Viewer::createSubWindow()
+{
+  return new SOCC_ViewWindow( 0,  this);
+}