Salome HOME
2194c861b2658c39e40a54f758237e10a2b9b1ad
[modules/hydro.git] / src / HYDROData / HYDROData_DTM.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROData_DTM_HeaderFile
20 #define HYDROData_DTM_HeaderFile
21
22 #include "HYDROData_Bathymetry.h"
23 #include <vector>
24
25 class Handle_HYDROData_Profile;
26 class Handle_Geom2d_BSplineCurve;
27 class Handle_Geom2d_Curve;
28
29 DEFINE_STANDARD_HANDLE( HYDROData_DTM, HYDROData_Bathymetry )
30
31 /**\class HYDROData_DTM
32  * \brief Class that represents the Digital Terrain Model
33  */
34 class HYDROData_DTM : public HYDROData_Bathymetry
35 {
36 protected:
37   /**
38    * Enumeration of tags corresponding to the persistent object parameters.
39    */
40   enum DataTag
41   {
42     DataTag_First = HYDROData_Bathymetry::DataTag_First + 100, ///< first tag, to reserve
43   };
44
45 public:
46   DEFINE_STANDARD_RTTI( HYDROData_DTM );
47
48 protected:
49   friend class HYDROData_Iterator;
50   friend class test_HYDROData_DTM;
51
52   HYDRODATA_EXPORT HYDROData_DTM();
53   virtual HYDRODATA_EXPORT ~HYDROData_DTM();
54
55   struct PointUZ
56   {
57     double U;
58     double Z;
59   };
60   class CurveUZ : public std::vector<PointUZ>
61   {
62   public:
63     CurveUZ( double theXcurv );
64     ~CurveUZ();
65
66     double Xcurv() const;
67
68     CurveUZ operator + ( const CurveUZ& ) const;
69     CurveUZ operator * ( double ) const;
70
71   private:
72     double myXcurv;
73   };
74
75   static Handle_Geom2d_BSplineCurve CreateHydraulicAxis( 
76     const std::vector<Handle_HYDROData_Profile>& theProfiles,
77     std::vector<double>& theDistances );
78
79   static std::vector<Handle_Geom2d_Curve> ProfileToParametric( const Handle_HYDROData_Profile& theProfile,
80                                                                double& theUMin, double& theUMax );
81
82   static void ProfileDiscretization( const Handle_HYDROData_Profile& theProfile,
83                                      double theXCurv, double theMinZ, double theMaxZ, double theDDZ,
84                                      CurveUZ& theMidPointCurve,
85                                      CurveUZ& theWidthCurve,
86                                      double theTolerance = 1E-6 );
87
88   static void CurveTo3d( const CurveUZ& theMidCurve, const CurveUZ& theWidthCurve,
89                          AltitudePoints& thePoints );
90   
91   static void Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCurveB, 
92                            int theNbSteps, std::vector<CurveUZ>& theInterpolation,
93                            bool isAddSecond );
94
95   static void Interpolate( const Handle_HYDROData_Profile& theProfileA,
96                            double theXCurvA,
97                            const Handle_HYDROData_Profile& theProfileB,
98                            double theXCurvB,
99                            double theDDZ, int theNbSteps, bool isAddSecond,
100                            AltitudePoints& thePoints );
101
102   static void Interpolate( const std::vector<Handle_HYDROData_Profile>& theProfiles,
103                            double theDDZ, double theSpatialStep, AltitudePoints& thePoints );
104 };
105
106 #endif