Salome HOME
refs #430: incorrect coordinates in dump polyline
[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 class Handle_HYDROData_PolylineXY;
10
11 DEFINE_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
12
13
14 /**\class HYDROData_Bathymetry
15  * \brief Class that stores/retreives information about the Bathymetry.
16  *
17  * The Bathymetry represents measurement of the altitude of points on the terrain.
18  */
19 class HYDROData_Bathymetry : public HYDROData_IAltitudeObject
20 {
21 public:
22
23   typedef gp_XYZ                              AltitudePoint;
24   typedef NCollection_Sequence<AltitudePoint> AltitudePoints;
25
26 protected:
27
28   /**
29    * Enumeration of tags corresponding to the persistent object parameters.
30    */
31   enum DataTag
32   {
33     DataTag_First = HYDROData_IAltitudeObject::DataTag_First + 100, ///< first tag, to reserve
34     DataTag_AltitudePoints,    ///< altitude points, array of reals
35     DataTag_FilePath,          ///< bathymetry imported file path
36     DataTag_AltitudesInverted, ///< flag to invert z values
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    * Replace current altitude points by new one.
59    * \param thePoints the altitude points list
60    */
61   HYDRODATA_EXPORT virtual void             SetAltitudePoints( const AltitudePoints& thePoints );
62
63   /**
64    * Returns altitude points list.
65    * \return points list
66    */
67   HYDRODATA_EXPORT virtual AltitudePoints   GetAltitudePoints() const;
68
69   /**
70    * Remove all altitude points.
71    */
72   HYDRODATA_EXPORT virtual void             RemoveAltitudePoints();
73
74   /**
75    * Returns altitude for given point.
76    * \param thePoint the point to examine
77    * \return altitude value
78    */
79   HYDRODATA_EXPORT virtual double           GetAltitudeForPoint( const gp_XY& thePoint ) const;
80
81 public:
82   // Public methods to work with files.
83
84   /**
85    * Stores the bathymetry file path
86    * \param theFilePath image file path
87    */
88   HYDRODATA_EXPORT void                     SetFilePath( const TCollection_AsciiString& theFilePath );
89
90   /**
91    * Returns uploaded bathymetry file path
92    */
93   HYDRODATA_EXPORT TCollection_AsciiString  GetFilePath() const;
94
95   /**
96    * Set flag indicating needs to invert altitude values
97    * \param theIsInverted new invert value
98    * \param theIsUpdate flag indicating necessity to update points
99    */
100   HYDRODATA_EXPORT void                     SetAltitudesInverted( const bool theIsInverted,
101                                                                   const bool theIsUpdate = true );
102
103   /**
104    * Returns flag indicating needs to invert altitude values.
105    */
106   HYDRODATA_EXPORT bool                     IsAltitudesInverted() const;
107
108   /**
109    * Imports Bathymetry data from file. The supported file types:
110    *  - xyz
111    * \param theFileName the path to file
112    * \return \c true if file has been successfully read
113    */
114   HYDRODATA_EXPORT virtual bool             ImportFromFile( const TCollection_AsciiString& theFileName );
115
116   HYDRODATA_EXPORT Handle_HYDROData_PolylineXY CreateBoundaryPolyline() const;
117
118   HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
119
120 private:
121
122   /**
123    * Imports Bathymetry data from 'XYZ' file.
124    */
125   bool                                      importFromXYZFile( QFile&          theFile,
126                                                                AltitudePoints& thePoints ) const;
127
128 protected:
129
130   friend class HYDROData_Iterator;
131
132   /**
133    * Creates new object in the internal data structure. Use higher level objects 
134    * to create objects with real content.
135    */
136   HYDRODATA_EXPORT HYDROData_Bathymetry();
137
138   /**
139    * Destructs properties of the object and object itself, removes it from the document.
140    */
141   HYDRODATA_EXPORT ~HYDROData_Bathymetry();
142 };
143
144 #endif