In my last commit
(https://github.com/igorvolk/geotools/commit/3ea8bd1f2cd017c2e0b312b9f52c02e04612b5ff)
I have implemented the proposals of Jody Garnett, concerning the interface
org.geotools.styling.Stroke. I have left interface org.opengis.style.Stroke
unmodified. I have some doubts concerning the implementation of legacy
method StrokeImpl.getDashArray().
Look at my implementation.

public float[] getDashArray() {
if (dashArray.isEmpty()){
return Stroke.DEFAULT.getDashArray();
} else {
int floatLiteralCount = 0;
for (Expression expr: dashArray){
if (expr instanceof Literal){
Float dash = expr.evaluate(null, Float.class);
if (dash != null){
floatLiteralCount++;
}
}
}
if (floatLiteralCount != dashArray.size()){
return Stroke.NULL.getDashArray();
} else {
float[] result = new float[floatLiteralCount];
int j = 0;
for (Expression expr: dashArray){
Float dash = expr.evaluate(null, Float.class);
result[j] = dash;
j++;
}
return result;
}
}
}

May be it's all right. But may be I need to swap the returns of
Stroke.DEFAULT.getDashArray() and Stroke.NULL.getDashArray() or to change
somethig else. I am waiting for your opinion.

I abandoned my old ideas about the use in SLDParser of filter function for
extraction of dash expressions.
For SLDParser I chose to use the excellent code of Nuno Oliveira (after
fixing small bug in it). A lot of thanks to him!!!
I suggested to Nuno to finish this task because he initiated it. But he has
not answerd yet. So I continue to work with dashArray (But I am ready at any
moment to give him way) .
Unlike Jody Garnett, I believe that there is no need to make changes in
classes 
library/opengis/src/main/java/org/opengis/style/StyleFactory.java
library/api/src/main/java/org/geotools/styling/StyleFactory.java
library/main/src/main/java/org/geotools/styling/AbstractStyleFactory.java
library/main/src/main/java/org/geotools/styling/StyleFactoryImpl.java
library/main/src/main/java/org/geotools/styling/StyleFactoryImpl2.java
because the use of method ListdashArray() assumes that the add expressions
after the creation of Stroke instance.
But class
extension/brewer/src/main/java/org/geotools/styling/builder/StrokeBuilder I
have modified by changing the implementation of method dashArray(float...
dashArray) and adding of method dash(Expession dash).



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/SLD-Stroke-Dasharray-Property-tp5083512p5219882.html
Sent from the geotools-devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to