gistoolkit.datasources
Class WKTFactory

java.lang.Object
  extended bygistoolkit.datasources.WKTFactory

public class WKTFactory
extends java.lang.Object

Class for converting Well Known Text(WKT) representations of a shape into their Shape counterparts.

Author:
bitterstorm

Constructor Summary
WKTFactory()
          Creates new WKTFactory
 
Method Summary
static void main(java.lang.String[] inArgs)
          Test the Parser
static LineString parseLineString(java.lang.String inWKT)
          Convert the Well Know Text (WKT) representation of a line string into a LineString.
static MultiLineString parseMultiLineString(java.lang.String inWKT)
          Convert the Well Known Text (WKT) representaion of a multi line string into a MultiLineString.
static MultiPoint parseMultiPoint(java.lang.String inWKT)
          Convert the Well Known Text (WKT) representation of a multi point into a MultiPoint.
static MultiPolygon parseMultiPolygon(java.lang.String inWKT)
          Convert the Well Known Text (WKT) representation of multi polygon into a MultiPolygon.
static Point parsePoint(java.lang.String inWKT)
          Convert the Well Know Text (WKT) representation of a point into a Point.
protected static Point parsePoint(java.lang.String inWKT, int inStartIndex, int inEndIndex)
          parse a point from a space separated set of numbers.
protected static Point[][] parsePointGroups(java.lang.String inWKT, int inStartIndex, int inEndIndex)
          Parse muliple sets of points from a space separated comma delimited, and parenthetically grouped set of numbers.
protected static Point[] parsePoints(java.lang.String inWKT, int inStartIndex, int inEndIndex)
          parse a set of points from a space separated coma delimited set of numbers.
static Polygon parsePolygon(java.lang.String inWKT)
          Convert the Well Know Text (WKT) representation of a polygon into a Polygon.
static Shape parseShape(java.lang.String inWKT)
          Retrieve the shape from the text string
static void writePoints(Point[] inPoints)
          Write out the point Array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WKTFactory

public WKTFactory()
Creates new WKTFactory

Method Detail

parseShape

public static Shape parseShape(java.lang.String inWKT)
                        throws java.lang.Exception
Retrieve the shape from the text string

Throws:
java.lang.Exception

parsePoint

public static Point parsePoint(java.lang.String inWKT)
                        throws java.lang.Exception
Convert the Well Know Text (WKT) representation of a point into a Point.

Throws:
java.lang.Exception

parseLineString

public static LineString parseLineString(java.lang.String inWKT)
                                  throws java.lang.Exception
Convert the Well Know Text (WKT) representation of a line string into a LineString.

Throws:
java.lang.Exception

parsePolygon

public static Polygon parsePolygon(java.lang.String inWKT)
                            throws java.lang.Exception
Convert the Well Know Text (WKT) representation of a polygon into a Polygon.

Throws:
java.lang.Exception

parseMultiPoint

public static MultiPoint parseMultiPoint(java.lang.String inWKT)
                                  throws java.lang.Exception
Convert the Well Known Text (WKT) representation of a multi point into a MultiPoint.

Throws:
java.lang.Exception

parseMultiLineString

public static MultiLineString parseMultiLineString(java.lang.String inWKT)
                                            throws java.lang.Exception
Convert the Well Known Text (WKT) representaion of a multi line string into a MultiLineString.

Throws:
java.lang.Exception

parseMultiPolygon

public static MultiPolygon parseMultiPolygon(java.lang.String inWKT)
                                      throws java.lang.Exception
Convert the Well Known Text (WKT) representation of multi polygon into a MultiPolygon.

Throws:
java.lang.Exception

parsePoint

protected static Point parsePoint(java.lang.String inWKT,
                                  int inStartIndex,
                                  int inEndIndex)
                           throws java.lang.Exception
parse a point from a space separated set of numbers. An example of input may be "1.2 2.3 3.4".

Throws:
java.lang.Exception

parsePoints

protected static Point[] parsePoints(java.lang.String inWKT,
                                     int inStartIndex,
                                     int inEndIndex)
                              throws java.lang.Exception
parse a set of points from a space separated coma delimited set of numbers. An example of input may be "1.2 2.3 3.4, 100 200.2, 25 35 45".

Throws:
java.lang.Exception

parsePointGroups

protected static Point[][] parsePointGroups(java.lang.String inWKT,
                                            int inStartIndex,
                                            int inEndIndex)
                                     throws java.lang.Exception
Parse muliple sets of points from a space separated comma delimited, and parenthetically grouped set of numbers. An example of the type of string that should be sent in is the following. (1.2 2.3 3.4, 1.3 3.4 4.5, 1.4 2.5 3.6),(9.8 8.7,3.4 4.3,1.2 1.3, 1.5 2.3)

Throws:
java.lang.Exception

main

public static void main(java.lang.String[] inArgs)
Test the Parser


writePoints

public static void writePoints(Point[] inPoints)
Write out the point Array