QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Public Member Functions | List of all members
QgsRemappingProxyFeatureSink Class Reference

A QgsFeatureSink which proxies incoming features to a destination feature sink, after applying transformations and field value mappings. More...

#include <qgsremappingproxyfeaturesink.h>

Inheritance diagram for QgsRemappingProxyFeatureSink:
Inheritance graph
[legend]

Public Member Functions

 QgsRemappingProxyFeatureSink (const QgsRemappingSinkDefinition &mappingDefinition, QgsFeatureSink *sink, bool ownsSink=false)
 Constructor for QgsRemappingProxyFeatureSink, using the specified mappingDefinition to manipulate features before sending them to the destination sink. More...
 
 ~QgsRemappingProxyFeatureSink () override
 
bool addFeature (QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
 Adds a single feature to the sink. More...
 
bool addFeatures (QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
 Adds all features from the specified iterator to the sink. More...
 
bool addFeatures (QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
 Adds a list of features to the sink. More...
 
QgsFeatureSinkdestinationSink ()
 Returns the destination QgsFeatureSink which the proxy will forward features to. More...
 
QString lastError () const override
 Returns the most recent error encountered by the sink, e.g. More...
 
QgsFeatureList remapFeature (const QgsFeature &feature) const
 Remaps a feature to a set of features compatible with the destination sink. More...
 
void setExpressionContext (const QgsExpressionContext &context)
 Sets the expression context to use when evaluating mapped field values. More...
 
void setTransformContext (const QgsCoordinateTransformContext &context)
 Sets the transform context to use when reprojecting features. More...
 
- Public Member Functions inherited from QgsFeatureSink
virtual ~QgsFeatureSink ()=default
 
virtual bool flushBuffer ()
 Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to the sink's destination. More...
 

Additional Inherited Members

- Public Types inherited from QgsFeatureSink
enum  Flag { FastInsert = 1 << 1, RollBackOnErrors = 1 << 2 }
 Flags controlling how features are added to a sink. More...
 
enum  SinkFlag { RegeneratePrimaryKey = 1 << 1 }
 Flags that can be set on a QgsFeatureSink. More...
 

Detailed Description

A QgsFeatureSink which proxies incoming features to a destination feature sink, after applying transformations and field value mappings.

This sink allows for transformation of incoming features to match the requirements of storing in an existing destination layer, e.g. by reprojecting the features to the destination's CRS and by coercing geometries to the format required by the destination sink.

Since
QGIS 3.14

Definition at line 178 of file qgsremappingproxyfeaturesink.h.

Constructor & Destructor Documentation

◆ QgsRemappingProxyFeatureSink()

QgsRemappingProxyFeatureSink::QgsRemappingProxyFeatureSink ( const QgsRemappingSinkDefinition mappingDefinition,
QgsFeatureSink sink,
bool  ownsSink = false 
)

Constructor for QgsRemappingProxyFeatureSink, using the specified mappingDefinition to manipulate features before sending them to the destination sink.

Ownership of sink is dictated by ownsSink. If ownsSink is false, ownership is not transferred, and callers must ensure that sink exists for the lifetime of this object. If ownsSink is true, then this object will take ownership of sink.

Definition at line 21 of file qgsremappingproxyfeaturesink.cpp.

◆ ~QgsRemappingProxyFeatureSink()

QgsRemappingProxyFeatureSink::~QgsRemappingProxyFeatureSink ( )
override

Definition at line 28 of file qgsremappingproxyfeaturesink.cpp.

Member Function Documentation

◆ addFeature()

bool QgsRemappingProxyFeatureSink::addFeature ( QgsFeature feature,
QgsFeatureSink::Flags  flags = QgsFeatureSink::Flags() 
)
overridevirtual

Adds a single feature to the sink.

Feature addition behavior is controlled by the specified flags.

See also
addFeatures()
Returns
true in case of success and false in case of failure

Reimplemented from QgsFeatureSink.

Definition at line 106 of file qgsremappingproxyfeaturesink.cpp.

◆ addFeatures() [1/2]

bool QgsRemappingProxyFeatureSink::addFeatures ( QgsFeatureIterator iterator,
QgsFeatureSink::Flags  flags = QgsFeatureSink::Flags() 
)
overridevirtual

Adds all features from the specified iterator to the sink.

Feature addition behavior is controlled by the specified flags.

Returns
true if all features were added successfully, or false if any feature could not be added

Reimplemented from QgsFeatureSink.

Definition at line 122 of file qgsremappingproxyfeaturesink.cpp.

◆ addFeatures() [2/2]

bool QgsRemappingProxyFeatureSink::addFeatures ( QgsFeatureList features,
QgsFeatureSink::Flags  flags = QgsFeatureSink::Flags() 
)
overridevirtual

Adds a list of features to the sink.

Feature addition behavior is controlled by the specified flags.

See also
addFeature()
Returns
true in case of success and false in case of failure

Implements QgsFeatureSink.

Definition at line 112 of file qgsremappingproxyfeaturesink.cpp.

◆ destinationSink()

QgsFeatureSink* QgsRemappingProxyFeatureSink::destinationSink ( )
inline

Returns the destination QgsFeatureSink which the proxy will forward features to.

Definition at line 227 of file qgsremappingproxyfeaturesink.h.

◆ lastError()

QString QgsRemappingProxyFeatureSink::lastError ( ) const
overridevirtual

Returns the most recent error encountered by the sink, e.g.

when a call to addFeatures() returns false.

Since
QGIS 3.16

Reimplemented from QgsFeatureSink.

Definition at line 133 of file qgsremappingproxyfeaturesink.cpp.

◆ remapFeature()

QgsFeatureList QgsRemappingProxyFeatureSink::remapFeature ( const QgsFeature feature) const

Remaps a feature to a set of features compatible with the destination sink.

Definition at line 44 of file qgsremappingproxyfeaturesink.cpp.

◆ setExpressionContext()

void QgsRemappingProxyFeatureSink::setExpressionContext ( const QgsExpressionContext context)

Sets the expression context to use when evaluating mapped field values.

Definition at line 34 of file qgsremappingproxyfeaturesink.cpp.

◆ setTransformContext()

void QgsRemappingProxyFeatureSink::setTransformContext ( const QgsCoordinateTransformContext context)

Sets the transform context to use when reprojecting features.

Definition at line 39 of file qgsremappingproxyfeaturesink.cpp.


The documentation for this class was generated from the following files: