|
Isis 3.0 Object Programmers' Reference |
Home |
Rubber banding tool. More...
#include <RubberBandTool.h>


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 RubberBandTool * | getInstance (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 () |
| MdiCubeViewport * | cubeViewport () const |
| Return the current cubeviewport. | |
| CubeViewportList * | cubeViewportList () const |
| Return the list of cubeviewports. | |
| virtual QAction * | toolPadAction (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 QWidget * | createToolBarWidget (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 | |
| MdiCubeViewport * | p_cvp |
| current cubeviewport | |
| Workspace * | p_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 RubberBandTool * | p_instance = NULL |
Rubber banding tool.
For internal use only.
Definition at line 44 of file RubberBandTool.h.
typedef QVector< MdiCubeViewport * > Isis::Tool::CubeViewportList [protected, inherited] |
| Isis::RubberBandTool::RubberBandTool | ( | QWidget * | parent | ) | [private] |
This is the constructor.
It's private because this class is a singleton.
| parent |
Definition at line 61 of file RubberBandTool.cpp.
References Isis::Tool::activate(), and repaint().
Referenced by getInstance().
| void Tool::activate | ( | bool | on | ) | [slot, inherited] |
Activates the tool.
| on |
Definition at line 110 of file Tool.cpp.
References Isis::Tool::addViewportConnections(), Isis::Tool::disableToolBar(), Isis::Tool::enableToolBar(), Isis::Tool::p_active, Isis::Tool::p_toolPadAction, and Isis::Tool::removeViewportConnections().
Referenced by Isis::Tool::addTo(), Isis::AdvancedTrackTool::AdvancedTrackTool(), disableBanding(), enableBanding(), Isis::AdvancedTrackTool::eventFilter(), Isis::FileTool::FileTool(), RubberBandTool(), Isis::TrackTool::TrackTool(), and Isis::WindowTool::WindowTool().
| virtual void Isis::Tool::addConnections | ( | MdiCubeViewport * | cvp | ) | [inline, protected, virtual, inherited] |
Anytime a tool is created, you must add the connections for it.
| 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.
| 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] |
requires the programmer to have this member
| menu |
Reimplemented in Isis::AdvancedTrackTool, Isis::BlinkTool, Isis::FeatureNomenclatureTool, Isis::FileTool, Isis::FindTool, Isis::HelpTool, Isis::MeasureTool, Isis::PanTool, Isis::SpecialPixelTool, Isis::SpectralPlotTool, Isis::StretchTool, Isis::SunShadowTool, Isis::WindowTool, and Isis::ZoomTool.
| void Tool::addTo | ( | ToolPad * | toolpad | ) | [inherited] |
Adds the tool to the toolpad.
| 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] |
Adds the tool to the application.
| pViewPortMnWin |
Definition at line 57 of file Tool.cpp.
References Isis::ViewportMainWindow::activeToolBar(), Isis::Tool::addToActive(), Isis::Tool::addToPermanent(), Isis::ViewportMainWindow::getMenu(), Isis::Tool::menuName(), Isis::ViewportMainWindow::permanentToolBar(), Isis::ViewportMainWindow::toolPad(), and Isis::ViewportMainWindow::workspace().
Referenced by Isis::ViewportMainWindow::ViewportMainWindow().
| void Tool::addToActive | ( | QToolBar * | toolbar | ) | [inherited] |
| toolbar |
Definition at line 91 of file Tool.cpp.
References Isis::Tool::createToolBarWidget(), Isis::Tool::disableToolBar(), Isis::Tool::p_activeToolBarStack, and Isis::Tool::p_toolBarWidget.
Referenced by Isis::Tool::addTo().
| virtual void Isis::Tool::addToPermanent | ( | QToolBar * | toolbar | ) | [inline, virtual, inherited] |
requires the programmer to have this member
| 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.
| 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] |
Anytime a tool is created, you must add it to the tool bar.
| parent |
Reimplemented in Isis::AbstractPlotTool, Isis::BandTool, Isis::EditTool, Isis::FeatureNomenclatureTool, Isis::FindTool, Isis::HistogramTool, Isis::MatchTool, Isis::MeasureTool, Isis::PanTool, Isis::ScatterPlotTool, Isis::SpatialPlotTool, Isis::SpectralPlotTool, Isis::StatisticsTool, Isis::StereoTool, Isis::StretchTool, Isis::SunShadowTool, and Isis::ZoomTool.
Definition at line 248 of file Tool.h.
Referenced by Isis::Tool::addToActive().
| MdiCubeViewport* Isis::Tool::cubeViewport | ( | ) | const [inline, protected, inherited] |
Return the current 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.
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.
| 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.
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 | ( | ) |
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.
| parent | A pointer to the main window for the tool to properly initialize |
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.
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.
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.
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.
| 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.
| 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.
| p |
Reimplemented from Isis::Tool.
Definition at line 368 of file RubberBandTool.cpp.
References repaint().
| void Tool::mouseMove | ( | QPoint | p | ) | [protected, virtual, slot, inherited] |
| p |
Reimplemented in Isis::AdvancedTrackTool, Isis::PanTool, Isis::SunShadowTool, and Isis::TrackTool.
Definition at line 319 of file Tool.cpp.
Referenced by Isis::Tool::addViewportConnections(), and Isis::Tool::removeViewportConnections().
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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] |
Sets the current viewport to the given cvp.
| cvp |
Definition at line 139 of file Tool.cpp.
References Isis::Tool::addViewportConnections(), Isis::Tool::enableToolBar(), Isis::Tool::p_active, Isis::Tool::p_cvp, Isis::Tool::removeViewportConnections(), and Isis::Tool::updateTool().
Referenced by Isis::Tool::addTo(), and Isis::FileTool::closeAll().
| 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
| p | The mouse's current location |
Definition at line 579 of file RubberBandTool.cpp.
Referenced by mouseButtonRelease(), and mouseMove().
| QString Isis::Tool::toolIconDir | ( | ) | const [inline, inherited] |
returns the path to the icon directory.
Definition at line 121 of file Tool.h.
References Isis::Tool::p_toolIconDir.
Referenced by Isis::AdvancedTrackTool::AdvancedTrackTool(), Isis::BlinkTool::BlinkTool(), Isis::StereoTool::createMenus(), Isis::ZoomTool::createToolBarWidget(), Isis::StretchTool::createToolBarWidget(), Isis::StereoTool::createToolBarWidget(), Isis::PanTool::createToolBarWidget(), Isis::MatchTool::createToolBarWidget(), Isis::FindTool::createToolBarWidget(), Isis::EditTool::createToolBarWidget(), Isis::BandTool::createToolBarWidget(), Isis::FileTool::FileTool(), Isis::FindTool::FindTool(), Isis::HistogramTool::HistogramTool(), Isis::SpatialPlotTool::SpatialPlotTool(), Isis::SpecialPixelTool::SpecialPixelTool(), Isis::SpectralPlotTool::SpectralPlotTool(), Isis::RubberBandComboBox::toolIconDir(), Isis::ZoomTool::toolPadAction(), Isis::SunShadowTool::toolPadAction(), Isis::StretchTool::toolPadAction(), Isis::StereoTool::toolPadAction(), Isis::StatisticsTool::toolPadAction(), Isis::ScatterPlotTool::toolPadAction(), Isis::PanTool::toolPadAction(), Isis::MeasureTool::toolPadAction(), Isis::MatchTool::toolPadAction(), Isis::HistogramTool::toolPadAction(), Isis::FindTool::toolPadAction(), Isis::FeatureNomenclatureTool::toolPadAction(), Isis::EditTool::toolPadAction(), Isis::BandTool::toolPadAction(), Isis::WindowTool::WindowTool(), and Isis::ZoomTool::ZoomTool().
| virtual QAction* Isis::Tool::toolPadAction | ( | ToolPad * | toolpad | ) | [inline, protected, virtual, inherited] |
Anytime a tool is created, you must setup a tool pad action with it.
| toolpad |
Reimplemented in Isis::BandTool, Isis::EditTool, Isis::FeatureNomenclatureTool, Isis::FindTool, Isis::HistogramTool, Isis::MatchTool, Isis::MeasureTool, Isis::PanTool, Isis::ScatterPlotTool, Isis::SpatialPlotTool, Isis::SpectralPlotTool, Isis::StatisticsTool, Isis::StereoTool, Isis::StretchTool, Isis::SunShadowTool, and Isis::ZoomTool.
Definition at line 225 of file Tool.h.
Referenced by Isis::Tool::addTo().
| void Tool::updateTool | ( | ) | [virtual, slot, inherited] |
Updates the tool.
Reimplemented in Isis::AbstractPlotTool, Isis::BandTool, Isis::BlinkTool, Isis::EditTool, Isis::FeatureNomenclatureTool, Isis::FileTool, Isis::FindTool, Isis::HistogramTool, Isis::MeasureTool, Isis::SpatialPlotTool, Isis::SpecialPixelTool, Isis::SpectralPlotTool, Isis::StretchTool, Isis::SunShadowTool, Isis::WindowTool, and Isis::ZoomTool.
Definition at line 290 of file Tool.cpp.
Referenced by Isis::Tool::enableToolBar(), and Isis::Tool::setCubeViewport().
MdiCubeViewport* Isis::Tool::p_cvp [protected, inherited] |
current cubeviewport
Definition at line 272 of file Tool.h.
Referenced by Isis::Tool::addViewportConnections(), Isis::Tool::cubeViewport(), Isis::Tool::registerTool(), Isis::Tool::removeViewportConnections(), repaint(), Isis::MeasureTool::rubberBandComplete(), Isis::Tool::setCubeViewport(), and Isis::Tool::Tool().