]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
debug assymetric profile for embankment
authorPaul RASCLE <paul.rascle@edf.fr>
Mon, 7 Jan 2019 16:01:13 +0000 (17:01 +0100)
committerPaul RASCLE <paul.rascle@edf.fr>
Mon, 7 Jan 2019 16:01:13 +0000 (17:01 +0100)
src/HYDROData/HYDROData_ChannelAltitude.cxx

index 3714ac6d7eb6b2ceb7f6b6593b612e81cfa6ddbb..d3c0008ee321a7e5d799a34783767989797bf31d 100644 (file)
@@ -27,7 +27,7 @@
 #include "HYDROData_ProfileUZ.h"
 #include "HYDROData_Profile.h"
 
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 #include <QString>
 
@@ -259,7 +259,7 @@ double HYDROData_ChannelAltitude::GetAltitudeForPoint( const gp_XY& thePoint,
               return aResAltitude;
             }
           double aDepth = HYDROData_ProfileUZ::GetDepthFromDistance( aProfilePoints, aParam );
-          //DEBTRACE("profile altitude: " << aDepth);
+          DEBTRACE("profile altitude: " << aDepth);
 
           // Compute edge index.
           TopExp_Explorer anExp(aShape, TopAbs_EDGE);
@@ -274,11 +274,10 @@ double HYDROData_ChannelAltitude::GetAltitudeForPoint( const gp_XY& thePoint,
 
           // get the XY distance from point to guideline
           const gp_Pnt &aPntProj = aDistShSh.PointOnShape2(i);
-          //DEBTRACE("projection: (" << aPntProj.X() << ", " << aPntProj.Y() << ", " << aPntProj.Z() << ")");
+          DEBTRACE("projection: (" << aPntProj.X() << ", " << aPntProj.Y() << ", " << aPntProj.Z() << ")");
           gp_XY aProjXY = gp_XY(aPntProj.X(), aPntProj.Y());
           aProjXY.Subtract(thePoint);
           double distance = aProjXY.Modulus();
-          //DEBTRACE("distance to guideline " << distance);
 
           gp_Vec2d aProjDir = aProjXY; 
           gp_Vec2d aProfileDir(LP, RP);
@@ -287,17 +286,19 @@ double HYDROData_ChannelAltitude::GetAltitudeForPoint( const gp_XY& thePoint,
             aSign = -1.0;
 
           distance *= aSign;
-
+          DEBTRACE("distance to guideline " << distance);
+          
           // get delta altitude on section (supposed symmetric) from guideline distance (aParam)
           double delta = 0;
           int i1 = 0;
+          int i2 = 0;
           gp_XY pt1 = gp_XY();
           gp_XY pt2 = gp_XY();
           HYDROData_ProfileUZ::PointsList aSectionPoints = aProfile->GetParametricPoints();
           for ( int i = 1, aNbPoints = aSectionPoints.Size(); i <= aNbPoints; ++i )
             {
               const HYDROData_IPolyline::Point& aPolylinePoint = aSectionPoints.Value( i );
-              //DEBTRACE("  profile point: " << aPolylinePoint.X() << " " << aPolylinePoint.Y());
+              DEBTRACE(" i, size, profile point: " << i <<  " " << aSectionPoints.Size() << " " << aPolylinePoint.X() << " " << aPolylinePoint.Y());
               if (aPolylinePoint.X() < distance)
                 {
                   i1 = i;
@@ -305,17 +306,24 @@ double HYDROData_ChannelAltitude::GetAltitudeForPoint( const gp_XY& thePoint,
                 }
               if (aPolylinePoint.X() >= distance)
                 {
+                  i2 = i;
                   pt2 = aPolylinePoint;
                   break;
                 }
             }
-          if ((i1 == 0) && (distance > 0))
+          if ((i1 == 0) && (i2 == 0))
             {
-              DEBTRACE("Projection aborted : non centered profile");
+              DEBTRACE("Projection aborted: non centered profile");
               return aResAltitude;
             }
-          if (i1 == aProfilePoints.Size()) // distance >= profile width
+          else if (i1 == 0)  // distance <  - profile width
+            {
+              DEBTRACE("distance < - profile width");
+              delta = pt2.Y();
+            }
+          else if (i1 == aSectionPoints.Size()) // distance >= profile width
             {
+              DEBTRACE("distance >= profile width");
               delta = pt1.Y();
             }
           else