org.gcube.indexmanagement.geoindexlookup.defaultplugins.refinement
Class PolygonalRefiner

java.lang.Object
  extended by Refiner
      extended by org.gcube.indexmanagement.geoindexlookup.defaultplugins.refinement.PolygonalRefiner

public class PolygonalRefiner
extends Refiner

A Refiner which refines based on whether a polygonal query overlaps/contains/is-inside entries.This RankEvaluator will work with any GeoIndexType.


Constructor Summary
PolygonalRefiner()
           
 
Method Summary
static Envelope getBoundingBox(Polygon sp)
          A method to get the Minimum Bounding Rectanngle of a polygon (as a jts Envelope object).
 void initialize(java.lang.String[] args)
          
 boolean isHit(DataWrapper entry)
          
 boolean isIndexTypeCompatible(GeoIndexType indexType)
          
static boolean isPointInsidePolygon(long x, long y, Polygon sp, boolean isBoundaryInside)
          A method to check whether a point is inside a polygon ****************************************************************** ****************************************************************** ** Algorithm used to determine if a point is inside a polygon ** ** ____________________________ ** ** _/ \ ** ** _/ X | ** ** _/ | / ** ** | __________|_(crossing 1)__/ ** ** | / | ** ** | | | ** ** | \__________|_(crossing 2)___ ** ** \_ | \ ** ** \_ | | ** ** \_ | / ** ** \___________|_(crossing 3)__/ ** ** | ** ** | ** ** V ** ** ** ** 3 crossings; 3 is an odd number; therefore inside ** ** ** ****************************************************************** ******************************************************************
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonalRefiner

public PolygonalRefiner()
Method Detail

isIndexTypeCompatible

public boolean isIndexTypeCompatible(GeoIndexType indexType)


isHit

public boolean isHit(DataWrapper entry)


initialize

public void initialize(java.lang.String[] args)
                throws RefinerInitializationException

Throws:
RefinerInitializationException

isPointInsidePolygon

public static boolean isPointInsidePolygon(long x,
                                           long y,
                                           Polygon sp,
                                           boolean isBoundaryInside)
A method to check whether a point is inside a polygon ****************************************************************** ****************************************************************** ** Algorithm used to determine if a point is inside a polygon ** ** ____________________________ ** ** _/ \ ** ** _/ X | ** ** _/ | / ** ** | __________|_(crossing 1)__/ ** ** | / | ** ** | | | ** ** | \__________|_(crossing 2)___ ** ** \_ | \ ** ** \_ | | ** ** \_ | / ** ** \___________|_(crossing 3)__/ ** ** | ** ** | ** ** V ** ** ** ** 3 crossings; 3 is an odd number; therefore inside ** ** ** ****************************************************************** ******************************************************************

Parameters:
x - - The X coordinate of the point to check whether is inside the polygon.
y - - The X coordinate of the point to check whether is inside the polygon.
sp - - The polygon to check whether contains the point.
isBoundaryInside - - An indicator of whether a point residing on the border is to be considered as inside the polygon.
Returns:
TRUE if the point is inside the polygon.

getBoundingBox

public static Envelope getBoundingBox(Polygon sp)
A method to get the Minimum Bounding Rectanngle of a polygon (as a jts Envelope object).

Parameters:
sp - - The polygon of which to get the Minimum Bounding Rectangle
Returns:
The Minimum Bounding Rectanngle of the polygon