On Tue, Jan 4, 2011 at 8:03 PM, Alberto Silva <[email protected]> wrote:
> Hi all.
>
> I´m havin some problems with labes on my map. I´m trying to implement a
> "street search" in my app. The search by name works well, and when user
> makes the search, I display a map with the matching streets in a different
> colour.
> But I´ve a problem with labels.
> Streets are labelled, but labels only appear at a determined scale
> (correct). But when I do the search, I want to display the labels of the
> resulting street, whatever the scale/zoom, because some streets could be
> very little in map (at big scale)
> I´ve tried using the setMinScaleDenominator/setMaxScaleDenominator methods
> in rules. But it seems that labels aren´t affected...
>
> There´s the part of my code where I define the rule of the selected streets´
> labels (simple)
>
>         TextSymbolizer txtSelected = styleFactory.createTextSymbolizer();
>         txtSelected.getOptions().put("followLine", "true");
>         txtSelected.getOptions().put("group", "true");
>         txtSelected.setLabel(ex);
>         txtSelected.setFont(styleBuilder.createFont("Arial", false, true,
> 12));
>         txtSelected.setHalo(styleBuilder.createHalo(Color.RED, 1));
>
>
>         Rule ruleTextSelected = styleFactory.createRule();
>         ruleTextSelected.setMinScaleDenominator(1e5);
>         //ruleTextSelected.setMaxScaleDenominator(1e300);
>         ruleTextSelected.symbolizers().add(txtSelected);
>         ruleTextSelected.setFilter(CQL.toFilter("NOM_VIA LIKE '" + name +
> "'"));
> Labels of selected streets are displayed in red correctly, but only when
> zoom is near.

Labels won't normally be displayed if the street is not long enough to
contain them, of if other labels conflict with them, or if the label would
cross the map drawing borders (is your display tiled by any chance?)

A small self contained application with sample data would help a lot
in trying to help you, difficult to see what could be wrong from that
code snipped

Cheers
Andrea

-----------------------------------------------------
Ing. Andrea Aime
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584962313
fax:     +39 0584962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-----------------------------------------------------

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to