mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-05 00:04:40 -05:00
Harmonize geometry-based parameters name in expression
using 'geometry1' instead of 'geometry_a' or 'geometry a'
This commit is contained in:
parent
6a30dd2b48
commit
3846b04f0a
@ -2,9 +2,9 @@
|
||||
"name": "contains",
|
||||
"type": "function",
|
||||
"groups": ["GeometryGroup"],
|
||||
"description": "Tests whether a geometry contains another. Returns true if and only if no points of geometry b lie in the exterior of geometry a, and at least one point of the interior of b lies in the interior of a.",
|
||||
"arguments": [ {"arg":"geometry a","description":"a geometry"},
|
||||
{"arg":"geometry b","description":"a geometry"}],
|
||||
"description": "Tests whether a geometry contains another. Returns true if and only if no points of geometry2 lie in the exterior of geometry1, and at least one point of the interior of geometry2 lies in the interior of geometry1.",
|
||||
"arguments": [ {"arg":"geometry1","description":"a geometry"},
|
||||
{"arg":"geometry2","description":"a geometry"}],
|
||||
"examples": [ { "expression":"contains( geom_from_wkt( 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))' ), geom_from_wkt( 'POINT(0.5 0.5 )' ) )", "returns":"true"},
|
||||
{ "expression":"contains( geom_from_wkt( 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"false"}
|
||||
]
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
"type": "function",
|
||||
"groups": ["GeometryGroup"],
|
||||
"description": "Tests whether a geometry crosses another. Returns true if the supplied geometries have some, but not all, interior points in common.",
|
||||
"arguments": [ {"arg":"geometry a","description":"a geometry"},
|
||||
{"arg":"geometry b","description":"a geometry"}],
|
||||
"arguments": [ {"arg":"geometry1","description":"a geometry"},
|
||||
{"arg":"geometry2","description":"a geometry"}],
|
||||
"examples": [ { "expression":"crosses( geom_from_wkt( 'LINESTRING(3 5, 4 4, 5 3)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"true"},
|
||||
{ "expression":"crosses( geom_from_wkt( 'POINT(4 5)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"false"}
|
||||
]
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
"name": "difference",
|
||||
"type": "function",
|
||||
"groups": ["GeometryGroup"],
|
||||
"description": "Returns a geometry that represents that part of geometry_a that does not intersect with geometry_b.",
|
||||
"arguments": [ {"arg":"geometry_a","description":"a geometry"},
|
||||
{"arg":"geometry_b","description":"a geometry"}],
|
||||
"description": "Returns a geometry that represents that part of geometry1 that does not intersect with geometry2.",
|
||||
"arguments": [ {"arg":"geometry1","description":"a geometry"},
|
||||
{"arg":"geometry2","description":"a geometry"}],
|
||||
"examples": [ { "expression":"geom_to_wkt( difference( geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4)' ) ) )", "returns":"LINESTRING(4 4, 5 5)"} ]
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
"type": "function",
|
||||
"groups": ["GeometryGroup"],
|
||||
"description": "Tests whether geometries do not spatially intersect. Returns true if the geometries do not share any space together.",
|
||||
"arguments": [ {"arg":"geometry a","description":"a geometry"},
|
||||
{"arg":"geometry b","description":"a geometry"}],
|
||||
"arguments": [ {"arg":"geometry1","description":"a geometry"},
|
||||
{"arg":"geometry2","description":"a geometry"}],
|
||||
"examples": [ { "expression":"disjoint( geom_from_wkt( 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0 ))' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"true"},
|
||||
{ "expression":"disjoint( geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ), geom_from_wkt( 'POINT(4 4)' ))", "returns":"false"}
|
||||
]
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
"type": "function",
|
||||
"groups": ["GeometryGroup"],
|
||||
"description": "Returns the minimum distance (based on spatial ref) between two geometries in projected units.",
|
||||
"arguments": [ {"arg":"geometry a","description":"a geometry"},
|
||||
{"arg":"geometry b","description":"a geometry"}],
|
||||
"arguments": [ {"arg":"geometry1","description":"a geometry"},
|
||||
{"arg":"geometry2","description":"a geometry"}],
|
||||
"examples": [ { "expression":"distance( geom_from_wkt( 'POINT(4 4)' ), geom_from_wkt( 'POINT(4 8)' ) )", "returns":"4"}
|
||||
]
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
"type": "function",
|
||||
"groups": ["GeometryGroup"],
|
||||
"description": "Returns the Hausdorff distance between two geometries. This is basically a measure of how similar or dissimilar 2 geometries are, with a lower distance indicating more similar geometries.<br>The function can be executed with an optional densify fraction argument. If not specified, an approximation to the standard Hausdorff distance is used. This approximation is exact or close enough for a large subset of useful cases. Examples of these are:<br><br><li>computing distance between Linestrings that are roughly parallel to each other, and roughly equal in length. This occurs in matching linear networks.</li><li>Testing similarity of geometries.</li><br><br>If the default approximate provided by this method is insufficient, specify the optional densify fraction argument. Specifying this argument performs a segment densification before computing the discrete Hausdorff distance. The parameter sets the fraction by which to densify each segment. Each segment will be split into a number of equal-length subsegments, whose fraction of the total length is closest to the given fraction. Decreasing the densify fraction parameter will make the distance returned approach the true Hausdorff distance for the geometries.",
|
||||
"arguments": [ {"arg":"geometry a","description":"a geometry"},
|
||||
{"arg":"geometry b","description":"a geometry"},
|
||||
"arguments": [ {"arg":"geometry1","description":"a geometry"},
|
||||
{"arg":"geometry2","description":"a geometry"},
|
||||
{"arg":"densify_fraction","description":"densify fraction amount", "optional":true}],
|
||||
"examples": [ { "expression":"hausdorff_distance( geometry1:= geom_from_wkt('LINESTRING (0 0, 2 1)'),geometry2:=geom_from_wkt('LINESTRING (0 0, 2 0)'))", "returns":"2"},
|
||||
{ "expression":"hausdorff_distance( geom_from_wkt('LINESTRING (130 0, 0 0, 0 150)'),geom_from_wkt('LINESTRING (10 10, 10 150, 130 10)'))", "returns":"14.142135623"},
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
"type": "function",
|
||||
"groups": ["GeometryGroup"],
|
||||
"description": "Tests whether a geometry intersects another. Returns true if the geometries spatially intersect (share any portion of space) and false if they do not.",
|
||||
"arguments": [ {"arg":"geometry a","description":"a geometry"},
|
||||
{"arg":"geometry b","description":"a geometry"}],
|
||||
"arguments": [ {"arg":"geometry1","description":"a geometry"},
|
||||
{"arg":"geometry2","description":"a geometry"}],
|
||||
"examples": [ { "expression":"intersects( geom_from_wkt( 'POINT(4 4)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"true"},
|
||||
{ "expression":"intersects( geom_from_wkt( 'POINT(4 5)' ), geom_from_wkt( 'POINT(5 5)' ) )", "returns":"false"}
|
||||
]
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
"type": "function",
|
||||
"groups": ["GeometryGroup"],
|
||||
"description": "Tests whether a geometry overlaps another. Returns true if the geometries share space, are of the same dimension, but are not completely contained by each other.",
|
||||
"arguments": [ {"arg":"geometry a","description":"a geometry"},
|
||||
{"arg":"geometry b","description":"a geometry"}],
|
||||
"arguments": [ {"arg":"geometry1","description":"a geometry"},
|
||||
{"arg":"geometry2","description":"a geometry"}],
|
||||
"examples": [ { "expression":"overlaps( geom_from_wkt( 'LINESTRING(3 5, 4 4, 5 5, 5 3)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"true"},
|
||||
{ "expression":"overlaps( geom_from_wkt( 'LINESTRING(0 0, 1 1)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"false"}
|
||||
]
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
"type": "function",
|
||||
"groups": ["GeometryGroup"],
|
||||
"description": "Tests whether a geometry touches another. Returns true if the geometries have at least one point in common, but their interiors do not intersect.",
|
||||
"arguments": [ {"arg":"geometry a","description":"a geometry"},
|
||||
{"arg":"geometry b","description":"a geometry"}],
|
||||
"arguments": [ {"arg":"geometry1","description":"a geometry"},
|
||||
{"arg":"geometry2","description":"a geometry"}],
|
||||
"examples": [ { "expression":"touches( geom_from_wkt( 'LINESTRING(5 3, 4 4)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"true"},
|
||||
{ "expression":"touches( geom_from_wkt( 'POINT(4 4)' ), geom_from_wkt( 'POINT(5 5)' ) )", "returns":"false"}
|
||||
]
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
"name": "within",
|
||||
"type": "function",
|
||||
"groups": ["GeometryGroup"],
|
||||
"description": "Tests whether a geometry is within another. Returns true if the geometry a is completely within geometry b.",
|
||||
"arguments": [ {"arg":"geometry a","description":"a geometry"},
|
||||
{"arg":"geometry b","description":"a geometry"}],
|
||||
"description": "Tests whether a geometry is within another. Returns true if the geometry1 is completely within geometry2.",
|
||||
"arguments": [ {"arg":"geometry1","description":"a geometry"},
|
||||
{"arg":"geometry2","description":"a geometry"}],
|
||||
"examples": [ { "expression":"within( geom_from_wkt( 'POINT( 0.5 0.5)' ), geom_from_wkt( 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))' ) )", "returns":"true"},
|
||||
{ "expression":"within( geom_from_wkt( 'POINT( 5 5 )' ), geom_from_wkt( 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0 ))' ) )", "returns":"false"}
|
||||
]
|
||||
|
||||
@ -6114,26 +6114,26 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "flip_coordinates" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry" ) ), fcnFlipCoordinates, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "relate" ), -1, fcnRelate, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "intersects_bbox" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "geometry" ) ), fcnBbox, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>(), false, QStringList() << QStringLiteral( "bbox" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "disjoint" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ),
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "disjoint" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
fcnDisjoint, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "intersects" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ),
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "intersects" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
fcnIntersects, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "touches" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ),
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "touches" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
fcnTouches, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "crosses" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ),
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "crosses" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
fcnCrosses, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "contains" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ),
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "contains" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
fcnContains, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "overlaps" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ),
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "overlaps" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
fcnOverlaps, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "within" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ),
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "within" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
fcnWithin, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "translate" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "dx" ) )
|
||||
@ -6217,17 +6217,17 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "segments" ), true, 36 ),
|
||||
fcnMinimalCircle, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "difference" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry_a" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry_b" ) ),
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "difference" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
fcnDifference, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "distance" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ),
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "distance" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
fcnDistance, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "hausdorff_distance" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "densify_fraction" ), true ),
|
||||
fcnHausdorffDistance, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "intersection" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry_a" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry_b" ) ),
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "intersection" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
fcnIntersection, QStringLiteral( "GeometryGroup" ) )
|
||||
<< new QgsStaticExpressionFunction( QStringLiteral( "sym_difference" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ),
|
||||
|
||||
@ -91,6 +91,10 @@ QString QgsExpressionNode::NodeList::cleanNamedNodeName( const QString &name )
|
||||
cleaned = QStringLiteral( "geometry" );
|
||||
else if ( cleaned == QLatin1String( "val" ) )
|
||||
cleaned = QStringLiteral( "value" );
|
||||
else if ( cleaned == QLatin1String( "geometry a" ) or cleaned == QLatin1String( "geometry_a" )
|
||||
cleaned = QStringLiteral( "geometry1" );
|
||||
else if ( cleaned == QLatin1String( "geometry b" ) or cleaned == QLatin1String( "geometry_b" )
|
||||
cleaned = QStringLiteral( "geometry2" );
|
||||
|
||||
return cleaned;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user