-bool HYDROData_ProfileUZ::join( const int theISectionTo,
- const int theISectionFrom )
-{
- return false;
+ int aNbPoints = thePoints.Size();
+ if ( aNbPoints < 2 )
+ return aResDepth;
+
+ double aCompDist = 0.0;
+ HYDROData_IPolyline::Point aPrevPoint = thePoints.First();
+ for ( int i = 2; i <= aNbPoints; ++i )
+ {
+ const Point& aCurPoint = thePoints.Value( i );
+
+ double aPntDist = gp_Pnt2d( aPrevPoint.X(), 0 ).Distance( gp_Pnt2d( aCurPoint.X(), 0 ) );
+
+ aCompDist += aPntDist;
+
+ if ( theDistance < aCompDist )
+ {
+ double aComPntDist = gp_Pnt2d( thePoints.First().X(), 0 ).Distance( gp_Pnt2d( aPrevPoint.X(), 0 ) );
+
+ double aFindDist = theDistance - aComPntDist;
+ double aRatio = aFindDist / ( aPntDist - aFindDist );
+
+ aResDepth = ( aPrevPoint.Y() + aRatio * aCurPoint.Y() ) / ( 1 + aRatio );
+ break;
+ }
+
+ aPrevPoint = aCurPoint;
+ }
+
+ return aResDepth;