Class FXWMTSMapLayer
WMTSMapLayer that retains references to the WebMapTileServer
and the WMTSLayer used to build it, enabling JavaFX renderers to
bypass WMTSCoverageReader and fetch tiles
individually in parallel via JavaFX's native async image loading.
Motivation
Stock WMTSMapLayer stores the server and the layer metadata only
inside its internal WMTSCoverageReader (package-private fields), so
a custom renderer can only go through that reader — whose read(...)
method fetches tiles sequentially via blocking HTTP. For a view with
8–12 tiles at 100–400 ms each this adds up to seconds of latency before
anything is drawn, and a visible white flash during zoom/pan.
By exposing getServer() and getLayerInfo(), a renderer
can construct a GetTileRequest directly,
enumerate the Tile instances for the visible area,
and load each tile URL via a JavaFX Image with background loading.
This method enable to parallelize HTTP on JavaFX's internal image-I/O thread pool and
supports progressive rendering (each tile appears as it arrives).
Usage
WebMapTileServer server = new WebMapTileServer(url);
WMTSCapabilities caps = server.getCapabilities();
Layer wmtsLayer = caps.getLayer("MY_LAYER");
FXWMTSMapLayer mapLayer = new FXWMTSMapLayer(server, wmtsLayer);
mapContent.addLayer(mapLayer);
Renderers that do not recognize this subclass will simply treat it as a
regular WMTSMapLayer and fall back to the coverage-reader pipeline.
- Author:
- Julien SEINTURIER - Université de Toulon / CNRS LIS umr 7020
-
Field Summary
Fields inherited from class org.geotools.ows.wmts.map.WMTSMapLayer
LOGGER, SOURCE_CRSFields inherited from class org.geotools.map.GridReaderLayer
params, readerFields inherited from class org.geotools.map.RasterLayer
sourceFields inherited from class org.geotools.map.StyleLayer
styleFields inherited from class org.geotools.map.Layer
listenerList, selected, title, userData, visible -
Constructor Summary
ConstructorsConstructorDescriptionFXWMTSMapLayer(org.geotools.ows.wmts.WebMapTileServer server, org.geotools.ows.wms.Layer layer) Builds a new FX-aware WMTS map layer. -
Method Summary
Modifier and TypeMethodDescriptionorg.geotools.ows.wmts.model.WMTSLayerGet the WMTS layer descriptor (from the server's capabilities).org.geotools.ows.wmts.WebMapTileServerGet the WMTS server this layer was built from.Methods inherited from class org.geotools.ows.wmts.map.WMTSMapLayer
getBounds, getCoordinateReferenceSystem, getRawTime, getReader, isNativelySupported, setRawTimeMethods inherited from class org.geotools.map.GridReaderLayer
dispose, getParams, toFeatureCollectionMethods inherited from class org.geotools.map.RasterLayer
getFeatureSourceMethods inherited from class org.geotools.map.StyleLayer
getStyle, setStyleMethods inherited from class org.geotools.map.Layer
addMapLayerListener, connectDataListener, finalize, fireMapLayerListenerLayerChanged, fireMapLayerListenerLayerDeselected, fireMapLayerListenerLayerHidden, fireMapLayerListenerLayerPreDispose, fireMapLayerListenerLayerSelected, fireMapLayerListenerLayerShown, getQuery, getTitle, getUserData, isSelected, isVisible, preDispose, removeMapLayerListener, setSelected, setTitle, setVisible, toString
-
Constructor Details
-
FXWMTSMapLayer
public FXWMTSMapLayer(org.geotools.ows.wmts.WebMapTileServer server, org.geotools.ows.wms.Layer layer) Builds a new FX-aware WMTS map layer.- Parameters:
server- the WMTS server (retained for direct tile requests)layer- the WMTS layer descriptor fromcapabilities.getLayer(...); must be aWMTSLayer(the dynamic type returned byWMTSCapabilities.getLayer)- Throws:
ClassCastException- iflayeris not aWMTSLayer
-
-
Method Details
-
getServer
public org.geotools.ows.wmts.WebMapTileServer getServer()Get the WMTS server this layer was built from.- Returns:
- the WMTS server this layer was built from
-
getLayerInfo
public org.geotools.ows.wmts.model.WMTSLayer getLayerInfo()Get the WMTS layer descriptor (from the server's capabilities).- Returns:
- the WMTS layer descriptor (from the server's capabilities)
-