Isis 3.0 Programmer Reference
Back | Home
MatrixViewWorkOrder.cpp
Go to the documentation of this file.
1 
23 #include "MatrixViewWorkOrder.h"
24 
25 #include <QDebug>
26 #include <QFileDialog>
27 #include <QInputDialog>
28 #include <QMessageBox>
29 
30 #include "CorrelationMatrix.h"
31 #include "Directory.h"
32 #include "IException.h"
33 #include "MatrixSceneWidget.h"
34 #include "Project.h"
35 
36 namespace Isis {
37 
45  WorkOrder(project) {
46  QAction::setText( tr("View Correlation &Matrix...") );
47  }
48 
55  WorkOrder(other) {
56  qDebug() << "matrix good?";
57  }
58 
63  }
64 
71  return new MatrixViewWorkOrder(*this);
72  }
73 
74 
84  return matrix.isValid();
85  }
86 
87 
94  bool success = WorkOrder::execute();
95 
96  if (success) {
97  QStringList viewOptions;
98 
100  int viewToUse = -1;
101 
102  if ( existingViews.count() ) {
103  for (int i = 0; i < existingViews.count(); i++) {
104  viewOptions.append( existingViews[i]->windowTitle() );
105  }
106  }
107 
108  viewOptions.append( tr("New Matrix View") );
109 
110  if (viewOptions.count() > 1) {
111  QString selected = QInputDialog::getItem(NULL, tr("View to see matrix in"),
112  tr("Which view would you like your\nmatrix to be put into?"),
113  viewOptions, viewOptions.count() - 1, false, &success);
114 
115  viewToUse = viewOptions.indexOf(selected);
116  }
117  else {
118  viewToUse = viewOptions.count() - 1;
119  }
120 
121  bool newView = false;
122  if (viewToUse == viewOptions.count() - 1) {
123  newView = true;
124 
125  QUndoCommand::setText( tr("View matrix in new matrix view") );
126 
127  }
128  else if (viewToUse != -1) {
129  MatrixSceneWidget *matrixView = existingViews[viewToUse];
130 
131  // Do we need this? If the view already exists has this already been done?
133  corrMat.computeCorrelationMatrix();
134  matrixView->setUpOptions(corrMat);
135  matrixView->drawElements(corrMat);
136  matrixView->drawGrid(corrMat);
137  }
138 
140  internalData.append( QString::number(viewToUse) );
141  internalData.append(newView? "new view" : "existing view");
142  setInternalData(internalData);
143  }
144 
145  return success;
146  }
147 
148 
158  // depend on types of ourselves.
159  return dynamic_cast<MatrixViewWorkOrder *>(other);
160  }
161 
162 
167  MatrixSceneWidget *matrixViewToUse = project()->directory()->addMatrixView();
169  /*
170  * Since computing the correlation matrix is potentially time consuming we only want to
171  * do it if the user wants to see it.
172  */
173  corrMat.computeCorrelationMatrix();
174  matrixViewToUse->setUpOptions(corrMat);
175  matrixViewToUse->drawElements(corrMat);
176  matrixViewToUse->drawGrid(corrMat);
177  if (matrixViewToUse == NULL) {
178  QString msg = "The Correlation Matrix for this bundle could not be displayed";
180  }
181  }
182 
183 
188  if (internalData()[1] == "new view") {
189  delete project()->directory()->matrixViews().last();
190  }
191  }
192 }
193 
QList< MatrixSceneWidget * > matrixViews()
Accessor for the list of MatrixSceneWidgets currently available.
Definition: Directory.cpp:962
void drawElements(CorrelationMatrix corrMatrix)
Refit scene and items when the widget size changes.
The main project for cnetsuite.
Definition: Project.h:105
virtual MatrixViewWorkOrder * clone() const
This method clones the MatrixViewWorkOrder.
This is a container for the correlation matrix that comes from a bundle adjust.
virtual bool isExecutable(CorrelationMatrix matrix)
This check is used by Directory::supportedActions(DataType data).
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1116
MatrixSceneWidget * addMatrixView()
Add the matrix view widget to the window.
Definition: Directory.cpp:731
void computeCorrelationMatrix()
This method reads the covariance matrix in from a file, one SparseBlockColumnMatrix at a time...
void syncRedo()
This method computes and displays the correlation matrix.
bool dependsOn(WorkOrder *other) const
This method returns true if other depends on a MatrixViewWorkOrder.
This widget encompasses the entire matrixDisplay scene.
QStringList internalData() const
Gets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1186
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:154
This work order will open a MatrixSceneWidget and display the correlation matrix. ...
void drawGrid(CorrelationMatrix corrMatrix)
Draw the lines that will show the columns and blocks for each image.
bool execute()
If WorkOrder::execute() returns true, a new matrix view is created.
Parent class for anything that performs an action in Project.
Definition: WorkOrder.h:104
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
Directory * directory() const
Returns the directory associated with this Project.
Definition: Project.cpp:824
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void setUpOptions(CorrelationMatrix corrMat)
Change item colors when options are changed.
bool isValid()
This is the public accessor for the list of elements that should be displayed in the current view...
Isis exception class.
Definition: IException.h:99
CorrelationMatrix correlationMatrix()
Returns the CorrleationMatrix for this WorkOrder.
Definition: WorkOrder.cpp:628
virtual bool execute()
The (child) implementation of this method should prompt the user/gather state by any means necessary...
Definition: WorkOrder.cpp:1078
MatrixViewWorkOrder(Project *project)
This method sets the text of the work order.
void syncUndo()
This method deletes the last matrix viewed.
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1130

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:23:10