USGS

Isis 3.0 Object Programmers' Reference

Home

Qisis::EditTool Class Reference

#include <EditTool.h>

Inheritance diagram for Qisis::EditTool:

Inheritance graph
[legend]
Collaboration diagram for Qisis::EditTool:

Collaboration graph
[legend]
List of all members.

Detailed Description

Interactive image edit tool.

This tool is part of the Qisis namespace and allows interactive editing of displayed images.

Author:
2006-06-09 Tracie Sucharski

For internal use only.

Todo:
The following fix is a bandaid- there is probably a bug in tiling class, buffer class? The following fix is for rectangle option only, the start/end line still has a problem when going off the right side of image.
History:
2006-10-20 Tracie Sucharski - If rubberband for rectangle option goes off the right side or bottom of image, set esamp/eline to image nsamps/nlines.
History:
2008-05-23 Noah Hilt - Added RubberBandToolfunctionality and changed the mouseButtonReleased method. Also added a writeToCube method that is used by both the rubberBandComplete and mouseButtonRelease methods.
History:
2008-06-19 Noah Hilt - Added methods and signals for saving and discarding changes to the current cube.

Definition at line 65 of file EditTool.h.

Public Types

 Point
 point
 HorizLine
 horizontal line
 VertLine
 vertical line
 StartEndLine
 start-end line
 Rectangle
 rectangle
 UserDn
 User Selected DN value.
 Null
 Null DN value.
 Hrs
 High representation saturation DN value.
 Lrs
 Low representation saturation DN value.
 His
 High instrument saturation DN value.
 Lis
 Low instrument satruation DN value.
enum  EditShape {
  Point, HorizLine, VertLine, StartEndLine,
  Rectangle
}
 Enum for possible shapes. More...
enum  ReplacementValue {
  UserDn, Null, Hrs, Lrs,
  His, Lis
}
 Enum for DN values. More...

Signals

void cubeChanged (bool)
 Emitted when cube changed.
void save ()
 Emitted when cube should be saved.
void saveAs ()
 Emitted when cube should be saved as another file.

Public Member Functions

 EditTool (QWidget *parent)
 Constructs and EditTool object.

Protected Slots

void mouseButtonRelease (QPoint p, Qt::MouseButton m)
 This is a slot called when any mouse button is released inside of a viewport.
virtual void enableRubberBandTool ()
 This method sets up the RubberBandTool depending on which mode is enabled.
void rubberBandComplete ()
 This method is called any time the RubberBandTool is complete.

Protected Member Functions

QAction * toolPadAction (ToolPad *pad)
 Adds the EditTool to the tool pad.
QWidgetcreateToolBarWidget (QStackedWidget *active)
 Creates the toolbar containing the edit tool widgets.
void updateTool ()
 This is a virtual function belonging to the Tool class which is called when the user selects a different viewport.

Private Slots

void selectValType (int index)
 This is a private slot which is called when the user selects a new dn type.
void changeDn ()
 This is a private slot called when the user hits the enter key after typing a value in the dnLineEdit field.
void undoEdit ()
 This is a private slot called when the user selects the undo button.
void undoAll (CubeViewport *vp)
 This method is used to discard any changes made to this viewport.
void redoEdit ()
 This method is called to redo any edit operations that have been undone.
void save (CubeViewport *vp)
 This method saves by removing any undo history for the viewport vp and reopening the cube.
void removeViewport (QObject *vp)
 This is a private slot called to clean up when a viewport is destroyed.

Private Member Functions

QList< QPoint * > * LineToPoints (const QLine &line)
 Convert rubber band line to points.
void writeToCube (int iesamp, int issamp, int ieline, int isline, QList< QPoint * > *linePts)

Private Attributes

QComboBox * p_shapeComboBox
 Shape combobox.
QComboBox * p_valTypeComboBox
 Value type combobox.
QLineEdit * p_dnLineEdit
 DN edit line.
QToolButton * p_undoButton
 Undo button.
QToolButton * p_redoButton
 Redo button.
QToolButton * p_saveButton
 Save button.
QToolButton * p_saveAsButton
 Save as button.
double p_dn
 DN value.
QMap< CubeViewport *, QStack<
Isis::Brick * > * > 
p_undoEdit
 Viewport to brick map for undo.
QMap< CubeViewport *, QStack<
Isis::Brick * > * > 
p_redoEdit
 Viewport to brick map for redo.
QMap< CubeViewport *, int > p_saveMarker
 Marker for last save.


Member Enumeration Documentation

enum Qisis::EditTool::EditShape

Enum for possible shapes.

Enumerator:
Point  point
HorizLine  horizontal line
VertLine  vertical line
StartEndLine  start-end line
Rectangle  rectangle

Definition at line 79 of file EditTool.h.

enum Qisis::EditTool::ReplacementValue

Enum for DN values.

Enumerator:
UserDn  User Selected DN value.
Null  Null DN value.
Hrs  High representation saturation DN value.
Lrs  Low representation saturation DN value.
His  High instrument saturation DN value.
Lis  Low instrument satruation DN value.

Definition at line 91 of file EditTool.h.


Constructor & Destructor Documentation

Qisis::EditTool::EditTool ( QWidget parent  ) 

Constructs and EditTool object.

Parameters:
parent Parent widget

Definition at line 42 of file EditTool.cpp.

References Isis::Null, and p_dn.


Member Function Documentation

void Qisis::EditTool::changeDn (  )  [private, slot]

This is a private slot called when the user hits the enter key after typing a value in the dnLineEdit field.

Definition at line 213 of file EditTool.cpp.

References p_dn, and p_dnLineEdit.

Referenced by createToolBarWidget().

QWidget * Qisis::EditTool::createToolBarWidget ( QStackedWidget *  active  )  [protected]

Creates the toolbar containing the edit tool widgets.

Parameters:
active input The widget that will contain the edit tool specific widgets
History:
2007-08-31 Tracie Sucharski - Changed signal on dn line edit from returnPressed to editingFinished.
Returns:
QWidget*

Definition at line 78 of file EditTool.cpp.

References changeDn(), enableRubberBandTool(), p_dnLineEdit, p_redoButton, p_saveAsButton, p_saveButton, p_shapeComboBox, p_undoButton, p_valTypeComboBox, redoEdit(), save(), saveAs(), selectValType(), and undoEdit().

void Qisis::EditTool::cubeChanged ( bool   )  [signal]

Emitted when cube changed.

Referenced by redoEdit(), undoEdit(), and writeToCube().

void Qisis::EditTool::enableRubberBandTool (  )  [protected, virtual, slot]

This method sets up the RubberBandTool depending on which mode is enabled.

If a valid RubberBandTool mode is not enabled the RubberBandTool is disabled.

Definition at line 886 of file EditTool.cpp.

References Qisis::RubberBandTool::disable(), Qisis::RubberBandTool::enable(), and p_shapeComboBox.

Referenced by createToolBarWidget().

QList< QPoint * > * Qisis::EditTool::LineToPoints ( const QLine &  line  )  [private]

Convert rubber band line to points.

This routine takes two points (sx,sy) and (ex,ey) and determines all the points which make up that line segment. This is useful for drawing graphic on a display or image

Author:
Jan 1 1996 Jeff Anderson, Original version
Parameters:
line input Line to be converted to points
Returns:
QList<QPoint*>* A pointer to a QList of points representing line

Definition at line 803 of file EditTool.cpp.

References ex, x, and y.

Referenced by rubberBandComplete().

void Qisis::EditTool::mouseButtonRelease ( QPoint  p,
Qt::MouseButton  m 
) [protected, slot]

This is a slot called when any mouse button is released inside of a viewport.

Parameters:
p input The point under the cursor
m input Mouse button released (left,middle,right)
History:
2007-03-02 Tracie Sucharski - Reopen cube read/write Workspace::addCubeViewport was opening cube read/write, changed to open read only so that the cube date was not changed unless EditTool is invoked.
History:
2007-02-26 Tracie Sucharski - Remove test for off image editing. It is no longer needed since the bug in the Cube class is fixed.
History:
2008-05-23 Noah Hilt - Removed the rectangle and start/end line functionality from the mouseButtonRelease and moved it to the rubberBandComplete method.

Definition at line 375 of file EditTool.cpp.

References Qisis::CubeViewport::cube(), Qisis::CubeViewport::cubeLines(), Qisis::CubeViewport::cubeSamples(), e, Qisis::CubeViewport::grayBand(), HorizLine, Qisis::CubeViewport::isColor(), Isis::Cube::IsReadOnly(), Isis::Cube::Lines(), p_dn, p_dnLineEdit, p_shapeComboBox, p_valTypeComboBox, Isis::Cube::PixelType(), Point, Isis::Cube::Read(), Isis::Cube::ReOpen(), Isis::Cube::Samples(), Isis::Brick::SetBasePosition(), UserDn, VertLine, Qisis::CubeViewport::viewportToCube(), and writeToCube().

void Qisis::EditTool::redoEdit (  )  [private, slot]

This method is called to redo any edit operations that have been undone.

Definition at line 668 of file EditTool.cpp.

References Qisis::CubeViewport::cube(), cubeChanged(), Qisis::CubeViewport::cubeChanged(), Qisis::CubeViewport::cubeContentsChanged(), Qisis::CubeViewport::grayBand(), Isis::Cube::IsReadOnly(), Isis::Buffer::Line(), Isis::Buffer::LineDimension(), p_redoButton, p_redoEdit, p_saveButton, p_undoButton, p_undoEdit, Isis::Cube::PixelType(), Isis::Cube::Read(), Isis::Buffer::Sample(), Isis::Buffer::SampleDimension(), Isis::Brick::SetBasePosition(), Qisis::CubeViewport::setCaption(), and Isis::Cube::Write().

Referenced by createToolBarWidget().

void Qisis::EditTool::removeViewport ( QObject *  vp  )  [private, slot]

This is a private slot called to clean up when a viewport is destroyed.

This viewport is removed from the undoEdit hash.

Parameters:
vp input Viewport to be removed from the undo edit hash

Definition at line 767 of file EditTool.cpp.

References p_redoEdit, and p_undoEdit.

Referenced by updateTool().

void Qisis::EditTool::rubberBandComplete (  )  [protected, slot]

This method is called any time the RubberBandTool is complete.

It checks if the viewport is writable, checks which mode it is in, either line or rectangle, and if RubberBandTool is valid. It then writes the data from the RubberBandTool to the cube.

Definition at line 262 of file EditTool.cpp.

References Qisis::CubeViewport::cube(), Qisis::CubeViewport::cubeLines(), Qisis::CubeViewport::cubeSamples(), e, Qisis::RubberBandTool::getVertices(), Qisis::CubeViewport::isColor(), Isis::Cube::IsReadOnly(), Qisis::RubberBandTool::isValid(), LineToPoints(), p_shapeComboBox, Qisis::RubberBandTool::rectangle(), Rectangle, Isis::Cube::ReOpen(), StartEndLine, Qisis::CubeViewport::viewportToCube(), and writeToCube().

void Qisis::EditTool::save ( CubeViewport vp  )  [private, slot]

This method saves by removing any undo history for the viewport vp and reopening the cube.

These changes are finalized! There is no undoing after a save has been made.

Parameters:
vp 

Definition at line 741 of file EditTool.cpp.

References Qisis::CubeViewport::cubeChanged(), p_saveButton, p_saveMarker, p_undoEdit, and Qisis::CubeViewport::setCaption().

void Qisis::EditTool::save (  )  [signal]

Emitted when cube should be saved.

Referenced by createToolBarWidget().

void Qisis::EditTool::saveAs (  )  [signal]

Emitted when cube should be saved as another file.

Referenced by createToolBarWidget().

void Qisis::EditTool::selectValType ( int  index  )  [private, slot]

This is a private slot which is called when the user selects a new dn type.

Parameters:
index input This is the index selected in the valType combo box

Definition at line 192 of file EditTool.cpp.

References Isis::His, Isis::Hrs, Isis::Lis, Isis::Lrs, Isis::Null, p_dn, and p_dnLineEdit.

Referenced by createToolBarWidget().

QAction * Qisis::EditTool::toolPadAction ( ToolPad pad  )  [protected]

Adds the EditTool to the tool pad.

Parameters:
pad input The tool pad that EditTool is to be added to
Returns:
QAction*

Definition at line 53 of file EditTool.cpp.

void Qisis::EditTool::undoAll ( CubeViewport vp  )  [private, slot]

This method is used to discard any changes made to this viewport.

If the viewport has been saved, then it will only discard changes to that save point.

Parameters:
vp 

Definition at line 610 of file EditTool.cpp.

References Qisis::CubeViewport::cube(), Isis::Cube::IsReadOnly(), p_redoEdit, p_saveMarker, p_undoEdit, and Isis::Cube::Write().

void Qisis::EditTool::undoEdit (  )  [private, slot]

This is a private slot called when the user selects the undo button.

With each call, another edit is reversed.

Definition at line 535 of file EditTool.cpp.

References Qisis::CubeViewport::cube(), Qisis::CubeViewport::cubeChanged(), cubeChanged(), Qisis::CubeViewport::cubeContentsChanged(), Qisis::CubeViewport::grayBand(), Isis::Cube::IsReadOnly(), Isis::Buffer::Line(), Isis::Buffer::LineDimension(), p_redoButton, p_redoEdit, p_saveButton, p_undoButton, p_undoEdit, Isis::Cube::PixelType(), Isis::Cube::Read(), Isis::Buffer::Sample(), Isis::Buffer::SampleDimension(), Isis::Brick::SetBasePosition(), Qisis::CubeViewport::setCaption(), and Isis::Cube::Write().

Referenced by createToolBarWidget().

void Qisis::EditTool::updateTool (  )  [protected]

This is a virtual function belonging to the Tool class which is called when the user selects a different viewport.

This sets up the signal/slot for destruction of a viewport so the viewport is removed from the undoEdit hash.

For internal use only.

Definition at line 225 of file EditTool.cpp.

References p_redoButton, p_redoEdit, p_saveButton, p_undoButton, p_undoEdit, and removeViewport().

void Qisis::EditTool::writeToCube ( int  iesamp,
int  issamp,
int  ieline,
int  isline,
QList< QPoint * > *  linePts 
) [private]

Parameters:
iesamp input
issamp input
ieline input
isline input
linePts input If the input data is a line, this will be the list of points in the line.

Definition at line 453 of file EditTool.cpp.

References Qisis::CubeViewport::cube(), Qisis::CubeViewport::cubeChanged(), cubeChanged(), Qisis::CubeViewport::cubeContentsChanged(), Qisis::CubeViewport::grayBand(), Isis::Buffer::Line(), Isis::Buffer::LineDimension(), p_dn, p_redoButton, p_redoEdit, p_saveButton, p_shapeComboBox, p_undoButton, p_undoEdit, Isis::Cube::PixelType(), Isis::Cube::Read(), Isis::Buffer::Sample(), Isis::Buffer::SampleDimension(), Isis::Brick::SetBasePosition(), Qisis::CubeViewport::setCaption(), Isis::Buffer::size(), StartEndLine, and Isis::Cube::Write().

Referenced by mouseButtonRelease(), and rubberBandComplete().


Member Data Documentation

double Qisis::EditTool::p_dn [private]

DN value.

Definition at line 131 of file EditTool.h.

Referenced by changeDn(), EditTool(), mouseButtonRelease(), selectValType(), and writeToCube().

QLineEdit* Qisis::EditTool::p_dnLineEdit [private]

DN edit line.

Definition at line 125 of file EditTool.h.

Referenced by changeDn(), createToolBarWidget(), mouseButtonRelease(), and selectValType().

QToolButton* Qisis::EditTool::p_redoButton [private]

Redo button.

Definition at line 127 of file EditTool.h.

Referenced by createToolBarWidget(), redoEdit(), undoEdit(), updateTool(), and writeToCube().

QMap<CubeViewport *, QStack <Isis::Brick *> *> Qisis::EditTool::p_redoEdit [private]

Viewport to brick map for redo.

Definition at line 134 of file EditTool.h.

Referenced by redoEdit(), removeViewport(), undoAll(), undoEdit(), updateTool(), and writeToCube().

QToolButton* Qisis::EditTool::p_saveAsButton [private]

Save as button.

Definition at line 129 of file EditTool.h.

Referenced by createToolBarWidget().

QToolButton* Qisis::EditTool::p_saveButton [private]

Save button.

Definition at line 128 of file EditTool.h.

Referenced by createToolBarWidget(), redoEdit(), save(), undoEdit(), updateTool(), and writeToCube().

QMap<CubeViewport *, int> Qisis::EditTool::p_saveMarker [private]

Marker for last save.

Definition at line 135 of file EditTool.h.

Referenced by save(), and undoAll().

QComboBox* Qisis::EditTool::p_shapeComboBox [private]

Shape combobox.

Definition at line 123 of file EditTool.h.

Referenced by createToolBarWidget(), enableRubberBandTool(), mouseButtonRelease(), rubberBandComplete(), and writeToCube().

QToolButton* Qisis::EditTool::p_undoButton [private]

Undo button.

Definition at line 126 of file EditTool.h.

Referenced by createToolBarWidget(), redoEdit(), undoEdit(), updateTool(), and writeToCube().

QMap<CubeViewport *, QStack <Isis::Brick *> *> Qisis::EditTool::p_undoEdit [private]

Viewport to brick map for undo.

Definition at line 133 of file EditTool.h.

Referenced by redoEdit(), removeViewport(), save(), undoAll(), undoEdit(), updateTool(), and writeToCube().

QComboBox* Qisis::EditTool::p_valTypeComboBox [private]

Value type combobox.

Definition at line 124 of file EditTool.h.

Referenced by createToolBarWidget(), and mouseButtonRelease().


The documentation for this class was generated from the following files: