0027860: Visualization - clean up Transformation Persistence API
[occt.git] / src / Graphic3d / Graphic3d_CView.cxx
index a3428f4..047d5bf 100644 (file)
@@ -290,7 +290,7 @@ void Graphic3d_CView::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
    && !theStruct->CStructure()->IsForHighlight
    && !theStruct->CStructure()->IsInfinite)
   {
-    const Standard_Integer aLayerId = theStruct->DisplayPriority();
+    const Graphic3d_ZLayerId aLayerId = theStruct->GetZLayer();
     InvalidateBVHData (aLayerId);
   }
 
@@ -432,7 +432,7 @@ void Graphic3d_CView::DisplayedStructures (Graphic3d_MapOfStructure& theStructur
 // function : MinMaxValues
 // purpose  :
 // =======================================================================
-Bnd_Box Graphic3d_CView::MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag) const
+Bnd_Box Graphic3d_CView::MinMaxValues (const Standard_Boolean theToIncludeAuxiliary) const
 {
   Bnd_Box aResult;
 
@@ -453,14 +453,18 @@ Bnd_Box Graphic3d_CView::MinMaxValues (const Standard_Boolean theToIgnoreInfinit
                                                  aCamera,
                                                  aWinWidth,
                                                  aWinHeight,
-                                                 theToIgnoreInfiniteFlag);
+                                                 theToIncludeAuxiliary);
     combineBox (aResult, aBox);
   }
 
   Standard_Integer aMaxZLayer = ZLayerMax();
   for (Standard_Integer aLayerId = Graphic3d_ZLayerId_Default; aLayerId <= aMaxZLayer; ++aLayerId)
   {
-    Graphic3d_BndBox4f aBox = ZLayerBoundingBox (aLayerId, aCamera, aWinWidth, aWinHeight, theToIgnoreInfiniteFlag);
+    Graphic3d_BndBox4f aBox = ZLayerBoundingBox (aLayerId,
+                                                 aCamera,
+                                                 aWinWidth,
+                                                 aWinHeight,
+                                                 theToIncludeAuxiliary);
     combineBox (aResult, aBox);
   }
 
@@ -487,12 +491,12 @@ Standard_Real Graphic3d_CView::ConsiderZoomPersistenceObjects()
   Standard_Real aMaxCoef = 1.0;
   for (Standard_Integer aLayer = 0; aLayer < THE_NB_DEFAULT_LAYERS; ++aLayer)
   {
-    aMaxCoef = Max (aMaxCoef, considerZoomPersistenceObjects (THE_DEFAULT_LAYERS[aLayer], aCamera, aWinWidth, aWinHeight, Standard_False));
+    aMaxCoef = Max (aMaxCoef, considerZoomPersistenceObjects (THE_DEFAULT_LAYERS[aLayer], aCamera, aWinWidth, aWinHeight));
   }
 
   for (Standard_Integer aLayer = Graphic3d_ZLayerId_Default; aLayer <= ZLayerMax(); ++aLayer)
   {
-    aMaxCoef = Max (aMaxCoef, considerZoomPersistenceObjects (aLayer, aCamera, aWinWidth, aWinHeight, Standard_False));
+    aMaxCoef = Max (aMaxCoef, considerZoomPersistenceObjects (aLayer, aCamera, aWinWidth, aWinHeight));
   }
 
   return aMaxCoef;
@@ -519,25 +523,19 @@ Bnd_Box Graphic3d_CView::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
   for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (theSet); aStructIter.More(); aStructIter.Next())
   {
     const Handle(Graphic3d_Structure)& aStructure = aStructIter.Key();
-    if (!aStructure->IsVisible() || aStructure->IsEmpty())
-    {
-      continue;
-    }
-    else if (!aStructure->CStructure()->ViewAffinity.IsNull()
-          && !aStructure->CStructure()->ViewAffinity->IsVisible (aViewId))
+    if (aStructure->IsEmpty()
+    || !aStructure->CStructure()->IsVisible (aViewId))
     {
       continue;
     }
 
     // "FitAll" operation ignores object with transform persistence parameter
-    if (aStructure->TransformPersistence().Flags != Graphic3d_TMF_None)
+    if (!aStructure->TransformPersistence().IsNull())
     {
       // Panning and 2d persistence apply changes to projection or/and its translation components.
       // It makes them incompatible with z-fitting algorithm. Ignored by now.
-      if (!theToIgnoreInfiniteFlag ||
-          (aStructure->TransformPersistence().Flags & Graphic3d_TMF_2d) ||
-          (aStructure->TransformPersistence().Flags & Graphic3d_TMF_PanPers) ||
-          (aStructure->TransformPersistence().Flags & Graphic3d_TMF_TriedronPers))
+      if (!theToIgnoreInfiniteFlag
+       || aStructure->TransformPersistence()->IsTrihedronOr2d())
       {
         continue;
       }
@@ -550,11 +548,11 @@ Bnd_Box Graphic3d_CView::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
       continue;
     }
 
-    if (aStructure->TransformPersistence().Flags != Graphic3d_TMF_None)
+    if (!aStructure->TransformPersistence().IsNull())
     {
       const Graphic3d_Mat4d& aProjectionMat = aCamera->ProjectionMatrix();
       const Graphic3d_Mat4d& aWorldViewMat  = aCamera->OrientationMatrix();
-      aStructure->TransformPersistence().Apply (aProjectionMat, aWorldViewMat, aWinWidth, aWinHeight, aBox);
+      aStructure->TransformPersistence()->Apply (aCamera, aProjectionMat, aWorldViewMat, aWinWidth, aWinHeight, aBox);
     }
 
     // To prevent float overflow at camera parameters calculation and further
@@ -1149,13 +1147,6 @@ void Graphic3d_CView::CopySettings (const Handle(Graphic3d_CView)& theOther)
   SetShadingModel          (theOther->ShadingModel());
   SetBackfacingModel       (theOther->BackfacingModel());
   SetCamera                (new Graphic3d_Camera (theOther->Camera()));
-  SetBackZClippingOn       (theOther->BackZClippingIsOn());
-  SetFrontZClippingOn      (theOther->FrontZClippingIsOn());
-  SetZClippingBackPlane    (theOther->ZClippingBackPlane());
-  SetZClippingFrontPlane   (theOther->ZClippingFrontPlane());
-  SetDepthCueingOn         (theOther->DepthCueingIsOn());
-  SetDepthCueingBackPlane  (theOther->DepthCueingBackPlane());
-  SetDepthCueingFrontPlane (theOther->DepthCueingFrontPlane());
   SetGLLightEnabled        (theOther->IsGLLightEnabled());
   SetLights                (theOther->Lights());
   SetClipPlanes            (theOther->ClipPlanes());