public abstract class AbstractGeometryFromTextConverter extends AbstractRatingConverter<String,com.vividsolutions.jts.geom.Geometry> implements TextToGeometryConverter
TextToGeometryConverter implementation that expects the given text to be separated by white space
characters, ';' or ':'. Additionally it requires a parameter: the EPSG code, e.g. EPSG:4326. The code is used to
interpret the given coordinates. The coordinates are expected to be provided as follows:The coordinates are parsed using the currently active Locale and thus the corresponding
NumberFormat. Three-dimensional coordinates are not supported.
| Modifier and Type | Field and Description |
|---|---|
static String |
SYS_PROP_DECIMAL_SEP |
| Constructor and Description |
|---|
AbstractGeometryFromTextConverter() |
| Modifier and Type | Method and Description |
|---|---|
String |
convertBackward(com.vividsolutions.jts.geom.Geometry to,
String... params)
Converts a given instance of
Geometry back to the origin format FROM. |
com.vividsolutions.jts.geom.Geometry |
convertForward(String from,
String... params)
Converts a given instance
FROM to a Geometry. |
protected abstract com.vividsolutions.jts.geom.Geometry |
createGeometry(com.vividsolutions.jts.geom.Coordinate[] coordinates,
com.vividsolutions.jts.geom.GeometryFactory geomFactory)
Creates a geometry from the given coordinate array and geometry factory.
|
protected DecimalFormat |
getDecimalFormat()
Creates a decimal format that uses the decimal separator of returned from
getDecimalSeparator() and
disabled grouping. |
protected char |
getDecimalSeparator()
Gets the decimal separator that is used by this converter.
|
String |
getFormatDescription() |
String |
getFormatHtmlDescription() |
protected String |
getTokenRegex()
Get the token regex that is used to split the data to convert.
|
protected char[] |
getTokenSeparators()
Gets the separators that are used to build the token regex.
|
ratepublic static final String SYS_PROP_DECIMAL_SEP
protected abstract com.vividsolutions.jts.geom.Geometry createGeometry(com.vividsolutions.jts.geom.Coordinate[] coordinates,
com.vividsolutions.jts.geom.GeometryFactory geomFactory)
throws de.cismet.commons.converter.ConversionException
null.coordinates - the coordinates to create a geometry fromgeomFactory - the geometry factory that may be used to create the geometryde.cismet.commons.converter.ConversionException - if any error occurs during creation of the geometrypublic com.vividsolutions.jts.geom.Geometry convertForward(String from, String... params) throws de.cismet.commons.converter.ConversionException
FROM to a Geometry. The first parameter must be the EPSG
code, e.g. EPSG:4326.convertForward in interface GeometryConverter<String>convertForward in interface de.cismet.commons.converter.Converter<String,com.vividsolutions.jts.geom.Geometry>from - the originating object that shall be converted to a Geometryparams - first parameter must be the EPSG codeGeometry which was create from the FROM instancede.cismet.commons.converter.ConversionException - if any error occurs during conversionpublic String convertBackward(com.vividsolutions.jts.geom.Geometry to, String... params) throws de.cismet.commons.converter.ConversionException
GeometryConverterGeometry back to the origin format FROM. The first
parameter must be the EPSG code, e.g. EPSG:4326.convertBackward in interface GeometryConverter<String>convertBackward in interface de.cismet.commons.converter.Converter<String,com.vividsolutions.jts.geom.Geometry>to - the geometry that shall be converted back to an instance of FROMparams - no parameters neededFROM which was create from the Geometry instancede.cismet.commons.converter.ConversionException - if any error occurs during conversionprotected char getDecimalSeparator()
SYS_PROP_DECIMAL_SEP. If the property is not set or is empty or is an invalid character (any white
space) or an invalid format the default separator of the default locale is returned. Supported formats are:Integer.decode(java.lang.String)Character.isWhitespace(char),
Integer.decode(java.lang.String)protected DecimalFormat getDecimalFormat()
getDecimalSeparator() and
disabled grouping.protected String getTokenRegex()
char
returned from getDecimalSeparator().protected char[] getTokenSeparators()
DEFAULT_TOKEN_SEPARATORS minus the getDecimalSeparator() if it is one of the default
separators.getTokenRegex()public String getFormatDescription()
getFormatDescription in interface de.cismet.commons.converter.FormatHintpublic String getFormatHtmlDescription()
getFormatHtmlDescription in interface de.cismet.commons.converter.FormatHintCopyright © 2012–2025 cismet GmbH. All rights reserved.