Isis Developer Reference
ShapeReader.h
Go to the documentation of this file.
1 #ifndef ShapeReader_H
2 #define ShapeReader_H
3 
4 #include <QObject>
5 
6 #include <QPointer>
7 
8 // This is the parent of the inner class
9 #include <functional>
10 
11 #include "ShapeDisplayProperties.h"
12 #include "ShapeList.h"
13 #include "ProgressBar.h"
14 #include "PvlObject.h"
15 
16 template <typename A> class QFutureWatcher;
17 class QMutex;
18 class QProgressBar;
19 class QStringList;
20 class QVariant;
21 
22 namespace Isis {
23  class PvlObject;
24 
34  class ShapeReader : public QObject {
35  Q_OBJECT
36 
37  public:
38  ShapeReader(QMutex *cameraMutex, bool requireFootprints = false, QObject *parent = NULL);
39  virtual ~ShapeReader();
40 
43 
44  signals:
45  void shapesReady(ShapeList shapes);
46 
47  public slots:
48  void read(PvlObject shapesObj);
49  void read(QStringList shapeFileNames);
50  void setSafeFileOpen(bool safeFileOpen);
51 
52  private slots:
53  void shapesReady(int);
54  void mappedFinished();
55  //void setSmallNumberOfOpenShapes(bool useSmallNumber);
56 
57  private:
58  Q_DISABLE_COPY(ShapeReader)
59 
60  template <typename Iterator>
61  void read(Iterator begin, Iterator end) {
62  int numNewEntries = 0;
63  while (begin != end) {
64  m_backlog.append(qVariantFromValue(*begin));
65  numNewEntries++;
66  begin++;
67  }
68 
69  m_progress->setRange(0, m_progress->maximum() + numNewEntries);
70 
71  start();
72  }
73 
74  void initProgress();
75  void start();
76 
77  void readSettings();
78  void writeSettings();
79 
80  private:
85  QPointer<QAction> m_askAlphaAct;
86  QList<QVariant> m_backlog;
87  QMutex *m_cameraMutex;
88  QPointer<QAction> m_openFilledAct;
89  QPointer<ProgressBar> m_progress;
90  QPointer<QAction> m_safeFileOpenAct;
91  QFutureWatcher<Shape *> * m_watcher;
92 
93  bool m_safeFileOpen;
94  bool m_openFilled;
95  int m_defaultAlpha;
96  bool m_requireFootprints;
97 
98  bool m_mappedRunning;
99 
100  private:
109  class VariantToShapeFunctor : public std::unary_function<
110  const QVariant &, Shape *> {
111 
112  public:
113  VariantToShapeFunctor(QMutex *cameraMutex, bool requireFootprints, QThread *targetThread,
114  bool openFilled, int defaultAlpha);
115  Shape *operator()(const QVariant &);
116 
117  private:
118  QMutex *m_mutex;
119  QThread *m_targetThread;
120 
121  int m_defaultAlpha;
122  bool m_openFilled;
123  bool m_requireFootprints;
124  };
125  };
126 };
127 
128 #endif
129 
ShapeReader.h
FileName.h
Isis::ShapeReader
Definition: ShapeReader.h:34
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
Isis::ShapeReader::setSafeFileOpen
void setSafeFileOpen(bool safeFileOpen)
Definition: ShapeReader.cpp:123
ShapeDisplayProperties.h
Isis::ShapeDisplayProperties::Property
Property
This is a list of properties and actions that are possible.
Definition: ShapeDisplayProperties.h:66
QStringList
IString.h
Shape.h
ShapeList.h
Isis::ShapeReader::ShapeReader
ShapeReader(QMutex *cameraMutex, bool requireFootprints=false, QObject *parent=NULL)
MosaicWidget constructor.
Definition: ShapeReader.cpp:35
Isis::ShapeReader::~ShapeReader
virtual ~ShapeReader()
Free the allocated memory by this object.
Definition: ShapeReader.cpp:65
Isis::ShapeReader::actions
QList< QAction * > actions(ShapeDisplayProperties::Property relevantDispProperties)
Definition: ShapeReader.cpp:84
Isis::ShapeList
Internalizes a list of shapes and allows for operations on the entire list.
Definition: ShapeList.h:33
Isis::ShapeReader::read
void read(PvlObject shapesObj)
Definition: ShapeReader.cpp:110
ProgressBar.h
IException.h
QThread
QFutureWatcher
This is free and unencumbered software released into the public domain.
Definition: AbstractTableModel.h:24
PvlObject.h
QObject
QAction
Isis::ShapeReader::shapesReady
void shapesReady(ShapeList shapes)
Isis::ShapeReader::progress
QProgressBar * progress()
Definition: ShapeReader.cpp:105
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16