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 profiles order and shape presentations of stream.
62 * Call this method whenever you made changes for stream data.
64 HYDRODATA_EXPORT virtual void Update();
67 * Update the shape presentations of stream.
69 HYDRODATA_EXPORT virtual void updatePrs();
72 * Returns default filling color for new stream.
74 HYDRODATA_EXPORT static QColor DefaultFillingColor();
77 * Returns default border color for new stream.
79 HYDRODATA_EXPORT static QColor DefaultBorderColor();
82 * Returns true if given polyline can be used as stream axis.
84 HYDRODATA_EXPORT static bool IsValidAsAxis( const Handle(HYDROData_PolylineXY)& theAxis );
87 // Public methods to work with Stream
90 * Sets reference hydraulic axis object for stream.
92 HYDRODATA_EXPORT virtual bool SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis );
95 * Returns reference hydraulic axis object of stream.
97 HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetHydraulicAxis() const;
100 * Remove reference hydraulic axis object from stream.
102 HYDRODATA_EXPORT virtual void RemoveHydraulicAxis();
105 * Returns true if profile has the intersection with the given 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 static bool HasIntersection( const Handle(HYDROData_PolylineXY)& theHydAxis,
110 const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
111 Standard_Real& outPar);
114 * Returns true if profile has the intersection with reference hydraulic axis.
115 * Returns the parameter of inresection point on axis if axis is presented by one curve,
116 * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point.
118 HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
119 Standard_Real& outPar) const;
122 * Builds a planar face
124 HYDRODATA_EXPORT virtual bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, TopoDS_Face& thePlane) const;
127 * Add new one reference profile object for stream.
129 HYDRODATA_EXPORT virtual bool AddProfile( const Handle(HYDROData_Profile)& theProfile );
132 * Returns all reference profile objects of stream.
134 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetProfiles() const;
137 * Removes reference profile object from stream.
139 HYDRODATA_EXPORT virtual bool RemoveProfile( const Handle(HYDROData_Profile)& theProfile );
142 * Removes all reference profile objects from stream.
144 HYDRODATA_EXPORT virtual void RemoveProfiles();
149 * Insert one profile in to the stream profiles order.
151 void insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
152 const int theBeforeIndex = -1 );
155 * Fully recompute the order of all profiles in accordance with reference hydraulic axis.
156 * If hydraulic axis is not set all profiles will be removed from order.
158 void updateProfilesOrder();
161 * Create all necessary child group objects.
163 virtual void createGroupObjects();
166 * Returns the type of child altitude object.
167 * Reimplemented to create stream altitude object.
169 virtual ObjectKind getAltitudeObjectType() const;
172 * Builds b-spline using interpolation algorithm.
174 Handle(Geom_BSplineCurve) buildInterpolationCurve(const Handle(TColgp_HArray1OfPnt)& theArrayOfPnt);
177 * Returns default filling color for new object.
179 virtual QColor getDefaultFillingColor() const;
182 * Returns default border color for new object.
184 virtual QColor getDefaultBorderColor() const;
188 void setParametersArray( const TColStd_Array1OfReal& theArray );
190 TColStd_Array1OfReal* getParametersArray() const;
192 void removeParametersArray();
194 int insertParameter( const Standard_Real& theParam );
196 void removeParameter( const int& theIndex );
200 friend class HYDROData_Iterator;
203 * Creates new object in the internal data structure. Use higher level objects
204 * to create objects with real content.
206 HYDRODATA_EXPORT HYDROData_Stream();
209 * Destructs properties of the object and object itself, removes it from the document.
211 virtual HYDRODATA_EXPORT ~HYDROData_Stream();