Hi Andrea,

Yes, I am using StreamingRenderer. I got a NullpointerException and, of course, nothing is shown.

Here is stack trace:
27-dic-2006 17.07.08 org.geotools.renderer.lite.StreamingRenderer$DefaultRenderListener errorOccurred
GRAVE: null
java.lang.NullPointerException
        at org.geotools.renderer.style.SLDStyleFactory.createPointStyle(SLDStyleFactory.java:486)
        at org.geotools.renderer.style.SLDStyleFactory.createStyleInternal(SLDStyleFactory.java:334)
        at org.geotools.renderer.style.SLDStyleFactory.createStyle(SLDStyleFactory.java:294)
        at org.geotools.renderer.lite.StreamingRenderer.processSymbolizers(StreamingRenderer.java:1366)
        at org.geotools.renderer.lite.StreamingRenderer.process(StreamingRenderer.java:1281)
        at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1231)
        at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:506)


And line 486 in SLDStyleFactory is the one you wrote.

But there's no problem in that line. NullPointerException is thrown because "feature" doesn't contains an attribute named "symbol" at that time.

I think that this is due to the fact that method queryLayer() takes only attributes founded in style definition. Unfortunately it doesn't work with mark attribute.

Setting optimizedDataLoadingEnabled hint to false, the program works fine, but loads everything in memory.

Bye,
Manuele.



in data 27/12/2006 16.25 Andrea Aime ha detto:
Manuele Ventoruzzo ha scritto:
Hi all,

I have found a problem using Mark symbols that have to be evaluated through attribute expressions.

Suppose that I want to show different symbols in a set of points and that mark well known name is stored in an attribute named "symbol".

This is resulting java code:

        Mark theMark = sb.createMark(sb.attributeExpression("symbol"),
                sb.createFill(Color.RED, 0.5), null);
        Graphic graph = sb.createGraphic(null,new Mark[] {theMark},null,
            sb.literalExpression(1),sb.attributeExpression("size"),sb.attributeExpression("rotation"));
        PointSymbolizer aPointSymbolizer = sb.createPointSymbolizer(graph);

So, everything works only and only if I use a label that evaluates "symbol" attribute.
Otherwise, Geotools doesn't keep attribute value in the subset used during map rendering phase.

What happens when you use a mark? Exceptions? You don't see anything?
What renderer are you using?
In StreamingRenderer the _expression_ above is turned into a java2d shape by the following code:

Shape shape = Java2DMark.getWellKnownMark(mark.getWellKnownName().getValue(feature)                                                           .toString());

which should work just fine.

Cheers
Andrea


--

Manuele Ventoruzzo
Over I.T. srl - Gruppo Engineering
Via Bassi 81
33080 Fiume Veneto (PN)
email: [EMAIL PROTECTED]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to