1#include "ImageListActionWorkOrder.h"
35 QUndoCommand::setText(
toString(action));
53 foreach (
const Image *image, *other.imageList()) {
54 connect(
this, SIGNAL(bringToFront()), image->
displayProperties(), SIGNAL(moveToTop()));
85 return !images->isEmpty();
104 QUndoCommand::setText(modifiedString);
107 foreach (
Image *image, *images) {
108 connect(
this, SIGNAL(bringToFront()), image->
displayProperties(), SIGNAL(moveToTop()));
135 state.append(QString::number(alpha));
144 if (color.isValid()) {
154 int maxRecommendedLabels = 2000;
156 imageList()->count() > maxRecommendedLabels) {
157 QMessageBox::StandardButton selectedOpt = QMessageBox::warning(NULL,
158 tr(
"Potentially Slow Operation"),
159 tr(
"You are asking to show the labels on %L1 images. When viewing these images in "
160 "a 2D footprint view, these images will take at least 3x longer to render. This "
161 "is a significant performance loss. Showing more than a few labels at a time is "
162 "not recommended. Are you sure you want to show the labels on these %L1 images?")
164 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
166 if (selectedOpt == QMessageBox::No) {
226 state = state.mid(0, 2);
231 state = state.mid(0, 2);
236 if (state.count() > 1) {
241 state.append(
imageList()->saveAndApplyRandomColor());
246 state = state.mid(0, 1);
247 state.append(
imageList()->saveAndToggleShowLabel());
251 state = state.mid(0, 1);
252 state.append(
imageList()->saveAndToggleShowFill());
256 state = state.mid(0, 1);
257 state.append(
imageList()->saveAndToggleShowDNs());
261 state = state.mid(0, 1);
262 state.append(
imageList()->saveAndToggleShowOutline());
363 QString result = unqualifiedString;
371 result = tr(
"Hide Label");
374 result = tr(
"Show Label");
380 result = tr(
"Show Unfilled");
383 result = tr(
"Show Filled");
389 result = tr(
"Hide Cube Data");
392 result = tr(
"Show Cube Data");
398 result = tr(
"Hide Outline");
401 result = tr(
"Show Outline");
426 result = tr(
"Change Transparency");
430 result = tr(
"Change Color");
434 result = tr(
"Randomize Color");
438 result = tr(
"Toggle Label");
442 result = tr(
"Toggle Show Filled");
446 result = tr(
"Toggle Show Cube Data");
450 result = tr(
"Toggle Show Outline");
454 result = tr(
"Bring to Front");
458 result = tr(
"Bring Forward");
462 result = tr(
"Send to Back");
466 result = tr(
"Send Backward");
470 result = tr(
"Zoom Fit");
486 QString actionString) {
489 for (
Action act = FirstAction;
491 act = (
Action)(act + 1)) {
492 if (
toString(act).toUpper() == actionString.toUpper()) {
static QString toRGBAString(QColor)
Convert a QColor to its QString.
static QColor fromRGBAString(QString)
Converts a QString to its QColor.
This is the GUI communication mechanism for cubes.
@ 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)
@ ShowOutline
True if the cube should be outlined (bool)
This represents a cube in a project-based GUI interface.
ImageDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this image.
Work orders that can be performed on an image list that modifies internal state.
static Action fromActionString(QString)
Convert a string to an action.
static QString toString(Action)
Convert an action to a string.
ImageListActionWorkOrder(Project *project)
Construct a work order for the given project.
~ImageListActionWorkOrder()
Destructor.
bool setupExecution()
If needed, prompt the user for input and save it.
bool isExecutable(ImageList *images)
Check if the work order can run on a given image list.
ImageListActionWorkOrder * clone() const
Clone the current work order.
void setData(ImageList *images)
Assign an image list to the work order.
void execute()
Perform the action stored in the work order and update the work order's internal data with the result...
static QString qualifyString(QString unqualifiedString, ImageList *)
Determine whether a toggle action should show or hide.
void undoExecution()
Undo the action stored in the work order and update the work order's internal data with the results o...
Action
Type of action to be performed by the work order.
@ 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.
@ UnknownAction
Unknown action.
@ MoveDownOne
Move the image backward.
@ ZoomFit
Zoom in on the image so that it fits the screen.
@ MoveToTop
Move the image to the front.
@ MoveUpOne
Move the image forward.
@ 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.
void applyShowOutline(QStringList showOutlineValues)
Sets the visibility of the outlines of the images in the image list based on a list of values.
void applyShowDNs(QStringList showDNsValues)
Sets the visibility of the DNs of the images in the image list based on a list of values.
void applyAlphas(QStringList alphaValues)
Sets the alpha values of the images based on a list of values.
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 applyColors(QStringList colorValues, int column=0)
Sets the colors values of the images based on a list of values.
bool askAlpha(int *alphaResult) const
Prompts the user for an alpha value.
bool askNewColor(QColor *colorResult) const
Prompts the user for color values.
void applyShowFill(QStringList showFillValues)
Sets the visibility of the fill areas of the images in the image list based on a list of values.
The main project for ipce.
Provide Undo/redo abilities, serialization, and history for an operation.
bool m_isSavedToHistory
Set the work order to be shown in the HistoryTreeWidget.
virtual void setData(Context)
Sets the context data for this WorkOrder.
virtual bool setupExecution()
This sets up the state for the work order.
QStringList internalData() const
Gets the internal data for this WorkOrder.
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
ImageList * imageList()
Returns a pointer to the ImageList for this WorkOrder.
This is free and unencumbered software released into the public domain.
int toInt(const QString &string)
Global function to convert from a string to an integer.