Isis 3 Programmer Reference
GuiCameraList.h
1 #ifndef GuiCameraList_H
2 #define GuiCameraList_H
3 
4 #include <QDebug>
5 #include <QList>
6 #include <QMetaType>
7 #include <QObject>
8 
9 #include "GuiCamera.h"
11 //#include "GuiCameraListActionWorkOrder.h" TODO - will we need this?
12 #include "WorkOrder.h"
13 #include "XmlStackedHandler.h"
14 
15 class QStringList;
16 class QXmlStreamWriter;
17 
18 namespace Isis {
19  class FileName;
20  class XmlStackedHandlerReader;
21 
35  class GuiCameraList : public QObject, public QList<GuiCameraQsp> {
36  Q_OBJECT
37 
38  public:
39 // friend class GuiCameraListActionWorkOrder;
40 
41  GuiCameraList(QString name, QString path, QObject *parent = NULL);
42  explicit GuiCameraList(QObject *parent = NULL);
43  explicit GuiCameraList(QList<GuiCameraQsp>, QObject *parent = NULL);
44  explicit GuiCameraList(Project *project,
45  XmlStackedHandlerReader *xmlReader, QObject *parent = NULL);
46 // explicit GuiCameraList(QStringList &);
49 
50  // These are overridden (-ish) in order to add notifications to the list changing
51  void append(GuiCameraQsp const & value);
52  void append(const QList<GuiCameraQsp> &value);
53 
54  void clear();
55 
56  iterator erase(iterator pos);
57  iterator erase(iterator begin, iterator end);
58 
59  void insert(int i, GuiCameraQsp const & value);
60  iterator insert(iterator before, GuiCameraQsp const & value);
61 
62  void prepend(GuiCameraQsp const & value);
63  void push_back(GuiCameraQsp const & value);
64  void push_front(GuiCameraQsp const & value);
65  int removeAll(GuiCameraQsp const & value);
66  void removeAt(int i);
67  void removeFirst();
68  void removeLast();
69  bool removeOne(GuiCameraQsp const & value);
70  void swap(QList<GuiCameraQsp> &other);
71  GuiCameraQsp takeAt(int i);
74 
76  GuiCameraList &operator+=(GuiCameraQsp const &other);
77  GuiCameraList &operator<<(const QList<GuiCameraQsp> &other);
78  GuiCameraList &operator<<(GuiCameraQsp const &other);
80 
81  // This is our own assignment, but it needs to notify just like the operator=(QList)
83 
84  // Done overriding (-ish)
85 
86 
87  QList<QAction *> supportedActions(Project *project = NULL);
88  bool allSupport(GuiCameraDisplayProperties::Property prop);
89 
90  void setName(QString newName);
91  void setPath(QString newPath);
92 
93  QString name() const;
94  QString path() const;
95 
96 // void deleteFromDisk(Project *project);
97  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
98 
99 
100  signals:
105  void countChanged(int newCount);
106 
107  private:
117  class XmlHandler : public XmlStackedHandler {
118  public:
120 
121  virtual bool startElement(const QString &namespaceURI, const QString &localName,
122  const QString &qName, const QXmlAttributes &atts);
123  virtual bool endElement(const QString &namespaceURI, const QString &localName,
124  const QString &qName);
125 
126  private:
127  Q_DISABLE_COPY(XmlHandler);
128 
129  GuiCameraList *m_GuiCameraList;
130  Project *m_project;
131  };
132 
133 
146 // class CopyTargetBodyDataFunctor : public std::unary_function<TargetBodyQsp const &, void *> {
147 // public:
148 // CopyTargetBodyDataFunctor(const Project *project, FileName newProjectRoot);
149 // CopyTargetBodyDataFunctor(const CopyTargetBodyDataFunctor &other);
150 // ~CopyTargetBodyDataFunctor();
151 
152 // void *operator()(TargetBodyQsp const &imageToCopy);
153 
154 // CopyTargetBodyDataFunctor &operator=(const CopyTargetBodyDataFunctor &rhs);
155 
156 // private:
157 // const Project *m_project;
158 // FileName m_newProjectRoot;
159 // };
160 
161  private:
162 // QAction *createWorkOrder(Project *project, GuiCameraListActionWorkOrder::Action action) {
163 // QAction *result = NULL;
164 
165 // if (project) {
166 // result = new GuiCameraListActionWorkOrder(action, project);
167 // ((GuiCameraListActionWorkOrder *)result)->setData(this);
168 // }
169 // else {
170 // result = new QAction(
171 // GuiCameraListActionWorkOrder::qualifyString(GuiCameraListActionWorkOrder::toString(action),
172 // this),
173 // this);
174 // }
175 
176 // return result;
177 // }
178 
179 // void applyAlphas(QStringList alphaValues);
180 // void applyColors(QStringList colorValues, int column = 0);
181 // void applyShowLabel(QStringList showLabelValues);
182 // void applyShowFill(QStringList showFillValues);
183 // void applyShowDNs(QStringList showDNsValues);
184 // void applyShowOutline(QStringList showOutlineValues);
185 // bool askAlpha(int *alphaResult) const;
186 // bool askNewColor(QColor *colorResult) const;
187 // QStringList saveAndApplyAlpha(int newAlpha);
188 // QStringList saveAndApplyColor(QColor newColor);
189 // QStringList saveAndApplyRandomColor();
190 
191  private slots:
192 // void askAndUpdateAlpha();
193 // void askAndUpdateColor();
194 // void showRandomColor();
195 // QStringList saveAndToggleShowDNs();
196 // QStringList saveAndToggleShowFill();
197 // QStringList saveAndToggleShowLabel();
198 // QStringList saveAndToggleShowOutline();
199 
200  private:
201  QString m_name;
202 
213  QString m_path;
214  };
215  // TODO: add QDataStream >> and << ???
216 }
217 
219 
220 #endif
void push_front(GuiCameraQsp const &value)
Inserts a GuiCamera at the front of the list.
int removeAll(GuiCameraQsp const &value)
Removes all occurances of a GuiCamera from the list.
~GuiCameraList()
Create a gui camera list from a list of gui camera file names.
The main project for ipce.
Definition: Project.h:289
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle an XML end element.
File name manipulation and expansion.
Definition: FileName.h:116
iterator erase(iterator pos)
Removes the GuiCamera associated with an iterator.
GuiCameraList & operator=(const QList< GuiCameraQsp > &rhs)
Assigns a list of GuiCameras to the list.
XmlHandler(GuiCameraList *GuiCameraList, Project *project)
Change the visibility of the display name.
void swap(QList< GuiCameraQsp > &other)
Swaps the list with another GuiCameraList.
GuiCameraQsp takeAt(int i)
Removes and returns the GuiCamera at a specific index.
Q_DECLARE_METATYPE(Isis::Cube *)
This allows Cube *&#39;s to be stored in a QVariant.
void removeFirst()
Removes the first GuiCamera in the list.
QString m_path
This stores the directory name that contains the GuiCamera objects in this list.
QString name() const
Get the human-readable name of this gui cameray list.
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Delete all of the contained GuiCamera objects from disk (see GuiCamera::deleteFromDisk()) ...
void prepend(GuiCameraQsp const &value)
Inserts a GuiCamera at the beginning of the list.
void clear()
Clears the list.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void push_back(GuiCameraQsp const &value)
Inserts a GuiCamera at the end of the list.
void insert(int i, GuiCameraQsp const &value)
Inserts a GuiCamera into the list at a given index.
QString path() const
Get the path to these gui camera objects in the list (relative to project root).
XmlHandler used to save to xml files.
GuiCameraQsp takeFirst()
Removes and returns the first GuiCamera in the list.
bool removeOne(GuiCameraQsp const &value)
Removes the first occurance of a GuiCamera from the list.
void removeAt(int i)
Removes the GuiCamera at a specific index.
void setPath(QString newPath)
Set the relative path (from the project root) to this gui camera list&#39;s folder.
QString m_name
This functor is used for copying the GuiCamera objects between two projects quickly.
XML Handler that parses XMLs in a stack-oriented way.
GuiCameraList & operator+=(const QList< GuiCameraQsp > &other)
Appends another GuiCameraList to the list and returns a reference to this.
GuiCameraList(QString name, QString path, QObject *parent=NULL)
Create an gui camera list from a gui camera list name and path (does not read GuiCamera objects)...
Property
This is a list of properties and actions that are possible.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
List of GuiCameras saved as QSharedPointers.
Definition: GuiCameraList.h:35
void countChanged(int newCount)
Emitted when the number of GuiCameras in the list changes.
void removeLast()
Removes the last GuiCamera in the list.
void append(GuiCameraQsp const &value)
Appends a single GuiCamera to the list.
GuiCameraQsp takeLast()
Removes and returns the last GuiCamera in the list.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
GuiCameraList & operator<<(const QList< GuiCameraQsp > &other)
Appends another GuiVameraList to the list and returns a reference to this.
void setName(QString newName)
Gets a list of pre-connected actions that have to do with display, such as color, alpha...
Manage a stack of content handlers for reading XML files.