1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #include "HYDROData_Profile.h"
27 class HYDROData_Profile : public HYDROData_Object
30 #include "HYDROData_Profile.h"
35 * Returns default filling color for new profile.
37 static QColor DefaultFillingColor();
40 * Returns default border color for new profile.
42 static QColor DefaultBorderColor();
48 * Check profile data and returns true if profile is valid.
49 * Validity is determined by:
50 * - First(left) and Last(right) point was set
51 * - Parametric points size is more than 1
56 * Invalidate profile first and last points.
62 // Public methods to work with profile points.
65 * Set first(left) point for profile.
66 * \param thePoint the point
68 void SetLeftPoint( const QPointF& thePoint ) [void (const gp_XY&)];
71 // The C++ API gets the gp_XY object, we convert it from QPointF.
72 gp_XY aPoint( a0->x(), a0->y() );
74 Py_BEGIN_ALLOW_THREADS
77 sipCpp->HYDROData_Profile::SetLeftPoint( aPoint );
81 sipCpp->SetLeftPoint( aPoint );
87 * Returns first(left) point of profile.
88 * \param thePoint[out] profile first point
89 * \return true if point has been set
91 bool GetLeftPoint( QPointF& thePoint ) const [bool (gp_XY&)];
94 // The C++ API gets the gp_XY object, then we convert it to QPointF.
97 Py_BEGIN_ALLOW_THREADS
98 sipRes = sipSelfWasArg ? sipCpp->HYDROData_Profile::GetLeftPoint( aPoint ) :
99 sipCpp->GetLeftPoint( aPoint );
102 a0->SetX( aPoint.X() );
103 a0->SetY( aPoint.Y() );
107 * Set last(right) point for profile.
108 * \param thePoint the point
110 void SetRightPoint( const QPointF& thePoint ) [void (const gp_XY&)];
113 // The C++ API gets the gp_XY object, we convert it from QPointF.
114 gp_XY aPoint( a0->x(), a0->y() );
116 Py_BEGIN_ALLOW_THREADS
118 sipCpp->HYDROData_Profile::SetRightPoint( aPoint );
122 sipCpp->SetRightPoint( aPoint );
128 * Returns last(right) point of profile.
129 * \param thePoint[out] profile last point
130 * \return true if point has been set
132 bool GetRightPoint( QPointF& thePoint ) const [bool (gp_XY&)];
135 // The C++ API gets the gp_XY object, then we convert it to QPointF.
138 Py_BEGIN_ALLOW_THREADS
139 sipRes = sipSelfWasArg ? sipCpp->HYDROData_Profile::GetRightPoint( aPoint ) :
140 sipCpp->GetRightPoint( aPoint );
143 a0->SetX( aPoint.X() );
144 a0->SetY( aPoint.Y() );
149 * Returns object which store parametric presentation of profile points.
150 * \return profile U,Z
152 HYDROData_ProfileUZ GetProfileUZ( const bool theIsCreate = true ) const
153 [Handle_HYDROData_ProfileUZ ( const bool theIsCreate = true )];
156 Handle(HYDROData_ProfileUZ) aRefProfileUZ;
158 Py_BEGIN_ALLOW_THREADS
159 aRefProfileUZ = sipSelfWasArg ? sipCpp->HYDROData_ImmersibleZone::GetProfileUZ() :
160 sipCpp->GetProfileUZ();
163 sipRes = (HYDROData_ProfileUZ*)createPointer( aRefProfileUZ );
169 * Return number of profile points.
170 * \return number of points
172 int NbPoints() const;
175 * Remove all profile points.
181 * Replace current profile parametric points by new one.
182 * \param thePoints the list with new points in parametric form
184 void SetParametricPoints( SIP_PYLIST thePoints ) [void ( const HYDROData_ProfileUZ::PointsList& )];
187 * Returns profile points in parametric form.
188 * \return points list
190 SIP_PYLIST GetParametricPoints() const [HYDROData_ProfileUZ::PointsList ()];
194 * Replace current profile points by new one.
195 * First and last points will be automatically updated.
196 * \param thePoints the list with new profile points
198 void SetProfilePoints( const SIP_PYLIST thePoints ) [void ( const ProfilePoints& )];
201 * Returns profile points.
202 * Empty sequence is returned if first or last point was not set.
203 * \return profile points list
205 SIP_PYLIST GetProfilePoints() const [ProfilePoints ()];
209 // Public methods to work with files.
212 * Stores the profile file path
213 * \param theFilePath profile file path
215 void SetFilePath( const QString& theFilePath ) [void ( const TCollection_AsciiString& )];
218 * Returns uploaded profile file path
220 QString GetFilePath() const [TCollection_AsciiString ()];
223 * Imports Profile data from file. The supported file types:
224 * - parametric presentation of profile (2 points in line U,Z)
225 * - georeferenced presentation of profile (3 points in line X,Y,Z)
226 * Create as many objects as many profiles in the file are defined.
227 * \param theFileName the path to file
228 * \return \c true if file has been successfully read
230 static bool ImportFromFile( HYDROData_Document theDoc,
231 const QString& theFileName )
232 [bool ( const Handle_HYDROData_Document&,
233 const TCollection_AsciiString& )];
236 * Imports Profile data from file.
237 * \param theFileName the path to file
238 * \return \c true if file has been successfully read
240 virtual bool ImportFromFile( const QString& theFileName ) [ bool ( const TCollection_AsciiString& ) ];
243 * Imports Profile data from file.
244 * \param theFile file to read
245 * \return \c true if file has been successfully read
247 // virtual bool ImportFromFile( OSD_File& theFile );
251 * Creates new object in the internal data structure. Use higher level objects
252 * to create objects with real content.
257 * Destructs properties of the object and object itself, removes it from the document.
259 ~HYDROData_Profile();