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