File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis Developer Reference
RubberBandTool.h
Go to the documentation of this file.
1 #ifndef RubberBandTool_h
2 #define RubberBandTool_h
3 
4 #include "Tool.h"
5 
6 #include <QPointer>
7 
8 class QRect;
9 class QPoint;
10 
11 template <typename A> class QList;
12 
13 namespace geos {
14  namespace geom {
15  class Geometry;
16  }
17 }
18 
19 
20 namespace Isis {
21  class Angle;
22  class MdiCubeViewport;
23 
50  class RubberBandTool : public Tool {
51  Q_OBJECT
52 
53  public:
54  RubberBandTool(QWidget *parent = NULL);
55  virtual ~RubberBandTool();
56 
58  AngleMode, //<! Measure an angle
59  CircleMode, //<! Draw a perfect circle
60  EllipseMode, //<! Draw an ellipse (oval)
61  LineMode, //<! Draw a simple line
62  RectangleMode, //<! Draw a rectangle without any rotation (perfectly horizonal/verticle)
63  RotatedRectangleMode, //<! Draw a rotatable rectangle
64  PolygonMode, //<! Draw any closed shape
65  SegmentedLineMode //<! Draw any open shape
66  };
67 
68  void enable(RubberBandMode mode, bool showIndicatorColors = false);
69 
70  void disable();
71 
72  void setDrawActiveViewportOnly(bool activeOnly = false);
73 
75 
77  double area();
78  Angle angle();
79 
80  geos::geom::Geometry *geometry();
81  QRect rectangle();
82  Qt::MouseButton mouseButton();
83 
84  void paintViewport(MdiCubeViewport *vp, QPainter *painter);
85 
87  bool isValid();
88  bool figureComplete();
89  bool figureValid();
90 
91  bool figureIsPoint();
92 
93  void enablePoints(unsigned int pixTolerance = 2);
94  void enableAllClicks();
95 
96  void clear();
97 
98  public slots:
99  void escapeKeyPress();
100 
101  signals:
102  void modeChanged();
105 
106  protected:
108  void scaleChanged();
109 
110  protected slots:
111  void mouseMove(QPoint p, Qt::MouseButton);
112  void mouseDoubleClick(QPoint p);
113  void mouseButtonPress(QPoint p, Qt::MouseButton s);
114  void mouseButtonRelease(QPoint p, Qt::MouseButton s);
115 
116  private:
117  QPoint snapMouse(QPoint);
118 
119  void repaint();
120  void paintVerticesConnected(QPainter *painter);
121  void paintRectangle(QPoint upperLeft, QPoint lowerRight, QPainter *painter);
122  void paintRectangle(QPoint upperLeft, QPoint upperRight,
123  QPoint lowerLeft, QPoint lowerRight, QPainter *painter);
124 
125  // This is used for rotated rectangle
126  void calcRectCorners(QPoint corner1, QPoint corner2, QPoint &corner3, QPoint &corner4);
127 
128  void reset(); //<! This resets the member variables
129 
130  bool p_mouseDown; //<! True if the mouse is pressed
131  bool p_doubleClicking; //<! True if on second click of a double click
132  bool p_tracking; //<! True if painting on mouse move
133  bool p_allClicks; //<! Enables all mouse buttons for banding
134  bool p_drawActiveOnly; //<! True if draw on active viewport only
135  RubberBandMode p_bandingMode; //<! Current type of rubber band
136  QList<QPoint> * p_vertices; //<! Known vertices pertaining to the current rubber band
137  QPoint *p_mouseLoc; //<! Current mouse location, only valid of p_tracking
138  Qt::MouseButton p_mouseButton; //<! Last mouse button status
139  bool p_indicatorColors; //<! Color the first side of objects a different color, if it's significant
140  unsigned int p_pointTolerance; //<! Tolerance for points (zero for no points)
141  };
142 };
143 
144 #endif
145 
Isis::MdiCubeViewport
Cube display widget for certain Isis MDI applications.
Definition: MdiCubeViewport.h:39
Isis::RubberBandTool::PolygonMode
@ PolygonMode
Definition: RubberBandTool.h:64
QWidget
Isis::RubberBandTool::mouseMove
void mouseMove(QPoint p, Qt::MouseButton)
If tracking is not enabled, this does nothing.
Definition: RubberBandTool.cpp:589
MdiCubeViewport.h
Isis::RubberBandTool::scaleChanged
void scaleChanged()
Definition: RubberBandTool.cpp:1181
Isis::RubberBandTool::setDrawActiveViewportOnly
void setDrawActiveViewportOnly(bool activeOnly=false)
This called to set whether rubber band is drawn on active viewport only rather than all linked viewpo...
Definition: RubberBandTool.cpp:333
Isis::RubberBandTool::RectangleMode
@ RectangleMode
Definition: RubberBandTool.h:62
Isis::PI
const double PI
The mathematical constant PI.
Definition: Constants.h:40
QList< QPoint >
Isis::RubberBandTool::RubberBandTool
RubberBandTool(QWidget *parent=NULL)
This is the constructor.
Definition: RubberBandTool.cpp:35
Isis::Tool::cubeViewportList
CubeViewportList * cubeViewportList() const
Return the list of cubeviewports.
Definition: Tool.cpp:390
Isis::RubberBandTool::CircleMode
@ CircleMode
Definition: RubberBandTool.h:59
Isis::Tool
Base class for the Qisis tools.
Definition: Tool.h:67
geos
Definition: Image.h:43
Isis::RubberBandTool::enable
void enable(RubberBandMode mode, bool showIndicatorColors=false)
This is called when changing modes or turning on.
Definition: RubberBandTool.cpp:302
Isis::RubberBandTool::currentMode
RubberBandMode currentMode()
Definition: RubberBandTool.cpp:1161
Isis::RubberBandTool::mouseButtonRelease
void mouseButtonRelease(QPoint p, Qt::MouseButton s)
If this is not the left mouse button, this does nothing.
Definition: RubberBandTool.cpp:475
Tool.h
Isis::globalFactory
static geos::geom::GeometryFactory::Ptr globalFactory
Definition: PolygonTools.h:51
Isis::RubberBandTool::figureComplete
bool figureComplete()
Definition: RubberBandTool.cpp:1021
Isis::RubberBandTool::RotatedRectangleMode
@ RotatedRectangleMode
Definition: RubberBandTool.h:63
Isis::RubberBandTool::measureChange
void measureChange()
Isis::RubberBandTool::modeChanged
void modeChanged()
Isis::RubberBandTool::mouseButton
Qt::MouseButton mouseButton()
This method returns the mouse button modifier.
Definition: RubberBandTool.cpp:1012
Isis::RubberBandTool::SegmentedLineMode
@ SegmentedLineMode
Definition: RubberBandTool.h:65
Isis::RubberBandTool::figureValid
bool figureValid()
Definition: RubberBandTool.cpp:1056
Isis::RubberBandTool::AngleMode
@ AngleMode
Definition: RubberBandTool.h:58
Isis::RubberBandTool::enablePoints
void enablePoints(unsigned int pixTolerance=2)
Definition: RubberBandTool.cpp:1117
Isis::RubberBandTool::~RubberBandTool
virtual ~RubberBandTool()
Definition: RubberBandTool.cpp:48
Isis::RubberBandTool::enableRubberBandTool
void enableRubberBandTool()
Anytime a tool is created, you may use the rubber band tool.
Definition: RubberBandTool.h:107
Isis::RubberBandTool::enableAllClicks
void enableAllClicks()
Definition: RubberBandTool.cpp:1171
SerialNumberList.h
Isis::MdiCubeViewport::isLinked
bool isLinked() const
Is the viewport linked with other viewports.
Definition: MdiCubeViewport.h:50
Isis::RubberBandTool::paintViewport
void paintViewport(MdiCubeViewport *vp, QPainter *painter)
This is the main paint method for the rubber bands.
Definition: RubberBandTool.cpp:73
Isis::RubberBandTool::clear
void clear()
clears the rubber band!
Definition: RubberBandTool.cpp:1155
Isis::RubberBandTool::escapeKeyPress
void escapeKeyPress()
Definition: RubberBandTool.cpp:1176
Isis::Angle
Defines an angle and provides unit conversions.
Definition: Angle.h:45
Isis::RubberBandTool::bandingComplete
void bandingComplete()
Isis::RubberBandTool::isValid
bool isValid()
This returns true if we can return complete & valid data.
Definition: RubberBandTool.cpp:1016
Isis::RubberBandTool::angle
Angle angle()
Definition: RubberBandTool.cpp:760
Isis::RubberBandTool::RubberBandMode
RubberBandMode
Definition: RubberBandTool.h:57
std
Namespace for the standard library.
Isis::Tool::activate
void activate(bool)
Activates the tool.
Definition: Tool.cpp:131
Isis::RubberBandTool::geometry
geos::geom::Geometry * geometry()
Definition: RubberBandTool.cpp:823
Isis::RubberBandTool
Rubber banding tool.
Definition: RubberBandTool.h:50
Angle.h
Isis::RubberBandTool::mouseButtonPress
void mouseButtonPress(QPoint p, Qt::MouseButton s)
If the click is not the left mouse button, this does nothing.
Definition: RubberBandTool.cpp:386
RubberBandTool.h
Isis::RubberBandTool::LineMode
@ LineMode
Definition: RubberBandTool.h:61
Constants.h
PolygonTools.h
Isis::RubberBandTool::figureIsPoint
bool figureIsPoint()
Definition: RubberBandTool.cpp:1121
Isis::RubberBandTool::area
double area()
Definition: RubberBandTool.cpp:1166
Isis::RubberBandTool::rectangle
QRect rectangle()
This method returns a rectangle from the vertices set by the RubberBandTool.
Definition: RubberBandTool.cpp:966
Isis::Tool::cubeViewport
MdiCubeViewport * cubeViewport() const
Return the current cubeviewport.
Definition: Tool.h:197
Isis::RubberBandTool::EllipseMode
@ EllipseMode
Definition: RubberBandTool.h:60
Isis::Angle::Radians
@ Radians
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
Definition: Angle.h:63
Isis::RubberBandTool::disable
void disable()
This is called when something is not using me, so turn off events, reset & repaint to clear the clear...
Definition: RubberBandTool.cpp:322
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::RubberBandTool::mouseDoubleClick
void mouseDoubleClick(QPoint p)
This triggers on a second mouse press.
Definition: RubberBandTool.cpp:343
Isis::RubberBandTool::vertices
QList< QPoint > vertices()
This method returns the vertices.
Definition: RubberBandTool.cpp:672

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:12:28