public abstract class WMTSProtocolHandler extends Object
Abstract class that represents handlers to comunicate via WMS protocol.
Modifier and Type | Field and Description |
---|---|
protected static Downloader |
downloader |
protected String |
encoding
Encoding used to parse different xml documents.
|
protected boolean |
forceChangeAxisOrder |
protected String |
host |
protected String |
name |
protected String |
port |
protected String |
version |
Constructor and Description |
---|
WMTSProtocolHandler() |
Modifier and Type | Method and Description |
---|---|
static String |
buildCapabilitiesSuitableVersionRequest(String _host,
String _version)
Builds the GetCapabilitiesRequest according to the OGC WMS Specifications
without a VERSION, to get the highest version than a WMS supports.
|
protected abstract WMTSGetCapabilitiesRequest |
createGetCapabilitiesRequest() |
protected abstract WMTSGetFeatureInfoRequest |
createGetFeatureInfoRequest(WMTSStatusImpl status,
int x,
int y) |
protected abstract WMTSGetTileRequest |
createGetTileRequest(WMTSStatusImpl status) |
File |
downloadFile(URL url,
ICancellable cancel,
File forceFile) |
protected byte[] |
fileToBytes(File file)
Copy the file in a byte array
|
String |
getBaseURL(String operation)
Gets the URL base for a operation (GetCapabilities, GetTile, ...)
|
String |
getBaseURL(String operation,
int protocol)
Gets the URL base for a operation (GetCapabilities, GetTile, ...) and
a protocol GET or POST
|
void |
getCapabilities(WMTSServerDescription status,
boolean override,
ICancellable cancel)
Builds a GetCapabilities request that is sent to the WMS
the response will be parse to extract the data needed by the
WMS client
|
String |
getFeatureInfo(WMTSStatusImpl status,
int x,
int y,
ICancellable cancel)
It will send a GetFeatureInfo request to the WMTS
Parsing the response and redirecting the info to the WMTS client
TODO: return a stored file instead a String.
|
String |
getHost() |
File |
getLegendGraphic(WMTSLayer layer,
WMTSStyle style,
ICancellable cancel) |
String |
getName() |
String |
getPort() |
WMTSServerDescription |
getServerDescription() |
String |
getSymbol(String h)
Just for not repeat code.
|
File |
getTile(String url,
ICancellable cancel,
File file) |
File |
getTile(WMTSStatus status,
ICancellable cancel) |
File |
getTile(WMTSStatusImpl status,
ICancellable cancel,
File file) |
URL |
getTileURL(WMTSStatusImpl status) |
String |
getVersion() |
abstract boolean |
parseCapabilities(File f)
parses the data retrieved by the Capabilities XML document
|
protected String |
parseException(byte[] data) |
void |
setForceChangeAxisOrder(boolean force)
Sets longitude first in the axis order read from the capabilities file
|
void |
setHost(String host) |
void |
setName(String name) |
void |
setPort(String port) |
void |
setVersion(String version) |
protected static final Downloader downloader
protected String encoding
protected boolean forceChangeAxisOrder
protected String name
protected String version
protected String host
protected String port
protected abstract WMTSGetFeatureInfoRequest createGetFeatureInfoRequest(WMTSStatusImpl status, int x, int y)
protected abstract WMTSGetTileRequest createGetTileRequest(WMTSStatusImpl status)
protected abstract WMTSGetCapabilitiesRequest createGetCapabilitiesRequest()
public abstract boolean parseCapabilities(File f)
public WMTSServerDescription getServerDescription()
public String getHost()
public void setHost(String host)
host
- The host to set.public String getName()
public void setName(String name)
name
- The name to set.public String getPort()
public void setPort(String port)
port
- The port to set.public String getVersion()
public void setVersion(String version)
version
- The version to set.public String getSymbol(String h)
h
- protected byte[] fileToBytes(File file) throws IOException
file
- The file to copyIOException
public void setForceChangeAxisOrder(boolean force)
force
- public File getTile(WMTSStatusImpl status, ICancellable cancel, File file) throws ServerErrorException, WMTSException
ServerErrorException
WMTSException
public File getTile(WMTSStatus status, ICancellable cancel) throws ServerErrorException, WMTSException
ServerErrorException
WMTSException
public File getTile(String url, ICancellable cancel, File file) throws ServerErrorException, WMTSException
ServerErrorException
WMTSException
public URL getTileURL(WMTSStatusImpl status) throws MalformedURLException
MalformedURLException
public String getBaseURL(String operation)
operation
- public String getBaseURL(String operation, int protocol)
operation
- public File downloadFile(URL url, ICancellable cancel, File forceFile) throws DownloadException
DownloadException
public File getLegendGraphic(WMTSLayer layer, WMTSStyle style, ICancellable cancel) throws ServerErrorException, WMTSException, DownloadException
ServerErrorException
WMTSException
DownloadException
public String getFeatureInfo(WMTSStatusImpl status, int x, int y, ICancellable cancel)
It will send a GetFeatureInfo request to the WMTS Parsing the response and redirecting the info to the WMTS client
TODO: return a stored file instead a String.public void getCapabilities(WMTSServerDescription status, boolean override, ICancellable cancel)
Builds a GetCapabilities request that is sent to the WMS the response will be parse to extract the data needed by the WMS client
override,
- if true the previous downloaded data will be overriddenpublic static String buildCapabilitiesSuitableVersionRequest(String _host, String _version)
protected String parseException(byte[] data) throws IOException
IOException