Re: [OpenMap Users] Confused about Filters

From: Don Dietrick <dietrick@bbn.com>
Date: Wed Mar 31 2004 - 09:36:32 EST

Hi Matt,

On Mar 30, 2004, at 1:42 AM, Matt Brennan wrote:

> hi there,
> i have a layer that extends OMGraphicsHandlerLayer and a filter
> extending FilterSupport. the filter, created during the layer
> constructor overrides the default 'filter' instance variable in OMGHL.
>
> in general, i'd like the filter to be applied always to affect the
> visibility of OMGraphics in the list - say to selectably display just
> OMCircles vs OMPolys based on an 'instanceof' test...
>
> i can see calls to getList and setList being generated, but no calls
> to actually apply the FilterSupport's "filter()" methods.
>
> so my questions are:
>
> - should my layer manually perform this filtering step ?

The way you've described it, I'd implement my own extension of
FilterSupport and set it on the layer.

But if you are grouping your OMGraphics for a more general purpose, you
might want to have separate sublists for the different types of objects
and just set the overall sublist visibility depending on your layer
settings. This would be much quicker than cycling through the list
doing the instanceof queries.

I depends on the number of OMGraphics you are filtering, I guess.

> - and where should this filtering be done to fit in with the OpenMap
> orthodoxy in terms of the standard OMGHL prepare() drawing sequence?

In prepare().

> (i sort of though this would already happen for free since each OMGHL
> already has a default instance of FilterSupport available - and was
> kind of expecting to see a call to filter(OMGraphicList omgl,
> Area area, boolean getInsideArea) somewhere in the
> generate/paint sequence.)

Normally, we just let java clipping or the layer handle what gets drawn
on the map. The filter method is really used for choosing subsets of
OMGraphics, so there's no real reason to call it for general purposes.

> and finally:
>
> - is there a good example of filters at work in the 4.6 codebase?

The DemoLayer uses them. The getGUI() method has buttons that call for
the drawing tool to create areas, and when the area is defined, the
drawingComplete method does the filtering.

- Don

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Mar 31 09:37:17 2004

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT