X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_DTM.h;h=4835cef14578d30dc088a1b6ebe8acdbfca3a4d6;hb=89c7928d864f9be4f35aaa7409896c264849f273;hp=a91357edce2107f30962c335f899839ac64120fc;hpb=abdcba0f2ee048bf3c1f6073ef7fea4f0b200dcb;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_DTM.h b/src/HYDROData/HYDROData_DTM.h index a91357ed..4835cef1 100644 --- a/src/HYDROData/HYDROData_DTM.h +++ b/src/HYDROData/HYDROData_DTM.h @@ -21,10 +21,20 @@ #include "HYDROData_Bathymetry.h" #include +#include +#include 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 ) @@ -40,47 +50,158 @@ protected: enum DataTag { DataTag_First = HYDROData_Bathymetry::DataTag_First + 100, ///< first tag, to reserve + DataTag_Profiles, + DataTag_DDZ, + DataTag_SpatialStep, + DataTag_LeftBankShape, + DataTag_RightBankShape, + DataTag_InletShape, + DataTag_OutletShape, + DataTag_3DShape, + DataTag_2DShape }; public: DEFINE_STANDARD_RTTI( HYDROData_DTM ); -protected: - friend class HYDROData_Iterator; - friend class test_HYDROData_DTM; + HYDRODATA_EXPORT HYDROData_SequenceOfObjects GetProfiles() const; + HYDRODATA_EXPORT void SetProfiles( const HYDROData_SequenceOfObjects& ); - HYDRODATA_EXPORT HYDROData_DTM(); - virtual HYDRODATA_EXPORT ~HYDROData_DTM(); + HYDRODATA_EXPORT double GetDDZ() const; + HYDRODATA_EXPORT void SetDDZ( double ); + + HYDRODATA_EXPORT double GetSpatialStep() const; + HYDRODATA_EXPORT void SetSpatialStep( double ); + HYDRODATA_EXPORT virtual void Update(); + +public: struct PointUZ { + PointUZ( double u=0, double z=0 ) { U=u; Z=z; } double U; double Z; }; class CurveUZ : public std::vector { 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 Xcurv; + double myXcurv; + gp_Vec2d myProfileDir; }; - static Handle_Geom2d_BSplineCurve CreateHydraulicAxis( const std::vector& theProfiles ); +protected: + friend class HYDROData_Stream; + friend class HYDROData_Iterator; + friend class test_HYDROData_DTM; + + HYDRODATA_EXPORT HYDROData_DTM(); + virtual HYDRODATA_EXPORT ~HYDROData_DTM(); - static std::vector ProfileToParametric( const Handle_HYDROData_Profile& theProfile ); + static Handle_Geom2d_BSplineCurve CreateHydraulicAxis( + const std::vector& theProfiles, + std::vector& theDistances ); - static void ProfileDiscretization( const Handle_HYDROData_Profile& theProfile, - double theMinZ, double theMaxZ, double theDDZ, - CurveUZ& theMidPointCurve, - CurveUZ& theWidthCurve ); + static std::vector ProfileToParametric( const Handle_HYDROData_Profile& theProfile, + double& theUMin, double& theUMax, + gp_Vec2d& theDir ); + + 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, + 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 ); + static void Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCurveB, - int theNbSteps, std::vector& theInterpolation ); + int theNbSteps, std::vector& theInterpolation, + bool isAddSecond ); + + static std::vector 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& theProfiles, + double theDDZ, double theSpatialStep, + AltitudePoints& theLeft, + AltitudePoints& theRight, + std::vector& theMainProfiles, + std::set& 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& main_profiles); + + static void CreateProfiles(const std::vector& theProfiles, + double theDDZ, + double theSpatialStep, + AltitudePoints& theOutLeft, + AltitudePoints& theOutRight, + AltitudePoints& theOutPoints, + std::vector& 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& 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: - static void CurveTo3d( const CurveUZ& theCurve, const CurveUZ& theCurveB, - int theNbSteps, std::vector& theInterpolation ); + 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& InvInd ); }; + + + #endif