Isis 3 Programmer Reference
Isis::RubberBandTool Class Reference

Rubber banding tool. More...

#include <RubberBandTool.h>

Inheritance diagram for Isis::RubberBandTool:
Inheritance graph
Collaboration diagram for Isis::RubberBandTool:
Collaboration graph

Public Types

enum  RubberBandMode {
  AngleMode , CircleMode , EllipseMode , LineMode ,
  RectangleMode , RotatedRectangleMode , PolygonMode , SegmentedLineMode
}
 

Public Slots

void escapeKeyPress ()
 
void activate (bool)
 Activates the tool.
 
virtual void updateTool ()
 Updates the tool.
 
void setCubeViewport (MdiCubeViewport *cvp)
 Sets the current viewport to the given cvp.
 

Signals

void modeChanged ()
 
void bandingComplete ()
 
void measureChange ()
 
void clearWarningSignal ()
 
void toolActivated ()
 
void viewportChanged ()
 

Public Member Functions

 RubberBandTool (QWidget *parent=NULL)
 This is the constructor.
 
void enable (RubberBandMode mode, bool showIndicatorColors=false)
 This is called when changing modes or turning on.
 
void disable ()
 This is called when something is not using me, so turn off events, reset & repaint to clear the clear.
 
void setDrawActiveViewportOnly (bool activeOnly=false)
 This called to set whether rubber band is drawn on active viewport only rather than all linked viewports.
 
QList< QPoint > vertices ()
 This method returns the vertices.
 
RubberBandMode currentMode ()
 
double area ()
 
Angle angle ()
 
geos::geom::Geometry * geometry ()
 
QRect rectangle ()
 This method returns a rectangle from the vertices set by the RubberBandTool.
 
Qt::MouseButton mouseButton ()
 This method returns the mouse button modifier.
 
void paintViewport (MdiCubeViewport *vp, QPainter *painter)
 This is the main paint method for the rubber bands.
 
bool isValid ()
 This returns true if we can return complete & valid data.
 
bool figureComplete ()
 
bool figureValid ()
 
bool figureIsPoint ()
 
void enablePoints (unsigned int pixTolerance=2)
 
void enableAllClicks ()
 
void clear ()
 clears the rubber band!
 
void addTo (ViewportMainWindow *mw)
 Adds the tool to the application.
 
void addTo (ToolPad *toolpad)
 Adds the tool to the toolpad.
 
virtual void addTo (QMenu *menu)
 
virtual void addTo (Workspace *ws)
 Adds the given workspace to the cubeviewport list.
 
virtual QString menuName () const
 Anytime a tool is created, you must give it a name for the menu.
 
virtual void addToPermanent (QToolBar *toolbar)
 
void addToActive (QToolBar *toolbar)
 
QString toolIconDir () const
 returns the path to the icon directory.
 
RubberBandToolrubberBandTool ()
 
void setList (ToolList *currentList)
 

Protected Types

typedef QVector< MdiCubeViewport * > CubeViewportList
 A list of cubeviewports.
 

Protected Slots

void mouseMove (QPoint p, Qt::MouseButton)
 If tracking is not enabled, this does nothing.
 
void mouseDoubleClick (QPoint p)
 This triggers on a second mouse press.
 
void mouseButtonPress (QPoint p, Qt::MouseButton s)
 If the click is not the left mouse button, this does nothing.
 
void mouseButtonRelease (QPoint p, Qt::MouseButton s)
 If this is not the left mouse button, this does nothing.
 
virtual void rubberBandComplete ()
 
virtual void screenPixelsChanged ()
 This is called when actions change which pixels from the cube are displayed.
 
virtual void mouseEnter ()
 
virtual void mouseMove (QPoint p)
 
virtual void mouseLeave ()
 

Protected Member Functions

void enableRubberBandTool ()
 Anytime a tool is created, you may use the rubber band tool.
 
void scaleChanged ()
 
virtual void updateMeasure ()
 
virtual void stretchRequested (MdiCubeViewport *, int)
 
void registerTool (MdiCubeViewport *viewport)
 Registers the tool to the viewport.
 
MdiCubeViewportcubeViewport () const
 Return the current cubeviewport.
 
CubeViewportListcubeViewportList () const
 Return the list of cubeviewports.
 
virtual QActiontoolPadAction (ToolPad *toolpad)
 Anytime a tool is created, you must setup a tool pad action with it.
 
virtual QWidgetcreateToolBarWidget (QStackedWidget *parent)
 Anytime a tool is created, you must add it to the tool bar.
 
virtual void addConnections (MdiCubeViewport *cvp)
 Anytime a tool is created, you must add the connections for it.
 
virtual void removeConnections (MdiCubeViewport *cvp)
 Anytime a tool is created, you must be able to remove it's connections.
 
Workspaceworkspace ()
 

Private Member Functions

QPoint snapMouse (QPoint)
 moves the mouse's location p to the nearest axis
 
void repaint ()
 This method will call the viewport's repaint if there is a current cube viewport.
 
void paintVerticesConnected (QPainter *painter)
 This paints connecting lines to p_vertices.
 
void paintRectangle (QPoint upperLeft, QPoint lowerRight, QPainter *painter)
 Given opposite corners, the other two are interpolated and the rectangle is drawn.
 
void paintRectangle (QPoint upperLeft, QPoint upperRight, QPoint lowerLeft, QPoint lowerRight, QPainter *painter)
 This draws a box around the 4 points using the painter.
 
void calcRectCorners (QPoint corner1, QPoint corner2, QPoint &corner3, QPoint &corner4)
 Given two set corners, and the mouse location, this method will interpolate the last two corners.
 
void reset ()
 This initializes the class except for the current mode, which is set on enable.
 
void addViewportConnections ()
 Makes all the connections for the tool.
 
void removeViewportConnections ()
 Removes all the connections from the tool.
 
void enableToolBar ()
 Enables entire tool bar.
 
void disableToolBar ()
 Disables entire tool bar.
 

Private Attributes

bool p_mouseDown
 
bool p_doubleClicking
 
bool p_tracking
 
bool p_allClicks
 
bool p_drawActiveOnly
 
RubberBandMode p_bandingMode
 
QList< QPoint > * p_vertices
 
QPoint * p_mouseLoc
 
Qt::MouseButton p_mouseButton
 
bool p_indicatorColors
 
unsigned int p_pointTolerance
 
MdiCubeViewportm_cvp
 current cubeviewport
 
Workspacem_workspace
 
bool m_active
 Is the tool acitve?
 
QWidgetm_toolBarWidget
 The tool bar on which this tool resides.
 
QActionm_toolPadAction
 The tool pad on which this tool resides.
 
QString m_toolIconDir
 The pathway to the icon directory.
 
ToolListm_toolList
 

Detailed Description

Rubber banding tool.

Author
2007-09-11 Steven Lambright
History

2007-09-11 Steven Lambright Original version

2008-01-03 Steven Lambright bug fix on the polygons

2008-05-23 Noah Hilt added getRectangle method

2008-08-18 Steven Koechle updated to work with Geos 3.0.0

2008-09-26 Steven Lambright Added Segmented line

2010-05-24 Eric Hyer - Added clear() method

2010-06-03 Eric Hyer - Fixed bug in getInstance method

2010-06-26 Eric Hyer - Now uses MdiCubeViewport

2010-11-08 Eric Hyer - Added mouse snapping

2011-09-20 Steven Lambright - Segmented lines now have updates while the user is still drawing them instead of just a complete state.

2012-02-08 Tracie Sucharski - Added method to set drawing on the active viewport only.

2012-09-18 Steven Lambright - This is no longer a singleton, which prevented it from working with multiple workspaces. Brought method naming closer to current coding standards.

Definition at line 50 of file RubberBandTool.h.

Member Typedef Documentation

◆ CubeViewportList

typedef QVector< MdiCubeViewport * > Isis::Tool::CubeViewportList
protectedinherited

A list of cubeviewports.

Definition at line 205 of file Tool.h.

Member Enumeration Documentation

◆ RubberBandMode

enum Isis::RubberBandTool::RubberBandMode

Definition at line 57 of file RubberBandTool.h.

Constructor & Destructor Documentation

◆ RubberBandTool()

Isis::RubberBandTool::RubberBandTool ( QWidget * parent = NULL)

This is the constructor.

It's private because this class is a singleton.

Parameters
parent

Definition at line 34 of file RubberBandTool.cpp.

References Isis::Tool::activate(), and repaint().

◆ ~RubberBandTool()

Isis::RubberBandTool::~RubberBandTool ( )
virtual

Definition at line 47 of file RubberBandTool.cpp.

Member Function Documentation

◆ activate

◆ addConnections()

virtual void Isis::Tool::addConnections ( MdiCubeViewport * cvp)
inlineprotectedvirtualinherited

Anytime a tool is created, you must add the connections for it.

Parameters
cvp

Reimplemented in Isis::TrackTool, and Isis::WindowTool.

Definition at line 239 of file Tool.h.

Referenced by Isis::Tool::addViewportConnections().

◆ addTo() [1/4]

◆ addTo() [2/4]

void Isis::Tool::addTo ( ToolPad * toolpad)
inherited

Adds the tool to the toolpad.

Parameters
toolpad

Definition at line 98 of file Tool.cpp.

References Isis::Tool::activate(), Isis::Tool::m_toolPadAction, and Isis::Tool::toolPadAction().

◆ addTo() [3/4]

◆ addTo() [4/4]

void Isis::Tool::addTo ( Workspace * ws)
virtualinherited

Adds the given workspace to the cubeviewport list.

Parameters
ws

Reimplemented in Isis::EditTool, Isis::FileTool, Isis::SpecialPixelTool, and Isis::WindowTool.

Definition at line 45 of file Tool.cpp.

References Isis::Tool::registerTool(), and Isis::Tool::setCubeViewport().

◆ addToActive()

void Isis::Tool::addToActive ( QToolBar * toolbar)
inherited
Parameters
toolbar

Definition at line 112 of file Tool.cpp.

References Isis::Tool::createToolBarWidget(), Isis::Tool::disableToolBar(), and Isis::Tool::m_toolBarWidget.

Referenced by Isis::Tool::addTo().

◆ addToPermanent()

virtual void Isis::Tool::addToPermanent ( QToolBar * toolbar)
inlinevirtualinherited
Parameters
toolbar

Reimplemented in Isis::AdvancedTrackTool, Isis::BlinkTool, Isis::FileTool, Isis::HelpTool, Isis::SpecialPixelTool, and Isis::WindowTool.

Definition at line 97 of file Tool.h.

Referenced by Isis::Tool::addTo().

◆ addViewportConnections()

◆ angle()

Angle Isis::RubberBandTool::angle ( )

Definition at line 759 of file RubberBandTool.cpp.

◆ area()

double Isis::RubberBandTool::area ( )

Definition at line 1164 of file RubberBandTool.cpp.

◆ calcRectCorners()

void Isis::RubberBandTool::calcRectCorners ( QPoint corner1,
QPoint corner2,
QPoint & corner3,
QPoint & corner4 )
private

Given two set corners, and the mouse location, this method will interpolate the last two corners.

Parameters
corner1Known point
corner2Known point
corner3Guessed corner (point to interpolate to).
corner4Unknown corner.

Definition at line 189 of file RubberBandTool.cpp.

Referenced by paintViewport(), and vertices().

◆ clear()

void Isis::RubberBandTool::clear ( )

clears the rubber band!

Definition at line 1153 of file RubberBandTool.cpp.

References repaint(), and reset().

◆ createToolBarWidget()

virtual QWidget * Isis::Tool::createToolBarWidget ( QStackedWidget * parent)
inlineprotectedvirtualinherited

◆ cubeViewport()

MdiCubeViewport * Isis::Tool::cubeViewport ( ) const
inlineprotectedinherited

Return the current cubeviewport.

Returns
CubeViewport*

Definition at line 197 of file Tool.h.

References Isis::Tool::m_cvp.

Referenced by Isis::TrackTool::addConnections(), Isis::WindowTool::addConnections(), Isis::StretchTool::advancedStretchChanged(), Isis::FindTool::centerLinkedViewports(), Isis::StretchTool::changeStretch(), Isis::BandTool::changeView(), Isis::BandTool::copyLinkedViewports(), Isis::StretchTool::deleteFromCube(), Isis::FileTool::discard(), Isis::Tool::enableToolBar(), Isis::FileTool::exportToList(), Isis::FileTool::exportView(), Isis::StatisticsTool::getStatistics(), Isis::FindTool::handleRecordClicked(), Isis::EditTool::LineToPoints(), Isis::StretchTool::loadStretchFromCube(), Isis::TrackTool::locateCursor(), Isis::SunShadowTool::mouseButtonPress(), Isis::EditTool::mouseButtonRelease(), Isis::ControlNetTool::mouseButtonRelease(), Isis::FeatureNomenclatureTool::mouseButtonRelease(), Isis::FindTool::mouseButtonRelease(), Isis::MatchTool::mouseButtonRelease(), Isis::QnetTool::mouseButtonRelease(), mouseButtonRelease(), Isis::StretchTool::mouseButtonRelease(), Isis::AdvancedTrackTool::mouseLeave(), Isis::SunShadowTool::mouseMove(), Isis::TrackTool::mouseMove(), mouseMove(), Isis::ScatterPlotTool::mouseMove(), Isis::LatLonGridTool::paintViewport(), Isis::FindTool::paintViewport(), paintViewport(), Isis::SunShadowTool::paintViewport(), Isis::FileTool::print(), Isis::SunShadowTool::recalculateShadowHeight(), Isis::EditTool::redoEdit(), Isis::FindTool::refresh(), Isis::HistogramTool::refreshPlot(), Isis::SpatialPlotTool::refreshPlot(), Isis::SpectralPlotTool::refreshPlot(), Isis::TrackTool::removeConnections(), Isis::WindowTool::removeConnections(), repaint(), Isis::WindowTool::resizeWindows(), Isis::EditTool::rubberBandComplete(), Isis::HistogramTool::rubberBandComplete(), Isis::MeasureTool::rubberBandComplete(), Isis::StretchTool::rubberBandComplete(), Isis::ZoomTool::rubberBandComplete(), Isis::FileTool::save(), Isis::FileTool::saveAs(), Isis::FileTool::saveAsCubeByOption(), Isis::FileTool::saveAsReducedCube(), Isis::FileTool::saveInfo(), Isis::StretchTool::saveStretchToCube(), Isis::BandTool::setBandBin(), Isis::BandTool::setList(), Isis::StretchTool::setStretchAcrossBands(), Isis::StretchTool::setStretchAllViewports(), Isis::StretchTool::showAdvancedDialog(), Isis::ScatterPlotTool::showNewScatterPlotConfig(), Isis::StretchTool::stretchChanged(), Isis::StretchTool::stretchGlobal(), Isis::StretchTool::stretchGlobalAllBands(), Isis::StretchTool::stretchRegional(), Isis::EditTool::undoEdit(), Isis::StretchTool::updateAdvStretchDialogforAll(), Isis::StretchTool::updateHistograms(), Isis::TrackTool::updateLabels(), Isis::MeasureTool::updateMeasure(), Isis::AdvancedTrackTool::updateRow(), Isis::AdvancedTrackTool::updateRow(), Isis::AbstractPlotTool::updateTool(), Isis::BandTool::updateTool(), Isis::BlinkTool::updateTool(), Isis::EditTool::updateTool(), Isis::FileTool::updateTool(), Isis::FindTool::updateTool(), Isis::LatLonGridTool::updateTool(), Isis::SpecialPixelTool::updateTool(), Isis::StretchTool::updateTool(), Isis::SunShadowTool::updateTool(), Isis::WindowTool::updateTool(), Isis::ZoomTool::updateTool(), Isis::AbstractPlotTool::viewportsToPlot(), Isis::EditTool::writeToCube(), Isis::ZoomTool::zoomBy(), Isis::ZoomTool::zoomFit(), Isis::ZoomTool::zoomFitHeight(), Isis::ZoomTool::zoomFitWidth(), and Isis::ZoomTool::zoomManual().

◆ cubeViewportList()

Tool::CubeViewportList * Isis::Tool::cubeViewportList ( ) const
protectedinherited

Return the list of cubeviewports.

Returns
CubeViewportList*

Definition at line 390 of file Tool.cpp.

References Isis::Workspace::cubeViewportList().

Referenced by Isis::BlinkTool::advance(), Isis::SpecialPixelTool::apply(), Isis::FindTool::centerLinkedViewports(), Isis::WindowTool::changeCursor(), Isis::FileTool::closeAll(), Isis::BandTool::copyAllViewports(), Isis::BandTool::copyLinkedViewports(), Isis::MatchTool::createPoint(), Isis::BlinkTool::eventFilter(), Isis::FeatureNomenclatureTool::featuresIdentified(), Isis::FeatureNomenclatureTool::findMissingNomenclature(), Isis::FeatureNomenclatureTool::findNomenclatureStateChanged(), Isis::FindTool::handleLinkClicked(), Isis::WindowTool::linkWindows(), mouseButtonRelease(), mouseMove(), Isis::QnetTool::openGround(), Isis::ControlNetTool::paintAllViewports(), Isis::MatchTool::paintAllViewports(), Isis::StereoTool::paintAllViewports(), Isis::QnetTool::paintAllViewports(), Isis::FindTool::refresh(), Isis::AbstractPlotTool::repaintViewports(), Isis::ScatterPlotTool::repaintViewports(), Isis::AbstractPlotTool::repaintViewports(), Isis::WindowTool::resizeWindows(), Isis::BlinkTool::reverse(), Isis::ZoomTool::rubberBandComplete(), Isis::MatchTool::serialNumberList(), Isis::ControlNetTool::setControlNet(), Isis::FeatureNomenclatureTool::setFontColor(), Isis::FeatureNomenclatureTool::setFontSize(), Isis::FeatureNomenclatureTool::setShowApprovedOnly(), Isis::StretchTool::setStretchAllViewports(), Isis::FeatureNomenclatureTool::setVectorType(), Isis::StretchTool::stretchGlobalAllViewports(), Isis::BlinkTool::toggleLink(), Isis::WindowTool::unlinkWindows(), Isis::MeasureTool::updateMeasure(), Isis::AdvancedTrackTool::updateRow(), Isis::BlinkTool::updateTool(), Isis::FindTool::updateTool(), Isis::WindowTool::updateTool(), Isis::AbstractPlotTool::viewportsToPlot(), Isis::ZoomTool::zoomBy(), Isis::ZoomTool::zoomFit(), Isis::ZoomTool::zoomFitHeight(), Isis::ZoomTool::zoomFitWidth(), and Isis::ZoomTool::zoomManual().

◆ currentMode()

RubberBandTool::RubberBandMode Isis::RubberBandTool::currentMode ( )

Definition at line 1159 of file RubberBandTool.cpp.

◆ disable()

void Isis::RubberBandTool::disable ( )

This is called when something is not using me, so turn off events, reset & repaint to clear the clear.

Definition at line 321 of file RubberBandTool.cpp.

References Isis::Tool::activate(), repaint(), and reset().

Referenced by Isis::EditTool::enableRubberBandTool(), Isis::Tool::enableRubberBandTool(), and Isis::RubberBandComboBox::selectionChanged().

◆ disableToolBar()

void Isis::Tool::disableToolBar ( )
privateinherited

Disables entire tool bar.

Definition at line 285 of file Tool.cpp.

References Isis::Tool::m_toolBarWidget.

Referenced by Isis::Tool::activate(), and Isis::Tool::addToActive().

◆ enable()

void Isis::RubberBandTool::enable ( RubberBandMode mode,
bool showIndicatorColors = false )

◆ enableAllClicks()

void Isis::RubberBandTool::enableAllClicks ( )

Definition at line 1169 of file RubberBandTool.cpp.

◆ enablePoints()

void Isis::RubberBandTool::enablePoints ( unsigned int pixTolerance = 2)

Definition at line 1115 of file RubberBandTool.cpp.

◆ enableRubberBandTool()

void Isis::RubberBandTool::enableRubberBandTool ( )
inlineprotectedvirtual

Anytime a tool is created, you may use the rubber band tool.

Enable the use of the rubberband tool.

Reimplemented from Isis::Tool.

Definition at line 107 of file RubberBandTool.h.

◆ enableToolBar()

void Isis::Tool::enableToolBar ( )
privateinherited

Enables entire tool bar.

Definition at line 297 of file Tool.cpp.

References Isis::Tool::cubeViewport(), Isis::Tool::m_toolBarWidget, and Isis::Tool::updateTool().

Referenced by Isis::Tool::activate(), and Isis::Tool::setCubeViewport().

◆ escapeKeyPress

void Isis::RubberBandTool::escapeKeyPress ( )
slot

Definition at line 1174 of file RubberBandTool.cpp.

◆ figureComplete()

bool Isis::RubberBandTool::figureComplete ( )

Definition at line 1019 of file RubberBandTool.cpp.

◆ figureIsPoint()

bool Isis::RubberBandTool::figureIsPoint ( )

Definition at line 1119 of file RubberBandTool.cpp.

◆ figureValid()

bool Isis::RubberBandTool::figureValid ( )

Definition at line 1054 of file RubberBandTool.cpp.

◆ geometry()

geos::geom::Geometry * Isis::RubberBandTool::geometry ( )
Returns
geos::Geometry*

Definition at line 822 of file RubberBandTool.cpp.

References geometry(), and vertices().

Referenced by geometry(), Isis::HistogramTool::refreshPlot(), and Isis::MeasureTool::updateDist().

◆ isValid()

bool Isis::RubberBandTool::isValid ( )

This returns true if we can return complete & valid data.

Definition at line 1014 of file RubberBandTool.cpp.

◆ menuName()

virtual QString Isis::Tool::menuName ( ) const
inlinevirtualinherited

Anytime a tool is created, you must give it a name for the menu.

Returns
QString

Reimplemented in Isis::AdvancedTrackTool, Isis::BandTool, Isis::BlinkTool, Isis::FeatureNomenclatureTool, Isis::FileTool, Isis::FindTool, Isis::HelpTool, Isis::MeasureTool, Isis::PanTool, Isis::SpecialPixelTool, Isis::StretchTool, Isis::WindowTool, and Isis::ZoomTool.

Definition at line 83 of file Tool.h.

Referenced by Isis::Tool::addTo().

◆ mouseButton()

Qt::MouseButton Isis::RubberBandTool::mouseButton ( )

This method returns the mouse button modifier.

Returns
MouseButton Mouse button modifier on last release

Definition at line 1010 of file RubberBandTool.cpp.

Referenced by mouseMove(), and Isis::ZoomTool::rubberBandComplete().

◆ mouseButtonPress

void Isis::RubberBandTool::mouseButtonPress ( QPoint p,
Qt::MouseButton s )
protectedslot

If the click is not the left mouse button, this does nothing.

This will set mouseDown as true. When the calculations are complete, p_mouseDown is set to true.

For drag-only, A press means starting a new rubber band so reset & record the point. This applies to CircleModes, Eliipsoids, LineModes and RectangleModes.

For Rotated RectangleModes, A mount press means we're starting over, setting the first point, or completing. For the first two, simply reset and record the point. For the latter, figure out the corners and store those points.

For polygons, A press means record the current point. Reset first if we're not currently drawing.

Parameters
p
s

Definition at line 385 of file RubberBandTool.cpp.

References reset().

◆ mouseButtonRelease

void Isis::RubberBandTool::mouseButtonRelease ( QPoint p,
Qt::MouseButton s )
protectedslot

If this is not the left mouse button, this does nothing.

This will set mouseDown as false. When the calculations are complete, p_doubleClicking is set to false. The double click event occurs with `the press event so it's safe to set that flag here.

The implementation differs, based on the mode, as follows:

For angles, This signifies a click. We're always setting one of the three vertexes, but if there is an already complete vertex go ahead and reset first to start a new angle.

For circles, Since this is a drag-only rubber band, a release signifies a complete. Figure out the corner, based on the mouse location, and push it onto the back of the vertex list and emit a complete.

For EllipseModes, Since this is a drag-only rubber band, a release signifies a complete. We know the corner, it's the mouse loc, push it onto the back of the vertex list and emit a complete.

For lines, Since this is a drag-only rubber band, a release signifies a complete. We know the end point, push it onto the back of the vertex list and emit a complete.

For rectangles, Since this is a drag-only rubber band, a release signifies a complete. We know the opposite corner, figure out the others and push them onto the back of the vertex list and emit a complete.

For rotated rectangles, If we're finishing dragging the first side, store the end point.

For polygons, Do nothing, this is taken care of on press.

Parameters
pCurrent mouse Location
sWhich mouse button was released

Definition at line 474 of file RubberBandTool.cpp.

References Isis::Tool::cubeViewport(), Isis::Tool::cubeViewportList(), reset(), snapMouse(), and vertices().

◆ mouseDoubleClick

void Isis::RubberBandTool::mouseDoubleClick ( QPoint p)
protectedslot

This triggers on a second mouse press.

Only polygons care about this, and it signifies an end of shape. So, if we're in polygon mode, stop tracking the mouse and emit a complete.

Parameters
p

Definition at line 342 of file RubberBandTool.cpp.

References repaint().

◆ mouseEnter

virtual void Isis::Tool::mouseEnter ( )
inlineprotectedvirtualslotinherited

Definition at line 152 of file Tool.h.

◆ mouseLeave

virtual void Isis::Tool::mouseLeave ( )
inlineprotectedvirtualslotinherited

Definition at line 159 of file Tool.h.

◆ mouseMove [1/2]

void Isis::Tool::mouseMove ( QPoint p)
protectedvirtualslotinherited
Parameters
p

Definition at line 352 of file Tool.cpp.

Referenced by Isis::Tool::addViewportConnections(), and Isis::Tool::removeViewportConnections().

◆ mouseMove [2/2]

void Isis::RubberBandTool::mouseMove ( QPoint p,
Qt::MouseButton mouseButton )
protectedslot

If tracking is not enabled, this does nothing.

This will first update the mouse location for painting purposes.

Most of the implementation is a matter of emitting measureChanges: For angles, if the first two vertices are specified a measureChange will be emitted. For circles, if the center of the circle is known a measureChange will be emitted. For EllipseModes, if the center of the EllipseMode is known a measureChange will be emitted. For lines, if the first point of the line is known a measureChange will be emitted. For rectangles, if the starting point is known a measureChange will be emitted. For rotated rectangles, if the first side is specified a measureChange will be emitted.

However, there is one exception: For polygons, if the mouse button is pressed the mouse location is recorded as a valid vertex.

Parameters
pCurrent mouse Location

Definition at line 588 of file RubberBandTool.cpp.

References Isis::Tool::cubeViewport(), Isis::Tool::cubeViewportList(), mouseButton(), and snapMouse().

◆ paintRectangle() [1/2]

void Isis::RubberBandTool::paintRectangle ( QPoint upperLeft,
QPoint lowerRight,
QPainter * painter )
private

Given opposite corners, the other two are interpolated and the rectangle is drawn.

Parameters
upperLeftCorner opposite of lowerRight
lowerRightCorner opposite of upperLeft
painter

Definition at line 270 of file RubberBandTool.cpp.

References paintRectangle().

Referenced by paintRectangle(), and paintViewport().

◆ paintRectangle() [2/2]

void Isis::RubberBandTool::paintRectangle ( QPoint upperLeft,
QPoint upperRight,
QPoint lowerLeft,
QPoint lowerRight,
QPainter * painter )
private

This draws a box around the 4 points using the painter.

Parameters
upperLeftInitial corner
upperRightCorner connected to upperLeft, lowerRight
lowerLeftCorner connected to lowerRight, upperLeft
lowerRightCorner connected to lowerLeft, upperRight
painter

Definition at line 286 of file RubberBandTool.cpp.

◆ paintVerticesConnected()

void Isis::RubberBandTool::paintVerticesConnected ( QPainter * painter)
private

This paints connecting lines to p_vertices.

If tracking, a line is also drawn to the mouse location.

Parameters
painter

Definition at line 247 of file RubberBandTool.cpp.

Referenced by paintViewport().

◆ paintViewport()

void Isis::RubberBandTool::paintViewport ( MdiCubeViewport * vp,
QPainter * painter )
virtual

This is the main paint method for the rubber bands.

For angles and lines, simply connect the known vertices.vertices[0].x() For polygons, paint the vertices & close if completed the shape. For circles, figure out the circle's square and draw the circle inside of it. For EllipseModes, figure out the EllipseMode's rectangle and draw the circle inside of it. For rectangles, paint the rectangle either to the mouse or back to the start depending on if the shape is complete. For rotated rectangles, if we can interpolate extra sides draw them and draw all known sides.

Parameters
vp
painter

Reimplemented from Isis::Tool.

Definition at line 72 of file RubberBandTool.cpp.

References calcRectCorners(), Isis::Tool::cubeViewport(), Isis::MdiCubeViewport::isLinked(), paintRectangle(), paintVerticesConnected(), and vertices().

◆ rectangle()

QRect Isis::RubberBandTool::rectangle ( )

This method returns a rectangle from the vertices set by the RubberBandTool.

It calculates the upper left and bottom right points for the rectangle and properly initializes a QRect object with these vertices. If the RubberBandTool is in the incorrect mode, or the rectangle is not valid it will return an error message.

Returns
QRect The QRect the user selected on the viewport in pixels

Definition at line 964 of file RubberBandTool.cpp.

References vertices().

Referenced by Isis::EditTool::rubberBandComplete(), Isis::StretchTool::rubberBandComplete(), and Isis::ZoomTool::rubberBandComplete().

◆ registerTool()

void Isis::Tool::registerTool ( MdiCubeViewport * viewport)
protectedinherited

Registers the tool to the viewport.

Parameters
viewport

Definition at line 327 of file Tool.cpp.

References Isis::Tool::m_cvp, and Isis::MdiCubeViewport::registerTool().

Referenced by Isis::Tool::addTo().

◆ removeConnections()

virtual void Isis::Tool::removeConnections ( MdiCubeViewport * cvp)
inlineprotectedvirtualinherited

Anytime a tool is created, you must be able to remove it's connections.

Parameters
cvp

Reimplemented in Isis::MeasureTool, Isis::TrackTool, and Isis::WindowTool.

Definition at line 247 of file Tool.h.

Referenced by Isis::Tool::removeViewportConnections().

◆ removeViewportConnections()

void Isis::Tool::removeViewportConnections ( )
privateinherited

◆ repaint()

void Isis::RubberBandTool::repaint ( )
private

This method will call the viewport's repaint if there is a current cube viewport.

Definition at line 811 of file RubberBandTool.cpp.

References Isis::Tool::cubeViewport().

Referenced by clear(), disable(), mouseDoubleClick(), reset(), RubberBandTool(), and setDrawActiveViewportOnly().

◆ reset()

void Isis::RubberBandTool::reset ( )
private

This initializes the class except for the current mode, which is set on enable.

Definition at line 751 of file RubberBandTool.cpp.

References repaint().

Referenced by clear(), disable(), enable(), mouseButtonPress(), and mouseButtonRelease().

◆ rubberBandComplete

virtual void Isis::Tool::rubberBandComplete ( )
inlineprotectedvirtualslotinherited

Definition at line 141 of file Tool.h.

◆ rubberBandTool()

RubberBandTool * Isis::Tool::rubberBandTool ( )
inherited

Definition at line 57 of file Tool.cpp.

◆ scaleChanged()

void Isis::RubberBandTool::scaleChanged ( )
protectedvirtual

Reimplemented from Isis::Tool.

Definition at line 1179 of file RubberBandTool.cpp.

◆ screenPixelsChanged

virtual void Isis::Tool::screenPixelsChanged ( )
inlineprotectedvirtualslotinherited

This is called when actions change which pixels from the cube are displayed.

Definition at line 148 of file Tool.h.

Referenced by Isis::Tool::addViewportConnections(), Isis::Tool::removeViewportConnections(), and Isis::FeatureNomenclatureTool::viewportDone().

◆ setCubeViewport

void Isis::Tool::setCubeViewport ( MdiCubeViewport * cvp)
slotinherited

◆ setDrawActiveViewportOnly()

void Isis::RubberBandTool::setDrawActiveViewportOnly ( bool activeOnly = false)

◆ setList()

void Isis::Tool::setList ( ToolList * currentList)
inherited

Definition at line 68 of file Tool.cpp.

◆ snapMouse()

QPoint Isis::RubberBandTool::snapMouse ( QPoint p)
private

moves the mouse's location p to the nearest axis

Parameters
pThe mouse's current location
Returns
The snapped point

Definition at line 553 of file RubberBandTool.cpp.

Referenced by mouseButtonRelease(), and mouseMove().

◆ stretchRequested()

virtual void Isis::Tool::stretchRequested ( MdiCubeViewport * ,
int  )
inlineprotectedvirtualinherited

Reimplemented in Isis::StretchTool.

Definition at line 177 of file Tool.h.

◆ toolIconDir()

QString Isis::Tool::toolIconDir ( ) const
inlineinherited

◆ toolPadAction()

virtual QAction * Isis::Tool::toolPadAction ( ToolPad * toolpad)
inlineprotectedvirtualinherited

◆ updateMeasure()

virtual void Isis::Tool::updateMeasure ( )
inlineprotectedvirtualinherited

Definition at line 167 of file Tool.h.

◆ updateTool

◆ vertices()

QList< QPoint > Isis::RubberBandTool::vertices ( )

This method returns the vertices.

The return value is mode-specific, and the return will be consistent whether in a measureChange or bandingComplete slot.

The return values are always in pixels.

The return values are as follows: For angles, the return will always be of size 3. The elements at 0 and 2 are the edges of the angle, while the element at 1 is the vertex of the angle.

For circles, the return will always be of size 2. The element at 0 is the center of the circle, and the element at 1 is offset by the radius in both directions.

For EllipseModes, the return will always be of size 2. The element at 0 is the center of the circle, and the element at 1 is offset by the radius in both directions.

For lines, the return will always be of size 2. The elements are the start and end points.

For rectangles, the return will always be of size 4. The elements will be the corners, in either a clockwise or counter-clockwise direction.

For rotated rectangles, the same applies.

For polygons, the return will be a list of vertices in the order that the user drew them.

**It is NOT valid to call this unless you're in a measureChange or bandingComplete slot.

Returns
QList<QPoint>

Definition at line 671 of file RubberBandTool.cpp.

References calcRectCorners(), and vertices().

Referenced by geometry(), Isis::SpatialPlotTool::getSpatialStatistics(), Isis::SpectralPlotTool::getSpectralStatistics(), mouseButtonRelease(), paintViewport(), rectangle(), Isis::HistogramTool::refreshPlot(), Isis::SpatialPlotTool::refreshPlot(), Isis::SpectralPlotTool::refreshPlot(), Isis::ZoomTool::rubberBandComplete(), Isis::MeasureTool::updateDist(), and vertices().

◆ workspace()

Workspace * Isis::Tool::workspace ( )
protectedinherited

Definition at line 344 of file Tool.cpp.

Member Data Documentation

◆ m_active

bool Isis::Tool::m_active
privateinherited

Is the tool acitve?

Definition at line 264 of file Tool.h.

Referenced by Isis::Tool::activate(), Isis::Tool::setCubeViewport(), and Isis::Tool::Tool().

◆ m_cvp

◆ m_toolBarWidget

QWidget* Isis::Tool::m_toolBarWidget
privateinherited

The tool bar on which this tool resides.

Definition at line 265 of file Tool.h.

Referenced by Isis::Tool::addToActive(), Isis::Tool::disableToolBar(), Isis::Tool::enableToolBar(), and Isis::Tool::Tool().

◆ m_toolIconDir

QString Isis::Tool::m_toolIconDir
privateinherited

The pathway to the icon directory.

Definition at line 267 of file Tool.h.

Referenced by Isis::Tool::Tool(), and Isis::Tool::toolIconDir().

◆ m_toolList

ToolList* Isis::Tool::m_toolList
privateinherited

Definition at line 268 of file Tool.h.

◆ m_toolPadAction

QAction* Isis::Tool::m_toolPadAction
privateinherited

The tool pad on which this tool resides.

Definition at line 266 of file Tool.h.

Referenced by Isis::Tool::activate(), Isis::Tool::addTo(), Isis::Tool::addViewportConnections(), and Isis::Tool::Tool().

◆ m_workspace

Workspace* Isis::Tool::m_workspace
privateinherited

Definition at line 262 of file Tool.h.

◆ p_allClicks

bool Isis::RubberBandTool::p_allClicks
private

Definition at line 133 of file RubberBandTool.h.

◆ p_bandingMode

RubberBandMode Isis::RubberBandTool::p_bandingMode
private

Definition at line 135 of file RubberBandTool.h.

◆ p_doubleClicking

bool Isis::RubberBandTool::p_doubleClicking
private

Definition at line 131 of file RubberBandTool.h.

◆ p_drawActiveOnly

bool Isis::RubberBandTool::p_drawActiveOnly
private

Definition at line 134 of file RubberBandTool.h.

◆ p_indicatorColors

bool Isis::RubberBandTool::p_indicatorColors
private

Definition at line 139 of file RubberBandTool.h.

◆ p_mouseButton

Qt::MouseButton Isis::RubberBandTool::p_mouseButton
private

Definition at line 138 of file RubberBandTool.h.

◆ p_mouseDown

bool Isis::RubberBandTool::p_mouseDown
private

Definition at line 130 of file RubberBandTool.h.

◆ p_mouseLoc

QPoint* Isis::RubberBandTool::p_mouseLoc
private

Definition at line 137 of file RubberBandTool.h.

◆ p_pointTolerance

unsigned int Isis::RubberBandTool::p_pointTolerance
private

Definition at line 140 of file RubberBandTool.h.

◆ p_tracking

bool Isis::RubberBandTool::p_tracking
private

Definition at line 132 of file RubberBandTool.h.

◆ p_vertices

QList<QPoint>* Isis::RubberBandTool::p_vertices
private

Definition at line 136 of file RubberBandTool.h.


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