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
12#include "ShapeList.h"
13#include "ProgressBar.h"
14#include "PvlObject.h"
15
16template <typename A> class QFutureWatcher;
17class QMutex;
18class QProgressBar;
19class QStringList;
20class QVariant;
21
22namespace 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
41 QList<QAction *> actions(ShapeDisplayProperties::Property relevantDispProperties);
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::function<
110 Shape *(const QVariant &)> {
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
Contains Pvl Groups and Pvl Objects.
Definition PvlObject.h:61
Property
This is a list of properties and actions that are possible.
Definition ShapeDisplayProperties.h:66
Internalizes a list of shapes and allows for operations on the entire list.
Definition ShapeList.h:33
Definition ShapeReader.h:34
ShapeReader(QMutex *cameraMutex, bool requireFootprints=false, QObject *parent=NULL)
MosaicWidget constructor.
Definition ShapeReader.cpp:35
void read(PvlObject shapesObj)
Definition ShapeReader.cpp:110
QProgressBar * progress()
Definition ShapeReader.cpp:105
void shapesReady(ShapeList shapes)
QList< QAction * > actions(ShapeDisplayProperties::Property relevantDispProperties)
Definition ShapeReader.cpp:84
virtual ~ShapeReader()
Free the allocated memory by this object.
Definition ShapeReader.cpp:65
void setSafeFileOpen(bool safeFileOpen)
Definition ShapeReader.cpp:123
This is free and unencumbered software released into the public domain.
Definition AbstractTableModel.h:24
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16