Salome HOME
Merge branch 'BR_LAND_COVER_MAP' into BR_quadtree
[modules/hydro.git] / src / HYDROData / HYDROData_ProfileUZ.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROData_ProfileUZ_HeaderFile
20 #define HYDROData_ProfileUZ_HeaderFile
21
22 #include "HYDROData_IPolyline.h"
23
24 DEFINE_STANDARD_HANDLE(HYDROData_ProfileUZ, HYDROData_IPolyline)
25
26 class gp_XYZ;
27 class Handle_HYDROData_PolylineXY;
28
29 /**\class HYDROData_ProfileUZ
30  * \brief Class that stores/retreives information about the 
31  *        parametric profile points.
32  */
33 class HYDROData_ProfileUZ : public HYDROData_IPolyline
34 {
35 protected:
36   /**
37    * Enumeration of tags corresponding to the persistent object parameters.
38    */
39   enum DataTag
40   {
41     DataTag_First = HYDROData_IPolyline::DataTag_First + 100, ///< first tag, to reserve
42   };
43
44 public:
45   DEFINE_STANDARD_RTTI(HYDROData_ProfileUZ);
46
47
48   /**
49    * Returns the kind of this object. Must be redefined in all objects of known type.
50    */
51   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_PROFILEUZ;}
52
53 public:
54
55   /**
56    * Returns the 3D presentation of all points.
57    */
58   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
59
60   /**
61    * Returns the depth for given distance.
62    */
63   HYDRODATA_EXPORT static double GetDepthFromDistance( const PointsList& thePoints,
64                                                        const double&     theDistance );
65
66
67   /**
68    * Returns number of sections.
69    */
70   HYDRODATA_EXPORT virtual int NbSections() const;
71
72   /**
73    * Adds new one section.
74    * \param theSectName name of the section
75    * \param theSectionType type of section
76    * \param theIsClosed flag indicates closures of section
77    */
78   HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
79                                             const SectionType              theSectionType,
80                                             const bool                     theIsClosed );
81
82   /**
83    * Returns name of section with given index.
84    * \param theSectionIndex index of section
85    */
86   HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
87
88   /**
89    * Set name for section with given index.
90    * \param theSectionIndex index of section
91    * \param theSectionName new section name
92    */
93   HYDRODATA_EXPORT virtual void SetSectionName( const int                      theSectionIndex, 
94                                                 const TCollection_AsciiString& theSectionName );
95
96   /**
97    * Returns type of section with given index.
98    * \param theSectionIndex index of section
99    */
100   HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
101
102   /**
103    * Set type for section with given index.
104    * \param theSectionIndex index of section
105    * \param theSectionType new section type
106    */
107   HYDRODATA_EXPORT virtual void SetSectionType( const int         theSectionIndex, 
108                                                 const SectionType theSectionType );
109
110   /**
111    * Returns true if section with given index is closed.
112    * \param theSectionIndex index of section
113    */
114   HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
115
116   /**
117    * Set closed flag for section with given index.
118    * \param theSectionIndex index of section
119    * \param theIsClosed new closures state
120    */
121   HYDRODATA_EXPORT virtual void SetSectionClosed( const int  theSectionIndex, 
122                                                   const bool theIsClosed );
123
124   /**
125    * Removes section with given index.
126    * \param theSectionIndex index of section
127    */
128   HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex );
129
130   /**
131    * Removes all sections.
132    */
133   HYDRODATA_EXPORT virtual void RemoveSections();
134
135
136   /**
137    * Adds new point for section with index "theSectionIndex".
138    * \param theSectionIndex index of section
139    * \param thePoint point to add
140    * \param theBeforeIndex if not equal -1 then insert point in this pos
141    */
142   HYDRODATA_EXPORT virtual void AddPoint( const int    theSectionIndex,
143                                           const Point& thePoint,
144                                           const int    thePointIndex = -1 );
145
146   /**
147    * Replaces point for section with index "theSectionIndex".
148    * \param theSectionIndex index of section
149    * \param thePoint new point
150    * \param thePointIndex index of point to replace
151    */
152   HYDRODATA_EXPORT virtual void SetPoint( const int    theSectionIndex,
153                                           const Point& thePoint,
154                                           const int    thePointIndex );
155
156   /**
157    * Removes point from section with index "theSectionIndex".
158    * \param theSectionIndex index of section
159    * \param thePointIndex index of point
160    */
161   HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
162                                              const int thePointIndex );
163
164
165   /**
166    * Returns list of points.
167    * \param theSectionIndex if not equal -1 then list of points returned
168    *                        only for section with this index
169    * \return list of points
170    */
171   HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1, bool IsConvertToGlobal = false ) const;
172
173   HYDRODATA_EXPORT virtual void CalculateAndAddPoints(const NCollection_Sequence<gp_XYZ>& theXYZPoints, Handle_HYDROData_PolylineXY& thePolylineXY);
174
175 protected:
176
177   friend class HYDROData_Iterator;
178
179   /**
180    * Creates new object in the internal data structure. Use higher level objects 
181    * to create objects with real content.
182    */
183   HYDRODATA_EXPORT HYDROData_ProfileUZ();
184
185   /**
186    * Destructs properties of the object and object itself, removes it from the document.
187    */
188   HYDRODATA_EXPORT ~HYDROData_ProfileUZ();
189 };
190
191 #endif