tecorrec: Check for OpenGL and add includes/libs
[tecorrec.git] / geo / tcSrtmModel.h
bloba11a1405f877865ed76a3d7529761849fc27ebf5
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;
34 class tcElevationData;
36 class QString;
38 /// SRTM elevation model.
39 class tcSrtmModel : public QObject
41 Q_OBJECT
43 public:
46 * Types
49 /// Render state.
50 class RenderState
52 public:
54 /// Number of longitudenal samples in the tile.
55 int samplesLon;
57 /// Number of latitudenal samples in the tile.
58 int samplesLat;
60 /// Is there more detail available longitudely.
61 bool moreAvailableLon;
63 /// Is there more detail available latitudely
64 bool moreAvailableLat;
66 private:
67 friend class tcSrtmModel;
69 /// South west corner of tile.
70 tcGeo swCorner;
72 /// North east corner of tile.
73 tcGeo neCorner;
75 /// Coordinate of most south westly sample inside tile.
76 tcGeo swSample;
78 /// Diagonal angles between samples.
79 tcGeo sampleDelta;
83 * Constructors + destructor
86 /// Default constructor.
87 tcSrtmModel();
89 /// Destructor.
90 virtual ~tcSrtmModel();
93 * Main interface
96 /** Get information to allow alignment with actual samples.
97 * @param swCorner South West corner of tile.
98 * @param neCorner North East corner of tile.
99 * @param state[out] Gets various information put into it to allow optimized rendering.
100 * @param maxSamples Maximum number of inner samples.
102 void sampleAlign(const tcGeo& swCorner, const tcGeo& neCorner, RenderState* state, int maxSamples = 0);
104 /// Get the altitude at a sample in a render state.
105 double altitudeAt(const RenderState& state, int x, int y, tcGeo* outCoord, bool corrected = false, bool* accurate = 0);
107 /// Get the altitude at a coordinate.
108 double altitudeAt(const tcGeo& coord, bool corrected = false, bool* accurate = 0);
110 /// Get the normal at a coordinate.
111 maths::Vector<3,float> normalAt(const tcGeo& coord, bool corrected = false, bool* accurate = 0);
113 /// Use raytracing to find whether a point is lit.
114 bool isLitAt(const tcGeo& coord, const maths::Vector<3,float>& light, bool corrected = false, bool* accurate = 0);
116 /// Use raytracing to find how lit a point is.
117 float litAt(const tcGeo& coord, const maths::Vector<3,float>& light, float angularRadius = 0.0f, bool corrected = false, bool* accurate = 0);
119 /// Set the data set to use.
120 void setDataSet(const QString& name);
122 /// Update any samples affected by the elevation field.
123 void updateFromElevationData(const tcElevationData* elevation);
125 signals:
128 * Signals
131 /// Emitted when the dataset is changed.
132 void dataSetChanged();
134 /// Progress notifier.
135 void progressing(const QString& progress);
137 private:
140 * Variables
143 /// Elevation dataset.
144 tcSrtmCache* m_cache;
147 #endif