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;
78 * Invalidate profile first and last points.
80 HYDRODATA_EXPORT void Invalidate();
84 // Public methods to work with profile points.
87 * Set first(left) point for profile.
88 * \param thePoint the point
90 HYDRODATA_EXPORT void SetFirstPoint( const gp_XY& thePoint );
93 * Returns first(left) point of profile.
94 * \param thePoint[out] profile first point
95 * \return true if point has been set
97 HYDRODATA_EXPORT bool GetFirstPoint( gp_XY& thePoint ) const;
100 * Set last(right) point for profile.
101 * \param thePoint the point
103 HYDRODATA_EXPORT void SetLastPoint( const gp_XY& thePoint );
106 * Returns last(right) point of profile.
107 * \param thePoint[out] profile last point
108 * \return true if point has been set
110 HYDRODATA_EXPORT bool GetLastPoint( gp_XY& thePoint ) const;
114 * Returns object which store parametric presentation of profile points.
115 * \return profile U,Z
117 HYDRODATA_EXPORT Handle(HYDROData_ProfileUZ) GetProfileUZ( const bool theIsCreate = true ) const;
121 * Return number of profile points.
122 * \return number of points
124 HYDRODATA_EXPORT int NbPoints() const;
127 * Remove all profile points.
129 HYDRODATA_EXPORT void RemovePoints();
133 * Replace current profile parametric points by new one.
134 * \param thePoints the list with new points in parametric form
136 HYDRODATA_EXPORT void SetParametricPoints( const HYDROData_ProfileUZ::PointsList& thePoints );
139 * Returns profile points in parametric form.
140 * \return points list
142 HYDRODATA_EXPORT HYDROData_ProfileUZ::PointsList GetParametricPoints() const;
146 * Replace current profile points by new one.
147 * First and last points will be automatically updated.
148 * \param thePoints the list with new profile points
150 HYDRODATA_EXPORT void SetProfilePoints( const ProfilePoints& thePoints );
153 * Returns profile points.
154 * Empty sequence is returned if first or last point was not set.
155 * \return profile points list
157 HYDRODATA_EXPORT ProfilePoints GetProfilePoints() const;
161 // Public methods to work with files.
164 * Stores the profile file path
165 * \param theFilePath profile file path
167 HYDRODATA_EXPORT void SetFilePath( const TCollection_AsciiString& theFilePath );
170 * Returns uploaded profile file path
172 HYDRODATA_EXPORT TCollection_AsciiString GetFilePath() const;
175 * Imports Profile data from file. The supported file types:
176 * - parametric presentation of profile (2 points in line U,Z)
177 * - georeferenced presentation of profile (3 points in line X,Y,Z)
178 * Create as many objects as many profiles in the file are defined.
179 * \param theFileName the path to file
180 * \return \c true if file has been successfully read
182 HYDRODATA_EXPORT static bool ImportFromFile( const Handle(HYDROData_Document)& theDoc,
183 const TCollection_AsciiString& theFileName );
186 * Imports Profile data from file.
187 * \param theFileName the path to file
188 * \return \c true if file has been successfully read
190 HYDRODATA_EXPORT virtual bool ImportFromFile( const TCollection_AsciiString& theFileName );
193 * Imports Profile data from file.
194 * \param theFile file to read
195 * \return \c true if file has been successfully read
197 HYDRODATA_EXPORT virtual bool ImportFromFile( OSD_File& theFile );
201 friend class HYDROData_Iterator;
204 * Creates new object in the internal data structure. Use higher level objects
205 * to create objects with real content.
210 * Destructs properties of the object and object itself, removes it from the document.
212 ~HYDROData_Profile();