org.opensha.commons.eq.cat.filters
Class PolygonFilter

java.lang.Object
  extended by org.opensha.commons.eq.cat.filters.PolygonFilter
All Implemented Interfaces:
CatalogFilter

public class PolygonFilter
extends Object
implements CatalogFilter

This class filters catalogs down to those events that fall within a polygon of lat/lon points. TODO: Algorithm results as yet are unspecified for polygons that traverse the International Date Line or encircle polar regions. TODO clean up error checking etc

Version:
$Id: PolygonFilter.java 8066 2011-07-22 23:59:04Z kmilner $
Author:
P. Powers

Field Summary
 
Fields inherited from interface org.opensha.commons.eq.cat.filters.CatalogFilter
FILTER_ERROR, FILTER_ERROR_NO_RESULT, FILTER_STATUS_IDLE, FILTER_STATUS_WORKING
 
Constructor Summary
PolygonFilter()
          Constructs a new empty polygon filter that will pruduce no results.
PolygonFilter(double[] lats, double[] lons)
          Constructs a new polygon filter with the specified vertices.
 
Method Summary
 int[] process(MutableCatalog catalog)
          Processes a given MutableCatalog against a filter.
 void setPolygon(double[] lats, double[] lons)
          Sets the vertices of the polygon filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonFilter

public PolygonFilter()
Constructs a new empty polygon filter that will pruduce no results.


PolygonFilter

public PolygonFilter(double[] lats,
                     double[] lons)
Constructs a new polygon filter with the specified vertices.

Parameters:
lats - latitude vertex values of the polygon
lons - longitude vertex values of the polygon
Method Detail

setPolygon

public void setPolygon(double[] lats,
                       double[] lons)
Sets the vertices of the polygon filter.

Parameters:
lats - latitude vertex values of the polygon
lons - longitude vertex values of the polygon arrays are different lengths

process

public int[] process(MutableCatalog catalog)
Description copied from interface: CatalogFilter
Processes a given MutableCatalog against a filter. Returns an array of valid event indices. Returns null if filter produces no results.

Specified by:
process in interface CatalogFilter
Parameters:
catalog - to process
Returns:
array of event indices