2 #ifndef HYDROData_Profile_HeaderFile
3 #define HYDROData_Profile_HeaderFile
5 #include "HYDROData_Object.h"
7 #include "HYDROData_ProfileUZ.h"
9 DEFINE_STANDARD_HANDLE(HYDROData_Profile, HYDROData_Object)
14 class Handle(HYDROData_Document);
16 /**\class HYDROData_Profile
17 * \brief Class that stores/retreives information about the profile.
19 class HYDROData_Profile : public HYDROData_Object
23 typedef gp_XYZ ProfilePoint;
24 typedef NCollection_Sequence<ProfilePoint> ProfilePoints;
28 * Enumeration of tags corresponding to the persistent object parameters.
32 DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
33 DataTag_FirstPoint, ///< first(left) point
34 DataTag_LastPoint, ///< last(right) point
35 DataTag_ChildProfileUZ, ///< child parametric profile
36 DataTag_FilePath ///< profile imported file path
40 DEFINE_STANDARD_RTTI(HYDROData_Profile);
43 * Returns the kind of this object. Must be redefined in all objects of known type.
45 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_PROFILE; }
48 * Returns the top shape of the object.
50 HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
53 * Returns the 3d shape of the object.
55 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
58 * Updates profile 3D presentation.
59 * Call this method whenever you made changes in data structure.
60 * This method does not called automatically since it may take a very long time.
62 HYDRODATA_EXPORT virtual void UpdateShape3D();
65 * Dump object to Python script representation.
67 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
71 * Check profile data and returns true if profile is valid.
72 * Validity is determined by:
73 * - First(left) and Last(right) point was set
74 * - Parametric points size is more than 1
76 HYDRODATA_EXPORT bool IsValid() const;
80 // Public methods to work with profile points.
83 * Set first(left) point for profile.
84 * \param thePoint the point
86 HYDRODATA_EXPORT void SetFirstPoint( const gp_XY& thePoint );
89 * Returns first(left) point of profile.
90 * \param thePoint[out] profile first point
91 * \return true if point has been set
93 HYDRODATA_EXPORT bool GetFirstPoint( gp_XY& thePoint ) const;
96 * Set last(right) point for profile.
97 * \param thePoint the point
99 HYDRODATA_EXPORT void SetLastPoint( const gp_XY& thePoint );
102 * Returns last(right) point of profile.
103 * \param thePoint[out] profile last point
104 * \return true if point has been set
106 HYDRODATA_EXPORT bool GetLastPoint( gp_XY& thePoint ) const;
110 * Returns object which store parametric presentation of profile points.
111 * \return profile U,Z
113 HYDRODATA_EXPORT Handle(HYDROData_ProfileUZ) GetProfileUZ( const bool theIsCreate = true ) const;
117 * Return number of profile points.
118 * \return number of points
120 HYDRODATA_EXPORT int NbPoints() const;
123 * Remove all profile points.
125 HYDRODATA_EXPORT void RemovePoints();
129 * Replace current profile parametric points by new one.
130 * \param thePoints the list with new points in parametric form
132 HYDRODATA_EXPORT void SetParametricPoints( const CurveCreator::Coordinates& theCoords );
135 * Returns profile points in parametric form.
136 * \return points list
138 HYDRODATA_EXPORT CurveCreator::Coordinates 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 HYDRODATA_EXPORT 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 HYDRODATA_EXPORT ProfilePoints GetProfilePoints() const;
157 // Public methods to work with files.
160 * Stores the profile file path
161 * \param theFilePath profile file path
163 HYDRODATA_EXPORT void SetFilePath( const TCollection_AsciiString& theFilePath );
166 * Returns uploaded profile file path
168 HYDRODATA_EXPORT 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 true if file has been successfully read
178 HYDRODATA_EXPORT static bool ImportFromFile( const Handle(HYDROData_Document)& theDoc,
179 const TCollection_AsciiString& theFileName );
182 * Imports Profile data from file.
183 * \param theFileName the path to file
184 * \return \c true if file has been successfully read
186 HYDRODATA_EXPORT virtual bool ImportFromFile( const TCollection_AsciiString& theFileName );
189 * Imports Profile data from file.
190 * \param theFile file to read
191 * \return \c true if file has been successfully read
193 HYDRODATA_EXPORT virtual bool ImportFromFile( OSD_File& theFile );
198 * Imports Profile data from parametric file.
200 bool importParametricFile( OSD_File& theFile,
201 CurveCreator::Coordinates& thePoints );
204 * Imports Profile data from Georeferenced file.
206 bool importGeoreferencedFile( OSD_File& theFile,
207 ProfilePoints& thePoints );
211 friend class HYDROData_Iterator;
214 * Creates new object in the internal data structure. Use higher level objects
215 * to create objects with real content.
220 * Destructs properties of the object and object itself, removes it from the document.
222 ~HYDROData_Profile();