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"
34 typedef gp_XYZ ProfilePoint;
35 typedef NCollection_Sequence<gp_XYZ> ProfilePoints;
39 * Returns default filling color for new profile.
41 static QColor DefaultFillingColor();
44 * Returns default border color for new profile.
46 static QColor DefaultBorderColor();
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
60 * Invalidate profile first and last points.
66 // Public methods to work with profile points.
69 * Set first(left) point for profile.
70 * \param thePoint the point
72 void SetLeftPoint( const gp_XY& thePoint );
75 * Returns first(left) point of profile.
76 * \param thePoint[out] profile first point
77 * \return true if point has been set
79 bool GetLeftPoint( gp_XY& thePoint ) const;
82 * Set last(right) point for profile.
83 * \param thePoint the point
85 void SetRightPoint( const gp_XY& thePoint );
88 * Returns last(right) point of profile.
89 * \param thePoint[out] profile last point
90 * \return true if point has been set
92 bool GetRightPoint( gp_XY& thePoint ) const;
96 * Returns object which store parametric presentation of profile points.
99 HYDROData_ProfileUZ GetProfileUZ( const bool theIsCreate = true ) const
100 [Handle_HYDROData_ProfileUZ ( const bool theIsCreate = true )];
103 Handle(HYDROData_ProfileUZ) aRefProfileUZ;
105 Py_BEGIN_ALLOW_THREADS
106 aRefProfileUZ = sipSelfWasArg ? sipCpp->HYDROData_Profile::GetProfileUZ() :
107 sipCpp->GetProfileUZ();
110 sipRes = (HYDROData_ProfileUZ*)createPointer( aRefProfileUZ );
116 * Return number of profile points.
117 * \return number of points
119 int NbPoints() const;
122 * Remove all profile points.
128 * Replace current profile parametric points by new one.
129 * \param thePoints the list with new points in parametric form
131 void SetParametricPoints( const HYDROData_IPolyline::PointsList& thePoints );
134 * Returns profile points in parametric form.
135 * \return points list
137 HYDROData_IPolyline::PointsList GetParametricPoints() const;
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
145 void SetProfilePoints( const HYDROData_Profile::ProfilePoints thePoints );
148 * Returns profile points.
149 * Empty sequence is returned if first or last point was not set.
150 * \return profile points list
152 HYDROData_Profile::ProfilePoints GetProfilePoints() const;
156 // Public methods to work with files.
159 * Stores the profile file path
160 * \param theFilePath profile file path
162 void SetFilePath( const TCollection_AsciiString& theFilePath );
165 * Returns uploaded profile file path
167 TCollection_AsciiString GetFilePath() const;
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
177 static int ImportFromFile( 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>& )];
184 Py_BEGIN_ALLOW_THREADS
185 sipRes = HYDROData_Profile::ImportFromFile( a0, *a1, *a2 );
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
195 virtual bool ImportFromFile( const TCollection_AsciiString& theFileName,
196 bool* theIsRead = 0 );
200 * Creates new object in the internal data structure. Use higher level objects
201 * to create objects with real content.
206 * Destructs properties of the object and object itself, removes it from the document.
208 ~HYDROData_Profile();