Isis 3 Programmer Reference
ImageList.cpp
Go to the documentation of this file.
1
23#include "Image.h"
24#include "ImageList.h"
25#include "IException.h"
26
27#include <QAction>
28#include <QColorDialog>
29#include <QDebug>
30#include <QDir>
31#include <QFile>
32#include <QFuture>
33#include <QInputDialog>
34#include <QLabel>
35#include <QProgressDialog>
36#include <QtConcurrentMap>
37#include <QXmlStreamWriter>
38
39#include "Color.h"
40#include "FileName.h"
41#include "IException.h"
42#include "IString.h"
43#include "Project.h"
44
45namespace Isis {
53 ImageList::ImageList(QString name, QString path, QObject *parent) : QObject(parent) {
54 m_name = name;
55 m_path = path;
56 }
57
58
65 }
66
67
74 ImageList::ImageList(QList<Image *> images, QObject *parent) : QObject(parent) {
75 append(images);
76 }
77
78
85 QList<Image *>(other) {
86 m_name = other.m_name;
87 m_path = other.m_path;
88 }
89
90
97 foreach (QString fileName, fileNames) {
98 try {
99 Image *image = new Image(fileName);
100 append(image);
101 image->closeCube();
102 }
103 catch (IException &) {
104 }
105 }
106 }
107
108
114
115
122
123 SerialNumberList *result = new SerialNumberList();
124
125 for (int i = 0; i < count(); i++) {
126 result->add((*this)[i]->fileName());
127 }
128 return result;
129 }
130
131
139 void ImageList::append(Image * const &value) {
141 emit countChanged(count());
142 }
143
144
152 void ImageList::append(const QList<Image *> &value) {
154 emit countChanged(count());
155 }
156
157
164 bool countChanging = count();
166 if (countChanging) {
167 emit countChanged(count());
168 }
169 }
170
171
182 iterator result = QList<Image *>::erase(pos);
183 emit countChanged(count());
184 return result;
185 }
186
187
200 QList<Image *>::iterator ImageList::erase(iterator begin, iterator end) {
201 iterator result = QList<Image *>::erase(begin, end);
202 emit countChanged(count());
203 return result;
204 }
205
206
215 void ImageList::insert(int i, Image * const &value) {
216 QList<Image *>::insert(i, value);
217
218 emit countChanged(count());
219 }
220
221
232 QList<Image *>::iterator ImageList::insert(iterator before, Image * const &value) {
233 iterator result = QList<Image *>::insert(before, value);
234 emit countChanged(count());
235 return result;
236 }
237
238
246 void ImageList::prepend(Image * const &value) {
248 emit countChanged(count());
249 }
250
251
260 void ImageList::push_back(Image * const &value) {
262 emit countChanged(count());
263 }
264
265
274 void ImageList::push_front(Image * const &value) {
276 emit countChanged(count());
277 }
278
279
289 int ImageList::removeAll(Image * const &value) {
290 int result = QList<Image *>::removeAll(value);
291
292 if (result != 0) {
293 emit countChanged(count());
294 }
295
296 return result;
297 }
298
299
309 emit countChanged(count());
310 }
311
312
320 emit countChanged(count());
321 }
322
323
331 emit countChanged(count());
332 }
333
334
344 bool ImageList::removeOne(Image * const &value) {
345 bool result = QList<Image *>::removeOne(value);
346
347 if (result) {
348 emit countChanged(count());
349 }
350
351 return result;
352 }
353
354
362 void ImageList::swap(QList<Image *> &other) {
364
365 if (count() != other.count()) {
366 emit countChanged(count());
367 }
368 }
369
370
381 Image * result = QList<Image *>::takeAt(i);
382 emit countChanged(count());
383 return result;
384 }
385
386
396 emit countChanged(count());
397 return result;
398 }
399
400
410 emit countChanged(count());
411 return result;
412 }
413
414
425 ImageList &ImageList::operator+=(const QList<Image *> &other) {
427
428 if (other.count()) {
429 emit countChanged(count());
430 }
431
432 return *this;
433 }
434
435
448 emit countChanged(count());
449 return *this;
450 }
451
452
463 ImageList &ImageList::operator<<(const QList<Image *> &other) {
465
466 if (other.count()) {
467 emit countChanged(count());
468 }
469
470 return *this;
471 }
472
473
486 emit countChanged(count());
487 return *this;
488 }
489
490
500 ImageList &ImageList::operator=(const QList<Image *> &rhs) {
501 bool countChanging = (rhs.count() != count());
503
504 if (countChanging) {
505 emit countChanged(count());
506 }
507
508 return *this;
509 }
510
511
520 bool countChanging = (rhs.count() != count());
522
523 m_name = rhs.m_name;
524 m_path = rhs.m_path;
525
526 if (countChanging) {
527 emit countChanged(count());
528 }
529
530 return *this;
531 }
532
533
551 QList<QAction *> ImageList::supportedActions(Project *project) {
552
553 QList<QAction *> actions;
554
555 // It turns out connect() statements cannot be templated, hence they aren't inside of
556 // createWorkOrder().
558
560 if (!project) {
561 connect(alphaAction, SIGNAL(triggered()),
562 this, SLOT(askAndUpdateAlpha()));
563 }
564 actions.append(alphaAction);
565
567 if (!project) {
568 connect(colorAction, SIGNAL(triggered()),
569 this, SLOT(askAndUpdateColor()));
570 }
571 actions.append(colorAction);
572
574 if (!project) {
575 connect(ranColorAction, SIGNAL(triggered()),
576 this, SLOT(showRandomColor()));
577 }
578 actions.append(ranColorAction);
579 }
580
582 QAction *labelVisibleAction = createWorkOrder(project,
584 if (!project) {
585 connect(labelVisibleAction, SIGNAL(triggered()),
586 this, SLOT(saveAndToggleShowLabel()));
587 }
588 actions.append(labelVisibleAction);
589 }
590
593 if (!project) {
594 connect(fillAction, SIGNAL(triggered()),
595 this, SLOT(saveAndToggleShowFill()));
596 }
597 actions.append(fillAction);
598 }
599
601 QAction *cubeDataAction = createWorkOrder(project,
603 if (!project) {
604 connect(cubeDataAction, SIGNAL(triggered()),
605 this, SLOT(saveAndToggleShowDNs()));
606 }
607 actions.append(cubeDataAction);
608 }
609
611 QAction *outlineAction = createWorkOrder(project,
613 if (!project) {
614 connect(outlineAction, SIGNAL(triggered()),
615 this, SLOT(saveAndToggleShowOutline()));
616 }
617 actions.append(outlineAction);
618 }
619
620 actions.append(NULL);
621
623
628
629 foreach (Image *image, *this) {
630 connect(moveToTopAct, SIGNAL(triggered()),
631 image->displayProperties(), SIGNAL(moveToTop()));
632
633 connect(moveUpAct, SIGNAL(triggered()),
634 image->displayProperties(), SIGNAL(moveUpOne()));
635
636 connect(moveToBottomAct, SIGNAL(triggered()),
637 image->displayProperties(), SIGNAL(moveToBottom()));
638
639 connect(moveDownAct, SIGNAL(triggered()),
640 image->displayProperties(), SIGNAL(moveDownOne()));
641 }
642
643 actions.append(moveToTopAct);
644 actions.append(moveUpAct);
645 actions.append(moveToBottomAct);
646 actions.append(moveDownAct);
647 }
648
649 actions.append(NULL);
650
651 if (size() == 1 && allSupport(ImageDisplayProperties::Zooming)) {
653 connect(zoomFit, SIGNAL(triggered()),
654 first()->displayProperties(), SIGNAL(zoomFit()));
655 actions.append(zoomFit);
656 }
657
658 return actions;
659 }
660
661
671 if (isEmpty())
672 return false;
673
674 foreach (Image *image, *this) {
675 if (!image->displayProperties()->supports(prop))
676 return false;
677 }
678
679 return true;
680 }
681
682
689 void ImageList::setName(QString newName) {
690 m_name = newName;
691 }
692
693
700 void ImageList::setPath(QString newPath) {
701 m_path = newPath;
702 }
703
704
710 QString ImageList::name() const {
711 return m_name;
712 }
713
714
721 QString ImageList::path() const {
722 return m_path;
723 }
724
725
734 foreach (Image *image, *this) {
735 image->deleteFromDisk();
736 }
737
738 if (!m_path.isEmpty()) {
739 QFile::remove(project->imageDataRoot() + "/" + m_path + "/images.xml");
740
741 QDir dir;
742 dir.rmdir(project->imageDataRoot() + "/" + m_path);
743 }
744 }
745
746
771 void ImageList::save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot)
772 const {
773 stream.writeStartElement("imageList");
774 stream.writeAttribute("name", m_name);
775 stream.writeAttribute("path", m_path);
776 // The newProjectRoot contains the full path and we want the dataRoot to be relative to the
777 // projectRoot so that projects can be moved.
778 QString dataRoot =
779 Project::imageDataRoot(newProjectRoot.toString()).remove(project->newProjectRoot());
780 // Get rid of any preceding "/"
781 if (dataRoot.startsWith("/")) {
782 dataRoot.remove(0,1);
783 }
784 stream.writeAttribute("dataRoot", dataRoot);
785
786 FileName settingsFileName(Project::imageDataRoot(newProjectRoot.toString()) +
787 "/" + m_path + "/images.xml");
788
789 if (!settingsFileName.dir().mkpath(settingsFileName.path())) {
791 QString("Failed to create directory [%1]")
792 .arg(settingsFileName.path()),
793 _FILEINFO_);
794 }
795 QFile imageListContentsFile(settingsFileName.toString());
796
797 if (!imageListContentsFile.open(QIODevice::ReadWrite | QIODevice::Truncate)) {
799 QString("Unable to save image information for [%1] because [%2] could not be opened for "
800 "writing")
801 .arg(m_name).arg(settingsFileName.original()),
802 _FILEINFO_);
803 }
804
805 QXmlStreamWriter imageDetailsWriter(&imageListContentsFile);
806 imageDetailsWriter.setAutoFormatting(true);
807 imageDetailsWriter.writeStartDocument();
808
809 imageDetailsWriter.writeStartElement("images");
810
811 // Only copy images if saving to new location
812 if (project->newProjectRoot() != project->projectRoot()) {
813 int countWidth = QString("%1L").arg(count()).size() - 1;
814 QChar paddingChar('0');
815
816 QLabel *progressLabel = new QLabel;
817
818 QProgressDialog progressDialog;
819 progressDialog.setLabel(progressLabel);
820 progressDialog.setRange(-1, count());
821 progressDialog.setValue(-1);
822
823 // Mapped is way faster than hundreds/thousands of run() calls... so use mapped for performance
824 QFuture<void *> future = QtConcurrent::mapped(*this,
825 CopyImageDataFunctor(project, newProjectRoot));
826
827 for (int i = 0; i < count(); i++) {
828 int newProgressValue = progressDialog.value() + 1;
829 progressLabel->setText(
830 tr("Saving Image Information for [%1] - %L2/%L3 done")
831 .arg(m_name)
832 .arg(newProgressValue, countWidth, 10, paddingChar)
833 .arg(count()));
834 progressDialog.setValue(newProgressValue);
835 try {
836 future.resultAt(i);
837 }
838 catch(std::exception &e) {
839 QString msg("Could not save ImageList: "+this->name() );
840 throw IException(IException::Io,msg,_FILEINFO_);
841 }
842 }
843
844 progressLabel->setText(tr("Finalizing..."));
845 progressDialog.setRange(0, 0);
846 progressDialog.setValue(0);
847 }
848
849 foreach (Image *image, *this) {
850 image->save(imageDetailsWriter, project, newProjectRoot);
851 }
852
853 imageDetailsWriter.writeEndElement();
854
855 imageDetailsWriter.writeEndDocument();
856
857 stream.writeEndElement();
858 }
859
860
868 FileName newProjectRoot) {
869 m_project = project;
870 m_newProjectRoot = newProjectRoot;
871 }
872
873
880 m_project = other.m_project;
881 m_newProjectRoot = other.m_newProjectRoot;
882 }
883
884
890
891
901 try {
902 imageToCopy->copyToNewProjectRoot(m_project, m_newProjectRoot);
903 }
904 catch (IException &e) {
905 IString msg = "Could not copy image [" + imageToCopy->displayProperties()->displayName() +
906 "]";
907 throw IException(e, IException::Io, msg, _FILEINFO_);
908 }
909 return NULL;
910 }
911
912
921 const CopyImageDataFunctor &rhs) {
922 m_project = rhs.m_project;
923 m_newProjectRoot = rhs.m_newProjectRoot;
924 return *this;
925 }
926
927
937 if (count() == alphaValues.count()) {
938 for (int i = 0; i < count(); i++) {
939 ImageDisplayProperties *dispProps = (*this)[i]->displayProperties();
940 QColor color = dispProps->getValue(ImageDisplayProperties::Color).value<QColor>();
941 color.setAlpha(alphaValues[i].toInt());
942 dispProps->setColor(color);
943 }
944 }
945 }
946
947
957 void ImageList::applyColors(QStringList colorValues, int column) {
958 if (count() == colorValues.count()) {
959 for (int i = 0; i < count(); i++) {
960 QString colorData = colorValues[i].split(" ")[column];
961 (*this)[i]->displayProperties()->setColor(Color::fromRGBAString(colorData));
962 }
963 }
964 }
965
966
978 if (count() == showLabelValues.count()) {
979 for (int i = 0; i < count(); i++) {
980 ImageDisplayProperties *dispProps = (*this)[i]->displayProperties();
981 dispProps->setShowLabel(showLabelValues[i] == "shown");
982 }
983 }
984 }
985
986
998 if (count() == showFillValues.count()) {
999 for (int i = 0; i < count(); i++) {
1000 ImageDisplayProperties *dispProps = (*this)[i]->displayProperties();
1001 dispProps->setShowFill(showFillValues[i] == "shown");
1002 }
1003 }
1004 }
1005
1006
1017 if (count() == showDNsValues.count()) {
1018 for (int i = 0; i < count(); i++) {
1019 ImageDisplayProperties *dispProps = (*this)[i]->displayProperties();
1020 dispProps->setShowDNs(showDNsValues[i] == "shown");
1021 }
1022 }
1023 }
1024
1025
1036 if (count() == showOutlineValues.count()) {
1037 for (int i = 0; i < count(); i++) {
1038 ImageDisplayProperties *dispProps = (*this)[i]->displayProperties();
1039 dispProps->setShowOutline(showOutlineValues[i] == "shown");
1040 }
1041 }
1042 }
1043
1044
1058 bool ImageList::askAlpha(int *alphaResult) const {
1059 bool result = false;
1060
1061 if (!isEmpty()) {
1062 ImageDisplayProperties *dispProps = first()->displayProperties();
1063 *alphaResult = QInputDialog::getInt(NULL, "Transparency Value",
1064 "Set the cube's transparency\nValues are 0 (invisible) to 255 (solid)",
1065 dispProps->getValue(ImageDisplayProperties::Color).value<QColor>().alpha(),
1066 0, 255, 1, &result);
1067 }
1068
1069 return result;
1070 }
1071
1072
1086 bool ImageList::askNewColor(QColor *colorResult) const {
1087 *colorResult = QColor();
1088
1089 if (!isEmpty()) {
1090 ImageDisplayProperties *dispProps = first()->displayProperties();
1091 *colorResult = QColorDialog::getColor(
1092 dispProps->getValue(ImageDisplayProperties::Color).value<QColor>(), NULL,
1093 "Cube Display Color",
1094 QColorDialog::ShowAlphaChannel);
1095 }
1096
1097 return colorResult->isValid();
1098 }
1099
1100
1110 QStringList results;
1111 foreach (Image *image, *this) {
1112 ImageDisplayProperties *displayProperties = image->displayProperties();
1113
1114 QColor displayColor = displayProperties->getValue(
1115 ImageDisplayProperties::Color).value<QColor>();
1116
1117 results.append(QString::number(displayColor.alpha()));
1118
1119 displayColor.setAlpha(newAlpha);
1120 displayProperties->setColor(displayColor);
1121 }
1122
1123 return results;
1124 }
1125
1126
1137 QStringList results;
1138
1139 if (newColor.isValid()) {
1140 foreach (Image *image, *this) {
1141 ImageDisplayProperties *displayProperties = image->displayProperties();
1142
1143 QColor displayColor = displayProperties->getValue(
1144 ImageDisplayProperties::Color).value<QColor>();
1145
1146 results.append(Color::toRGBAString(displayColor));
1147
1148 displayProperties->setColor(newColor);
1149 }
1150 }
1151
1152 return results;
1153 }
1154
1155
1164 QStringList results;
1165
1166 foreach (Image *image, *this) {
1167 QColor ranColor = ImageDisplayProperties::randomColor();
1168
1169 ImageDisplayProperties *displayProperties = image->displayProperties();
1170
1171 QColor displayColor = displayProperties->getValue(
1172 ImageDisplayProperties::Color).value<QColor>();
1173
1174 // Preserve alpha
1175 ranColor.setAlpha(displayColor.alpha());
1176
1177 // QColor::name() doesn't preserve alpha.
1178 results.append(
1179 QString("%1 %2").arg(Color::toRGBAString(displayColor))
1180 .arg(Color::toRGBAString(ranColor)));
1181
1182 displayProperties->setColor(ranColor);
1183 }
1184
1185 return results;
1186 }
1187
1188
1194 int newAlpha = 255;
1195
1196 if (askAlpha(&newAlpha)) {
1197 saveAndApplyAlpha(newAlpha);
1198 }
1199 }
1200
1201
1207 QColor newColor;
1208 askNewColor(&newColor);
1209 saveAndApplyColor(newColor);
1210 }
1211
1212
1218 foreach (Image *image, *this) {
1219 QColor ranColor = ImageDisplayProperties::randomColor();
1220 image->displayProperties()->setColor(ranColor);
1221 }
1222 }
1223
1224
1232 QStringList results;
1233
1234 if (!isEmpty()) {
1235 ImageDisplayProperties *firstDisplayProperties = first()->displayProperties();
1236 bool newValue = !firstDisplayProperties->getValue(ImageDisplayProperties::ShowDNs).toBool();
1237
1238 foreach (Image *image, *this) {
1239 ImageDisplayProperties *displayProps = image->displayProperties();
1240
1241 bool value = displayProps->getValue(ImageDisplayProperties::ShowDNs).toBool();
1242 results.append(value? "shown" : "hidden");
1243
1244 image->displayProperties()->setShowDNs(newValue);
1245 }
1246 }
1247
1248 return results;
1249 }
1250
1251
1260 QStringList results;
1261
1262 if (!isEmpty()) {
1263 ImageDisplayProperties *firstDisplayProps = first()->displayProperties();
1264 bool newValue = !firstDisplayProps->getValue(ImageDisplayProperties::ShowFill).toBool();
1265
1266 foreach (Image *image, *this) {
1267 ImageDisplayProperties *displayProps = image->displayProperties();
1268
1269 bool value = displayProps->getValue(ImageDisplayProperties::ShowFill).toBool();
1270 results.append(value? "shown" : "hidden");
1271
1272 image->displayProperties()->setShowFill(newValue);
1273 }
1274 }
1275
1276 return results;
1277 }
1278
1279
1288 QStringList results;
1289
1290 if (!isEmpty()) {
1291 ImageDisplayProperties *firstDisplayProps = first()->displayProperties();
1292 bool newValue = !firstDisplayProps->getValue(ImageDisplayProperties::ShowLabel).toBool();
1293
1294 foreach (Image *image, *this) {
1295 ImageDisplayProperties *displayProps = image->displayProperties();
1296
1297 bool value = displayProps->getValue(ImageDisplayProperties::ShowLabel).toBool();
1298 results.append(value? "shown" : "hidden");
1299
1300 image->displayProperties()->setShowLabel(newValue);
1301 }
1302 }
1303
1304 return results;
1305 }
1306
1307
1316 QStringList results;
1317
1318 if (!isEmpty()) {
1319 ImageDisplayProperties *firstDisplayProps = first()->displayProperties();
1320 bool newValue = !firstDisplayProps->getValue(ImageDisplayProperties::ShowOutline).toBool();
1321
1322 foreach (Image *image, *this) {
1323 ImageDisplayProperties *displayProps = image->displayProperties();
1324
1325 bool value = displayProps->getValue(ImageDisplayProperties::ShowOutline).toBool();
1326 results.append(value? "shown" : "hidden");
1327
1328 image->displayProperties()->setShowOutline(newValue);
1329 }
1330 }
1331
1332 return results;
1333 }
1334}
static QString toRGBAString(QColor)
Convert a QColor to its QString.
Definition Color.cpp:38
static QColor fromRGBAString(QString)
Converts a QString to its QColor.
Definition Color.cpp:21
QVariant getValue(int property) const
Get a property's associated data.
bool supports(int property)
Support may come later, please make sure you are connected to the supportAdded signal.
File name manipulation and expansion.
Definition FileName.h:100
QString path() const
Returns the path of the file name.
Definition FileName.cpp:103
QDir dir() const
Returns the path of the file's parent directory as a QDir object.
Definition FileName.cpp:465
QString original() const
Returns the full file name including the file path.
Definition FileName.cpp:212
QString toString() const
Returns a QString of the full file name including the file path, excluding the attributes with any Is...
Definition FileName.cpp:515
Isis exception class.
Definition IException.h:91
@ Io
A type of error that occurred when performing an actual I/O operation.
Definition IException.h:155
Adds specific functionality to C++ strings.
Definition IString.h:165
This is the GUI communication mechanism for cubes.
void setShowLabel(bool)
Change the visibility of the display name associated with this cube.
void setShowFill(bool)
Change the visibility of the fill area associated with this cube.
void setShowDNs(bool)
Change the visibility of DNs associated with this cube.
Property
This is a list of properties and actions that are possible.
@ ShowLabel
True if the cube should show its display name (bool)
@ ShowFill
True if the cube should show a fill area if possible (bool)
@ ShowDNs
True if the cube should show DN values if possible (bool)
@ Zooming
Data ignored. Tells if the cube supports the zoomFit action.
@ Color
The color of the cube, default randomized (QColor)
@ ZOrdering
Data ignored. Tells if the cube supports the "move*" actions.
@ ShowOutline
True if the cube should be outlined (bool)
void setColor(QColor newColor)
Change the color associated with this cube.
void setShowOutline(bool)
Change the visibility of the outline associated with this cube.
static QColor randomColor()
Creates and returns a random color for the intial color of the footprint polygon.
This represents a cube in a project-based GUI interface.
Definition Image.h:105
void closeCube()
Cleans up the Cube pointer.
Definition Image.cpp:282
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Write the Image properties out to an XML file.
Definition Image.cpp:601
ImageDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this image.
Definition Image.cpp:295
void deleteFromDisk()
Delete the image data from disk.
Definition Image.cpp:561
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.
@ ToggleShowOutline
Show or hide each image's outline.
@ MoveToBottom
Move the image to the back.
@ ChangeTransparency
Change the alpha values of the image list.
@ ToggleShowFilled
Show or hide each image's fill area.
@ ChangeColor
Change the color values of the image list.
@ ToggleShowCubeData
Show or hide each image's DNs.
@ MoveDownOne
Move the image backward.
@ ZoomFit
Zoom in on the image so that it fits the screen.
@ MoveToTop
Move the image to the front.
@ ToggleShowLabel
Show or hide each image's display name.
@ RandomizeColor
Set each image in the list to a random color.
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
QString newProjectRoot() const
Get the top-level folder of the new project.
Definition Project.cpp:1736
QString imageDataRoot() const
Accessor for the root directory of the image data.
Definition Project.cpp:2138
QString projectRoot() const
Get the top-level folder of the project.
Definition Project.cpp:1727
static QString imageDataRoot(QString projectRoot)
Appends the root directory name 'images' to the project .
Definition Project.cpp:2128
Serial Number list generator.
void add(const QString &filename, bool def2filename=false)
Adds a new filename / serial number pair to the SerialNumberList.
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
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition IString.cpp:93