|
From: Andy T. <A.G...@le...> - 2014-11-27 01:51:24
|
Thanks Hal,
I tried making a class by extending DirectLayer.
I tried adding it as a layer to the MapContent. It does something, but I have not figured out what as yet...
I'm going to work on this tomorrow. It is most important for me that I can get the bounds for each of the classes. Ideally I would like to produce a legend, but at the moment I haven't found a way of getting the values back... Hopefully I will find a way tomorrow, but if anyone has any further pointers, that would be great.
Cheers,
Andy
-----Original Message-----
From: Hal Mirsky [mailto:hm...@as...]
Sent: 25 November 2014 22:22
To: Andy Turner; geo...@li...
Subject: RE: [Geotools-gt2-users] Choropleth map legend
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...@le...]
Sent: Tuesday, November 25, 2014 11:36 AM
To: geo...@li...
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
-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&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
Geo...@li...
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
|