33 , mCheckGeometryType( true )
59void QgsMapToolDigitizeFeature::layerGeometryCaptured(
const QgsGeometry &geometry )
76 if ( mCheckGeometryType )
80 QVector<QgsGeometry> layerGeometries = geometry.
coerceToType( layerWKBType, defaultZ, defaultM );
81 if ( layerGeometries.count() > 0 )
82 layerGeometry = layerGeometries.at( 0 );
92 layerGeometry = geometry;
94 f.setGeometry( layerGeometry );
98 featureDigitized( f );
103 QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mLayer );
116 mCurrentLayer =
mCanvas->currentLayer();
118 mCanvas->setCurrentLayer( mLayer );
130 mCanvas->setCurrentLayer( mCurrentLayer );
136 if ( e->key() == Qt::Key_Escape )
145 return mCheckGeometryType;
155 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.
WkbType
The WKB type describes the number of dimensions a geometry has.
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(Qgis::WkbType type, double defaultZ=0, double defaultM=0) const
Attempts to coerce this geometry into the specified destination type.
Qgis::WkbType wkbType() const
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 * settingsDigitizingDefaultMValue
Settings entry digitizing default m value.
static const QgsSettingsEntryDouble * settingsDigitizingDefaultZValue
Settings entry digitizing default z 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.
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.
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.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.
static Qgis::WkbType linearType(Qgis::WkbType type)
Returns the linear type for a WKB type.
static QString displayString(Qgis::WkbType type)
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...