Salome HOME
62a5c14ef3fe98c95fade9ddf868630f1d3a7197
[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 HYDROData_ProfileUZ
27  * \brief Class that stores/retreives information about the 
28  *        parametric profile points.
29  */
30 class HYDROData_ProfileUZ : public HYDROData_IPolyline
31 {
32 protected:
33   /**
34    * Enumeration of tags corresponding to the persistent object parameters.
35    */
36   enum DataTag
37   {
38     DataTag_First = HYDROData_IPolyline::DataTag_First + 100, ///< first tag, to reserve
39   };
40
41 public:
42   DEFINE_STANDARD_RTTI(HYDROData_ProfileUZ);
43
44
45   /**
46    * Returns the kind of this object. Must be redefined in all objects of known type.
47    */
48   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_PROFILEUZ;}
49
50 public:
51
52   /**
53    * Returns the 3D presentation of all points.
54    */
55   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
56
57   /**
58    * Returns the depth for given distance.
59    */
60   HYDRODATA_EXPORT static double GetDepthFromDistance( const PointsList& thePoints,
61                                                        const double&     theDistance );
62
63
64   /**
65    * Returns number of sections.
66    */
67   HYDRODATA_EXPORT virtual int NbSections() const;
68
69   /**
70    * Adds new one section.
71    * \param theSectName name of the section
72    * \param theSectionType type of section
73    * \param theIsClosed flag indicates closures of section
74    */
75   HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
76                                             const SectionType              theSectionType,
77                                             const bool                     theIsClosed );
78
79   /**
80    * Returns name of section with given index.
81    * \param theSectionIndex index of section
82    */
83   HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
84
85   /**
86    * Set name for section with given index.
87    * \param theSectionIndex index of section
88    * \param theSectionName new section name
89    */
90   HYDRODATA_EXPORT virtual void SetSectionName( const int                      theSectionIndex, 
91                                                 const TCollection_AsciiString& theSectionName );
92
93   /**
94    * Returns type of section with given index.
95    * \param theSectionIndex index of section
96    */
97   HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
98
99   /**
100    * Set type for section with given index.
101    * \param theSectionIndex index of section
102    * \param theSectionType new section type
103    */
104   HYDRODATA_EXPORT virtual void SetSectionType( const int         theSectionIndex, 
105                                                 const SectionType theSectionType );
106
107   /**
108    * Returns true if section with given index is closed.
109    * \param theSectionIndex index of section
110    */
111   HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
112
113   /**
114    * Set closed flag for section with given index.
115    * \param theSectionIndex index of section
116    * \param theIsClosed new closures state
117    */
118   HYDRODATA_EXPORT virtual void SetSectionClosed( const int  theSectionIndex, 
119                                                   const bool theIsClosed );
120
121   /**
122    * Removes section with given index.
123    * \param theSectionIndex index of section
124    */
125   HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex );
126
127   /**
128    * Removes all sections.
129    */
130   HYDRODATA_EXPORT virtual void RemoveSections();
131
132
133   /**
134    * Adds new point for section with index "theSectionIndex".
135    * \param theSectionIndex index of section
136    * \param thePoint point to add
137    * \param theBeforeIndex if not equal -1 then insert point in this pos
138    */
139   HYDRODATA_EXPORT virtual void AddPoint( const int    theSectionIndex,
140                                           const Point& thePoint,
141                                           const int    thePointIndex = -1 );
142
143   /**
144    * Replaces point for section with index "theSectionIndex".
145    * \param theSectionIndex index of section
146    * \param thePoint new point
147    * \param thePointIndex index of point to replace
148    */
149   HYDRODATA_EXPORT virtual void SetPoint( const int    theSectionIndex,
150                                           const Point& thePoint,
151                                           const int    thePointIndex );
152
153   /**
154    * Removes point from section with index "theSectionIndex".
155    * \param theSectionIndex index of section
156    * \param thePointIndex index of point
157    */
158   HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
159                                              const int thePointIndex );
160
161
162   /**
163    * Returns list of points.
164    * \param theSectionIndex if not equal -1 then list of points returned
165    *                        only for section with this index
166    * \return list of points
167    */
168   HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
169
170 protected:
171
172   friend class HYDROData_Iterator;
173
174   /**
175    * Creates new object in the internal data structure. Use higher level objects 
176    * to create objects with real content.
177    */
178   HYDRODATA_EXPORT HYDROData_ProfileUZ();
179
180   /**
181    * Destructs properties of the object and object itself, removes it from the document.
182    */
183   HYDRODATA_EXPORT ~HYDROData_ProfileUZ();
184 };
185
186 #endif