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 ***************************************************************************/
25 * @brief Manages data for a globe.
28 #include "tcSrtmModel.h"
36 /** Manages data for a globe.
37 * Holds terrain elevation and imagery data.
58 ElevationSampleAlignment
62 * Constructors + destructor
65 /// Primary constructor.
66 tcGlobe(double meanRadius
);
75 /// Add a dataset to the globe.
76 void addDataSet(tcGeoImageData
* data
);
82 /// Render from the POV of an observer.
83 void render(tcObserver
* const observer
= 0, bool adaptive
= true, const tcGeo
* extent
= 0);
85 /// Set the elevation mode to render in.
86 void setElevationMode(ElevationMode mode
);
88 /// Set the level of correction to show.
89 void setElevationCorrection(float correction
);
91 /// Set the elevation data set name.
92 void setElevationDataSet(const QString
& name
);
94 /// Set colour coding method.
95 void setColourCoding(ColourCoding colourCoding
);
97 /// Adjust the mapping between bands and colour channels.
98 void setColourMapping(int outputChannel
, int inputBand
);
104 /// Get the mean radius.
105 double meanRadius() const;
107 /// Get the altitude above sea level at a sample in a render state.
108 double altitudeAt(const tcSrtmModel::RenderState
& state
, int x
, int y
, tcGeo
* outCoord
, bool* isAccurate
= 0) const;
110 /// Get the altitude above sea level at a coordinate.
111 double altitudeAt(const tcGeo
& coord
, bool* isAccurate
= 0) const;
113 /// Get the radius at a coordinate.
114 double radiusAt(const tcGeo
& coord
) const;
122 /// Draw a line of latitude.
123 void drawLineOfLatitude(double latitude
) const;
126 void renderCell(tcObserver
* const observer
, const tcGeo
& swCorner
, const tcGeo
& neCorner
, int samples
,
127 bool northEdge
= false, bool eastEdge
= false, bool southEdge
= false, bool westEdge
= false) const;
135 /// Mean radius in metres.
139 tcSrtmModel
* m_elevation
;
141 /// List of geo data sets.
142 QList
<tcGeoImageData
*> m_data
;
148 /// Current elevation mode.
149 ElevationMode m_elevationMode
;
151 /// Current level of elevation correction.
152 float m_elevationCorrection
;
154 /// Colour coding method.
155 ColourCoding m_colourCoding
;
157 /// Mapping of bands to colour channels.
158 int m_colourMapping
[3];