I don't think I got my question across clearly last time, and now I'm
knee-deep in the code and what I see confirms this further.
I'm looking to see if there's support in the default SLD rendering
implementation for adding an external graphic as a "shield" on which a
label is placed in the geotools literenderer labeler. Not a
PointSymbolizer as in putting a graphic on a point, but a
TextSymbolizer, as in drawing a graphic under a label.
I'm not 100% sure this is the way that I'd do it, but I'd expect that if
this were possible, something like the following would be renderable
SLD:
<Rule>
<LineSymbolizer>
my interstate freeways line symbolization...
</LineSymbolizer>
<TextSymbolizer>
<Label>
<PropertyName
xmlns="http://www.opengis.net/ogc/filter">FREEWAY\_NUMBER</PropertyName>
</Label>
<!-- here's what I'm looking for in terms of a "shield" -->
<Graphic>
<ExternalGraphic>
<OnlineResource>http://my-road-shield.com/road-shield-interstate.gif</OnlineResource>
<Format>image/gif</Format>
</ExternalGraphic>
</Graphic>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<Font>
<CssParameter name="font-family">arial</CssParameter>
<CssParameter name="font-weight">medium</CssParameter>
<CssParameter name="font-size">10</CssParameter>
</Font>
</TextSymbolizer>
So looking through
org.geotools.renderer.lite.LabelCacheDefault.end(Graphics2D graphics,
Rectangle displayArea)
I see that this is where all the long-cached labels get rendered. A
bunch of LabelCacheItems are iterated through, and each is rendered in
turn. Each LabelCacheItem has text information, a geometry and some
general labeling hints info (distance around, etc.)
I thought for a second that this geometry might be exactly what I was
looking for, that it was a possible "geometry" to be painted underneath
the label, but looking at the comment on lines 325-328, I think that
this is really just a copy of the geometry to be labeled...which is then
used to determine the label position.
So I'm back to my original question: is there a way to get the LABELER
to draw labels on-top of a custom-defined shield? I suppose I could
roll my own font, but that seems a bit extreme. And come to think of
it, wouldn't work anyway, because I'd need custom graphics for every
freeway number from 5 through 905, each with its own custom-rendered
shield.
This is kindof a make-or-break feature for geoserver use in my
situation, so I'd love to find out a couple of things:
1) Sanity check: I don't think the above is valid SLD. Is this
"missing road-shield support" just a hole in the spec, or am I
completely missing an easy way to do road-shields using a
PointSymbolizer that will do what I'm looking to do without any labeling
changes?
2) Is this useful for anyone else?
3) How should I lay out my dev env for developing this kind of thing?
I've followed the list for long enough to know that current geoserver
subversion HEAD isn't tracking geotools 2.2.x, but is tracking the
feature-frozen 2.1.x branch. I couldn't find a way to check-out the
geotools 2.1.x branch (svn co <url to 2.1.x-branch> failed on me with a
strange error), so I checked out the geoserver-1.3.0.RC4.SC1 subversion
tag, but that's a TAG, so I figure it's stationary and not a good place
to be adding code. Any hints?
4) This is not valid SLD...and would be an extension of the SLD spec.
I know there are a few other spots where geotools offers a strict
superset of valid SLD. Is this another candidate spot?
Thanks in advance to all. Hopefully I'm missing something easy. And if
not, hopefully this is something that would be a good addition.
--saul