2 #include "ScatterPlotConfigDialog.h"
4 #include <qwt_interval.h>
12 #include <QPushButton>
32 setWindowTitle(
"Configure Scatter Plot");
37 QGridLayout *mainLayout =
new QGridLayout;
68 QLabel *titleLabel =
new QLabel(
"<h2>Create Scatter Plot</h2>");
69 mainLayout->addWidget(titleLabel, curRow, 0, 1, 3);
72 QLabel *headerLabel =
new QLabel(
"Choose where to gather the scatter plot "
73 "data from. The X and Y axes are a single band of a cube and must have "
74 "the same dimensions");
75 headerLabel->setWordWrap(
true);
76 mainLayout->addWidget(headerLabel, curRow, 0, 1, 3);
79 int spacerRow = curRow;
82 QLabel *configXLabel =
new QLabel(
"Choose X Input Data");
83 mainLayout->addWidget(configXLabel, curRow, 0, 1, 3);
86 QLabel *xAxisCubeLabel =
new QLabel(
"Cube");
87 mainLayout->addWidget(xAxisCubeLabel, curRow, 1, 1, 1);
96 QLabel *xAxisCubeBandLabel =
new QLabel(
"Cube Band");
97 mainLayout->addWidget(xAxisCubeBandLabel, curRow, 1, 1, 1);
105 QLabel *xAxisBinCountLabel =
new QLabel(
"Bin Count (resolution)");
106 mainLayout->addWidget(xAxisBinCountLabel, curRow, 1, 1, 1);
117 QLabel *useViewportRangesLabel =
new QLabel(
"Use Viewport Visible Range");
118 mainLayout->addWidget(useViewportRangesLabel, curRow, 1, 1, 1);
126 QLabel *configYLabel =
new QLabel(
"Choose Y Input Data");
127 mainLayout->addWidget(configYLabel, curRow, 0, 1, 3);
130 QLabel *yAxisCubeLabel =
new QLabel(
"Cube");
131 mainLayout->addWidget(yAxisCubeLabel, curRow, 1, 1, 1);
140 QLabel *yAxisCubeBandLabel =
new QLabel(
"Cube Band");
141 mainLayout->addWidget(yAxisCubeBandLabel, curRow, 1, 1, 1);
149 QLabel *yAxisBinCountLabel =
new QLabel(
"Bin Count (resolution)");
150 mainLayout->addWidget(yAxisBinCountLabel, curRow, 1, 1, 1);
161 QHBoxLayout *buttonsLayout =
new QHBoxLayout;
162 buttonsLayout->addStretch();
167 this, SLOT(accept()));
170 QPushButton *cancelButton =
new QPushButton(
"Cancel");
171 cancelButton->setIcon(QIcon::fromTheme(
"window-close"));
172 connect(cancelButton, SIGNAL(clicked()),
173 this, SLOT(reject()));
174 buttonsLayout->addWidget(cancelButton);
177 buttonsWrapper->setLayout(buttonsLayout);
178 mainLayout->addWidget(buttonsWrapper, curRow, 0, 1, 3);
180 mainLayout->setColumnMinimumWidth(0, 20);
181 mainLayout->setRowMinimumHeight(spacerRow, 20);
182 setLayout(mainLayout);
194 if (activeViewport) {
211 return QSize(qRound(QDialog::sizeHint().width() * 1.3),
212 QDialog::sizeHint().height());
316 container = viewport;
333 container = viewport;
353 allXCubes.append(viewport->
cube());
358 foreach (
Cube *cubeToRemove, extraXCubes) {
365 foreach (
Cube *cubeToAdd, missingXCubes) {
367 QString cubeName = QFileInfo(cubeToAdd->
fileName()).baseName();
393 allYCubes.append(cube);
399 foreach (
Cube *cubeToRemove, extraYCubes) {
406 foreach (
Cube *cubeToAdd, missingYCubes) {
408 QString cubeName = QFileInfo(cubeToAdd->
fileName()).baseName();
444 bool allowCreation =
true;
447 allowCreation =
false;
452 allowCreation =
false;
472 foreach (
Cube *toRemove, itemsToRemove) {
473 list.removeAll(toRemove);
499 sampleRange.setInterval(1.0,
xAxisCube()->sampleCount());
500 lineRange.setInterval(1.0,
xAxisCube()->lineCount());
503 double startSample =
Null;
504 double startLine =
Null;
505 double endSample =
Null;
506 double endLine =
Null;
510 container->viewport()->height() - 1,
512 sampleRange.setInterval(qRound(startSample), qRound(endSample));
513 lineRange.setInterval(qRound(startLine), qRound(endLine));
517 sampleRange.setInterval(1.0,
xAxisCube()->sampleCount());
518 lineRange.setInterval(1.0,
xAxisCube()->lineCount());
Cube display widget for certain Isis MDI applications.
const double Null
Value for an Isis Null pixel.
int xAxisBinCount() const
The current user selection for the resolution of the scatter plot's x data.
QVector< MdiCubeViewport * > * cubeViewportList()
Repopulates the list of MdiCubeViewports and returns a pointer to this list.
RangeType
This is used internally to differentiate range accessors.
QPointer< QSpinBox > m_yAxisCubeBandSpinBox
A user-selection for the y axis cube's band to plot.
virtual QSize sizeHint() const
This is overridden to give a better default size than what Qt calculates by default.
int yAxisCubeBand() const
The current user selection for the band in the y-axis cube to get data from.
QPointer< QPushButton > m_createButton
This button triggers an accepted() signal.
QPointer< QSpinBox > m_yAxisBinCountSpinBox
A user-selection for the y axis cube's resolution.
Cube * yAxisCube() const
The current user selection for a cube for the x-axis data for a scatter plot.
void refreshWidgetStates()
Update the enabled/disabled states of the various widgets based on the current user inputs' states...
Cube * xAxisCube() const
The current user selection for a cube for the x-axis data for a scatter plot.
QwtInterval lineRange() const
This is the line range from which the scatter plot should be created.
Cube * m_oldXAxisCube
This is used to detect when a user changes the x-axis cube.
MdiCubeViewport * xAxisCubeViewport() const
This returns a viewport which contains the x-axis cube.
QPointer< QSpinBox > m_xAxisBinCountSpinBox
A user-selection for the x axis cube's resolution.
QPointer< QCheckBox > m_useViewportRangesCheckBox
A user-selection for using only the visible range of the viewport.
Cube * cube() const
Return the cube associated with viewport.
MdiCubeViewport * yAxisCubeViewport() const
This returns a viewport which contains the y-axis cube.
QPointer< QComboBox > m_xAxisCubeCombo
A user-selection for the x axis cube.
void viewportToCube(int x, int y, double &sample, double &line) const
Convert a viewport x/y to a cube sample/line (may be outside the cube)
This is used to get the line range in a generic way.
QwtInterval sampleRange() const
This is the sample range from which the scatter plot should be created.
QwtInterval range(RangeType) const
This returns the sample/line ranges indicated by the user for the scatter plot to be created on...
Workspace * m_workspace
This is the workspace containing all of the viewports.
This is used to get the sample range in a generic way.
QString fileName() const
Returns the opened cube's filename.
QPointer< QSpinBox > m_xAxisCubeBandSpinBox
A user-selection for the x axis cube's band to plot.
ScatterPlotConfigDialog(MdiCubeViewport *activeViewport, Workspace *workspace, QWidget *parent=NULL)
This method creates all the dialog boxes required for the scatter plot window.
QPointer< QComboBox > m_yAxisCubeCombo
A user-selection for the y axis cube.
int xAxisCubeBand() const
The current user selection for the band in the x-axis cube to get data from.
QList< Cube * > removeFromList(QList< Cube * > list, QList< Cube * > itemsToRemove)
This is a helper method.
IO Handler for Isis Cubes.
int yAxisBinCount() const
The current user selection for the resolution of the scatter plot's y data.