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