casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlotMSIterateTab.qo.h
Go to the documentation of this file.
1 //# PlotMSIterationTab.qo.h: Plot tab for iterated plot settings
2 //# Copyright (C) 2009
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 PLOTMSITERATETAB_QO_H_
28 #define PLOTMSITERATETAB_QO_H_
29 
30 #include <plotms/GuiTabs/PlotMSIterateTab.ui.h>
31 
34 
35 #include <array>
36 #include <QAbstractTableModel>
37 #include <QIcon>
38 
39 namespace casa {
40 
41 //# Forward declarations.
42 class QtLabelWidget;
43 
44 
45 // Subclass of PlotMSPlotSubtab to manage plot display parameters.
46 class PlotMSIterateTab : public PlotMSPlotSubtab, Ui::IterateTab {
47  Q_OBJECT
48 
49 
50 public:
51 
52  // Constructor which takes the parent tab and plotter.
53  PlotMSIterateTab(PlotMSPlotTab* plotTab, PlotMSPlotter* parent);
54 
55  // Destructor.
57 
58 
59  // Implements PlotMSTab::tabName().
60  QString tabName() const { return "Page"; }
61 
62  // Implements PlotMSPlotSubtab::getValue().
63  void getValue(PlotMSPlotParameters& params) const;
64 
65  // Implements PlotMSPlotSubtab::setValue().
66  void setValue(const PlotMSPlotParameters& params);
67 
68  // Implements PlotMSPlotSubtab::update().
69  void update(const PlotMSPlot& plot);
70 
71  // Uses the index chooser at the top, with the given number of rows and
72  // columns, to manage multi-plot display parameters.
73  bool setGridSize(unsigned int nRows,unsigned int nCols);
74 
75  //Returns true if a reasonable row and column location has been
76  //set (nonzero); false otherwise.
77  bool isPlottable() const;
78 
79  // Clear user-selected header items
80  void clearSelectedItems();
81 
82 signals:
83  void plottableChanged();
84 
85 private slots:
86  //Whether to use a single global axis has changed.
87  void globalChanged();
88  void locationChanged();
89  // Header items edition
90  // ---- Add items selected in availableItemsTableView
91  void addItems();
92  // ---- Remove items selected in selectedItemsTableView
93  void removeItems();
94  void headerItemsChanged();
95  // Icons animation
96  void setArrowUpNormal();
97  void setArrowUpActive();
98  void setArrowDownNormal();
99  void setArrowDownActive();
100 
101 private:
102  void hideGridLocation( bool hide );
103  void setGridIndices( int rowIndex, int colIndex );
104  void setHeaderItems(const PMS_PP_PageHeader* pageHeaderParamsGroup);
105  void setAvailable(PageHeaderItemsDef::Item item, bool isAvailable);
106  void setButtonIcon(QPushButton *button, Bool isActive);
107 
108  //Location of the plot
109  int gridRow;
110  int gridCol;
111 
112  // Page header items
114 
115  // Animated buttons
116  QIcon arrowUpIcon;
118 };
119 
120 
121 class SelectedItemsDataModel : public QAbstractTableModel
122 {
123  Q_OBJECT
124 
125 public:
127  using Item = Items::Item;
128  SelectedItemsDataModel(PageHeaderItems &items, QObject *parent =0);
129  // Read-Only interface
130  int rowCount(const QModelIndex &parent = QModelIndex()) const;
131  int columnCount(const QModelIndex &parent = QModelIndex()) const;
132  QVariant data(const QModelIndex &index, int role) const;
133  // Resize interface
134  void prepareToAppend(Item item);
135  std::vector<Item>& itemsToRemove() { return itemsToRemove_ ; }
136  bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
137  bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
138 
139  // Edit interface
140  // bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
141 private:
143  std::vector<Item> newItem_;
144  std::vector<Item> itemsToRemove_;
145 };
146 
147 
148 class AvailableItemsDataModel : public QAbstractTableModel
149 {
150  Q_OBJECT
151 
152 public:
154  using Item = Items::Item;
155  using ItemsArray = std::array<Item,Items::n_items>;
156  AvailableItemsDataModel(const ItemsArray &items, QObject *parent =0);
157  // Read-Only interface
158  int rowCount(const QModelIndex &parent = QModelIndex()) const;
159  int columnCount(const QModelIndex &parent = QModelIndex()) const;
160  QVariant data(const QModelIndex &index, int role) const;
161 private:
163 };
164 
165 
166 
167 
168 
169 
170 
171 
172 }
173 
174 #endif /* PLOTMSDISPLAYTAB_QO_H_ */
bool isPlottable() const
Returns true if a reasonable row and column location has been set (nonzero); false otherwise...
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
void setHeaderItems(const PMS_PP_PageHeader *pageHeaderParamsGroup)
~PlotMSIterateTab()
Destructor.
void update(const PlotMSPlot &plot)
Implements PlotMSPlotSubtab::update().
int columnCount(const QModelIndex &parent=QModelIndex()) const
void setValue(const PlotMSPlotParameters &params)
Implements PlotMSPlotSubtab::setValue().
std::array< Item, Items::n_items > ItemsArray
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
void globalChanged()
Whether to use a single global axis has changed.
Parameters for a PlotMSPlot.
void hideGridLocation(bool hide)
SelectedItemsDataModel(PageHeaderItems &items, QObject *parent=0)
void clearSelectedItems()
Clear user-selected header items.
bool setGridSize(unsigned int nRows, unsigned int nCols)
Uses the index chooser at the top, with the given number of rows and columns, to manage multi-plot di...
void setGridIndices(int rowIndex, int colIndex)
PageHeaderItems & items_
Edit interface bool setData(const QModelIndex &amp; index, const QVariant &amp; value, int role = Qt::EditRol...
int rowCount(const QModelIndex &parent=QModelIndex()) const
Read-Only interface.
Subclass of PlotMSPlotParameters::Group to handle page header parameters.
QString tabName() const
Implements PlotMSTab::tabName().
PageHeaderItems headerItems
Page header items.
PlotMSIterateTab(PlotMSPlotTab *plotTab, PlotMSPlotter *parent)
Constructor which takes the parent tab and plotter.
void setButtonIcon(QPushButton *button, Bool isActive)
Subclass of PlotMSTab for tabs that are meant to be used as subtabs in a PlotMSPlotTab.
Class for a single &quot;plot&quot; concept.
Definition: PlotMSPlot.h:57
void setAvailable(PageHeaderItemsDef::Item item, bool isAvailable)
QVariant data(const QModelIndex &index, int role) const
Subclass of PlotMSPlotSubtab to manage plot display parameters.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void setArrowUpNormal()
Icons animation.
int rowCount(const QModelIndex &parent=QModelIndex()) const
Read-Only interface.
QIcon arrowUpIcon
Animated buttons.
int columnCount(const QModelIndex &parent=QModelIndex()) const
int gridRow
Location of the plot.
Definition of supported Page Header Items.
void addItems()
Header items edition -— Add items selected in availableItemsTableView.
High(ish)-level plotter class that manages the GUI (semi-) transparently to the rest of PlotMS...
QVariant data(const QModelIndex &index, int role) const
AvailableItemsDataModel(const ItemsArray &items, QObject *parent=0)
void removeItems()
-— Remove items selected in selectedItemsTableView
Ordered selection of distinct (no duplicates) page header items.
Subclass of PlotMSTab that manages PlotMSPlots in the GUI.
void getValue(PlotMSPlotParameters &params) const
Implements PlotMSPlotSubtab::getValue().
void prepareToAppend(Item item)
Resize interface.
std::vector< Item > & itemsToRemove()
std::vector< Item > itemsToRemove_