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