public abstract class Transliterator extends Object implements Serializable
REMARKS["…"]
elements:
They are ASCII codes 32 to 125 inclusive except ! (33), # (35), $ (36), @ (64) and ` (96), plus the addition of ° (176) despite being formally outside the ASCII character set. The only exception to this rules is for the text insideA-Z a-z 0-9 _ [ ] ( ) { } < = > . , : ; + - (space) % & ' " * ^ / \ ? | °
REMARKS["…"]
elements,
where all Unicode characters are allowed.
The filter(String)
method is responsible for replacing or removing characters outside the above-cited
set of permitted characters.
toLatinAbbreviation(…)
and toUnicodeAbbreviation(…)
methods are responsible for doing the transliteration at formatting and parsing time, respectively.
toShortAxisName(…)
and toLongAxisName(…)
methods are responsible for doing the transliteration at formatting and parsing time, respectively.Characters.isValidWKT(int)
,
WKT 2 specification §7.5.3,
Serialized FormDefined in the sis-metadata
module
Modifier and Type | Field and Description |
---|---|
static Transliterator |
DEFAULT
A transliterator compliant with ISO 19162 on a "best effort" basis.
|
static Transliterator |
IDENTITY
A transliterator that does not perform any replacement.
|
Modifier | Constructor and Description |
---|---|
protected |
Transliterator()
For sub-class constructors.
|
Modifier and Type | Method and Description |
---|---|
String |
filter(String text)
Returns a character sequences with the non-ASCII characters replaced or removed.
|
String |
toLatinAbbreviation(CoordinateSystem cs,
AxisDirection direction,
String abbreviation)
Returns the axis abbreviation to format in WKT, or
null if none. |
String |
toLongAxisName(String csType,
AxisDirection direction,
String name)
Returns the axis name to use in memory for an axis parsed from a WKT.
|
String |
toShortAxisName(CoordinateSystem cs,
AxisDirection direction,
String name)
Returns the axis name to format in WKT, or
null if none. |
String |
toUnicodeAbbreviation(String csType,
AxisDirection direction,
String abbreviation)
Returns the axis abbreviation to use in memory for an axis parsed from a WKT.
|
public static final Transliterator DEFAULT
Transliterator
class.public static final Transliterator IDENTITY
public String filter(String text)
Implementations shall not care about opening or closing quotes. The quotes will be doubled by the caller if needed after this method has been invoked.
The default implementation invokes CharSequences.toASCII(CharSequence)
,
replaces line feed and tabulations by single spaces, then remove control characters.
text
- the text to format without non-ASCII characters.Characters.isValidWKT(int)
public String toShortAxisName(CoordinateSystem cs, AxisDirection direction, String name)
null
if none. This method performs the mapping
between the names of axes in memory (designated by "long axis names" in this class)
and the names to format in the WKT (designated by "short axis names").
null
if the name should be omitted.
ISO 19162 recommends to omit the axis name when it is already given through the mandatory axis direction.
The default implementation performs at least the following replacements:
null
if the axis direction is AxisDirection.GEOCENTRIC_X
, GEOCENTRIC_Y
or GEOCENTRIC_Z
and the name is the same than the axis direction (ignoring case).cs
- the enclosing coordinate system, or null
if unknown.direction
- the direction of the axis to format.name
- the axis name, to be eventually replaced by this method.null
if the name shall be omitted.DefaultCoordinateSystemAxis.formatTo(Formatter)
public String toLongAxisName(String csType, AxisDirection direction, String name)
CoordinateSystem
instance is created,
most coordinate system characteristics are known only as String
.
In particular the csType
argument, if non-null, should be one of the following values:
This method is the converse of"affine"
,"Cartesian"
(note the upper-case"C"
),"cylindrical"
,"ellipsoidal"
,"linear"
,"parametric"
,"polar"
,"spherical"
,"temporal"
or"vertical"
toShortAxisName(CoordinateSystem, AxisDirection, String)
.
The default implementation performs at least the following replacements:
AxisDirection.GEOCENTRIC_X
, GEOCENTRIC_Y
and GEOCENTRIC_Z
respectively in a Cartesian CS,
if the given axis name is only an abbreviation.csType
- the type of the coordinate system, or null
if unknown.direction
- the parsed axis direction.name
- the parsed axis abbreviation, to be eventually replaced by this method.public String toLatinAbbreviation(CoordinateSystem cs, AxisDirection direction, String abbreviation)
null
if none. The given abbreviation may contain
Greek letters, in particular φ, λ and θ. This toLatinAbbreviation(…)
method is responsible
for replacing Greek letters by Latin letters for ISO 19162 compliance, if desired.
The default implementation performs at least the following mapping:
cs
- the enclosing coordinate system, or null
if unknown.direction
- the direction of the axis to format.abbreviation
- the axis abbreviation, to be eventually replaced by this method.DefaultCoordinateSystemAxis.formatTo(Formatter)
public String toUnicodeAbbreviation(String csType, AxisDirection direction, String abbreviation)
CoordinateSystem
instance is created,
most coordinate system characteristics are known only as String
.
In particular the csType
argument, if non-null, should be one of the following values:
This method is the converse of"affine"
,"Cartesian"
(note the upper-case"C"
),"cylindrical"
,"ellipsoidal"
,"linear"
,"parametric"
,"polar"
,"spherical"
,"temporal"
or"vertical"
toLatinAbbreviation(CoordinateSystem, AxisDirection, String)
.
The default implementation performs at least the following mapping:
csType
is "ellipsoidal"
.csType
is "ellipsoidal"
.csType
is "spherical"
, regardless of coordinate system convention.csType
is "spherical"
, regardless of coordinate system convention.csType
is "polar"
.csType
- the type of the coordinate system, or null
if unknown.direction
- the parsed axis direction.abbreviation
- the parsed axis abbreviation, to be eventually replaced by this method.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.