Skip to content

Commit

Permalink
Merge pull request #37780 from DelazJ/display_expression
Browse files Browse the repository at this point in the history
Swap display_expression parameters order
  • Loading branch information
m-kuhn committed Jul 14, 2020
2 parents 56613de + e6f3c7f commit e8704f0
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 56 deletions.
53 changes: 25 additions & 28 deletions resources/function_help/json/display_expression
Expand Up @@ -2,39 +2,36 @@
"name": "display_expression",
"type": "function",
"groups": ["Record and Attributes"],
"description": "Returns the display expression for a given feature in a layer. If called with no parameters, it evaluates the current feature. The expression is evaluated by default.",
"arguments": [
"description": "Returns the display expression for a given feature in a layer. The expression is evaluated by default. Can be used with zero, one or more arguments, see below for details.",
"variants": [
{
"arg": "feature",
"optional": true,
"default": "current feature",
"description": "The feature which should be evaluated."
"variant": "No parameters",
"variant_description": "If called with no parameters, the function will evaluate the display expression of the current feature in the current layer.",
"arguments": [],
"examples": [ { "expression": "display_expression()", "returns" : "The display expression of the current feature in the current layer." } ]
},
{
"arg": "layer",
"optional": true,
"default": "current layer",
"description": "The layer (or its id or name)."
"variant": "One 'feature' parameter",
"variant_description": "If called with a 'feature' parameter only, the function will evaluate the specified feature from the current layer.",
"arguments": [ { "arg": "feature", "description": "The feature which should be evaluated." } ],
"examples": [ { "expression": "display_expression(@atlas_feature)", "returns": "The display expression of the current atlas feature." } ]
},
{
"arg": "evaluate",
"description": "If the expression must be evaluated. If false, the expression will be returned as a string literal only (which could potentially be later evaluated using the 'eval' function).",
"optional": true,
"default": "true"
}
],
"examples": [
{
"expression": "display_expression()",
"returns": "The display expression of the current feature."
},
{
"expression": "display_expression(get_feature_by_id('streets', 1), 'streets')",
"returns": "The display expression of the feature with the ID 1 on the layer 'streets'."
},
{
"expression": "display_expression('a_layer_id', $currentfeature, 'False')",
"returns": "The display expression of the given feature not evaluated."
"variant" : "Layer and feature parameters",
"variant_description": "If the function is called with both a layer and a feature, it will evaluate the specified feature from the specified layer.",
"arguments": [
{ "arg": "layer", "description": "The layer (or its ID or name)" },
{ "arg": "feature", "description": "The feature which should be evaluated." },
{ "arg": "evaluate", "description": "If the expression must be evaluated. If false, the expression will be returned as a string literal only (which could potentially be later evaluated using the 'eval' function).", "optional": true, "default": "true" }
],
"examples": [
{ "expression": "display_expression( 'streets', get_feature_by_id('streets', 1))",
"returns": "The display expression of the feature with the ID 1 on the layer 'streets'."
},
{ "expression": "display_expression('a_layer_id', $currentfeature, 'False')",
"returns": "The display expression of the given feature not evaluated."
}
]
}
]
}
53 changes: 25 additions & 28 deletions resources/function_help/json/maptip
Expand Up @@ -2,39 +2,36 @@
"name": "maptip",
"type": "function",
"groups": ["Record and Attributes"],
"description": "Returns the maptip for a given feature in a layer. If called with no parameters, it evaluates the current feature. The maptip is evaluated by default.",
"arguments": [
"description": "Returns the maptip for a given feature in a layer. The expression is evaluated by default. Can be used with zero, one or more arguments, see below for details.",
"variants": [
{
"arg": "feature",
"optional": true,
"default": "current feature",
"description": "The feature which should be evaluated."
"variant": "No parameters",
"variant_description": "If called with no parameters, the function will evaluate the maptip of the current feature in the current layer.",
"arguments": [],
"examples": [ { "expression": "maptip()", "returns" : "The maptip of the current feature in the current layer." } ]
},
{
"arg": "layer",
"optional": true,
"default": "current layer",
"description": "The layer (or its id or name)."
"variant": "One 'feature' parameter",
"variant_description": "If called with a 'feature' parameter only, the function will evaluate the specified feature from the current layer.",
"arguments": [ { "arg": "feature", "description": "The feature which should be evaluated." } ],
"examples": [ { "expression": "maptip(@atlas_feature)", "returns": "The maptip of the current atlas feature." } ]
},
{
"arg": "evaluate",
"description": "If the expression must be evaluated. If false, the expression will be returned as a string literal only (which could potentially be later evaluated using the 'eval_template' function).",
"optional": true,
"default": "true"
}
],
"examples": [
{
"expression": "maptip()",
"returns": "The maptip of the current feature."
},
{
"expression": "maptip(get_feature('streets', 1), 'streets')",
"returns": "The maptip of the feature with the ID 1 on the layer 'streets'."
},
{
"expression": "maptip('a_layer_id', $currentfeature, 'False')",
"returns": "The maptip of the given feature not evaluated."
"variant" : "Layer and feature parameters",
"variant_description": "If the function is called with both a layer and a feature, it will evaluate the specified feature from the specified layer.",
"arguments": [
{ "arg": "layer", "description": "The layer (or its ID or name)" },
{ "arg": "feature", "description": "The feature which should be evaluated." },
{ "arg": "evaluate", "description": "If the expression must be evaluated. If false, the expression will be returned as a string literal only (which could potentially be later evaluated using the 'eval_template' function).", "optional": true, "default": "true" }
],
"examples": [
{ "expression": "maptip('streets', get_feature_by_id('streets', 1))",
"returns": "The maptip of the feature with the ID 1 on the layer 'streets'."
},
{ "expression": "maptip('a_layer_id', $currentfeature, 'False')",
"returns": "The maptip of the given feature not evaluated."
}
]
}
]
}

0 comments on commit e8704f0

Please sign in to comment.