tcElevationOptimization::loadSnapShot: simplify reliability expression
[tecorrec.git] / tcColourMapWidget.h
blob1b1e08abf9b418310b421be59dff874c4b76772a
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 _tcColourMapWidget_h_
21 #define _tcColourMapWidget_h_
23 /**
24 * @file tcColourMapWidget.h
25 * @brief Colour mapping widget.
28 #include <QScrollArea>
29 #include <QList>
31 class QSignalMapper;
32 class QGridLayout;
33 class QButtonGroup;
35 /// Colour mapping widget.
36 class tcColourMapWidget : public QScrollArea
38 Q_OBJECT
40 public:
43 * Constructors + destructor
46 /// Construct with colour information.
47 tcColourMapWidget(const QStringList& outputBands, QWidget* parent);
49 /// Destructor.
50 virtual ~tcColourMapWidget();
53 * Main interface
56 /// Clear bands.
57 void clearInputBands();
59 /// Add an input band.
60 void addInputBand(const QString& name, const QString& description);
62 /// Add an input band group separator.
63 void addInputGroupSeparator(const QString& name);
66 * Accessors
69 /// Get the index of the input band assigned to an output band.
70 int inputBand(int outputBand) const;
72 public slots:
75 * Public slots
78 /// Set the input band assigned to an output.
79 void setInputBand(int output, int input);
81 signals:
84 * Signals
87 /// Emitted when an input band is clicked.
88 void inputBandClicked(int input, int inputGroup);
90 /// Emitted when an input group is clicked.
91 void inputGroupClicked(int group);
93 /// Emitted when the input band assigned to an output is changed.
94 void inputBandChanged(int output, int input, int inputGroup);
96 private slots:
99 * Private slots
102 /// Indicates that an input band has been clicked.
103 void inputBandClickedSlot(int input);
105 /// Indicates that the input band assigned to an output has changed.
106 void inputBandChangedSlot(int output);
108 private:
111 * Private functions
114 /// Get the input group and adjust the band number to be relative to the input group.
115 int inputGroup(int* band);
117 private:
120 * GUI objects
123 /// Main layout of the widget.
124 QGridLayout* m_layout;
126 /// Input label signal mapper.
127 QSignalMapper* m_inputSignalMapper;
129 /// Input group signal mapper.
130 QSignalMapper* m_inputGroupSignalMapper;
132 /// Group signal mapper.
133 QSignalMapper* m_groupSignalMapper;
136 * Variables
139 /// Radio button groups for each output band.
140 QList<QButtonGroup*> m_outputBandButtonGroups;
142 /// Number of input colour bands.
143 int m_numInputBands;
145 /// Number of input bands per group.
146 QList<int> m_numInputBandsPerGroup;
149 #endif