Package org.geotools.referencing.wkt
Class Formattable
Object
Formattable
- Direct Known Subclasses:
AbstractIdentifiedObject
,AbstractMathTransform
,AbstractParameter
,BursaWolfParameters
Base class for all object formattable as Well Known
Text (WKT).
- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The indentation value to give totoWKT(int)
method for formatting the complete object on a single line. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Cleans up the thread local set in this thread.protected String
Format the inner part of a Well Known Text (WKT) element.toString()
Returns a string representation for this object.toWKT()
Returns a Well Known Text (WKT) using a default indentation.toWKT
(int indentation) Returns a Well Known Text (WKT) for this object using the specified indentation.toWKT
(int indentation, boolean strict) Returns a Well Known Text (WKT) for this object using the specified indentation.Returns a Well Known Text (WKT) for this object using the specified indentation and authority.
-
Field Details
-
SINGLE_LINE
public static final int SINGLE_LINEThe indentation value to give totoWKT(int)
method for formatting the complete object on a single line.- Since:
- 2.6
- See Also:
-
-
Constructor Details
-
Formattable
protected Formattable()Default constructor.
-
-
Method Details
-
toString
Returns a string representation for this object. The default implementation returns the same string similar thantoWKT()
, except that no exception is thrown if the string contains non-standard keywords. For example the WKT specification do not defines any keyword for coordinate system objects. If this object is an instance ofDefaultCartesianCS
, then the WKT will be formatted as"CartesianCS[AXIS["
..."], AXIS["
..."],
etc.]"
. -
toWKT
Returns a Well Known Text (WKT) using a default indentation. The default indentation is read from user preferences.- Returns:
- The Well Know Text for this object.
- Throws:
UnformattableObjectException
- If this object can't be formatted as WKT. A formatting may fails because an object is too complex for the WKT format capability (for example an engineering CRS with different unit for each axis), or because only some specific implementations can be formatted as WKT.
-
toWKT
Returns a Well Known Text (WKT) for this object using the specified indentation.- Parameters:
indentation
- The amount of spaces to use in indentation for WKT formatting, orSINGLE_LINE
for formatting the whole WKT on a single line.- Returns:
- The Well Know Text for this object.
- Throws:
UnformattableObjectException
- If this object can't be formatted as WKT. A formatting may fails because an object is too complex for the WKT format capability (for example an engineering CRS with different unit for each axis), or because only some specific implementations can be formatted as WKT.
-
toWKT
Returns a Well Known Text (WKT) for this object using the specified indentation. The strict parameter is used to control whether the resulting WKT is tested for validity. When set tofalse
the check is not performed. Whentrue
and the WKT is found to be invalid aUnformattableObjectException
is thrown.- Parameters:
indentation
- The amount of spaces to use in indentation for WKT formatting, orSINGLE_LINE
for formatting the whole WKT on a single line.strict
- Controls the check for validity.- Returns:
- The Well Know Text for this object.
- Throws:
UnformattableObjectException
- If this object can't be formatted as WKT. A formatting may fails because an object is too complex for the WKT format capability (for example an engineering CRS with different unit for each axis), or because only some specific implementations can be formatted as WKT.
-
toWKT
Returns a Well Known Text (WKT) for this object using the specified indentation and authority.- Parameters:
authority
- The authority to prefer when choosing WKT entities names.indentation
- The amount of spaces to use in indentation for WKT formatting, orSINGLE_LINE
for formatting the whole WKT on a single line.- Returns:
- The Well Know Text for this object.
- Throws:
UnformattableObjectException
- If this object can't be formatted as WKT. A formatting may fails because an object is too complex for the WKT format capability (for example an engineering CRS with different unit for each axis), or because only some specific implementations can be formatted as WKT.
-
formatWKT
Format the inner part of a Well Known Text (WKT) element. This method is automatically invoked byFormatter.append(Formattable)
. Element name and authority code must not be formatted here. For example for aGEOGCS
element (DefaultGeographicCRS
), the formatter will invokes this method for completing the WKT at the insertion point show below:GEOGCS["WGS 84", AUTHORITY["EPSG","4326"]] | (insertion point)
The default implementation declares that this object produces an invalid WKT. Subclasses must override this method for proper WKT formatting and should not invokesuper.formatWKT(formatter)
if they can use a valid WKT syntax.- Parameters:
formatter
- The formatter to use.- Returns:
- The name of the WKT element type (e.g.
"GEOGCS"
). - See Also:
-
cleanupThreadLocals
public static void cleanupThreadLocals()Cleans up the thread local set in this thread. They can prevent web applications from proper shutdown
-