[prev in list] [next in list] [prev in thread] [next in thread]
List: mapserver-commits
Subject: [mapserver-commits] [MapServer/MapServer] ac6053: Allow Expressions to be set for LABEL properties u
From: Seth G <noreply () github ! com>
Date: 2023-06-22 10:46:35
Message-ID: MapServer/MapServer/push/refs/heads/main/94c1e5-ac6053 () github ! com
[Download RAW message or body]
Branch: refs/heads/main
Home: https://github.com/MapServer/MapServer
Commit: ac6053904b0a8877ff88b9a0f139f51c8b08269a
https://github.com/MapServer/MapServer/commit/ac6053904b0a8877ff88b9a0f139f51c8b08269a
Author: Seth G <sethg@geographika.co.uk>
Date: 2023-06-22 (Thu, 22 Jun 2023)
Changed paths:
M mapfile.c
M mapscript/python/tests/cases/label_test.py
M mapscript/swiginc/label.i
Log Message:
-----------
Allow Expressions to be set for LABEL properties using MapScript (#6904)
This pull request allows the new functionality in #6884 of using an expression in a \
LABEL PRIORITY in MapScript. It takes a similar approach to setting attribute \
bindings for properties, which requires using the appropriate attribute constant such \
as `MS_LABEL_BINDING_PRIORITY`:
```python
label = mapscript.labelObj()
label .setExpressionBinding(mapscript.MS_LABEL_BINDING_PRIORITY, "[MY_ATTRIBUTE] * \
2") ```
This is a little clunky but is at least consistent with setting attribute bindings:
```python
label = mapscript.labelObj()
label.setBinding(mapscript.MS_LABEL_BINDING_COLOR, "NEW_BINDING")
```
While testing this I noticed that the `writeLabel` function used to write Mapfile \
objects ignored expressions. This seems an oversight also for the `LABEL` `SIZE` \
expression. If this approach seems appropriate I can use this for other expression \
bindings.
Something to note is that a property could have an attribute binding **and** an \
expression binding set. In this case the attribute binding currently takes precedence \
when calculating a shape value, so it also takes precedence when writing to a \
Mapfile.
In theory setting an expression could also set the attribute binding to NULL. This is \
not currently the case for MapScript or when reading a Mapfile twice.
_______________________________________________
MapServer-commits mailing list
MapServer-commits@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic