Hi,

I have some questions about the SLD stroke-dasharray property support.
Does it exists some reason for stroke-dasharray property only supports literal expressions ?

After reading some code I come to the conclusion that the only restriction is defined by the Stroke interfaces, i.e. org.opengis.style.Stroke and org.geotools.styling.Stroke. Basically they define that the stroke-dasharray property can only be an array of floats
and everyone else just follow that definition.

So, SLD parser for SLD 1.0.0 version do this (SLDParser):

   if (res.equalsIgnoreCase("dasharray")
        || res.equalsIgnoreCase("stroke-dasharray")) {
        String dashString = null;
        if( child.getChildNodes().getLength() == 1 &&
   child.getFirstChild().getNodeType() == Node.TEXT_NODE ){
            dashString = getFirstChildValue(child);
        } else {
            Expression definition = parseCssParameter(child);
            if( definition instanceof Literal){
                dashString = ((Literal)definition).getValue().toString();
            }
            else {
                LOGGER.warning("Only literal stroke-dasharray supported
   at this time:"+definition);
            }
        }
   }


And SLD parser for SLD 1.1.0 version do this (SLDStrokeBinding):

   float[] dash = null;

   if (dashArray != null) {
        String[] string = Filters.asString(dashArray).split(" +");
        dash = new float[string.length];

        for (int i = 0; i < string.length; i++) {
            dash[i] = Float.parseFloat(string[i]);
        }
   }


In the rendering process the getStroke methods retrieve the values from all the stroke properties evaluating them except for the dasharray property that is already an array of floats:

            // get the other properties needed for the stroke
            float[] dashes = stroke.getDashArray();
            float width = evalToFloat(stroke.getWidth(), feature, 1);
            float dashOffset = evalToFloat(stroke.getDashOffset(),
   feature, 0);

I checked the SLD standard and I haven't found any restriction that force the dash property to
be represented as an array of floats.

Would it be acceptable to alter the Stroke interface to return and accept the dashproperty as an Expression
instead of an array of floats ?

If so I can provide a patch for this.

Best regards,

Nuno Oliveira



------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to