Hi to everybody,
I'm new to geotools, so I have a question that somebody could find really simple.
I have to show a map with multiple layers each one with a label. When one layer override a second one, geotools have to show only that one with greater priority. I founded that TextSymbolizer has a method named setPriority() to do that (I except that it will do that).
But, as result, I have some layer with low priority that overrides others with high priority. The question is simple. What's wrong?
The code for label management is:
int priority = 10;
...
StyleBuilder sb=new StyleBuilder();
TextSymbolizer ts= sb.createTextSymbolizer();
ts.setPriority(sb.literalExpression(priority);
ts.setFill(sb.createFill(Color.RED));
_expression_ family=sb.literalExpression(s.getString(Style.FAMILY,"Monospaced"));
_expression_ style=sb.literalExpression(s.getString(Style.STYLE,StyleBuilder.FONT_STYLE_NORMAL));
_expression_ weight=sb.literalExpression(s.getString(Style.WEIGHT,StyleBuilder.FONT_WEIGHT_NORMAL));
_expression_ size=sb.literalExpression(s.getint(Style.SIZE,10));
org.geotools.styling.Font f=sb.createFont(family,style,weight,size);
ts.setFonts(new org.geotools.styling.Font[]{f});
double h=s.getdouble(Style.HALO,0);
For example, first layer has 10 as priority and second 5. But sometimes, item with priority 5 overrides item with priority 10.
Thank you for your attention.
Bye,
Manuele