Some javascript/style in this post has been disabled (
why?)
Hi,
I think its the fixed MIN_GOODNESS_FIT value used
by LabelCacheDefault that's causing the
trouble. I've
sidestepped this for now by passing a hint to StreamingRenderer to use
LabelCacheImpl instead - all labels are
showing up now
. It would be great if
LabelCacheDefault
accepted an option to set MIN_GOODNESS_FIT instead
of having it be a fixed constant value,
maybe I'll do it myself, if I manage to figure
out how to compile the GeoTools library lol.
Anyway thanks to anyone who read my question and
spared it some thought. GeoTools is getting
more and more fun to use!
Cheers,
Mann Ern
Sent: Sunday, October 18, 2009 1:46 PM
Subject: TextSymbolizer - Some Labels Not Showing
Hi,
I've been using GeoTools for some time now and I
think it gives great results. However
I seem to be having some problems with
TextSymbolizer.
Many labels, especially longer ones don't seem to be getting
rendered. I
have tried setting
the "spaceAround"
option to negative values, which increases the number of labels
displayed
(some of which overlap each other), but many labels are still not
being rendered. Changing the
magnitude of the negative spaceAround value makes no difference.
Changing the placement
also doesn't solve the problem.
I have even tried rendering with a single feature
(I.e. only one label in the entire map), but still
the label does not show up.
I suspect this may be due to a predefined
maximum size for labels, but I can't find any option
to override such a thing. Am I overlooking some
option, or doing this in the wrong way?
Hope to get some ideas. Thanks a lot.
Code:
....
....
//create labels
TextSymbolizer textSym =
styleBuilder.createTextSymbolizer(
Color.BLACK, styleBuilder.createFont("Arial", false, false,
9),
"building_n");
textSym.setHalo(styleBuilder.createHalo(Color.WHITE,
1));
textSym.setPlacement(styleBuilder.createPointPlacement(0.5, 0.5, 0, 0,
0));
textSym.addToOptions("spaceAround", "-1");
Rule rule4 =
styleBuilder.createRule(textSym);
Rule[] rules = {rule, rule2, rule3,
rule4};
FeatureTypeStyle featureTypeStyle =
styleBuilder.
createFeatureTypeStyle("Feature", rules);
style.addFeatureTypeStyle(featureTypeStyle);
DefaultMapContext mc = new
DefaultMapContext();
DefaultMapLayer layer = new
DefaultMapLayer(intBdlgsCollection, style); //layer containing
labels
DefaultMapLayer layer2 = new DefaultMapLayer(landlotCollection,
style2);
mc.addLayer(layer2);
mc.addLayer(layer);
StreamingRenderer renderer = new
StreamingRenderer();
renderer.setContext(mc);
java.awt.Rectangle rc = new
java.awt.Rectangle();
rc.setBounds(0, 0, 1280,
800);
g2d.setColor(Color.BLUE); //fill background first
g2d.fillRect(0, 0,
1280, 800);
//render map
renderer.paint(g2d,
rc,
new ReferencedEnvelope( 17500,
23000, 28000, 33437,
mc.getCoordinateReferenceSystem()));
Cheers,
Mann Ern
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users