Isis 3 Programmer Reference
ImageList.h
1#ifndef ImageList_H
2#define ImageList_H
3
4#include <QDebug>
5#include <QObject>
6#include <QList>
7#include <QMetaType>
8#include <QSharedPointer>
9
10#include "Image.h"
12#include "ImageListActionWorkOrder.h"
13#include "SerialNumberList.h"
14#include "WorkOrder.h"
15
16class QStringList;
17class QXmlStreamWriter;
18
19namespace Isis {
20 class FileName;
21
53 class ImageList : public QObject, public QList<Image *> {
54 Q_OBJECT
55
56 public:
57 friend class ImageListActionWorkOrder;
58
59 ImageList(QString name, QString path, QObject *parent = NULL);
60 explicit ImageList(QObject *parent = NULL);
61 explicit ImageList(QList<Image *>, QObject *parent = NULL);
62 explicit ImageList(QStringList &);
63 ImageList(const ImageList &);
64 ~ImageList();
65
66// QSharedPointer<SerialNumberList> serialNumberList();
68
69 // These are overridden (-ish) in order to add notifications to the list changing
70 void append(Image * const & value);
71 void append(const QList<Image *> &value);
72
73 void clear();
74
75 iterator erase(iterator pos);
76 iterator erase(iterator begin, iterator end);
77
78 void insert(int i, Image * const & value);
79 iterator insert(iterator before, Image * const & value);
80
81 void prepend(Image * const & value);
82 void push_back(Image * const & value);
83 void push_front(Image * const & value);
84 int removeAll(Image * const & value);
85 void removeAt(int i);
86 void removeFirst();
87 void removeLast();
88 bool removeOne(Image * const & value);
89 void swap(QList<Image *> &other);
90 Image *takeAt(int i);
92 Image *takeLast();
93
94 ImageList &operator+=(const QList<Image *> &other);
95 ImageList &operator+=(Image * const &other);
96 ImageList &operator<<(const QList<Image *> &other);
97 ImageList &operator<<(Image * const &other);
98 ImageList &operator=(const QList<Image *> &rhs);
99
100 // This is our own assignment, but it needs to notify just like the operator=(QList)
101 ImageList &operator=(const ImageList &rhs);
102
103 // Done overriding (-ish)
104
105
106 QList<QAction *> supportedActions(Project *project = NULL);
108
109 void setName(QString newName);
110 void setPath(QString newPath);
111
112 QString name() const;
113 QString path() const;
114
115 void deleteFromDisk(Project *project);
116 void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
117
118 signals:
119 void countChanged(int newCount);
120
121 private:
122
132 class CopyImageDataFunctor : public std::function<void *(Image * const &)> {
133 public:
134 CopyImageDataFunctor(const Project *project, FileName newProjectRoot);
137
138 void *operator()(Image * const &imageToCopy);
139
141
142 private:
151 };
152
153 private:
163 QAction *result = NULL;
164
165 if (project) {
166 result = new ImageListActionWorkOrder(action, project);
167 ((ImageListActionWorkOrder *)result)->setData(this);
168 }
169 else {
170 result = new QAction(
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);
190
191 private slots:
192 void askAndUpdateAlpha();
193 void askAndUpdateColor();
194 void showRandomColor();
199
200 private:
204 QString m_name;
205
216 QString m_path;
217 };
218
219}
220
221Q_DECLARE_METATYPE(Isis::ImageList *);
222
223#endif
File name manipulation and expansion.
Definition FileName.h:100
Property
This is a list of properties and actions that are possible.
This represents a cube in a project-based GUI interface.
Definition Image.h:105
This functor is used for copying the images between two projects quickly.
Definition ImageList.h:132
const Project * m_project
This stores the name of the project that is going to be copied to.
Definition ImageList.h:146
FileName m_newProjectRoot
This stores the path to the root of the project that is going to be copied to.
Definition ImageList.h:150
CopyImageDataFunctor & operator=(const CopyImageDataFunctor &rhs)
Assignment operator for CopyImageDataFunctor.
CopyImageDataFunctor(const Project *project, FileName newProjectRoot)
Constructor for CopyImageDataFunctor.
void * operator()(Image *const &imageToCopy)
Copies the cub/ecub files for an image into m_project.
~CopyImageDataFunctor()
Destructor for CopyImageDataFunctor.
Work orders that can be performed on an image list that modifies internal state.
static QString toString(Action)
Convert an action to a string.
static QString qualifyString(QString unqualifiedString, ImageList *)
Determine whether a toggle action should show or hide.
Action
Type of action to be performed by the work order.
Internalizes a list of images and allows for operations on the entire list.
Definition ImageList.h:53
void applyShowOutline(QStringList showOutlineValues)
Sets the visibility of the outlines of the images in the image list based on a list of values.
Image * takeLast()
Removes and returns the last image.
void applyShowDNs(QStringList showDNsValues)
Sets the visibility of the DNs of the images in the image list based on a list of values.
void deleteFromDisk(Project *project)
Delete all of the contained Images from disk.
int removeAll(Image *const &value)
Removes all occurances of an image.
QStringList saveAndToggleShowDNs()
Changes the visibility of the DNs of the first image in the image list and synchronizes the visibilit...
QString path() const
Get the path to the images in the image list (relative to project root).
~ImageList()
Destructor.
ImageList & operator+=(const QList< Image * > &other)
Appends a list of images to the end of the image list.
void applyAlphas(QStringList alphaValues)
Sets the alpha values of the images based on a list of values.
ImageList & operator<<(const QList< Image * > &other)
Appends a list of images to the end of the image list.
void applyShowLabel(QStringList showLabelValues)
Sets the visibility of the display names of the images in the image list based on a list of values.
void setPath(QString newPath)
Set the relative path (from the project root) to this image list's folder.
void insert(int i, Image *const &value)
Inserts an image into the image list at an index.
void showRandomColor()
This applies a new semi-random color to every image's display property for every image in this image ...
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Convert this image list into XML format for saving/restoring capabilities.
bool removeOne(Image *const &value)
Removes the first occurance of an image.
Image * takeAt(int i)
Removes the image at an index and returns it.
void push_front(Image *const &value)
Prepends an image to the beginning of the image list.
void applyColors(QStringList colorValues, int column=0)
Sets the colors values of the images based on a list of values.
Image * takeFirst()
Removes and returns the first image.
ImageList & operator=(const QList< Image * > &rhs)
Assigns another list of images to the image list.
void prepend(Image *const &value)
Inserts an image at the beginning of the image list.
ImageList(QString name, QString path, QObject *parent=NULL)
Creates an image list from an image list name and path (does not read Images).
Definition ImageList.cpp:53
bool askAlpha(int *alphaResult) const
Prompts the user for an alpha value.
QStringList saveAndToggleShowOutline()
Changes the visibility of the outline of the first image in the image list and synchronizes the visib...
iterator erase(iterator pos)
Erases a single image from the image list.
QAction * createWorkOrder(Project *project, ImageListActionWorkOrder::Action action)
Creates an ImageListActionWorkOrder and sets the image list as the data for the work order.
Definition ImageList.h:162
void askAndUpdateAlpha()
Prompt the user for a new alpha value.
SerialNumberList * serialNumberList()
Creates a SerialNumberList from the image list.
void askAndUpdateColor()
Prompt the user for a new color.
void removeAt(int i)
Removes the image at an index.
bool askNewColor(QColor *colorResult) const
Prompts the user for color values.
void push_back(Image *const &value)
Appends an image to the end of the image list.
QString m_name
This stores the image list's name.
Definition ImageList.h:204
bool allSupport(ImageDisplayProperties::Property prop)
Check if all images in the image list support a display property.
QStringList saveAndToggleShowLabel()
Changes the visibility of the display name of the first image in the image list and synchronizes the ...
void append(Image *const &value)
Appends an image to the image list.
QStringList saveAndApplyColor(QColor newColor)
Sets the color values of every image to a specificed set of values.
QStringList saveAndApplyAlpha(int newAlpha)
Sets the alpha value of every image in the image list to a specificed value.
void applyShowFill(QStringList showFillValues)
Sets the visibility of the fill areas of the images in the image list based on a list of values.
QList< QAction * > supportedActions(Project *project=NULL)
Gets a list of pre-connected actions that have to do with display.
QString m_path
This stores the directory name that contains the images in this image list.
Definition ImageList.h:216
void swap(QList< Image * > &other)
Swaps the image list with another list of images.
void setName(QString newName)
Set the human-readable name of this image list.
QStringList saveAndToggleShowFill()
Changes the visibility of the fill area of the first image in the image list and synchronizes the vis...
QString name() const
Get the human-readable name of this image list.
void clear()
Clears the image list.
void removeFirst()
Removes the image at the front of the image list.
void removeLast()
Removes the image at the end of the image list.
QStringList saveAndApplyRandomColor()
Sets the color values of every image to a random color.
The main project for ipce.
Definition Project.h:287
Serial Number list generator.
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