QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
39 , mCheckGeometryType( true )
51 void QgsMapToolDigitizeFeature::digitized(
const QgsFeature &f )
92 return mCheckGeometryType;
102 QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mLayer );
133 if ( e->button() != Qt::LeftButton )
144 bool isMatchPointZ =
false;
151 isMatchPointZ =
true;
156 savePoint = fetchPoint;
158 savePoint =
QgsPoint( fetchPoint.
x(), fetchPoint.
y() );
166 savePoint =
QgsPoint( layerPoint.
x(), layerPoint.
y() );
186 g =
QgsGeometry( qgis::make_unique<QgsPoint>( savePoint ) );
205 g =
QgsGeometry( qgis::make_unique<QgsPoint>( savePoint ) );
246 if ( e->button() == Qt::LeftButton )
254 else if ( error == 2 )
263 else if ( e->button() == Qt::RightButton )
295 QList<QgsPointLocator::Match> snappingMatchesList;
297 if ( hasCurvedSegments && providerSupportsCurvedSegments )
315 if ( hasCurvedSegments && providerSupportsCurvedSegments )
327 QList<QgsVectorLayer *> avoidIntersectionsLayers;
331 avoidIntersectionsLayers.append( vlayer );
339 if ( avoidIntersectionsLayers.size() > 0 )
342 int avoidIntersectionsReturn = featGeom.
avoidIntersections( avoidIntersectionsLayers );
343 f->setGeometry( featGeom );
344 if ( avoidIntersectionsReturn == 1 )
348 if ( f->geometry().isEmpty() )
350 emit
messageEmitted( tr(
"The feature cannot be added because its geometry collapsed due to intersection avoidance" ),
Qgis::Critical );
Abstract base class for curved geometry type.
int avoidIntersections(const QList< QgsVectorLayer * > &avoidIntersectionsLayers, const QHash< QgsVectorLayer *, QSet< QgsFeatureId > > &ignoreFeatures=(QHash< QgsVectorLayer *, QSet< QgsFeatureId > >()))
Modifies geometry to avoid intersections with the layers specified in project properties.
QList< QgsVectorLayer * > avoidIntersectionsLayers
Q_INVOKABLE QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
QgsPointXY mapPoint() const
mapPoint returns the point in coordinates
Point geometry type, with support for z-dimension and m-values.
bool hasCurvedSegments() const override
Returns true if the geometry contains curved segments.
virtual void setExteriorRing(QgsCurve *ring)
Sets the exterior ring of the polygon.
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
Curve polygon geometry type.
void cleared()
Emitted when the project is cleared (and additionally when an open project is cleared just before a n...
bool addGeometry(QgsAbstractGeometry *g) override
Adds a geometry and takes ownership. Returns true in case of success.
Map canvas is a class for displaying all GIS data types on a canvas.
void setValid(bool validity)
Sets the validity of the feature.
static QgsProject * instance()
Returns the QgsProject singleton instance.
void readProject(const QDomDocument &)
Emitted when a project is being read.
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.
@ AllowIntersections
Overlap with any feature allowed when digitizing new features.
Type
The WKB type describes the number of dimensions a geometry has.
QVector< QgsPointXY > QgsMultiPointXY
A collection of QgsPoints that share a common collection of attributes.
bool isEditable() const FINAL
Returns true if the provider is in editing mode.
void setCurrentLayer(QgsMapLayer *layer)
QgsFields fields() const FINAL
Returns the list of fields of this layer.
virtual QgsVectorDataProvider::Capabilities capabilities() const
Returns flags containing the supported capabilities.
QgsPointLocator::Match mapPointMatch() const
Returns the matching data from the most recently snapped point.
Custom exception class for Coordinate Reference System related exceptions.
QgsWkbTypes::Type wkbType() const SIP_HOLDGIL
Returns the WKB type of the geometry.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
static QgsGeometry fromMultiPointXY(const QgsMultiPointXY &multipoint)
Creates a new geometry from a QgsMultiPointXY object.
static bool hasM(Type type) SIP_HOLDGIL
Tests whether a WKB type contains m values.
@ AddFeatures
Allows adding features.
@ AvoidIntersectionsCurrentLayer
Overlap with features from the active layer when digitizing new features not allowed.
@ AvoidIntersectionsLayers
Overlap with features from a specified list of layers when digitizing new features not allowed.
Multi point geometry collection.
A class to represent a 2D point.
QgsAbstractGeometry * get()
Returns a modifiable (non-const) reference to the underlying abstract geometry primitive.
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
QgsCompoundCurve * clone() const override
Clones the geometry by performing a deep copy.
A geometry is the spatial representation of a feature.
Represents a vector layer which manages a vector based data sets.
Base class for all map layer types.
@ CircularGeometries
Supports circular geometry types (circularstring, compoundcurve, curvepolygon)
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
static bool hasZ(Type type) SIP_HOLDGIL
Tests whether a WKB type contains the z-dimension.
This is the base class for vector data providers.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QgsMapLayer * currentLayer()
returns current layer (set by legend widget)
static bool isMultiType(Type type) SIP_HOLDGIL
Returns true if the WKB type is a multi type.
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
void set(QgsAbstractGeometry *geometry)
Sets the underlying geometry store.