Hi! If anyone is curious, my code for the parsing of the dash-array property looks like this:
... 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 if( definition instanceof Function){ Function functionExpression = (Function) definition; String functionName = functionExpression.getFunctionName().getName(); List<Expression> parameters = functionExpression.getParameters(); List<Expression> dashes = stroke.dashArray(); dashes.clear(); if (functionName.equals("strConcat")){ processStrConcatFirstParameter(parameters.get(0), dashes); if (!parameters.get(1).evaluate(null, String.class).trim().isEmpty()){ dashes.add(parameters.get(1)); } } else { LOGGER.warning("Wrong structure of stroke-dasharray:"+definition); } } else { LOGGER.warning("Wrong structure of stroke-dasharray:"+definition); } } if( dashString != null){ StringTokenizer stok = new StringTokenizer(dashString.trim(), " "); float[] dashes = new float[stok.countTokens()]; for (int l = 0; l < dashes.length; l++) { dashes[l] = Float.parseFloat(stok.nextToken()); } stroke.setDashArray(dashes); } else { LOGGER.fine("Unable to parse stroke-dasharray"); } ... private void processStrConcatFirstParameter(Expression expression, List<Expression> expressions) { if (expression instanceof Function){ Function functionExpression = (Function) expression; String functionName = functionExpression.getFunctionName().getName(); if(functionName.equals("strConcat")){ List<Expression> parameters = functionExpression.getParameters(); processStrConcatFirstParameter(parameters.get(0), expressions); if (!parameters.get(1).evaluate(null, String.class).trim().isEmpty()){ expressions.add(parameters.get(1)); } } else { if (!expression.evaluate(null, String.class).trim().isEmpty()){ expressions.add(expression); } } } else { if (!expression.evaluate(null, String.class).trim().isEmpty()){ expressions.add(expression); } } } This code will work with SLD like this <CssParameter name="stroke-dasharray"> 5 35</CssParameter> and this <CssParameter name="stroke-dasharray"> <PropertyName>dash_size</PropertyName> <PropertyName>blank_size</PropertyName> </CssParameter> The only advantage (and main disadvantage) of my code is that it uses already existing method parseCssParameter(child). Your code, Nuno, is better because it does not depend on any assumptions about the work of another method. So I am ready to use your code. Honestly, I would prefer if you posted your pull request.I intervened only because my applications don't fit your previous solution. I have a number of another improvements and bug fixes for geotools. So, I would be happy if this task completed you. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/SLD-Stroke-Dasharray-Property-tp5083512p5219733.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