Salome HOME
QStrings changed to cascade ascii strings.
[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 NCollection_Sequence<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     DataTag_AltitudesInverted, ///< flag to invert z values
36   };
37
38 public:
39
40   DEFINE_STANDARD_RTTI(HYDROData_Bathymetry);
41
42   /**
43    * Returns the kind of this object. Must be redefined in all objects of known type.
44    */
45   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_BATHYMETRY; }
46
47
48   /**
49    * Dump Bathymetry object to Python script representation.
50    */
51   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
52
53 public:      
54   // Public methods to work with Bathymetry altitudes.
55
56   /**
57    * Replace current altitude points by new one.
58    * \param thePoints the altitude points list
59    */
60   HYDRODATA_EXPORT virtual void             SetAltitudePoints( const AltitudePoints& thePoints );
61
62   /**
63    * Returns altitude points list.
64    * \return points list
65    */
66   HYDRODATA_EXPORT virtual AltitudePoints   GetAltitudePoints() const;
67
68   /**
69    * Remove all altitude points.
70    */
71   HYDRODATA_EXPORT virtual void             RemoveAltitudePoints();
72
73   /**
74    * Returns altitude for given point.
75    * \param thePoint the point to examine
76    * \return altitude value
77    */
78   HYDRODATA_EXPORT virtual double           GetAltitudeForPoint( const gp_XY& thePoint ) const;
79
80 public:
81   // Public methods to work with files.
82
83   /**
84    * Stores the bathymetry file path
85    * \param theFilePath image file path
86    */
87   HYDRODATA_EXPORT void                     SetFilePath( const TCollection_AsciiString& theFilePath );
88
89   /**
90    * Returns uploaded bathymetry file path
91    */
92   HYDRODATA_EXPORT TCollection_AsciiString  GetFilePath() const;
93
94   /**
95    * Set flag indicating needs to invert altitude values
96    * \param theIsInverted new invert value
97    * \param theIsUpdate flag indicating necessity to update points
98    */
99   HYDRODATA_EXPORT void                     SetAltitudesInverted( const bool theIsInverted,
100                                                                   const bool theIsUpdate = true );
101
102   /**
103    * Returns flag indicating needs to invert altitude values.
104    */
105   HYDRODATA_EXPORT bool                     IsAltitudesInverted() const;
106
107   /**
108    * Imports Bathymetry data from file. The supported file types:
109    *  - xyz
110    * \param theFileName the path to file
111    * \return \c true if file has been successfully read
112    */
113   HYDRODATA_EXPORT virtual bool             ImportFromFile( const TCollection_AsciiString& theFileName );
114
115   HYDRODATA_EXPORT bool CreateBoundaryPolyline() const;
116
117 private:
118
119   /**
120    * Imports Bathymetry data from 'XYZ' file.
121    */
122   bool                                      importFromXYZFile( QFile&          theFile,
123                                                                AltitudePoints& thePoints ) const;
124
125 protected:
126
127   friend class HYDROData_Iterator;
128
129   /**
130    * Creates new object in the internal data structure. Use higher level objects 
131    * to create objects with real content.
132    */
133   HYDRODATA_EXPORT HYDROData_Bathymetry();
134
135   /**
136    * Destructs properties of the object and object itself, removes it from the document.
137    */
138   HYDRODATA_EXPORT ~HYDROData_Bathymetry();
139 };
140
141 #endif