Salome HOME
Merge branch 'BR_LAND_COVER_MAP' into BR_quadtree
[modules/hydro.git] / src / HYDROData / HYDROData_StreamAltitude.cxx
index 60452989426cf7a635598b66210b67c6184f2ee6..96b33ad8cb62e0ad1fb8b67114081823b35191f1 100644 (file)
@@ -52,6 +52,9 @@
 
 #include <QStringList>
 
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 #ifdef DEB_CLASS2D
 #include <BRepTools.hxx>
 #include <BRep_Builder.hxx>
@@ -236,20 +239,29 @@ bool HYDROData_StreamAltitude::getBoundaryWiresForPoint(
 
 double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) const
 {
+  DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << ")");
   double aResAltitude = GetInvalidAltitude();
 
   Handle(HYDROData_Object) anObject =
     Handle(HYDROData_Object)::DownCast( GetFatherObject() );
   if ( anObject.IsNull() )
+  {
+    DEBTRACE("aStream.IsNull()");
     return aResAltitude;
-  
+  }
   TopoDS_Shape aTopShape = anObject->GetTopShape();
   if ( aTopShape.IsNull() )
+  {
+    DEBTRACE("aTopShape.IsNull()");
     return aResAltitude;
+  }
 
   TopExp_Explorer aFaceExp( aTopShape, TopAbs_FACE );
   if ( !aFaceExp.More() )
+  {
+    DEBTRACE("!aFaceExp.More()");
     return aResAltitude;
+  }
 
   // Get only face because of 2d profile wires is in compound
   TopoDS_Face aFace = TopoDS::Face( aFaceExp.Current() );
@@ -269,7 +281,10 @@ double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) co
          BRepTools::Write(aCmp, "FCL2d.brep");
 #endif
   if ( aPointState == TopAbs_OUT )
+  {
+       DEBTRACE("aPointState == TopAbs_OUT");
     return aResAltitude;
+  }
 
   TopoDS_Edge aLeftEdge, aRightEdge;
 
@@ -292,7 +307,10 @@ double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) co
   // Find the two profiles between which the point is lies
   TopoDS_Wire aLeftWire, aRightWire;
   if ( !getBoundaryWiresForPoint( thePoint, aLeftWire, aRightWire ) )
+  {
+      DEBTRACE("!getBoundaryProfilesForPoint( thePoint, aLeftProfile, aRightProfile )");
       return aResAltitude;
+  }
 
   // Find the projections of point to borders of stream
   gp_XYZ aPointToTest( thePoint.X(), thePoint.Y(), 0.0 );
@@ -348,7 +366,7 @@ double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) co
   Standard_Real aSecCoeff = aRightProfileDist / ( aLeftProfileDist + aRightProfileDist );
 
   aResAltitude = aLeftAlt * ( 1 - aFirstCoeff ) + aRightAlt * ( 1 - aSecCoeff );
-
+  DEBTRACE("aResAltitude=" << aResAltitude);
   return aResAltitude;
 }