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();
77 * Returns true if given polyline can be used as stream axis.
79 HYDRODATA_EXPORT static bool IsValidAsAxis( const Handle(HYDROData_PolylineXY)& theAxis );
82 // Public methods to work with Stream
85 * Sets reference hydraulic axis object for stream.
87 HYDRODATA_EXPORT virtual bool SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis );
90 * Returns reference hydraulic axis object of stream.
92 HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetHydraulicAxis() const;
95 * Remove reference hydraulic axis object from stream.
97 HYDRODATA_EXPORT virtual void RemoveHydraulicAxis();
100 * Returns true if profile has the intersection with the given hydraulic axis.
101 * Returns the parameter of inresection point on axis if axis is presented by one curve,
102 * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point.
104 HYDRODATA_EXPORT static bool HasIntersection( const Handle(HYDROData_PolylineXY)& theHydAxis,
105 const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
106 Standard_Real& outPar);
109 * Returns true if profile has the intersection with reference hydraulic axis.
110 * Returns the parameter of inresection point on axis if axis is presented by one curve,
111 * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point.
113 HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
114 Standard_Real& outPar) const;
117 * Builds a planar face
119 HYDRODATA_EXPORT virtual bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, TopoDS_Face& thePlane) const;
122 * Add new one reference profile object for stream.
124 HYDRODATA_EXPORT virtual bool AddProfile( const Handle(HYDROData_Profile)& theProfile );
127 * Returns all reference profile objects of stream.
129 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetProfiles() const;
132 * Removes reference profile object from stream.
134 HYDRODATA_EXPORT virtual bool RemoveProfile( const Handle(HYDROData_Profile)& theProfile );
137 * Removes all reference profile objects from stream.
139 HYDRODATA_EXPORT virtual void RemoveProfiles();
144 * Insert one profile in to the stream profiles order.
146 void insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
147 const int theBeforeIndex = -1 );
150 * Fully recompute the order of all profiles in accordance with reference hydraulic axis.
151 * If hydraulic axis is not set all profiles will be removed from order.
153 void updateProfilesOrder();
156 * Create all necessary child group objects.
158 virtual void createGroupObjects();
161 * Returns the type of child altitude object.
162 * Reimplemented to create stream altitude object.
164 virtual ObjectKind getAltitudeObjectType() const;
167 * Builds b-spline using interpolation algorithm.
169 Handle(Geom_BSplineCurve) buildInterpolationCurve(const Handle(TColgp_HArray1OfPnt)& theArrayOfPnt);
172 * Returns default filling color for new object.
174 virtual QColor getDefaultFillingColor() const;
177 * Returns default border color for new object.
179 virtual QColor getDefaultBorderColor() const;
183 void setParametersArray( const TColStd_Array1OfReal& theArray );
185 TColStd_Array1OfReal* getParametersArray() const;
187 void removeParametersArray();
189 int insertParameter( const Standard_Real& theParam );
191 void removeParameter( const int& theIndex );
195 friend class HYDROData_Iterator;
198 * Creates new object in the internal data structure. Use higher level objects
199 * to create objects with real content.
201 HYDRODATA_EXPORT HYDROData_Stream();
204 * Destructs properties of the object and object itself, removes it from the document.
206 virtual HYDRODATA_EXPORT ~HYDROData_Stream();