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