Salome HOME
SIP: HYDROData_Digue is included.
[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 public:
30
31   typedef gp_XYZ                       ProfilePoint;
32   typedef NCollection_Sequence<gp_XYZ> ProfilePoints;
33
34 %TypeHeaderCode
35 #include "HYDROData_Profile.h"
36 %End
37
38 public:
39   /**
40    * Returns default filling color for new profile.
41    */
42   static QColor DefaultFillingColor();
43
44   /**
45    * Returns default border color for new profile.
46    */
47   static QColor DefaultBorderColor();
48
49
50 public:
51
52   /**
53    * Check profile data and returns true if profile is valid.
54    * Validity is determined by:
55    *   - First(left) and Last(right) point was set
56    *   - Parametric points size is more than 1
57    */
58   bool IsValid() const;
59
60   /**
61    * Invalidate profile first and last points.
62    */
63   void Invalidate();
64   
65 public:
66
67   // Public methods to work with profile points.
68
69   /**
70    * Set first(left) point for profile.
71    * \param thePoint the point
72    */
73   void SetLeftPoint( const gp_XY& thePoint );
74
75   /**
76    * Returns first(left) point of profile.
77    * \param thePoint[out] profile first point
78    * \return true if point has been set
79    */
80   bool GetLeftPoint( gp_XY& thePoint ) const;
81   
82   /**
83    * Set last(right) point for profile.
84    * \param thePoint the point
85    */
86   void SetRightPoint( const gp_XY& thePoint );
87
88   /**
89    * Returns last(right) point of profile.
90    * \param thePoint[out] profile last point
91    * \return true if point has been set
92    */
93   bool GetRightPoint( gp_XY& thePoint ) const;
94
95
96   /**
97    * Returns object which store parametric presentation of profile points.
98    * \return profile U,Z
99    */
100   HYDROData_ProfileUZ GetProfileUZ( const bool theIsCreate = true ) const 
101     [Handle_HYDROData_ProfileUZ ( const bool theIsCreate = true )];
102   %MethodCode
103
104     Handle(HYDROData_ProfileUZ) aRefProfileUZ;
105     
106     Py_BEGIN_ALLOW_THREADS
107     aRefProfileUZ = sipSelfWasArg ? sipCpp->HYDROData_Profile::GetProfileUZ() : 
108                                    sipCpp->GetProfileUZ();
109     Py_END_ALLOW_THREADS
110     
111     sipRes = (HYDROData_ProfileUZ*)createPointer( aRefProfileUZ );
112   
113   %End
114
115
116   /**
117    * Return number of profile points.
118    * \return number of points
119    */
120   int NbPoints() const;
121
122   /**
123    * Remove all profile points.
124    */
125   void RemovePoints();
126
127
128   /**
129    * Replace current profile parametric points by new one.
130    * \param thePoints the list with new points in parametric form
131    */
132   void SetParametricPoints( const HYDROData_ProfileUZ::PointsList& thePoints );
133
134   /**
135    * Returns profile points in parametric form.
136    * \return points list
137    */
138   HYDROData_ProfileUZ::PointsList GetParametricPoints() const;
139
140
141   /**
142    * Replace current profile points by new one.
143    * First and last points will be automatically updated.
144    * \param thePoints the list with new profile points
145    */
146   void SetProfilePoints( const ProfilePoints thePoints );
147
148   /**
149    * Returns profile points.
150    * Empty sequence is returned if first or last point was not set.
151    * \return profile points list
152    */
153   ProfilePoints GetProfilePoints() const;
154
155
156 public:
157   // Public methods to work with files.
158
159   /**
160    * Stores the profile file path
161    * \param theFilePath profile file path
162    */
163   void SetFilePath( const TCollection_AsciiString& theFilePath );
164
165   /**
166    * Returns uploaded profile file path
167    */
168   TCollection_AsciiString GetFilePath() const;
169
170   /**
171    * Imports Profile data from file. The supported file types:
172    *  - parametric presentation of profile (2 points in line U,Z)
173    *  - georeferenced presentation of profile (3 points in line X,Y,Z)
174    * Create as many objects as many profiles in the file are defined.
175    * \param theFileName the path to file
176    * \return \c number of successfully imported profiles
177    */
178   static int ImportFromFile( const HYDROData_Document theDoc,
179                              const TCollection_AsciiString&    theFileName,
180                              NCollection_Sequence<int>&        theBadProfilesIds )
181   [int ( const Handle_HYDROData_Document& ,
182          const TCollection_AsciiString&    ,
183          NCollection_Sequence<int>&         )];
184   %MethodCode
185     Py_BEGIN_ALLOW_THREADS
186     sipRes = HYDROData_Profile::ImportFromFile( a0, *a1, a2 );
187     Py_END_ALLOW_THREADS
188   %End
189
190   /**
191    * Imports Profile data from file.
192    * \param theFileName the path to file
193    * \param theIsRead set to true if at least one non empty string was read from file
194    * \return \c true if file has been successfully read
195    */
196   virtual bool ImportFromFile( const TCollection_AsciiString& theFileName,
197                                bool*                          theIsRead = 0 );
198
199 protected:
200   /**
201    * Creates new object in the internal data structure. Use higher level objects 
202    * to create objects with real content.
203    */
204   HYDROData_Profile();
205
206   /**
207    * Destructs properties of the object and object itself, removes it from the document.
208    */
209   ~HYDROData_Profile();
210 };