2 #ifndef HYDROData_Stream_HeaderFile
3 #define HYDROData_Stream_HeaderFile
5 #include "HYDROData_NaturalObject.h"
7 #include <TopoDS_Face.hxx>
8 #include <TopoDS_Edge.hxx>
10 #include <Geom_BSplineCurve.hxx>
12 DEFINE_STANDARD_HANDLE(HYDROData_Stream, HYDROData_NaturalObject)
14 class Handle(HYDROData_PolylineXY);
15 class Handle(HYDROData_Profile);
16 class TColStd_Array1OfReal;
18 /**\class HYDROData_Stream
22 class HYDROData_Stream : public HYDROData_NaturalObject
30 TopoDS_Edge myLeftBank;
31 TopoDS_Edge myRightBank;
38 * Enumeration of tags corresponding to the persistent object parameters.
42 DataTag_First = HYDROData_NaturalObject::DataTag_First + 100, ///< first tag, to reserve
43 DataTag_HydraulicAxis, ///< reference hydraulic axis
44 DataTag_Profile, ///< reference profiles
45 DataTag_ParamsArray ///< parameters array
50 DEFINE_STANDARD_RTTI(HYDROData_Stream);
55 * Creates the presentations(2D and 3D) by given hydraulic axis and profiles.
57 HYDRODATA_EXPORT static bool CreatePresentations( const Handle(HYDROData_PolylineXY)& theHydAxis,
58 const HYDROData_SequenceOfObjects& theProfiles,
59 PrsDefinition& thePrs );
64 * Returns the kind of this object. Must be redefined in all objects of known type.
66 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_STREAM;}
69 * Dump object to Python script representation.
71 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
74 * Returns the list of all reference objects of this object.
76 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
79 * Returns the top shape of the object.
81 HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
84 * Returns the 3d shape of the object.
86 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
89 * Update the profiles order and shape presentations of stream.
90 * Call this method whenever you made changes for stream data.
92 HYDRODATA_EXPORT virtual void Update();
95 * Checks that object has 2D presentation. Reimlemented to retun true.
97 HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
100 * Update the shape presentations of stream.
102 HYDRODATA_EXPORT virtual void UpdatePrs();
105 * Returns default filling color for new stream.
107 HYDRODATA_EXPORT static QColor DefaultFillingColor();
110 * Returns default border color for new stream.
112 HYDRODATA_EXPORT static QColor DefaultBorderColor();
115 * Returns true if given polyline can be used as stream axis.
117 HYDRODATA_EXPORT static bool IsValidAsAxis( const Handle(HYDROData_PolylineXY)& theAxis );
120 // Public methods to work with Stream presentation
123 * Returns the left edge of the stream.
125 HYDRODATA_EXPORT virtual TopoDS_Shape GetLeftShape() const;
128 * Returns the right edge of the stream.
130 HYDRODATA_EXPORT virtual TopoDS_Shape GetRightShape() const;
133 * Returns the inlet edge of the stream.
135 HYDRODATA_EXPORT virtual TopoDS_Shape GetInletShape() const;
138 * Returns the outlet edge of the stream.
140 HYDRODATA_EXPORT virtual TopoDS_Shape GetOutletShape() const;
144 // Public methods to work with Stream data fields
147 * Sets reference hydraulic axis object for stream.
149 HYDRODATA_EXPORT virtual bool SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis );
152 * Returns reference hydraulic axis object of stream.
154 HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetHydraulicAxis() const;
157 * Remove reference hydraulic axis object from stream.
159 HYDRODATA_EXPORT virtual void RemoveHydraulicAxis();
162 * Returns true if profile has the intersection with the given hydraulic axis.
163 * Returns the parameter of inresection point on axis if axis is presented by one curve,
164 * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point.
166 HYDRODATA_EXPORT static bool HasIntersection( const Handle(HYDROData_PolylineXY)& theHydAxis,
167 const Handle(HYDROData_Profile)& theProfile,
168 const TopoDS_Face& thePlane,
169 Standard_Real& theOutPar );
172 * Returns true if profile has the intersection with reference hydraulic axis.
173 * Returns the parameter of inresection point on axis if axis is presented by one curve,
174 * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point.
176 HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile,
177 const TopoDS_Face& thePlane,
178 Standard_Real& theOutPar ) const;
181 * Builds a planar face
183 HYDRODATA_EXPORT static bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis,
184 TopoDS_Face& thePlane );
187 * Add new one reference profile object for stream.
189 HYDRODATA_EXPORT virtual bool AddProfile( const Handle(HYDROData_Profile)& theProfile );
192 * Add new one reference profile object for stream.
194 HYDRODATA_EXPORT virtual bool SetProfiles( const HYDROData_SequenceOfObjects& theProfiles,
195 const bool& theIsToOrder = true );
198 * Returns all reference profile objects of stream.
200 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetProfiles() const;
203 * Removes reference profile object from stream.
205 HYDRODATA_EXPORT virtual bool RemoveProfile( const Handle(HYDROData_Profile)& theProfile );
208 * Removes all reference profile objects from stream.
210 HYDRODATA_EXPORT virtual void RemoveProfiles();
215 * Insert one profile in to the stream profiles order.
217 void insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
218 const int theBeforeIndex = -1 );
221 * Fully recompute the order of all profiles in accordance with reference hydraulic axis.
222 * If hydraulic axis is not set all profiles will be removed from order.
224 void updateProfilesOrder();
227 * Returns the type of child altitude object.
228 * Reimplemented to create stream altitude object.
230 HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
233 * Builds b-spline using interpolation algorithm.
235 static Handle(Geom_BSplineCurve) buildInterpolationCurve(
236 const Handle(TColgp_HArray1OfPnt)& theArrayOfPnt );
239 * Returns default filling color for new object.
241 HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
244 * Returns default border color for new object.
246 HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
250 void setParametersArray( const TColStd_Array1OfReal& theArray );
252 TColStd_Array1OfReal* getParametersArray() const;
254 void removeParametersArray();
256 int insertParameter( const Standard_Real& theParam );
258 void removeParameter( const int& theIndex );
262 friend class HYDROData_Iterator;
265 * Creates new object in the internal data structure. Use higher level objects
266 * to create objects with real content.
268 HYDRODATA_EXPORT HYDROData_Stream();
271 * Destructs properties of the object and object itself, removes it from the document.
273 virtual HYDRODATA_EXPORT ~HYDROData_Stream();