From 49bfe68c8cebecfba1da2c7a22e3eabaa4243340 Mon Sep 17 00:00:00 2001 From: adv Date: Fri, 24 Jan 2014 06:25:13 +0000 Subject: [PATCH] Calculation af altitude implemented. --- src/HYDROData/HYDROData_ObstacleAltitude.cxx | 22 ++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) 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; } -- 2.39.2