1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * Tecorrec is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * Tecorrec is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with Tecorrec. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _tcChannelDem_h_
21 #define _tcChannelDem_h_
24 * @file tcChannelDem.h
25 * @brief An abstract image channel which needs access to the digital elevation model.
28 #include "tcChannel.h"
35 /// An abstract image channel which needs access to the digital elevation model.
36 class tcChannelDem
: public tcChannel
41 * Constructors + destructor
44 /// Primary constructor.
45 tcChannelDem(tcSrtmModel
* dem
, tcGeoImageData
* imagery
, const QString
& name
, const QString
& description
, bool depend1
= true, bool depend2
= false);
48 virtual ~tcChannelDem();
53 * Interface for derived classes to access elevation model data
56 // Main transformation
58 /// Get the geographical coordinate at a pixel.
59 tcGeo
geoAt(const maths::Vector
<2,float>& textureCoordinate
, tcGeoImageData
* imagery
= 0) const;
61 /// Get the texture coordinate at a geographical coordinate.
62 maths::Vector
<2,float> textureAt(const tcGeo
& geoCoordinate
, tcGeoImageData
* imagery
= 0) const;
66 /// Get the altitude at a geographical coordinate.
67 float altitudeAt(const tcGeo
& coordinate
, bool corrected
= false, bool* accurate
= 0) const;
69 /// Get the texture-space normal vector at a geographical coordinate.
70 maths::Vector
<3,float> normalAt(const tcGeo
& coordinate
, bool corrected
= false, bool* accurate
= 0) const;
72 /// Get the lighting direction vector at a geographical coordinate.
73 maths::Vector
<3,float> lightDirectionAt(const tcGeo
& coordinate
, tcGeoImageData
* imagery
= 0) const;
75 /// Find whether a point is lit by the light.
76 bool isLitAt(const tcGeo
& coordinate
, bool corrected
= false, bool* accurate
= 0, tcGeoImageData
* imagery
= 0) const;
78 /// Find how lit a point is by the light.
79 float litAt(const tcGeo
& coordinate
, bool corrected
= false, bool* accurate
= 0, tcGeoImageData
* imagery
= 0) const;
81 // Lower level accessors
83 /// Get the digital elevation model.
84 tcSrtmModel
* dem() const;
87 tcGeoImageData
* imagery() const;
95 /// Digital elevation model.
99 tcGeoImageData
* m_imagery
;