## com.bbn.openmap.omGraphics
Class FilterSupport

    java.lang.Object
      com.bbn.openmap.omGraphics.FilterSupport

All Implemented Interfaces:
  OMGraphicHandler, java.io.Serializable

public class FilterSupport
extends java.lang.Object
implements OMGraphicHandler, java.io.Serializable

This class provides support for implementing the OMGraphicHandler interface. If you already calculate an OMGraphicList, you can use this class to apply filtering to it. The graphics on the list you provide it will be made visible or not depending on whether they meet the filter criteria.

The visibility of the graphics is affected when a filter is applied, and visiblity is used as the test if whether a graphic is added to a returned list. Use resetFiltering() to turn visibility back on for all the OMGraphics. If a graphic is not visible when a filter is applied, then the filter test will automatically fail.

See Also:
  Serialized Form

Field Summary
`protected boolean` `DEBUG`
`protected OMGraphicList` `list` The source graphic list.
`protected boolean` `precise` A flag to use the Area.intersets(Area) test, which may be a performance hit.

Constructor Summary
`FilterSupport()`
`FilterSupport(OMGraphicList omgl)`

Method Summary
`boolean` `canSetList()` Indicates if the OMGraphicHandler can have its OMGraphicList set.
`boolean` `doAction(OMGraphic graphic, OMAction action)` Allows the OMGraphicHandler to receive graphics or take some action on one.
`protected void` `failedFilter(OMGraphic omg)` Method called when FilterSupport finds an OMGraphic that fails the filter test.
`OMGraphicList` `filter(java.awt.Shape withinThisShape)` Filters the OMGraphicHandler graphic list so that graphics within the given shape will be visible.
`OMGraphicList` `filter(java.awt.Shape shapeBoundary, boolean getInsideBoundary)` Filters the OMGraphicHandler graphic list so that graphics inside or outside the given shape will be visible.
`OMGraphicList` `filter(java.lang.String SQLQuery)` Filters the OMGraphicHandler graphic list so that graphics meeting the SQL query statement will be visible.
`protected OMGraphicList` `filterList(OMGraphicList omgl, java.awt.geom.Area area, boolean getInsideArea)` Method that provides a recursive mechanism to go through OMGraphicsLists to filter out areas, inside or outside another.
`OMGraphicList` `getList()` Return the graphic list currently being used by the OMGraphicHandler.
`protected void` `passedFilter(OMGraphic omg)` Method called when FilterSupport finds an OMGraphic that passes the filter test.
`void` `resetFiltering()` Remove all filters, and reset all graphics to be visible.
`void` `setList(OMGraphicList omgl)` Set the OMGraphicList within this OMGraphicHandler.
`boolean` `supportsSQL()` Returns true if the OMGraphicHandler can handle SQL statements for filtering.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### list

    protected OMGraphicList list

  The source graphic list.

### precise

    protected boolean precise

  A flag to use the Area.intersets(Area) test, which may be a performance hit.

### DEBUG

    protected boolean DEBUG

Constructor Detail

### FilterSupport

    public FilterSupport()

### FilterSupport

    public FilterSupport(OMGraphicList omgl)

Method Detail

### filter

    public OMGraphicList filter(java.awt.Shape withinThisShape)

  Filters the OMGraphicHandler graphic list so that graphics within the given shape will be visible. Returns an OMGraphicList with those visible shapes. The returned list should not be assumed to be the same OMGraphicList object that is maintained inside the OMGraphicHandler. Same as calling filter(withinThisShape, true).

  Specified by:
    `filter` in interface `OMGraphicHandler`
  Parameters:
    `withinThisShape` - java.awt.Shape object defining a boundary.
  Returns:
    OMGraphicList containing OMGraphics that are within the Shape.

### filter

    public OMGraphicList filter(java.awt.Shape shapeBoundary,
                                boolean getInsideBoundary)

  Filters the OMGraphicHandler graphic list so that graphics inside or outside the given shape will be visible. Returns an OMGraphicList with those visible shapes. The returned list should not be assumed to be the same OMGraphicList object that is maintained inside the OMGraphicHandler.

  Specified by:
    `filter` in interface `OMGraphicHandler`
  Parameters:
    `shapeBoundary` - java.awt.Shape object defining a boundary.
    `getInsideBoundary` - if true, the filter will look for shapes inside and contacting the boundary. If false, the filter will look for shapes outside the boundary.
  Returns:
    OMGraphicList containing OMGraphics that are within the Shape.

### filterList

    protected OMGraphicList filterList(OMGraphicList omgl,
                                       java.awt.geom.Area area,
                                       boolean getInsideArea)

  Method that provides a recursive mechanism to go through OMGraphicsLists to filter out areas, inside or outside another.

### supportsSQL

    public boolean supportsSQL()

  Returns true if the OMGraphicHandler can handle SQL statements for filtering.

  Specified by:
    `supportsSQL` in interface `OMGraphicHandler`

### filter

    public OMGraphicList filter(java.lang.String SQLQuery)

  Filters the OMGraphicHandler graphic list so that graphics meeting the SQL query statement will be visible. Returns an OMGraphicList with those visible shapes. The returned list should not be assumed to be the same OMGraphicList object that is maintained inside the OMGraphicHandler.

  Specified by:
    `filter` in interface `OMGraphicHandler`
  Parameters:
    `SQLQuery` - a SELECT SQL statement
  Returns:
    OMGraphicList containing OMGraphics that meet the SELECT statemenet criteria.

### doAction

    public boolean doAction(OMGraphic graphic,
                            OMAction action)

  Allows the OMGraphicHandler to receive graphics or take some action on one.

  Specified by:
    `doAction` in interface `OMGraphicHandler`
  Parameters:
    `graphic` - the OMGraphic to do the action on.
    `action` - the OMAction describing what to do to the graphic.
  Returns:
    true if the action was able to be carried out.

### getList

    public OMGraphicList getList()

  Return the graphic list currently being used by the OMGraphicHandler. If filters have been applied, then the OMGraphics that have made it through the filter are visible. List may be null, if it hasn't been set.

  Specified by:
    `getList` in interface `OMGraphicHandler`
  See Also:
    `BasicGeometry.isVisible().`

### canSetList

    public boolean canSetList()

  Indicates if the OMGraphicHandler can have its OMGraphicList set.

  Specified by:
    `canSetList` in interface `OMGraphicHandler`

### setList

    public void setList(OMGraphicList omgl)

  Set the OMGraphicList within this OMGraphicHandler. Works if canSetGraphicList == true.

  Specified by:
    `setList` in interface `OMGraphicHandler`

### resetFiltering

    public void resetFiltering()

  Remove all filters, and reset all graphics to be visible.

  Specified by:
    `resetFiltering` in interface `OMGraphicHandler`

### failedFilter

    protected void failedFilter(OMGraphic omg)

  Method called when FilterSupport finds an OMGraphic that fails the filter test. The OMGraphic is not being added to a list that is being returned for passing OMGraphics in another method, this call-out is an opportunity to make settings on OMGraphics that pass the filter. By default, the visibility of the OMGraphic is set to false.

### passedFilter

    protected void passedFilter(OMGraphic omg)

  Method called when FilterSupport finds an OMGraphic that passes the filter test. The OMGraphic is already being added to a list that is being returned in another method, this call-out is an opportunity to make settings on OMGraphics that pass the filter.

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details