mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
harmonize join type value (0=one-to-many, 1=one-to-one)
This commit is contained in:
parent
1542b484be
commit
2073562fa5
@ -2774,7 +2774,6 @@ tests:
|
||||
- algorithm: native:joinattributestable
|
||||
name: join the attribute table by common field (one-to-one)
|
||||
params:
|
||||
METHOD: 0
|
||||
INPUT:
|
||||
name: points.gml
|
||||
type: vector
|
||||
@ -2791,7 +2790,7 @@ tests:
|
||||
- algorithm: native:joinattributestable
|
||||
name: join the attribute table by common field, discard non matching (one-to-one)
|
||||
params:
|
||||
METHOD: 0
|
||||
METHOD: 1
|
||||
INPUT:
|
||||
name: points.gml
|
||||
type: vector
|
||||
@ -2809,7 +2808,7 @@ tests:
|
||||
- algorithm: native:joinattributestable
|
||||
name: join the attribute table by common field (one-to-many)
|
||||
params:
|
||||
METHOD: 1
|
||||
METHOD: 0
|
||||
INPUT:
|
||||
name: points.gml
|
||||
type: vector
|
||||
@ -2826,7 +2825,6 @@ tests:
|
||||
- algorithm: native:joinattributestable
|
||||
name: Join attributes table with subset of fields
|
||||
params:
|
||||
METHOD: 0
|
||||
FIELD: id
|
||||
FIELDS_TO_COPY:
|
||||
- NUM_A
|
||||
|
@ -47,8 +47,8 @@ QString QgsJoinByAttributeAlgorithm::groupId() const
|
||||
void QgsJoinByAttributeAlgorithm::initAlgorithm( const QVariantMap & )
|
||||
{
|
||||
QStringList methods;
|
||||
methods << QObject::tr( "Take attributes of the first matching feature only (one-to-one)" )
|
||||
<< QObject::tr( "Create separate feature for each matching feature (one-to-many)" );
|
||||
methods << QObject::tr( "Create separate feature for each matching feature (one-to-many)" )
|
||||
<< QObject::tr( "Take attributes of the first matching feature only (one-to-one)" );
|
||||
|
||||
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ),
|
||||
QObject::tr( "Input layer" ), QList< int>() << QgsProcessing::TypeVector ) );
|
||||
@ -67,7 +67,7 @@ void QgsJoinByAttributeAlgorithm::initAlgorithm( const QVariantMap & )
|
||||
|
||||
addParameter( new QgsProcessingParameterEnum( QStringLiteral( "METHOD" ),
|
||||
QObject::tr( "Join type" ),
|
||||
methods, false, 0 ) );
|
||||
methods, false, 1 ) );
|
||||
addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "DISCARD_NONMATCHING" ),
|
||||
QObject::tr( "Discard records which could not be joined" ),
|
||||
false ) );
|
||||
@ -158,7 +158,7 @@ QVariantMap QgsJoinByAttributeAlgorithm::processAlgorithm( const QVariantMap &pa
|
||||
|
||||
feedback->setProgress( i * step );
|
||||
|
||||
if ( joinMethod == 0 && input2AttributeCache.contains( feat.attribute( joinField2Index ) ) )
|
||||
if ( joinMethod == 1 && input2AttributeCache.contains( feat.attribute( joinField2Index ) ) )
|
||||
continue;
|
||||
|
||||
// only keep selected attributes
|
||||
|
Loading…
x
Reference in New Issue
Block a user