Thanks for you help.

Here the reduced code, where the fault still exists.
I´ve changed some attributes, but there is always the same problem. The labels 
are filtered out in paintPointLabelInternal(...) of LabelCacheImpl. 
displayArea.contains(transformed) returns false.

AnchorPoint ap = styleFactory.createAnchorPoint(filterFactory.literal(0.5), 
filterFactory.literal(0.0));
Displacement dp = styleFactory.createDisplacement(filterFactory.literal(0.0), 
filterFactory.literal(-20.0));
LabelPlacement placement = styleFactory.createPointPlacement(ap, dp, 
filterFactory.literal(0.0));
Fill bgFill = styleFactory.createFill(filterFactory.literal(bgColor), 
filterFactory.literal(1));
Stroke stroke = styleFactory.createStroke(filterFactory.literal(Color.black), 
filterFactory.literal(1.0), filterFactory.literal(1.0f));
Fill fillBg = styleFactory.createFill(filterFactory.literal(bgColor), 
filterFactory.literal(1.0));
Graphic graphicBg = styleFactory.createGraphic(null, new Mark[] 
{StyleFactoryFinder.createStyleFactory().getCrossMark()}, null, null, 
filterFactory.literal(20), filterFactory
TextSymbolizer2 textSymbolizer = (TextSymbolizer2) 
styleFactory.createTextSymbolizer(fill, new Font[] {gtFont}, null, 
filterFactory.literal("This is a test"), placement, null);
textSymbolizer.setGeometryPropertyName("geometry");
textSymbolizer.setGraphic(graphicBg);

As I said, to the right side all works correct. Only the left side makes the 
problems. Depending on the length of the label, the label is hided earlier 
although there would be enough place to show it. But the label-bounds seem to 
be calculated correct.

Cheers,
Christian
    

-----Ursprüngliche Nachricht-----
Von: Andrea Aime [mailto:[email protected]] 
Gesendet: Donnerstag, 29. April 2010 18:40
An: Christian Dubray
Cc: [email protected]
Betreff: Re: [Geotools-gt2-users] Problem with the LabelShiel-hack of 
TextSymbolizer2

Christian Dubray ha scritto:
> Hi,
> 
>  
> 
> I have again a little problem.
> 
> I´m trying  to use the TextSymbolizer2 for a rectangle background. But 
> okay, that is not important because I have the same problem with all 
> graphic-objects.
> 
>  
> 
> The problem is the following:
> 
> If I don´t add a Graphic to my TextSymbolizer2 all works fine. If I add 
> one, the complete label (label and shield) isn´t shown if the feature is 
> near to the left border,  although there is still absolute enough place 
> for the label and the shield. To the right side all works fine.
> 
> What could be the problem? I reduced my code so that I thought I´m only 
> using geotools-stuff. But the problem still exists. Maybe I ignored a 
> failure in my code, but I reduced my code so that I think that I am 
>  only using geotools-stuff for that.  Has anybody experience with the 
> labelshield? I hope somebody can help me.

Difficult to say without more details.
Two common reasons beyond the normal conflict resolution:
- the label or the icon would cross the map borders. We don't draw them
   in that case as that would break solid the tiled rendering case
   (a la Google Maps, for example). At the moment there is no way to
   turn off this behavior (though adding a new vendor option would
   not be so hard)
- the object to be labelled is a polygon and the label containment
   within the polygon does not go beyond the minimum threshold (I think
   it's 50%). To change that you can add a vendor option to your
   text symbolizer with the key "goodnessOfFit" and a value between
   0 and 1

If that does not help please provide a data set and a little self
contained program that shows the behaviour you deem to be unsatisfactory

Cheers
Andrea

-- 
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to