deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.crs.configuration.deegree.db
Class WKTParser

java.lang.Object
  extended by org.deegree.crs.configuration.deegree.db.WKTParser

public class WKTParser
extends Object

The WKTParser class instantiates the Coordinate System given in a file, in WKT (Well Known Text) format. The extendend Backus-Naur grammar of WKT as well as a detailed reference are available at the OGC website.

Version:
$Revision: $, $Date: $
Author:
Andrei Ionita, last edited by: $Author: ionita $

Field Summary
(package private)  StreamTokenizer tokenizer
           
 
Constructor Summary
WKTParser()
          Use this if you want to parse WKT strings directly using the parse method.
WKTParser(String fileName)
          Constructor
 
Method Summary
(package private)  String containsVariantsKey(Map<String,Double> params, String candidate)
           
(package private)  boolean equalsParameterVariants(String candidate, String paramName)
           
static void main(String[] args)
          For testing purposes.
 CoordinateSystem parse(String wkt)
           
(package private)  Unit parseAngularUnit()
           
(package private)  CRSCodeType parseAuthority()
           
(package private)  Axis parseAxis()
           
 CoordinateSystem parseCoordinateSystem()
           
(package private)  Ellipsoid parseEllipsoid()
           
(package private)  GeodeticDatum parseGeodeticDatum()
           
(package private)  Helmert parseHelmert()
           
(package private)  Unit parseLinearUnit()
           
(package private)  PrimeMeridian parsePrimeMeridian()
           
(package private)  String parseString()
           
(package private)  VerticalDatum parseVerticalDatum()
           
(package private)  void passOverChar(char ch)
          Walk a character (comma or round/square bracket).
(package private)  void passOverClosingBracket()
          Walk a closing bracket (round or square).
(package private)  void passOverOpeningBracket()
          Walk an opening bracket (round or square).
(package private)  void passOverWord(String s)
          Walk a WKT keyword element (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokenizer

StreamTokenizer tokenizer
Constructor Detail

WKTParser

public WKTParser(String fileName)
          throws IOException
Constructor

Parameters:
fileName - the file that contains a Coordinate System definition
Throws:
IOException - if the provided WKT has a syntax error

WKTParser

public WKTParser()
Use this if you want to parse WKT strings directly using the parse method.

Method Detail

equalsParameterVariants

boolean equalsParameterVariants(String candidate,
                                String paramName)

containsVariantsKey

String containsVariantsKey(Map<String,Double> params,
                           String candidate)

passOverChar

void passOverChar(char ch)
            throws IOException
Walk a character (comma or round/square bracket).

Parameters:
ch -
Throws:
IOException - if an I/O error occurs.
WKTParsingException - if the expected character is not present at this position.

passOverOpeningBracket

void passOverOpeningBracket()
                      throws IOException
Walk an opening bracket (round or square).

Throws:
IOException - if an I/O error occurs.
WKTParsingException - if the opening bracket is not present at this position.

passOverClosingBracket

void passOverClosingBracket()
                      throws IOException
Walk a closing bracket (round or square).

Throws:
IOException - if an I/O error occurs.
WKTParsingException - if the closing bracket is not present at this position.

passOverWord

void passOverWord(String s)
            throws IOException
Walk a WKT keyword element (e.g. DATUM, AUTHORITY, UNIT, etc.)

Parameters:
s - the keyword element as a String
Throws:
IOException - if an I/O error occurs.
WKTParsingException - if the keyword is not present at this position.

parseAuthority

CRSCodeType parseAuthority()
                     throws IOException
Returns:
a CRSCodeType object based on the information in the AUTHORITY element
Throws:
IOException - if an I/O error occurs

parseString

String parseString()
             throws IOException
Returns:
the string that is surrounded by double-quotes
Throws:
IOException - if an I/O error occurs
WKTParsingException - if the string does not begin with have an opening double-quote.

parseAxis

Axis parseAxis()
         throws IOException
Returns:
an Axis
Throws:
IOException
WKTParsingException - if the axis orientation is not one of the values defined in the WKT reference ( NORTH | SOUTH | WEST | EAST | UP | DOWN | OTHER )

parseLinearUnit

Unit parseLinearUnit()
               throws IOException
Returns:
a linear Unit ( METRE, BRITISHYARD, USFOOT )
Throws:
IOException
UnknownUnitException - if the unit name does not match any of the predefined units in the API

parseAngularUnit

Unit parseAngularUnit()
                throws IOException
Returns:
an angular Unit ( DEGREE, RADIAN, ARC_SEC, DMSH )
Throws:
IOException
UnknownUnitException - if the unit name does not match any of the predefined units in the API

parsePrimeMeridian

PrimeMeridian parsePrimeMeridian()
                           throws IOException
Returns:
a Prime Meridian
Throws:
IOException

parseEllipsoid

Ellipsoid parseEllipsoid()
                   throws IOException
Throws:
IOException

parseHelmert

Helmert parseHelmert()
               throws IOException
Throws:
IOException

parseGeodeticDatum

GeodeticDatum parseGeodeticDatum()
                           throws IOException
Returns:
a Geodetic Datum
Throws:
IOException

parseVerticalDatum

VerticalDatum parseVerticalDatum()
                           throws IOException
Returns:
a Vertical Datum
Throws:
IOException

parseCoordinateSystem

public CoordinateSystem parseCoordinateSystem()
                                       throws IOException
Returns:
a Coordinate System ( Compound CRS, Projected CRS, Geographic CRS, Geocentric CRS, Vertical CRS)
Throws:
IOException - if the provided WKT has a syntax error

parse

public CoordinateSystem parse(String wkt)
                       throws IOException
Parameters:
wkt - the wkt code as a String
Returns:
the parsed CoordinateSystem
Throws:
IOException - if the provided WKT has a syntax error

main

public static void main(String[] args)
                 throws IOException
For testing purposes.

Parameters:
args - the first argument is the file containing the Coordinate System.
Throws:
IOException - if the provided WKT has a syntax error

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>