Unfortunately, that's not the behavior I'm seeing. I create my fill function
like so:
Fill fill = styleFactory.createFill(
newColor, // function to choose feature
colour
filterFactory.literal(1.0f)); // opacity
where newColor is my external function. When I use
JMapFrame.showMap(map); to show the map, it makes exactly one call to
newColor.evaluate(Object), where the parameter is a SimpleFeatureImpl object
containing only the geometry. My evaluate function looks like this:
@Override
public Object evaluate(Object object) {
return Color.GREEN;
}
Unless the calling routine is "sensing" that I am returning a constant, there
is no reason that this should only be called once for a map with 18,000
features.
I'm fully confident that I have screwed something up, but I have no way to
identify what it is, because I have no working model to compare this to. The
model that I was working from, the "ColorLookupFunction" example/tutorial, has
apparently been broken by changes in the underlying classes and was deprecated
by the author anyway. And the Javadocs are, frankly, impenetrable to a
casual observer. I don't THINK I'm an idiot, but Geotools has defeated me on
this issue - I have no idea what to do next.
I simply want to draw a thematic map using a shapefile and a database - I don't
think this should be this hard.
----- Original Message -----
From: Andrea Aime
To: [email protected]
Cc: [email protected]
Sent: Sunday, June 24, 2012 8:08 AM
Subject: Re: [Geotools-gt2-users] Passing a feature to a function
On Sun, Jun 24, 2012 at 4:49 PM, <[email protected]> wrote:
I'm looking for an example (or some documentation would be nice) on how to
pass a feature to a function as you draw a map. Conceptually I need to do
this:
fill = createFill(myFunction(feature.attribute))
Where myFunction(feature.attribute) would go off and look up the proper
fill color based on some attribute of the current feature. (The fill color
could be different for each feature, in other words).
The trouble I'm having is that there does not seem to be any clear example
or documentation about how to pass the current feature to this function - all
the examples I've found are either deprecated or don't seem to address what I
need to do.
Does anyone have an example they'd be willing to share, or a link to some
documentation for Geotools 8.0-RC1?
A function receives an object, when you are rendering that object is always
the Feature itself, everything else is passed
as an explicit parameter instead.
Cheers
Andrea
--
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users