Salome HOME
Insert single profiles in to the stream order.
[modules/hydro.git] / src / HYDROData / HYDROData_Stream.h
1
2 #ifndef HYDROData_Stream_HeaderFile
3 #define HYDROData_Stream_HeaderFile
4
5 #include "HYDROData_NaturalObject.h"
6 #include <TopoDS_Face.hxx>
7 DEFINE_STANDARD_HANDLE(HYDROData_Stream, HYDROData_NaturalObject)
8
9 class Handle(HYDROData_PolylineXY);
10 class Handle(HYDROData_Profile);
11 class TColStd_Array1OfReal;
12
13 /**\class HYDROData_Stream
14  * \brief 
15  *
16  */
17 class HYDROData_Stream : public HYDROData_NaturalObject
18 {
19 protected:
20   /**
21    * Enumeration of tags corresponding to the persistent object parameters.
22    */
23   enum DataTag
24   {
25     DataTag_First = HYDROData_NaturalObject::DataTag_First + 100, ///< first tag, to reserve
26     DataTag_HydraulicAxis,     ///< reference hydraulic axis
27     DataTag_Profile,           ///< reference profiles
28     DataTag_ParamsArray        ///< parameters array
29   };
30
31 public:
32   DEFINE_STANDARD_RTTI(HYDROData_Stream);
33
34   /**
35    * Returns the kind of this object. Must be redefined in all objects of known type.
36    */
37   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_STREAM;}
38
39   /**
40    * Dump object to Python script representation.
41    */
42   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
43
44   /**
45    * Returns the list of all reference objects of this object.
46    */
47   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
48
49   /**
50    * Returns the top shape of the object.
51    */
52   HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
53
54   /**
55    * Returns the 3d shape of the object.
56    */
57   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
58
59   /**
60    * Update the shape presentations of stream.
61    * Call this method whenever you made changes for stream data.
62    */
63   HYDRODATA_EXPORT virtual void Update();
64
65
66 public:      
67   // Public methods to work with Stream
68   
69   /**
70    * Sets reference hydraulic axis object for stream.
71    */
72   HYDRODATA_EXPORT virtual bool SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis );
73
74   /**
75    * Returns reference hydraulic axis object of stream.
76    */
77   HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetHydraulicAxis() const;
78
79   /**
80    * Remove reference hydraulic axis object from stream.
81    */
82   HYDRODATA_EXPORT virtual void RemoveHydraulicAxis();
83
84
85   /**
86    * Returns true if profile has the intersection with reference hydraulic axis.
87    * Returns the parameter of inresection point on axis if axis is presented by one curve,
88    * if axis presented by set of edges the <outPar> returns a common length of segments till the intersection point. 
89    */
90   HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
91                                                                                                 Standard_Real& outPar) const;
92
93    /**
94    * Builds a planar face
95    */
96   HYDRODATA_EXPORT virtual bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, TopoDS_Face& thePlane) const;
97
98   /**
99    * Add new one reference profile object for stream.
100    */
101   HYDRODATA_EXPORT virtual bool AddProfile( const Handle(HYDROData_Profile)& theProfile );
102
103   /**
104    * Returns all reference profile objects of stream.
105    */
106   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetProfiles() const;
107
108   /**
109    * Removes reference profile object from stream.
110    */
111   HYDRODATA_EXPORT virtual bool RemoveProfile( const Handle(HYDROData_Profile)& theProfile );
112
113   /**
114    * Removes all reference profile objects from stream.
115    */
116   HYDRODATA_EXPORT virtual void RemoveProfiles();
117
118
119 protected:
120
121   /**
122    * Insert one profile in to the stream profiles order.
123    */
124   void insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
125                                const int                        theBeforeIndex = -1 );
126
127   /**
128    * Fully recompute the order of all profiles in accordance with reference hydraulic axis.
129    * If hydraulic axis is not set all profiles will be removed from order.
130    */
131   void updateProfilesOrder();
132
133 private:
134   
135   void setParametersArray( const TColStd_Array1OfReal& theArray );
136
137   TColStd_Array1OfReal* getParametersArray() const;
138
139   void removeParametersArray();
140
141   int insertParameter( const Standard_Real& theParam );
142
143   void removeParameter( const int& theIndex );
144
145 protected:
146
147   friend class HYDROData_Iterator;
148
149   /**
150    * Creates new object in the internal data structure. Use higher level objects 
151    * to create objects with real content.
152    */
153   HYDRODATA_EXPORT HYDROData_Stream();
154
155   /**
156    * Destructs properties of the object and object itself, removes it from the document.
157    */
158   virtual HYDRODATA_EXPORT ~HYDROData_Stream();
159 };
160
161 #endif