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();
97 * Returns true if profile has the intersection with reference hydraulic axis.
98 * Returns the parameter of inresection point on axis if axis is presented by one curve,
99 * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point.
101 HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
102 Standard_Real& outPar) const;
105 * Builds a planar face
107 HYDRODATA_EXPORT virtual bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, TopoDS_Face& thePlane) const;
110 * Add new one reference profile object for stream.
112 HYDRODATA_EXPORT virtual bool AddProfile( const Handle(HYDROData_Profile)& theProfile );
115 * Returns all reference profile objects of stream.
117 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetProfiles() const;
120 * Removes reference profile object from stream.
122 HYDRODATA_EXPORT virtual bool RemoveProfile( const Handle(HYDROData_Profile)& theProfile );
125 * Removes all reference profile objects from stream.
127 HYDRODATA_EXPORT virtual void RemoveProfiles();
132 * Insert one profile in to the stream profiles order.
134 void insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
135 const int theBeforeIndex = -1 );
138 * Fully recompute the order of all profiles in accordance with reference hydraulic axis.
139 * If hydraulic axis is not set all profiles will be removed from order.
141 void updateProfilesOrder();
144 * Builds b-spline using interpolation algorithm.
146 Handle(Geom_BSplineCurve) buildInterpolationCurve(const Handle(TColgp_HArray1OfPnt)& theArrayOfPnt);
149 * Returns default filling color for new object.
151 HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
154 * Returns default border color for new object.
156 HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
160 void setParametersArray( const TColStd_Array1OfReal& theArray );
162 TColStd_Array1OfReal* getParametersArray() const;
164 void removeParametersArray();
166 int insertParameter( const Standard_Real& theParam );
168 void removeParameter( const int& theIndex );
172 friend class HYDROData_Iterator;
175 * Creates new object in the internal data structure. Use higher level objects
176 * to create objects with real content.
178 HYDRODATA_EXPORT HYDROData_Stream();
181 * Destructs properties of the object and object itself, removes it from the document.
183 virtual HYDRODATA_EXPORT ~HYDROData_Stream();