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 }
Isis::MosaicSceneWorkOrder::scene
MosaicSceneWidget * scene()
Returns the MosaicSceneWidget corresponding to this work order's interal data (the MosaicSceneWidget'...
Definition: MosaicSceneWorkOrder.cpp:50
Isis::Footprint2DView
View for displaying footprints of images in a QMos like way.
Definition: Footprint2DView.h:102
QList< double >
Isis::WorkOrder::imageList
ImageList * imageList()
Returns a pointer to the ImageList for this WorkOrder.
Definition: WorkOrder.cpp:631
Isis::WorkOrder::setInternalData
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1318
Isis::MosaicSceneWidget::moveZ
double moveZ(MosaicSceneItem *sceneItem, double newZ, bool newZValueMightExist=true)
This method moves the given scene item to the given Z value.
Definition: MosaicSceneWidget.cpp:1955
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::MosaicSceneWidget
This widget encompasses the entire mosaic scene.
Definition: MosaicSceneWidget.h:153
QStringList
Isis::toDouble
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
Isis::WorkOrder::internalData
QStringList internalData() const
Gets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1377
Isis::MosaicSceneWorkOrder::restoreZPositions
void restoreZPositions(bool zValuesMightBeInUse)
Definition: MosaicSceneWorkOrder.cpp:67
Isis::MosaicSceneWorkOrder::~MosaicSceneWorkOrder
~MosaicSceneWorkOrder()
Destructor.
Definition: MosaicSceneWorkOrder.cpp:37
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16