Skip to content

Commit

Permalink
[Processing][needs-docs] Improve some vector overlay algorithms descr…
Browse files Browse the repository at this point in the history
…iption

* Some algorithms used almost the same label for the second layer and the output one (eg, "difference layer" vs "difference"), making hard to understand the description, in English and once translated.  Overlay label is now used to name the second layer, matching the parameter identifier
* Add more details to description and try to harmonize as far as possible (more convenient for readers and translators)
* The union algorithm behavior changed deeply but its description got no updates
  • Loading branch information
DelazJ authored and nyalldawson committed Aug 31, 2018
1 parent e0fa9eb commit 91cebc4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
13 changes: 7 additions & 6 deletions src/analysis/processing/qgsalgorithmclip.cpp
Expand Up @@ -49,18 +49,19 @@ QString QgsClipAlgorithm::groupId() const
void QgsClipAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Clip layer" ), QList< int >() << QgsProcessing::TypeVectorPolygon ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Overlay layer" ), QList< int >() << QgsProcessing::TypeVectorPolygon ) );

addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Clipped" ) ) );
}

QString QgsClipAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm clips a vector layer using the polygons of an additional polygons layer. Only the parts of the features "
"in the input layer that falls within the polygons of the clipping layer will be added to the resulting layer.\n\n"
"The attributes of the features are not modified, although properties such as area or length of the features will "
"be modified by the clipping operation. If such properties are stored as attributes, those attributes will have to "
"be manually updated." );
return QObject::tr( "This algorithm clips a vector layer using the features of an additional polygon layer. Only the parts of the features "
"in the Input layer that fall within the polygons of the Overlay layer will be added to the resulting layer." )
+ QStringLiteral( "\n\n" )
+ QObject::tr( "The attributes of the features are not modified, although properties such as area or length of the features will "
"be modified by the clipping operation. If such properties are stored as attributes, those attributes will have to "
"be manually updated." );
}

QgsClipAlgorithm *QgsClipAlgorithm::createInstance() const
Expand Down
10 changes: 7 additions & 3 deletions src/analysis/processing/qgsalgorithmdifference.cpp
Expand Up @@ -42,9 +42,13 @@ QString QgsDifferenceAlgorithm::groupId() const

QString QgsDifferenceAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm extracts features from the Input layer that fall outside, or partially overlap, features in the Difference layer. Input layer features that partially overlap the difference layer feature(s) are split along the boundary of the difference layer feature(s) and only the portions outside the difference layer features are retained." )
return QObject::tr( "This algorithm extracts features from the Input layer that fall outside, or partially overlap, features in the Overlay layer. "
"Input layer features that partially overlap feature(s) in the Overlay layer are split along those features' boundary "
"and only the portions outside the Overlay layer features are retained." )
+ QStringLiteral( "\n\n" )
+ QObject::tr( "Attributes are not modified." );
+ QObject::tr( "Attributes are not modified, although properties such as area or length of the features will "
"be modified by the difference operation. If such properties are stored as attributes, those attributes will have to "
"be manually updated." );
}

QgsProcessingAlgorithm *QgsDifferenceAlgorithm::createInstance() const
Expand All @@ -55,7 +59,7 @@ QgsProcessingAlgorithm *QgsDifferenceAlgorithm::createInstance() const
void QgsDifferenceAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Difference layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Overlay layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Difference" ) ) );
}

Expand Down
6 changes: 4 additions & 2 deletions src/analysis/processing/qgsalgorithmintersection.cpp
Expand Up @@ -44,7 +44,9 @@ QString QgsIntersectionAlgorithm::groupId() const

QString QgsIntersectionAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm extracts the overlapping portions of features in the Input and Overlay layers. Features in the Overlay layer are assigned the attributes of the overlapping features from both the Input and Overlay layers." );
return QObject::tr( "This algorithm extracts the overlapping portions of features in the Input and Overlay layers. "
"Features in the output Intersection layer are assigned the attributes of the overlapping features "
"from both the Input and Overlay layers." );
}

QgsProcessingAlgorithm *QgsIntersectionAlgorithm::createInstance() const
Expand All @@ -55,7 +57,7 @@ QgsProcessingAlgorithm *QgsIntersectionAlgorithm::createInstance() const
void QgsIntersectionAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Intersection layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Overlay layer" ) ) );

addParameter( new QgsProcessingParameterField(
QStringLiteral( "INPUT_FIELDS" ),
Expand Down
6 changes: 4 additions & 2 deletions src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp
Expand Up @@ -41,7 +41,9 @@ QString QgsSymmetricalDifferenceAlgorithm::groupId() const

QString QgsSymmetricalDifferenceAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm creates a layer containing features from both the Input and Difference layers but with the overlapping areas between the two layers removed. The attribute table of the Symmetrical Difference layer contains attributes from both the Input and Difference layers." );
return QObject::tr( "This algorithm extracts the portions of features from both the Input and Overlay layers that do not overlap. "
"Overlapping areas between the two layers are removed. The attribute table of the Symmetrical Difference layer "
"contains original attributes from both the Input and Difference layers." );
}

QgsProcessingAlgorithm *QgsSymmetricalDifferenceAlgorithm::createInstance() const
Expand All @@ -52,7 +54,7 @@ QgsProcessingAlgorithm *QgsSymmetricalDifferenceAlgorithm::createInstance() cons
void QgsSymmetricalDifferenceAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Difference layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Overlay layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Symmetrical difference" ) ) );
}

Expand Down
11 changes: 9 additions & 2 deletions src/analysis/processing/qgsalgorithmunion.cpp
Expand Up @@ -42,7 +42,14 @@ QString QgsUnionAlgorithm::groupId() const

QString QgsUnionAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm creates a layer containing all the features from both input layers. In the case of polygon layers, separate features are created for overlapping and non-overlapping features. The attribute table of the union layer contains attribute values from the respective input layer for non-overlapping features, and attribute values from both input layers for overlapping features." );
return QObject::tr( "This algorithm checks overlaps between features within the Input layer and creates separate features for overlapping "
"and non-overlapping parts. The area of overlap will create as many identical overlapping features as there are "
"features that participate in that overlap." )
+ QStringLiteral( "\n\n" )
+ QObject::tr( "An Overlay layer can also be used, in which case features from each layer are split at their overlap with features from "
"the other one, creating a layer containing all the portions from both Input and Overlay layers. "
"The attribute table of the Union layer is filled with attribute values from the respective original layer "
"for non-overlapping features, and attribute values from both layers for overlapping features." );
}

QgsProcessingAlgorithm *QgsUnionAlgorithm::createInstance() const
Expand All @@ -53,7 +60,7 @@ QgsProcessingAlgorithm *QgsUnionAlgorithm::createInstance() const
void QgsUnionAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Union layer" ), QList< int >(), QVariant(), true ) );
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "OVERLAY" ), QObject::tr( "Overlay layer" ), QList< int >(), QVariant(), true ) );

addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Union" ) ) );
}
Expand Down

0 comments on commit 91cebc4

Please sign in to comment.