2 #ifndef HYDROData_Stream_HeaderFile
3 #define HYDROData_Stream_HeaderFile
5 #include "HYDROData_NaturalObject.h"
6 #include <TopoDS_Face.hxx>
7 #include <Geom_BSplineCurve.hxx>
8 DEFINE_STANDARD_HANDLE(HYDROData_Stream, HYDROData_NaturalObject)
10 class Handle(HYDROData_PolylineXY);
11 class Handle(HYDROData_Profile);
12 class TColStd_Array1OfReal;
14 /**\class HYDROData_Stream
18 class HYDROData_Stream : public HYDROData_NaturalObject
22 * Enumeration of tags corresponding to the persistent object parameters.
26 DataTag_First = HYDROData_NaturalObject::DataTag_First + 100, ///< first tag, to reserve
27 DataTag_HydraulicAxis, ///< reference hydraulic axis
28 DataTag_Profile, ///< reference profiles
29 DataTag_ParamsArray ///< parameters array
33 DEFINE_STANDARD_RTTI(HYDROData_Stream);
36 * Returns the kind of this object. Must be redefined in all objects of known type.
38 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_STREAM;}
41 * Dump object to Python script representation.
43 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
46 * Returns the list of all reference objects of this object.
48 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
51 * Returns the top shape of the object.
53 HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
56 * Returns the 3d shape of the object.
58 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
61 * Update the shape presentations of stream.
62 * Call this method whenever you made changes for stream data.
64 HYDRODATA_EXPORT virtual void Update();
67 * Returns default filling color for new stream.
69 HYDRODATA_EXPORT static QColor DefaultFillingColor();
72 * Returns default border color for new stream.
74 HYDRODATA_EXPORT static QColor DefaultBorderColor();
78 // Public methods to work with Stream
81 * Sets reference hydraulic axis object for stream.
83 HYDRODATA_EXPORT virtual bool SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis );
86 * Returns reference hydraulic axis object of stream.
88 HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetHydraulicAxis() const;
91 * Remove reference hydraulic axis object from stream.
93 HYDRODATA_EXPORT virtual void RemoveHydraulicAxis();
96 * Returns true if profile has the intersection with the given hydraulic axis.
97 * Returns the parameter of inresection point on axis if axis is presented by one curve,
98 * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point.
100 HYDRODATA_EXPORT static bool HasIntersection( const Handle(HYDROData_PolylineXY)& theHydAxis,
101 const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
102 Standard_Real& outPar);
105 * Returns true if profile has the intersection with reference hydraulic axis.
106 * Returns the parameter of inresection point on axis if axis is presented by one curve,
107 * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point.
109 HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
110 Standard_Real& outPar) const;
113 * Builds a planar face
115 HYDRODATA_EXPORT virtual bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, TopoDS_Face& thePlane) const;
118 * Add new one reference profile object for stream.
120 HYDRODATA_EXPORT virtual bool AddProfile( const Handle(HYDROData_Profile)& theProfile );
123 * Returns all reference profile objects of stream.
125 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetProfiles() const;
128 * Removes reference profile object from stream.
130 HYDRODATA_EXPORT virtual bool RemoveProfile( const Handle(HYDROData_Profile)& theProfile );
133 * Removes all reference profile objects from stream.
135 HYDRODATA_EXPORT virtual void RemoveProfiles();
140 * Insert one profile in to the stream profiles order.
142 void insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
143 const int theBeforeIndex = -1 );
146 * Fully recompute the order of all profiles in accordance with reference hydraulic axis.
147 * If hydraulic axis is not set all profiles will be removed from order.
149 void updateProfilesOrder();
152 * Builds b-spline using interpolation algorithm.
154 Handle(Geom_BSplineCurve) buildInterpolationCurve(const Handle(TColgp_HArray1OfPnt)& theArrayOfPnt);
157 * Returns default filling color for new object.
159 HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
162 * Returns default border color for new object.
164 HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
168 void setParametersArray( const TColStd_Array1OfReal& theArray );
170 TColStd_Array1OfReal* getParametersArray() const;
172 void removeParametersArray();
174 int insertParameter( const Standard_Real& theParam );
176 void removeParameter( const int& theIndex );
180 friend class HYDROData_Iterator;
183 * Creates new object in the internal data structure. Use higher level objects
184 * to create objects with real content.
186 HYDRODATA_EXPORT HYDROData_Stream();
189 * Destructs properties of the object and object itself, removes it from the document.
191 virtual HYDRODATA_EXPORT ~HYDROData_Stream();