org.ala.layers.intersect
Class SimpleShapeFile

java.lang.Object
  extended by org.ala.layers.intersect.SimpleShapeFile
All Implemented Interfaces:
java.io.Serializable

public class SimpleShapeFile
extends java.lang.Object
implements java.io.Serializable

SimpleShapeFile is a representation of a Shape File for intersections with points .shp MULTIPOLYGON only .dbf can read values from String and Number columns only TODO: finish serialization

Author:
Adam Collins
See Also:
Serialized Form

Constructor Summary
SimpleShapeFile(java.lang.String fileprefix, java.lang.String column)
          Constructor for a SimpleShapeFile, requires .dbf and .shp files present on the fileprefix provided.
 
Method Summary
 int getColumnIdx(java.lang.String column_name)
          returns the position, zero indexed, of the provided column_name from within the .dbf
 java.lang.String[] getColumnLookup()
           
 java.lang.String[] getColumnLookup(int column)
          returns set of values found in the .dbf file at a column number, zero base.
 java.lang.String getHeaderString()
          gets shape header as String
 java.lang.String getValueString(int idx)
           
 int[] intersect(double[][] points, java.lang.String[] lookup, int column, int threadcount)
          use when created from a shape file identifies the index within a lookup list provided for each provided point, or -1 for not found.
 java.lang.String intersect(double longitude, double latitude)
           
 int intersectInt(double longitude, double latitude)
           
 java.lang.String[] listColumns()
          returns a list of column names in the .dbf file
 boolean loadRegion(java.lang.String filename)
          save partial file (enough to reload and use intersect function)
static ComplexRegion loadShapeInRegion(java.lang.String filename, int idx)
          save partial file (enough to reload and use intersect function)
static SimpleRegion parseWKT(java.lang.String pointsString)
          defines a region by a points string, POLYGON only TODO: define better format for parsing, including BOUNDING_BOX and CIRCLE
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleShapeFile

public SimpleShapeFile(java.lang.String fileprefix,
                       java.lang.String column)
Constructor for a SimpleShapeFile, requires .dbf and .shp files present on the fileprefix provided.

Parameters:
fileprefix - file path for valid files after appending .shp and .dbf
Method Detail

loadRegion

public boolean loadRegion(java.lang.String filename)
save partial file (enough to reload and use intersect function)

Parameters:
filename -
Returns:
true when successful

loadShapeInRegion

public static ComplexRegion loadShapeInRegion(java.lang.String filename,
                                              int idx)
save partial file (enough to reload and use intersect function)

Parameters:
filename -

listColumns

public java.lang.String[] listColumns()
returns a list of column names in the .dbf file

Returns:
list of column names as String []

getColumnLookup

public java.lang.String[] getColumnLookup(int column)
returns set of values found in the .dbf file at a column number, zero base.

Parameters:
column - integer representing column whose set of values is to be returned. see listColumns() for listing column names.
Returns:
set of values in the column as String [] sorted

getColumnIdx

public int getColumnIdx(java.lang.String column_name)
returns the position, zero indexed, of the provided column_name from within the .dbf

Parameters:
column_name -
Returns:
-1 if not found, otherwise column index number, zero base

intersect

public int[] intersect(double[][] points,
                       java.lang.String[] lookup,
                       int column,
                       int threadcount)
use when created from a shape file identifies the index within a lookup list provided for each provided point, or -1 for not found.

Parameters:
points - double [n][2] where n is number of points [][0] is longitude [][1] is latitude
lookup - String [], same as output from getColumnLookup(column)
column - .dbf column value to use
Returns:
index within a lookup list provided for each provided point, or -1 for not found as int []

intersect

public java.lang.String intersect(double longitude,
                                  double latitude)

intersectInt

public int intersectInt(double longitude,
                        double latitude)

getHeaderString

public java.lang.String getHeaderString()
gets shape header as String

Returns:
String

getValueString

public java.lang.String getValueString(int idx)

getColumnLookup

public java.lang.String[] getColumnLookup()

parseWKT

public static SimpleRegion parseWKT(java.lang.String pointsString)
defines a region by a points string, POLYGON only TODO: define better format for parsing, including BOUNDING_BOX and CIRCLE

Parameters:
pointsString - points separated by ',' with longitude and latitude separated by ':'
Returns:
SimpleRegion object


Copyright © 2014. All Rights Reserved.