Salome HOME
Replaced the old execption handler by the new one.
[modules/gui.git] / src / SOCC / SOCC_ViewModel.cxx
index c21735bbac0185ae7db6af6cad29077d9ea8e696..b78328d7f40c2ea687c5966f5bbe4aab3376f84c 100755 (executable)
@@ -1,6 +1,7 @@
 #include "SOCC_ViewModel.h"
 
 #include "SOCC_Prs.h"
+#include "SOCC_ViewWindow.h"
 
 #include "SUIT_Session.h"
 #include "SUIT_Application.h"
@@ -24,6 +25,8 @@
 #include "SALOMEDSClient.hxx"
 #include "SALOMEDS_StudyManager.hxx"
 
+#include <AIS_TypeOfIso.hxx>
+
 // in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study.
 // SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from 
 // SALOMEDS::StudyManager - no linkage with SalomeApp. 
@@ -469,23 +472,23 @@ SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )
 //=======================================================================
 void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
 {
-  Handle(AIS_InteractiveContext) anIC = getAISContext();
+  Handle(AIS_InteractiveContext) ic = getAISContext();
   
   const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( thePrs );
-  if ( anIC.IsNull() )
+  if ( ic.IsNull() )
     return;
   
   // Open local context if there is no one
   bool allObjects = thePrs == 0 || thePrs->IsNull();
-  if ( !anIC->HasOpenedContext() ) {
-    anIC->ClearCurrents( false );
-    anIC->OpenLocalContext( allObjects, true, true );
+  if ( !ic->HasOpenedContext() ) {
+    ic->ClearCurrents( false );
+    ic->OpenLocalContext( allObjects, true, true );
   }
 
   AIS_ListOfInteractive anObjs;
   // Get objects to be activated
   if ( allObjects ) 
-    anIC->DisplayedObjects( anObjs );
+    ic->DisplayedObjects( anObjs );
   else
     anOCCPrs->GetObjects( anObjs );
 
@@ -497,13 +500,13 @@ void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode
     {
       if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
       {
-        anIC->Load( anAIS, -1, false );
-        anIC->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) );
+        ic->Load( anAIS, -1, false );
+        ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) );
       }
       else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )
       {
-        anIC->Load( anAIS, -1, false );
-        anIC->Activate( anAIS, theMode );
+        ic->Load( anAIS, -1, false );
+        ic->Activate( anAIS, theMode );
       }
     }
   }
@@ -515,11 +518,13 @@ void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode
 //=======================================================================
 void SOCC_Viewer::GlobalSelection( const bool update ) const
 {
-  Handle(AIS_InteractiveContext) anIC = getAISContext();
-  if ( !anIC.IsNull() )
-    anIC->CloseAllContexts( false );
-  if ( update )
-    anIC->CurrentViewer()->Redraw();
+  Handle(AIS_InteractiveContext) ic = getAISContext();
+  if ( !ic.IsNull() )
+  {
+    ic->CloseAllContexts( false );
+    if ( update )
+      ic->CurrentViewer()->Redraw();
+  }
 }
 
 //=======================================================================
@@ -574,7 +579,7 @@ bool SOCC_Viewer::getTrihedronSize( double& theNewSize, double& theSize )
   if ( aMaxSide < Ymax -Ymin ) aMaxSide = Ymax -Ymin;
   if ( aMaxSide < Zmax -Zmin ) aMaxSide = Zmax -Zmin;
 
-  float aSizeInPercents = SUIT_Session::session()->resourceMgr()->doubleValue("Viewer:TrihedronSize", 105.);
+  float aSizeInPercents = SUIT_Session::session()->resourceMgr()->doubleValue("Viewer","TrihedronSize", 105.);
 
   static float EPS = 5.0E-3;
   theSize = getTrihedron()->Size();
@@ -594,3 +599,13 @@ void SOCC_Viewer::Repaint()
   getViewer3d()->Update();
 }
 
+//=======================================================================
+// name    : createView
+// Purpose : create SOCC_ViewWindow
+//=======================================================================
+SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )
+{
+  SOCC_ViewWindow* view = new SOCC_ViewWindow(theDesktop, this);
+  initView( view );
+  return view;
+}