27 #include <QFileDialog>
28 #include <QInputDialog>
29 #include <QMessageBox>
32 #include "MosaicSceneItem.h"
33 #include "MosaicSceneWidget.h"
38 Footprint2DViewWorkOrder::Footprint2DViewWorkOrder(Project *project) :
40 QAction::setText(tr(
"View &Footprints..."));
44 Footprint2DViewWorkOrder::Footprint2DViewWorkOrder(
const Footprint2DViewWorkOrder &other) :
49 Footprint2DViewWorkOrder::~Footprint2DViewWorkOrder() {
53 Footprint2DViewWorkOrder *Footprint2DViewWorkOrder::clone()
const {
55 return new Footprint2DViewWorkOrder(*
this);
63 foreach (
Image *image, *images) {
74 int maxRecommendedFootprints = 50000;
75 if (success && imageList()->count() > maxRecommendedFootprints) {
76 QMessageBox::StandardButton selectedOpt = QMessageBox::warning(NULL,
77 tr(
"Potentially Slow Operation"),
78 tr(
"You are asking to open %L1 images in a 2D footprint view at once. This is possible, "
79 "but will take a significant amount of time and cause overall slowness. Working with "
80 "more than %L2 footprints is not recommended. Are you sure you want to view these "
81 "%L1 footprints?").arg(imageList()->count()).arg(maxRecommendedFootprints),
82 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
84 if (selectedOpt == QMessageBox::No) {
95 if (existingViews.count()) {
96 for (
int i = 0; i < existingViews.count(); i++) {
97 viewOptions.append(existingViews[i]->windowTitle());
101 viewOptions.append(tr(
"New Footprint View"));
103 if (viewOptions.count() > 1) {
104 QString selected = QInputDialog::getItem(NULL, tr(
"View to see footprints in"),
105 tr(
"Which view would you like your\nimage's footprints to be put into?"),
106 viewOptions, viewOptions.count() - 1,
false, &success);
108 viewToUse = viewOptions.indexOf(selected);
111 viewToUse = viewOptions.count() - 1;
114 bool newView =
false;
115 if (viewToUse == viewOptions.count() - 1) {
117 if (!imageList()->
name().isEmpty()) {
118 QUndoCommand::setText(tr(
"View image footprints of list [%1] in new 2D footprint view")
119 .arg(imageList()->name()));
122 QUndoCommand::setText(tr(
"View [%1] image footprints in new footprint view")
123 .arg(imageList()->count()));
126 else if (viewToUse != -1) {
132 QMutableListIterator<Image *> it(*imageList());
134 while (it.hasNext()) {
135 Image *image = it.next();
137 if (footprintView->cubeToMosaic(image)) {
142 if (list.count() != imageList()->count()) {
146 if (!imageList()->name().isEmpty()) {
147 QUndoCommand::setText(tr(
"View image footprints of list [%1] in footprint view [%2]")
148 .arg(imageList()->name()).arg(existingViews[viewToUse]->windowTitle()));
151 QUndoCommand::setText(tr(
"View [%1] image footprints in footprint view [%2]")
152 .arg(imageList()->count()).arg(existingViews[viewToUse]->windowTitle()));
157 internalData.append(QString::number(viewToUse));
158 internalData.append(newView?
"new view" :
"existing view");
159 setInternalData(internalData);
166 bool Footprint2DViewWorkOrder::dependsOn(
WorkOrder *other)
const {
173 int viewToUse = internalData().first().toInt();
176 if (viewToUse == project()->directory()->footprint2DViews().count()) {
177 footprintViewToUse = project()->directory()->addFootprint2DView();
180 footprintViewToUse = project()->directory()->footprint2DViews()[viewToUse];
183 ImageList nonFootprintable = *imageList();
186 QMutableListIterator<Image *> it(nonFootprintable);
188 while (it.hasNext()) {
189 Image *unknownFootprintability = it.next();
192 footprintable.
append(unknownFootprintability);
197 footprintViewToUse->addImages(footprintable);
199 foreach (
Image *nonFootprintableImage, nonFootprintable) {
200 project()->warn(tr(
"Image [%1] does not have and cannot create an associated footprint")
208 int viewToUse = internalData().first().toInt();
210 if (internalData()[1] ==
"new view") {
211 delete project()->directory()->footprint2DViews().last();
214 MosaicSceneWidget *footprintView = project()->directory()->footprint2DViews()[viewToUse];
216 QListIterator<Image *> it(*imageList());
217 while (it.hasNext()) {
218 Image *imageToRemoveFromView = it.next();
219 delete footprintView->cubeToMosaic(imageToRemoveFromView);