There are are a couple ways to use filter.
1. the usual way is to update the style (configure a Rule with your filter; and
it will only draws what matches the filter).
2. there is also a layer.setFilter( filter ) method which will change the
selection ( not what you want)
3. you can place a filter on the style blackboard (you can try this yourself
using the styled editor). The result is used to create virtual "view" of the
original data source.
Finally I need to ask what your values are? For many common values they should
be considered part of the viewport model for the map; such as elevation or
depth or time. You can look at the jgrass project for an example of a user
interface allowing these kind of values to be set. You also need to teach the
renderers how to use these values (or write custom renderers).
--
Jody Garnett
On Monday, 23 May 2011 at 9:57 PM, Jaime Lop wrote:
> Hello,
>
> I have a postgis view containing somo points. In uDig I create a layer using
> postgis directly as a the data source.
>
> I created a plugin with a dual slider to select a range of values and I would
> like to filter the features shown in uDig based on this range. How do I do
> that?
> I see geotools has a factory for creating filters. Do I have to do somthing
> like this?
>
> FilterFactory2 ff = (FilterFactory2)
> CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
> PropertyIsGreaterThanOrEqualTo minIncluded =
> ff.greaterOrEqual(ff.property("ATTRIBUT"), ff.literal(min));
> PropertyIsLessThanOrEqualTo maxIncluded = ff.lessOrEqual(
> ff.property("ATTRIBUT"), ff.literal(max));
> And and = ff.and(minIncluded, maxIncluded);
>
> What do I have to do next to apply the filter to a specific layer?
>
> Thanks,
> Jaime
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel