23 , mDefinition( mappingDefinition )
25 , mOwnsSink( ownsSink )
54 const QMap< QString, QgsProperty > fieldMap = mDefinition.
fieldMap();
57 if ( fieldMap.contains( field.name() ) )
59 attributes.append( fieldMap.value( field.name() ).value( mContext ) );
63 attributes.append( QVariant() );
72 if ( !geometries.isEmpty() )
74 res.reserve( geometries.size() );
141 map.insert( QStringLiteral(
"wkb_type" ),
static_cast< quint32
>( mDestinationWkbType ) );
143 QVariantList fieldNames;
144 for (
const QgsField &field : mDestinationFields )
145 fieldNames << field.name();
146 map.insert( QStringLiteral(
"destination_field_names" ), fieldNames );
151 for (
auto it = mFieldMap.constBegin(); it != mFieldMap.constEnd(); ++it )
153 fieldMap.insert( it.key(), it.value().toVariant() );
155 map.insert( QStringLiteral(
"field_map" ),
fieldMap );
164 const QVariantList fieldNames = map.value( QStringLiteral(
"destination_field_names" ) ).toList();
166 for (
const QVariant &field : fieldNames )
170 mDestinationFields = fields;
175 const QVariantMap
fieldMap = map.value( QStringLiteral(
"field_map" ) ).toMap();
181 mFieldMap.insert( it.key(), p );
189 return mDestinationWkbType == other.mDestinationWkbType
190 && mDestinationFields == other.mDestinationFields
191 && mFieldMap == other.mFieldMap
192 && mSourceCrs == other.mSourceCrs
193 && mDestinationCrs == other.mDestinationCrs;
198 return !( *
this == other );
WkbType
The WKB type describes the number of dimensions a geometry has.
@ WKT_PREFERRED
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
static QgsCoordinateReferenceSystem fromWkt(const QString &wkt)
Creates a CRS from a WKT spatial ref sys definition string.
QString toWkt(WktVariant variant=WKT1_GDAL, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
Contains information about the context in which a coordinate transform is executed.
Custom exception class for Coordinate Reference System related exceptions.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
An interface for objects which accept features via addFeature(s) methods.
virtual QString lastError() const
Returns the most recent error encountered by the sink, e.g.
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
Adds a list of features to the sink.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
void setFields(const QgsFields &fields, bool initAttributes=false)
Assigns a field map with the feature to allow attribute access by attribute name.
void clearGeometry()
Removes any geometry associated with the feature.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
bool append(const QgsField &field, FieldOrigin origin=OriginProvider, int originIndex=-1)
Appends a field. The field must have unique name, otherwise it is rejected (returns false)
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::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false)
Transforms this geometry as described by the coordinate transform ct.
static void warning(const QString &msg)
Goes to qWarning.
A store for object properties.
bool loadVariant(const QVariant &property)
Loads this property from a QVariantMap, wrapped in a QVariant.
void setTransformContext(const QgsCoordinateTransformContext &context)
Sets the transform context to use when reprojecting features.
void setExpressionContext(const QgsExpressionContext &context) const
Sets the expression context to use when evaluating mapped field values.
~QgsRemappingProxyFeatureSink() override
bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a list of features to the sink.
QString lastError() const override
Returns the most recent error encountered by the sink, e.g.
QgsRemappingProxyFeatureSink(const QgsRemappingSinkDefinition &mappingDefinition, QgsFeatureSink *sink, bool ownsSink=false)
Constructor for QgsRemappingProxyFeatureSink, using the specified mappingDefinition to manipulate fea...
bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a single feature to the sink.
QgsFeatureList remapFeature(const QgsFeature &feature) const
Remaps a feature to a set of features compatible with the destination sink.
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
bool operator==(const QgsRemappingSinkDefinition &other) const
QMap< QString, QgsProperty > fieldMap() const
Returns the field mapping, which defines how to map the values from incoming features to destination ...
bool operator!=(const QgsRemappingSinkDefinition &other) const
QgsCoordinateReferenceSystem sourceCrs() const
Returns the source CRS used for reprojecting incoming features to the sink's destination CRS.
QVariant toVariant() const
Saves this remapping definition to a QVariantMap, wrapped in a QVariant.
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination CRS used for reprojecting incoming features to the sink's destination CRS.
bool loadVariant(const QVariantMap &map)
Loads this remapping definition from a QVariantMap, wrapped in a QVariant.
QgsFields destinationFields() const
Returns the fields for the destination sink.
Qgis::WkbType destinationWkbType() const
Returns the WKB geometry type for the destination.
QList< QgsFeature > QgsFeatureList