mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Some minor changes
- QgsVectorLayer * - make a const copy of a const container - typo and comments
This commit is contained in:
parent
fb47dd930d
commit
a8dbb5395c
@ -177,12 +177,13 @@ are padded with NULL values to match the required length).
|
|||||||
.. versionadded:: 3.4
|
.. versionadded:: 3.4
|
||||||
%End
|
%End
|
||||||
|
|
||||||
static const QgsFeatureList makeFeatureCompatible( const QgsFeature &feature, const QgsVectorLayer &layer );
|
static const QgsFeatureList makeFeatureCompatible( const QgsFeature &feature, const QgsVectorLayer *layer );
|
||||||
%Docstring
|
%Docstring
|
||||||
Converts input ``feature`` to be compatible with the given ``layer``.
|
Converts input ``feature`` to be compatible with the given ``layer``.
|
||||||
|
|
||||||
This function returns a new list of transformed features compatible with the input
|
This function returns a new list of transformed features compatible with the input
|
||||||
layer, note that the number of features returned might be greater than one.
|
layer, note that the number of features returned might be greater than one when
|
||||||
|
converting a multi part geometry to single part
|
||||||
|
|
||||||
The following operations will be performed to convert the input features:
|
The following operations will be performed to convert the input features:
|
||||||
- convert single geometries to multi part
|
- convert single geometries to multi part
|
||||||
@ -196,13 +197,13 @@ The following operations will be performed to convert the input features:
|
|||||||
.. versionadded:: 3.4
|
.. versionadded:: 3.4
|
||||||
%End
|
%End
|
||||||
|
|
||||||
static const QgsFeatureList makeFeaturesCompatible( const QgsFeatureList &features, const QgsVectorLayer &layer );
|
static const QgsFeatureList makeFeaturesCompatible( const QgsFeatureList &features, const QgsVectorLayer *layer );
|
||||||
%Docstring
|
%Docstring
|
||||||
Converts input ``features`` to be compatible with the given ``layer``.
|
Converts input ``features`` to be compatible with the given ``layer``.
|
||||||
|
|
||||||
This function returns a new list of transformed features compatible with the input
|
This function returns a new list of transformed features compatible with the input
|
||||||
layer, note that the number of features returned might be greater than the number
|
layer, note that the number of features returned might be greater than the number
|
||||||
of input featurers.
|
of input features.
|
||||||
|
|
||||||
The following operations will be performed to convert the input features:
|
The following operations will be performed to convert the input features:
|
||||||
- convert single geometries to multi part
|
- convert single geometries to multi part
|
||||||
|
@ -561,13 +561,13 @@ void QgsVectorLayerUtils::matchAttributesToFields( QgsFeature &feature, const Qg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QgsFeatureList QgsVectorLayerUtils::makeFeatureCompatible( const QgsFeature &feature, const QgsVectorLayer &layer )
|
const QgsFeatureList QgsVectorLayerUtils::makeFeatureCompatible( const QgsFeature &feature, const QgsVectorLayer *layer )
|
||||||
{
|
{
|
||||||
QgsWkbTypes::Type inputWkbType( layer.wkbType( ) );
|
QgsWkbTypes::Type inputWkbType( layer->wkbType( ) );
|
||||||
QgsFeatureList resultFeatures;
|
QgsFeatureList resultFeatures;
|
||||||
QgsFeature newF( feature );
|
QgsFeature newF( feature );
|
||||||
// Fix attributes
|
// Fix attributes
|
||||||
QgsVectorLayerUtils::matchAttributesToFields( newF, layer.fields( ) );
|
QgsVectorLayerUtils::matchAttributesToFields( newF, layer->fields( ) );
|
||||||
// Does geometry need transformations?
|
// Does geometry need transformations?
|
||||||
QgsWkbTypes::GeometryType newFGeomType( QgsWkbTypes::geometryType( newF.geometry().wkbType() ) );
|
QgsWkbTypes::GeometryType newFGeomType( QgsWkbTypes::geometryType( newF.geometry().wkbType() ) );
|
||||||
bool newFHasGeom = newFGeomType !=
|
bool newFHasGeom = newFGeomType !=
|
||||||
@ -579,7 +579,7 @@ const QgsFeatureList QgsVectorLayerUtils::makeFeatureCompatible( const QgsFeatur
|
|||||||
// Drop geometry if layer is geometry-less
|
// Drop geometry if layer is geometry-less
|
||||||
if ( newFHasGeom && ! layerHasGeom )
|
if ( newFHasGeom && ! layerHasGeom )
|
||||||
{
|
{
|
||||||
QgsFeature _f = QgsFeature( layer.fields() );
|
QgsFeature _f = QgsFeature( layer->fields() );
|
||||||
_f.setAttributes( newF.attributes() );
|
_f.setAttributes( newF.attributes() );
|
||||||
resultFeatures.append( _f );
|
resultFeatures.append( _f );
|
||||||
}
|
}
|
||||||
@ -634,7 +634,7 @@ const QgsFeatureList QgsVectorLayerUtils::makeFeatureCompatible( const QgsFeatur
|
|||||||
for ( int i = 0; i < parts->partCount( ); i++ )
|
for ( int i = 0; i < parts->partCount( ); i++ )
|
||||||
{
|
{
|
||||||
QgsGeometry g( parts->geometryN( i )->clone() );
|
QgsGeometry g( parts->geometryN( i )->clone() );
|
||||||
QgsFeature _f( createFeature( &layer, g, attrMap ) );
|
QgsFeature _f( createFeature( layer, g, attrMap ) );
|
||||||
resultFeatures.append( _f );
|
resultFeatures.append( _f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -651,12 +651,13 @@ const QgsFeatureList QgsVectorLayerUtils::makeFeatureCompatible( const QgsFeatur
|
|||||||
return resultFeatures;
|
return resultFeatures;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QgsFeatureList QgsVectorLayerUtils::makeFeaturesCompatible( const QgsFeatureList &features, const QgsVectorLayer &layer )
|
const QgsFeatureList QgsVectorLayerUtils::makeFeaturesCompatible( const QgsFeatureList &features, const QgsVectorLayer *layer )
|
||||||
{
|
{
|
||||||
QgsFeatureList resultFeatures;
|
QgsFeatureList resultFeatures;
|
||||||
for ( const QgsFeature &f : features )
|
for ( const QgsFeature &f : features )
|
||||||
{
|
{
|
||||||
for ( const auto &_f : makeFeatureCompatible( f, layer ) )
|
const QgsFeatureList features( makeFeatureCompatible( f, layer ) );
|
||||||
|
for ( const auto &_f : features )
|
||||||
{
|
{
|
||||||
resultFeatures.append( _f );
|
resultFeatures.append( _f );
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,8 @@ class CORE_EXPORT QgsVectorLayerUtils
|
|||||||
* Converts input \a feature to be compatible with the given \a layer.
|
* Converts input \a feature to be compatible with the given \a layer.
|
||||||
*
|
*
|
||||||
* This function returns a new list of transformed features compatible with the input
|
* This function returns a new list of transformed features compatible with the input
|
||||||
* layer, note that the number of features returned might be greater than one.
|
* layer, note that the number of features returned might be greater than one when
|
||||||
|
* converting a multi part geometry to single part
|
||||||
*
|
*
|
||||||
* The following operations will be performed to convert the input features:
|
* The following operations will be performed to convert the input features:
|
||||||
* - convert single geometries to multi part
|
* - convert single geometries to multi part
|
||||||
@ -205,14 +206,14 @@ class CORE_EXPORT QgsVectorLayerUtils
|
|||||||
*
|
*
|
||||||
* \since QGIS 3.4
|
* \since QGIS 3.4
|
||||||
*/
|
*/
|
||||||
static const QgsFeatureList makeFeatureCompatible( const QgsFeature &feature, const QgsVectorLayer &layer );
|
static const QgsFeatureList makeFeatureCompatible( const QgsFeature &feature, const QgsVectorLayer *layer );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts input \a features to be compatible with the given \a layer.
|
* Converts input \a features to be compatible with the given \a layer.
|
||||||
*
|
*
|
||||||
* This function returns a new list of transformed features compatible with the input
|
* This function returns a new list of transformed features compatible with the input
|
||||||
* layer, note that the number of features returned might be greater than the number
|
* layer, note that the number of features returned might be greater than the number
|
||||||
* of input featurers.
|
* of input features.
|
||||||
*
|
*
|
||||||
* The following operations will be performed to convert the input features:
|
* The following operations will be performed to convert the input features:
|
||||||
* - convert single geometries to multi part
|
* - convert single geometries to multi part
|
||||||
@ -225,7 +226,7 @@ class CORE_EXPORT QgsVectorLayerUtils
|
|||||||
*
|
*
|
||||||
* \since QGIS 3.4
|
* \since QGIS 3.4
|
||||||
*/
|
*/
|
||||||
static const QgsFeatureList makeFeaturesCompatible( const QgsFeatureList &features, const QgsVectorLayer &layer );
|
static const QgsFeatureList makeFeaturesCompatible( const QgsFeatureList &features, const QgsVectorLayer *layer );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user