1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "HYDROData_Profile.h"
23 class HYDROData_Profile : public HYDROData_Object
26 #include "HYDROData_Profile.h"
30 typedef gp_XYZ ProfilePoint;
31 typedef NCollection_Sequence<gp_XYZ> ProfilePoints;
35 * Returns default filling color for new profile.
37 virtual QColor DefaultFillingColor() const;
40 * Returns default border color for new profile.
42 virtual QColor DefaultBorderColor() const;
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 gp_XY& thePoint );
71 * Returns first(left) point of profile.
72 * \param thePoint[out] profile first point
73 * \return true if point has been set
75 bool GetLeftPoint( gp_XY& thePoint ) const;
78 * Set last(right) point for profile.
79 * \param thePoint the point
81 void SetRightPoint( const gp_XY& thePoint );
84 * Returns last(right) point of profile.
85 * \param thePoint[out] profile last point
86 * \return true if point has been set
88 bool GetRightPoint( gp_XY& thePoint ) const;
92 * Returns object which store parametric presentation of profile points.
95 HYDROData_ProfileUZ GetProfileUZ( const bool theIsCreate = true ) const
96 [Handle_HYDROData_ProfileUZ ( const bool theIsCreate = true )];
99 Handle(HYDROData_ProfileUZ) aRefProfileUZ;
101 Py_BEGIN_ALLOW_THREADS
102 aRefProfileUZ = sipSelfWasArg ? sipCpp->HYDROData_Profile::GetProfileUZ() :
103 sipCpp->GetProfileUZ();
106 sipRes = (HYDROData_ProfileUZ*)createPointer( aRefProfileUZ );
112 * Return number of profile points.
113 * \return number of points
115 int NbPoints() const;
118 * Remove all profile points.
124 * Replace current profile parametric points by new one.
125 * \param thePoints the list with new points in parametric form
127 void SetParametricPoints( const HYDROData_IPolyline::PointsList& thePoints );
130 * Returns profile points in parametric form.
131 * \return points list
133 HYDROData_IPolyline::PointsList GetParametricPoints() const;
137 * Replace current profile points by new one.
138 * First and last points will be automatically updated.
139 * \param thePoints the list with new profile points
141 void SetProfilePoints( const HYDROData_Profile::ProfilePoints thePoints );
144 * Returns profile points.
145 * Empty sequence is returned if first or last point was not set.
146 * \return profile points list
148 HYDROData_Profile::ProfilePoints GetProfilePoints() const;
152 // Public methods to work with files.
155 * Stores the profile file path
156 * \param theFilePath profile file path
158 void SetFilePath( const TCollection_AsciiString& theFilePath );
161 * Returns uploaded profile file path
163 TCollection_AsciiString GetFilePath() const;
166 * Imports Profile data from file. The supported file types:
167 * - parametric presentation of profile (2 points in line U,Z)
168 * - georeferenced presentation of profile (3 points in line X,Y,Z)
169 * Create as many objects as many profiles in the file are defined.
170 * \param theFileName the path to file
171 * \return \c number of successfully imported profiles
173 static int ImportFromFile( HYDROData_Document theDoc,
174 const TCollection_AsciiString& theFileName,
175 NCollection_Sequence<int>& theBadProfilesIds,
176 bool isToProject = true )
177 [int ( const Handle_HYDROData_Document&,
178 const TCollection_AsciiString&,
179 NCollection_Sequence<int>& )];
181 Py_BEGIN_ALLOW_THREADS
182 sipRes = HYDROData_Profile::ImportFromFile( a0, *a1, *a2, a3 );
187 * Imports Profile data from file.
188 * \param theFileName the path to file
189 * \param theIsRead set to true if at least one non empty string was read from file
190 * \return \c true if file has been successfully read
192 virtual bool ImportFromFile( const TCollection_AsciiString& theFileName,
193 bool isToProject = true,
194 bool* isNotEmpty = 0 );
198 * Creates new object in the internal data structure. Use higher level objects
199 * to create objects with real content.
204 * Destructs properties of the object and object itself, removes it from the document.
206 ~HYDROData_Profile();