Salome HOME
f7bc599fa5dddbed8880f0bc829121ed00e0d87d
[modules/hydro.git] / src / HYDROData / HYDROData_Bathymetry.h
1
2 #ifndef HYDROData_Bathymetry_HeaderFile
3 #define HYDROData_Bathymetry_HeaderFile
4
5 #include "HYDROData_IAltitudeObject.h"
6
7 class QFile;
8 class gp_XYZ;
9
10 DEFINE_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
11
12
13 /**\class HYDROData_Bathymetry
14  * \brief Class that stores/retreives information about the Bathymetry.
15  *
16  * The Bathymetry represents measurement of the altitude of points on the terrain.
17  */
18 class HYDROData_Bathymetry : public HYDROData_IAltitudeObject
19 {
20 public:
21
22   typedef gp_XYZ               AltitudePoint;
23   typedef QList<AltitudePoint> AltitudePoints;
24
25 protected:
26
27   /**
28    * Enumeration of tags corresponding to the persistent object parameters.
29    */
30   enum DataTag
31   {
32     DataTag_First = HYDROData_IAltitudeObject::DataTag_First + 100, ///< first tag, to reserve
33     DataTag_AltitudePoints, ///< altitude points, array of reals
34     DataTag_FilePath        ///< bathymetry imported file path
35   };
36
37 public:
38
39   DEFINE_STANDARD_RTTI(HYDROData_Bathymetry);
40
41   /**
42    * Returns the kind of this object. Must be redefined in all objects of known type.
43    */
44   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_BATHYMETRY; }
45
46
47   /**
48    * Dump Bathymetry object to Python script representation.
49    */
50   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
51
52 public:      
53   // Public methods to work with Bathymetry altitudes.
54
55   /**
56    * Replace current altitude points by new one.
57    * \param thePoints the altitude points list
58    */
59   HYDRODATA_EXPORT virtual void             SetAltitudePoints( const AltitudePoints& thePoints );
60
61   /**
62    * Returns altitude points list.
63    * \return points list
64    */
65   HYDRODATA_EXPORT virtual AltitudePoints   GetAltitudePoints() const;
66
67   /**
68    * Remove all altitude points.
69    */
70   HYDRODATA_EXPORT virtual void             RemoveAltitudePoints();
71
72   /**
73    * Returns altitude for given point.
74    * \param thePoint the point to examine
75    * \return altitude value
76    */
77   HYDRODATA_EXPORT virtual double           GetAltitudeForPoint( const gp_XY& thePoint ) const;
78
79   using HYDROData_IAltitudeObject::GetAltitudeForPoint;  
80
81
82 public:
83   // Public methods to work with files.
84
85   /**
86    * Stores the bathymetry file path
87    * \param theFilePath image file path
88    */
89   HYDRODATA_EXPORT void                     SetFilePath( const QString& theFilePath );
90
91   /**
92    * Returns uploaded bathymetry file path
93    */
94   HYDRODATA_EXPORT QString                  GetFilePath() const;
95
96   /**
97    * Imports Bathymetry data from file. The supported file types:
98    *  - xyz
99    * \param theFileName the path to file
100    * \return \c true if file has been successfully read
101    */
102   HYDRODATA_EXPORT virtual bool             ImportFromFile( const QString& theFileName );
103
104
105 private:
106
107   /**
108    * Imports Bathymetry data from 'XYZ' file.
109    */
110   bool                                      importFromXYZFile( QFile&          theFile,
111                                                                AltitudePoints& thePoints );
112
113 protected:
114
115   friend class HYDROData_Iterator;
116
117   /**
118    * Creates new object in the internal data structure. Use higher level objects 
119    * to create objects with real content.
120    */
121   HYDROData_Bathymetry();
122
123   /**
124    * Destructs properties of the object and object itself, removes it from the document.
125    */
126   ~HYDROData_Bathymetry();
127 };
128
129 #endif