Hard constrain and bilinear/bicubic interpolation in elevation optimisation config
[tecorrec.git] / geo / tcChannel.h
blob2f2abe0a5ec09cc29a71fd2320c1040c0d550c47
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 _tcChannel_h_
21 #define _tcChannel_h_
23 /**
24 * @file tcChannel.h
25 * @brief A single abstract image channel.
28 #include "tcPixelData.h"
30 #include <QObject>
31 #include <QString>
32 #include <QList>
34 #include <GL/gl.h>
36 class tcChannelConfigWidget;
37 class tcChannelManager;
39 /// A single abstract image channel.
40 class tcChannel : public QObject
42 Q_OBJECT
44 public:
47 * Constructors + destructor
50 /// Primary constructor.
51 tcChannel(const QString& name, const QString& description);
53 /// Destructor.
54 virtual ~tcChannel();
57 * Metadata
60 /// Get the channel manager.
61 tcChannelManager* channelManager() const;
63 /// Set the channel manager.
64 void setChannelManager(tcChannelManager* channelManager);
66 /// Get the channel name.
67 const QString& name() const;
69 /// Get the channel description;
70 const QString& description() const;
72 /// Set the channel name.
73 void setName(const QString& name);
75 /// Set the channel description.
76 void setDescription(const QString& description);
79 * Dependencies
82 /// Add derivitive of this channel.
83 void addDerivitive(tcChannel* derivitive);
85 /// Remove a derivitive of this channel.
86 void removeDerivitive(tcChannel* derivitive);
89 * Main image interface
92 /// Get configuration widget.
93 virtual tcChannelConfigWidget* configWidget();
95 /// Get GL texture ID of thumbnail of the channel.
96 virtual GLuint thumbnailTexture();
98 /// Get a reference to the pixel data of the current portion of the image.
99 Reference<tcAbstractPixelData> portion() const;
101 /// Get a reference to the pixel data of a portion of the image.
102 Reference<tcAbstractPixelData> portion(double* x1, double* y1, double* x2, double* y2);
104 /// Get a reference to the pixel data of a portion of the image.
105 Reference<tcAbstractPixelData> portion(double x1, double y1, double x2, double y2);
107 /// Get GL texture ID of portion of the channel.
108 GLuint portionTexture(double* x1, double* y1, double* x2, double* y2);
110 //protected:
113 * Interface for derived class to implement
116 /// Round coordinates to sensible values.
117 virtual void roundPortion(double* x1, double* y1, double* x2, double* y2) = 0;
119 /// Load a portion of pixel data from the channel source, wherever that may be.
120 virtual tcAbstractPixelData* loadPortion(double x1, double y1, double x2, double y2) = 0;
122 public slots:
125 * Interface for derived classes
128 /** Invalidate this channel.
129 * For example if one of the inputs has changed.
131 void invalidate();
133 signals:
136 * Signals
139 /// Emitted to indicate progress of processing.
140 void progressing(const QString& message);
142 protected:
145 * Progress functions
148 /// Start a processing step.
149 void startProcessing(const QString& step);
151 /// Update progress.
152 void progress(float progress);
154 /// Update progress.
155 void progress(const QString& info);
157 /// End processing step.
158 void endProcessing();
160 private:
163 * Variables
166 /// Channel manager.
167 tcChannelManager* m_channelManager;
169 /// Name of the channel.
170 QString m_name;
172 /// Description of the channel.
173 QString m_description;
175 /// List of channels which are derived from this channel.
176 QList<tcChannel*> m_derivitives;
178 /// Pixel data of a portion of the channel.
179 Reference<tcAbstractPixelData> m_portion;
181 /// Portion coordinates.
182 double m_portionPosition[2][2];
185 * Static variables
188 /// Current processing step.
189 static QString s_processingStep;
191 /// Last progress percent.
192 static int s_processingLastPercent;
195 #endif