Isis Developer Reference
ImageReader.h
Go to the documentation of this file.
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 
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 
FileName.h
Isis::ImageReader::imagesReady
void imagesReady(ImageList images)
QProgressBar
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
QList< QAction * >
Isis::ProgressBar
Definition: ProgressBar.h:15
Isis::PvlObject::beginObject
PvlObjectIterator beginObject()
Returns the index of the beginning object.
Definition: PvlObject.h:235
Isis::PvlObject::endObject
PvlObjectIterator endObject()
Returns the index of the ending object.
Definition: PvlObject.h:253
ImageDisplayProperties.h
Image.h
Isis::ImageReader
Definition: ImageReader.h:43
Isis::ImageDisplayProperties::Property
Property
This is a list of properties and actions that are possible.
Definition: ImageDisplayProperties.h:91
QStringList
IString.h
Isis::ImageReader::read
void read(PvlObject imagesObj)
Definition: ImageReader.cpp:147
Isis::ImageList
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
Isis::ImageReader::ImageReader
ImageReader(QMutex *cameraMutex, bool requireFootprints=true, QObject *parent=NULL)
MosaicWidget constructor.
Definition: ImageReader.cpp:35
Isis::ImageReader::setSafeFileOpen
void setSafeFileOpen(bool safeFileOpen)
Definition: ImageReader.cpp:168
Isis::ImageDisplayProperties::Color
@ Color
The color of the cube, default randomized (QColor)
Definition: ImageDisplayProperties.h:95
Isis::ImageReader::askDefaultAlpha
void askDefaultAlpha()
Definition: ImageReader.cpp:134
ImageList.h
ProgressBar.h
Isis::ImageReader::~ImageReader
virtual ~ImageReader()
Free the allocated memory by this object.
Definition: ImageReader.cpp:65
IException.h
Isis::ImageReader::progress
QProgressBar * progress()
Definition: ImageReader.cpp:129
QThread
Isis::ImageDisplayProperties::ShowFill
@ ShowFill
True if the cube should show a fill area if possible (bool)
Definition: ImageDisplayProperties.h:101
QFutureWatcher
This is free and unencumbered software released into the public domain.
Definition: AbstractTableModel.h:24
PvlObject.h
ImageReader.h
QObject
QAction
Isis::ImageReader::setOpenFilled
void setOpenFilled(bool openFilled)
Definition: ImageReader.cpp:160
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::ImageReader::actions
QList< QAction * > actions(ImageDisplayProperties::Property relevantDispProperties)
Definition: ImageReader.cpp:84