Salome HOME
95af7420ea73536f7275112f7badb93425217345
[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 #include "HYDROData_QuadtreeNode.hxx"
7
8 class QFile;
9 class gp_XYZ;
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   HYDRODATA_EXPORT virtual HYDROData_QuadtreeNode* GetQuadtreeNodes() const;
69
70   /**
71    * Remove all altitude points.
72    */
73   HYDRODATA_EXPORT virtual void             RemoveAltitudePoints();
74
75   /**
76    * Returns altitude for given point.
77    * \param thePoint the point to examine
78    * \return altitude value
79    */
80   HYDRODATA_EXPORT virtual double           GetAltitudeForPoint( const gp_XY& thePoint ) const;
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 TCollection_AsciiString& theFilePath );
90
91   /**
92    * Returns uploaded bathymetry file path
93    */
94   HYDRODATA_EXPORT TCollection_AsciiString  GetFilePath() const;
95
96   /**
97    * Set flag indicating needs to invert altitude values
98    * \param theIsInverted new invert value
99    * \param theIsUpdate flag indicating necessity to update points
100    */
101   HYDRODATA_EXPORT void                     SetAltitudesInverted( const bool theIsInverted,
102                                                                   const bool theIsUpdate = true );
103
104   /**
105    * Returns flag indicating needs to invert altitude values.
106    */
107   HYDRODATA_EXPORT bool                     IsAltitudesInverted() 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 TCollection_AsciiString& theFileName );
116
117   HYDRODATA_EXPORT bool CreateBoundaryPolyline() const;
118
119 private:
120
121   /**
122    * Imports Bathymetry data from 'XYZ' file.
123    */
124   bool                                      importFromXYZFile( QFile&          theFile,
125                                                                AltitudePoints& thePoints ) const;
126   static std::map<int, HYDROData_QuadtreeNode*> myQuadtrees;
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