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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROData_DTM_HeaderFile
20 #define HYDROData_DTM_HeaderFile
22 #include "HYDROData_Bathymetry.h"
24 #include <gp_Pnt2d.hxx>
26 class Handle_HYDROData_Profile;
27 class Handle_Geom2d_BSplineCurve;
28 class Handle_Geom2d_Curve;
33 DEFINE_STANDARD_HANDLE( HYDROData_DTM, HYDROData_Bathymetry )
35 /**\class HYDROData_DTM
36 * \brief Class that represents the Digital Terrain Model
38 class HYDROData_DTM : public HYDROData_Bathymetry
42 * Enumeration of tags corresponding to the persistent object parameters.
46 DataTag_First = HYDROData_Bathymetry::DataTag_First + 100, ///< first tag, to reserve
53 DEFINE_STANDARD_RTTI( HYDROData_DTM );
55 HYDRODATA_EXPORT HYDROData_SequenceOfObjects GetProfiles() const;
56 HYDRODATA_EXPORT void SetProfiles( const HYDROData_SequenceOfObjects& );
58 HYDRODATA_EXPORT double GetDDZ() const;
59 HYDRODATA_EXPORT void SetDDZ( double );
61 HYDRODATA_EXPORT double GetSpatialStep() const;
62 HYDRODATA_EXPORT void SetSpatialStep( double );
64 HYDRODATA_EXPORT virtual void Update();
66 HYDRODATA_EXPORT void CreateBankShapes( TopoDS_Edge& theLeft, TopoDS_Edge& theRight ) const;
71 PointUZ( double u=0, double z=0 ) { U=u; Z=z; }
75 class CurveUZ : public std::vector<PointUZ>
78 CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir = gp_Vec2d() );
82 gp_Vec2d ProfileDir() const;
84 CurveUZ operator + ( const CurveUZ& ) const;
85 CurveUZ operator * ( double ) const;
89 gp_Vec2d myProfileDir;
94 void reserve( int theNbPoints );
95 void push_back( const gp_Pnt& thePnt, const gp_Dir& theTangent );
97 TopoDS_Edge createEdge3d() const;
100 std::vector<gp_Pnt> myPoints;
101 std::vector<gp_Dir> myDirs;
105 friend class HYDROData_Iterator;
106 friend class test_HYDROData_DTM;
108 HYDRODATA_EXPORT HYDROData_DTM();
109 virtual HYDRODATA_EXPORT ~HYDROData_DTM();
111 static Handle_Geom2d_BSplineCurve CreateHydraulicAxis(
112 const std::vector<Handle_HYDROData_Profile>& theProfiles,
113 std::vector<double>& theDistances );
115 static std::vector<Handle_Geom2d_Curve> ProfileToParametric( const Handle_HYDROData_Profile& theProfile,
116 double& theUMin, double& theUMax,
119 static void GetProperties( const Handle_HYDROData_Profile& theProfile,
120 gp_Pnt& theLowestPoint, gp_Vec2d& theDir,
122 double& theZMin, double& theZMax );
124 static void ProfileDiscretization( const Handle_HYDROData_Profile& theProfile,
125 double theXCurv, double theMinZ, double theMaxZ, double theDDZ,
126 CurveUZ& theMidPointCurve,
127 CurveUZ& theWidthCurve,
128 double theTolerance = 1E-6 );
130 static void CurveTo3D( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
131 const CurveUZ& theMidCurve, const CurveUZ& theWidthCurve,
132 AltitudePoints& thePoints,
133 Bank* theLeftBank = 0,
134 Bank* theRightBank = 0,
137 static void Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCurveB,
138 int theNbSteps, std::vector<CurveUZ>& theInterpolation,
141 static AltitudePoints Interpolate( const Handle_Geom2d_BSplineCurve& theHydraulicAxis,
142 const Handle_HYDROData_Profile& theProfileA,
144 const Handle_HYDROData_Profile& theProfileB,
146 double theDDZ, int theNbSteps, bool isAddSecond,
147 Bank* theLeftBank = 0,
148 Bank* theRightBank = 0 );
150 static AltitudePoints Interpolate( const std::vector<Handle_HYDROData_Profile>& theProfiles,
151 double theDDZ, double theSpatialStep,
152 Bank* theLeftBank = 0,
153 Bank* theRightBank = 0 );