| java.lang.Object org.geotools.referencing.wkt.Formatter
Field Summary | |
Citation | authority The preferred authority for object or parameter names. | StringBuffer | buffer The buffer in which to format. | int | bufferBase The starting point in the buffer. | boolean | colorEnabled Whatever we allow syntax coloring on ANSI X3.64 compatible terminal. | final int | indentation The amount of space to use in indentation, or 0 if indentation is disabled. | String | warning Warning that may be produced during WKT formatting, or
null if none. |
Constructor Summary | |
public | Formatter() Creates a new instance of the formatter with the default symbols. | public | Formatter(Symbols symbols) Creates a new instance of the formatter. | public | Formatter(Symbols symbols, int indentation) Creates a new instance of the formatter with the specified indentation width.
The WKT will be formatted on many lines, and the indentation width will have
the value specified to this constructor. | | Formatter(Symbols symbols, NumberFormat numberFormat) Constructor for private use by
AbstractParser.format only. |
Method Summary | |
public void | append(Formattable formattable) Append the specified
Formattable object. | public void | append(IdentifiedObject info) Append the specified OpenGIS's
IdentifiedObject object. | public void | append(MathTransform transform) Append the specified math transform. | public void | append(CodeList code) Append a code list to the WKT. | public void | append(GeneralParameterValue parameter) Append a
in WKT form. | public void | append(int number) Append an integer number. | public void | append(double number) Append a floating point number. | public void | append(Unit unit) Appends a unit in WKT form. | public void | append(String text) Append a character string. | public void | clear() Clear this formatter. | public Unit | getAngularUnit() The angular unit for formatting measures, or
null for the "natural" unit of
each WKT element. | public Identifier | getIdentifier(IdentifiedObject info) Returns the preferred identifier for the specified object. | public Unit | getLinearUnit() The linear unit for formatting measures, or
null for the "natural" unit of each
WKT element.
The unit for measure. | public String | getName(IdentifiedObject info) Returns the preferred name for the specified object. | final Class | getUnformattableClass() Returns the class declared by the last call to
Formatter.setInvalidWKT . | public boolean | isInvalidWKT() Returns
true if the WKT in this formatter is not strictly compliant to the
WKT
specification. | public static void | main(String[] args) Set the preferred indentation from the command line. | public void | setAngularUnit(Unit unit) Set the angular unit for formatting measures. | public void | setInvalidWKT(Class unformattable) Set a flag marking the current WKT as not strictly compliant to the
WKT
specification. | public void | setInvalidWKT() Set a flag marking the current WKT as not strictly compliant to the WKT specification. | public void | setLinearUnit(Unit unit) Set the unit for formatting linear measures. | public String | toString() Returns the WKT in its current state. |
indentation | final int indentation(Code) | | The amount of space to use in indentation, or 0 if indentation is disabled.
|
warning | String warning(Code) | | Warning that may be produced during WKT formatting, or
null if none.
|
Formatter | public Formatter()(Code) | | Creates a new instance of the formatter with the default symbols.
|
Formatter | public Formatter(Symbols symbols)(Code) | | Creates a new instance of the formatter. The whole WKT will be formatted
on a single line.
Parameters: symbols - The symbols. |
Formatter | public Formatter(Symbols symbols, int indentation)(Code) | | Creates a new instance of the formatter with the specified indentation width.
The WKT will be formatted on many lines, and the indentation width will have
the value specified to this constructor. If the specified indentation is 0,
then the whole WKT will be formatted on a single line.
Parameters: symbols - The symbols. Parameters: indentation - The amount of spaces to use in indentation. Typical values are 2 or 4. |
append | public void append(Formattable formattable)(Code) | | Append the specified
Formattable object. This method will automatically append
the keyword (e.g. "GEOCS" ), the name and the authority code, and will invokes
formattable.
(this) for completing
the inner part of the WKT.
Parameters: formattable - The formattable object to append to the WKT. |
append | public void append(IdentifiedObject info)(Code) | | Append the specified OpenGIS's
IdentifiedObject object.
Parameters: info - The info object to append to the WKT. |
append | public void append(MathTransform transform)(Code) | | Append the specified math transform.
Parameters: transform - The transform object to append to the WKT. |
append | public void append(CodeList code)(Code) | | Append a code list to the WKT.
|
append | public void append(GeneralParameterValue parameter)(Code) | | Append a
in WKT form. If the supplied parameter
is actually a
, all parameters will be
inlined.
|
append | public void append(int number)(Code) | | Append an integer number. A comma (or any other element
separator) will be written before the number if needed.
|
append | public void append(double number)(Code) | | Append a floating point number. A comma (or any other element
separator) will be written before the number if needed.
|
append | public void append(Unit unit)(Code) | | Appends a unit in WKT form. For example,
append(SI.KILOMETER) can append "UNIT["km", 1000] " to the WKT.
|
append | public void append(String text)(Code) | | Append a character string. The string will be written between quotes.
A comma (or any other element separator) will be written before the string if needed.
|
clear | public void clear()(Code) | | Clear this formatter. All properties (including
and
are reset to their default value.
After this method call, this
Formatter object is ready for formatting
a new object.
|
getAngularUnit | public Unit getAngularUnit()(Code) | | The angular unit for formatting measures, or
null for the "natural" unit of
each WKT element. This value is set for example by "GEOGCS", which force its enclosing
"PRIMEM" to take the same units than itself.
The unit for measure. Default value is null . |
getIdentifier | public Identifier getIdentifier(IdentifiedObject info)(Code) | | Returns the preferred identifier for the specified object. If the specified
object contains an identifier from the preferred authority (usually
), then this identifier is
returned. Otherwise, the first identifier is returned. If the specified
object contains no identifier, then this method returns
null .
Parameters: info - The object to looks for a preferred identifier. The preferred identifier, or null if none. since: 2.3 |
getLinearUnit | public Unit getLinearUnit()(Code) | | The linear unit for formatting measures, or
null for the "natural" unit of each
WKT element.
The unit for measure. Default value is null . |
getName | public String getName(IdentifiedObject info)(Code) | | Returns the preferred name for the specified object. If the specified
object contains a name from the preferred authority (usually
), then this name is
returned. Otherwise, the first name found is returned.
Parameters: info - The object to looks for a preferred name. The preferred name. |
isInvalidWKT | public boolean isInvalidWKT()(Code) | | Returns
true if the WKT in this formatter is not strictly compliant to the
WKT
specification. This method returns
true if
Formatter.setInvalidWKT has
been invoked at least once. The action to take regarding invalid WKT is caller-dependant.
For example
Formattable.toString will accepts loose WKT formatting and ignore this
flag, while
Formattable.toWKT requires strict WKT formatting and will thrown an
exception if this flag is set.
|
main | public static void main(String[] args)(Code) | | Set the preferred indentation from the command line. This indentation is used by
Formattable.toWKT when no indentation were explicitly requested. This
method can be invoked from the command line using the following syntax:
java org.geotools.referencing.wkt.Formatter -indentation= <preferred
indentation>
|
setAngularUnit | public void setAngularUnit(Unit unit)(Code) | | Set the angular unit for formatting measures.
Parameters: unit - The new unit, or null . |
setInvalidWKT | public void setInvalidWKT(Class unformattable)(Code) | | Set a flag marking the current WKT as not strictly compliant to the
WKT
specification. This method is invoked by
Formattable.formatWKT methods when the
object to format is more complex than what the WKT specification allows. For example this
method is invoked when an
uses different unit for each axis, An application can tests
Formatter.isInvalidWKT later for checking WKT validity.
Parameters: unformattable - The type of the component that can't be formatted,for example org.opengis.referencing.crs.EngineeringCRS. See Also: UnformattableObjectException.getUnformattableClass since: 2.4 |
setLinearUnit | public void setLinearUnit(Unit unit)(Code) | | Set the unit for formatting linear measures.
Parameters: unit - The new unit, or null . |
toString | public String toString()(Code) | | Returns the WKT in its current state.
|
|
|