21 #include <QMouseEvent> 49 if ( !( e->buttons() & Qt::LeftButton ) )
57 QColor color( Qt::blue );
73 if ( e->button() != Qt::LeftButton )
82 if ( e->button() != Qt::LeftButton )
86 if ( e->modifiers() & Qt::AltModifier )
113 const QSize &zoomRectSize =
mZoomRect.size();
115 const QSize &canvasSize = mapSettings.
outputSize();
116 double sfx = ( double )zoomRectSize.width() / canvasSize.width();
117 double sfy = ( double )zoomRectSize.height() / canvasSize.height();
118 double sf = std::max( sfx, sfy );
void zoomWithCenter(int x, int y, bool zoomIn)
Zooms in/out with a given center.
void setToCanvasRectangle(QRect rect)
Sets this rubber band to a map canvas rectangle.
A class to represent a 2D point.
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
void refresh()
Repaints the canvas map.
Map canvas is a class for displaying all GIS data types on a canvas.
The QgsMapSettings class contains configuration for rendering of the map.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Perform transforms between map coordinates and device coordinates.
A class for drawing transient features (e.g.
void zoomByFactor(double scaleFactor, const QgsPointXY *center=nullptr)
Zoom with the factor supplied.
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
const QgsMapToPixel * getCoordinateTransform()
Gets the current coordinate transform.
void setColor(const QColor &color)
Sets the color for the rubberband.
static QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
QSize outputSize() const
Returns the size of the resulting map image.
QgsPointXY toMapCoordinates(int x, int y) const