Sure I can do that. I will see about creating a standalone DirectLayer Map 
Legend example (code and some explanatory text).  Is that what you had in mind? 
 Where would you see it being posted?  That would help me understand what 
content to create.

 

Hal

 

From: Jody Garnett [mailto:jody.garn...@gmail.com] 
Sent: Thursday, November 27, 2014 3:29 PM
To: Hal Mirsky
Cc: Andy Turner; geotools geotools-gt2-users@lists. sourceforge. net
Subject: Re: [Geotools-gt2-users] Choropleth map legend

 

That would be a killer example for the docs Hal - are you in position to share 
your code?




Jody Garnett

 

On Tue, Nov 25, 2014 at 2:22 PM, Hal Mirsky <hmir...@aseg.com> wrote:

Andy,
I derived a class from DirectLayer and implemented the draw method which
worked great.

Some of the legend text was dynamic (e.g. low/high values for each color).
A little interesting to figure out the size of rectangles I needed to draw
for each legend item.  Here's a snippet:

private Font titlef = new Font("Ariel", Font.BOLD, 12);
private Font itemf  = new Font("Ariel", Font.BOLD, 10);

Rectangle2D titleLabelRect = titlef.getStringBounds(title, new
FontRenderContext(null, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT,
RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT));

Rectangle2D itemLabelRect = itemf.getStringBounds(label, new
FontRenderContext(null, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT,
RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT));

// now get the height of the title rectangle and height to use for each
legend item:

th = (int) titleLabelRect.getHeight();
ih = (int) itemLabelRect.getHeight();  // height of site label.  Also used
as icon size
 ...

Hope this helps,
Hal

-----Original Message-----
From: Andy Turner [mailto:a.g.d.tur...@leeds.ac.uk]
Sent: Tuesday, November 25, 2014 11:36 AM
To: geotools-gt2-users@lists.sourceforge.net
Subject: [Geotools-gt2-users] Choropleth map legend

Hi,

I would like to have a map legend for the choropleth maps I am generating,
please will you help?

To style the main part of the map I have followed an example using
ColorBrewer and FilterFactory2. I have a Classifier by calling evaluate on a
Function from the FilterFactory2.

I've have searched and found others asking about this [1], but no answers.

[1]
http://gis.stackexchange.com/questions/22962/create-a-color-scale-legend-for 
<http://gis.stackexchange.com/questions/22962/create-a-color-scale-legend-for-choropleth-map-using-geotools-or-other-open-sou>
 
-choropleth-map-using-geotools-or-other-open-sou

Thanks,

Andy
http://www.geog.leeds.ac.uk/people/a.turner/index.html



----------------------------------------------------------------------------
--
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from
Actuate! Instantly Supercharge Your Business Reports and Dashboards with
Interactivity, Sharing, Native Excel Exports, App Integration & more Get
technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751 
<http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk> 
&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751 
<http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk> 
&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

 

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to