Isis 3 Programmer Reference
MosaicSceneWorkOrder.cpp
1 #include "IsisDebug.h"
2 #include "MosaicSceneWorkOrder.h"
3 
4 #include <QProgressDialog>
5 
6 #include "Directory.h"
7 #include "Footprint2DView.h"
8 #include "MosaicSceneWidget.h"
9 
10 namespace Isis {
11 
12  MosaicSceneWorkOrder::MosaicSceneWorkOrder(QString actionText, MosaicSceneWidget *scene,
13  Project *project) : WorkOrder(project) {
14 
15  QAction::setText(actionText);
16  QUndoCommand::setText(tr("%1 on [%2]").arg(actionText).arg(scene->windowTitle()));
17 
18  QStringList data;
19  data.append(scene->windowTitle());
20  setInternalData(data);
21  }
22 
23 
24  MosaicSceneWorkOrder::MosaicSceneWorkOrder(Project *project) :
25  WorkOrder(project) {
26  }
27 
28 
29  MosaicSceneWorkOrder::MosaicSceneWorkOrder(const MosaicSceneWorkOrder &other) :
30  WorkOrder(other) {
31  }
32 
33 
38  }
39 
40 
51 
52  MosaicSceneWidget *result = NULL;
53 
54  foreach (Footprint2DView *scene, directory()->footprint2DViews()) {
55  if (internalData().first() == scene->mosaicSceneWidget()->windowTitle()) {
56  result = scene->mosaicSceneWidget();
57  }
58  }
59  return result;
60  }
61 
62 
67  void MosaicSceneWorkOrder::restoreZPositions(bool zValuesMightBeInUse) {
68  QStringList zPositions = internalData().mid(1);
69 
70  ASSERT(zPositions.count() == imageList()->count());
71 
72  MosaicSceneWidget *sceneWidget = scene();
73 
74  QProgressDialog progress(tr("Restoring Z Values"), "", 0, imageList()->count());
75  progress.setCancelButton(NULL);
76  for (int i = imageList()->count() - 1; i >= 0; i--) {
77  int originalZ = qRound(zPositions[i].toDouble());
78  sceneWidget->moveZ(imageList()->at(i), originalZ, zValuesMightBeInUse);
79  progress.setValue(progress.value() + 1);
80  }
81  }
82 
83 
84  void MosaicSceneWorkOrder::storeZPositions(QList<double> zPositions) {
85  QStringList data;
86  data.append(internalData().first());
87 
88  foreach (double zPosition, zPositions) {
89  data.append(QString::number(qRound(zPosition)));
90  }
91 
92  setInternalData(data);
93  }
94 }
This widget encompasses the entire mosaic scene.
View for displaying footprints of images in a QMos like way.
$Date$ $Revision$
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:164
MosaicSceneWidget * scene()
Returns the MosaicSceneWidget corresponding to this work order&#39;s interal data (the MosaicSceneWidget&#39;...
void restoreZPositions(bool zValuesMightBeInUse)
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
ImageList * imageList()
Returns a pointer to the ImageList for this WorkOrder.
Definition: WorkOrder.cpp:645
QStringList internalData() const
Gets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1391
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1332
Directory * directory() const
return the workorder project directory Returns the Directory object of the Project this WorkOrder is ...
Definition: WorkOrder.cpp:1304