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
14class QStringList;
15class QXmlStreamWriter;
16
17namespace Isis {
18 class FileName;
19
31 class TargetBodyList : public QObject, public QList<TargetBodyQsp> {
32 Q_OBJECT
33
34 public:
35// friend class TargetBodyListActionWorkOrder;
36
37 TargetBodyList(QString name, QString path, QObject *parent = NULL);
38 explicit TargetBodyList(QObject *parent = NULL);
39 explicit TargetBodyList(QList<TargetBodyQsp>, QObject *parent = NULL);
42
43 // These are overridden (-ish) in order to add notifications to the list changing
44 void append(TargetBodyQsp const &value);
45 void append(const QList<TargetBodyQsp> &value);
46
47 void clear();
48
49 iterator erase(iterator pos);
50 iterator erase(iterator begin, iterator end);
51
52 void insert(int i, TargetBodyQsp const &value);
53 iterator insert(iterator before, TargetBodyQsp const &value);
54
55 void prepend(TargetBodyQsp const &value);
56 void push_back(TargetBodyQsp const &value);
57 void push_front(TargetBodyQsp const &value);
58 int removeAll(TargetBodyQsp const &value);
59 void removeAt(int i);
60 void removeFirst();
61 void removeLast();
62 bool removeOne(TargetBodyQsp const &value);
63 void swap(QList<TargetBodyQsp> &other);
64 TargetBodyQsp takeAt(int i);
67
68 TargetBodyList &operator+=(const QList<TargetBodyQsp> &other);
70 TargetBodyList &operator<<(const QList<TargetBodyQsp> &other);
72 TargetBodyList &operator=(const QList<TargetBodyQsp> &rhs);
73
74 // This is our own assignment, but it needs to notify just like the operator=(QList)
76
77 // Done overriding (-ish)
78
79
80 QList<QAction *> supportedActions(Project *project = NULL);
81 bool allSupport(TargetBodyDisplayProperties::Property prop);
82
83 void setName(QString newName);
84 void setPath(QString newPath);
85
86 QString name() const;
87 QString path() const;
88
89// void deleteFromDisk(Project *project);
90 void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
91
92
93 signals:
94 void countChanged(int newCount);
95
105// class CopyTargetBodyDataFunctor : public std::unary_function<TargetBodyQsp const &, void *> {
106// public:
107// CopyTargetBodyDataFunctor(const Project *project, FileName newProjectRoot);
108// CopyTargetBodyDataFunctor(const CopyTargetBodyDataFunctor &other);
109// ~CopyTargetBodyDataFunctor();
110
111// void *operator()(TargetBodyQsp const &imageToCopy);
112
113// CopyTargetBodyDataFunctor &operator=(const CopyTargetBodyDataFunctor &rhs);
114
115// private:
116// const Project *m_project;
117// FileName m_newProjectRoot;
118// };
119
120 private:
121// QAction *createWorkOrder(Project *project, TargetBodyListActionWorkOrder::Action action) {
122// QAction *result = NULL;
123
124// if (project) {
125// result = new TargetBodyListActionWorkOrder(action, project);
126// ((TargetBodyListActionWorkOrder *)result)->setData(this);
127// }
128// else {
129// result = new QAction(
130// TargetBodyListActionWorkOrder::qualifyString(TargetBodyListActionWorkOrder::toString(action),
131// this),
132// this);
133// }
134
135// return result;
136// }
137
138// void applyAlphas(QStringList alphaValues);
139// void applyColors(QStringList colorValues, int column = 0);
140// void applyShowLabel(QStringList showLabelValues);
141// void applyShowFill(QStringList showFillValues);
142// void applyShowDNs(QStringList showDNsValues);
143// void applyShowOutline(QStringList showOutlineValues);
144// bool askAlpha(int *alphaResult) const;
145// bool askNewColor(QColor *colorResult) const;
146// QStringList saveAndApplyAlpha(int newAlpha);
147// QStringList saveAndApplyColor(QColor newColor);
148// QStringList saveAndApplyRandomColor();
149
150 private slots:
151// void askAndUpdateAlpha();
152// void askAndUpdateColor();
153// void showRandomColor();
154// QStringList saveAndToggleShowDNs();
155// QStringList saveAndToggleShowFill();
156// QStringList saveAndToggleShowLabel();
157// QStringList saveAndToggleShowOutline();
158
159 private:
160 QString m_name;
161
172 QString m_path;
173 };
174
175}
176
177Q_DECLARE_METATYPE(Isis::TargetBodyList *);
178
179#endif
File name manipulation and expansion.
Definition FileName.h:100
The main project for ipce.
Definition Project.h:287
Property
This is a list of properties and actions that are possible.
List for holding TargetBodies.
TargetBodyList & operator<<(const QList< TargetBodyQsp > &other)
Appends another TargetBodyList to the list.
QString m_name
This functor is used for copying the TargetBody objects between two projects quickly.
TargetBodyList & operator=(const QList< TargetBodyQsp > &rhs)
Assignment operator for a QList of TargetBodyQsp.
void setPath(QString newPath)
Set the relative path (from the project root) to this target body list's folder.
void removeLast()
Removes the last TargetBody from the list.
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Delete all of the contained TargetBody objects from disk (see TargetBody::deleteFromDisk())
iterator erase(iterator pos)
Erases the TargetBody associated with an iterator.
QString path() const
Get the path to these target body objects in the list (relative to project root).
void swap(QList< TargetBodyQsp > &other)
Swaps the list with another TargetBodyList.
TargetBodyQsp takeLast()
Removes and returns the last TargetBody in the list.
void insert(int i, TargetBodyQsp const &value)
Inserts a TargetBody at a specific index.
void append(TargetBodyQsp const &value)
Appends a TargetBody to the list.
bool removeOne(TargetBodyQsp const &value)
Removes the first occurrence of a TargetBody from the list.
void push_front(TargetBodyQsp const &value)
Insertes a TargetBody at the front of the list.
TargetBodyList & operator+=(const QList< TargetBodyQsp > &other)
Appends another TargetBodyList to the list.
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).
QString name() const
Get the human-readable name of this target body list.
void removeFirst()
Removes the first TargetBody from the list.
int removeAll(TargetBodyQsp const &value)
Removes all occurrences of a TargetBody and returns the number removed.
void prepend(TargetBodyQsp const &value)
Inserts a TargetBody at the front of the list.
void push_back(TargetBodyQsp const &value)
Appends a TargetBody to the end of the list.
TargetBodyQsp takeFirst()
Removes and returns the first TargetBody in the list.
QString m_path
This stores the directory name that contains the TargetBody objects in this list.
~TargetBodyList()
Create an target body list from a list of target body file names.
void setName(QString newName)
Gets a list of pre-connected actions that have to do with display, such as color, alpha,...
void removeAt(int i)
Removes the TargetBody at a specific index.
void clear()
clears the list.
TargetBodyQsp takeAt(int i)
Removes and returns the TargetBody at a specific index.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16