X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_ObstacleAltitude.cxx;h=4d0679aaf6c47cd8b1f9dbefdb9cf79966c30d90;hb=81c9f5cdf82909d0aebd2c491c50fa7516cc80b7;hp=c54a820f58ba439ea87739a183a93744b5d74334;hpb=15327a2433ee39a181928d06a2acb5104bfbc979;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_ObstacleAltitude.cxx b/src/HYDROData/HYDROData_ObstacleAltitude.cxx index c54a820f..4d0679aa 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,7 +25,20 @@ 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; + + HYDROData_Make3dMesh aMesher3D( anObjectShape3D, Precision::Intersection() ); + + gp_Pnt aHighestPoint; + if ( aMesher3D.GetHighestOriginal( thePoint.X(), thePoint.Y(), aHighestPoint ) ) + aResAltitude = aHighestPoint.Z(); return aResAltitude; }