0030692: Data Exchange - introduce base framework RWMesh for importing mesh data...
[occt.git] / src / V3d / V3d_View.cxx
index 3f3edbb..b67123a 100644 (file)
@@ -189,7 +189,10 @@ void V3d_View::SetWindow (const Handle(Aspect_Window)&  theWindow,
   myView->SetWindow (theWindow, theContext);
   MyViewer->SetViewOn (this);
   SetRatio();
-  Redraw();
+  if (myImmediateUpdate)
+  {
+    Redraw();
+  }
 }
 
 //=============================================================================
@@ -312,24 +315,6 @@ void V3d_View::SetAutoZFitMode (const Standard_Boolean theIsOn,
   myAutoZFitIsOn = theIsOn;
 }
 
-// ========================================================================
-// function : AutoZFitMode
-// purpose  :
-// ========================================================================
-Standard_Boolean V3d_View::AutoZFitMode() const
-{
-  return myAutoZFitIsOn;
-}
-
-// ========================================================================
-// function : AutoZFitScaleFactor
-// purpose  :
-// ========================================================================
-Standard_Real V3d_View::AutoZFitScaleFactor() const
-{
-  return myAutoZFitScaleFactor;
-}
-
 //=============================================================================
 //function : AutoZFit
 //purpose  :
@@ -412,8 +397,10 @@ void V3d_View::MustBeResized()
   myView->Resized();
 
   SetRatio();
-
-  Redraw();
+  if (myImmediateUpdate)
+  {
+    Redraw();
+  }
 }
 
 //=============================================================================
@@ -1032,38 +1019,42 @@ void V3d_View::SetProj( const Standard_Real Vx,const Standard_Real Vy, const Sta
 //function : SetProj
 //purpose  :
 //=============================================================================
-void V3d_View::SetProj( const V3d_TypeOfOrientation Orientation )
+void V3d_View::SetProj (const V3d_TypeOfOrientation theOrientation,
+                        const Standard_Boolean theIsYup)
 {
-  Standard_Real Xpn=0;
-  Standard_Real Ypn=0;
-  Standard_Real Zpn=0;
-
-  switch (Orientation) {
-  case V3d_Zpos :
-    Ypn = 1.;
-    break;
-  case V3d_Zneg :
-    Ypn = -1.;
-    break;
-  default:
-    Zpn = 1.;
+  Graphic3d_Vec3d anUp = theIsYup ? Graphic3d_Vec3d (0.0, 1.0, 0.0) : Graphic3d_Vec3d (0.0, 0.0, 1.0);
+  if (theIsYup)
+  {
+    if (theOrientation == V3d_Ypos
+     || theOrientation == V3d_Yneg)
+    {
+      anUp.SetValues (0.0, 0.0, -1.0);
+    }
+  }
+  else
+  {
+    if (theOrientation == V3d_Zpos)
+    {
+      anUp.SetValues (0.0, 1.0, 0.0);
+    }
+    else if (theOrientation == V3d_Zneg)
+    {
+      anUp.SetValues (0.0, -1.0, 0.0);
+    }
   }
 
-  const gp_Dir aBck = V3d::GetProjAxis (Orientation);
+  const gp_Dir aBck = V3d::GetProjAxis (theOrientation);
 
   // retain camera panning from origin when switching projection
-  Handle(Graphic3d_Camera) aCamera = Camera();
-
-  gp_Pnt anOriginVCS  = aCamera->ConvertWorld2View (gp::Origin());
-  Standard_Real aPanX = anOriginVCS.X();
-  Standard_Real aPanY = anOriginVCS.Y();
+  const Handle(Graphic3d_Camera)& aCamera = Camera();
+  const gp_Pnt anOriginVCS = aCamera->ConvertWorld2View (gp::Origin());
 
   aCamera->SetCenter (gp_Pnt (0, 0, 0));
   aCamera->SetDirection (gp_Dir (aBck.X(), aBck.Y(), aBck.Z()).Reversed());
-  aCamera->SetUp (gp_Dir (Xpn, Ypn, Zpn));
+  aCamera->SetUp (gp_Dir (anUp.x(), anUp.y(), anUp.z()));
   aCamera->OrthogonalizeUp();
 
-  Panning (aPanX, aPanY);
+  Panning (anOriginVCS.X(), anOriginVCS.Y());
 
   AutoZFit();
 
@@ -1499,18 +1490,6 @@ void V3d_View::DepthFitAll(const Standard_Real Aspect,
     ImmediateUpdate();
 }
 
-//=============================================================================
-//function : WindowFitAll
-//purpose  :
-//=============================================================================
-void V3d_View::WindowFitAll(const Standard_Integer Xmin,
-                            const Standard_Integer Ymin,
-                            const Standard_Integer Xmax,
-                            const Standard_Integer Ymax)
-{
-  WindowFit(Xmin,Ymin,Xmax,Ymax);
-}
-
 //=======================================================================
 //function : WindowFit
 //purpose  :
@@ -2093,15 +2072,6 @@ void V3d_View::Eye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const
   Z = aCameraEye.Z();
 }
 
-//=============================================================================
-//function : FocalReferencePoint
-//purpose  :
-//=============================================================================
-void V3d_View::FocalReferencePoint(Standard_Real& X, Standard_Real& Y,Standard_Real& Z) const
-{
-  Eye (X,Y,Z);
-}
-
 //=============================================================================
 //function : ProjReferenceAxe
 //purpose  :
@@ -2240,15 +2210,6 @@ V3d_TypeOfVisualization V3d_View::Visualization() const
   return static_cast<V3d_TypeOfVisualization> (myView->VisualizationType());
 }
 
-//=============================================================================
-//function : Viewer
-//purpose  :
-//=============================================================================
-Handle(V3d_Viewer) V3d_View::Viewer() const
-{
-  return MyViewer;
-}
-
 //=============================================================================
 //function : IfWindow
 //purpose  :
@@ -2258,15 +2219,6 @@ Standard_Boolean V3d_View::IfWindow() const
   return myView->IsDefined();
 }
 
-//=============================================================================
-//function : Window
-//purpose  :
-//=============================================================================
-Handle(Aspect_Window) V3d_View::Window() const
-{
-  return MyWindow;
-}
-
 //=============================================================================
 //function : Type
 //purpose  :
@@ -2312,15 +2264,6 @@ Standard_Real V3d_View::Focale() const
   return aCamera->Distance() * 2.0 * Tan (aCamera->FOVy() * M_PI / 360.0);
 }
 
-//=============================================================================
-//function : View
-//purpose  :
-//=============================================================================
-Handle(Graphic3d_CView) V3d_View::View() const
-{
-  return myView;
-}
-
 //=============================================================================
 //function : screenAxis
 //purpose  :
@@ -3169,31 +3112,31 @@ void V3d_View::Translate (const Handle(Graphic3d_Camera)& theCamera,
 }
 
 // =======================================================================
-// function : IsCullingEnabled
+// function : DiagnosticInformation
 // purpose  :
 // =======================================================================
-Standard_Boolean V3d_View::IsCullingEnabled() const
+void V3d_View::DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict,
+                                      Graphic3d_DiagnosticInfo theFlags) const
 {
-  return myView->IsCullingEnabled();
+  myView->DiagnosticInformation (theDict, theFlags);
 }
 
-// =======================================================================
-// function : SetFrustumCulling
-// purpose  :
-// =======================================================================
-void V3d_View::SetFrustumCulling (const Standard_Boolean theToClip)
+//=======================================================================
+//function : StatisticInformation
+//purpose  :
+//=======================================================================
+void V3d_View::StatisticInformation (TColStd_IndexedDataMapOfStringString& theDict) const
 {
-  myView->SetCullingEnabled (theToClip);
+  myView->StatisticInformation (theDict);
 }
 
 // =======================================================================
-// function : DiagnosticInformation
+// function : StatisticInformation
 // purpose  :
 // =======================================================================
-void V3d_View::DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict,
-                                      Graphic3d_DiagnosticInfo theFlags) const
+TCollection_AsciiString V3d_View::StatisticInformation() const
 {
-  myView->DiagnosticInformation (theDict, theFlags);
+  return myView->StatisticInformation();
 }
 
 //=============================================================================