Hi Emily; I decided to go ahead and figure out the problem - so you
would not have to have a frustrating day.
Turns out two things:
1. You saw the null checks being needed in the SLDTransformer thing
2. The SLDParser parser code can be done better when an expression is
expected...see what follows.
Right now a few spots assume a literal is expected - example here:
> if (childName.equalsIgnoreCase("GammaValue")) {
> try {
> final String
> gammaString=child.getFirstChild().getNodeValue();
>
> symbol.setGammaValue(ff.literal(Double.parseDouble(gammaString)));
> } catch (Exception e) {
> if(LOGGER.isLoggable(Level.WARNING))
>
> LOGGER.log(Level.WARNING,e.getLocalizedMessage(),e);
> }
> }
They need to be rewritten to use the following:
> if (childName.equalsIgnoreCase(opacityString)) {
> try {
> final String
> opacityString=child.getFirstChild().getNodeValue();
> Expression opacity = parseExpression( child );
> symbol.setOpacity( opacity );
> } catch (Throwable e) {
> if(LOGGER.isLoggable(Level.WARNING))
>
> LOGGER.log(Level.WARNING,e.getLocalizedMessage(),e);
> }
> }
I create the parseExpression( Node node ) method; it needs to check out
all a nodes children (because some of them are text nodes ...).
> /** Return the first expression that can be used as an Expression */
> Expression parseExpression( Node root ){
> ExpressionDOMParser parser = new ExpressionDOMParser(
> (FilterFactory2) ff );
> Expression expr = parser.expression( root ); // try the
> provided node first
> if( expr != null ) return expr;
> NodeList children = root.getChildNodes();
> for( int index=0; index<children.getLength(); index++){
> Node child = children.item(index);
> if( child instanceof CharacterData ) continue;
> expr = parser.expression( child );
> if( expr != null ) return expr;
> }
> return null; // Expression.NIL?
> }
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel