Skip to content
Permalink
Browse files

Rename addFeature member in QgsVectorFileWriter to avoid clash

  • Loading branch information
nyalldawson committed Jun 15, 2017
1 parent 30d35c1 commit 2640626e17e6f3536e948640930ab69ed2a93dae
Showing with 14 additions and 10 deletions.
  1. +3 −2 python/core/qgsvectorfilewriter.sip
  2. +6 −6 src/core/qgsvectorfilewriter.cpp
  3. +5 −2 src/core/qgsvectorfilewriter.h
@@ -527,9 +527,10 @@ Retrieves error message
virtual bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 );


bool addFeature( QgsFeature &feature, QgsFeatureRenderer *renderer, QgsUnitTypes::DistanceUnit outputUnit = QgsUnitTypes::DistanceMeters );
bool addFeatureWithStyle( QgsFeature &feature, QgsFeatureRenderer *renderer, QgsUnitTypes::DistanceUnit outputUnit = QgsUnitTypes::DistanceMeters );
%Docstring
Add feature to the currently opened data source
Adds a ``feature`` to the currently opened data source, using the style from a specified ``renderer``.
.. versionadded:: 3.0
:rtype: bool
%End

@@ -1836,23 +1836,23 @@ QString QgsVectorFileWriter::errorMessage()
return mErrorMessage;
}

bool QgsVectorFileWriter::addFeature( QgsFeature &feature, Flags )
bool QgsVectorFileWriter::addFeature( QgsFeature &feature, QgsFeatureSink::Flags )
{
return addFeature( feature, nullptr, QgsUnitTypes::DistanceMeters );
return addFeatureWithStyle( feature, nullptr, QgsUnitTypes::DistanceMeters );
}

bool QgsVectorFileWriter::addFeatures( QgsFeatureList &features, Flags )
bool QgsVectorFileWriter::addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags )
{
QgsFeatureList::iterator fIt = features.begin();
bool result = true;
for ( ; fIt != features.end(); ++fIt )
{
result = result && addFeature( *fIt, nullptr, QgsUnitTypes::DistanceMeters );
result = result && addFeatureWithStyle( *fIt, nullptr, QgsUnitTypes::DistanceMeters );
}
return result;
}

bool QgsVectorFileWriter::addFeature( QgsFeature &feature, QgsFeatureRenderer *renderer, QgsUnitTypes::DistanceUnit outputUnit )
bool QgsVectorFileWriter::addFeatureWithStyle( QgsFeature &feature, QgsFeatureRenderer *renderer, QgsUnitTypes::DistanceUnit outputUnit )
{
// create the feature
OGRFeatureH poFeature = createFeature( feature );
@@ -2561,7 +2561,7 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer *layer,
fet.initAttributes( 0 );
}

if ( !writer->addFeature( fet, layer->renderer(), mapUnits ) )
if ( !writer->addFeatureWithStyle( fet, layer->renderer(), mapUnits ) )
{
WriterError err = writer->hasError();
if ( err != NoError && errorMessage )
@@ -519,8 +519,11 @@ class CORE_EXPORT QgsVectorFileWriter : public QgsFeatureSink
bool addFeature( QgsFeature &feature, QgsFeatureSink::Flags flags = 0 ) override;
bool addFeatures( QgsFeatureList &features, QgsFeatureSink::Flags flags = 0 ) override;

//! Add feature to the currently opened data source
bool addFeature( QgsFeature &feature, QgsFeatureRenderer *renderer, QgsUnitTypes::DistanceUnit outputUnit = QgsUnitTypes::DistanceMeters );
/**
* Adds a \a feature to the currently opened data source, using the style from a specified \a renderer.
* \since QGIS 3.0
*/
bool addFeatureWithStyle( QgsFeature &feature, QgsFeatureRenderer *renderer, QgsUnitTypes::DistanceUnit outputUnit = QgsUnitTypes::DistanceMeters );

//! \note not available in Python bindings
QMap<int, int> attrIdxToOgrIdx() { return mAttrIdxToOgrIdx; } SIP_SKIP

0 comments on commit 2640626

Please sign in to comment.
You can’t perform that action at this time.