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"
34 /** Manages data for a globe.
35 * Holds terrain elevation and imagery data.
56 ElevationSampleAlignment
60 * Constructors + destructor
63 /// Primary constructor.
64 tcGlobe(double meanRadius
);
73 /// Set the imagery data.
74 void setImagery(tcGeoImageData
* data
);
76 /// Get the imagery data.
77 tcGeoImageData
* imagery() const;
79 /// Get the elevation model.
80 tcSrtmModel
* dem() const;
86 /// Render from the POV of an observer.
87 void render(tcObserver
* const observer
= 0, bool adaptive
= true, const tcGeo
* extent
= 0);
89 /// Set the elevation mode to render in.
90 void setElevationMode(ElevationMode mode
);
92 /// Set the level of correction to show.
93 void setElevationCorrection(float correction
);
95 /// Set the elevation data set name.
96 void setElevationDataSet(const QString
& name
);
98 /// Set colour coding method.
99 void setColourCoding(ColourCoding colourCoding
);
101 /// Adjust the mapping between bands and colour channels.
102 void setColourMapping(int outputChannel
, int inputBand
);
108 /// Get the mean radius.
109 double meanRadius() const;
111 /// Get the altitude above sea level at a sample in a render state.
112 double altitudeAt(const tcSrtmModel::RenderState
& state
, int x
, int y
, tcGeo
* outCoord
, bool* isAccurate
= 0) const;
114 /// Get the altitude above sea level at a coordinate.
115 double altitudeAt(const tcGeo
& coord
, bool* isAccurate
= 0) const;
117 /// Get the radius at a coordinate.
118 double radiusAt(const tcGeo
& coord
) const;
120 /// Get the texture coordinate of the effective texture at a geographical coordinate.
121 maths::Vector
<2,double> textureCoordOfGeo(const tcGeo
& coord
) const;
129 /// Draw a line of latitude.
130 void drawLineOfLatitude(double latitude
) const;
133 void renderCell(tcObserver
* const observer
, const tcGeo
& swCorner
, const tcGeo
& neCorner
, int samples
,
134 bool northEdge
= false, bool eastEdge
= false, bool southEdge
= false, bool westEdge
= false) const;
142 /// Mean radius in metres.
146 tcSrtmModel
* m_elevation
;
149 tcGeoImageData
* m_imagery
;
155 /// Current elevation mode.
156 ElevationMode m_elevationMode
;
158 /// Current level of elevation correction.
159 float m_elevationCorrection
;
161 /// Colour coding method.
162 ColourCoding m_colourCoding
;
164 /// Mapping of bands to colour channels.
165 int m_colourMapping
[3];