X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Stream.h;h=f44f2d2452e7d9302f2baf6df02c52077f16496c;hb=81c9f5cdf82909d0aebd2c491c50fa7516cc80b7;hp=ce9eb426555f1d6c6e3f7a704019d767fedc8cbe;hpb=34310fe4f26db0f23c2edfef1678e5b02f578204;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Stream.h b/src/HYDROData/HYDROData_Stream.h index ce9eb426..f44f2d24 100644 --- a/src/HYDROData/HYDROData_Stream.h +++ b/src/HYDROData/HYDROData_Stream.h @@ -4,10 +4,16 @@ #include "HYDROData_NaturalObject.h" +#include +#include + +#include + DEFINE_STANDARD_HANDLE(HYDROData_Stream, HYDROData_NaturalObject) class Handle(HYDROData_PolylineXY); class Handle(HYDROData_Profile); +class TColStd_Array1OfReal; /**\class HYDROData_Stream * \brief @@ -15,6 +21,18 @@ class Handle(HYDROData_Profile); */ class HYDROData_Stream : public HYDROData_NaturalObject { +public: + + struct PrsDefinition + { + TopoDS_Shape myPrs3D; + TopoDS_Shape myPrs2D; + TopoDS_Edge myLeftBank; + TopoDS_Edge myRightBank; + TopoDS_Edge myInlet; + TopoDS_Edge myOutlet; + }; + protected: /** * Enumeration of tags corresponding to the persistent object parameters. @@ -24,11 +42,24 @@ protected: DataTag_First = HYDROData_NaturalObject::DataTag_First + 100, ///< first tag, to reserve DataTag_HydraulicAxis, ///< reference hydraulic axis DataTag_Profile, ///< reference profiles + DataTag_ParamsArray ///< parameters array }; public: + DEFINE_STANDARD_RTTI(HYDROData_Stream); +public: + + /** + * Creates the presentations(2D and 3D) by given hydraulic axis and profiles. + */ + HYDRODATA_EXPORT static bool CreatePresentations( const Handle(HYDROData_PolylineXY)& theHydAxis, + const HYDROData_SequenceOfObjects& theProfiles, + PrsDefinition& thePrs ); + +public: + /** * Returns the kind of this object. Must be redefined in all objects of known type. */ @@ -55,15 +86,63 @@ public: HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const; /** - * Update the shape presentations of stream. + * Update the profiles order and shape presentations of stream. * Call this method whenever you made changes for stream data. */ HYDRODATA_EXPORT virtual void Update(); + /** + * Checks that object has 2D presentation. Reimlemented to retun true. + */ + HYDRODATA_EXPORT virtual bool IsHas2dPrs() const; + + /** + * Update the shape presentations of stream. + */ + HYDRODATA_EXPORT virtual void UpdatePrs(); + + /** + * Returns default filling color for new stream. + */ + HYDRODATA_EXPORT static QColor DefaultFillingColor(); + + /** + * Returns default border color for new stream. + */ + HYDRODATA_EXPORT static QColor DefaultBorderColor(); + + /** + * Returns true if given polyline can be used as stream axis. + */ + HYDRODATA_EXPORT static bool IsValidAsAxis( const Handle(HYDROData_PolylineXY)& theAxis ); public: - // Public methods to work with Stream + // Public methods to work with Stream presentation + /** + * Returns the left edge of the stream. + */ + HYDRODATA_EXPORT virtual TopoDS_Shape GetLeftShape() const; + + /** + * Returns the right edge of the stream. + */ + HYDRODATA_EXPORT virtual TopoDS_Shape GetRightShape() const; + + /** + * Returns the inlet edge of the stream. + */ + HYDRODATA_EXPORT virtual TopoDS_Shape GetInletShape() const; + + /** + * Returns the outlet edge of the stream. + */ + HYDRODATA_EXPORT virtual TopoDS_Shape GetOutletShape() const; + + +public: + // Public methods to work with Stream data fields + /** * Sets reference hydraulic axis object for stream. */ @@ -79,18 +158,42 @@ public: */ HYDRODATA_EXPORT virtual void RemoveHydraulicAxis(); + /** + * Returns true if profile has the intersection with the given hydraulic axis. + * Returns the parameter of inresection point on axis if axis is presented by one curve, + * if axis presented by set of edges the returns a common length of segments till the intersection point. + */ + HYDRODATA_EXPORT static bool HasIntersection( const Handle(HYDROData_PolylineXY)& theHydAxis, + const Handle(HYDROData_Profile)& theProfile, + const TopoDS_Face& thePlane, + Standard_Real& theOutPar ); /** * Returns true if profile has the intersection with reference hydraulic axis. + * Returns the parameter of inresection point on axis if axis is presented by one curve, + * if axis presented by set of edges the returns a common length of segments till the intersection point. */ - HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile ) const; + HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile, + const TopoDS_Face& thePlane, + Standard_Real& theOutPar ) const; + /** + * Builds a planar face + */ + HYDRODATA_EXPORT static bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, + TopoDS_Face& thePlane ); /** * Add new one reference profile object for stream. */ HYDRODATA_EXPORT virtual bool AddProfile( const Handle(HYDROData_Profile)& theProfile ); + /** + * Add new one reference profile object for stream. + */ + HYDRODATA_EXPORT virtual bool SetProfiles( const HYDROData_SequenceOfObjects& theProfiles, + const bool& theIsToOrder = true ); + /** * Returns all reference profile objects of stream. */ @@ -105,20 +208,54 @@ public: * Removes all reference profile objects from stream. */ HYDRODATA_EXPORT virtual void RemoveProfiles(); - - + protected: /** * Insert one profile in to the stream profiles order. */ - void insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile ); + void insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile, + const int theBeforeIndex = -1 ); /** * Fully recompute the order of all profiles in accordance with reference hydraulic axis. * If hydraulic axis is not set all profiles will be removed from order. */ void updateProfilesOrder(); + + /** + * Returns the type of child altitude object. + * Reimplemented to create stream altitude object. + */ + HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const; + + /** + * Builds b-spline using interpolation algorithm. + */ + static Handle(Geom_BSplineCurve) buildInterpolationCurve( + const Handle(TColgp_HArray1OfPnt)& theArrayOfPnt ); + + /** + * Returns default filling color for new object. + */ + HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const; + + /** + * Returns default border color for new object. + */ + HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const; + +private: + + void setParametersArray( const TColStd_Array1OfReal& theArray ); + + TColStd_Array1OfReal* getParametersArray() const; + + void removeParametersArray(); + + int insertParameter( const Standard_Real& theParam ); + + void removeParameter( const int& theIndex ); protected: @@ -137,3 +274,5 @@ protected: }; #endif + +