QGIS API Documentation 3.99.0-Master (d270888f95f)
Loading...
Searching...
No Matches
QgsMapToolShapeAbstract Class Referenceabstract

Base class for shape map tools to be used by QgsMapToolCapture. More...

#include <qgsmaptoolshapeabstract.h>

Inheritance diagram for QgsMapToolShapeAbstract:

Public Types

enum class  ShapeCategory {
  Curve , Circle , Ellipse , Rectangle ,
  RegularPolygon
}
 List of different shapes. More...

Signals

void transientGeometryChanged (const QgsReferencedGeometry &geometry)
 Emitted whenever the geometry associated with the tool is changed, including transient (i.e.

Public Member Functions

 QgsMapToolShapeAbstract (const QString &id, QgsMapToolCapture *parentTool)
 Constructor.
 ~QgsMapToolShapeAbstract () override
virtual void activate (QgsMapToolCapture::CaptureMode mode, const QgsPoint &lastCapturedMapPoint)
 Activates the map tool with the last captured map point.
virtual void cadCanvasMoveEvent (QgsMapMouseEvent *e, QgsMapToolCapture::CaptureMode mode)=0
 Called for a mouse move event.
virtual bool cadCanvasReleaseEvent (QgsMapMouseEvent *e, QgsMapToolCapture::CaptureMode mode)=0
 Called for a mouse release event Must return true if the digitization has ended and the geometry is correctly set.
virtual void clean ()
 Called to clean the map tool (after canceling the operation or when the digitization has finished).
virtual void deactivate ()
 Deactivates the map tool.
QString id () const
 Returns the id of the shape tool (equivalent to the one from the metadata).
virtual void keyPressEvent (QKeyEvent *e)
 Filters a key press event Ignores the event in default implementation.
virtual void keyReleaseEvent (QKeyEvent *e)
 Filters a key release event Ignores the event in default implementation.
virtual void undo ()
 Called to undo last action (last point added).

Protected Member Functions

void setTransientGeometry (const QgsGeometry &geometry)
 Sets the current geometry, including transient (i.e.

Protected Attributes

QgsMapToolCapturemParentTool = nullptr
QgsPointSequence mPoints
 points (in map coordinates)
QgsGeometryRubberBandmTempRubberBand = nullptr

Detailed Description

Base class for shape map tools to be used by QgsMapToolCapture.

Since
QGIS 3.26

Definition at line 41 of file qgsmaptoolshapeabstract.h.

Member Enumeration Documentation

◆ ShapeCategory

List of different shapes.

Enumerator
Curve 

Curve.

Circle 

Circle.

Ellipse 

Ellipse.

Rectangle 

Rectangle.

RegularPolygon 

RegularPolygon (e.g pentagons or hexagons).

Definition at line 47 of file qgsmaptoolshapeabstract.h.

Constructor & Destructor Documentation

◆ QgsMapToolShapeAbstract()

QgsMapToolShapeAbstract::QgsMapToolShapeAbstract ( const QString & id,
QgsMapToolCapture * parentTool )
inline

Constructor.

Definition at line 58 of file qgsmaptoolshapeabstract.h.

◆ ~QgsMapToolShapeAbstract()

QgsMapToolShapeAbstract::~QgsMapToolShapeAbstract ( )
override

Definition at line 27 of file qgsmaptoolshapeabstract.cpp.

Member Function Documentation

◆ activate()

virtual void QgsMapToolShapeAbstract::activate ( QgsMapToolCapture::CaptureMode mode,
const QgsPoint & lastCapturedMapPoint )
inlinevirtual

Activates the map tool with the last captured map point.

Definition at line 92 of file qgsmaptoolshapeabstract.h.

◆ cadCanvasMoveEvent()

virtual void QgsMapToolShapeAbstract::cadCanvasMoveEvent ( QgsMapMouseEvent * e,
QgsMapToolCapture::CaptureMode mode )
pure virtual

Called for a mouse move event.

◆ cadCanvasReleaseEvent()

virtual bool QgsMapToolShapeAbstract::cadCanvasReleaseEvent ( QgsMapMouseEvent * e,
QgsMapToolCapture::CaptureMode mode )
pure virtual

Called for a mouse release event Must return true if the digitization has ended and the geometry is correctly set.

◆ clean()

void QgsMapToolShapeAbstract::clean ( )
virtual

Called to clean the map tool (after canceling the operation or when the digitization has finished).

Definition at line 42 of file qgsmaptoolshapeabstract.cpp.

◆ deactivate()

virtual void QgsMapToolShapeAbstract::deactivate ( )
inlinevirtual

Deactivates the map tool.

Definition at line 99 of file qgsmaptoolshapeabstract.h.

◆ id()

QString QgsMapToolShapeAbstract::id ( ) const
inline

Returns the id of the shape tool (equivalent to the one from the metadata).

Definition at line 68 of file qgsmaptoolshapeabstract.h.

◆ keyPressEvent()

void QgsMapToolShapeAbstract::keyPressEvent ( QKeyEvent * e)
virtual

Filters a key press event Ignores the event in default implementation.

Definition at line 32 of file qgsmaptoolshapeabstract.cpp.

◆ keyReleaseEvent()

void QgsMapToolShapeAbstract::keyReleaseEvent ( QKeyEvent * e)
virtual

Filters a key release event Ignores the event in default implementation.

Definition at line 37 of file qgsmaptoolshapeabstract.cpp.

◆ setTransientGeometry()

void QgsMapToolShapeAbstract::setTransientGeometry ( const QgsGeometry & geometry)
protected

Sets the current geometry, including transient (i.e.

non-finalized, hover state) changes.

Subclasses should call this during their cadCanvasMoveEvent() implementations, whenever the transient geometry changes as a result of a mouse move.

geometry should be in the current map canvas CRS.

Since
QGIS 4.0

Definition at line 61 of file qgsmaptoolshapeabstract.cpp.

◆ transientGeometryChanged

void QgsMapToolShapeAbstract::transientGeometryChanged ( const QgsReferencedGeometry & geometry)
signal

Emitted whenever the geometry associated with the tool is changed, including transient (i.e.

non-finalized, hover state) changes.

Since
QGIS 4.0

◆ undo()

void QgsMapToolShapeAbstract::undo ( )
virtual

Called to undo last action (last point added).

Definition at line 53 of file qgsmaptoolshapeabstract.cpp.

Member Data Documentation

◆ mParentTool

QgsMapToolCapture* QgsMapToolShapeAbstract::mParentTool = nullptr
protected

Definition at line 132 of file qgsmaptoolshapeabstract.h.

◆ mPoints

QgsPointSequence QgsMapToolShapeAbstract::mPoints
protected

points (in map coordinates)

Definition at line 135 of file qgsmaptoolshapeabstract.h.

◆ mTempRubberBand

QgsGeometryRubberBand* QgsMapToolShapeAbstract::mTempRubberBand = nullptr
protected

Definition at line 137 of file qgsmaptoolshapeabstract.h.


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