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#include "XmlStackedHandlerReader.h"
45
46namespace Isis {
54 ImageList::ImageList(QString name, QString path, QObject *parent) : QObject(parent) {
55 m_name = name;
56 m_path = path;
57 }
58
59
66 }
67
68
75 ImageList::ImageList(QList<Image *> images, QObject *parent) : QObject(parent) {
76 append(images);
77 }
78
79
88 QObject(parent) {
89 xmlReader->pushContentHandler(new XmlHandler(this, project));
90 }
91
92
99 QList<Image *>(other) {
100 m_name = other.m_name;
101 m_path = other.m_path;
102 }
103
104
111 foreach (QString fileName, fileNames) {
112 try {
113 Image *image = new Image(fileName);
114 append(image);
115 image->closeCube();
116 }
117 catch (IException &) {
118 }
119 }
120 }
121
122
128
129
136
137 SerialNumberList *result = new SerialNumberList();
138
139 for (int i = 0; i < count(); i++) {
140 result->add((*this)[i]->fileName());
141 }
142 return result;
143 }
144
145
153 void ImageList::append(Image * const &value) {
155 emit countChanged(count());
156 }
157
158
166 void ImageList::append(const QList<Image *> &value) {
168 emit countChanged(count());
169 }
170
171
178 bool countChanging = count();
180 if (countChanging) {
181 emit countChanged(count());
182 }
183 }
184
185
196 iterator result = QList<Image *>::erase(pos);
197 emit countChanged(count());
198 return result;
199 }
200
201
214 QList<Image *>::iterator ImageList::erase(iterator begin, iterator end) {
215 iterator result = QList<Image *>::erase(begin, end);
216 emit countChanged(count());
217 return result;
218 }
219
220
229 void ImageList::insert(int i, Image * const &value) {
230 QList<Image *>::insert(i, value);
231
232 emit countChanged(count());
233 }
234
235
246 QList<Image *>::iterator ImageList::insert(iterator before, Image * const &value) {
247 iterator result = QList<Image *>::insert(before, value);
248 emit countChanged(count());
249 return result;
250 }
251
252
260 void ImageList::prepend(Image * const &value) {
262 emit countChanged(count());
263 }
264
265
274 void ImageList::push_back(Image * const &value) {
276 emit countChanged(count());
277 }
278
279
288 void ImageList::push_front(Image * const &value) {
290 emit countChanged(count());
291 }
292
293
303 int ImageList::removeAll(Image * const &value) {
304 int result = QList<Image *>::removeAll(value);
305
306 if (result != 0) {
307 emit countChanged(count());
308 }
309
310 return result;
311 }
312
313
323 emit countChanged(count());
324 }
325
326
334 emit countChanged(count());
335 }
336
337
345 emit countChanged(count());
346 }
347
348
358 bool ImageList::removeOne(Image * const &value) {
359 bool result = QList<Image *>::removeOne(value);
360
361 if (result) {
362 emit countChanged(count());
363 }
364
365 return result;
366 }
367
368
376 void ImageList::swap(QList<Image *> &other) {
378
379 if (count() != other.count()) {
380 emit countChanged(count());
381 }
382 }
383
384
395 Image * result = QList<Image *>::takeAt(i);
396 emit countChanged(count());
397 return result;
398 }
399
400
410 emit countChanged(count());
411 return result;
412 }
413
414
424 emit countChanged(count());
425 return result;
426 }
427
428
439 ImageList &ImageList::operator+=(const QList<Image *> &other) {
441
442 if (other.count()) {
443 emit countChanged(count());
444 }
445
446 return *this;
447 }
448
449
462 emit countChanged(count());
463 return *this;
464 }
465
466
477 ImageList &ImageList::operator<<(const QList<Image *> &other) {
479
480 if (other.count()) {
481 emit countChanged(count());
482 }
483
484 return *this;
485 }
486
487
500 emit countChanged(count());
501 return *this;
502 }
503
504
514 ImageList &ImageList::operator=(const QList<Image *> &rhs) {
515 bool countChanging = (rhs.count() != count());
517
518 if (countChanging) {
519 emit countChanged(count());
520 }
521
522 return *this;
523 }
524
525
534 bool countChanging = (rhs.count() != count());
536
537 m_name = rhs.m_name;
538 m_path = rhs.m_path;
539
540 if (countChanging) {
541 emit countChanged(count());
542 }
543
544 return *this;
545 }
546
547
565 QList<QAction *> ImageList::supportedActions(Project *project) {
566
567 QList<QAction *> actions;
568
569 // It turns out connect() statements cannot be templated, hence they aren't inside of
570 // createWorkOrder().
572
574 if (!project) {
575 connect(alphaAction, SIGNAL(triggered()),
576 this, SLOT(askAndUpdateAlpha()));
577 }
578 actions.append(alphaAction);
579
581 if (!project) {
582 connect(colorAction, SIGNAL(triggered()),
583 this, SLOT(askAndUpdateColor()));
584 }
585 actions.append(colorAction);
586
588 if (!project) {
589 connect(ranColorAction, SIGNAL(triggered()),
590 this, SLOT(showRandomColor()));
591 }
592 actions.append(ranColorAction);
593 }
594
596 QAction *labelVisibleAction = createWorkOrder(project,
598 if (!project) {
599 connect(labelVisibleAction, SIGNAL(triggered()),
600 this, SLOT(saveAndToggleShowLabel()));
601 }
602 actions.append(labelVisibleAction);
603 }
604
607 if (!project) {
608 connect(fillAction, SIGNAL(triggered()),
609 this, SLOT(saveAndToggleShowFill()));
610 }
611 actions.append(fillAction);
612 }
613
615 QAction *cubeDataAction = createWorkOrder(project,
617 if (!project) {
618 connect(cubeDataAction, SIGNAL(triggered()),
619 this, SLOT(saveAndToggleShowDNs()));
620 }
621 actions.append(cubeDataAction);
622 }
623
625 QAction *outlineAction = createWorkOrder(project,
627 if (!project) {
628 connect(outlineAction, SIGNAL(triggered()),
629 this, SLOT(saveAndToggleShowOutline()));
630 }
631 actions.append(outlineAction);
632 }
633
634 actions.append(NULL);
635
637
642
643 foreach (Image *image, *this) {
644 connect(moveToTopAct, SIGNAL(triggered()),
645 image->displayProperties(), SIGNAL(moveToTop()));
646
647 connect(moveUpAct, SIGNAL(triggered()),
648 image->displayProperties(), SIGNAL(moveUpOne()));
649
650 connect(moveToBottomAct, SIGNAL(triggered()),
651 image->displayProperties(), SIGNAL(moveToBottom()));
652
653 connect(moveDownAct, SIGNAL(triggered()),
654 image->displayProperties(), SIGNAL(moveDownOne()));
655 }
656
657 actions.append(moveToTopAct);
658 actions.append(moveUpAct);
659 actions.append(moveToBottomAct);
660 actions.append(moveDownAct);
661 }
662
663 actions.append(NULL);
664
665 if (size() == 1 && allSupport(ImageDisplayProperties::Zooming)) {
667 connect(zoomFit, SIGNAL(triggered()),
668 first()->displayProperties(), SIGNAL(zoomFit()));
669 actions.append(zoomFit);
670 }
671
672 return actions;
673 }
674
675
685 if (isEmpty())
686 return false;
687
688 foreach (Image *image, *this) {
689 if (!image->displayProperties()->supports(prop))
690 return false;
691 }
692
693 return true;
694 }
695
696
703 void ImageList::setName(QString newName) {
704 m_name = newName;
705 }
706
707
714 void ImageList::setPath(QString newPath) {
715 m_path = newPath;
716 }
717
718
724 QString ImageList::name() const {
725 return m_name;
726 }
727
728
735 QString ImageList::path() const {
736 return m_path;
737 }
738
739
748 foreach (Image *image, *this) {
749 image->deleteFromDisk();
750 }
751
752 if (!m_path.isEmpty()) {
753 QFile::remove(project->imageDataRoot() + "/" + m_path + "/images.xml");
754
755 QDir dir;
756 dir.rmdir(project->imageDataRoot() + "/" + m_path);
757 }
758 }
759
760
785 void ImageList::save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot)
786 const {
787 stream.writeStartElement("imageList");
788 stream.writeAttribute("name", m_name);
789 stream.writeAttribute("path", m_path);
790 // The newProjectRoot contains the full path and we want the dataRoot to be relative to the
791 // projectRoot so that projects can be moved.
792 QString dataRoot =
793 Project::imageDataRoot(newProjectRoot.toString()).remove(project->newProjectRoot());
794 // Get rid of any preceding "/"
795 if (dataRoot.startsWith("/")) {
796 dataRoot.remove(0,1);
797 }
798 stream.writeAttribute("dataRoot", dataRoot);
799
800 FileName settingsFileName(Project::imageDataRoot(newProjectRoot.toString()) +
801 "/" + m_path + "/images.xml");
802
803 if (!settingsFileName.dir().mkpath(settingsFileName.path())) {
805 QString("Failed to create directory [%1]")
806 .arg(settingsFileName.path()),
807 _FILEINFO_);
808 }
809 QFile imageListContentsFile(settingsFileName.toString());
810
811 if (!imageListContentsFile.open(QIODevice::ReadWrite | QIODevice::Truncate)) {
813 QString("Unable to save image information for [%1] because [%2] could not be opened for "
814 "writing")
815 .arg(m_name).arg(settingsFileName.original()),
816 _FILEINFO_);
817 }
818
819 QXmlStreamWriter imageDetailsWriter(&imageListContentsFile);
820 imageDetailsWriter.setAutoFormatting(true);
821 imageDetailsWriter.writeStartDocument();
822
823 imageDetailsWriter.writeStartElement("images");
824
825 // Only copy images if saving to new location
826 if (project->newProjectRoot() != project->projectRoot()) {
827 int countWidth = QString("%1L").arg(count()).size() - 1;
828 QChar paddingChar('0');
829
830 QLabel *progressLabel = new QLabel;
831
832 QProgressDialog progressDialog;
833 progressDialog.setLabel(progressLabel);
834 progressDialog.setRange(-1, count());
835 progressDialog.setValue(-1);
836
837 // Mapped is way faster than hundreds/thousands of run() calls... so use mapped for performance
838 QFuture<void *> future = QtConcurrent::mapped(*this,
839 CopyImageDataFunctor(project, newProjectRoot));
840
841 for (int i = 0; i < count(); i++) {
842 int newProgressValue = progressDialog.value() + 1;
843 progressLabel->setText(
844 tr("Saving Image Information for [%1] - %L2/%L3 done")
845 .arg(m_name)
846 .arg(newProgressValue, countWidth, 10, paddingChar)
847 .arg(count()));
848 progressDialog.setValue(newProgressValue);
849 try {
850 future.resultAt(i);
851 }
852 catch(std::exception &e) {
853 QString msg("Could not save ImageList: "+this->name() );
854 throw IException(IException::Io,msg,_FILEINFO_);
855 }
856 }
857
858 progressLabel->setText(tr("Finalizing..."));
859 progressDialog.setRange(0, 0);
860 progressDialog.setValue(0);
861 }
862
863 foreach (Image *image, *this) {
864 image->save(imageDetailsWriter, project, newProjectRoot);
865 }
866
867 imageDetailsWriter.writeEndElement();
868
869 imageDetailsWriter.writeEndDocument();
870
871 stream.writeEndElement();
872 }
873
874
882 FileName newProjectRoot) {
883 m_project = project;
884 m_newProjectRoot = newProjectRoot;
885 }
886
887
894 m_project = other.m_project;
895 m_newProjectRoot = other.m_newProjectRoot;
896 }
897
898
904
905
915 try {
916 imageToCopy->copyToNewProjectRoot(m_project, m_newProjectRoot);
917 }
918 catch (IException &e) {
919 IString msg = "Could not copy image [" + imageToCopy->displayProperties()->displayName() +
920 "]";
921 throw IException(e, IException::Io, msg, _FILEINFO_);
922 }
923 return NULL;
924 }
925
926
935 const CopyImageDataFunctor &rhs) {
936 m_project = rhs.m_project;
937 m_newProjectRoot = rhs.m_newProjectRoot;
938 return *this;
939 }
940
941
951 if (count() == alphaValues.count()) {
952 for (int i = 0; i < count(); i++) {
953 ImageDisplayProperties *dispProps = (*this)[i]->displayProperties();
954 QColor color = dispProps->getValue(ImageDisplayProperties::Color).value<QColor>();
955 color.setAlpha(alphaValues[i].toInt());
956 dispProps->setColor(color);
957 }
958 }
959 }
960
961
971 void ImageList::applyColors(QStringList colorValues, int column) {
972 if (count() == colorValues.count()) {
973 for (int i = 0; i < count(); i++) {
974 QString colorData = colorValues[i].split(" ")[column];
975 (*this)[i]->displayProperties()->setColor(Color::fromRGBAString(colorData));
976 }
977 }
978 }
979
980
992 if (count() == showLabelValues.count()) {
993 for (int i = 0; i < count(); i++) {
994 ImageDisplayProperties *dispProps = (*this)[i]->displayProperties();
995 dispProps->setShowLabel(showLabelValues[i] == "shown");
996 }
997 }
998 }
999
1000
1012 if (count() == showFillValues.count()) {
1013 for (int i = 0; i < count(); i++) {
1014 ImageDisplayProperties *dispProps = (*this)[i]->displayProperties();
1015 dispProps->setShowFill(showFillValues[i] == "shown");
1016 }
1017 }
1018 }
1019
1020
1031 if (count() == showDNsValues.count()) {
1032 for (int i = 0; i < count(); i++) {
1033 ImageDisplayProperties *dispProps = (*this)[i]->displayProperties();
1034 dispProps->setShowDNs(showDNsValues[i] == "shown");
1035 }
1036 }
1037 }
1038
1039
1050 if (count() == showOutlineValues.count()) {
1051 for (int i = 0; i < count(); i++) {
1052 ImageDisplayProperties *dispProps = (*this)[i]->displayProperties();
1053 dispProps->setShowOutline(showOutlineValues[i] == "shown");
1054 }
1055 }
1056 }
1057
1058
1072 bool ImageList::askAlpha(int *alphaResult) const {
1073 bool result = false;
1074
1075 if (!isEmpty()) {
1076 ImageDisplayProperties *dispProps = first()->displayProperties();
1077 *alphaResult = QInputDialog::getInt(NULL, "Transparency Value",
1078 "Set the cube's transparency\nValues are 0 (invisible) to 255 (solid)",
1079 dispProps->getValue(ImageDisplayProperties::Color).value<QColor>().alpha(),
1080 0, 255, 1, &result);
1081 }
1082
1083 return result;
1084 }
1085
1086
1100 bool ImageList::askNewColor(QColor *colorResult) const {
1101 *colorResult = QColor();
1102
1103 if (!isEmpty()) {
1104 ImageDisplayProperties *dispProps = first()->displayProperties();
1105 *colorResult = QColorDialog::getColor(
1106 dispProps->getValue(ImageDisplayProperties::Color).value<QColor>(), NULL,
1107 "Cube Display Color",
1108 QColorDialog::ShowAlphaChannel);
1109 }
1110
1111 return colorResult->isValid();
1112 }
1113
1114
1124 QStringList results;
1125 foreach (Image *image, *this) {
1126 ImageDisplayProperties *displayProperties = image->displayProperties();
1127
1128 QColor displayColor = displayProperties->getValue(
1129 ImageDisplayProperties::Color).value<QColor>();
1130
1131 results.append(QString::number(displayColor.alpha()));
1132
1133 displayColor.setAlpha(newAlpha);
1134 displayProperties->setColor(displayColor);
1135 }
1136
1137 return results;
1138 }
1139
1140
1151 QStringList results;
1152
1153 if (newColor.isValid()) {
1154 foreach (Image *image, *this) {
1155 ImageDisplayProperties *displayProperties = image->displayProperties();
1156
1157 QColor displayColor = displayProperties->getValue(
1158 ImageDisplayProperties::Color).value<QColor>();
1159
1160 results.append(Color::toRGBAString(displayColor));
1161
1162 displayProperties->setColor(newColor);
1163 }
1164 }
1165
1166 return results;
1167 }
1168
1169
1178 QStringList results;
1179
1180 foreach (Image *image, *this) {
1181 QColor ranColor = ImageDisplayProperties::randomColor();
1182
1183 ImageDisplayProperties *displayProperties = image->displayProperties();
1184
1185 QColor displayColor = displayProperties->getValue(
1186 ImageDisplayProperties::Color).value<QColor>();
1187
1188 // Preserve alpha
1189 ranColor.setAlpha(displayColor.alpha());
1190
1191 // QColor::name() doesn't preserve alpha.
1192 results.append(
1193 QString("%1 %2").arg(Color::toRGBAString(displayColor))
1194 .arg(Color::toRGBAString(ranColor)));
1195
1196 displayProperties->setColor(ranColor);
1197 }
1198
1199 return results;
1200 }
1201
1202
1208 int newAlpha = 255;
1209
1210 if (askAlpha(&newAlpha)) {
1211 saveAndApplyAlpha(newAlpha);
1212 }
1213 }
1214
1215
1221 QColor newColor;
1222 askNewColor(&newColor);
1223 saveAndApplyColor(newColor);
1224 }
1225
1226
1232 foreach (Image *image, *this) {
1233 QColor ranColor = ImageDisplayProperties::randomColor();
1234 image->displayProperties()->setColor(ranColor);
1235 }
1236 }
1237
1238
1246 QStringList results;
1247
1248 if (!isEmpty()) {
1249 ImageDisplayProperties *firstDisplayProperties = first()->displayProperties();
1250 bool newValue = !firstDisplayProperties->getValue(ImageDisplayProperties::ShowDNs).toBool();
1251
1252 foreach (Image *image, *this) {
1253 ImageDisplayProperties *displayProps = image->displayProperties();
1254
1255 bool value = displayProps->getValue(ImageDisplayProperties::ShowDNs).toBool();
1256 results.append(value? "shown" : "hidden");
1257
1258 image->displayProperties()->setShowDNs(newValue);
1259 }
1260 }
1261
1262 return results;
1263 }
1264
1265
1274 QStringList results;
1275
1276 if (!isEmpty()) {
1277 ImageDisplayProperties *firstDisplayProps = first()->displayProperties();
1278 bool newValue = !firstDisplayProps->getValue(ImageDisplayProperties::ShowFill).toBool();
1279
1280 foreach (Image *image, *this) {
1281 ImageDisplayProperties *displayProps = image->displayProperties();
1282
1283 bool value = displayProps->getValue(ImageDisplayProperties::ShowFill).toBool();
1284 results.append(value? "shown" : "hidden");
1285
1286 image->displayProperties()->setShowFill(newValue);
1287 }
1288 }
1289
1290 return results;
1291 }
1292
1293
1302 QStringList results;
1303
1304 if (!isEmpty()) {
1305 ImageDisplayProperties *firstDisplayProps = first()->displayProperties();
1306 bool newValue = !firstDisplayProps->getValue(ImageDisplayProperties::ShowLabel).toBool();
1307
1308 foreach (Image *image, *this) {
1309 ImageDisplayProperties *displayProps = image->displayProperties();
1310
1311 bool value = displayProps->getValue(ImageDisplayProperties::ShowLabel).toBool();
1312 results.append(value? "shown" : "hidden");
1313
1314 image->displayProperties()->setShowLabel(newValue);
1315 }
1316 }
1317
1318 return results;
1319 }
1320
1321
1330 QStringList results;
1331
1332 if (!isEmpty()) {
1333 ImageDisplayProperties *firstDisplayProps = first()->displayProperties();
1334 bool newValue = !firstDisplayProps->getValue(ImageDisplayProperties::ShowOutline).toBool();
1335
1336 foreach (Image *image, *this) {
1337 ImageDisplayProperties *displayProps = image->displayProperties();
1338
1339 bool value = displayProps->getValue(ImageDisplayProperties::ShowOutline).toBool();
1340 results.append(value? "shown" : "hidden");
1341
1342 image->displayProperties()->setShowOutline(newValue);
1343 }
1344 }
1345
1346 return results;
1347 }
1348
1349
1358 ImageList::XmlHandler::XmlHandler(ImageList *imageList, Project *project, QString dataRoot) {
1359 m_imageList = imageList;
1360 m_project = project;
1361 m_imageDataRoot = dataRoot;
1362 }
1363
1364
1371 bool ImageList::XmlHandler::startElement(const QString &namespaceURI, const QString &localName,
1372 const QString &qName, const QXmlAttributes &atts) {
1373 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
1374 if (localName == "imageList") {
1375 QString name = atts.value("name");
1376 QString path = atts.value("path");
1377 m_imageDataRoot = atts.value("dataRoot");
1378
1379 if (!name.isEmpty()) {
1380 m_imageList->setName(name);
1381 }
1382
1383 if (!path.isEmpty()) {
1384 m_imageList->setPath(path);
1385 }
1386 }
1387 else if (localName == "image") {
1388 m_imageList->append(new Image(
1389 m_project->projectRoot() + "/" + m_imageDataRoot + "/" + m_imageList->path(), reader()));
1390 }
1391 }
1392
1393 return true;
1394 }
1395
1396
1406 bool ImageList::XmlHandler::endElement(const QString &namespaceURI, const QString &localName,
1407 const QString &qName) {
1408 if (localName == "imageList") {
1409 XmlHandler handler(m_imageList, m_project, m_imageDataRoot);
1410
1412 reader.pushContentHandler(&handler);
1413 reader.setErrorHandler(&handler);
1414
1415 QDir projectPath = QDir(m_project->projectRoot()).dirName();
1416 QString imageListXmlPath = m_project->projectRoot() + "/" + m_imageDataRoot + "/" +
1417 m_imageList->path() + "/images.xml";
1418 imageListXmlPath = QDir::cleanPath(imageListXmlPath);
1419
1420 QFile file(imageListXmlPath);
1421
1422 if (!file.open(QFile::ReadOnly)) {
1424 QString("Unable to open [%1] with read access")
1425 .arg(imageListXmlPath),
1426 _FILEINFO_);
1427 }
1428
1429 QXmlInputSource xmlInputSource(&file);
1430 if (!reader.parse(xmlInputSource))
1432 tr("Failed to open image list XML [%1]").arg(imageListXmlPath),
1433 _FILEINFO_);
1434 }
1435
1436 return XmlStackedHandler::endElement(namespaceURI, localName, qName);
1437 }
1438}
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:107
void closeCube()
Cleans up the Cube pointer.
Definition Image.cpp:307
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Write the Image properties out to an XML file.
Definition Image.cpp:626
ImageDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this image.
Definition Image.cpp:320
void deleteFromDisk()
Delete the image data from disk.
Definition Image.cpp:586
This functor is used for copying the images between two projects quickly.
Definition ImageList.h:170
const Project * m_project
This stores the name of the project that is going to be copied to.
Definition ImageList.h:184
FileName m_newProjectRoot
This stores the path to the root of the project that is going to be copied to.
Definition ImageList.h:188
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.
This class is used to read an images.xml file into an image list.
Definition ImageList.h:133
XmlHandler(ImageList *imageList, Project *project, QString dataRoot="")
Create an XML Handler (reader) that can populate the Image list class data.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle an XML end element.
@ 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:55
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:54
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:200
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:242
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:254
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:289
QString newProjectRoot() const
Get the top-level folder of the new project.
Definition Project.cpp:1674
QString imageDataRoot() const
Accessor for the root directory of the image data.
Definition Project.cpp:2076
QString projectRoot() const
Get the top-level folder of the project.
Definition Project.cpp:1665
static QString imageDataRoot(QString projectRoot)
Appends the root directory name 'images' to the project .
Definition Project.cpp:2066
Serial Number list generator.
void add(const QString &filename, bool def2filename=false)
Adds a new filename / serial number pair to the SerialNumberList.
Manage a stack of content handlers for reading XML files.
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
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