From: adv Date: Fri, 24 Jan 2014 06:25:13 +0000 (+0000) Subject: Calculation af altitude implemented. X-Git-Tag: BR_hydro_v_1_0~51 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=49bfe68c8cebecfba1da2c7a22e3eabaa4243340;p=modules%2Fhydro.git Calculation af altitude implemented. --- diff --git a/src/HYDROData/HYDROData_ObstacleAltitude.cxx b/src/HYDROData/HYDROData_ObstacleAltitude.cxx index c54a820f..0c300146 100644 --- a/src/HYDROData/HYDROData_ObstacleAltitude.cxx +++ b/src/HYDROData/HYDROData_ObstacleAltitude.cxx @@ -1,8 +1,13 @@ #include "HYDROData_ObstacleAltitude.h" + #include "HYDROData_Document.h" +#include "HYDROData_Object.h" +#include "HYDROData_Projection.h" + +#include -#include +#include IMPLEMENT_STANDARD_HANDLE(HYDROData_ObstacleAltitude, HYDROData_IAltitudeObject) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ObstacleAltitude, HYDROData_IAltitudeObject) @@ -20,8 +25,21 @@ double HYDROData_ObstacleAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) { double aResAltitude = GetInvalidAltitude(); - // TODO + Handle(HYDROData_Object) anObject = + Handle(HYDROData_Object)::DownCast( GetFatherObject() ); + if ( anObject.IsNull() ) + return aResAltitude; + + TopoDS_Shape anObjectShape3D = anObject->GetShape3D(); + if ( anObjectShape3D.IsNull() ) + return aResAltitude; + + gp_Pnt aHighestPoint; + + HYDROData_Make3dMesh aMesher3D( anObjectShape3D, Precision::Intersection() ); + aMesher3D.GetHighestOriginal( thePoint.X(), thePoint.Y(), aHighestPoint ); + aResAltitude = aHighestPoint.Z(); return aResAltitude; }