QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
32 mCursor = QCursor( Qt::OpenHandCursor );
37 mCanvas->ungrabGesture( Qt::PinchGesture );
42 mCanvas->grabGesture( Qt::PinchGesture );
48 mCanvas->ungrabGesture( Qt::PinchGesture );
59 if ( e->button() == Qt::LeftButton )
61 mCanvas->setCursor( QCursor( Qt::ClosedHandCursor ) );
71 if ( ( e->buttons() & Qt::LeftButton ) )
84 if ( e->button() == Qt::LeftButton )
114 if ( !QTouchDevice::devices().isEmpty() && !mPinching )
122 if ( QTouchDevice::devices().isEmpty() )
125 if ( QGesture *gesture = event->gesture( Qt::PinchGesture ) )
128 pinchTriggered(
static_cast<QPinchGesture *
>( gesture ) );
133 void QgsMapToolPan::pinchTriggered( QPinchGesture *gesture )
135 if ( gesture->state() == Qt::GestureFinished )
138 if ( 0.98 < gesture->totalScaleFactor() && gesture->totalScaleFactor() < 1.02 )
145 QPoint pos = gesture->centerPoint().toPoint();
146 pos =
mCanvas->mapFromGlobal( pos );
150 r.
scale( 1 / gesture->totalScaleFactor(), ¢er );
QgsRectangle extent() const
Returns the current zoom extent of the map canvas.
void refresh()
Repaints the canvas map.
void zoomOut()
Zoom out with fixed factor.
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
void panActionEnd(QPoint releasePoint)
Ends pan action and redraws the canvas.
QgsPointXY center() const
Gets map center, in geographical coordinates.
QgsCoordinateTransformContext transformContext
static QgsProject * instance()
Returns the QgsProject singleton instance.
void zoomWithCenter(int x, int y, bool zoomIn)
Zooms in/out with a given center.
void panAction(QMouseEvent *event)
Called when mouse is moving and pan is activated.
QgsPointXY toMapCoordinates(int x, int y) const
Transform device coordinates to map (world) coordinates.
bool allowInteraction(QgsMapCanvasInteractionBlocker::Interaction interaction) const
Returns true if the specified interaction is currently permitted on the canvas.
void scale(double scaleFactor, const QgsPointXY *c=nullptr)
Scale the rectangle around its center point.
bool setEllipsoid(const QString &ellipsoid)
Sets the ellipsoid by its acronym.
double bearing(const QgsPointXY &p1, const QgsPointXY &p2) const
Computes the bearing (in radians) between two points.
double measureLine(const QVector< QgsPointXY > &points) const
Measures the length of a line with multiple segments.
QgsUnitTypes::DistanceUnit lengthUnits() const
Returns the units of distance for length calculations made by this object.
void setCenter(const QgsPointXY ¢er)
Set the center of the map canvas, in geographical coordinates.
void setSourceCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets source spatial reference system crs.
void setExtent(const QgsRectangle &r, bool magnified=false)
Sets the extent of the map canvas to the specified rectangle.
const QgsMapToPixel * getCoordinateTransform()
Gets the current coordinate transform.
QgsCoordinateReferenceSystem destinationCrs() const
returns CRS of destination coordinate reference system
void panActionStart(QPoint releasePoint)
Starts a pan action.
@ MapPanOnSingleClick
A map pan interaction caused by a single click and release on the map canvas.