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, it works very well : the text is displayed at the right of the segment, vertically centered with respect to the segment.
For horizontal segments, however, the text is not placed correctly : it is centered vertically, making it overlaying the line and it is not centered horizontaly (even though the anchor point is centered). As you can see, I also have more digits displayed than necessary. I just need 2 digits after the dot.


Le 23 févr. 09 à 06:15, Jody Garnett a écrit :

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 ....

Jody

On Thu, Feb 19, 2009 at 4:52 AM, Benoît Thiébault <[email protected]> wrote:
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 associated
LineSymbolizer. By default, the start of the text matches the line
center. I would like the middle of the text to match the line center
- then, I would like to format the displayed text in a format like
XX.XX. To do that, I think I have to access the String of my Feature
attribute and format it on the fly

I think I need to use visitors, but I'm really not sure how they work.
Does anyone have a code sample ?

Thanks
----
// Creates the style builder
StyleBuilder sb = new StyleBuilder();

// Creates the text symbolizer
TextSymbolizer text = sb.createTextSymbolizer(Color.black, sb
               .createFont(new Font("sansserif", Font.PLAIN, 12)), "depth");

// Adds it to a rule
Rule rule1 = sb.createRule(text);

// Creates the line symbolizer
LineSymbolizer lineSymbolizer = sb.createLineSymbolizer(Color.red, 2.0);

// Adds it to another rule
Rule rule2 = sb.createRule(lineSymbolizer);

// And so on...

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Benoît Thiébault

  Société Artenum
  24 rue Louis Blanc, 75010 Paris
  tel: +33 (0)1 46 94 67 54

  Artenum - Science & Groupware - http://www.artenum.com

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to