Thanks Andrea. I fixed the bug and created a pull request (https://github.com/geotools/geotools/pull/407). However, there are two potential issues:

1.) I don't have a signed contribution license. It's only 4 lines of code so this may not be necessary.

2.) I didn't include a unit test. I'm having trouble getting the tests to pass on master, even before my changes. I'm getting an ArrayIndexOutOfBoundsException from line 173 of SLDStyleFactoryTest.java. The variable coordsExpected (and coords) is a double array of size 2 and the Javadocs for the currentSegment method (line 173) says it needs an array size 6, hence the exception. If I change the initialization to create an array of size 6 the test passes. I'm not sure how this test is passing for other developers and on the CI server. I tried Java 6 & 7.

Thanks,
Michael

On 03/12/2014 04:02 AM, Andrea Aime wrote:
On Tue, Mar 11, 2014 at 11:06 PM, Michael Romero <[email protected] <mailto:[email protected]>> wrote:

    All,

    I am trying to create a label that consists of some text with a
    rectangular border around it.  I currently have a TextSymbolizer
    with a Label and a Graphic using the WellKnownName "square".  This
    gets the desired result for a single line of text but if the text
    contains multiple lines the square graphic is not placed correctly.

    I am reading from a PostgreSQL table that contains the text with
    new lines. I can also get the same result by using a single line
    and adding a very small autoWrap to create multi-line text. Here
    is an example of the text I am inserting:

    UDPATE my_table SET label=E'First line\nSecond line\nThird line';


    This thread is similar but I think was created before this was
    implemented at all:

    
http://osgeo-org.1560.x6.nabble.com/SLD-Graphic-inside-TextSymbolizer-Relative-placements-td4992671.html


    After playing with all the SLD options I believe this is a bug and
    I am beginning to look through the GS/GT code.  Has anyone seen
    this before?  If not, can someone point me to the classes I should
    be looking at?

    I'm using PostgreSQL 9.0 with PostGIS 1.5.2 and tried both
    GeoServer 2.2.4 and 2.4.4.  Attached is my SLD and images of a
    single line and multi line text.  I'm using a point geometry that
    is located in the middle of the text in both images.


Yes, I believe this might be a bug. The class you should be looking into is this one:
https://github.com/geotools/geotools/blob/master/modules/library/render/src/main/java/org/geotools/renderer/label/LabelPainter.java

Cheers
Andrea

--
==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
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 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

------------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to