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)
13 class Handle(HYDROData_Document);
15 /**\class HYDROData_Profile
16 * \brief Class that stores/retreives information about the profile.
18 class HYDROData_Profile : public HYDROData_Object
22 typedef gp_XYZ ProfilePoint;
23 typedef NCollection_Sequence<ProfilePoint> ProfilePoints;
27 * Enumeration of tags corresponding to the persistent object parameters.
31 DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
32 DataTag_FirstPoint, ///< first(left) point
33 DataTag_LastPoint, ///< last(right) point
34 DataTag_ChildProfileUZ, ///< child parametric profile
35 DataTag_FilePath ///< profile imported file path
39 DEFINE_STANDARD_RTTI(HYDROData_Profile);
42 * Returns the kind of this object. Must be redefined in all objects of known type.
44 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_PROFILE; }
47 * Returns the top shape of the object.
49 HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
52 * Returns the 3d shape of the object.
54 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
57 * Updates profile 3D presentation.
58 * Call this method whenever you made changes in data structure.
59 * This method does not called automatically since it may take a very long time.
61 HYDRODATA_EXPORT virtual void UpdateShape3D();
64 * Dump object to Python script representation.
66 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
70 * Check profile data and returns true if profile is valid.
71 * Validity is determined by:
72 * - First(left) and Last(right) point was set
73 * - Parametric points size is more than 1
75 HYDRODATA_EXPORT bool IsValid() const;
79 // Public methods to work with profile points.
82 * Set first(left) point for profile.
83 * \param thePoint the point
85 HYDRODATA_EXPORT void SetFirstPoint( const gp_XY& thePoint );
88 * Returns first(left) point of profile.
89 * \param thePoint[out] profile first point
90 * \return true if point has been set
92 HYDRODATA_EXPORT bool GetFirstPoint( gp_XY& thePoint ) const;
95 * Set last(right) point for profile.
96 * \param thePoint the point
98 HYDRODATA_EXPORT void SetLastPoint( const gp_XY& thePoint );
101 * Returns last(right) point of profile.
102 * \param thePoint[out] profile last point
103 * \return true if point has been set
105 HYDRODATA_EXPORT bool GetLastPoint( gp_XY& thePoint ) const;
109 * Returns object which store parametric presentation of profile points.
110 * \return profile U,Z
112 HYDRODATA_EXPORT Handle(HYDROData_ProfileUZ) GetProfileUZ( const bool theIsCreate = true ) const;
116 * Return number of profile points.
117 * \return number of points
119 HYDRODATA_EXPORT int NbPoints() const;
122 * Remove all profile points.
124 HYDRODATA_EXPORT void RemovePoints();
128 * Replace current profile parametric points by new one.
129 * \param thePoints the list with new points in parametric form
131 HYDRODATA_EXPORT void SetParametricPoints( const HYDROData_ProfileUZ::PointsList& thePoints );
134 * Returns profile points in parametric form.
135 * \return points list
137 HYDRODATA_EXPORT HYDROData_ProfileUZ::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 HYDRODATA_EXPORT void SetProfilePoints( const 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_EXPORT ProfilePoints GetProfilePoints() const;
156 // Public methods to work with files.
159 * Stores the profile file path
160 * \param theFilePath profile file path
162 HYDRODATA_EXPORT void SetFilePath( const TCollection_AsciiString& theFilePath );
165 * Returns uploaded profile file path
167 HYDRODATA_EXPORT 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 true if file has been successfully read
177 HYDRODATA_EXPORT static bool ImportFromFile( const Handle(HYDROData_Document)& theDoc,
178 const TCollection_AsciiString& theFileName );
181 * Imports Profile data from file.
182 * \param theFileName the path to file
183 * \return \c true if file has been successfully read
185 HYDRODATA_EXPORT virtual bool ImportFromFile( const TCollection_AsciiString& theFileName );
188 * Imports Profile data from file.
189 * \param theFile file to read
190 * \return \c true if file has been successfully read
192 HYDRODATA_EXPORT virtual bool ImportFromFile( OSD_File& theFile );
197 * Imports Profile data from parametric file.
199 bool importParametricFile( OSD_File& theFile,
200 HYDROData_ProfileUZ::PointsList& thePoints );
203 * Imports Profile data from Georeferenced file.
205 bool importGeoreferencedFile( OSD_File& theFile,
206 ProfilePoints& thePoints );
210 friend class HYDROData_Iterator;
213 * Creates new object in the internal data structure. Use higher level objects
214 * to create objects with real content.
219 * Destructs properties of the object and object itself, removes it from the document.
221 ~HYDROData_Profile();