Made it possible to display normals in output channels 4-6 (A,B,C)
[tecorrec.git] / geo / tcGeoImageData.h
blob57ddd32b0748a71fd5a96bfe15d5b861ac2e70a8
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 _tcGeoImageData_h_
21 #define _tcGeoImageData_h_
23 /**
24 * @file tcGeoImageData.h
25 * @brief Terrain image data.
28 #include "tcGeoData.h"
29 #include "tcAffineTransform.h"
30 #include "tcPixelData.h"
31 #include "CountedReference.h"
33 #include <QString>
34 #include <QStringList>
36 class tcSensor;
37 class tcChannelManager;
38 class OGRCoordinateTransformation;
40 /// Terrain image data.
41 class tcGeoImageData : public tcGeoData
43 public:
46 * Constructors + destructor
49 /// Default constructor.
50 tcGeoImageData();
52 /// Destructor.
53 virtual ~tcGeoImageData();
56 * Accessors
59 /// Get a name for this image data.
60 const QString& name() const;
62 /// Get the channel manager.
63 tcChannelManager* channelManager() const;
65 /// Get the sun direction.
66 maths::Vector<3,float> sunDirection(const tcGeo& coord) const;
69 * Main interface
72 /// Get the affine transformation from texture to geo.
73 const tcAffineTransform2<double> texToGeo() const;
75 /// Get the affine transformation from geo to texture.
76 const tcAffineTransform2<double> geoToTex() const;
78 /// Get the affine transformation from effective texture to geo.
79 const tcAffineTransform2<double> effectiveTexToGeo() const;
81 /// Get the affine transformation from geo to effective texture.
82 const tcAffineTransform2<double> geoToEffectiveTex() const;
85 * Rendering
88 /// Set up rendering using thumbnails.
89 virtual void setupThumbnailRendering(int numChannels, int* channels);
91 /// Set up rendering using a custom generated high resolution image.
92 virtual void setupDetailedRendering(int numChannels, int* channels,
93 const tcGeo& swCorner, const tcGeo& neCorner);
95 /// Set up rendering for normals.
96 virtual void setupNormalRendering();
98 /// Provide a geographical texture coordinate.
99 virtual void texCoord(const tcGeo& coord);
101 /// Finds the normal at a geographical coordinate during rendering.
102 virtual maths::Vector<3,float> normalAt(int norm, const tcGeo& coord);
104 /// Unbind any textures etc.
105 virtual void finishRendering();
107 protected:
110 * Protected mutators
113 /// Set the texture to geo transformation.
114 void setTexToGeo(const tcAffineTransform2<double>& texToGeo);
116 /// Set the effective texture to geo transformation.
117 void setEffectiveTexToGeo(const tcAffineTransform2<double>& effectiveTexToGeo);
119 /// Set the name.
120 void setName(const QString& name);
122 /// Set the sun direction.
123 void setSunDirection(const tcGeo& sunDirection, const tcGeo& sunReference);
125 private:
128 * Variables
131 /// Name of the image data.
132 QString m_name;
134 /// Channel manager object.
135 tcChannelManager* m_channelManager;
137 /// Transformation from full texture to geo.
138 tcAffineTransform2<double> m_texToGeo;
140 /// Transformation from geo to full texture.
141 tcAffineTransform2<double> m_geoToTex;
143 /// Transformation from effective texture to geo.
144 tcAffineTransform2<double> m_effectiveTexToGeo;
146 /// Transformation from geo to effective texture.
147 tcAffineTransform2<double> m_geoToEffectiveTex;
149 /// Sensors which collected the data.
150 tcSensor* m_sensor;
152 /// Direction of the sun relative to earth.
153 maths::Vector<3,double> m_sunDirection;
155 /// Whether each channel is set up for rendering.
156 bool m_channelSetup[3];
158 /// The current normal data.
159 Reference<tcTypedPixelData<maths::Vector<3,float> > > m_effectiveNormals[3];
162 #endif