casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TBSlicer.qo.h
Go to the documentation of this file.
1 //# TBSlicer.qo.h: Widget to display and change the current array slice.
2 //# Copyright (C) 2005
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: $
27 #ifndef TBSLICER_H_
28 #define TBSLICER_H_
29 
30 #include <casaqt/QtBrowser/TBSlicer.ui.h>
31 
32 #include <vector>
33 
34 #include <QtGui>
35 
36 #include <casa/BasicSL/String.h>
37 
38 namespace casa {
39 
40 // <summary>
41 // Widget to display and change the current array slice.
42 // </summary>
43 //
44 // <synopsis>
45 // A TBSlicer has two parts: the bottom part allows the user to chooser which
46 // dimension is viewed along the two axes, and the top part chooses which
47 // "slice" along those two axes to view. When the user changes the slice,
48 // a signal is emitted; the parent/caller is responsible for connecting and
49 // processing the signal.
50 // </synopsis>
51 
52 class TBSlicer : public QWidget, Ui_Slicer {
53  Q_OBJECT
54 
55 public:
56  // Constructor that takes the shape of the array.
57  TBSlicer(std::vector<int> d);
58 
59  ~TBSlicer();
60 
61 signals:
62  // This signal is emitted when the user changes the slice. The slice
63  // parameter contains non-negative values along all dimensions EXCEPT
64  // for the two dimensions that are mapped to the X- and Y-axes. The
65  // dimension mapped to the X-axis has the value
66  // TBConstants::SLICER_ROW_AXIS in the vector while the dimension mapped
67  // to the Y-axis has the value TBConstants::SLICER_COL_AXIS in the vector.
68  // For example, if the array was 4x4x4, a slice of [SLICER_ROW_AXIS 1
69  // SLICER_COL_AXIS] would mean to display the first dimension along the
70  // X-axis and the third dimension along the Y-axis and to use 1 as the
71  // index for the second dimension.
72  void sliceChanged(std::vector<int> slice);
73 
74 private:
75  // Current spinners.
76  std::vector<QSpinBox*> spinners;
77 
78  // Current slice values.
79  std::vector<int> values;
80 
81  // Holds the old row index.
82  int oldR;
83 
84  // Holds the old column index.
85  int oldC;
86 
87  // Flag to indicate whether GUI-generated events are "genuine."
88  bool shouldEmit;
89 
90 
91  // Collects the slice and emits the sliceChanged() signal.
92  void emitSliceChanged();
93 
94 private slots:
95  // Slot for when one of the spinners changes values. Updates the current
96  // slice and calls emitSliceChanged() if the slice has changed.
97  void valueChanged();
98 
99  // Slot for when the row axis dimension is changed. Updates the slicer
100  // accordingly.
101  void rowAxisChanged(int newRow);
102 
103  // Slot for when the column axis dimension is changed. Updates the slicer
104  // accordingly.
105  void colAxisChanged(int newCol);
106 };
107 
108 }
109 
110 #endif /* TBSLICER_H_ */
std::vector< int > values
Current slice values.
Definition: TBSlicer.qo.h:79
void colAxisChanged(int newCol)
Slot for when the column axis dimension is changed.
TBSlicer(std::vector< int > d)
Constructor that takes the shape of the array.
void emitSliceChanged()
Collects the slice and emits the sliceChanged() signal.
void rowAxisChanged(int newRow)
Slot for when the row axis dimension is changed.
std::vector< QSpinBox * > spinners
Current spinners.
Definition: TBSlicer.qo.h:76
bool shouldEmit
Flag to indicate whether GUI-generated events are &quot;genuine.&quot;.
Definition: TBSlicer.qo.h:88
void valueChanged()
Slot for when one of the spinners changes values.
Widget to display and change the current array slice.
Definition: TBSlicer.qo.h:52
int oldR
Holds the old row index.
Definition: TBSlicer.qo.h:82
int oldC
Holds the old column index.
Definition: TBSlicer.qo.h:85
void sliceChanged(std::vector< int > slice)
This signal is emitted when the user changes the slice.