]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Calculation af altitude implemented.
authoradv <adv@opencascade.com>
Fri, 24 Jan 2014 06:25:13 +0000 (06:25 +0000)
committeradv <adv@opencascade.com>
Fri, 24 Jan 2014 06:25:13 +0000 (06:25 +0000)
src/HYDROData/HYDROData_ObstacleAltitude.cxx

index c54a820f58ba439ea87739a183a93744b5d74334..0c300146196f86a2839d6104966a3af6469e7d80 100644 (file)
@@ -1,8 +1,13 @@
 
 #include "HYDROData_ObstacleAltitude.h"
+
 #include "HYDROData_Document.h"
+#include "HYDROData_Object.h"
+#include "HYDROData_Projection.h"
+
+#include <Precision.hxx>
 
-#include <QStringList>
+#include <TopoDS_Shape.hxx>
 
 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;
 }