Salome HOME
change version number
[modules/hydro.git] / src / HYDROData / HYDROData_DTM.h
index 0dc1a89191f7627b285e4272a43f9278a84de0f4..59d3cd6811e8a7f60c67620e63f6512661e8cc50 100644 (file)
 #define HYDROData_DTM_HeaderFile
 
 #include "HYDROData_Bathymetry.h"
+#include "HYDROData_Profile.h"
+
+#include <gp_Pnt2d.hxx>
+
+#include<Geom2d_BSplineCurve.hxx>
+#include<Geom2d_Curve.hxx>
+#include<Geom_Plane.hxx>
+
+#include <TopTools_DataMapOfShapeListOfShape.hxx>
+#include <TopTools_IndexedMapOfOrientedShape.hxx>
+#include <TopTools_SequenceOfShape.hxx>
+
 #include <vector>
 #include <set>
-#include <gp_Pnt2d.hxx>
 
-class Handle_HYDROData_Profile;
-class Handle_Geom2d_BSplineCurve;
-class Handle_Geom2d_Curve;
 class gp_Pnt;
 class gp_Vec2d;
 class TopoDS_Edge;
 class TopoDS_Wire;
 class TopoDS_Face;
 class TopoDS_Compound;
-class Handle_Geom_Plane;
-class TopTools_IndexedMapOfOrientedShape;
 
-DEFINE_STANDARD_HANDLE( HYDROData_DTM, HYDROData_Bathymetry )
 
 /**\class HYDROData_DTM
  * \brief Class that represents the Digital Terrain Model
@@ -62,7 +67,7 @@ protected:
   };
 
 public:
-  DEFINE_STANDARD_RTTI( HYDROData_DTM );
+  DEFINE_STANDARD_RTTIEXT( HYDROData_DTM, HYDROData_Bathymetry );
 
   HYDRODATA_EXPORT HYDROData_SequenceOfObjects GetProfiles() const;
   HYDRODATA_EXPORT void SetProfiles( const HYDROData_SequenceOfObjects& );
@@ -85,11 +90,13 @@ public:
   class CurveUZ : public std::vector<PointUZ>
   {
   public:
-    CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir = gp_Vec2d() );
+    CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir, double theDeltaZ, double theMaxZ );
     ~CurveUZ();
 
     double Xcurv() const;
-    gp_Vec2d ProfileDir() const; 
+    gp_Vec2d ProfileDir() const;
+    double DeltaZ() const;
+    double MaxZ() const;
 
     CurveUZ operator + ( const CurveUZ& ) const;
     CurveUZ operator * ( double ) const;
@@ -97,6 +104,8 @@ public:
   private:
     double myXcurv;
     gp_Vec2d myProfileDir;
+    double myDeltaZ;
+    double myMaxZ;
   };
 
 protected:
@@ -107,59 +116,64 @@ protected:
   HYDRODATA_EXPORT HYDROData_DTM();
   virtual HYDRODATA_EXPORT ~HYDROData_DTM();
 
-  static Handle_Geom2d_BSplineCurve CreateHydraulicAxis( 
-    const std::vector<Handle_HYDROData_Profile>& theProfiles,
+  static Handle(Geom2d_BSplineCurve) CreateHydraulicAxis( 
+    const std::vector<Handle(HYDROData_Profile)>& theProfiles,
     std::vector<double>& theDistances );
 
-  static std::vector<Handle_Geom2d_Curve> ProfileToParametric( const Handle_HYDROData_Profile& theProfile,
-                                                               double& theUMin, double& theUMax,
-                                                               gp_Vec2d& theDir );
+  static std::vector<Handle(Geom2d_Curve)> ProfileToParametric( const Handle(HYDROData_Profile)& theProfile,
+                                                                double& theUMin, double& theUMax,
+                                                                gp_Vec2d& theDir );
 
-  static void GetProperties( const Handle_HYDROData_Profile& theProfile,
+  static void GetProperties( const Handle(HYDROData_Profile)& theProfile,
                              gp_Pnt& theLowestPoint, gp_Vec2d& theDir,
-                             bool isNormalDir,
                              double& theZMin, double& theZMax );
 
-  static void ProfileDiscretization( const Handle_HYDROData_Profile& theProfile,
-                                     double theXCurv, double theMinZ, double theMaxZ, double theDDZ,
+  static void ProfileDiscretization( const Handle(HYDROData_Profile)& theProfile,
+                                     double theXCurv, double theMinZ, double theMaxZ, double theTopZ, double theDDZ,
                                      CurveUZ& theMidPointCurve,
                                      CurveUZ& theWidthCurve,
                                      int& intersection_nb,
                                      double theTolerance = 1E-6 );
 
-  static void CurveTo3D( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
+  static void CurveTo3D( const Handle(Geom2d_BSplineCurve)& theHydraulicAxis,
                          const CurveUZ& theMidCurve, const CurveUZ& theWidthCurve,
-                         AltitudePoints& thePoints, double dz );
+                         AltitudePoints& thePoints );
   
   static void Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCurveB, 
                            int theNbSteps, std::vector<CurveUZ>& theInterpolation,
                            bool isAddSecond );
 
   static std::vector<AltitudePoints> Interpolate
-    ( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
-      const Handle_HYDROData_Profile& theProfileA,
+    ( const Handle(Geom2d_BSplineCurve)& theHydraulicAxis,
+      const Handle(HYDROData_Profile)& theProfileA,
       double theXCurvA,
-      const Handle_HYDROData_Profile& theProfileB,
+      const Handle(HYDROData_Profile)& theProfileB,
       double theXCurvB,
       double theDDZ, int theNbSteps, bool isAddSecond,
       int& inter_nb_1, int& inter_nb_2 );
 
-  static AltitudePoints Interpolate( const std::vector<Handle_HYDROData_Profile>& theProfiles,
+  static AltitudePoints Interpolate( const std::vector<Handle(HYDROData_Profile)>& theProfiles,
                                      double theDDZ, double theSpatialStep,
                                      AltitudePoints& theLeft,
                                      AltitudePoints& theRight,
                                      std::vector<AltitudePoints>& theMainProfiles,
-                                     std::set<int> invalInd );
+                                     std::set<int>& invalInd );
+
+  static void PointsToWire(const AltitudePoints& pnts, TopoDS_Wire& W );
+
+  static void PointsToEdge(const AltitudePoints& pnts, TopoDS_Edge& E );
 
-  static void PointToWire(const AltitudePoints& pnts, TopoDS_Wire& W );
+  //static void ProjWireOnPlane(const TopoDS_Shape& inpWire, const Handle_Geom_Plane& RefPlane,
+    //TopTools_DataMapOfShapeListOfShape* E2PE);
 
-  static void ProjWireOnPlane(const TopoDS_Wire& inpWire, const Handle_Geom_Plane& RefPlane, TopoDS_Wire& outWire);
+  static bool GetPlanarFaceFromBanks(const TopoDS_Edge& LB, const TopoDS_Edge& RB, TopoDS_Face& outF,
+    TopTools_SequenceOfShape* Boundr);
 
   static TopTools_IndexedMapOfOrientedShape Create3DShape(const AltitudePoints& left,
                                                           const AltitudePoints& right,
                                                           const std::vector<AltitudePoints>& main_profiles);
 
-  static void CreateProfiles(const std::vector<Handle_HYDROData_Profile>& theProfiles,
+  static void CreateProfiles(const std::vector<Handle(HYDROData_Profile)>& theProfiles,
                              double theDDZ,
                              double theSpatialStep,
                              AltitudePoints& theOutLeft,
@@ -174,10 +188,15 @@ protected:
                              TopoDS_Shape& OutOutlet,
                              bool Create3dPres,
                              bool Create2dPres,
-                             std::set<int> InvInd );
+                             std::set<int>& InvInd,
+                             bool& ProjStat);
+
+  //static bool Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF, 
+    //TopTools_SequenceOfShape* Boundr = NULL, std::set<int> ind = std::set<int>() );
+  
+  static int EstimateNbPoints( const std::vector<Handle(HYDROData_Profile)>& theProfiles,
+                               double theDDZ, double theSpatialStep );
 
-  static void Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF );
-    
   void GetPresentationShapes( TopoDS_Shape& Out3dPres,
                               TopoDS_Shape& Out2dPres,
                               TopoDS_Shape& OutLeftB,
@@ -187,18 +206,20 @@ protected:
 public:
 
   HYDRODATA_EXPORT static void CreateProfilesFromDTM ( const HYDROData_SequenceOfObjects& InpProfiles,
-                                      double ddz,
-                                      double step, 
-                                      AltitudePoints& points,
-                                      TopoDS_Shape& Out3dPres,
-                                      TopoDS_Shape& Out2dPres,
-                                      TopoDS_Shape& OutLeftB,
-                                      TopoDS_Shape& OutRightB,
-                                      TopoDS_Shape& OutInlet,
-                                      TopoDS_Shape& OutOutlet,
-                                      bool Create3dPres,
-                                      bool Create2dPres,
-                                      std::set<int> InvInd );
+                                                       double ddz,
+                                                       double step, 
+                                                       AltitudePoints& points,
+                                                       TopoDS_Shape& Out3dPres,
+                                                       TopoDS_Shape& Out2dPres,
+                                                       TopoDS_Shape& OutLeftB,
+                                                       TopoDS_Shape& OutRightB,
+                                                       TopoDS_Shape& OutInlet,
+                                                       TopoDS_Shape& OutOutlet,
+                                                       bool Create3dPres,
+                                                       bool Create2dPres,
+                                                       std::set<int>& InvInd,
+                                                       int thePntsLimit,
+                                                       bool& WireIntersections);
 };