Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis Developer Reference
ShapeList.h
Go to the documentation of this file.
1#ifndef ShapeList_H
2#define ShapeList_H
3
4#include <QDebug>
5#include <QObject>
6#include <QList>
7#include <QMetaType>
8
9#include "Shape.h"
11#include "SerialNumberList.h"
12#include "WorkOrder.h"
13
14class QXmlStreamWriter;
15
16namespace Isis {
17 class FileName;
18
30 class ShapeList : public QObject, public QList<Shape *> {
31 Q_OBJECT
32
33 public:
34 ShapeList(QString name, QString path, QObject *parent = NULL);
35 explicit ShapeList(QObject *parent = NULL);
36 explicit ShapeList(QList<Shape *>, QObject *parent = NULL);
37 explicit ShapeList(QStringList &);
38 ShapeList(const ShapeList &);
39 ~ShapeList();
40
42
43 // These are overridden (-ish) in order to add notifications to the list changing
44 void append(Shape * const & value);
45 void append(const QList<Shape *> &value);
46
47 void clear();
48
50 iterator erase(iterator begin, iterator end);
51
52 void insert(int i, Shape * const & value);
53 iterator insert(iterator before, Shape * const & value);
54
55 void prepend(Shape * const & value);
56 void push_back(Shape * const & value);
57 void push_front(Shape * const & value);
58 int removeAll(Shape * const & value);
59 void removeAt(int i);
60 void removeFirst();
61 void removeLast();
62 bool removeOne(Shape * const & value);
63 void swap(QList<Shape *> &other);
64 Shape *takeAt(int i);
66 Shape *takeLast();
67
68 ShapeList &operator+=(const QList<Shape *> &other);
69 ShapeList &operator+=(Shape * const &other);
70 ShapeList &operator<<(const QList<Shape *> &other);
71 ShapeList &operator<<(Shape * const &other);
73
74 // This is our own assignment, but it needs to notify just like the operator=(QList)
75 ShapeList &operator=(const ShapeList &rhs);
76
77 // Done overriding (-ish)
78
79 void setName(QString newName);
80 void setPath(QString newPath);
81
82 QString name() const;
83 QString path() const;
84
85 void deleteFromDisk(Project *project);
86 void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
87
88
89 signals:
90 void countChanged(int newCount);
91
92 private:
93
103 class CopyShapeDataFunctor : public std::function<void *(Shape * const &)> {
104 public:
105 CopyShapeDataFunctor(const Project *project, FileName newProjectRoot);
106 CopyShapeDataFunctor(const CopyShapeDataFunctor &other);
107 ~CopyShapeDataFunctor();
108
109 void *operator()(Shape * const &shapeToCopy);
110
111 CopyShapeDataFunctor &operator=(const CopyShapeDataFunctor &rhs);
112
113 private:
117 const Project *m_project;
121 FileName m_newProjectRoot;
122 };
123
124 private slots:
125
126 private:
130 QString m_name;
131
142 QString m_path;
143 };
144
145}
146
148
149#endif
Q_DECLARE_METATYPE(Isis::ShapeList *)
The main project for ipce.
Definition Project.h:287
Serial Number list generator.
Definition SerialNumberList.h:64
This represents a shape in a project-based GUI interface.
Definition Shape.h:66
Internalizes a list of shapes and allows for operations on the entire list.
Definition ShapeList.h:30
void insert(int i, Shape *const &value)
Inserts an shape into the shape list at an index.
Definition ShapeList.cpp:195
void append(Shape *const &value)
Appends an shape to the shape list.
Definition ShapeList.cpp:119
void deleteFromDisk(Project *project)
Delete all of the contained Shapes from disk.
Definition ShapeList.cpp:564
void removeAt(int i)
Removes the shape at an index.
Definition ShapeList.cpp:287
void setName(QString newName)
Set the human-readable name of this shape list.
Definition ShapeList.cpp:520
Shape * takeLast()
Removes and returns the last shape.
Definition ShapeList.cpp:388
iterator erase(iterator pos)
Erases a single shape from the shape list.
Definition ShapeList.cpp:161
SerialNumberList serialNumberList()
Creates a SerialNumberList from the shape list.
Definition ShapeList.cpp:101
void swap(QList< Shape * > &other)
Swaps the shape list with another list of shapes.
Definition ShapeList.cpp:342
void clear()
Clears the shape list.
Definition ShapeList.cpp:143
void countChanged(int newCount)
void push_back(Shape *const &value)
Appends an shape to the end of the shape list.
Definition ShapeList.cpp:240
void removeFirst()
Removes the shape at the front of the shape list.
Definition ShapeList.cpp:298
void removeLast()
Removes the shape at the end of the shape list.
Definition ShapeList.cpp:309
QString path() const
Get the path to the shapes in the shape list (relative to project root).
Definition ShapeList.cpp:552
int removeAll(Shape *const &value)
Removes all occurances of an shape.
Definition ShapeList.cpp:269
QString name() const
Get the human-readable name of this shape list.
Definition ShapeList.cpp:541
void prepend(Shape *const &value)
Inserts an shape at the beginning of the shape list.
Definition ShapeList.cpp:226
Shape * takeAt(int i)
Removes the shape at an index and returns it.
Definition ShapeList.cpp:360
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Convert this shape list into XML format for saving/restoring capabilities.
Definition ShapeList.cpp:601
ShapeList(QString name, QString path, QObject *parent=NULL)
Creates an shape list from an shape list name and path (does not read Shapes).
Definition ShapeList.cpp:34
void push_front(Shape *const &value)
Prepends an shape to the beginning of the shape list.
Definition ShapeList.cpp:254
ShapeList & operator<<(const QList< Shape * > &other)
Appends a list of shapes to the end of the shape list.
Definition ShapeList.cpp:443
~ShapeList()
Destructor.
Definition ShapeList.cpp:92
bool removeOne(Shape *const &value)
Removes the first occurance of an shape.
Definition ShapeList.cpp:324
ShapeList & operator=(const QList< Shape * > &rhs)
Assigns another list of shapes to the shape list.
Definition ShapeList.cpp:480
void setPath(QString newPath)
Set the relative path (from the project root) to this shape list's folder.
Definition ShapeList.cpp:531
Shape * takeFirst()
Removes and returns the first shape.
Definition ShapeList.cpp:374
ShapeList & operator+=(const QList< Shape * > &other)
Appends a list of shapes to the end of the shape list.
Definition ShapeList.cpp:405
This is free and unencumbered software released into the public domain.
Definition BoxcarCachingAlgorithm.h:13
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16