[Geoserver-users] Definigng a custo rendering class

( I tried to reply to an older post, but i don't know way I can't :-/ )

Hi, first sorry for re-opening an old thread...
I need to draw the traffic flow of bi-directional roads.
As example, I have a table in postgis that contains multiline elements (the
roads), a field (named dirx) showing the flow direction, and the flow value.
What i need to do is, if dirx=1 then display the line on the left side of
the "centerline" defined by the geometric attribute of the road, or right if
dirx=-1. As example, i want to do something like this

(where I want to draw the line if dirx=1)
---------------------------------------------
(offset to be scecified)
X
(the line as described in the dataset, not rendered)
**********************************
(offset to be scecified)
X
(where I want to draw the line if dirx=-1)
---------------------------------------------

I didn't find any possible rules to do this with SLD...so, i thought I may
implement my own rendering class to do this stuff.
But if i try to insert in my sld "<LineSymbolizer
responsibleClass="de.myurl.myrenderer.MyLineDisplayElement">"
I get
cvc-complex-type.3.2.2: Attribute 'responsibleClass' is not allowed to
appear in element 'LineSymbolizer'

So, is not yet possible to do this, or wath I'm doing wrong?
Thanks for helping!

(Here the old post from andreas, link:
http://n2.nabble.com/SLD,-Single-Side-Line-Symbols-td2054465.html )
[CUT]
b) because of the short commings of SLD deegree allowes regstering
classes that represents special styles that can not be formulated with a
SLD. As default deegree interal classes will be used to render
Symbolizers but you are free to register your own class(es) e.g. to
realizes a displacement for line symbols. Example:
<sld:LineSymbolizer
responsibleClass="de.myurl.myrenderer.MyLineDisplayElement">
   <sld:Geometry>
       <ogc:PropertyName>app:geometry</ogc:PropertyName>
   </sld:Geometry>
   <sld:Stroke>
       <sld:CssParameter name="stroke">#cc0000</sld:CssParameter>
       <sld:CssParameter name="stroke-opacity">0.5</sld:CssParameter>
       <sld:CssParameter name="stroke-width">6</sld:CssParameter>
       <sld:CssParameter name="stroke-dasharray">1</sld:CssParameter>
   </sld:Stroke>
</sld:LineSymbolizer>

In this case de.myurl.myrenderer.MyLineDisplayElement must extend
org.deegree.graphics.displayelements.LineStringDisplayElement. In
deegree a DisplayElement is responsible for rendering geometries by
using the assigned Symbolizer. Writing your own DisplayElement enables
you to render a geometry how ever you like; you may consider settings of
the assigned Symbolizer but you don not have to; you may move the
geometry to the right or left before redering or render its boundingbox
or centroid istead. ...

best regards

ANDREAS
--
View this message in context: http://www.nabble.com/Definigng-a-custo-rendering-class-tp22865034p22865034.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

totom ha scritto:

( I tried to reply to an older post, but i don't know way I can't :-/ )

Because you did not subscribe to the ml (at least, this message was stuck in the admin queue because you weren't subscribed when sending it).

Hi, first sorry for re-opening an old thread...
I need to draw the traffic flow of bi-directional roads.
As example, I have a table in postgis that contains multiline elements (the
roads), a field (named dirx) showing the flow direction, and the flow value.
What i need to do is, if dirx=1 then display the line on the left side of
the "centerline" defined by the geometric attribute of the road, or right if
dirx=-1. As example, i want to do something like this

(where I want to draw the line if dirx=1) ---------------------------------------------
(offset to be scecified) X
(the line as described in the dataset, not rendered)
**********************************
(offset to be scecified) X
(where I want to draw the line if dirx=-1) ---------------------------------------------

I didn't find any possible rules to do this with SLD...so, i thought I may
implement my own rendering class to do this stuff.
But if i try to insert in my sld "<LineSymbolizer
responsibleClass="de.myurl.myrenderer.MyLineDisplayElement">"
I get
cvc-complex-type.3.2.2: Attribute 'responsibleClass' is not allowed to
appear in element 'LineSymbolizer'

So, is not yet possible to do this, or wath I'm doing wrong?
Thanks for helping!

(Here the old post from andreas, link:
http://n2.nabble.com/SLD,-Single-Side-Line-Symbols-td2054465.html )
[CUT]
b) because of the short commings of SLD deegree allowes regstering
classes that represents special styles that can not be formulated with a
SLD. As default deegree interal classes will be used to render
Symbolizers but you are free to register your own class(es) e.g. to
realizes a displacement for line symbols. Example:
<sld:LineSymbolizer
responsibleClass="de.myurl.myrenderer.MyLineDisplayElement">
   <sld:Geometry>
       <ogc:PropertyName>app:geometry</ogc:PropertyName>
   </sld:Geometry>
   <sld:Stroke>
       <sld:CssParameter name="stroke">#cc0000</sld:CssParameter>
       <sld:CssParameter name="stroke-opacity">0.5</sld:CssParameter>
       <sld:CssParameter name="stroke-width">6</sld:CssParameter>
       <sld:CssParameter name="stroke-dasharray">1</sld:CssParameter>
   </sld:Stroke>
</sld:LineSymbolizer>

In this case de.myurl.myrenderer.MyLineDisplayElement must extend
org.deegree.graphics.displayelements.LineStringDisplayElement. In
deegree a DisplayElement is responsible for rendering geometries by
using the assigned Symbolizer. Writing your own DisplayElement enables
you to render a geometry how ever you like; you may consider settings of
the assigned Symbolizer but you don not have to; you may move the
geometry to the right or left before redering or render its boundingbox
or centroid istead. ...

Interesting way of dealing with these limitations. Unfortunately
GeoServer does not have that. What you're talking about above is a
DeeGree specific enhancement (vendor extension).

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.