Basic elevation optimisation channel
[tecorrec.git] / geo / tcSrtmData.h
blob37a7ec8e627034d6a3e888eea580e7a474418cbd
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 _tcSrtmData_h_
21 #define _tcSrtmData_h_
23 /**
24 * @file tcSrtmData.h
25 * @brief Block of raw SRTM elevation data.
28 #include "tcGeo.h"
30 #include <QObject>
32 #include <inttypes.h>
34 class QFile;
35 class QString;
37 /// Block of raw SRTM elevation data.
38 class tcSrtmData : public QObject
40 Q_OBJECT
42 public:
45 * Constructors + destructor
48 /** Load SRTM data.
49 * @param lon Longitude in degrees.
50 * @param lat Latitude in degrees.
51 * @param file File to read data from.
53 tcSrtmData(int lon, int lat, QFile& file, QObject* progressObj, const char* progressMember);
55 /// Destructor.
56 virtual ~tcSrtmData();
59 * Accessors
62 /// Get the longitude in degrees.
63 int lon() const;
65 /// Get the latitude in degrees.
66 int lat() const;
68 /// Get the number of scan lines.
69 int lines() const;
71 /// Get the number of samples in each scan line.
72 int samples() const;
74 /// Find the geographical angles between samples.
75 tcGeo sampleResolution() const;
77 /// Get the geographical coordinate of a sample.
78 tcGeo sampleCoordinate(int line, int sample) const;
80 /// Does data exist for a sample?
81 bool sampleExists(int line, int sample) const;
83 /// Get the altitude at a sample (interpolating gaps).
84 uint16_t sampleAltitude(int line, int sample, bool corrected = false, bool* exists = 0) const;
86 /// Get the altitude at a coordinate.
87 float sampleAltitude(const tcGeo& coord, bool corrected = false, bool* exists = 0) const;
90 * Mutators
93 /// Correct the altitude at a sample.
94 void setSampleAltitude(int line, int sample, uint16_t altitude);
96 /// Fill voids using bilinear interpolation.
97 void fillVoidsBilinear();
99 /// Fill voids using bicubic interpolation.
100 void fillVoidsBicubic();
102 signals:
105 * Signals
108 /// Process notifier.
109 void progressing(const QString& message);
111 private:
114 * Private functions
117 /// Index into the data array.
118 unsigned int indexData(int corrected, int line, int sample) const;
120 private:
123 * Variables
126 /// Longitude in degrees.
127 int m_lat;
129 /// Latitude in degrees.
130 int m_lon;
132 /// Number of scan lines.
133 int m_lines;
135 /// Number of samples per scan line.
136 int m_samples;
138 /** Fixed resolution elevation data.
139 * Indexed by correction, scanline, sample.
140 * Most significant bit means that original data is missing.
142 uint16_t* m_data;
145 #endif