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 A single abstract image channel.
28 #include "tcPixelData.h"
36 class tcChannelConfigWidget
;
37 class tcChannelManager
;
39 /// A single abstract image channel.
40 class tcChannel
: public QObject
47 * Constructors + destructor
50 /// Primary constructor.
51 tcChannel(const QString
& name
, const QString
& description
);
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
);
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
);
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;
125 * Interface for derived classes
128 /** Invalidate this channel.
129 * For example if one of the inputs has changed.
139 /// Emitted to indicate progress of processing.
140 void progressing(const QString
& message
);
148 /// Start a processing step.
149 void startProcessing(const QString
& step
);
152 void progress(float progress
);
155 void progress(const QString
& info
);
157 /// End processing step.
158 void endProcessing();
167 tcChannelManager
* m_channelManager
;
169 /// Name of the channel.
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];
188 /// Current processing step.
189 static QString s_processingStep
;
191 /// Last progress percent.
192 static int s_processingLastPercent
;