/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsremappingproxyfeaturesink.h                              *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/




class QgsRemappingSinkDefinition
{
%Docstring(signature="appended")
Defines the parameters used to remap features when creating a
:py:class:`QgsRemappingProxyFeatureSink`.

The definition includes parameters required to correctly map incoming
features to the structure of the destination sink, e.g. information
about how to create output field values and how to transform geometries
to match the destination CRS.

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgsremappingproxyfeaturesink.h"
%End
  public:

    QMap< QString, QgsProperty > fieldMap() const;
%Docstring
Returns the field mapping, which defines how to map the values from
incoming features to destination field values.

Field values are mapped using a :py:class:`QgsProperty` source object,
which allows either direct field value to field value mapping or use of
:py:class:`QgsExpression` expressions to transform values to the
destination field.

.. seealso:: :py:func:`setFieldMap`

.. seealso:: :py:func:`addMappedField`
%End

    void setFieldMap( const QMap< QString, QgsProperty > &map );
%Docstring
Sets the field mapping, which defines how to map the values from
incoming features to destination field values.

Field values are mapped using a :py:class:`QgsProperty` source object,
which allows either direct field value to field value mapping or use of
:py:class:`QgsExpression` expressions to transform values to the
destination field.

.. seealso:: :py:func:`fieldMap`

.. seealso:: :py:func:`addMappedField`
%End

    void addMappedField( const QString &destinationField, const QgsProperty &property );
%Docstring
Adds a mapping for a destination field.

Field values are mapped using a :py:class:`QgsProperty` source object,
which allows either direct field value to field value mapping or use of
:py:class:`QgsExpression` expressions to transform values to the
destination field.

.. seealso:: :py:func:`setFieldMap`

.. seealso:: :py:func:`fieldMap`
%End

    QgsCoordinateReferenceSystem sourceCrs() const;
%Docstring
Returns the source CRS used for reprojecting incoming features to the
sink's destination CRS.

.. seealso:: :py:func:`setSourceCrs`
%End

    void setSourceCrs( const QgsCoordinateReferenceSystem &source );
%Docstring
Sets the ``source`` crs used for reprojecting incoming features to the
sink's destination CRS.

.. seealso:: :py:func:`sourceCrs`
%End

    QgsCoordinateReferenceSystem destinationCrs() const;
%Docstring
Returns the destination CRS used for reprojecting incoming features to
the sink's destination CRS.

.. seealso:: :py:func:`setDestinationCrs`
%End

    void setDestinationCrs( const QgsCoordinateReferenceSystem &destination );
%Docstring
Sets the ``destination`` crs used for reprojecting incoming features to
the sink's destination CRS.

.. seealso:: :py:func:`destinationCrs`
%End

    Qgis::WkbType destinationWkbType() const;
%Docstring
Returns the WKB geometry type for the destination.

.. seealso:: :py:func:`setDestinationWkbType`
%End

    void setDestinationWkbType( Qgis::WkbType type );
%Docstring
Sets the WKB geometry ``type`` for the destination.

.. seealso:: :py:func:`setDestinationWkbType`
%End

    QgsFields destinationFields() const;
%Docstring
Returns the fields for the destination sink.

.. seealso:: :py:func:`setDestinationFields`
%End

    void setDestinationFields( const QgsFields &fields );
%Docstring
Sets the ``fields`` for the destination sink.

.. seealso:: :py:func:`destinationFields`
%End

    QVariant toVariant() const;
%Docstring
Saves this remapping definition to a QVariantMap, wrapped in a QVariant.
You can use :py:class:`QgsXmlUtils`.writeVariant to save it to an XML
document.

.. seealso:: :py:func:`loadVariant`
%End

    bool loadVariant( const QVariantMap &map );
%Docstring
Loads this remapping definition from a QVariantMap, wrapped in a
QVariant. You can use :py:class:`QgsXmlUtils`.readVariant to load it
from an XML document.

.. seealso:: :py:func:`toVariant`
%End

    bool operator==( const QgsRemappingSinkDefinition &other ) const;
    bool operator!=( const QgsRemappingSinkDefinition &other ) const;

};




class QgsRemappingProxyFeatureSink : QgsFeatureSink
{
%Docstring(signature="appended")
A :py:class:`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.

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgsremappingproxyfeaturesink.h"
%End
  public:


    QgsRemappingProxyFeatureSink( const QgsRemappingSinkDefinition &mappingDefinition, QgsFeatureSink *sink );
%Docstring
Constructor for QgsRemappingProxyFeatureSink, using the specified
``mappingDefinition`` to manipulate features before sending them to the
destination ``sink``.
%End

    ~QgsRemappingProxyFeatureSink();

    void setExpressionContext( const QgsExpressionContext &context ) const;
%Docstring
Sets the expression ``context`` to use when evaluating mapped field
values.
%End

    void setTransformContext( const QgsCoordinateTransformContext &context );
%Docstring
Sets the transform ``context`` to use when reprojecting features.
%End

    QgsFeatureList remapFeature( const QgsFeature &feature ) const;
%Docstring
Remaps a ``feature`` to a set of features compatible with the
destination sink.
%End

    virtual bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() );

    virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() );

    virtual bool addFeatures( QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() );

    virtual QString lastError() const;


    QgsFeatureSink *destinationSink();
%Docstring
Returns the destination :py:class:`QgsFeatureSink` which the proxy will
forward features to.
%End

};





/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsremappingproxyfeaturesink.h                              *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/
