On Tue, Aug 14, 2012 at 7:18 PM, Ákos Maróy <[email protected]> wrote:
> Hi,
>
> I found an issue where the SDL renderer gets into an infinite loop when
> using a GraphicStroke line simbolyzer with the uom extension. To
> reproduce, consider the following SDL fragment:
>
> <sld:LineSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
> <sld:Stroke>
> <sld:GraphicStroke>
> <sld:Graphic>
> <sld:Mark>
> <sld:WellKnownName>shape://vertline</sld:WellKnownName>
> <sld:Stroke>
> <sld:CssParameter
> name="stroke">#000000</sld:CssParameter>
> <sld:CssParameter
> name="stroke-width">1</sld:CssParameter>
> </sld:Stroke>
> </sld:Mark>
> <sld:Size>12</sld:Size>
> </sld:Graphic>
> </sld:GraphicStroke>
> <sld:CssParameter name="stroke-dasharray">12 18</sld:CssParameter>
> </sld:Stroke>
> </sld:LineSymbolizer>
>
>
> when trying to render, say lines of an OSM database with the above,
> geoserver gets into an infinite loop.
>
> I looked at the code, and found the following, although I'm not sure how
> to fix the issue. the infinite loop is this one, in StyledShapePainter,
> starting at line 466:
>
> for (dist = remainder; dist < len; dist += imageSize) {
> renderGraphicsStroke(graphics, x, y, graphicStroke, rotation, 1,
> isLabelObstacle);
>
> x += dx;
> y += dy;
> }
>
>
> and the reason is that imageSize == 0, thus dist does not increase.
>
> looking at the code, it turns out that imageSize comes from a
> MarkStyle2D object's size attribute, which is 0. it is set to 0 in
> SLDStyleFactory.createPointStyle(), line 647:
>
> ms2d.setSize((int) size);
>
> where this size value is set at line 542 in the same function:
>
> size = evalToDouble(sldGraphic.getSize(), feature, 0);
>
>
> now, the (double) size value is calculated to less than 1 (but still
> greater than 0), and casting to int will turn it into 0.
>
>
> I wonder what a proper fix to this issue would consist of? rounding up
> size to 1?
>
Given that Java2D can handle float/double dimensions just fine I'd just
promote MarkStyle2D size to a double and fix the callers of setSize
accordintly
Cheers
Andrea
--
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel