Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
671 | werner | 1 | /******************************************************************************************** |
2 | ** iLand - an individual based forest landscape and disturbance model |
||
3 | ** http://iland.boku.ac.at |
||
4 | ** Copyright (C) 2009- Werner Rammer, Rupert Seidl |
||
5 | ** |
||
6 | ** This program is free software: you can redistribute it and/or modify |
||
7 | ** it under the terms of the GNU General Public License as published by |
||
8 | ** the Free Software Foundation, either version 3 of the License, or |
||
9 | ** (at your option) any later version. |
||
10 | ** |
||
11 | ** This program is distributed in the hope that it will be useful, |
||
12 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
13 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
14 | ** GNU General Public License for more details. |
||
15 | ** |
||
16 | ** You should have received a copy of the GNU General Public License |
||
17 | ** along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
18 | ********************************************************************************************/ |
||
19 | |||
642 | werner | 20 | #ifndef DEM_H |
21 | #define DEM_H |
||
22 | #include "grid.h" |
||
23 | /** DEM is a digital elevation model class. |
||
697 | werner | 24 | @ingroup tools |
642 | werner | 25 | It uses a float grid internally. |
26 | slope is calculated in "%", i.e. a value of 1 is 45° (90° -> inf) |
||
27 | |||
28 | The aspect angles are defined as follows (like ArcGIS): |
||
29 | 0° |
||
30 | N |
||
31 | 270° W x E 90° |
||
32 | S |
||
33 | 180° |
||
34 | |||
654 | werner | 35 | Values for height of -1 indicate "out of scope", "invalid" values |
36 | |||
642 | werner | 37 | */ |
38 | |||
39 | class DEM: public FloatGrid |
||
40 | { |
||
41 | public: |
||
42 | DEM(const QString &fileName) { loadFromFile(fileName); } |
||
43 | bool loadFromFile(const QString &fileName); |
||
44 | // create and fill grids for aspect/slope |
||
1009 | werner | 45 | void createSlopeGrid() const; |
46 | const FloatGrid *aspectGrid() const { createSlopeGrid(); return &aspect_grid; } |
||
47 | const FloatGrid *slopeGrid() const { createSlopeGrid(); return &slope_grid; } |
||
48 | const FloatGrid *viewGrid() const { createSlopeGrid(); return &view_grid; } |
||
642 | werner | 49 | // special functions for DEM |
50 | /// get the elevation (m) at point (x/y) |
||
654 | werner | 51 | float elevation(const float x, const float y) const { return constValueAt(x,y); } |
52 | float elevation(const QPointF p) const { return constValueAt(p.x(),p.y()); } |
||
642 | werner | 53 | /// get the direction of the slope at point (x/y) |
54 | /// if the slope at the point is 0, "north" (0) is returned. |
||
55 | float direction(const float x, const float y); |
||
56 | float slope(const float x, const float y); |
||
57 | /// get orientation at specific point (x,y) and height |
||
1009 | werner | 58 | float orientation(const QPointF &point, float &rslope_angle, float &rslope_aspect) const; |
642 | werner | 59 | float orientation(const float x, const float y, float &rslope_angle, float &rslope_aspect) |
60 | { return orientation(QPointF(x,y), rslope_angle, rslope_aspect); } |
||
61 | |||
62 | |||
63 | private: |
||
1009 | werner | 64 | mutable FloatGrid aspect_grid; |
65 | mutable FloatGrid slope_grid; |
||
66 | mutable FloatGrid view_grid; |
||
642 | werner | 67 | }; |
68 | |||
69 | #endif // DEM_H |