org.geotoolkit.io.wkt
Class ReferencingParser

Object
  extended by Parser
      extended by MathTransformParser
          extended by ReferencingParser

public class ReferencingParser
extends MathTransformParser

Well Known Text (WKT) parser for referencing objects. This include, but is not limited too, Coordinate Reference System objects. This parser can parse Math Transform objects as well because they are part of the WKT's "FITTED_CS" element. Default axis names The default axis names differ depending on whatever the parsing shall be strictly compliant to the legacy WKT specification, or whatever ISO 19111 identifiers shall be used instead. The following table compares the names:

CRS type WKT defaultsISO abbreviations
GeographicLon, Lat λ, φ
Vertical H h
Projected X, Y x, y
GeocentricX, Y, Z X, Y, Z
The default behavior is to use the legacy WKT identifiers, for compliance with the WKT specification. This behavior can be changed by call to setISOConform(boolean). Note that Geotk referencing factories like WKTParsingAuthorityFactory perform the above-cited setISOConform(true) method call on their internal parser instance, for ISO compliance.

Since:
2.0
Version:
3.19
Author:
Rémi Eve (IRD), Martin Desruisseaux (IRD, Geomatys)
See Also:
Well Know Text specification, OGC WKT Coordinate System Issues
Module:
referencing/geotk-referencing (download)    View source code for this class

Constructor Summary
ReferencingParser()
          Creates a parser using the default set of symbols and factories.
ReferencingParser(Symbols symbols, DatumFactory datumFactory, CSFactory csFactory, CRSFactory crsFactory, MathTransformFactory mtFactory)
          Constructs a parser for the specified set of symbols using the specified set of factories.
ReferencingParser(Symbols symbols, Hints hints)
          Creates a parser using the specified set of symbols.
ReferencingParser(Symbols symbols, ReferencingFactoryContainer factories)
          Constructs a parser for the specified set of symbols using the specified set of factories.
 
Method Summary
protected  Map<String,Object> alterProperties(Map<String,Object> properties)
          Returns the properties to be given to the parsed object.
 boolean isAxisIgnored()
          Returns true if AXIS[...] elements will be ignored during parsing.
 boolean isISOConform()
          Returns true if the default names of AXIS[...] elements shall be ISO 19111 identifiers.
 CoordinateReferenceSystem parseCoordinateReferenceSystem(String text)
          Parses a coordinate reference system element.
 void setAxisIgnored(boolean ignored)
          Sets whatever AXIS[...] elements will be ignored during parsing.
 void setISOConform(boolean conform)
          Sets whatever the default names of AXIS[...] elements shall be ISO identifiers.
 
Methods inherited from class MathTransformParser
parseMathTransform
 
Methods inherited from class Parser
parseObject, parseObject
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferencingParser

public ReferencingParser()
Creates a parser using the default set of symbols and factories.


ReferencingParser

public ReferencingParser(Symbols symbols,
                         Hints hints)
Creates a parser using the specified set of symbols. Default factories are fetching according the given hints.

Parameters:
symbols - The symbols for parsing and formatting numbers.
hints - The hints to be used for fetching the factories, or null for the system-wide default hints.

ReferencingParser

public ReferencingParser(Symbols symbols,
                         ReferencingFactoryContainer factories)
Constructs a parser for the specified set of symbols using the specified set of factories.

Parameters:
symbols - The symbols for parsing and formatting numbers.
factories - The factories to use.

ReferencingParser

public ReferencingParser(Symbols symbols,
                         DatumFactory datumFactory,
                         CSFactory csFactory,
                         CRSFactory crsFactory,
                         MathTransformFactory mtFactory)
Constructs a parser for the specified set of symbols using the specified set of factories.

Parameters:
symbols - The symbols for parsing and formatting numbers.
datumFactory - The factory to use for creating datum.
csFactory - The factory to use for creating coordinate systems.
crsFactory - The factory to use for creating coordinate reference systems.
mtFactory - The factory to use for creating math transform objects.
Method Detail

isISOConform

public boolean isISOConform()
Returns true if the default names of AXIS[...] elements shall be ISO 19111 identifiers. The default value is false, which mean that the identifiers specified by the WKT specification are used.

Returns:
true if the default identifiers of AXIS[...] elements shall be conform to ISO 19111.
Since:
3.18

setISOConform

public void setISOConform(boolean conform)
Sets whatever the default names of AXIS[...] elements shall be ISO identifiers.

Parameters:
conform - true if the default identifiers of AXIS[...] elements shall be conform to ISO 19111.
Since:
3.18

isAxisIgnored

public boolean isAxisIgnored()
Returns true if AXIS[...] elements will be ignored during parsing. The default value is false.

Returns:
true if AXIS[...] elements will be ignored during parsing.
Since:
3.00

setAxisIgnored

public void setAxisIgnored(boolean ignored)
Sets whatever AXIS[...] elements will be ignored during parsing. The default value is false as we would expect from a WKT compliant parser. However this flag may occasionally be set to true for compatibility with ESRI softwares, which ignore AXIS elements. It may also be used as a way to force the longitude axis to be first.

Note that AXIS elements still need to be well formed even when this flag is set to true; invalid axis will continue to cause a ParseException despite their content being ignored.

Parameters:
ignored - true if AXIS[...] elements should be ignored during parsing.
Since:
3.00

parseCoordinateReferenceSystem

public final CoordinateReferenceSystem parseCoordinateReferenceSystem(String text)
                                                               throws ParseException
Parses a coordinate reference system element.

Parameters:
text - The text to be parsed.
Returns:
The coordinate reference system.
Throws:
ParseException - if the string can't be parsed.

alterProperties

protected Map<String,Object> alterProperties(Map<String,Object> properties)
Returns the properties to be given to the parsed object. This method is invoked automatically by the parser for the root element only. This method expect on input the properties parsed from the AUTHORITY element, and returns on output the properties to give to the object to be created. The default implementation returns the properties map unchanged. Subclasses may override this method in order to add or change properties.

Example: if a subclass want to add automatically an authority code when no AUTHORITY element was explicitly set in the WKT, then it may test for the IdentifiedObject.IDENTIFIERS_KEY key and add automatically an entry if this key was missing.

Parameters:
properties - The properties parsed from the WKT file. Entries can be added, removed or modified directly in this map.
Returns:
The properties to be given to the parsed object. This is usually properties (maybe after modifications), but could also be a new map.
Since:
2.3


Copyright © 2009-2011 Geotoolkit.org. All Rights Reserved.