Skip to content
Permalink
Browse files

Rename QgsFeaturesData to QgsFeatureData and fix test case

  • Loading branch information
elpaso committed Feb 19, 2019
1 parent ba3d9ed commit 490c1fedfb978265cf67b77ad0d216a9358728bf
@@ -57,7 +57,7 @@ Returns the duplicated features in the given layer

};

class QgsFeaturesData
class QgsFeatureData
{
%Docstring
Encapsulate geometry and attributes for new features, to be passed to createFeatures
@@ -72,9 +72,9 @@ Encapsulate geometry and attributes for new features, to be passed to createFeat
%End
public:

QgsFeaturesData( const QgsGeometry &geometry = QgsGeometry(), const QgsAttributeMap &attributes = QgsAttributeMap() );
QgsFeatureData( const QgsGeometry &geometry = QgsGeometry(), const QgsAttributeMap &attributes = QgsAttributeMap() );
%Docstring
Constructs a new QgsFeaturesData with given ``geometry`` and ``attributes``
Constructs a new QgsFeatureData with given ``geometry`` and ``attributes``
%End

QgsGeometry geometry() const;
@@ -89,7 +89,7 @@ Returns attributes

};

typedef QList<QgsVectorLayerUtils::QgsFeaturesData> QgsFeaturesDataList;
typedef QList<QgsVectorLayerUtils::QgsFeatureData> QgsFeaturesDataList;

static QgsFeatureIterator getValuesIterator( const QgsVectorLayer *layer, const QString &fieldOrExpression, bool &ok, bool selectedOnly );
%Docstring
@@ -9023,7 +9023,7 @@ void QgisApp::pasteFromClipboard( QgsMapLayer *destinationLayer )
}
// now create new feature using pasted feature as a template. This automatically handles default
// values and field constraints
newFeaturesDataList << QgsVectorLayerUtils::QgsFeaturesData( geom, attrMap );
newFeaturesDataList << QgsVectorLayerUtils::QgsFeatureData( geom, attrMap );
}

QgsFeatureList newFeatures {QgsVectorLayerUtils::createFeatures( pasteVectorLayer, newFeaturesDataList, &context )};
@@ -359,7 +359,8 @@ bool QgsVectorLayerUtils::validateAttribute( const QgsVectorLayer *layer, const
QgsFeature QgsVectorLayerUtils::createFeature( const QgsVectorLayer *layer, const QgsGeometry &geometry,
const QgsAttributeMap &attributes, QgsExpressionContext *context )
{
return createFeatures( layer, QgsFeaturesDataList() << QgsFeaturesData( geometry, attributes ), context ).first();
QgsFeatureList features { createFeatures( layer, QgsFeaturesDataList() << QgsFeatureData( geometry, attributes ), context ) };
return features.isEmpty() ? QgsFeature() : features.first();
}

QgsFeatureList QgsVectorLayerUtils::createFeatures( const QgsVectorLayer *layer, const QgsFeaturesDataList &featuresData, QgsExpressionContext *context )
@@ -789,17 +790,17 @@ QMap<QgsVectorLayer *, QgsFeatureIds> QgsVectorLayerUtils::QgsDuplicateFeatureC
}
*/

QgsVectorLayerUtils::QgsFeaturesData::QgsFeaturesData( const QgsGeometry &geometry, const QgsAttributeMap &attributes ):
QgsVectorLayerUtils::QgsFeatureData::QgsFeatureData( const QgsGeometry &geometry, const QgsAttributeMap &attributes ):
mGeometry( geometry ),
mAttributes( attributes )
{}

QgsGeometry QgsVectorLayerUtils::QgsFeaturesData::geometry() const
QgsGeometry QgsVectorLayerUtils::QgsFeatureData::geometry() const
{
return mGeometry;
}

QgsAttributeMap QgsVectorLayerUtils::QgsFeaturesData::attributes() const
QgsAttributeMap QgsVectorLayerUtils::QgsFeatureData::attributes() const
{
return mAttributes;
}
@@ -72,19 +72,19 @@ class CORE_EXPORT QgsVectorLayerUtils

/**
* \ingroup core
* \class QgsFeatureSetData
* \class QgsFeatureData
* \brief Encapsulate geometry and attributes for new features, to be passed to createFeatures
* \see createFeatures()
* \since QGIS 3.6
*/
class CORE_EXPORT QgsFeaturesData
class CORE_EXPORT QgsFeatureData
{
public:

/**
* Constructs a new QgsFeaturesData with given \a geometry and \a attributes
* Constructs a new QgsFeatureData with given \a geometry and \a attributes
*/
QgsFeaturesData( const QgsGeometry &geometry = QgsGeometry(), const QgsAttributeMap &attributes = QgsAttributeMap() );
QgsFeatureData( const QgsGeometry &geometry = QgsGeometry(), const QgsAttributeMap &attributes = QgsAttributeMap() );

//! Returns geometry
QgsGeometry geometry() const;
@@ -98,8 +98,8 @@ class CORE_EXPORT QgsVectorLayerUtils
};

// SIP does not lile "using", use legacy typedef
//! Alias for list of QgsFeaturesData
typedef QList<QgsVectorLayerUtils::QgsFeaturesData> QgsFeaturesDataList;
//! Alias for list of QgsFeatureData
typedef QList<QgsVectorLayerUtils::QgsFeatureData> QgsFeaturesDataList;

/**
* Create a feature iterator for a specified field name or expression.

0 comments on commit 490c1fe

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