Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-03-03 Thread Michael Bedward
Super - that's a nice clear example. Thanks very much Ben ! Michael -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterp

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-03-03 Thread Benoît Thiébault
Hi Michael, hi everyone, Here is how to use the NumberFormatFunction. 1) First, you have to register it so the factory can find it dynamically. To do so, you have to create a META-INF/services folder in your jar file and put in it a simple text file called "org.opengis.filter.expression"

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-03-03 Thread Michael Bedward
Hi Ben, Many thanks for posting your code. I've just been studying it. If it's not too much trouble could you post a little snippet sometime showing how you would use this programmatically please ? No hurry. cheers Michael --

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-03-03 Thread Benoît Thiébault
Thanks Andrea ! I found what I did wrong. I used two Strings instead of a String and a Double. Your example helped me to find this rather trivial mistake. Here is the working code, for those who are interested. NumberFormatFunction.java Description: Binary data Le 3 mars 09 à 18:10, A

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-03-03 Thread Andrea Aime
Benoît Thiébault wrote: > OK for the text symbolizer, I have replaced the code as you said. > > Regarding the evaluate method, I have evaluated the two parameters > against the object as you said (see below). > I have built the formatter from the string result. > But then, I don't know what to re

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-03-03 Thread Benoît Thiébault
OK for the text symbolizer, I have replaced the code as you said. Regarding the evaluate method, I have evaluated the two parameters against the object as you said (see below). I have built the formatter from the string result. But then, I don't know what to return. I have tried (T) formatter.

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-03-03 Thread Andrea Aime
Benoît Thiébault wrote: > Hi everyone, > > As Andrea suggested, I'm trying to implement a formatting filter > function that could be used in SLD files (or programmatically) to > display text in a given format, like this : > > > myAtt > ##.## > > > I have looked at existing functions and co

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-03-03 Thread Benoît Thiébault
Hi everyone, As Andrea suggested, I'm trying to implement a formatting filter function that could be used in SLD files (or programmatically) to display text in a given format, like this : myAtt ##.## I have looked at existing functions and coded the function attached. However, I still

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-02-24 Thread Andrea Aime
Benoît Thiébault wrote: > Thanks Andrea, > > I did not try to set my AnchorX to 0.5. > How do you do it ? I couldn't find any documentation to access the > anchor point of a TextSymbolizer. Mumble... it's part of the label placement structure, it can be a point placement, or a line placement. If

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-02-24 Thread Benoît Thiébault
I found how to do it: text.setLabelPlacement(sb.createPointPlacement(0.5, 0.0, 0.0)); It's still another deprecated method (setLabelPlacement), but there is a way to avoid it : StyleBuilder sb = new StyleBuilder(); org.geotools.styling.Font[] fontArray = {sb.createFont(new Font("sansserif",

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-02-24 Thread Benoît Thiébault
Thanks Andrea, I did not try to set my AnchorX to 0.5. How do you do it ? I couldn't find any documentation to access the anchor point of a TextSymbolizer. Regarding the new function, I will give it a try and let you know. Benoît Le 24 févr. 09 à 14:03, Andrea Aime a écrit : > Jody Garnett w

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-02-24 Thread Andrea Aime
Jody Garnett wrote: > Okay cool; so have you tried the text symbolizer offset yet? Setting an > offset should allow you to draw above or below the line. There is also a > rendering hint that can be used to make the text follow the line; I am > not sure if that only changes orientation or if it a

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-02-23 Thread Jody Garnett
Okay cool; so have you tried the text symbolizer offset yet? Setting an offset should allow you to draw above or below the line. There is also a rendering hint that can be used to make the text follow the line; I am not sure if that only changes orientation or if it also would calculate an offset?

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-02-22 Thread Benoît Thiébault
Hi Jody,In fact, I have to draw a grid. Each segment of the grid is displayed in a different color, representing the depth of the water at a given point.To make it more readable, I also have to be able to display the value of the depth of each grid segments. (see attached file)For vertical segments

Re: [Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-02-22 Thread Jody Garnett
The style visitor is there to go over all the elements in a style data structure (so you do not have to use get methods so much). I am still trying to sort out what you want to do? Are you trying to make your text flow along your linestring? Or go in the same direction as your line string or what .

[Geotools-gt2-users] Centering and formatting the text of a TextSymbolizer

2009-02-18 Thread Benoît Thiébault
Hi List ! I'm still working on styles and I have create a TextSymbolizer that indicates the value of my linear shaped feature. I don't use SLD file but rather create my styles programmatically. I want to do two things with my text : - first, I want it to be centered with respect to the associa