Added gui options for wireframe, and colour coding
[tecorrec.git] / geo / tcGlobe.h
blob7ccf759144d43d2c7262045801c99b46a3a7eb46
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 _tcGlobe_h_
21 #define _tcGlobe_h_
23 /**
24 * @file tcGlobe.h
25 * @brief Manages data for a globe.
28 #include "tcSrtmModel.h"
30 #include <QList>
32 class tcGeo;
33 class tcGeoImageData;
34 class tcObserver;
36 /** Manages data for a globe.
37 * Holds terrain elevation and imagery data.
39 class tcGlobe
41 public:
44 * Enumerations
47 /// Elevation modes.
48 enum ElevationMode
50 NoElevation,
51 RawElevation,
52 CorrectedElevation
55 /// Colour codings.
56 enum ColourCoding {
57 NoColourCoding = 0,
58 ElevationSampleAlignment
62 * Constructors + destructor
65 /// Primary constructor.
66 tcGlobe(double meanRadius);
68 /// Destructor.
69 virtual ~tcGlobe();
72 * Data sets
75 /// Add a dataset to the globe.
76 void addDataSet(tcGeoImageData* data);
79 * Rendering
82 /// Render from the POV of an observer.
83 void render(tcObserver* const observer, 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);
98 * Accessors
101 /// Get the mean radius.
102 double meanRadius() const;
104 /// Get the altitude above sea level at a sample in a render state.
105 double altitudeAt(const tcSrtmModel::RenderState& state, int x, int y, tcGeo* outCoord, bool* isAccurate = 0) const;
107 /// Get the altitude above sea level at a coordinate.
108 double altitudeAt(const tcGeo& coord, bool* isAccurate = 0) const;
110 /// Get the radius at a coordinate.
111 double radiusAt(const tcGeo& coord) const;
113 private:
116 * Rendering
119 /// Draw a line of latitude.
120 void drawLineOfLatitude(double latitude) const;
122 /// Render a cell.
123 void renderCell(tcObserver* const observer, const tcGeo& swCorner, const tcGeo& neCorner, int samples,
124 bool northEdge = false, bool eastEdge = false, bool southEdge = false, bool westEdge = false) const;
126 private:
129 * Variables
132 /// Mean radius in metres.
133 double m_meanRadius;
135 /// Elevation model.
136 tcSrtmModel* m_elevation;
138 /// List of geo data sets.
139 QList<tcGeoImageData*> m_data;
142 * Rendering options
145 /// Current elevation mode.
146 ElevationMode m_elevationMode;
148 /// Current level of elevation correction.
149 float m_elevationCorrection;
151 /// Colour coding method.
152 ColourCoding m_colourCoding;
155 #endif