Salome HOME
tests 1 to 7 OK, 8 and above failed
[modules/hydro.git] / src / HYDROData / HYDROData_DTM.h
index 717a9ed588850a5c21719710444d86b466335110..4835cef14578d30dc088a1b6ebe8acdbfca3a4d6 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "HYDROData_Bathymetry.h"
 #include <vector>
+#include <set>
 #include <gp_Pnt2d.hxx>
 
 class Handle_HYDROData_Profile;
@@ -29,6 +30,11 @@ 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 )
 
@@ -47,6 +53,12 @@ protected:
     DataTag_Profiles,
     DataTag_DDZ,
     DataTag_SpatialStep,
+    DataTag_LeftBankShape,
+    DataTag_RightBankShape,
+    DataTag_InletShape,
+    DataTag_OutletShape,
+    DataTag_3DShape,
+    DataTag_2DShape
   };
 
 public:
@@ -73,31 +85,22 @@ public:
   class CurveUZ : public std::vector<PointUZ>
   {
   public:
-    CurveUZ( double theXcurv );
+    CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir = gp_Vec2d() );
     ~CurveUZ();
 
     double Xcurv() const;
+    gp_Vec2d ProfileDir() const; 
 
     CurveUZ operator + ( const CurveUZ& ) const;
     CurveUZ operator * ( double ) const;
 
   private:
     double myXcurv;
-  };
-  class Bank
-  {
-  public:
-    void reserve( int theNbPoints );
-    void push_back( const gp_Pnt& thePnt, const gp_Dir& theTangent );
-    void clear();
-    TopoDS_Edge createEdge( bool is3d ) const;
-
-  private:
-    std::vector<gp_Pnt> myPoints;
-    std::vector<gp_Dir> myDirs;
+    gp_Vec2d myProfileDir;
   };
 
 protected:
+  friend class HYDROData_Stream;
   friend class HYDROData_Iterator;
   friend class test_HYDROData_DTM;
 
@@ -109,7 +112,8 @@ protected:
     std::vector<double>& theDistances );
 
   static std::vector<Handle_Geom2d_Curve> ProfileToParametric( const Handle_HYDROData_Profile& theProfile,
-                                                               double& theUMin, double& theUMax );
+                                                               double& theUMin, double& theUMax,
+                                                               gp_Vec2d& theDir );
 
   static void GetProperties( const Handle_HYDROData_Profile& theProfile,
                              gp_Pnt& theLowestPoint, gp_Vec2d& theDir,
@@ -120,36 +124,84 @@ protected:
                                      double theXCurv, double theMinZ, double theMaxZ, double theDDZ,
                                      CurveUZ& theMidPointCurve,
                                      CurveUZ& theWidthCurve,
+                                     int& intersection_nb,
                                      double theTolerance = 1E-6 );
 
   static void CurveTo3D( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
                          const CurveUZ& theMidCurve, const CurveUZ& theWidthCurve,
-                         AltitudePoints& thePoints,
-                         Bank* theLeftBank = 0,
-                         Bank* theRightBank = 0,
-                         double dz = 0 );
+                         AltitudePoints& thePoints, double dz );
   
   static void Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCurveB, 
                            int theNbSteps, std::vector<CurveUZ>& theInterpolation,
                            bool isAddSecond );
 
-  static AltitudePoints Interpolate( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
-                                     const Handle_HYDROData_Profile& theProfileA,
-                                     double theXCurvA,
-                                     const Handle_HYDROData_Profile& theProfileB,
-                                     double theXCurvB,
-                                     double theDDZ, int theNbSteps, bool isAddSecond,
-                                     Bank* theLeftBank = 0,
-                                     Bank* theRightBank = 0 );
+  static std::vector<AltitudePoints> Interpolate
+    ( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
+      const Handle_HYDROData_Profile& theProfileA,
+      double theXCurvA,
+      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,
                                      double theDDZ, double theSpatialStep,
-                                     Bank* theLeftBank = 0,
-                                     Bank* theRightBank = 0 );
+                                     AltitudePoints& theLeft,
+                                     AltitudePoints& theRight,
+                                     std::vector<AltitudePoints>& theMainProfiles,
+                                     std::set<int>& invalInd );
+
+  static void PointToWire(const AltitudePoints& pnts, TopoDS_Wire& W );
+
+  static void ProjWireOnPlane(const TopoDS_Wire& inpWire, const Handle_Geom_Plane& RefPlane, TopoDS_Wire& outWire);
+
+  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,
+                             double theDDZ,
+                             double theSpatialStep,
+                             AltitudePoints& theOutLeft,
+                             AltitudePoints& theOutRight,
+                             AltitudePoints& theOutPoints,
+                             std::vector<AltitudePoints>& theOutMainProfiles,
+                             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 );
+
+  static void Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF );
+    
+  void GetPresentationShapes( TopoDS_Shape& Out3dPres,
+                              TopoDS_Shape& Out2dPres,
+                              TopoDS_Shape& OutLeftB,
+                              TopoDS_Shape& OutRightB,
+                              TopoDS_Shape& OutInlet,
+                              TopoDS_Shape& OutOutlet );
+public:
 
-private:
-  Bank myLeft;
-  Bank myRight;
+  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 );
 };
 
+
+
+
 #endif