Isis 3 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 
Internalizes a list of shapes and allows for operations on the entire list.
Definition: ShapeList.h:33
ShapeReader(QMutex *cameraMutex, bool requireFootprints=false, QObject *parent=NULL)
MosaicWidget constructor.
Definition: ShapeReader.cpp:35
virtual ~ShapeReader()
Free the allocated memory by this object.
Definition: ShapeReader.cpp:65
QList< QAction * > actions(ShapeDisplayProperties::Property relevantDispProperties)
Definition: ShapeReader.cpp:84
QProgressBar * progress()
Definition: ShapeReader.cpp:105
void shapesReady(ShapeList shapes)
Definition: AbstractTableModel.h:16
void setSafeFileOpen(bool safeFileOpen)
Definition: ShapeReader.cpp:123
Definition: ShapeReader.h:34
This represents a shape in a project-based GUI interface.
Definition: Shape.h:78
Definition: BoxcarCachingAlgorithm.h:29
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Property
This is a list of properties and actions that are possible.
Definition: ShapeDisplayProperties.h:80
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
void read(PvlObject shapesObj)
Definition: ShapeReader.cpp:110