Base class for objects that can be formatted as
Well Known Text (WKT). {@link WKTFormat} checks for this class at formatting time for each element to format.When a {@code FormattableObject} element is found, its {@link #formatTo(Formatter)} methodis invoked for allowing the element to control its formatting.
This class provides two methods for getting a default Well Known Text representation of this object:
- {@link #toWKT()} returns a strictly compliant WKT or throws {@link UnformattableObjectException}if this object contains elements not defined by the ISO 19162 standard.
- {@link #toString()} returns a WKT with some redundant information omitted and some constraints relaxed.This method never throw {@code UnformattableObjectException}; it will rather use non-standard representation if necessary.
{@section Syntax coloring}A convenience {@link #print()} method is provided, which is roughly equivalent to{@code System.out.println(this)} except that syntax coloring is automatically appliedif the terminal seems to support the ANSI escape codes. {@section Non-standard WKT}If this object can not be formatted without violating some WKT constraints, then the behavior depends on the method invoked:
- {@link #toWKT()} will throw a {@link UnformattableObjectException}.
- {@link #toString()} will ignore the problem and uses non-standard elements if needed.
- {@link #print()} will show the non-standard elements in red if syntax coloring is enabled.
@author Martin Desruisseaux (IRD, Geomatys)
@since 0.4 (derived from geotk-2.0)
@version 0.4
@module