Isis 3 Programmer Reference
Footprint2DViewWorkOrder.cpp
Go to the documentation of this file.
1 
22 
23 #include <QtDebug>
24 
25 #include <QFileDialog>
26 #include <QInputDialog>
27 #include <QMessageBox>
28 
29 #include "Directory.h"
30 #include "Footprint2DView.h"
31 #include "ImageList.h"
32 #include "MosaicSceneItem.h"
33 #include "MosaicSceneWidget.h"
34 #include "Project.h"
35 #include "ProjectItem.h"
36 #include "ProjectItemModel.h"
37 
38 namespace Isis {
39 
47  WorkOrder(project) {
48  QAction::setText(tr("View &Footprints..."));
49  m_isUndoable = false;
50  m_isSavedToHistory = false;
51  }
52 
53 
62  WorkOrder(other) {
63  m_isUndoable = other.m_isUndoable;
64  }
65 
66 
73  }
74 
75 
82 
83  return new Footprint2DViewWorkOrder(*this);
84  }
85 
86 
98  bool result = false;
99 
100  foreach (Image *image, *images) {
101  result = result || image->isFootprintable();
102  }
103 
104  return result;
105  }
106 
107 
119  bool result = false;
120 
121  if (shapes) {
122  foreach (Shape *shape, *shapes) {
123  result = result || shape->isFootprintable();
124  }
125  return result;
126  }
127  return result;
128  }
129 
130 
140  bool success = WorkOrder::setupExecution();
141 
142  int maxRecommendedFootprints = 50000;
143  if (success && imageList()->count() > maxRecommendedFootprints) {
144  QMessageBox::StandardButton selectedOpt = QMessageBox::warning(NULL,
145  tr("Potentially Slow Operation"),
146  tr("You are asking to open %L1 images in a 2D footprint view at once. This is possible, "
147  "but will take a significant amount of time and cause overall slowness. Working with "
148  "more than %L2 footprints is not recommended. Are you sure you want to view these "
149  "%L1 footprints?").arg(imageList()->count()).arg(maxRecommendedFootprints),
150  QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
151 
152  if (selectedOpt == QMessageBox::No) {
153  success = false;
154  }
155  }
156 
157  int viewToUse = -1;
158  if (success) {
159  QStringList viewOptions;
160 
162  if (existingViews.count()) {
163  for (int i = 0; i < existingViews.count(); i++) {
164  viewOptions.append(existingViews[i]->windowTitle());
165  }
166  }
167 
168  viewOptions.append(tr("New Footprint View"));
169 
170  if (viewOptions.count() > 1) {
171  QString selected = QInputDialog::getItem(NULL, tr("View to see footprints in"),
172  tr("Which view would you like your\nimage's footprints to be put into?"),
173  viewOptions, viewOptions.count() - 1, false, &success);
174 
175  viewToUse = viewOptions.indexOf(selected);
176  }
177  else {
178  viewToUse = viewOptions.count() - 1;
179  }
180 
181  if (viewToUse == viewOptions.count() - 1) {
182  QUndoCommand::setText(tr("View footprints in new 2D footprint view"));
183  }
184  else if (viewToUse != -1) {
185  QUndoCommand::setText(tr("View footprints in footprint view [%1]")
186  .arg(existingViews[viewToUse]->windowTitle()));
187  }
188 
190  internalData.append(QString::number(viewToUse));
192  }
193  return success;
194  }
195 
196 
203 
204  QList<ProjectItem *> selectedItems = project()->directory()->model()->selectedItems();
205 
206  int viewToUse = internalData().first().toInt();
207 
208  Footprint2DView *view = NULL;
209  if (viewToUse == project()->directory()->footprint2DViews().count()) {
210  view = project()->directory()->addFootprint2DView();
211  }
212  else {
213  view = project()->directory()->footprint2DViews()[viewToUse];
214  }
215 
216  view->addItems( selectedItems );
217  project()->setClean(false);
218  }
219 }
Isis::Footprint2DViewWorkOrder
View an image list's footprints in a footprint view.
Definition: Footprint2DViewWorkOrder.h:64
Isis::WorkOrder::setupExecution
virtual bool setupExecution()
This sets up the state for the work order.
Definition: WorkOrder.cpp:1261
Isis::Footprint2DViewWorkOrder::isExecutable
virtual bool isExecutable(ImageList *images)
This method returns true if one of an image in ImageList images isFootprintable, False if none of the...
Definition: Footprint2DViewWorkOrder.cpp:97
Isis::Directory::footprint2DViews
QList< Footprint2DView * > footprint2DViews()
Accessor for the list of Footprint2DViews currently available.
Definition: Directory.cpp:1410
Isis::Footprint2DView
View for displaying footprints of images in a QMos like way.
Definition: Footprint2DView.h:102
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::WorkOrder
Provide Undo/redo abilities, serialization, and history for an operation.
Definition: WorkOrder.h:311
Project.h
Isis::Directory::model
ProjectItemModel * model()
Gets the ProjectItemModel for this directory.
Definition: Directory.cpp:1091
Isis::Footprint2DViewWorkOrder::Footprint2DViewWorkOrder
Footprint2DViewWorkOrder(Project *project)
Creates a work order to view image footprints.
Definition: Footprint2DViewWorkOrder.cpp:46
Isis::WorkOrder::imageList
ImageList * imageList()
Returns a pointer to the ImageList for this WorkOrder.
Definition: WorkOrder.cpp:631
Isis::WorkOrder::m_isSavedToHistory
bool m_isSavedToHistory
Set the work order to be shown in the HistoryTreeWidget.
Definition: WorkOrder.h:537
Isis::WorkOrder::setInternalData
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1318
Isis::WorkOrder::directory
Directory * directory() const
return the workorder project directory Returns the Directory object of the Project this WorkOrder is ...
Definition: WorkOrder.cpp:1290
Isis::AbstractProjectItemView::addItems
virtual void addItems(QList< ProjectItem * > items)
Adds several items to the view.
Definition: AbstractProjectItemView.cpp:264
Footprint2DViewWorkOrder.h
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Isis::Shape::isFootprintable
bool isFootprintable() const
Test to see if it's possible to create a footprint from this shape.
Definition: Shape.cpp:294
QStringList
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::Project::directory
Directory * directory() const
Returns the directory associated with this Project.
Definition: Project.cpp:1229
Isis::ImageList
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
Isis::Footprint2DViewWorkOrder::setupExecution
virtual bool setupExecution()
Setup this WorkOrder for execution.
Definition: Footprint2DViewWorkOrder.cpp:139
Isis::WorkOrder::m_isUndoable
bool m_isUndoable
Set the workorder to be undoable/redoable This is defaulted to true - his will allow the workorder to...
Definition: WorkOrder.h:523
Isis::ProjectItemModel::selectedItems
QList< ProjectItem * > selectedItems()
Returns a list of the selected items of the internal selection model.
Definition: ProjectItemModel.cpp:158
Isis::Footprint2DViewWorkOrder::execute
virtual void execute()
This either adds a new Footprint2DView containing the selected images or adds the image's footprints ...
Definition: Footprint2DViewWorkOrder.cpp:202
Isis::Shape
This represents a shape in a project-based GUI interface.
Definition: Shape.h:68
Isis::WorkOrder::project
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1300
Isis::Image::isFootprintable
bool isFootprintable() const
Test to see if it's possible to create a footprint from this image.
Definition: Image.cpp:253
Isis::ShapeList
Internalizes a list of shapes and allows for operations on the entire list.
Definition: ShapeList.h:33
Isis::Image
This represents a cube in a project-based GUI interface.
Definition: Image.h:107
Isis::Footprint2DViewWorkOrder::clone
virtual Footprint2DViewWorkOrder * clone() const
This method clones the current Footprint2DViewWorkOrder and returns it.
Definition: Footprint2DViewWorkOrder.cpp:81
Isis::Footprint2DViewWorkOrder::~Footprint2DViewWorkOrder
~Footprint2DViewWorkOrder()
Destructor.
Definition: Footprint2DViewWorkOrder.cpp:72
Isis::WorkOrder::internalData
QStringList internalData() const
Gets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1377
Isis::Directory::addFootprint2DView
Footprint2DView * addFootprint2DView(QString objectName="")
Add the qmos view widget to the window.
Definition: Directory.cpp:757
Isis::Project::setClean
void setClean(bool value)
Function to change the clean state of the project.
Definition: Project.cpp:1595
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16