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
31 typedef gp_XYZ ProfilePoint;
32 typedef NCollection_Sequence<gp_XYZ> ProfilePoints;
35 #include "HYDROData_Profile.h"
40 * Returns default filling color for new profile.
42 static QColor DefaultFillingColor();
45 * Returns default border color for new profile.
47 static QColor DefaultBorderColor();
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
61 * Invalidate profile first and last points.
67 // Public methods to work with profile points.
70 * Set first(left) point for profile.
71 * \param thePoint the point
73 void SetLeftPoint( const gp_XY& thePoint );
76 * Returns first(left) point of profile.
77 * \param thePoint[out] profile first point
78 * \return true if point has been set
80 bool GetLeftPoint( gp_XY& thePoint ) const;
83 * Set last(right) point for profile.
84 * \param thePoint the point
86 void SetRightPoint( const gp_XY& thePoint );
89 * Returns last(right) point of profile.
90 * \param thePoint[out] profile last point
91 * \return true if point has been set
93 bool GetRightPoint( gp_XY& thePoint ) const;
97 * Returns object which store parametric presentation of profile points.
100 HYDROData_ProfileUZ GetProfileUZ( const bool theIsCreate = true ) const
101 [Handle_HYDROData_ProfileUZ ( const bool theIsCreate = true )];
104 Handle(HYDROData_ProfileUZ) aRefProfileUZ;
106 Py_BEGIN_ALLOW_THREADS
107 aRefProfileUZ = sipSelfWasArg ? sipCpp->HYDROData_Profile::GetProfileUZ() :
108 sipCpp->GetProfileUZ();
111 sipRes = (HYDROData_ProfileUZ*)createPointer( aRefProfileUZ );
117 * Return number of profile points.
118 * \return number of points
120 int NbPoints() const;
123 * Remove all profile points.
129 * Replace current profile parametric points by new one.
130 * \param thePoints the list with new points in parametric form
132 void SetParametricPoints( const HYDROData_IPolyline::PointsList& thePoints );
135 * Returns profile points in parametric form.
136 * \return points list
138 HYDROData_IPolyline::PointsList GetParametricPoints() const;
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
146 void SetProfilePoints( const ProfilePoints thePoints );
149 * Returns profile points.
150 * Empty sequence is returned if first or last point was not set.
151 * \return profile points list
153 ProfilePoints GetProfilePoints() const;
157 // Public methods to work with files.
160 * Stores the profile file path
161 * \param theFilePath profile file path
163 void SetFilePath( const TCollection_AsciiString& theFilePath );
166 * Returns uploaded profile file path
168 TCollection_AsciiString GetFilePath() const;
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
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>& )];
185 Py_BEGIN_ALLOW_THREADS
186 sipRes = HYDROData_Profile::ImportFromFile( a0, *a1, a2 );
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
196 virtual bool ImportFromFile( const TCollection_AsciiString& theFileName,
197 bool* theIsRead = 0 );
201 * Creates new object in the internal data structure. Use higher level objects
202 * to create objects with real content.
207 * Destructs properties of the object and object itself, removes it from the document.
209 ~HYDROData_Profile();