Isis 3 Programmer Reference
ImageReader.h
1 #ifndef ImageReader_H
2 #define ImageReader_H
3 
4 #include <QObject>
5 
6 #include <QPointer>
7 
8 // This is the parent of the inner class
9 #include <functional>
10 
11 // We're using an internal enum for actions()
12 #include "ImageDisplayProperties.h"
13 // This is in a signal
14 #include "ImageList.h"
15 // This is inlined in the templated read()
16 #include "ProgressBar.h"
17 // This is in a slot
18 #include "PvlObject.h"
19 
20 template <typename A> class QFutureWatcher;
21 class QMutex;
22 class QProgressBar;
23 class QStringList;
24 class QVariant;
25 
26 namespace Isis {
27  class PvlObject;
28 
43  class ImageReader : public QObject {
44  Q_OBJECT
45 
46  public:
47  ImageReader(QMutex *cameraMutex, bool requireFootprints = true, QObject *parent = NULL);
48  virtual ~ImageReader();
49 
50  QList<QAction *> actions(ImageDisplayProperties::Property relevantDispProperties);
51  QProgressBar *progress();
52 
53  signals:
54  void imagesReady(ImageList images);
55 
56  public slots:
57  void askDefaultAlpha();
58  void read(PvlObject imagesObj);
59  void read(QStringList imageFileNames);
60  void setOpenFilled(bool openFilled);
61  void setSafeFileOpen(bool safeFileOpen);
62 
63  private slots:
64  void imageReady(int);
65  void mappedFinished();
66  //void setSmallNumberOfOpenImages(bool useSmallNumber);
67 
68  private:
69  Q_DISABLE_COPY(ImageReader)
70 
71  template <typename Iterator>
72  void read(Iterator begin, Iterator end) {
73  int numNewEntries = 0;
74  while (begin != end) {
75  m_backlog.append(qVariantFromValue(*begin));
76  numNewEntries++;
77  begin++;
78  }
79 
80  m_progress->setRange(0, m_progress->maximum() + numNewEntries);
81 
82  start();
83  }
84 
85  void initProgress();
86  void start();
87 
88  void readSettings();
89  void writeSettings();
90 
91  private:
96  QPointer<QAction> m_askAlphaAct;
97  QList<QVariant> m_backlog;
98  QMutex *m_cameraMutex;
99  QPointer<QAction> m_openFilledAct;
100  QPointer<ProgressBar> m_progress;
101  QPointer<QAction> m_safeFileOpenAct;
102  QFutureWatcher<Image *> * m_watcher;
103 
104  bool m_safeFileOpen;
105  bool m_openFilled;
106  int m_defaultAlpha;
107  bool m_requireFootprints;
108 
109  bool m_mappedRunning;
110 
111  private:
120  class VariantToImageFunctor : public std::unary_function<
121  const QVariant &, Image *> {
122 
123  public:
124  VariantToImageFunctor(QMutex *cameraMutex, bool requireFootprints, QThread *targetThread,
125  bool openFilled, int defaultAlpha);
126  Image *operator()(const QVariant &);
127 
128  private:
129  QMutex *m_mutex;
130  QThread *m_targetThread;
131 
132  int m_defaultAlpha;
133  bool m_openFilled;
134  bool m_requireFootprints;
135  };
136  };
137 };
138 
139 #endif
140 
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
VariantToImageFunctor(QMutex *cameraMutex, bool requireFootprints, QThread *targetThread, bool openFilled, int defaultAlpha)
Create a functor for converting from QVariant to an Image *.
virtual ~ImageReader()
Free the allocated memory by this object.
Definition: ImageReader.cpp:65
ImageReader(QMutex *cameraMutex, bool requireFootprints=true, QObject *parent=NULL)
MosaicWidget constructor.
Definition: ImageReader.cpp:35
QPointer< QAction > m_askAlphaAct
Variant Internal Format: (QString|PvlObject).
Definition: ImageReader.h:96
Converts from file name or project representation to Image *.
Definition: ImageReader.h:120
This represents a cube in a project-based GUI interface.
Definition: Image.h:107
Image * operator()(const QVariant &)
Read the QString filename and make an Image from it.
Property
This is a list of properties and actions that are possible.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74