[udig-devel] Layer Label
Jesse Eichar
jeichar at refractions.net
Wed Aug 8 08:58:40 PDT 2007
ok...
class StyleToggle{
Style noLabels;
Style wtihLabels;
ILayer layer;
StyleToggle( ILayer layer, Style noLables, Style withLabels ){
this.noLabels = noLables;
this.withLabels = withLabels;
this.layer = layer;
}
void toggle( ){
IStyleBlackboard bb = layer.getStyleBlackboard();
if( bb.get( SLDContent.ID ) == withLabels ){
bb.put( SLDContent.ID, noLabels );
}else{
bb.put( SLDContent.ID, withLabels );
}
}
}
This class will toggle between the two provided styles. Your plugin
will have to depend on net.refractions.udig.style.sld for SLDContent
to be resolved.
You can use StyleBuilder and StyleFactory to create the styles. Or
you can parse the style the user created and remove the
TextSymbolizers. For and example on parsing styles look at the
DuplicatingStyleVisitor class in GeoTools.
Good luck,
Jesse
On Aug 8, 2007, at 12:38 AM, Andy Cox wrote:
> Jesse,
>
>
>
> I had a look and this is all very new to me and I’m not sure there
> is enough info on the page to work out what I need to do. I would
> like to do 2 things:
>
>
>
> Programmatically turn off a layers labels
> Thematically render a polygon layer based on it’s attributes e.g.
> if a field value=”y” colour code red, if it = “n” colour code green
> and then colour code all other polygons grey.
>
>
> Do you have any sample code to help with these. Any pointers would
> be great.
>
>
>
> Thanks
>
> Andy
>
>
>
> From: udig-devel-bounces at lists.refractions.net [mailto:udig-devel-
> bounces at lists.refractions.net] On Behalf Of Jesse Eichar
> Sent: 07 August 2007 17:44
> To: User-friendly Desktop Internet GIS
> Subject: Re: [udig-devel] Layer Label
>
>
>
> That's right. Hopefully there is enought information on that page I
> sent you if not give us a shout.
>
>
>
> Jesse
>
>
>
> On Aug 7, 2007, at 9:07 AM, Andy Cox wrote:
>
>
>
>
> Jesse,
>
> Yes I meant the labels rendered on the layer under the style editor
> which you access by right clicking the layer. I presume I still
> need to use the blackboard ?
>
> Thanks
> Andy
>
> From: udig-devel-bounces at lists.refractions.net [mailto:udig-devel-
> bounces at lists.refractions.net] On Behalf Of Jesse Eichar
> Sent: 07 August 2007 16:47
> To: User-friendly Desktop Internet GIS
> Subject: Re: [udig-devel] Layer Label
>
> I'm not sure what you refer to as a Layer Label. I'm guessing you
> mean the labels rendered on a layer? If so then you have to
> interact with the layer's style blackboard.
>
> Some documentation is here: http://udig.refractions.net/confluence/
> display/DEV/3+Style
>
> Good luck,
>
> Jesse
>
> On Aug 7, 2007, at 7:32 AM, Andrew Cox wrote:
>
>
>
>
>
> Hello,
>
> I have created a new new extension viewsAction and I want to be
> able to programatically switch a layer label off, rather than
> having to use the style editor. Please can anyone help?
>
> Thanks
> Andy
>
> Andy Cox ivyavenue at hotmail.com
>
>
>
> Email straight to your blog, upload jokes, photos and more. Windows
> Live Spaces, it's FREE!
>
> _______________________________________________
>
> User-friendly Desktop Internet GIS (uDig)
>
> http://udig.refractions.net
>
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
> _______________________________________________
>
> User-friendly Desktop Internet GIS (uDig)
>
> http://udig.refractions.net
>
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.refractions.net/pipermail/udig-devel/attachments/20070808/0d3c8c54/attachment-0001.html
More information about the udig-devel
mailing list