39 int browsedFeatureCount = 0;
40 int couldNotWriteCount = 0;
41 int noGeometryCount = 0;
47 browsedFeatureCount++;
64 QgsDebugMsg( QStringLiteral(
"Could not add new feature. Original copied feature id: %1" ).arg( fid ) );
68 fidList.insert( newFeature.
id() );
69 if ( topologicalEditing )
71 if ( topologicalLayer )
88 if ( !couldNotWriteCount && !noGeometryCount )
94 errorMsg =
new QString( tr(
"Only %1 out of %2 features were copied." )
95 .arg( browsedFeatureCount - couldNotWriteCount - noGeometryCount, browsedFeatureCount ) );
96 if ( noGeometryCount )
98 errorMsg->append(
" " );
99 errorMsg->append( tr(
"Some features have no geometry." ) );
101 if ( couldNotWriteCount )
103 errorMsg->append(
" " );
104 errorMsg->append( tr(
"Some could not be created on the layer." ) );
112 return mForceSuppressFormPopup;
CORE_EXPORT QgsAttributeMap toMap() const
Returns a QgsAttributeMap of the attribute values.
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsFeatureRequest & setFilterFids(const QgsFeatureIds &fids)
Sets feature IDs that should be fetched.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
bool hasGeometry() const
Returns true if the feature has an associated geometry.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
A geometry is the spatial representation of a feature.
OperationResult translate(double dx, double dy, double dz=0.0, double dm=0.0)
Translates this geometry by dx, dy, dz and dm.
static QgsFeature createFeature(const QgsVectorLayer *layer, const QgsGeometry &geometry=QgsGeometry(), const QgsAttributeMap &attributes=QgsAttributeMap(), QgsExpressionContext *context=nullptr)
Creates a new feature ready for insertion into a layer.
Represents a vector layer which manages a vector based data sets.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
bool isEditable() const FINAL
Returns true if the provider is in editing mode.
bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) FINAL
Adds a single feature to the sink.
int addTopologicalPoints(const QgsGeometry &geom)
Adds topological points for every vertex of the geometry.
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features