USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::RubberBandTool Class Reference

Rubber banding tool. More...

#include <RubberBandTool.h>

Inheritance diagram for Isis::RubberBandTool:
Inheritance graph
[legend]
Collaboration diagram for Isis::RubberBandTool:
Collaboration graph
[legend]

List of all members.

Public Types

enum  RubberBandMode {
  Angle, Circle, Ellipse, Line,
  Rectangle, RotatedRectangle, Polygon, SegmentedLine
}

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

void enableBanding (RubberBandMode mode, bool showIndicatorColors=false)
 This is called when changing modes or turning on.
void disableBanding ()
 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 > getFoundVertices ()
 This method returns the vertices.
RubberBandMode getCurrentMode ()
double getAreaMeasure ()
double getAngleMeasure ()
geos::geom::Geometry * getGeometry ()
QRect getRectangle ()
 This method returns a rectangle from the vertices set by the RubberBandTool.
Qt::MouseButton getMouseButton ()
 This method returns the mouse button modifier.
void paintViewport (MdiCubeViewport *vp, QPainter *painter)
 This is the main paint method for the rubber bands.
bool figureComplete ()
bool figureValid ()
bool figureIsPoint ()
void enablePoints (unsigned int pixTolerance=2)
void enableAllClicks ()
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)
 requires the programmer to have this member
virtual void addTo (Workspace *ws)
 requires the programmer to have this member
virtual void addToPermanent (QToolBar *toolbar)
 requires the programmer to have this member
void addToActive (QToolBar *toolbar)
QString toolIconDir () const
 returns the path to the icon directory.

Static Public Member Functions

static RubberBandToolgetInstance (QWidget *parent=NULL)
 This method returns the singleton instance of the rubber band tool.
static void enable (RubberBandMode mode, bool showIndicatorColors=false)
static void disable ()
static void drawActiveViewportOnly (bool activeOnly=false)
static QList< QPoint > getVertices ()
static RubberBandMode getMode ()
static double getArea ()
static double getAngle ()
static geos::geom::Geometry * geometry ()
static QRect rectangle ()
static Qt::MouseButton mouseButton ()
static bool isValid ()
static bool isPoint ()
static void allowPoints (unsigned int pixTolerance=2)
static void allowAllClicks ()
static void clear ()
 clears the rubber band!

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 ()
virtual void updateMeasure ()
virtual void stretchRequested (MdiCubeViewport *, int)
void registerTool (MdiCubeViewport *viewport)
 Registers the tool to the viewport.

Protected Member Functions

void enableRubberBandTool ()
 Anytime a tool is created, you may use the rubber band tool.
void scaleChanged ()
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 QString menuName () const
 Anytime a tool is created, you must give it a name for the menu.
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.

Protected Attributes

MdiCubeViewportp_cvp
 current cubeviewport
Workspacep_workspace

Private Member Functions

QPoint snapMouse (QPoint)
 moves the mouse's location p to the nearest axis
 RubberBandTool (QWidget *parent)
 This is the constructor.
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.

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

Static Private Attributes

static RubberBandToolp_instance = NULL

Detailed Description

Rubber banding tool.

Author:
2007-09-11 Steven Lambright

For internal use only.

History:
2007-09-11 Steven Lambright Original version
History:
2008-01-03 Steven Lambright bug fix on the polygons
History:
2008-05-23 Noah Hilt added getRectangle method
History:
2008-08-18 Steven Koechle updated to work with Geos 3.0.0
History:
2008-09-26 Steven Lambright Added Segmented line
History:
2010-05-24 Eric Hyer - Added clear() method
History:
2010-06-03 Eric Hyer - Fixed bug in getInstance method
History:
2010-06-26 Eric Hyer - Now uses MdiCubeViewport
History:
2010-11-08 Eric Hyer - Added mouse snapping
History:
2011-09-20 Steven Lambright - Segmented lines now have updates while the user is still drawing them instead of just a complete state.
History:
2012-02-08 Tracie Sucharski - Added method to set drawing on the active viewport only.

Definition at line 44 of file RubberBandTool.h.


Member Typedef Documentation

typedef QVector< MdiCubeViewport * > Isis::Tool::CubeViewportList [protected, inherited]

A list of cubeviewports.

Definition at line 207 of file Tool.h.


Constructor & Destructor Documentation

Isis::RubberBandTool::RubberBandTool ( QWidget parent  )  [private]

This is the constructor.

It's private because this class is a singleton.

Parameters:
parent 

Definition at line 61 of file RubberBandTool.cpp.

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

Referenced by getInstance().


Member Function Documentation

void Tool::activate ( bool  on  )  [slot, inherited]
virtual void Isis::Tool::addConnections ( MdiCubeViewport cvp  )  [inline, protected, virtual, inherited]

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

Parameters:
cvp 

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

Definition at line 258 of file Tool.h.

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

void Tool::addTo ( Workspace ws  )  [virtual, inherited]

requires the programmer to have this member

Adds the given workspace to the cubeviewport list.

Parameters:
ws 

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

Definition at line 41 of file Tool.cpp.

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

virtual void Isis::Tool::addTo ( QMenu *  menu  )  [inline, virtual, inherited]
void Tool::addTo ( ToolPad toolpad  )  [inherited]

Adds the tool to the toolpad.

Parameters:
toolpad 

Definition at line 77 of file Tool.cpp.

References Isis::Tool::activate(), Isis::ToolPad::addAction(), Isis::Tool::p_toolPadAction, and Isis::Tool::toolPadAction().

void Tool::addTo ( ViewportMainWindow pViewPortMnWin  )  [inherited]
void Tool::addToActive ( QToolBar toolbar  )  [inherited]
virtual void Isis::Tool::addToPermanent ( QToolBar toolbar  )  [inline, virtual, inherited]

requires the programmer to have this member

Parameters:
toolbar 

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

Definition at line 103 of file Tool.h.

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

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:
corner1 Known point
corner2 Known point
corner3 Guessed corner (point to interpolate to).
corner4 Unknown corner.

Definition at line 215 of file RubberBandTool.cpp.

Referenced by getFoundVertices(), and paintViewport().

void Isis::RubberBandTool::clear (  )  [static]

clears the rubber band!

Definition at line 1173 of file RubberBandTool.cpp.

References getInstance(), repaint(), and reset().

virtual QWidget* Isis::Tool::createToolBarWidget ( QStackedWidget *  parent  )  [inline, protected, virtual, inherited]
MdiCubeViewport* Isis::Tool::cubeViewport (  )  const [inline, protected, inherited]

Return the current cubeviewport.

Returns:
CubeViewport*

Definition at line 205 of file Tool.h.

References Isis::Tool::p_cvp.

Referenced by Isis::WindowTool::addConnections(), Isis::TrackTool::addConnections(), Isis::StretchTool::advancedStretchChanged(), Isis::FindTool::centerLinkedViewports(), Isis::StretchTool::changeStretch(), Isis::BandTool::changeView(), Isis::BandTool::copyLinkedViewports(), Isis::FileTool::discard(), Isis::Tool::enableToolBar(), Isis::FileTool::exportView(), Isis::StatisticsTool::getStatistics(), Isis::FindTool::handleRecordClicked(), Isis::EditTool::LineToPoints(), Isis::TrackTool::locateCursor(), Isis::SunShadowTool::mouseButtonPress(), Isis::StretchTool::mouseButtonRelease(), mouseButtonRelease(), Isis::PanTool::mouseButtonRelease(), Isis::MatchTool::mouseButtonRelease(), Isis::FindTool::mouseButtonRelease(), Isis::FeatureNomenclatureTool::mouseButtonRelease(), Isis::EditTool::mouseButtonRelease(), Isis::AdvancedTrackTool::mouseLeave(), Isis::TrackTool::mouseMove(), Isis::SunShadowTool::mouseMove(), Isis::ScatterPlotTool::mouseMove(), mouseMove(), Isis::SunShadowTool::paintViewport(), paintViewport(), Isis::FindTool::paintViewport(), Isis::FileTool::print(), Isis::SunShadowTool::recalculateShadowHeight(), Isis::EditTool::redoEdit(), Isis::FindTool::refresh(), Isis::SpectralPlotTool::refreshPlot(), Isis::SpatialPlotTool::refreshPlot(), Isis::HistogramTool::refreshPlot(), Isis::WindowTool::removeConnections(), Isis::TrackTool::removeConnections(), Isis::WindowTool::resizeWindows(), Isis::ZoomTool::rubberBandComplete(), Isis::StretchTool::rubberBandComplete(), Isis::HistogramTool::rubberBandComplete(), Isis::EditTool::rubberBandComplete(), Isis::FileTool::save(), Isis::FileTool::saveAs(), Isis::FileTool::saveAsCubeByOption(), Isis::FileTool::saveAsReducedCube(), Isis::FileTool::saveInfo(), 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::ZoomTool::updateTool(), Isis::WindowTool::updateTool(), Isis::SunShadowTool::updateTool(), Isis::StretchTool::updateTool(), Isis::SpecialPixelTool::updateTool(), Isis::FindTool::updateTool(), Isis::FileTool::updateTool(), Isis::EditTool::updateTool(), Isis::BlinkTool::updateTool(), Isis::BandTool::updateTool(), Isis::AbstractPlotTool::updateTool(), Isis::AbstractPlotTool::viewportsToPlot(), Isis::EditTool::writeToCube(), Isis::ZoomTool::zoomBy(), Isis::ZoomTool::zoomFit(), Isis::ZoomTool::zoomFitHeight(), Isis::ZoomTool::zoomFitWidth(), and Isis::ZoomTool::zoomManual().

Tool::CubeViewportList * Tool::cubeViewportList (  )  const [protected, inherited]

Return the list of cubeviewports.

Returns:
CubeViewportList*

Definition at line 357 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(), Isis::PanTool::mouseButtonRelease(), mouseMove(), Isis::StereoTool::paintAllViewports(), Isis::MatchTool::paintAllViewports(), Isis::FindTool::refresh(), Isis::ScatterPlotTool::repaintViewports(), Isis::AbstractPlotTool::repaintViewports(), Isis::WindowTool::resizeWindows(), Isis::BlinkTool::reverse(), Isis::ZoomTool::rubberBandComplete(), Isis::MatchTool::serialNumberList(), 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::WindowTool::updateTool(), Isis::FindTool::updateTool(), Isis::BlinkTool::updateTool(), Isis::AbstractPlotTool::viewportsToPlot(), Isis::ZoomTool::zoomBy(), Isis::ZoomTool::zoomFit(), Isis::ZoomTool::zoomFitHeight(), Isis::ZoomTool::zoomFitWidth(), and Isis::ZoomTool::zoomManual().

void Isis::RubberBandTool::disableBanding (  ) 

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

Definition at line 347 of file RubberBandTool.cpp.

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

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

This is called when changing modes or turning on.

So, set the mode, reset, and activate our event handlers.

Parameters:
mode 
showIndicatorColors Color the first side of figures differently

Definition at line 327 of file RubberBandTool.cpp.

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

void Isis::RubberBandTool::enableRubberBandTool (  )  [inline, protected, virtual]

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 113 of file RubberBandTool.h.

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

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 Ellipses, 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 697 of file RubberBandTool.cpp.

References calcRectCorners(), x, and y.

Referenced by getGeometry(), getRectangle(), mouseButtonRelease(), and paintViewport().

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

Definition at line 846 of file RubberBandTool.cpp.

References a, getFoundVertices(), line, x, and y.

RubberBandTool * Isis::RubberBandTool::getInstance ( QWidget parent = NULL  )  [static]

This method returns the singleton instance of the rubber band tool.

The first call to this method must have the optional argument *parent so the tool can properly initialize. After this tool is created, *parent is ignored.

Parameters:
parent A pointer to the main window for the tool to properly initialize
Returns:
RubberBandTool* An instance of the rubber band tool

Definition at line 40 of file RubberBandTool.cpp.

References RubberBandTool().

Referenced by Isis::Tool::addViewportConnections(), clear(), Isis::MeasureTool::createToolBarWidget(), Isis::Tool::removeViewportConnections(), Isis::RubberBandComboBox::RubberBandComboBox(), and Isis::RubberBandComboBox::toolIconDir().

Qt::MouseButton Isis::RubberBandTool::getMouseButton (  ) 

This method returns the mouse button modifier.

Returns:
MouseButton Mouse button modifier on last release

Definition at line 1035 of file RubberBandTool.cpp.

QRect Isis::RubberBandTool::getRectangle (  ) 

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 989 of file RubberBandTool.cpp.

References getFoundVertices(), x, and y.

virtual QString Isis::Tool::menuName (  )  const [inline, protected, virtual, inherited]

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 236 of file Tool.h.

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

void Isis::RubberBandTool::mouseButtonPress ( QPoint  p,
Qt::MouseButton  s 
) [protected, virtual, slot]

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 Circles, Eliipsoids, Lines and Rectangles.

For Rotated Rectangles, 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 

Reimplemented from Isis::Tool.

Definition at line 411 of file RubberBandTool.cpp.

References reset().

void Isis::RubberBandTool::mouseButtonRelease ( QPoint  p,
Qt::MouseButton  s 
) [protected, virtual, slot]

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 Ellipses, 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:
p Current mouse Location
s Which mouse button was released

Reimplemented from Isis::Tool.

Definition at line 500 of file RubberBandTool.cpp.

References Isis::Tool::cubeViewport(), Isis::Tool::cubeViewportList(), getFoundVertices(), Isis::MdiCubeViewport::isLinked(), reset(), and snapMouse().

void Isis::RubberBandTool::mouseDoubleClick ( QPoint  p  )  [protected, virtual, slot]

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 

Reimplemented from Isis::Tool.

Definition at line 368 of file RubberBandTool.cpp.

References repaint().

void Tool::mouseMove ( QPoint  p  )  [protected, virtual, slot, inherited]
void Isis::RubberBandTool::mouseMove ( QPoint  p,
Qt::MouseButton  mouseButton 
) [protected, virtual, slot]

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 Ellipses, if the center of the Ellipse 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:
p Current mouse Location

Reimplemented from Isis::Tool.

Definition at line 614 of file RubberBandTool.cpp.

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

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:
upperLeft Initial corner
upperRight Corner connected to upperLeft, lowerRight
lowerLeft Corner connected to lowerRight, upperLeft
lowerRight Corner connected to lowerLeft, upperRight
painter 

Definition at line 312 of file RubberBandTool.cpp.

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:
upperLeft Corner opposite of lowerRight
lowerRight Corner opposite of upperLeft
painter 

Definition at line 296 of file RubberBandTool.cpp.

Referenced by paintViewport().

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 273 of file RubberBandTool.cpp.

Referenced by 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 Ellipses, figure out the Ellipse'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 98 of file RubberBandTool.cpp.

References calcRectCorners(), Isis::Tool::cubeViewport(), getFoundVertices(), Isis::MdiCubeViewport::isLinked(), paintRectangle(), paintVerticesConnected(), x, and y.

void Tool::registerTool ( MdiCubeViewport viewport  )  [protected, slot, inherited]

Registers the tool to the viewport.

Parameters:
viewport 

Definition at line 299 of file Tool.cpp.

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

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

virtual void Isis::Tool::removeConnections ( MdiCubeViewport cvp  )  [inline, protected, virtual, inherited]

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 266 of file Tool.h.

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

void Isis::RubberBandTool::repaint (  )  [private]

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

Definition at line 835 of file RubberBandTool.cpp.

References Isis::Tool::p_cvp.

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

void Isis::RubberBandTool::reset (  )  [private]

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

Definition at line 777 of file RubberBandTool.cpp.

References repaint().

Referenced by clear(), disableBanding(), enableBanding(), mouseButtonPress(), and mouseButtonRelease().

virtual void Isis::Tool::screenPixelsChanged (  )  [inline, protected, virtual, slot, inherited]

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

Reimplemented in Isis::StretchTool.

Definition at line 156 of file Tool.h.

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

void Tool::setCubeViewport ( MdiCubeViewport cvp  )  [slot, inherited]
void Isis::RubberBandTool::setDrawActiveViewportOnly ( bool  activeOnly = false  ) 

This called to set whether rubber band is drawn on active viewport only rather than all linked viewports.

Definition at line 358 of file RubberBandTool.cpp.

References repaint().

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

moves the mouse's location p to the nearest axis

Parameters:
p The mouse's current location
Returns:
The snapped point

Definition at line 579 of file RubberBandTool.cpp.

Referenced by mouseButtonRelease(), and mouseMove().

QString Isis::Tool::toolIconDir (  )  const [inline, inherited]
virtual QAction* Isis::Tool::toolPadAction ( ToolPad toolpad  )  [inline, protected, virtual, inherited]
void Tool::updateTool (  )  [virtual, slot, inherited]

Member Data Documentation

MdiCubeViewport* Isis::Tool::p_cvp [protected, inherited]

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