Isis 3 Programmer Reference
TargetBodyList.h
1 #ifndef TargetBodyList_H
2 #define TargetBodyList_H
3 
4 #include <QDebug>
5 #include <QObject>
6 #include <QList>
7 #include <QMetaType>
8 
9 #include "TargetBody.h"
10 #include "TargetBodyDisplayProperties.h"
11 //#include "TargetBodyListActionWorkOrder.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 
33  class TargetBodyList : public QObject, public QList<TargetBodyQsp> {
34  Q_OBJECT
35 
36  public:
37 // friend class TargetBodyListActionWorkOrder;
38 
39  TargetBodyList(QString name, QString path, QObject *parent = NULL);
40  explicit TargetBodyList(QObject *parent = NULL);
41  explicit TargetBodyList(QList<TargetBodyQsp>, QObject *parent = NULL);
42  explicit TargetBodyList(Project *project,
43  XmlStackedHandlerReader *xmlReader, QObject *parent = NULL);
44 // explicit TargetBodyList(QStringList &);
47 
48  // These are overridden (-ish) in order to add notifications to the list changing
49  void append(TargetBodyQsp const &value);
50  void append(const QList<TargetBodyQsp> &value);
51 
52  void clear();
53 
54  iterator erase(iterator pos);
55  iterator erase(iterator begin, iterator end);
56 
57  void insert(int i, TargetBodyQsp const &value);
58  iterator insert(iterator before, TargetBodyQsp const &value);
59 
60  void prepend(TargetBodyQsp const &value);
61  void push_back(TargetBodyQsp const &value);
62  void push_front(TargetBodyQsp const &value);
63  int removeAll(TargetBodyQsp const &value);
64  void removeAt(int i);
65  void removeFirst();
66  void removeLast();
67  bool removeOne(TargetBodyQsp const &value);
68  void swap(QList<TargetBodyQsp> &other);
69  TargetBodyQsp takeAt(int i);
72 
78 
79  // This is our own assignment, but it needs to notify just like the operator=(QList)
81 
82  // Done overriding (-ish)
83 
84 
85  QList<QAction *> supportedActions(Project *project = NULL);
86  bool allSupport(TargetBodyDisplayProperties::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 
101  private:
109  class XmlHandler : public XmlStackedHandler {
110  public:
112 
113  virtual bool startElement(const QString &namespaceURI, const QString &localName,
114  const QString &qName, const QXmlAttributes &atts);
115  virtual bool endElement(const QString &namespaceURI, const QString &localName,
116  const QString &qName);
117 
118  private:
119  Q_DISABLE_COPY(XmlHandler);
120 
123  };
124 
125 
135 // class CopyTargetBodyDataFunctor : public std::unary_function<TargetBodyQsp const &, void *> {
136 // public:
137 // CopyTargetBodyDataFunctor(const Project *project, FileName newProjectRoot);
138 // CopyTargetBodyDataFunctor(const CopyTargetBodyDataFunctor &other);
139 // ~CopyTargetBodyDataFunctor();
140 
141 // void *operator()(TargetBodyQsp const &imageToCopy);
142 
143 // CopyTargetBodyDataFunctor &operator=(const CopyTargetBodyDataFunctor &rhs);
144 
145 // private:
146 // const Project *m_project;
147 // FileName m_newProjectRoot;
148 // };
149 
150  private:
151 // QAction *createWorkOrder(Project *project, TargetBodyListActionWorkOrder::Action action) {
152 // QAction *result = NULL;
153 
154 // if (project) {
155 // result = new TargetBodyListActionWorkOrder(action, project);
156 // ((TargetBodyListActionWorkOrder *)result)->setData(this);
157 // }
158 // else {
159 // result = new QAction(
160 // TargetBodyListActionWorkOrder::qualifyString(TargetBodyListActionWorkOrder::toString(action),
161 // this),
162 // this);
163 // }
164 
165 // return result;
166 // }
167 
168 // void applyAlphas(QStringList alphaValues);
169 // void applyColors(QStringList colorValues, int column = 0);
170 // void applyShowLabel(QStringList showLabelValues);
171 // void applyShowFill(QStringList showFillValues);
172 // void applyShowDNs(QStringList showDNsValues);
173 // void applyShowOutline(QStringList showOutlineValues);
174 // bool askAlpha(int *alphaResult) const;
175 // bool askNewColor(QColor *colorResult) const;
176 // QStringList saveAndApplyAlpha(int newAlpha);
177 // QStringList saveAndApplyColor(QColor newColor);
178 // QStringList saveAndApplyRandomColor();
179 
180  private slots:
181 // void askAndUpdateAlpha();
182 // void askAndUpdateColor();
183 // void showRandomColor();
184 // QStringList saveAndToggleShowDNs();
185 // QStringList saveAndToggleShowFill();
186 // QStringList saveAndToggleShowLabel();
187 // QStringList saveAndToggleShowOutline();
188 
189  private:
190  QString m_name;
191 
202  QString m_path;
203  };
204 
205 }
206 
208 
209 #endif
Isis::TargetBodyList::operator=
TargetBodyList & operator=(const QList< TargetBodyQsp > &rhs)
Assignment operator for a QList of TargetBodyQsp.
Definition: TargetBodyList.cpp:473
Isis::TargetBodyList::TargetBodyList
TargetBodyList(QString name, QString path, QObject *parent=NULL)
Create an target body list from an target body list name and path (does not read TargetBody objects).
Definition: TargetBodyList.cpp:38
Isis::TargetBodyList::m_name
QString m_name
This functor is used for copying the TargetBody objects between two projects quickly.
Definition: TargetBodyList.h:190
Isis::TargetBodyList::takeAt
TargetBodyQsp takeAt(int i)
Removes and returns the TargetBody at a specific index.
Definition: TargetBodyList.cpp:357
Isis::TargetBodyList::save
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Delete all of the contained TargetBody objects from disk (see TargetBody::deleteFromDisk())
Definition: TargetBodyList.cpp:726
Isis::TargetBodyList::XmlHandler::m_project
Project * m_project
The project that contains the TargetBodies.
Definition: TargetBodyList.h:122
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::TargetBodyList::takeLast
TargetBodyQsp takeLast()
Removes and returns the last TargetBody in the list.
Definition: TargetBodyList.cpp:385
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::TargetBodyList::operator+=
TargetBodyList & operator+=(const QList< TargetBodyQsp > &other)
Appends another TargetBodyList to the list.
Definition: TargetBodyList.cpp:401
Isis::TargetBodyList::push_back
void push_back(TargetBodyQsp const &value)
Appends a TargetBody to the end of the list.
Definition: TargetBodyList.cpp:238
QSharedPointer< TargetBody >
Isis::TargetBodyList::setPath
void setPath(QString newPath)
Set the relative path (from the project root) to this target body list's folder.
Definition: TargetBodyList.cpp:661
QStringList
Isis::XmlStackedHandlerReader
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:30
Isis::TargetBodyList::push_front
void push_front(TargetBodyQsp const &value)
Insertes a TargetBody at the front of the list.
Definition: TargetBodyList.cpp:251
Isis::TargetBodyList::XmlHandler::XmlHandler
XmlHandler(TargetBodyList *TargetBodyList, Project *project)
Change the visibility of the display name.
Definition: TargetBodyList.cpp:862
Isis::TargetBodyList::removeAt
void removeAt(int i)
Removes the TargetBody at a specific index.
Definition: TargetBodyList.cpp:284
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::TargetBodyList::removeLast
void removeLast()
Removes the last TargetBody from the list.
Definition: TargetBodyList.cpp:306
Isis::TargetBodyList::XmlHandler
XmlReader for working with TargetBody XML files.
Definition: TargetBodyList.h:109
Isis::TargetBodyDisplayProperties::Property
Property
This is a list of properties and actions that are possible.
Definition: TargetBodyDisplayProperties.h:69
Isis::TargetBodyList::insert
void insert(int i, TargetBodyQsp const &value)
Inserts a TargetBody at a specific index.
Definition: TargetBodyList.cpp:193
Isis::TargetBodyList::operator<<
TargetBodyList & operator<<(const QList< TargetBodyQsp > &other)
Appends another TargetBodyList to the list.
Definition: TargetBodyList.cpp:437
Isis::TargetBodyList
List for holding TargetBodies.
Definition: TargetBodyList.h:33
Isis::TargetBodyList::removeFirst
void removeFirst()
Removes the first TargetBody from the list.
Definition: TargetBodyList.cpp:295
Isis::TargetBodyList::clear
void clear()
clears the list.
Definition: TargetBodyList.cpp:143
Isis::TargetBodyList::XmlHandler::startElement
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
Definition: TargetBodyList.cpp:879
Isis::TargetBodyList::~TargetBodyList
~TargetBodyList()
Create an target body list from a list of target body file names.
Definition: TargetBodyList.cpp:108
Isis::TargetBodyList::m_path
QString m_path
This stores the directory name that contains the TargetBody objects in this list.
Definition: TargetBodyList.h:202
Isis::TargetBodyList::name
QString name() const
Get the human-readable name of this target body list.
Definition: TargetBodyList.cpp:671
Isis::TargetBodyList::append
void append(TargetBodyQsp const &value)
Appends a TargetBody to the list.
Definition: TargetBodyList.cpp:119
Isis::TargetBodyList::path
QString path() const
Get the path to these target body objects in the list (relative to project root).
Definition: TargetBodyList.cpp:683
Isis::TargetBodyList::setName
void setName(QString newName)
Gets a list of pre-connected actions that have to do with display, such as color, alpha,...
Definition: TargetBodyList.cpp:650
Isis::XmlStackedHandler
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:118
Isis::TargetBodyList::removeAll
int removeAll(TargetBodyQsp const &value)
Removes all occurrences of a TargetBody and returns the number removed.
Definition: TargetBodyList.cpp:266
Isis::TargetBodyList::swap
void swap(QList< TargetBodyQsp > &other)
Swaps the list with another TargetBodyList.
Definition: TargetBodyList.cpp:339
Isis::TargetBodyList::XmlHandler::m_TargetBodyList
TargetBodyList * m_TargetBodyList
The TargetBodyList to read into/save from.
Definition: TargetBodyList.h:121
QObject
Isis::TargetBodyList::XmlHandler::endElement
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle an XML end element.
Definition: TargetBodyList.cpp:920
Isis::TargetBodyList::prepend
void prepend(TargetBodyQsp const &value)
Inserts a TargetBody at the front of the list.
Definition: TargetBodyList.cpp:225
Isis::TargetBodyList::erase
iterator erase(iterator pos)
Erases the TargetBody associated with an iterator.
Definition: TargetBodyList.cpp:159
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(Isis::PlotWindow *)
We have plot windows as QVariant data types, so here it's enabled.
Isis::TargetBodyList::takeFirst
TargetBodyQsp takeFirst()
Removes and returns the first TargetBody in the list.
Definition: TargetBodyList.cpp:371
Isis::TargetBodyList::removeOne
bool removeOne(TargetBodyQsp const &value)
Removes the first occurrence of a TargetBody from the list.
Definition: TargetBodyList.cpp:321