iLand
dem.h
Go to the documentation of this file.
1/********************************************************************************************
2** iLand - an individual based forest landscape and disturbance model
3** http://iland-model.org
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
20#ifndef DEM_H
21#define DEM_H
22#include "grid.h"
39class DEM: public FloatGrid
40{
41public:
42 DEM(const QString &fileName) { loadFromFile(fileName); }
43 bool loadFromFile(const QString &fileName);
44 // create and fill grids for aspect/slope
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; }
49 // special functions for DEM
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()); }
55 float direction(const float x, const float y);
56 float slope(const float x, const float y);
58 float orientation(const QPointF &point, float &rslope_angle, float &rslope_aspect) const;
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
63private:
64 mutable FloatGrid aspect_grid;
65 mutable FloatGrid slope_grid;
66 mutable FloatGrid view_grid;
67};
68
69#endif // DEM_H
DEM is a digital elevation model class.
Definition: dem.h:40
float slope(const float x, const float y)
const FloatGrid * viewGrid() const
Definition: dem.h:48
float orientation(const QPointF &point, float &rslope_angle, float &rslope_aspect) const
get orientation at specific point (x,y) and height
Definition: dem.cpp:127
float elevation(const QPointF p) const
Definition: dem.h:52
DEM(const QString &fileName)
Definition: dem.h:42
const FloatGrid * aspectGrid() const
Definition: dem.h:46
bool loadFromFile(const QString &fileName)
loads a DEM from a ESRI style text file.
Definition: dem.cpp:52
const FloatGrid * slopeGrid() const
Definition: dem.h:47
float elevation(const float x, const float y) const
get the elevation (m) at point (x/y)
Definition: dem.h:51
void createSlopeGrid() const
Definition: dem.cpp:162
float direction(const float x, const float y)
get the direction of the slope at point (x/y) if the slope at the point is 0, "north" (0) is returned...
float orientation(const float x, const float y, float &rslope_angle, float &rslope_aspect)
Definition: dem.h:59
const float & constValueAt(const QPointF &posf) const
value at position defined by metric coordinates (QPointF)
Definition: grid.h:337