17#include "moc_qgsmaptoolcapture.cpp" 
   50  , mCaptureMode( mode )
 
   51  , mCaptureModeFromLayer( mode == CaptureNone )
 
   64  mExtraSnapLayer = 
new QgsVectorLayer( QStringLiteral( 
"LineString?crs=" ), QStringLiteral( 
"extra snap" ), QStringLiteral( 
"memory" ), layerOptions );
 
   68  mExtraSnapFeatureId = f.
id();
 
 
   83    mCanvas->snappingUtils()->removeExtraSnapLayer( mExtraSnapLayer );
 
   85  mExtraSnapLayer->deleteLater();
 
   86  mExtraSnapLayer = 
nullptr;
 
   92    mValidator->deleteLater();
 
 
  118  if ( mTempRubberBand )
 
  119    mTempRubberBand->show();
 
  121  mCanvas->snappingUtils()->addExtraSnapLayer( mExtraSnapLayer );
 
  125    mCurrentShapeMapTool->
activate( mCaptureMode, mCaptureLastPoint );
 
 
  130  if ( mTempRubberBand )
 
  131    mTempRubberBand->hide();
 
  135  mCanvas->snappingUtils()->removeExtraSnapLayer( mExtraSnapLayer );
 
 
  143void QgsMapToolCapture::currentLayerChanged( 
QgsMapLayer *layer )
 
  145  if ( !mCaptureModeFromLayer )
 
  181  if ( mTempRubberBand )
 
  189bool QgsMapToolCapture::tracingEnabled()
 
  197QgsPointXY QgsMapToolCapture::tracingStartPoint()
 
  202    return mTracingStartPoint;
 
  204  return mCaptureLastPoint;
 
  230  mTempRubberBand->addPoint( mCaptureLastPoint );
 
  236  const QgsPoint lastPoint = mCaptureLastPoint;
 
  238  if ( lastPointXY == pt0 && 
points[0] != lastPointXY )
 
  254  for ( 
int i = 1; i < 
points.count(); ++i ) 
 
  265bool QgsMapToolCapture::tracingAddVertex( 
const QgsPointXY &point )
 
  271  if ( mTempRubberBand->pointsCount() == 0 )
 
  273    if ( !tracer->
init() )
 
  283      mTracingStartPoint = point;
 
  293  const QVector<QgsPointXY> tracedPointsInMapCrs = tracer->
findShortestPath( pt0, point, &err );
 
  294  if ( tracedPointsInMapCrs.isEmpty() )
 
  299  layerPoints.reserve( tracedPointsInMapCrs.size() );
 
  301  mapPoints.reserve( tracedPointsInMapCrs.size() );
 
  302  for ( 
const QgsPointXY &tracedPointMapCrs : tracedPointsInMapCrs )
 
  323  mCaptureCurve.
moveVertex( lastVertexId, layerPoints.first() );
 
  324  mSnappingMatches.removeLast();
 
  334#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) 
  335    int pointBefore = mCaptureCurve.
numPoints();
 
  349        mCaptureCurve.
clear();
 
  350        mCaptureCurve.
addCurve( qgsgeometry_cast<const QgsCurve *>( curved.
constGet() )->clone() );
 
  354        mCaptureCurve = *qgsgeometry_cast<const QgsCompoundCurve *>( curved.
constGet() );
 
  358#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) 
  360    const int pointAfter = mCaptureCurve.
numPoints();
 
  362    for ( ; pointBefore < pointAfter; ++pointBefore )
 
  365    for ( ; pointBefore > pointAfter; --pointBefore )
 
  366      mSnappingMatches.removeLast();
 
  368    mSnappingMatches.resize( mCaptureCurve.
numPoints() );
 
  381QgsMapToolCaptureRubberBand *QgsMapToolCapture::createCurveRubberBand()
 const 
  383  QgsMapToolCaptureRubberBand *rb = 
new QgsMapToolCaptureRubberBand( 
mCanvas );
 
  388  color.setAlphaF( color.alphaF() * alphaScale );
 
  389  rb->setLineStyle( Qt::DotLine );
 
  390  rb->setStrokeColor( color );
 
  393  rb->setFillColor( fillColor );
 
  398void QgsMapToolCapture::resetRubberBand()
 
  431  if ( mCurrentCaptureTechnique == technique )
 
  434  mStartNewCurve = 
true;
 
  459  if ( mTempRubberBand )
 
  460    mTempRubberBand->setStringType( mLineDigitizingType );
 
  462  mCurrentCaptureTechnique = technique;
 
  467    mCurrentShapeMapTool->
activate( mCaptureMode, mCaptureLastPoint );
 
 
  473  if ( mCurrentShapeMapTool )
 
  475    if ( shapeMapToolMetadata && mCurrentShapeMapTool->
id() == shapeMapToolMetadata->
id() )
 
  479    mCurrentShapeMapTool->deleteLater();
 
  482  mCurrentShapeMapTool.
reset( shapeMapToolMetadata ? shapeMapToolMetadata->
factory( 
this ) : nullptr );
 
  487    if ( mCurrentShapeMapTool )
 
  488      mCurrentShapeMapTool->
activate( mCaptureMode, mCaptureLastPoint );
 
 
  495  if ( mCaptureModeFromLayer && ( !
canvas()->currentLayer() || !
canvas()->currentLayer()->isSpatial() ) )
 
  506    if ( !mCurrentShapeMapTool )
 
  512      if ( !mTempRubberBand )
 
  514        mTempRubberBand.
reset( createCurveRubberBand() );
 
  515        mTempRubberBand->setStringType( mLineDigitizingType );
 
  527    if ( mCaptureMode != 
CapturePoint && mTempRubberBand && mCapturing )
 
  529      bool hasTrace = 
false;
 
  533        if ( !mCaptureCurve.
isEmpty() )
 
  540        mAllowAddingStreamingPoints = 
true;
 
  542        mAllowAddingStreamingPoints = 
false;
 
  544      else if ( tracingEnabled() && mCaptureCurve.
numPoints() != 0 )
 
  550          mCircularItermediatePoint = mTempRubberBand->pointFromEnd( 1 );
 
  552          mCircularItermediatePoint = 
QgsPoint();
 
  554        hasTrace = tracingMouseMove( e );
 
  560          mTempRubberBand->addPoint( mCaptureLastPoint );
 
  561          if ( !mCircularItermediatePoint.
isEmpty() )
 
  563            mTempRubberBand->movePoint( mCircularItermediatePoint );
 
  564            mTempRubberBand->addPoint( mCircularItermediatePoint );
 
  573          const QgsPoint mapPt = mCaptureLastPoint;
 
  575          if ( mTempRubberBand )
 
  577            mTempRubberBand->movePoint( 
mapPoint );
 
  578            mTempRubberBand->movePoint( 0, mapPt );
 
  585        else if ( mTempRubberBand )
 
  586          mTempRubberBand->movePoint( 
mapPoint );
 
 
  600      const bool is3D = layerPoint.
is3D();
 
  601      const bool isMeasure = layerPoint.
isMeasure();
 
  603      layerPoint = 
QgsPoint( layerPoint.
wkbType(), mapP.
x(), mapP.
y(), layerPoint.
z(), layerPoint.
m() ); 
 
  611      QgsDebugError( QStringLiteral( 
"transformation to layer coordinate failed" ) );
 
 
  643  if ( match.
isValid() && sourceLayer )
 
  647      if ( sourceLayer->
crs() != vlayer->
crs() )
 
 
  731    mSnappingMatches.append( match );
 
  735    if ( mCaptureFirstPoint.
isEmpty() )
 
  743    if ( !mTempRubberBand )
 
  745      mTempRubberBand.
reset( createCurveRubberBand() );
 
  746      mTempRubberBand->setStringType( mLineDigitizingType );
 
  750    bool traceCreated = 
false;
 
  751    if ( tracingEnabled() )
 
  753      traceCreated = tracingAddVertex( 
mapPoint );
 
  758    mTracingStartPoint = traceCreated ? point : 
QgsPointXY();
 
  763      mTempRubberBand->movePoint( 
mapPoint );   
 
  764      if ( mTempRubberBand->curveIsComplete() ) 
 
  766        if ( 
QgsCurve *curve = mTempRubberBand->curve() )
 
  771          if ( match.
isValid() && mSnappingMatches.count() > 0 && !mSnappingMatches.last().isValid() )
 
  773            mSnappingMatches.removeLast();
 
  777              mSnappingMatches.removeLast();
 
  778              mSnappingMatches.append( mCircularIntermediateMatch );
 
  780            mSnappingMatches.append( match );
 
  786      else if ( mTempRubberBand->pointsCount() == 0 )
 
  790        mSnappingMatches.append( match );
 
  796          mCircularIntermediateMatch = match;
 
  800      mTempRubberBand->addPoint( 
mapPoint );
 
  805      mTempRubberBand->addPoint( mCaptureLastPoint );
 
  809  updateExtraSnapLayer();
 
 
  827  if ( mTempRubberBand )
 
  831    mTempRubberBand->addPoint( endPt ); 
 
  834  const int countBefore = mCaptureCurve.
vertexCount();
 
  847    mCaptureCurve.
addCurve( segmented, 
false );
 
  854    mCaptureCurve.
addCurve( 
c, !mStartNewCurve );
 
  857  mStartNewCurve = 
false;
 
  859  const int countAfter = mCaptureCurve.
vertexCount();
 
  860  const int addedPoint = countAfter - countBefore;
 
  862  updateExtraSnapLayer();
 
  864  for ( 
int i = 0; i < addedPoint; ++i )
 
 
  874  mCaptureCurve.
clear();
 
  875  updateExtraSnapLayer();
 
 
  880  return mSnappingMatches;
 
 
  887  if ( mTempRubberBand )
 
  889    if ( 
size() <= 1 && mTempRubberBand->pointsCount() != 0 )
 
  892    if ( isAutoRepeat && mIgnoreSubsequentAutoRepeatUndo )
 
  894    mIgnoreSubsequentAutoRepeatUndo = 
false;
 
  896    const QgsPoint lastPoint = mTempRubberBand->lastPoint();
 
  900      mTempRubberBand->removeLastPoint();
 
  901      mTempRubberBand->movePoint( lastPoint );
 
  906    vertexToRemove.
part = 0;
 
  907    vertexToRemove.
ring = 0;
 
  926      const int curvesBefore = mCaptureCurve.
nCurves();
 
  927      const bool lastCurveIsLineString = qgsgeometry_cast<const QgsLineString *>( mCaptureCurve.
curveAt( curvesBefore - 1 ) );
 
  929      const int pointsCountBefore = mCaptureCurve.
numPoints();
 
  931      int pointsCountAfter = mCaptureCurve.
numPoints();
 
  932      for ( ; pointsCountAfter < pointsCountBefore; pointsCountAfter++ )
 
  933        if ( !mSnappingMatches.empty() )
 
  934          mSnappingMatches.removeLast();
 
  940      if ( mCaptureCurve.
nCurves() < curvesBefore && lastCurveIsLineString )
 
  941        mIgnoreSubsequentAutoRepeatUndo = 
true;
 
  944    updateExtraSnapLayer();
 
  954      mTempRubberBand->addPoint( mCaptureLastPoint );
 
  955      mTempRubberBand->movePoint( lastPoint );
 
 
  968    if ( e->isAccepted() )
 
  979  if ( e->key() == Qt::Key_Backspace || e->key() == Qt::Key_Delete )
 
  983      if ( !e->isAutoRepeat() )
 
  985        mCurrentShapeMapTool->
undo();
 
  990      undo( e->isAutoRepeat() );
 
  996  else if ( e->key() == Qt::Key_Escape )
 
  998    if ( mCurrentShapeMapTool )
 
  999      mCurrentShapeMapTool->
clean();
 
 
 1020  mRubberBand.
reset();
 
 1024  qDeleteAll( mGeomErrorMarkers );
 
 1025  mGeomErrorMarkers.clear();
 
 1026  mGeomErrors.clear();
 
 1034  mCaptureCurve.
clear();
 
 1035  updateExtraSnapLayer();
 
 1036  mSnappingMatches.clear();
 
 1038    lCurrentVectorLayer->triggerRepaint();
 
 
 1043  mTempRubberBand.
reset();
 
 
 1050    mCurrentShapeMapTool->
clean();
 
 
 1057  mCaptureCurve.
close();
 
 1058  updateExtraSnapLayer();
 
 
 1061void QgsMapToolCapture::validateGeometry()
 
 1069    mValidator->deleteLater();
 
 1070    mValidator = 
nullptr;
 
 1073  mGeomErrors.clear();
 
 1074  while ( !mGeomErrorMarkers.isEmpty() )
 
 1076    delete mGeomErrorMarkers.takeFirst();
 
 1081  switch ( mCaptureMode )
 
 1095      exteriorRing->
close();
 
 1110  mValidator->start();
 
 1127    vm->setToolTip( e.
what() );
 
 1129    vm->setZValue( vm->zValue() + 1 );
 
 1130    mGeomErrorMarkers << vm;
 
 1141  QVector<QgsPointXY> pointsXY;
 
 
 1150  mCaptureCurve.
points( pts );
 
 
 1157  mCaptureCurve.
clear();
 
 1159  updateExtraSnapLayer();
 
 1160  mSnappingMatches.clear();
 
 1161  for ( 
int i = 0; i < line->
length(); ++i )
 
 
 1169  mCaptureCurve.
clear();
 
 1171  updateExtraSnapLayer();
 
 1172  mSnappingMatches.clear();
 
 1173  for ( 
int i = 0; i < line->
length(); ++i )
 
 
 1230      if ( match.
layer() )
 
 
 1248void QgsMapToolCapture::updateExtraSnapLayer()
 
 1250  if ( !mExtraSnapLayer )
 
 1253  if ( 
canvas()->snappingUtils()->config().selfSnapping() && 
layer() && mCaptureCurve.
numPoints() >= 2 )
 
 1261      qgsgeometry_cast<QgsCompoundCurve *>( geom.
get() )->close();
 
 1278    if ( e->button() != Qt::LeftButton )
 
 1282    bool isMatchPointZ = 
false;
 
 1283    bool isMatchPointM = 
false;
 
 1294        if ( isMatchPointM && isMatchPointZ )
 
 1298        else if ( isMatchPointM )
 
 1302        else if ( isMatchPointZ )
 
 1306        savePoint = 
QgsPoint( geomType, fetchPoint.
x(), fetchPoint.
y(), fetchPoint.
z(), fetchPoint.
m() );
 
 1312        savePoint = 
QgsPoint( point.
x(), point.
y(), fetchPoint.
z(), fetchPoint.
m() );
 
 1322    QgsGeometry g( std::make_unique<QgsPoint>( savePoint ) );
 
 1339    bool digitizingFinished = 
false;
 
 1343      if ( !mCurrentShapeMapTool )
 
 1350        if ( !mTempRubberBand )
 
 1352          mTempRubberBand.
reset( createCurveRubberBand() );
 
 1353          mTempRubberBand->setStringType( mLineDigitizingType );
 
 1358        if ( digitizingFinished )
 
 1359          mCurrentShapeMapTool->
clean();
 
 1365      if ( e->button() == Qt::LeftButton )
 
 1377      else if ( e->button() == Qt::RightButton )
 
 1401        digitizingFinished = 
true;
 
 1405    if ( digitizingFinished )
 
 1408      std::unique_ptr<QgsCurve> curveToAdd( 
captureCurve()->clone() );
 
 1425          if ( hasCurvedSegments && providerSupportsCurvedSegments )
 
 
void setParentOwner(QObject *parent)
Sets the parent object.
 
void reset(T *p=nullptr)
Will reset the managed pointer to p.
 
void reset(T *p=nullptr)
Will reset the managed pointer to p.
 
T * release()
Clears the pointer and returns it.
 
Provides global constants and enumerations for use throughout the application.
 
@ CircularGeometries
Supports circular geometry types (circularstring, compoundcurve, curvepolygon)
 
CaptureTechnique
Capture technique.
 
@ StraightSegments
Default capture mode - capture occurs with straight line segments.
 
@ CircularString
Capture in circular strings.
 
@ Streaming
Streaming points digitizing mode (points are automatically added as the mouse cursor moves).
 
GeometryValidationEngine
Available engines for validating geometries.
 
@ QgisInternal
Use internal QgsGeometryValidator method.
 
@ Geos
Use GEOS validation methods.
 
@ Warning
Warning message.
 
WkbType
The WKB type describes the number of dimensions a geometry has.
 
@ CompoundCurve
CompoundCurve.
 
@ CircularString
CircularString.
 
@ Reverse
Reverse/inverse transform (from destination to source)
 
bool isMeasure() const
Returns true if the geometry contains m values.
 
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
 
virtual QgsPoint vertexAt(QgsVertexId id) const =0
Returns the point corresponding to a specified vertex id.
 
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
 
static QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
 
@ CapturePoint
Select and capture a point or a feature.
 
QgsLineString * curveToLine(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const override
Returns a new line string geometry corresponding to a segmentized approximation of the curve.
 
void close()
Appends first point if not already closed.
 
bool isEmpty() const override
Returns true if the geometry is empty.
 
int nCurves() const
Returns the number of curves in the geometry.
 
void removeCurve(int i)
Removes a curve from the geometry.
 
void addCurve(QgsCurve *c, bool extendPrevious=false)
Adds a curve to the geometry (takes ownership).
 
bool moveVertex(QgsVertexId position, const QgsPoint &newPos) override
Moves a vertex within the geometry.
 
bool deleteVertex(QgsVertexId position) override
Deletes a vertex within the geometry.
 
QgsCompoundCurve * clone() const override
Clones the geometry by performing a deep copy.
 
const QgsCurve * curveAt(int i) const
Returns the curve at the specified index.
 
void points(QgsPointSequence &pts) const override
Returns a list of points within the curve.
 
void clear() override
Clears the geometry, ie reset it to a null geometry.
 
bool hasCurvedSegments() const override
Returns true if the geometry contains curved segments.
 
QgsPoint startPoint() const override
Returns the starting point of the curve.
 
QgsPoint endPoint() const override
Returns the end point of the curve.
 
int numPoints() const override
Returns the number of points in the curve.
 
void addVertex(const QgsPoint &pt)
Adds a vertex to the end of the geometry.
 
Custom exception class for Coordinate Reference System related exceptions.
 
Curve polygon geometry type.
 
virtual void setExteriorRing(QgsCurve *ring)
Sets the exterior ring of the polygon.
 
Abstract base class for curved geometry type.
 
QgsCurve * segmentize(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const override
Returns a geometry without curves.
 
int vertexCount(int part=0, int ring=0) const override
Returns the number of vertices of which this geometry is built.
 
virtual QgsPoint endPoint() const =0
Returns the end point of the curve.
 
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
 
Wraps a request for features to a vector layer (or directly its vector data provider).
 
QgsFeatureRequest & setFilterFid(QgsFeatureId fid)
Sets the feature ID that should be fetched.
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
Validates geometries using the QGIS geometry validation model.
 
void errorFound(const QgsGeometry::Error &error)
Sent when an error has been found during the validation process.
 
bool hasWhere() const
true if the location available from
 
QgsPointXY where() const
The coordinates at which the error is located and should be visualized.
 
QString what() const
A human readable error message containing details about the error.
 
A geometry is the spatial representation of a feature.
 
bool vertexIdFromVertexNr(int number, QgsVertexId &id) const
Calculates the vertex ID from a vertex number.
 
QgsPoint vertexAt(int atVertex) const
Returns coordinates of a vertex.
 
QgsAbstractGeometry * get()
Returns a modifiable (non-const) reference to the underlying abstract geometry primitive.
 
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
 
QgsGeometry convertToCurves(double distanceTolerance=1e-8, double angleTolerance=1e-8) const
Attempts to convert a non-curved geometry into a curved geometry type (e.g.
 
static void convertPointList(const QVector< QgsPointXY > &input, QgsPointSequence &output)
Upgrades a point list from QgsPointXY to QgsPoint.
 
Qgis::WkbType wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
 
Line string geometry type, with support for z-dimension and m-values.
 
double length() const override
Returns the planar, 2-dimensional length of the geometry.
 
void transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection d=Qgis::TransformDirection::Forward, bool transformZ=false) override
Transforms the geometry using a coordinate transform.
 
QgsLineString * curveToLine(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const override
Returns a new line string geometry corresponding to a segmentized approximation of the curve.
 
void close()
Closes the line string by appending the first point to the end of the line, if it is not already clos...
 
Extension of QgsTracer that provides extra functionality.
 
QAction * actionEnableSnapping() const
Access to action that user may use to toggle snapping on/off.
 
void reportError(PathError err, bool addingVertex)
Report a path finding error to the user.
 
QAction * actionEnableTracing() const
Access to action that user may use to toggle tracing on/off. May be nullptr if no action was associat...
 
static QgsMapCanvasTracer * tracerForCanvas(QgsMapCanvas *canvas)
Retrieve instance of this class associated with given canvas (if any).
 
Map canvas is a class for displaying all GIS data types on a canvas.
 
void currentLayerChanged(QgsMapLayer *layer)
Emitted when the current layer is changed.
 
QgsMapLayer * currentLayer()
returns current layer (set by legend widget)
 
Base class for all map layer types.
 
QgsCoordinateReferenceSystem crs
 
void setCrs(const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
Sets layer's spatial reference system.
 
A mouse event which is the result of a user interaction with a QgsMapCanvas.
 
bool isSnapped() const
Returns true if there is a snapped point cached.
 
QgsPointXY mapPoint() const
mapPoint returns the point in coordinates
 
QgsPointLocator::Match mapPointMatch() const
Returns the matching data from the most recently snapped point.
 
Point geometry type, with support for z-dimension and m-values.
 
bool addMValue(double mValue=0) override
Adds a measure to the geometry, initialized to a preset value.
 
bool dropMValue() override
Drops any measure values which exist in the geometry.
 
bool addZValue(double zValue=0) override
Adds a z-dimension to the geometry, initialized to a preset value.
 
void setM(double m)
Sets the point's m-value.
 
bool convertTo(Qgis::WkbType type) override
Converts the geometry to a specified type.
 
bool isEmpty() const override
Returns true if the geometry is empty.
 
void setZ(double z)
Sets the point's z-coordinate.
 
bool dropZValue() override
Drops any z-dimensions which exist in the geometry.
 
void setExteriorRing(QgsCurve *ring) override
Sets the exterior ring of the polygon.
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
void snappingConfigChanged(const QgsSnappingConfig &config)
Emitted whenever the configuration for snapping has changed.
 
Responsible for drawing transient features (e.g.
 
void movePoint(const QgsPointXY &p, int geometryIndex=0, int ringIndex=0)
Moves the rubber band point specified by index.
 
void reset(Qgis::GeometryType geometryType=Qgis::GeometryType::Line)
Clears all the geometries in this rubberband.
 
const QgsPointXY * getPoint(int i, int j=0, int ringIndex=0) const
Returns a vertex.
 
int numberOfVertices() const
Returns count of vertices in all lists of mPoint.
 
void addGeometry(const QgsGeometry &geometry, QgsMapLayer *layer, bool doUpdate=true)
Adds the geometry of an existing feature to a rubberband This is useful for multi feature highlightin...
 
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
 
static const QgsSettingsEntryInteger * settingsDigitizingStreamTolerance
Settings entry digitizing stream tolerance.
 
static const QgsSettingsEntryDouble * settingsDigitizingLineColorAlphaScale
Settings entry digitizing line color alpha scale.
 
static const QgsSettingsEntryDouble * settingsDigitizingConvertToCurveAngleTolerance
Settings entry digitizing convert to curve angle tolerance.
 
static const QgsSettingsEntryDouble * settingsDigitizingConvertToCurveDistanceTolerance
Settings entry digitizing convert to curve distance tolerance.
 
static const QgsSettingsEntryInteger * settingsDigitizingValidateGeometries
Settings entry digitizing validate geometries.
 
static const QgsSettingsEntryBool * settingsDigitizingConvertToCurve
Settings entry digitizing convert to curve.
 
Shows a snapping marker on map canvas for the current snapping match.
 
bool isPointSnapped(const QgsPointXY &pt)
Find out whether the point is snapped to a vertex or edge (i.e. it can be used for tracing start/stop...
 
QVector< QgsPointXY > findShortestPath(const QgsPointXY &p1, const QgsPointXY &p2, PathError *error=nullptr)
Given two points, find the shortest path and return points on the way.
 
PathError
Possible errors that may happen when calling findShortestPath()
 
@ ErrTooManyFeatures
Max feature count threshold was reached while reading features.
 
bool init()
Build the internal data structures.
 
virtual Q_INVOKABLE Qgis::VectorProviderCapabilities capabilities() const
Returns flags containing the supported capabilities.
 
Represents a vector layer which manages a vector based dataset.
 
Q_INVOKABLE bool startEditing()
Makes the layer editable.
 
bool isSpatial() const FINAL
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeome...
 
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
 
Q_INVOKABLE Qgis::WkbType wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
 
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
 
bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) FINAL
Adds a single feature to the sink.
 
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.
 
Q_INVOKABLE QgsFeature getFeature(QgsFeatureId fid) const
Queries the layer for the feature with the given id.
 
bool changeGeometry(QgsFeatureId fid, QgsGeometry &geometry, bool skipDefaultValue=false)
Changes a feature's geometry within the layer's edit buffer (but does not immediately commit the chan...
 
A map canvas item for marking vertices of features using e.g.
 
void setPenWidth(int width)
 
void setCenter(const QgsPointXY &point)
Sets the center point of the marker, in map coordinates.
 
void setIconType(int iconType)
 
void setColor(const QColor &color)
Sets the stroke color for the marker.
 
static Q_INVOKABLE bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
 
static Q_INVOKABLE bool hasM(Qgis::WkbType type)
Tests whether a WKB type contains m values.
 
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
 
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
 
#define BUILTIN_UNREACHABLE
 
QVector< QgsPoint > QgsPointSequence
 
#define QgsDebugMsgLevel(str, level)
 
#define QgsDebugError(str)
 
const QgsCoordinateReferenceSystem & crs
 
QgsFeatureId featureId() const
The id of the feature to which the snapped geometry belongs.
 
QgsVectorLayer * layer() const
The vector layer where the snap occurred.
 
QgsPoint interpolatedPoint(const QgsCoordinateReferenceSystem &destinationCrs=QgsCoordinateReferenceSystem()) const
Convenient method to return a point on an edge with linear interpolation of the Z value.
 
bool hasEdge() const
Returns true if the Match is an edge.
 
bool hasLineEndpoint() const
Returns true if the Match is a line endpoint (start or end vertex).
 
bool hasMiddleSegment() const
Returns true if the Match is the middle of a segment.
 
int vertexIndex() const
for vertex / edge match (first vertex of the edge)
 
bool hasVertex() const
Returns true if the Match is a vertex.
 
Setting options for loading vector layers.
 
bool skipCrsValidation
Controls whether the layer is allowed to have an invalid/unknown CRS.
 
bool loadDefaultStyle
Set to true if the default layer style should be loaded.
 
Utility class for identifying a unique vertex within a geometry.