public class WMTSTileSource extends AbstractTMSTileSource implements TemplatedTileSource
| Modifier and Type | Class and Description |
|---|---|
private static class |
WMTSTileSource.Dimension |
static class |
WMTSTileSource.Layer
Class representing WMTS Layer information
|
private static class |
WMTSTileSource.SelectLayerDialog |
private static class |
WMTSTileSource.TileMatrix |
static class |
WMTSTileSource.TileMatrixSet
class representing WMTS TileMatrixSet
This connects projection and TileMatrix (how the map is divided in tiles)
|
private static class |
WMTSTileSource.TileMatrixSetBuilder |
static class |
WMTSTileSource.WMTSGetCapabilitiesException
Exception thrown when parser doesn't find expected information in GetCapabilities document
|
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String[] |
ALL_PATTERNS |
private int |
cachedTileSize |
private double |
crsScale |
private WMTSTileSource.Layer |
currentLayer |
private WMTSTileSource.TileMatrixSet |
currentTileMatrixSet |
private DefaultLayer |
defaultLayer |
private java.util.Map<java.lang.String,java.lang.String> |
headers |
private java.util.Collection<WMTSTileSource.Layer> |
layers |
private NativeScaleLayer.ScaleList |
nativeScaleList |
private static java.lang.String |
PATTERN_HEADER |
private static javax.xml.namespace.QName |
QN_CONTENTS |
private static javax.xml.namespace.QName |
QN_DEFAULT |
private static javax.xml.namespace.QName |
QN_DIMENSION |
private static javax.xml.namespace.QName |
QN_FORMAT |
private static javax.xml.namespace.QName |
QN_LAYER |
private static javax.xml.namespace.QName |
QN_MATRIX_HEIGHT |
private static javax.xml.namespace.QName |
QN_MATRIX_WIDTH |
private static javax.xml.namespace.QName |
QN_RESOURCE_URL |
private static javax.xml.namespace.QName |
QN_SCALE_DENOMINATOR |
private static javax.xml.namespace.QName |
QN_STYLE |
private static javax.xml.namespace.QName |
QN_TILE_HEIGHT |
private static javax.xml.namespace.QName |
QN_TILE_WIDTH |
private static javax.xml.namespace.QName |
QN_TILEMATRIX |
private static javax.xml.namespace.QName |
QN_TILEMATRIX_SET_LINK |
private static javax.xml.namespace.QName |
QN_TILEMATRIXSET |
private static javax.xml.namespace.QName |
QN_TOPLEFT_CORNER |
private static javax.xml.namespace.QName |
QN_VALUE |
private Projection |
tileProjection |
private GetCapabilitiesParseHelper.TransferMode |
transferMode |
private static java.lang.String |
URL_GET_ENCODING_PARAMS |
static java.lang.String |
WMTS_NS_URL
WMTS namespace address
|
baseUrl, id, modTileFeatures, name, tileSizeattributionImage, attributionImageURL, attributionLinkURL, attributionText, termsOfUseText, termsOfUseURL| Constructor and Description |
|---|
WMTSTileSource(ImageryInfo info)
Creates a tile source based on imagery info
|
WMTSTileSource(ImageryInfo info,
Projection projection)
Creates a tile source based on imagery info and initializes it with given projection.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
checkUrl(java.lang.String url)
Checks if url is acceptable by this Tile Source
|
static WMTSCapabilities |
getCapabilities(java.lang.String url,
java.util.Map<java.lang.String,java.lang.String> headers)
Call remote server and parse response to WMTSCapabilities object
|
TileRange |
getCoveringTileRange(Tile tile,
int newZoom)
Returns a range of tiles, that cover a given tile, which is
usually at a different zoom level.
|
double |
getDistance(double lat1,
double lon1,
double lat2,
double lon2)
Gets the distance using Spherical law of cosines.
|
java.util.Map<java.lang.String,java.lang.String> |
getHeaders() |
java.util.Collection<WMTSTileSource.Layer> |
getLayers()
Layers that can be used with this tile source
|
int |
getMaxZoom()
Specifies the maximum zoom value.
|
NativeScaleLayer.ScaleList |
getNativeScales()
Get native scales of tile source.
|
java.lang.String |
getServerCRS()
Get coordinate reference system for this tile source.
|
java.util.Collection<java.lang.String> |
getSupportedProjections() |
java.lang.String |
getTileId(int zoom,
int tilex,
int tiley)
Creates tile identifier that is unique among all tile sources, but the same tile will always
get the same identifier.
|
private WMTSTileSource.TileMatrix |
getTileMatrix(int zoom) |
Projection |
getTileProjection()
Returns the tile projection.
|
private ProjectionBounds |
getTileProjectionBounds(Tile tile) |
int |
getTileSize()
Specifies how large each tile is.
|
java.lang.String |
getTileUrl(int zoom,
int tilex,
int tiley)
Constructs the tile url.
|
int |
getTileXMax(int zoom)
Get maximum x index of tile for specified zoom level.
|
private int |
getTileXMax(int zoom,
Projection proj) |
int |
getTileYMax(int zoom)
Get maximum y index of tile for specified zoom level.
|
private int |
getTileYMax(int zoom,
Projection proj) |
static java.util.List<java.util.Map.Entry<java.lang.String,java.util.List<WMTSTileSource.Layer>>> |
groupLayersByNameAndTileMatrixSet(java.util.Collection<WMTSTileSource.Layer> layers) |
private java.lang.String |
handleTemplate(java.lang.String url) |
void |
initProjection(Projection proj)
Initializes projection for this TileSource with projection
|
boolean |
isInside(Tile inner,
Tile outer)
Check if one tile is inside another tile.
|
TileXY |
latLonToTileXY(double lat,
double lon,
int zoom)
Transforms longitude and latitude to tile indices.
|
TileXY |
latLonToTileXY(ICoordinate point,
int zoom)
Transforms longitude and latitude to tile indices.
|
java.awt.Point |
latLonToXY(double lat,
double lon,
int zoom)
Transforms longitude and latitude to pixel space (as if all tiles at specified zoom level where joined).
|
java.awt.Point |
latLonToXY(ICoordinate point,
int zoom)
Transforms longitude and latitude to pixel space (as if all tiles at specified zoom level where joined).
|
private static BBox |
parseBoundingBox(javax.xml.stream.XMLStreamReader reader)
Parses WGS84BoundingBox section.
|
private static java.util.Collection<WMTSTileSource.Layer> |
parseContents(javax.xml.stream.XMLStreamReader reader)
Parse Contents tag.
|
private static <T> T |
parseCoor(java.lang.String coor,
boolean switchXY,
java.util.function.BiFunction<java.lang.String,java.lang.String,T> function) |
private static WMTSTileSource.Dimension |
parseDimension(javax.xml.stream.XMLStreamReader reader)
Gets Dimension value.
|
private static EastNorth |
parseEastNorth(java.lang.String coor,
boolean switchXY) |
private static LatLon |
parseLatLon(java.lang.String coor,
boolean switchXY) |
private static WMTSTileSource.Layer |
parseLayer(javax.xml.stream.XMLStreamReader reader)
Parse Layer tag.
|
private static WMTSCapabilities |
parseOperationMetadata(javax.xml.stream.XMLStreamReader reader)
Parses OperationMetadata section.
|
private static WMTSTileSource.TileMatrix |
parseTileMatrix(javax.xml.stream.XMLStreamReader reader,
java.lang.String matrixCrs)
Parses TileMatrix section.
|
private static WMTSTileSource.TileMatrixSet |
parseTileMatrixSet(javax.xml.stream.XMLStreamReader reader)
Parses TileMatrixSet section.
|
private static java.lang.String |
parseTileMatrixSetLink(javax.xml.stream.XMLStreamReader reader)
Gets TileMatrixSetLink value.
|
TileXY |
projectedToTileXY(IProjected projected,
int zoom)
Convert projected coordinates to tile indices.
|
private EastNorth |
tileToEastNorth(int x,
int y,
int z) |
ICoordinate |
tileXYToLatLon(int x,
int y,
int zoom)
Transforms tile indices to longitude and latitude.
|
ICoordinate |
tileXYToLatLon(Tile tile)
Determines to longitude and latitude of a tile.
|
ICoordinate |
tileXYToLatLon(TileXY xy,
int zoom)
Transforms tile indices to longitude and latitude.
|
IProjected |
tileXYtoProjected(int x,
int y,
int zoom)
Convert tile indices (x/y/zoom) into projected coordinates of the tile origin.
|
DefaultLayer |
userSelectLayer()
Creates a dialog based on this tile source with all available layers and returns the name of selected layer
|
Coordinate |
xyToLatLon(int x,
int y,
int zoom)
Transforms a point in pixel space to longitude/latitude (WGS84).
|
Coordinate |
xyToLatLon(java.awt.Point point,
int zoom)
Transforms a point in pixel space to longitude/latitude (WGS84).
|
getBaseUrl, getDefaultTileSize, getExtension, getId, getMetadata, getMinZoom, getName, getTilePath, getTileXMin, getTileYMin, isModTileFeatures, isNoTileAtZoom, toStringgetAttributionImage, getAttributionImageURL, getAttributionLinkURL, getAttributionText, getTermsOfUseText, getTermsOfUseURL, requiresAttribution, setAttributionImage, setAttributionImageURL, setAttributionLinkURL, setAttributionText, setTermsOfUseText, setTermsOfUseURLclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetDefaultTileSize, getId, getMetadata, getMinZoom, getName, getTileXMin, getTileYMin, isModTileFeatures, isNoTileAtZoomgetAttributionImage, getAttributionImageURL, getAttributionLinkURL, getAttributionText, getTermsOfUseText, getTermsOfUseURL, requiresAttributionpublic static final java.lang.String WMTS_NS_URL
private static final javax.xml.namespace.QName QN_CONTENTS
private static final javax.xml.namespace.QName QN_DEFAULT
private static final javax.xml.namespace.QName QN_DIMENSION
private static final javax.xml.namespace.QName QN_FORMAT
private static final javax.xml.namespace.QName QN_LAYER
private static final javax.xml.namespace.QName QN_MATRIX_WIDTH
private static final javax.xml.namespace.QName QN_MATRIX_HEIGHT
private static final javax.xml.namespace.QName QN_RESOURCE_URL
private static final javax.xml.namespace.QName QN_SCALE_DENOMINATOR
private static final javax.xml.namespace.QName QN_STYLE
private static final javax.xml.namespace.QName QN_TILEMATRIX
private static final javax.xml.namespace.QName QN_TILEMATRIXSET
private static final javax.xml.namespace.QName QN_TILEMATRIX_SET_LINK
private static final javax.xml.namespace.QName QN_TILE_WIDTH
private static final javax.xml.namespace.QName QN_TILE_HEIGHT
private static final javax.xml.namespace.QName QN_TOPLEFT_CORNER
private static final javax.xml.namespace.QName QN_VALUE
private static final java.lang.String PATTERN_HEADER
private static final java.lang.String URL_GET_ENCODING_PARAMS
private static final java.lang.String[] ALL_PATTERNS
private int cachedTileSize
private final java.util.Map<java.lang.String,java.lang.String> headers
private final java.util.Collection<WMTSTileSource.Layer> layers
private WMTSTileSource.Layer currentLayer
private WMTSTileSource.TileMatrixSet currentTileMatrixSet
private double crsScale
private final GetCapabilitiesParseHelper.TransferMode transferMode
private NativeScaleLayer.ScaleList nativeScaleList
private final DefaultLayer defaultLayer
private Projection tileProjection
public WMTSTileSource(ImageryInfo info) throws java.io.IOException, WMTSTileSource.WMTSGetCapabilitiesException
info - imagery infojava.io.IOException - if any I/O error occursWMTSTileSource.WMTSGetCapabilitiesException - when document didn't contain any layersjava.lang.IllegalArgumentException - if any other error happens for the given imagery infopublic WMTSTileSource(ImageryInfo info, Projection projection) throws java.io.IOException, WMTSTileSource.WMTSGetCapabilitiesException
info - imagery infoprojection - projection to be used by this TileSourcejava.io.IOException - if any I/O error occursWMTSTileSource.WMTSGetCapabilitiesException - when document didn't contain any layersjava.lang.IllegalArgumentException - if any other error happens for the given imagery infopublic DefaultLayer userSelectLayer()
private java.lang.String handleTemplate(java.lang.String url)
public static WMTSCapabilities getCapabilities(java.lang.String url, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, WMTSTileSource.WMTSGetCapabilitiesException
url - of the getCapabilities documentheaders - HTTP headers to set when calling getCapabilities urljava.io.IOException - in case of any I/O errorWMTSTileSource.WMTSGetCapabilitiesException - when document didn't contain any layersjava.lang.IllegalArgumentException - in case of any other errorprivate static java.util.Collection<WMTSTileSource.Layer> parseContents(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
reader - StAX reader instancejavax.xml.stream.XMLStreamException - See XMLStreamReaderprivate static WMTSTileSource.Layer parseLayer(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
reader - StAX reader instancejavax.xml.stream.XMLStreamException - See XMLStreamReaderprivate static WMTSTileSource.Dimension parseDimension(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
reader - StAX reader instancejavax.xml.stream.XMLStreamException - See XMLStreamReaderprivate static java.lang.String parseTileMatrixSetLink(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
reader - StAX reader instancejavax.xml.stream.XMLStreamException - See XMLStreamReaderprivate static WMTSTileSource.TileMatrixSet parseTileMatrixSet(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
reader - StAX reader instancejavax.xml.stream.XMLStreamException - See XMLStreamReaderprivate static WMTSTileSource.TileMatrix parseTileMatrix(javax.xml.stream.XMLStreamReader reader, java.lang.String matrixCrs) throws javax.xml.stream.XMLStreamException
reader - StAX reader instancematrixCrs - projection used by this matrixjavax.xml.stream.XMLStreamException - See XMLStreamReaderprivate static <T> T parseCoor(java.lang.String coor, boolean switchXY, java.util.function.BiFunction<java.lang.String,java.lang.String,T> function)
private static EastNorth parseEastNorth(java.lang.String coor, boolean switchXY)
private static LatLon parseLatLon(java.lang.String coor, boolean switchXY)
private static BBox parseBoundingBox(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
reader - StAX reader instancejavax.xml.stream.XMLStreamException - See XMLStreamReaderprivate static WMTSCapabilities parseOperationMetadata(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
reader - StAX reader instancejavax.xml.stream.XMLStreamException - See XMLStreamReaderpublic void initProjection(Projection proj)
proj - projection to be used by this TileSourcepublic int getTileSize()
TileSourcegetTileSize in interface TileSourcegetTileSize in class AbstractTMSTileSourcepublic java.lang.String getTileUrl(int zoom, int tilex, int tiley)
TileSourcegetTileUrl in interface TileSourcegetTileUrl in class AbstractTMSTileSourcezoom - zoom leveltilex - X coordinatetiley - Y coordinateprivate WMTSTileSource.TileMatrix getTileMatrix(int zoom)
zoom - zoom levelpublic double getDistance(double lat1, double lon1, double lat2, double lon2)
TileSourcegetDistance in interface TileSourcelat1 - latitude of first pointlon1 - longitude of first pointlat2 - latitude of second pointlon2 - longitude of second pointpublic ICoordinate tileXYToLatLon(Tile tile)
TileSourcetileXYToLatLon in interface TileSourcetileXYToLatLon in class AbstractTMSTileSourcetile - Tilepublic ICoordinate tileXYToLatLon(TileXY xy, int zoom)
TileSourcetileXYToLatLon in interface TileSourcetileXYToLatLon in class AbstractTMSTileSourcexy - X/Y tile indiceszoom - zoom levelpublic ICoordinate tileXYToLatLon(int x, int y, int zoom)
TileSourcetileXYToLatLon in interface TileSourcex - x tile indexy - y tile indexzoom - zoom levelpublic TileXY latLonToTileXY(double lat, double lon, int zoom)
TileSourcelatLonToTileXY in interface TileSourcelat - latitudelon - longitudezoom - zoom levelpublic TileXY latLonToTileXY(ICoordinate point, int zoom)
TileSourcelatLonToTileXY in interface TileSourcelatLonToTileXY in class AbstractTMSTileSourcepoint - pointzoom - zoom levelpublic int getTileXMax(int zoom)
TileSourcegetTileXMax in interface TileSourcegetTileXMax in class AbstractTMSTileSourcezoom - zoom levelpublic int getTileYMax(int zoom)
TileSourcegetTileYMax in interface TileSourcegetTileYMax in class AbstractTMSTileSourcezoom - zoom levelpublic java.awt.Point latLonToXY(double lat, double lon, int zoom)
TileSourcelatLonToXY in interface TileSourcelat - latitudelon - longitudezoom - zoom levelpublic java.awt.Point latLonToXY(ICoordinate point, int zoom)
TileSourcelatLonToXY in interface TileSourcelatLonToXY in class AbstractTMSTileSourcepoint - pointzoom - zoom levelpublic Coordinate xyToLatLon(java.awt.Point point, int zoom)
TileSourcexyToLatLon in interface TileSourcexyToLatLon in class AbstractTMSTileSourcepoint - pointzoom - zoom levelpublic Coordinate xyToLatLon(int x, int y, int zoom)
TileSourcexyToLatLon in interface TileSourcex - X coordinatey - Y coordinatezoom - zoom levelpublic java.util.Map<java.lang.String,java.lang.String> getHeaders()
getHeaders in interface TemplatedTileSourcepublic int getMaxZoom()
TileSourceTileSource.getMaxZoom()].getMaxZoom in interface TileSourcegetMaxZoom in class AbstractTMSTileSourceJMapViewer.MAX_ZOOMpublic java.lang.String getTileId(int zoom, int tilex, int tiley)
TileSourcegetTileId in interface TileSourcegetTileId in class AbstractTMSTileSourcezoom - zoom leveltilex - X coordinatetiley - Y coordinatepublic static void checkUrl(java.lang.String url)
url - URL to checkpublic static java.util.List<java.util.Map.Entry<java.lang.String,java.util.List<WMTSTileSource.Layer>>> groupLayersByNameAndTileMatrixSet(java.util.Collection<WMTSTileSource.Layer> layers)
layers - to be groupedpublic java.util.Collection<java.lang.String> getSupportedProjections()
private int getTileYMax(int zoom, Projection proj)
private int getTileXMax(int zoom, Projection proj)
public NativeScaleLayer.ScaleList getNativeScales()
NativeScaleLayer.ScaleList of native scalespublic Projection getTileProjection()
public IProjected tileXYtoProjected(int x, int y, int zoom)
TileSourcetileXYtoProjected in interface TileSourcex - x tile indexy - z tile indexzoom - zoom levelpublic TileXY projectedToTileXY(IProjected projected, int zoom)
TileSourceprojectedToTileXY in interface TileSourceprojected - projected coordinateszoom - zoom levelprivate EastNorth tileToEastNorth(int x, int y, int z)
private ProjectionBounds getTileProjectionBounds(Tile tile)
public boolean isInside(Tile inner, Tile outer)
TileSourceisInside in interface TileSourceinner - the tile that is suspected to be inside the other tileouter - the tile that might contain the first tilepublic TileRange getCoveringTileRange(Tile tile, int newZoom)
TileSourcegetCoveringTileRange in interface TileSourcetile - the tile to covernewZoom - zoom level of the covering tilesnewZoompublic java.lang.String getServerCRS()
TileSourcegetServerCRS in interface TileSourcepublic java.util.Collection<WMTSTileSource.Layer> getLayers()