Isis 3 Programmer Reference
ControlHealthMonitorWorkOrder.cpp
Go to the documentation of this file.
1 
22 
23 #include <QMessageBox>
24 #include <QtDebug>
25 
26 #include "Control.h"
27 #include "Directory.h"
28 #include "IException.h"
29 #include "Project.h"
30 #include "ProjectItem.h"
31 #include "ProjectItemModel.h"
32 
33 namespace Isis {
34 
40  WorkOrder(project) {
41 
42  // This workorder is not undoable
43  m_isUndoable = false;
44 
45  QAction::setText(tr("View Control Net Health Monitor") );
46  QUndoCommand::setText(tr("View Control Net Health Monitor"));
47  }
48 
49 
55  WorkOrder(other) {
56  }
57 
58 
63  }
64 
65 
71  return new ControlHealthMonitorWorkOrder(*this);
72  }
73 
74 
83  return !!controls;
84  }
85 
92 
93  bool success = WorkOrder::setupExecution();
94  if (success) {
95  if (!isExecutable(controlList())) {
96 
97  QMessageBox::critical(NULL, tr("Unable to load Control Net Health Monitor."),
98  tr("You must first set an active control in order to view the health monitor."));
99  success = false;
100  }
101  // So far, so good, set the command text
102  else {
103  QUndoCommand::setText(tr("Set Active Control Network to [%1]").arg(
104  controlList()->at(0)->displayProperties()->displayName()));
105  }
106  }
107 
108  return success;
109  }
110 
111 
120  try {
121  project()->directory()->addControlHealthMonitorView();
122  }
123  catch (IException &e) {
124  m_status = WorkOrderFinished;
125  QMessageBox::critical(NULL, tr("Error"), tr(e.what()));
126  }
127  }
128 }
const char * what() const
Returns a string representation of this exception in its current state.
Definition: IException.cpp:391
$Date$ $Revision$
The main project for ipce.
Definition: Project.h:289
Maintains a list of Controls so that control nets can easily be copied from one Project to another...
Definition: ControlList.h:36
virtual bool setupExecution()
This sets up the state for the work order.
Definition: WorkOrder.cpp:1275
This is a child of class WorkOrder which is used for anything that performs an action in a Project...
virtual bool isExecutable(ControlList *controls)
Determines if we can execute the health monitor.
Directory * directory() const
Returns the directory associated with this Project.
Definition: Project.cpp:1229
Provide Undo/redo abilities, serialization, and history for an operation.
Definition: WorkOrder.h:322
virtual ControlHealthMonitorWorkOrder * clone() const
Returns a copy of this ControlHealthMonitorWorkOrder instance.
void execute()
Set the active control net for the project.
bool m_isUndoable
Set the workorder to be undoable/redoable This is defaulted to true - his will allow the workorder to...
Definition: WorkOrder.h:534
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
bool setupExecution()
Make sure an active ImageList has been chosen.
ControlHealthMonitorWorkOrder(Project *project)
Creates a WorkOrder that will display the Control Net Health Monitor interface.
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
This is used for work orders that will not undo or redo (See createsCleanState()) ...
Definition: WorkOrder.h:342
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1314
QPointer< ControlList > controlList()
Returns the Control List for this WorkOrder (a list of control networks).
Definition: WorkOrder.cpp:720