Basic elevation optimisation channel
[tecorrec.git] / geo / tcSrtmModel.h
blob0db5df9f9ab035106c6dda85ae2a8ebeb1a789ed
1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
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. *
9 * *
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. *
14 * *
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 _tcSrtmModel_h_
21 #define _tcSrtmModel_h_
23 /**
24 * @file tcSrtmModel.h
25 * @brief SRTM elevation model.
28 #include "tcGeo.h"
29 #include <Vector.h>
31 #include <QObject>
33 class tcSrtmCache;
35 class QString;
37 /// SRTM elevation model.
38 class tcSrtmModel : public QObject
40 Q_OBJECT
42 public:
45 * Types
48 /// Render state.
49 class RenderState
51 public:
53 /// Number of longitudenal samples in the tile.
54 int samplesLon;
56 /// Number of latitudenal samples in the tile.
57 int samplesLat;
59 /// Is there more detail available longitudely.
60 bool moreAvailableLon;
62 /// Is there more detail available latitudely
63 bool moreAvailableLat;
65 private:
66 friend class tcSrtmModel;
68 /// South west corner of tile.
69 tcGeo swCorner;
71 /// North east corner of tile.
72 tcGeo neCorner;
74 /// Coordinate of most south westly sample inside tile.
75 tcGeo swSample;
77 /// Diagonal angles between samples.
78 tcGeo sampleDelta;
82 * Constructors + destructor
85 /// Default constructor.
86 tcSrtmModel();
88 /// Destructor.
89 virtual ~tcSrtmModel();
92 * Main interface
95 /** Get information to allow alignment with actual samples.
96 * @param swCorner South West corner of tile.
97 * @param neCorner North East corner of tile.
98 * @param state[out] Gets various information put into it to allow optimized rendering.
99 * @param maxSamples Maximum number of inner samples.
101 void sampleAlign(const tcGeo& swCorner, const tcGeo& neCorner, RenderState* state, int maxSamples = 0);
103 /// Get the altitude at a sample in a render state.
104 double altitudeAt(const RenderState& state, int x, int y, tcGeo* outCoord, bool corrected = false, bool* accurate = 0);
106 /// Get the altitude at a coordinate.
107 double altitudeAt(const tcGeo& coord, bool corrected = false, bool* accurate = 0);
109 /// Get the normal at a coordinate.
110 maths::Vector<3,float> normalAt(const tcGeo& coord, bool corrected = false, bool* accurate = 0);
112 /// Use raytracing to find whether a point is lit.
113 bool isLitAt(const tcGeo& coord, const maths::Vector<3,float>& light, bool corrected = false, bool* accurate = 0);
115 /// Use raytracing to find how lit a point is.
116 float litAt(const tcGeo& coord, const maths::Vector<3,float>& light, float angularRadius = 0.0f, bool corrected = false, bool* accurate = 0);
118 /// Set the data set to use.
119 void setDataSet(const QString& name);
121 signals:
124 * Signals
127 /// Emitted when the dataset is changed.
128 void dataSetChanged();
130 /// Progress notifier.
131 void progressing(const QString& progress);
133 private:
136 * Variables
139 /// SRTM cache.
140 tcSrtmCache* m_cache;
144 #endif