public class WMTSTileSource extends TMSTileSource implements TemplatedTileSource
Modifier and Type | Class and Description |
---|---|
private static class |
WMTSTileSource.Layer |
private static class |
WMTSTileSource.SelectLayerDialog |
private static class |
WMTSTileSource.TileMatrix |
private static class |
WMTSTileSource.TileMatrixSet |
private static class |
WMTSTileSource.TransferMode |
Modifier and Type | Field and Description |
---|---|
private static String[] |
ALL_PATTERNS |
private double |
crsScale |
private WMTSTileSource.Layer |
currentLayer |
private WMTSTileSource.TileMatrixSet |
currentTileMatrixSet |
private Map<String,String> |
headers |
private Collection<WMTSTileSource.Layer> |
layers |
private static String |
OWS_NS_URL |
private static String |
PATTERN_HEADER |
private WMTSTileSource.TransferMode |
transferMode |
private static String |
URL_GET_ENCODING_PARAMS |
private static String |
WMTS_NS_URL |
private static String |
XLINK_NS_URL |
maxZoom, minZoom
baseUrl, id, name, osmMercator, tileSize
attributionImage, attributionImageURL, attributionLinkURL, attributionText, termsOfUseText, termsOfUseURL
Constructor and Description |
---|
WMTSTileSource(ImageryInfo info)
Creates a tile source based on imagery info
|
Modifier and Type | Method and Description |
---|---|
static void |
checkUrl(String url)
Checks if url is acceptable by this Tile Source
|
private static String |
crsToCode(String crsIdentifier) |
private Collection<WMTSTileSource.Layer> |
getCapabilities() |
int |
getDefaultTileSize() |
double |
getDistance(double lat1,
double lon1,
double lat2,
double lon2)
Gets the distance using Spherical law of cosines.
|
Map<String,String> |
getHeaders() |
private Collection<WMTSTileSource.Layer> |
getLayers(String name,
String projectionCode) |
int |
getMaxZoom()
Specifies the maximum zoom value.
|
Set<String> |
getSupportedProjections() |
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) |
int |
getTileSize()
Specifies how large each tile is.
|
String |
getTileUrl(int zoom,
int tilex,
int tiley)
Constructs the tile url.
|
int |
getTileXMax(int zoom) |
private int |
getTileXMax(int zoom,
Projection proj) |
int |
getTileXMin(int zoom) |
int |
getTileYMax(int zoom) |
private int |
getTileYMax(int zoom,
Projection proj) |
int |
getTileYMin(int zoom) |
private static WMTSTileSource.TransferMode |
getTransferMode(XMLStreamReader reader)
Parses Operation[@name='GetTile']/DCP/HTTP/Get section.
|
private String |
handleTemplate(String url) |
void |
initProjection(Projection proj)
Initializes projection for this TileSource with projection
|
TileXY |
latLonToTileXY(double lat,
double lon,
int zoom) |
TileXY |
latLonToTileXY(ICoordinate point,
int zoom) |
Point |
latLonToXY(double lat,
double lon,
int zoom) |
Point |
latLonToXY(ICoordinate point,
int zoom) |
private static boolean |
moveReaderToTag(XMLStreamReader reader,
QName[] tags)
Moves reader to first occurrence of the structure equivalent of Xpath tags[0]/tags[1]../tags[n].
|
private static String |
normalizeCapabilitiesUrl(String url) |
private static Collection<WMTSTileSource.Layer> |
parseContents(XMLStreamReader reader)
Parse Contents tag.
|
private static WMTSTileSource.Layer |
parseLayer(XMLStreamReader reader)
Parse Layer tag.
|
private void |
parseOperationMetadata(XMLStreamReader reader)
Parses OperationMetadata section.
|
private static WMTSTileSource.TileMatrix |
parseTileMatrix(XMLStreamReader reader,
String matrixCrs)
Parses TileMatrix section.
|
private static WMTSTileSource.TileMatrixSet |
parseTileMatrixSet(XMLStreamReader reader)
Parses TileMatrixSet section.
|
private static String |
praseTileMatrixSetLink(XMLStreamReader reader)
Gets TileMatrixSetLink value.
|
ICoordinate |
tileXYToLatLon(int x,
int y,
int zoom) |
ICoordinate |
tileXYToLatLon(Tile tile) |
ICoordinate |
tileXYToLatLon(TileXY xy,
int zoom) |
private WMTSTileSource.Layer |
userSelectLayer(Collection<WMTSTileSource.Layer> layers) |
Coordinate |
xyToLatLon(int x,
int y,
int zoom) |
Coordinate |
xyToLatLon(Point point,
int zoom) |
getMinZoom
getBaseUrl, getExtension, getId, getMetadata, getName, getTilePath, isNoTileAtZoom, toString
getAttributionImage, getAttributionImageURL, getAttributionLinkURL, getAttributionText, getTermsOfUseText, getTermsOfUseURL, requiresAttribution, setAttributionImage, setAttributionImageURL, setAttributionLinkURL, setAttributionText, setTermsOfUseText, setTermsOfUseURL
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getId, getMetadata, getMinZoom, getName, isNoTileAtZoom
getAttributionImage, getAttributionImageURL, getAttributionLinkURL, getAttributionText, getTermsOfUseText, getTermsOfUseURL, requiresAttribution
private static final String PATTERN_HEADER
private static final String URL_GET_ENCODING_PARAMS
private static final String[] ALL_PATTERNS
private static final String OWS_NS_URL
private static final String WMTS_NS_URL
private static final String XLINK_NS_URL
private Collection<WMTSTileSource.Layer> layers
private WMTSTileSource.Layer currentLayer
private WMTSTileSource.TileMatrixSet currentTileMatrixSet
private double crsScale
private WMTSTileSource.TransferMode transferMode
public WMTSTileSource(ImageryInfo info) throws IOException
info
- imagery infoIOException
- if any I/O error occursprivate WMTSTileSource.Layer userSelectLayer(Collection<WMTSTileSource.Layer> layers)
private String handleTemplate(String url)
private Collection<WMTSTileSource.Layer> getCapabilities() throws IOException
IOException
private static Collection<WMTSTileSource.Layer> parseContents(XMLStreamReader reader) throws XMLStreamException
reader
- StAX reader instanceXMLStreamException
- See XMLStreamReader
private static WMTSTileSource.Layer parseLayer(XMLStreamReader reader) throws XMLStreamException
reader
- StAX reader instanceXMLStreamException
- See XMLStreamReader
private static String praseTileMatrixSetLink(XMLStreamReader reader) throws XMLStreamException
reader
- StAX reader instanceXMLStreamException
- See XMLStreamReader
private static WMTSTileSource.TileMatrixSet parseTileMatrixSet(XMLStreamReader reader) throws XMLStreamException
reader
- StAX reader instanceXMLStreamException
- See XMLStreamReader
private static WMTSTileSource.TileMatrix parseTileMatrix(XMLStreamReader reader, String matrixCrs) throws XMLStreamException
reader
- StAX reader instancematrixCrs
- projection used by this matrixXMLStreamException
- See XMLStreamReader
private void parseOperationMetadata(XMLStreamReader reader) throws XMLStreamException
reader
- StAX reader instanceXMLStreamException
- See XMLStreamReader
private static WMTSTileSource.TransferMode getTransferMode(XMLStreamReader reader) throws XMLStreamException
reader
- StAX reader instanceXMLStreamException
- See XMLStreamReader
private static boolean moveReaderToTag(XMLStreamReader reader, QName[] tags) throws XMLStreamException
reader
- StAX reader instancetags
- array of tagsXMLStreamException
- See XMLStreamReader
private static String normalizeCapabilitiesUrl(String url) throws MalformedURLException
MalformedURLException
public void initProjection(Projection proj)
proj
- projection to be used by this TileSourceprivate Collection<WMTSTileSource.Layer> getLayers(String name, String projectionCode)
public int getDefaultTileSize()
getDefaultTileSize
in interface TileSource
getDefaultTileSize
in class AbstractTMSTileSource
public int getTileSize()
TileSource
getTileSize
in interface TileSource
getTileSize
in class AbstractTMSTileSource
public String getTileUrl(int zoom, int tilex, int tiley)
TileSource
getTileUrl
in interface TileSource
getTileUrl
in class AbstractTMSTileSource
zoom
- zoom leveltilex
- X coordinatetiley
- Y coordinateprivate WMTSTileSource.TileMatrix getTileMatrix(int zoom)
zoom
- zoom levelpublic double getDistance(double lat1, double lon1, double lat2, double lon2)
TileSource
getDistance
in interface TileSource
getDistance
in class AbstractTMSTileSource
lat1
- latitude of first pointlon1
- longitude of first pointlat2
- latitude of second pointlon2
- longitude of second pointpublic ICoordinate tileXYToLatLon(Tile tile)
tileXYToLatLon
in interface TileSource
tileXYToLatLon
in class AbstractTMSTileSource
tile
- Tilepublic ICoordinate tileXYToLatLon(TileXY xy, int zoom)
tileXYToLatLon
in interface TileSource
tileXYToLatLon
in class AbstractTMSTileSource
xy
- X/Y coordinateszoom
- zoom levelpublic ICoordinate tileXYToLatLon(int x, int y, int zoom)
tileXYToLatLon
in interface TileSource
tileXYToLatLon
in class AbstractTMSTileSource
x
- X coordinatey
- Y coordinatezoom
- zoom levelpublic TileXY latLonToTileXY(double lat, double lon, int zoom)
latLonToTileXY
in interface TileSource
latLonToTileXY
in class AbstractTMSTileSource
lat
- latitudelon
- longitudezoom
- zoom levelpublic TileXY latLonToTileXY(ICoordinate point, int zoom)
latLonToTileXY
in interface TileSource
latLonToTileXY
in class AbstractTMSTileSource
point
- pointzoom
- zoom levelpublic int getTileXMax(int zoom)
getTileXMax
in interface TileSource
getTileXMax
in class AbstractTMSTileSource
zoom
- zoom levelpublic int getTileXMin(int zoom)
getTileXMin
in interface TileSource
getTileXMin
in class AbstractTMSTileSource
zoom
- zoom levelpublic int getTileYMax(int zoom)
getTileYMax
in interface TileSource
getTileYMax
in class AbstractTMSTileSource
zoom
- zoom levelpublic int getTileYMin(int zoom)
getTileYMin
in interface TileSource
getTileYMin
in class AbstractTMSTileSource
zoom
- zoom levelpublic Point latLonToXY(double lat, double lon, int zoom)
latLonToXY
in interface TileSource
latLonToXY
in class AbstractTMSTileSource
lat
- latitudelon
- longitudezoom
- zoom levelpublic Point latLonToXY(ICoordinate point, int zoom)
latLonToXY
in interface TileSource
latLonToXY
in class AbstractTMSTileSource
point
- pointzoom
- zoom levelpublic Coordinate xyToLatLon(Point point, int zoom)
xyToLatLon
in interface TileSource
xyToLatLon
in class AbstractTMSTileSource
point
- pointzoom
- zoom levelpublic Coordinate xyToLatLon(int x, int y, int zoom)
xyToLatLon
in interface TileSource
xyToLatLon
in class AbstractTMSTileSource
x
- X coordinatey
- Y coordinatezoom
- zoom levelpublic Map<String,String> getHeaders()
getHeaders
in interface TemplatedTileSource
public int getMaxZoom()
TileSource
TileSource.getMaxZoom()
].getMaxZoom
in interface TileSource
getMaxZoom
in class TMSTileSource
JMapViewer.MAX_ZOOM
public String getTileId(int zoom, int tilex, int tiley)
TileSource
getTileId
in interface TileSource
getTileId
in class AbstractTMSTileSource
zoom
- zoom leveltilex
- X coordinatetiley
- Y coordinatepublic static void checkUrl(String url)
url
- URL to checkpublic Set<String> getSupportedProjections()
private int getTileYMax(int zoom, Projection proj)
private int getTileXMax(int zoom, Projection proj)