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 );
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).
@ Warning
Warning message.
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.
QgsWkbTypes::Type wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
QVector< QgsGeometry > coerceToType(QgsWkbTypes::Type type, double defaultZ=0, double defaultM=0) const
Attempts to coerce this geometry into the specified destination type.
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.
Type
The WKB type describes the number of dimensions a geometry has.
static QString displayString(Type type)
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...
static Type linearType(Type type)
Returns the linear type for a WKB type.