Salome HOME
lot 3 - coloring of section in OCC view see also refs #1838
[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   /**
72    * Sets color for section of polyline.
73    */
74   virtual void SetSectionColor( const int theSectionIndex, const QColor& theColor );
75
76   /**
77    * Returns color of section of polyline.
78    */
79   virtual bool GetSectionColor( const int theSectionIndex, QColor &theColor ) const;
80
81
82 public:
83
84   /**
85    * Returns number of sections.
86    */
87   virtual int NbSections() const = 0;
88
89   /**
90    * Adds new one section.
91    * \param theSectName name of the section
92    * \param theSectionType type of section
93    * \param theIsClosed flag indicates closures of section
94    */
95   virtual void AddSection( const TCollection_AsciiString& theSectName,
96                            const HYDROData_IPolyline::SectionType theSectionType,
97                            const bool                     theIsClosed ) = 0;
98
99   /**
100    * Returns name of section with given index.
101    * \param theSectionIndex index of section
102    */
103   virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const = 0;
104
105   /**
106    * Set name for section with given index.
107    * \param theSectionIndex index of section
108    * \param theSectionName new section name
109    */
110   virtual void SetSectionName( const int                      theSectionIndex, 
111                                const TCollection_AsciiString& theSectionName ) = 0;
112
113   /**
114    * Returns type of section with given index.
115    * \param theSectionIndex index of section
116    */
117   virtual HYDROData_IPolyline::SectionType GetSectionType( const int theSectionIndex ) const = 0;
118
119   /**
120    * Set type for section with given index.
121    * \param theSectionIndex index of section
122    * \param theSectionType new section type
123    */
124   virtual void SetSectionType( const int         theSectionIndex, 
125                                const HYDROData_IPolyline::SectionType theSectionType ) = 0;
126
127   /**
128    * Returns true if section with given index is closed.
129    * \param theSectionIndex index of section
130    */
131   virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
132
133   /**
134    * Set closed flag for section with given index.
135    * \param theSectionIndex index of section
136    * \param theIsClosed new closures state
137    */
138   virtual void SetSectionClosed( const int  theSectionIndex, 
139                                  const bool theIsClosed ) = 0;
140
141   /**
142    * Removes section with given index.
143    * \param theSectionIndex index of section
144    */
145   virtual void RemoveSection( const int theSectionIndex ) = 0;
146
147   /**
148    * Removes all sections.
149    */
150   virtual void RemoveSections() = 0;
151
152
153   /**
154    * Return number of profile points.
155    * \return number of points
156    */
157   int NbPoints( const int theSectionIndex = -1 ) const;
158
159   /**
160    * Adds new point for section with index "theSectionIndex".
161    * \param theSectionIndex index of section
162    * \param thePoint point to add
163    * \param theBeforeIndex if not equal -1 then insert point before this index
164    */
165   virtual void AddPoint( const int    theSectionIndex,
166                          const HYDROData_IPolyline::Point& thePoint,
167                          const int    theBeforeIndex = -1 ) = 0;
168
169   /**
170    * Replaces point for section with index "theSectionIndex".
171    * \param theSectionIndex index of section
172    * \param thePoint new point
173    * \param thePointIndex index of point to replace
174    */
175   virtual void SetPoint( const int    theSectionIndex,
176                          const HYDROData_IPolyline::Point& thePoint,
177                          const int    thePointIndex ) = 0;
178
179   /**
180    * Removes point from section with index "theSectionIndex".
181    * \param theSectionIndex index of section
182    * \param thePointIndex index of point
183    */
184   virtual void RemovePoint( const int theSectionIndex,
185                             const int thePointIndex ) = 0;
186
187
188   /**
189    * Returns list of points.
190    * \param theSectionIndex if not equal -1 then list of points returned
191    *                        only for section with this index
192    * \return list of points
193    */
194   virtual HYDROData_IPolyline::PointsList GetPoints( const int theSectionIndex = -1 ) const = 0;
195
196 protected:
197
198   /**
199    * Creates new object in the internal data structure. Use higher level objects 
200    * to create objects with real content.
201    */
202   HYDROData_IPolyline();
203
204   /**
205    * Destructs properties of the object and object itself, removes it from the document.
206    */
207   ~HYDROData_IPolyline();
208 };
209
210