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
38namespace Isis {
39
47 WorkOrder(project) {
48 QAction::setText(tr("View &Footprints..."));
49 m_isUndoable = false;
50 m_isSavedToHistory = false;
51 }
52
53
65
66
74
75
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
161 QList<Footprint2DView *> existingViews = project()->directory()->footprint2DViews();
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}
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
QList< Footprint2DView * > footprint2DViews()
Accessor for the list of Footprint2DViews currently available.
ProjectItemModel * model()
Gets the ProjectItemModel for this directory.
Footprint2DView * addFootprint2DView(QString objectName="")
Add the qmos view widget to the window.
View for displaying footprints of images in a QMos like way.
View an image list's footprints in a footprint view.
virtual void execute()
This either adds a new Footprint2DView containing the selected images or adds the image's footprints ...
virtual bool setupExecution()
Setup this WorkOrder for execution.
virtual bool isExecutable(ImageList *images)
This method returns true if one of an image in ImageList images isFootprintable, False if none of the...
Footprint2DViewWorkOrder(Project *project)
Creates a work order to view image footprints.
virtual Footprint2DViewWorkOrder * clone() const
This method clones the current Footprint2DViewWorkOrder and returns it.
This represents a cube in a project-based GUI interface.
Definition Image.h:107
bool isFootprintable() const
Test to see if it's possible to create a footprint from this image.
Definition Image.cpp:253
Internalizes a list of images and allows for operations on the entire list.
Definition ImageList.h:55
The main project for ipce.
Definition Project.h:289
Directory * directory() const
Returns the directory associated with this Project.
Definition Project.cpp:1228
void setClean(bool value)
Function to change the clean state of the project.
Definition Project.cpp:1594
QList< ProjectItem * > selectedItems()
Returns a list of the selected items of the internal selection model.
This represents a shape in a project-based GUI interface.
Definition Shape.h:68
bool isFootprintable() const
Test to see if it's possible to create a footprint from this shape.
Definition Shape.cpp:294
Internalizes a list of shapes and allows for operations on the entire list.
Definition ShapeList.h:33
Provide Undo/redo abilities, serialization, and history for an operation.
Definition WorkOrder.h:311
bool m_isSavedToHistory
Set the work order to be shown in the HistoryTreeWidget.
Definition WorkOrder.h:537
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
virtual bool setupExecution()
This sets up the state for the work order.
QStringList internalData() const
Gets the internal data for this WorkOrder.
Directory * directory() const
return the workorder project directory Returns the Directory object of the Project this WorkOrder is ...
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
Project * project() const
Returns the Project this WorkOrder is attached to.
ImageList * imageList()
Returns a pointer to the ImageList for this WorkOrder.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16