Class: QgsMapToolCapture

class qgis.gui.QgsMapToolCapture(canvas: QgsMapCanvas, cadDockWidget: QgsAdvancedDigitizingDockWidget, mode: QgsMapToolCapture.CaptureMode)

Bases: qgis._gui.QgsMapToolAdvancedDigitizing

constructor

Enums

Methods

activate

addCurve

Adds a whole curve (e.g.

addTopologicalPoints

addVertex

Adds a point to the rubber band (in map coordinates) and to the capture list (in layer coordinates)

cadCanvasMoveEvent

captureCurve

Gets the capture curve

childEvent

clean

convenient method to clean members

clearCurve

Clear capture curve.

closePolygon

Close an open polygon

connectNotify

createGeometryRubberBand

createRubberBand

currentVectorLayer

customEvent

deactivate

deleteTempRubberBand

Clean a temporary rubberband

digitizingFillColor

digitizingStrokeColor

digitizingStrokeWidth

disconnectNotify

fetchLayerPoint

Fetches the original point from the source layer if it has the same CRS as the current layer.

isCapturing

Are we currently capturing?

isSignalConnected

keyPressEvent

Intercept key events like Esc or Del to delete the last point

mapPoint

Creates a QgsPoint with ZM support if necessary (according to the WkbType of the current layer).

mode

The capture mode

nextPoint

Converts a map point to layer coordinates

notifyNotEditableLayer

notifyNotVectorLayer

points

List of digitized points

receivers

sender

senderSignalIndex

setAdvancedDigitizingAllowed

setAutoSnapEnabled

setPoints

Set the points on which to work

size

Number of points digitized

snappingMatches

Returns a list of matches for each point on the captureCurve.

startCapturing

Start capturing

stopCapturing

Stop capturing

timerEvent

toCanvasCoordinates

toLayerCoordinates

toMapCoordinates

toMapCoordinatesV2

undo

Removes the last vertex from mRubberBand and mCaptureList

Signals

Attributes

CaptureLine

CaptureNone

CapturePoint

CapturePolygon

CaptureLine = 2
class CaptureMode

Bases: int

CaptureNone = 0
CapturePoint = 1
CapturePolygon = 3
activate(self)
addCurve(self, c: QgsCurve) → int

Adds a whole curve (e.g. circularstring) to the captured geometry. Curve must be in map CRS

addTopologicalPoints()
addVertex(self, point: QgsPointXY) → int

Adds a point to the rubber band (in map coordinates) and to the capture list (in layer coordinates)

Returns

0 in case of success, 1 if current layer is not a vector layer, 2 if coordinate transformation failed

addVertex(self, mapPoint: QgsPointXY, match: QgsPointLocator.Match) -> int Variant to supply more information in the case of snapping

Parameters
  • mapPoint – The vertex to add in map coordinates

  • match – Data about the snapping match. Can be an invalid match, if point not snapped.

New in version 2.14.

cadCanvasMoveEvent(self, e: QgsMapMouseEvent)
captureCurve(self) → QgsCompoundCurve

Gets the capture curve

Returns

Capture curve

childEvent()
clean(self)

convenient method to clean members

clearCurve(self)

Clear capture curve.

New in version 3.0.

closePolygon(self)

Close an open polygon

connectNotify()
createGeometryRubberBand()
createRubberBand()
currentVectorLayer()
customEvent()
deactivate(self)
deleteTempRubberBand(self)

Clean a temporary rubberband

digitizingFillColor()
digitizingStrokeColor()
digitizingStrokeWidth()
disconnectNotify()
fetchLayerPoint(self, match: QgsPointLocator.Match, layerPoint: QgsPoint) → int

Fetches the original point from the source layer if it has the same CRS as the current layer.

Returns

0 in case of success, 1 if not applicable (CRS mismatch), 2 in case of failure

New in version 2.14.

isCapturing(self) → bool

Are we currently capturing?

Returns

Is the tool in capture mode?

isSignalConnected()
keyPressEvent(self, e: QKeyEvent)

Intercept key events like Esc or Del to delete the last point

Parameters

e – key event

mapPoint(self, e: QgsMapMouseEvent) → QgsPoint

Creates a QgsPoint with ZM support if necessary (according to the WkbType of the current layer). If the point is snapped, then the Z value is took from the snapped point.

Parameters

e – A mouse event

Returns

a point with ZM support if necessary

New in version 3.0.

mapPoint(self, point: QgsPointXY) -> QgsPoint Creates a QgsPoint with ZM support if necessary (according to the WkbType of the current layer).

Parameters

point – A point in 2D

Returns

a point with ZM support if necessary

New in version 3.0.

mode(self) → QgsMapToolCapture.CaptureMode

The capture mode

Returns

Capture mode

nextPoint(self, mapPoint: QgsPoint, layerPoint: QgsPoint) → int

Converts a map point to layer coordinates

Parameters

mapPoint – the point in map coordinates

param[in,out] layerPoint the point in layer coordinates

Returns

0 in case of success 1 if the current layer is None or not a vector layer 2 if the transformation failed

nextPoint(self, p: QPoint, layerPoint: QgsPoint, mapPoint: QgsPoint) -> int Converts a point to map coordinates and layer coordinates

Parameters

p – the input point

param[in,out] layerPoint the point in layer coordinates param[in,out] mapPoint the point in map coordinates

Returns

0 in case of success 1 if the current layer is None or not a vector layer 2 if the transformation failed

notifyNotEditableLayer()
notifyNotVectorLayer()
points(self) → List[QgsPointXY]

List of digitized points

Returns

List of points

receivers()
sender()
senderSignalIndex()
setAdvancedDigitizingAllowed()
setAutoSnapEnabled()
setPoints(self, pointList: Iterable[QgsPointXY])

Set the points on which to work

Parameters

pointList – A list of points

size(self) → int

Number of points digitized

Returns

Number of points

snappingMatches(self) → List[QgsPointLocator.Match]

Returns a list of matches for each point on the captureCurve.

New in version 3.0.

startCapturing(self)

Start capturing

stopCapturing(self)

Stop capturing

timerEvent()
toCanvasCoordinates()
toLayerCoordinates()
toMapCoordinates()
toMapCoordinatesV2()
undo(self)

Removes the last vertex from mRubberBand and mCaptureList