Salome HOME
Merge remote-tracking branch 'origin/pre/IMPS_2016' into BR_HYDRO_IMPS_2016
[modules/hydro.git] / src / HYDROData / HYDROData_DTM.h
index 18280a394c5f8ff51eadcecf310eaaab3b20e7b5..0e4f746cf1286e297860640b9eae08a1fab8f326 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,13 @@ 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;
+class TopTools_DataMapOfShapeListOfShape;
+class TopTools_SequenceOfShape;
 
 DEFINE_STANDARD_HANDLE( HYDROData_DTM, HYDROData_Bathymetry )
 
@@ -47,6 +55,12 @@ protected:
     DataTag_Profiles,
     DataTag_DDZ,
     DataTag_SpatialStep,
+    DataTag_LeftBankShape,
+    DataTag_RightBankShape,
+    DataTag_InletShape,
+    DataTag_OutletShape,
+    DataTag_3DShape,
+    DataTag_2DShape
   };
 
 public:
@@ -73,11 +87,12 @@ 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 );
     ~CurveUZ();
 
     double Xcurv() const;
-    gp_Vec2d ProfileDir() const; 
+    gp_Vec2d ProfileDir() const;
+    double DeltaZ() const;
 
     CurveUZ operator + ( const CurveUZ& ) const;
     CurveUZ operator * ( double ) const;
@@ -85,9 +100,11 @@ public:
   private:
     double myXcurv;
     gp_Vec2d myProfileDir;
+    double myDeltaZ;
   };
 
 protected:
+  friend class HYDROData_Stream;
   friend class HYDROData_Iterator;
   friend class test_HYDROData_DTM;
 
@@ -111,11 +128,12 @@ 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, double dz );
+                         AltitudePoints& thePoints );
   
   static void Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCurveB, 
                            int theNbSteps, std::vector<CurveUZ>& theInterpolation,
@@ -127,13 +145,75 @@ protected:
       double theXCurvA,
       const Handle_HYDROData_Profile& theProfileB,
       double theXCurvB,
-      double theDDZ, int theNbSteps, bool isAddSecond );
+      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,
                                      AltitudePoints& theLeft,
                                      AltitudePoints& theRight,
-                                     std::vector<AltitudePoints>& theMainProfiles );
+                                     std::vector<AltitudePoints>& theMainProfiles,
+                                     std::set<int>& invalInd );
+
+  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 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,
+                             bool& WireIntersections);
+
+  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 );
+
+  void GetPresentationShapes( TopoDS_Shape& Out3dPres,
+                              TopoDS_Shape& Out2dPres,
+                              TopoDS_Shape& OutLeftB,
+                              TopoDS_Shape& OutRightB,
+                              TopoDS_Shape& OutInlet,
+                              TopoDS_Shape& OutOutlet );
+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,
+                                                       int thePntsLimit,
+                                                       bool& WireIntersections);
 };
 
+
+
+
 #endif