Interesting; It is slightly more correct to use the thread local env variable 
(rather than a global) if you have many renderers. Just call the correct method 
and set "simple" for that thread prior to calling the renderer .... scalable 
solution without a GUID hack.

-- 
Jody Garnett


On Wednesday, 6 July 2011 at 7:18 PM, LSA wrote:

> I used approach with EnvFunction.setGlobalValue("simple", 
> simpleFeatureFilter ) and it worked like a charm.
> 
> One small notice, I used GUIDs instead of "simple", because in our 
> applications we have many renderers sometimes.
> 
> Thank you very much,
> Sergey
> 
> On 05.07.2011 18:28, Jody Garnett wrote:
> > In your calling code you have a choice....
> > 
> > static ISimpleFeatureFilter SIMPLE_FILTER = ....
> > Filter filter = ff.equals( ff.function( "wrapper", ff.literal( 
> > SIMPLE_FILTER ) ), ff.literal( Boolean.TRUE ) );
> > 
> > 1) Your ISimpleFeatureFilter is handed as an literal and thus can be 
> > copied when Style needs to look at it
> > 2) It does not (and your original does not) indicate to the rendering 
> > system what attributes it wants the feature to have; so they may not 
> > be requested (and the feature could be full of empty null values at 
> > runtime). Just so you know ...
> > 
> > The other thing you could do is use an environment variable ... 
> > http://docs.geotools.org/latest/javadocs/org/geotools/filter/function/EnvFunction.html
> > 
> > This is a good choice if you want want to change the value over time 
> > (perhaps as your user interacts?).
> > 
> > EnvFunction.setGlobalValue("simple", simpleFeatureFilter );
> > Filter filter = ff.equals( ff.function( "wrapper", ff.function( "env", 
> > "simple" ) ), ff.literal( Boolean.TRUE ) );
> > 
> > .. later ...
> > 
> > EnvFunction.setGlobalValue("simple", simpleFeatureFilter2 );
> > 
> > Do you have a JIRA issue open on this topic? It would be good to 
> > record some ideas and actually solve this; and it would be nice if you 
> > can tell me if the above ideas work (perhaps I can get a blog post or 
> > a tutorial out of this discussion).
> > 
> > -- 
> > Jody Garnett

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to