41 , mCheckGeometryType( true )
67void QgsMapToolDigitizeFeature::layerGeometryCaptured(
const QgsGeometry &geometry )
84 if ( mCheckGeometryType )
88 QVector<QgsGeometry> layerGeometries = geometry.
coerceToType( layerWKBType, defaultZ, defaultM );
89 if ( layerGeometries.count() > 0 )
90 layerGeometry = layerGeometries.at( 0 );
100 layerGeometry = geometry;
102 f.setGeometry( layerGeometry );
106 featureDigitized( f );
111 QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mLayer );
124 mCurrentLayer =
mCanvas->currentLayer();
126 mCanvas->setCurrentLayer( mLayer );
138 mCanvas->setCurrentLayer( mCurrentLayer );
144 if ( e->key() == Qt::Key_Escape )
153 return mCheckGeometryType;
163 QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mLayer );
179 emit
messageEmitted( tr(
"The data provider for this layer does not support the addition of features." ), Qgis::MessageLevel::Warning );
192 emit
messageEmitted( tr(
"Wrong editing tool, cannot apply the 'capture point' tool on this vector layer" ), Qgis::MessageLevel::Warning );
199 emit
messageEmitted( tr(
"Wrong editing tool, cannot apply the 'capture line' tool on this vector layer" ), Qgis::MessageLevel::Warning );
206 emit
messageEmitted( tr(
"Wrong editing tool, cannot apply the 'capture polygon' tool on this vector layer" ), Qgis::MessageLevel::Warning );
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).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
A geometry is the spatial representation of a feature.
QVector< QgsGeometry > coerceToType(QgsWkbTypes::Type type, double defaultZ=0, double defaultM=0) const
Attempts to coerce this geometry into the specified destination type.
QgsWkbTypes::Type wkbType() const SIP_HOLDGIL
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
static QgsProject * instance()
Returns the QgsProject singleton instance.
void cleared()
Emitted when the project is cleared (and additionally when an open project is cleared just before a n...
void readProject(const QDomDocument &)
Emitted when a project is being read.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
static const QgsSettingsEntryDouble settingsDigitizingDefaultZValue
Settings entry digitizing default z value.
static const QgsSettingsEntryDouble settingsDigitizingDefaultMValue
Settings entry digitizing default m value.
This is the base class for vector data providers.
@ AddFeatures
Allows adding features.
virtual Q_INVOKABLE QgsVectorDataProvider::Capabilities capabilities() const
Returns flags containing the supported capabilities.
Represents a vector layer which manages a vector based data sets.
Q_INVOKABLE QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
bool isSpatial() const FINAL
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeome...
QgsFields fields() const FINAL
Returns the list of fields of this layer.
bool isEditable() const FINAL
Returns true if the provider is in editing mode.
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
static Type linearType(Type type) SIP_HOLDGIL
Returns the linear type for a WKB type.
Type
The WKB type describes the number of dimensions a geometry has.
static QString displayString(Type type) SIP_HOLDGIL
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...