Salome HOME
SIP: NCollection_Sequence mapping is updated.
[modules/hydro.git] / src / HYDROPy / HYDROData_Profile.sip
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 %ExportedHeaderCode
24 #include "HYDROData_Profile.h"
25 %End
26
27 class HYDROData_Profile : public HYDROData_Object
28 {
29 %TypeHeaderCode
30 #include "HYDROData_Profile.h"
31 %End
32 public:
33
34   typedef gp_XYZ                       ProfilePoint;
35   typedef NCollection_Sequence<HYDROData_Profile::ProfilePoint> ProfilePoints;
36
37 public:
38   /**
39    * Returns default filling color for new profile.
40    */
41   static QColor DefaultFillingColor();
42
43   /**
44    * Returns default border color for new profile.
45    */
46   static QColor DefaultBorderColor();
47
48
49 public:
50
51   /**
52    * Check profile data and returns true if profile is valid.
53    * Validity is determined by:
54    *   - First(left) and Last(right) point was set
55    *   - Parametric points size is more than 1
56    */
57   bool IsValid() const;
58
59   /**
60    * Invalidate profile first and last points.
61    */
62   void Invalidate();
63   
64 public:
65
66   // Public methods to work with profile points.
67
68   /**
69    * Set first(left) point for profile.
70    * \param thePoint the point
71    */
72   void SetLeftPoint( const gp_XY& thePoint );
73
74   /**
75    * Returns first(left) point of profile.
76    * \param thePoint[out] profile first point
77    * \return true if point has been set
78    */
79   bool GetLeftPoint( gp_XY& thePoint ) const;
80   
81   /**
82    * Set last(right) point for profile.
83    * \param thePoint the point
84    */
85   void SetRightPoint( const gp_XY& thePoint );
86
87   /**
88    * Returns last(right) point of profile.
89    * \param thePoint[out] profile last point
90    * \return true if point has been set
91    */
92   bool GetRightPoint( gp_XY& thePoint ) const;
93
94
95   /**
96    * Returns object which store parametric presentation of profile points.
97    * \return profile U,Z
98    */
99   HYDROData_ProfileUZ GetProfileUZ( const bool theIsCreate = true ) const 
100     [Handle_HYDROData_ProfileUZ ( const bool theIsCreate = true )];
101   %MethodCode
102
103     Handle(HYDROData_ProfileUZ) aRefProfileUZ;
104     
105     Py_BEGIN_ALLOW_THREADS
106     aRefProfileUZ = sipSelfWasArg ? sipCpp->HYDROData_Profile::GetProfileUZ() : 
107                                    sipCpp->GetProfileUZ();
108     Py_END_ALLOW_THREADS
109     
110     sipRes = (HYDROData_ProfileUZ*)createPointer( aRefProfileUZ );
111   
112   %End
113
114
115   /**
116    * Return number of profile points.
117    * \return number of points
118    */
119   int NbPoints() const;
120
121   /**
122    * Remove all profile points.
123    */
124   void RemovePoints();
125
126
127   /**
128    * Replace current profile parametric points by new one.
129    * \param thePoints the list with new points in parametric form
130    */
131   void SetParametricPoints( const HYDROData_IPolyline::PointsList& thePoints );
132
133   /**
134    * Returns profile points in parametric form.
135    * \return points list
136    */
137   HYDROData_IPolyline::PointsList GetParametricPoints() const;
138
139
140   /**
141    * Replace current profile points by new one.
142    * First and last points will be automatically updated.
143    * \param thePoints the list with new profile points
144    */
145   void SetProfilePoints( const HYDROData_Profile::ProfilePoints thePoints );
146
147   /**
148    * Returns profile points.
149    * Empty sequence is returned if first or last point was not set.
150    * \return profile points list
151    */
152   HYDROData_Profile::ProfilePoints GetProfilePoints() const;
153
154
155 public:
156   // Public methods to work with files.
157
158   /**
159    * Stores the profile file path
160    * \param theFilePath profile file path
161    */
162   void SetFilePath( const TCollection_AsciiString& theFilePath );
163
164   /**
165    * Returns uploaded profile file path
166    */
167   TCollection_AsciiString GetFilePath() const;
168
169   /**
170    * Imports Profile data from file. The supported file types:
171    *  - parametric presentation of profile (2 points in line U,Z)
172    *  - georeferenced presentation of profile (3 points in line X,Y,Z)
173    * Create as many objects as many profiles in the file are defined.
174    * \param theFileName the path to file
175    * \return \c number of successfully imported profiles
176    */
177   static int ImportFromFile( const HYDROData_Document theDoc,
178                              const TCollection_AsciiString&    theFileName,
179                              NCollection_Sequence<int>&        theBadProfilesIds )
180   [int ( const Handle_HYDROData_Document& ,
181          const TCollection_AsciiString&    ,
182          NCollection_Sequence<int>&         )];
183   %MethodCode
184     Py_BEGIN_ALLOW_THREADS
185     sipRes = HYDROData_Profile::ImportFromFile( a0, *a1, a2 );
186     Py_END_ALLOW_THREADS
187   %End
188
189   /**
190    * Imports Profile data from file.
191    * \param theFileName the path to file
192    * \param theIsRead set to true if at least one non empty string was read from file
193    * \return \c true if file has been successfully read
194    */
195   virtual bool ImportFromFile( const TCollection_AsciiString& theFileName,
196                                bool*                          theIsRead = 0 );
197
198 protected:
199   /**
200    * Creates new object in the internal data structure. Use higher level objects 
201    * to create objects with real content.
202    */
203   HYDROData_Profile();
204
205   /**
206    * Destructs properties of the object and object itself, removes it from the document.
207    */
208   ~HYDROData_Profile();
209 };