Salome HOME
cb455acd1a629d72370d2cca3c2fdc90728d3332
[modules/hydro.git] / src / HYDROPy / HYDROData_IPolyline.sip
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 %ExportedHeaderCode
20 #include <HYDROData_IPolyline.h>
21 %End
22
23 class HYDROData_IPolyline : public HYDROData_Entity /Abstract/
24 {
25 %TypeHeaderCode
26 #include <HYDROData_IPolyline.h>
27 %End
28
29   typedef gp_XY                       Point;
30   typedef NCollection_Sequence<gp_XY> PointsList;
31
32
33 %ConvertToSubClassCode
34     switch ( sipCpp->GetKind() )
35     {
36       case KIND_POLYLINEXY:
37         sipClass = sipClass_HYDROData_PolylineXY;
38         break;
39
40       case KIND_PROFILEUZ:
41         sipClass = sipClass_HYDROData_ProfileUZ;
42         break;
43
44       default:
45         // We don't recognise the type.
46         sipClass = NULL;
47     }
48 %End
49
50 public:
51
52   enum SectionType{ SECTION_POLYLINE = 0, SECTION_SPLINE = 1 };
53
54 public:      
55
56   /**
57    * Sets wire color for object.
58    */
59   virtual void SetWireColor( const QColor& theColor );
60
61   /**
62    * Returns wire color of object.
63    */
64   virtual QColor GetWireColor() const;
65
66   /**
67    * Returns default wire color for new object.
68    */
69   static QColor DefaultWireColor();
70
71 public:
72
73   /**
74    * Returns number of sections.
75    */
76   virtual int NbSections() const = 0;
77
78   /**
79    * Adds new one section.
80    * \param theSectName name of the section
81    * \param theSectionType type of section
82    * \param theIsClosed flag indicates closures of section
83    */
84   virtual void AddSection( const TCollection_AsciiString& theSectName,
85                            const HYDROData_IPolyline::SectionType theSectionType,
86                            const bool                     theIsClosed ) = 0;
87
88   /**
89    * Returns name of section with given index.
90    * \param theSectionIndex index of section
91    */
92   virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const = 0;
93
94   /**
95    * Set name for section with given index.
96    * \param theSectionIndex index of section
97    * \param theSectionName new section name
98    */
99   virtual void SetSectionName( const int                      theSectionIndex, 
100                                const TCollection_AsciiString& theSectionName ) = 0;
101
102   /**
103    * Returns type of section with given index.
104    * \param theSectionIndex index of section
105    */
106   virtual HYDROData_IPolyline::SectionType GetSectionType( const int theSectionIndex ) const = 0;
107
108   /**
109    * Set type for section with given index.
110    * \param theSectionIndex index of section
111    * \param theSectionType new section type
112    */
113   virtual void SetSectionType( const int         theSectionIndex, 
114                                const HYDROData_IPolyline::SectionType theSectionType ) = 0;
115
116   /**
117    * Returns true if section with given index is closed.
118    * \param theSectionIndex index of section
119    */
120   virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
121
122   /**
123    * Set closed flag for section with given index.
124    * \param theSectionIndex index of section
125    * \param theIsClosed new closures state
126    */
127   virtual void SetSectionClosed( const int  theSectionIndex, 
128                                  const bool theIsClosed ) = 0;
129
130   /**
131    * Removes section with given index.
132    * \param theSectionIndex index of section
133    */
134   virtual void RemoveSection( const int theSectionIndex ) = 0;
135
136   /**
137    * Removes all sections.
138    */
139   virtual void RemoveSections() = 0;
140
141
142   /**
143    * Return number of profile points.
144    * \return number of points
145    */
146   int NbPoints( const int theSectionIndex = -1 ) const;
147
148   /**
149    * Adds new point for section with index "theSectionIndex".
150    * \param theSectionIndex index of section
151    * \param thePoint point to add
152    * \param theBeforeIndex if not equal -1 then insert point before this index
153    */
154   virtual void AddPoint( const int    theSectionIndex,
155                          const HYDROData_IPolyline::Point& thePoint,
156                          const int    theBeforeIndex = -1 ) = 0;
157
158   /**
159    * Replaces point for section with index "theSectionIndex".
160    * \param theSectionIndex index of section
161    * \param thePoint new point
162    * \param thePointIndex index of point to replace
163    */
164   virtual void SetPoint( const int    theSectionIndex,
165                          const HYDROData_IPolyline::Point& thePoint,
166                          const int    thePointIndex ) = 0;
167
168   /**
169    * Removes point from section with index "theSectionIndex".
170    * \param theSectionIndex index of section
171    * \param thePointIndex index of point
172    */
173   virtual void RemovePoint( const int theSectionIndex,
174                             const int thePointIndex ) = 0;
175
176
177   /**
178    * Returns list of points.
179    * \param theSectionIndex if not equal -1 then list of points returned
180    *                        only for section with this index
181    * \return list of points
182    */
183   virtual HYDROData_IPolyline::PointsList GetPoints( const int theSectionIndex = -1 ) const = 0;
184
185 protected:
186
187   /**
188    * Creates new object in the internal data structure. Use higher level objects 
189    * to create objects with real content.
190    */
191   HYDROData_IPolyline();
192
193   /**
194    * Destructs properties of the object and object itself, removes it from the document.
195    */
196   ~HYDROData_IPolyline();
197 };
198
199