Class TileMatrixSetFormat
- All Implemented Interfaces:
Serializable, Cloneable, Localized
Formats Tile Matrix Sets (TMS) in a tabular format.
This format assumes a monospaced font and a character encoding which supports the drawing of box characters,
such as UTF-8. The table contains one row for each Tile Matrix with the following columns:
- Tile matrix identifier
- Resolution
- Number of tiles
- Tile size (if available)
- Image size (if available)
Limitations
- The current implementation can only format tile matrices — parsing is unsupported.
TileMatrixSetFormat, like mostjava.text.Formatsubclasses, is not thread-safe.
- Since:
- 1.7
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Format
Format.Field -
Constructor Summary
ConstructorsConstructorDescriptionTileMatrixSetFormat(Locale locale, TimeZone timezone) Creates a new formatter using the given locale and timezone. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the error status.format(TileMatrixSet matrices) Formats a textual representation of the given tile matrices.voidformat(TileMatrixSet matrices, Appendable toAppendTo) Formats a textual representation of the given tile matrices.formatHeader(TileMatrixSet matrices) Formats the properties of the given Tile Matrix Set for presentation before the main table.intformatTable(Iterable<? extends TileMatrix> matrices, Map<String, Object> addTo) Formats the properties of the given Tile Matrices in a way suitable for a tabular format.If an error occurred while formatting the Tile Matrix Set, returns that error.final Class<TileMatrixSet> Returns the type of values formatted by thisFormatinstance.Methods inherited from class CompoundFormat
clone, format, format, formatObject, getFormat, getLocale, getLocale, getTemporalStyle, getTimeZone, parseObject, parseObjectModifier and TypeMethodDescriptionclone()Returns a clone of this format.format(Object object, StringBuffer toAppendTo, FieldPosition pos) Writes a textual representation of the specified object in the given buffer.voidformat(TileMatrixSet object, StringBuilder toAppendTo) Writes a textual representation of the given object in the given buffer.voidformatObject(Object object, Appendable toAppendTo) Writes a textual representation of an object of arbitrary class in the given stream or buffer.protected FormatgetFormat(Class<?> valueType) Returns the format to use for parsing and formatting values of the given type.Returns the locale used by this format.getLocale(Locale.Category category) Returns the locale for the given category.protected FormatStylegetTemporalStyle(boolean dates) Returns the style to use for formatting dates or times.Returns the timezone used by this format.parseObject(String text) Creates an object from the given string representation.parseObject(String text, ParsePosition pos) Creates an object from the given string representation, or returnsnullif an error occurred while parsing.Methods inherited from class Format
format, formatToCharacterIterator
-
Constructor Details
-
TileMatrixSetFormat
-
-
Method Details
-
getValueType
Returns the type of values formatted by thisFormatinstance.- Specified by:
getValueTypein classCompoundFormat<TileMatrixSet>- Returns:
- the type of values formatted by this
Formatinstance.
-
formatHeader
Formats the properties of the given Tile Matrix Set for presentation before the main table. The properties are formatted asStrings using the locale given at construction time. The returned map contains the following entries if the corresponding properties were found:Tile Matrix Set (TMS) formatted properties Key Value type Description "identifier"StringIdentifier of the TMS. "referencing"StringName of the CRS, or reason why not available. "crs"CoordinateReferenceSystemThe CRS. "bbox"DefaultGeographicBoundingBoxBounding box of the TMS. If the
The returned properties can be completed by a call to"crs"property is non-null, then the"referencing"property is the CRS name. Conversely, if the"crs"property is null, then the"referencing"property is a message saying that the CRS was not available or the reason why it was not available.formatTable(Iterable, Map).- Parameters:
matrices- the tile matrices to format.- Returns:
- properties of the header of the given tile matrix set.
-
formatTable
Formats the properties of the given Tile Matrices in a way suitable for a tabular format. The properties are formatted asStrings using the locale given at construction time. The returned map contains the following entries if the corresponding properties were found:
TheTile Matrices formatted properties Key Value type Description "identifiers"String[]Column of the identifier of each Tile Matrix. "resolutions"String[][]Columns of the resolution of each Tile Matrix. "tileCounts"String[][]Columns of the number of tiles of each Tile Matrix. "tileSizes"String[][]Columns of the tile size of each Tile Matrix. "imageSizes"String[][]Columns of the image size (if available). "gridAxes"String[]Name of grid axes. "tileSizes"and"imageSizes"properties may be absent if not applicable. Implementations other than the default implementation may also choose to add or remove more properties.This method returns the number of rows in the table to format. The length of the
"identifiers"array is that number of rows. All other arrays have a length equal to the number of columns in a group of columns, which is 2 in the usual case of two-dimensional Tile Matrix Sets. The"resolutions[i]","tileCounts[i]"and"tileSizes[i]"arrays, where i is a column index, all have a length equal to the number of rows. Some element may benullif the corresponding data could not be extracted.- Parameters:
matrices- the tile matrices to format.addTo- where to put the properties of the given tile matrix set.- Returns:
- number of rows in the table to format.
-
format
Formats a textual representation of the given tile matrices. This method delegates toformat(TileMatrixSet, Appendable)with a temporary buffer.- Parameters:
matrices- the tile matrices to format.- Returns:
- a string representation of the given Tile Matrix Set.
-
format
Formats a textual representation of the given tile matrices. First, a header is formatted with the TMS identifier, the Coordinate Reference System and the geographic bounding box. Then, each tile matrix is formatted as a row in a table.- Specified by:
formatin classCompoundFormat<TileMatrixSet>- Parameters:
matrices- the tile matrices to format.toAppendTo- where to format the object.- Throws:
IOException- if an error occurred while writing to the given appendable.
-
getError
-
clear
public void clear()Clears the error status. This method should be invoked if the sameTileMatrixSetFormatinstance is used for formatting manyTileMatrixSetinstances.
-