Class FXWMTSMapLayer

java.lang.Object
org.geotools.map.Layer
org.geotools.map.StyleLayer
org.geotools.map.RasterLayer
org.geotools.map.GridReaderLayer
org.geotools.ows.wmts.map.WMTSMapLayer
org.jorigin.geotools.map.FXWMTSMapLayer

public class FXWMTSMapLayer extends org.geotools.ows.wmts.map.WMTSMapLayer
A 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_CRS

    Fields inherited from class org.geotools.map.GridReaderLayer

    params, reader

    Fields inherited from class org.geotools.map.RasterLayer

    source

    Fields inherited from class org.geotools.map.StyleLayer

    style

    Fields inherited from class org.geotools.map.Layer

    listenerList, selected, title, userData, visible
  • Constructor Summary

    Constructors
    Constructor
    Description
    FXWMTSMapLayer(org.geotools.ows.wmts.WebMapTileServer server, org.geotools.ows.wms.Layer layer)
    Builds a new FX-aware WMTS map layer.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.geotools.ows.wmts.model.WMTSLayer
    Get the WMTS layer descriptor (from the server's capabilities).
    org.geotools.ows.wmts.WebMapTileServer
    Get the WMTS server this layer was built from.

    Methods inherited from class org.geotools.ows.wmts.map.WMTSMapLayer

    getBounds, getCoordinateReferenceSystem, getRawTime, getReader, isNativelySupported, setRawTime

    Methods inherited from class org.geotools.map.GridReaderLayer

    dispose, getParams, toFeatureCollection

    Methods inherited from class org.geotools.map.RasterLayer

    getFeatureSource

    Methods inherited from class org.geotools.map.StyleLayer

    getStyle, setStyle

    Methods 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

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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 from capabilities.getLayer(...); must be a WMTSLayer (the dynamic type returned by WMTSCapabilities.getLayer)
      Throws:
      ClassCastException - if layer is not a WMTSLayer
  • 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)