From: Rakshit M. <ra...@th...> - 2012-03-26 13:07:58
|
{Please also send mails to the mailing list too,so everyone can contribute and help us.} Ahh. , Actually in my case, it was required to change the code of JMapFrame. So I could not make it pluggable. But I can give you an idea what it was doing : - for the color expression, call one function which will create an HashMap<Object,Color> Object : attribute which needs to be coloured Color : the unique color generated according to value of attribute. . Now, from the user, the system will ask about new values of Text to display in front of color and I created a Resizable and draggable JPanel which shows final result as a table with Color - String pairs which is having a transparent background. So, that was my way of representing legend and by making a draggable and resizable JPanel, we could make it more user friendly. Hope I was clear and my way helped you a bit. Please let me know if I made any silly mistake or chose a longer way. Thank you, Rax ________________________________ Best regards,Rakshit Majithiya Techno geek, Web Developer,Code Lover email : ra...@th... blog : http://thetechtime.com skype : rakshit.majithiya ________________________________ From: Kakpo Adoko <ad...@ho...> To: ra...@th... Sent: Monday, 26 March 2012 4:06 PM Subject: RE: : [Geotools-gt2-users] Legend in geotools Hi Rax, Nice to hear from you. My approach for showing different colours to features was based: 1) Reading features attributes with Expression: Expression expr = ff.property("attrName"); String attrName = expr.evaluate( feature, String.class ); 2) And a between rule creation: Filter filter = ff.between(ff.property(attrName), ff.literal(thres[i]),ff.literal(thres[i+1])); rule.setFilter(filter); * thres[i] being the integer array containing attribute values defining the bandwidths. How did you develop the legend module? Can it be used as plug-in? Thanks. Regards, Kakpo > Date: Mon, 26 Mar 2012 18:07:52 +0800 > From: ra...@th... > Subject: Re:: [Geotools-gt2-users] Legend in geotools > To: ad...@ho... > > > hello !! > I've developed legend module using geotools. > For this purpose, basically I've used colour function. > Can you let me know about your approach to show different colors according to features ?? > > Thanks, > Rax > ------------------------------ > On Mon 26 Mar, 2012 3:05 PM IST Kakpo Adoko wrote: > > > > >Hi All, > >I am trying to develop a small shapefile application with Geotools (version 2.7.1). Currently, I am able to show the map colour-coded by polygon attributes (eg. population density, etc). > >How can I display the map's legend annotated by colour band? > >I look forward to hearing from you. > >Many thanks in advance, > >Kakpo AdokoPhD researcher,TU DelftThe Netherlands |