tcElevationOptimization::loadSnapShot: simplify reliability expression
[tecorrec.git] / geo / tcChannelGroup.h
blobcbbc475f456739598b9734560de224522be9a0b1
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 _tcChannelGroup_h_
21 #define _tcChannelGroup_h_
23 /**
24 * @file tcChannelGroup.h
25 * @brief A group of linked channels.
28 #include "CountedReference.h"
29 #include "tcPixelData.h"
31 #include <QObject>
32 #include <QString>
33 #include <QList>
35 class tcChannel;
36 class tcChannelConfigWidget;
38 /** A single abstract image channel.
39 * This sort of acts as a data source for a set of related output channels.
41 class tcChannelGroup : public QObject
43 Q_OBJECT
45 public:
48 * Types
51 /// Our custom channel group member class.
52 class Channel;
55 * Constructors + destructor
58 /// Primary constructor.
59 tcChannelGroup(int channels, const QString& name, const QString& description);
61 /// Destructor.
62 virtual ~tcChannelGroup();
65 * Metadata
68 /// Get the channel name.
69 const QString& name() const;
71 /// Get the channel description;
72 const QString& description() const;
74 /// Set the channel name.
75 void setName(const QString& name);
77 /// Set the channel description.
78 void setDescription(const QString& description);
81 * Main image interface
84 /// Get the list of output channels.
85 const QList<tcChannel*>& channels() const;
87 /// Get configuration widget.
88 virtual tcChannelConfigWidget* configWidget();
90 /// Get a reference to the pixel data of a portion of one of the output channels.
91 Reference<tcAbstractPixelData> portion(int channel, double x1, double y1, double x2, double y2, bool changed);
93 //protected:
96 * Interface for derived class to implement
99 /// Round coordinates to sensible values.
100 virtual void roundPortion(double* x1, double* y1, double* x2, double* y2) = 0;
102 /// Load portions of pixel data for each output channel.
103 virtual void loadPortions(double x1, double y1, double x2, double y2, bool changed) = 0;
105 public slots:
108 * Interface for derived classes
111 /** Invalidate this channel.
112 * For example if one of the inputs has changed.
114 void invalidate();
116 protected:
119 * Protected variables
122 /// Pixel data of a portion of each channel.
123 QList< Reference<tcAbstractPixelData> > m_portions;
125 private:
128 * Variables
131 /// Name of the channel.
132 QString m_name;
134 /// Description of the channel.
135 QString m_description;
137 /// Output channels.
138 QList<tcChannel*> m_channels;
140 /// Portion coordinates.
141 double m_portionPosition[2][2];
144 #endif