stroke dasharray as an expression - STEMLab/geotools GitHub Wiki
- Contact: Nuno Oliveira
- Tracker: https://osgeo-org.atlassian.net/browse/GEOT-3776
- Tagline: stroke-dasharray as an expression
- Pull request: https://github.com/geotools/geotools/pull/943
Allow SLD stroke-dasharray property to support expressions.
Approach used is similar to how Symbolizer was extended to support PropertyName.
The interface org.opengis.style.Stroke provides a float[] (and is only useful when all the expressions are literals):
package org.opengis.style;
public interface Stroke {
...
@XmlParameter("stroke-dasharray")
float[] getDashArray();
...
}
GeoTools org.geotools.styling.Stroke interface provides access to a List for dash array.
package org.geotools.styling;
public interface Stroke extends org.opengis.style.Stroke {
/** Shortcut to retrieve dash array in the case where all expressions are literal numbers */
float[] getDashArray();
/** Shortcut to define dash array using literal numbers */
void setDashArray(float[] dashArray);
/** Sequence defining dash array pattern as a series of floats.
* <p>
* The first number gives the length in pixels of the dash to draw, the
* second gives the amount of space to leave, and this pattern repeats.<br>
* If an odd number of values is given, then the pattern is expanded by
* repeating it twice to give an even number of values.
*/
List<Expression> dashArray();
}
References:
Choose one of:
- Under Discussion
- In Progress
- Completed
- Rejected,
- Deferred
Voting:
- Andrea Aime
- Ben Caradoc-Davies
- Christian Mueller
- Ian Turton
- Justin Deoliveira
- Jody Garnett +1
- Simone Giannecchini
-
Update implementation
- Update Stroke Interface - deprecate float[] references, and add new methods
- Update StyleFactory - deprecate float[] array method and add Expression method
- Update StyleBuilder - existing float[] array methods can generate a Literal expression
-
Verify with test case
- Add additional methods, existing float[] methods should still work
-
Update documentation
- The upgrade before and after examples are important here.
- The Symbology Encoding page and style tutorial
-
Release API change in GeoTools 14.0
-
Remove deprecated code from master after 14-RC is created.
- StyleBuilder can retain existing float[] methods allowing many clients to remain unmodified