Skip to content
Permalink
Browse files
Relabel "join by location..." algorithms inputs
  • Loading branch information
DelazJ authored and nyalldawson committed Nov 4, 2021
1 parent d4876f3 commit 7a2ae423ed13d69a0c5fe41dd0a128cdd6dd1abe
Showing with 24 additions and 24 deletions.
  1. +12 −12 python/plugins/processing/algs/qgis/SpatialJoinSummary.py
  2. +12 −12 src/analysis/processing/qgsalgorithmjoinbylocation.cpp
@@ -81,13 +81,13 @@ def svgIconPath(self):

def initAlgorithm(self, config=None):
self.predicates = (
('intersects', self.tr('intersects')),
('contains', self.tr('contains')),
('isEqual', self.tr('equals')),
('touches', self.tr('touches')),
('overlaps', self.tr('overlaps')),
('within', self.tr('within')),
('crosses', self.tr('crosses')))
('intersects', self.tr('intersect')),
('contains', self.tr('contain')),
('isEqual', self.tr('equal')),
('touches', self.tr('touch')),
('overlaps', self.tr('overlap')),
('within', self.tr('are within')),
('crosses', self.tr('cross')))

self.statistics = [
('count', self.tr('count')),
@@ -111,20 +111,20 @@ def initAlgorithm(self, config=None):
('mean_length', self.tr('mean_length'))]

self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Base layer'),
[QgsProcessing.TypeVectorAnyGeometry]))
self.addParameter(QgsProcessingParameterFeatureSource(self.JOIN,
self.tr('Join layer'),
self.tr('Join to features in'),
[QgsProcessing.TypeVectorAnyGeometry]))
predicate = QgsProcessingParameterEnum(self.PREDICATE,
self.tr('Geometric predicate'),
self.tr('Features they (geometric predicate)'),
options=[p[1] for p in self.predicates],
allowMultiple=True, defaultValue=[0])
predicate.setMetadata({
'widget_wrapper': {
'useCheckBoxes': True,
'columns': 2}})
self.addParameter(predicate)
self.addParameter(QgsProcessingParameterFeatureSource(self.JOIN,
self.tr('By comparing to'),
[QgsProcessing.TypeVectorAnyGeometry]))
self.addParameter(QgsProcessingParameterField(self.JOIN_FIELDS,
self.tr('Fields to summarise (leave empty to use all fields)'),
parentLayerParameterName=self.JOIN,
@@ -29,27 +29,27 @@
void QgsJoinByLocationAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ),
QObject::tr( "Base Layer" ), QList< int > () << QgsProcessing::QgsProcessing::TypeVectorAnyGeometry ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "JOIN" ),
QObject::tr( "Join Layer" ), QList< int > () << QgsProcessing::QgsProcessing::TypeVectorAnyGeometry ) );
QObject::tr( "Join to features in" ), QList< int > () << QgsProcessing::QgsProcessing::TypeVectorAnyGeometry ) );

QStringList predicates;
predicates << QObject::tr( "intersects" )
<< QObject::tr( "contains" )
<< QObject::tr( "equals" )
<< QObject::tr( "touches" )
<< QObject::tr( "overlaps" )
<< QObject::tr( "within" )
<< QObject::tr( "crosses" );

std::unique_ptr< QgsProcessingParameterEnum > predicateParam = std::make_unique< QgsProcessingParameterEnum >( QStringLiteral( "PREDICATE" ), QObject::tr( "Geometric predicate" ), predicates, true, 0 );
predicates << QObject::tr( "intersect" )
<< QObject::tr( "contain" )
<< QObject::tr( "equal" )
<< QObject::tr( "touch" )
<< QObject::tr( "overlap" )
<< QObject::tr( "are within" )
<< QObject::tr( "cross" );

std::unique_ptr< QgsProcessingParameterEnum > predicateParam = std::make_unique< QgsProcessingParameterEnum >( QStringLiteral( "PREDICATE" ), QObject::tr( "Features they (geometric predicate)" ), predicates, true, 0 );
QVariantMap predicateMetadata;
QVariantMap widgetMetadata;
widgetMetadata.insert( QStringLiteral( "useCheckBoxes" ), true );
widgetMetadata.insert( QStringLiteral( "columns" ), 2 );
predicateMetadata.insert( QStringLiteral( "widget_wrapper" ), widgetMetadata );
predicateParam->setMetadata( predicateMetadata );
addParameter( predicateParam.release() );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "JOIN" ),
QObject::tr( "By comparing to" ), QList< int > () << QgsProcessing::QgsProcessing::TypeVectorAnyGeometry ) );
addParameter( new QgsProcessingParameterField( QStringLiteral( "JOIN_FIELDS" ),
QObject::tr( "Fields to add (leave empty to use all fields)" ),
QVariant(), QStringLiteral( "JOIN" ), QgsProcessingParameterField::Any, true, true ) );

0 comments on commit 7a2ae42

Please sign in to comment.