Isis 3.0 Programmer Reference
Back | Home
ControlList.h
1 #ifndef ControlList_H
2 #define ControlList_H
3 
4 #include <QDebug>
5 #include <QList>
6 #include <QMetaType>
7 #include <QObject>
8 
9 #include "Control.h"
11 #include "WorkOrder.h"
12 #include "XmlStackedHandler.h"
13 
14 class QStringList;
15 class QXmlStreamWriter;
16 
17 namespace Isis {
18  class FileName;
19  class XmlStackedHandlerReader;
20 
34  class ControlList : public QObject, public QList<Control *> {
35  Q_OBJECT
36 
37  public:
38 
39  ControlList(QString name, QString path, QObject *parent = NULL);
40  explicit ControlList(QObject *parent = NULL);
41  explicit ControlList(QList<Control *>, QObject *parent = NULL);
42  explicit ControlList(Project *project, XmlStackedHandlerReader *xmlReader,
43  QObject *parent = NULL);
44  explicit ControlList(QStringList &);
45  ControlList(const ControlList &);
46  ~ControlList();
47 
48  // These are overridden (-ish) in order to add notifications to the list changing
49  void append(Control * const &value);
50  void append(const QList<Control *> &value);
51 
52  void clear();
53 
54  iterator erase(iterator pos);
55  iterator erase(iterator begin, iterator end);
56 
57  void insert(int i, Control * const &value);
58  iterator insert(iterator before, Control * const &value);
59 
60  void prepend(Control * const &value);
61  void push_back(Control * const &value);
62  void push_front(Control * const &value);
63  int removeAll(Control * const &value);
64  void removeAt(int i);
65  void removeFirst();
66  void removeLast();
67  bool removeOne(Control * const &value);
68  void swap(QList<Control *> &other);
69  Control *takeAt(int i);
70  Control *takeFirst();
71  Control *takeLast();
72 
74  ControlList &operator+=(Control * const &other);
75  ControlList &operator<<(const QList<Control *> &other);
76  ControlList &operator<<(Control * const &other);
78 
79  // This is our own assignment, but it needs to notify just like the operator=(QList)
80  ControlList &operator=(const ControlList &rhs);
81 
82  // Done overriding (-ish)
83 
84 
85  QList<QAction *> supportedActions(Project *project = NULL);
86  bool allSupport(ControlDisplayProperties::Property prop);
87 
88  void setName(QString newName);
89  void setPath(QString newPath);
90 
91  QString name() const;
92  QString path() const;
93 
94  void deleteFromDisk(Project *project);
95  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
96 
97 
98  signals:
99  void countChanged(int newCount);
100  void deletingList(ControlList *list);
101 
102  private:
103 
104 
116  class CopyControlDataFunctor : public std::unary_function<Control * const &, void *> {
117  public:
118  CopyControlDataFunctor(const Project *project, FileName newProjectRoot);
121 
122  void *operator()(Control * const &controlToCopy);
123 
125 
126  private:
129  };
130 
142  class XmlHandler : public XmlStackedHandler {
143  public:
144  XmlHandler(ControlList *controlList, Project *project);
145 
146  virtual bool startElement(const QString &namespaceURI, const QString &localName,
147  const QString &qName, const QXmlAttributes &atts);
148  virtual bool endElement(const QString &namespaceURI, const QString &localName,
149  const QString &qName);
150 
151  private:
152  Q_DISABLE_COPY(XmlHandler);
153 
156  };
157 
158 
159  private:
160  QString m_name;
161 
172  QString m_path;
173  };
174 }
175 
177 
178 #endif
This represents an ISIS control net in a project-based GUI interface.
Definition: Control.h:57
Property
This is a list of properties and actions that are possible.
FileName m_newProjectRoot
The filename of the destination project&#39;s root.
Definition: ControlList.h:128
ControlList(QString name, QString path, QObject *parent=NULL)
Create an control list from a control list name and path (does not read Controls).
Definition: ControlList.cpp:51
The main project for cnetsuite.
Definition: Project.h:105
~ControlList()
Destructor.
iterator erase(iterator pos)
Erases a control pointer from the control list at the specified position.
void insert(int i, Control *const &value)
Inserts a control pointer at the specified position in the control list.
File name manipulation and expansion.
Definition: FileName.h:111
Maintains a list of Controls so that control nets can easily be copied from one Project to another...
Definition: ControlList.h:34
void setName(QString newName)
Set the human-readable name of this control list.
void push_front(Control *const &value)
Equivalent to prepend(value)
ControlList & operator<<(const QList< Control * > &other)
Appends a list of other control pointers to this control list.
const Project * m_project
Project to copy the control list to.
Definition: ControlList.h:127
Q_DECLARE_METATYPE(Isis::Cube *)
This allows Cube *&#39;s to be stored in a QVariant.
void swap(QList< Control * > &other)
Swaps this control list&#39;s control pointers with the other list of control pointers.
~CopyControlDataFunctor()
CopyControlDataFunctor destructor.
CopyControlDataFunctor & operator=(const CopyControlDataFunctor &rhs)
CopyControlDataFunctor assignment operator.
bool removeOne(Control *const &value)
Removes the first occurence of the control pointer from the control list.
void removeLast()
Removes the last control pointer from the control list.
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Convert this control list into XML format for saving/restoring capabilities.
QString m_name
Name of the ControlList.
Definition: ControlList.h:160
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle an XML end element.
ControlList * m_controlList
Control list to be read or written.
Definition: ControlList.h:154
XmlHandler(ControlList *controlList, Project *project)
Create an XML Handler (reader/writer) that can populate the ControlList class data.
QString name() const
Get the human-readable name of this control list.
Nested class used to write the ControlList object information to an XML file for the purposes of savi...
Definition: ControlList.h:142
XML Handler that parses XMLs in a stack-oriented way.
Control * takeFirst()
Removes the first control pointer from the control list and returns it.
void clear()
Clears the control list.
ControlList & operator+=(const QList< Control * > &other)
Appends control pointers from the other list to this control list.
void append(Control *const &value)
Appends a control pointer to the control list.
void prepend(Control *const &value)
Prepends a control pointer to the control list.
CopyControlDataFunctor(const Project *project, FileName newProjectRoot)
CopyControlDataFunctor constructor.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
void push_back(Control *const &value)
Equivalent to append(value)
Control * takeLast()
Removes the last control pointer from the control list and returns it.
void setPath(QString newPath)
Set the relative path (from the project root) to this control list&#39;s folder.
QString m_path
This stores the directory name that contains the controls in this control list.
Definition: ControlList.h:172
Control * takeAt(int i)
Remove the control pointer at the specified index and returns it.
void removeAt(int i)
Removes the control pointer at the specified index.
ControlList & operator=(const QList< Control * > &rhs)
Assigns another list of control pointers to this control list.
void deleteFromDisk(Project *project)
Delete all of the contained Controls from disk.
his enables stack-based XML parsing of XML files.
void removeFirst()
Removes the first control pointer from the control list.
void * operator()(Control *const &controlToCopy)
Copies the Control from one project to another.
int removeAll(Control *const &value)
Removes all occurences of the control pointer in the control list.
Project * m_project
Project that contains the control list.
Definition: ControlList.h:155
This functor is used for copying the control nets between two projects quickly.
Definition: ControlList.h:116
QString path() const
Get the path to these controls in the control list (relative to project root).

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:16:20