Class StreamingRendererJFX
java.lang.Object
org.jorigin.geotools.StreamingRendererJFX
- All Implemented Interfaces:
GTRendererJFX
A GeoTools map renderer that draws directly onto a JavaFX
Canvas
using the JavaFX GraphicsContext API — no AWT dependency.
The rendering pipeline iterates over the MapContent layers and
handles each layer type:
FeatureLayer— vector layers with SLD-based symbolization (polygon, line, point symbolizers); geometries are converted to JavaFX path commands via JTSCoordinateSequencetraversal.WMSLayer— raster layers fetched from a WMS server via aGetMaprequest; the response image is loaded asynchronously and drawn onto the canvas when available.WMTSMapLayer— tiled raster layers fetched through theGridCoverage2DReaderexposed byWMTSMapLayer; the read (which performsGetTilerequests and composites the tiles) runs on a background thread and the resulting image is drawn onto the canvas when available.
Layer compositing: WMS layers are drawn asynchronously on top of whatever is already on the canvas; feature layers are drawn synchronously on top of WMS content. The canvas is only cleared on resize — during pan/zoom the old image remains visible until the new WMS response arrives.
Usage (on the JavaFX application thread):
StreamingRendererJFX renderer = new StreamingRendererJFX();
somePane.getChildren().add(renderer.getCanvas());
renderer.paint(mapContent, 800, 600, envelope);
paint(org.geotools.map.MapContent, double, double, org.geotools.geometry.jts.ReferencedEnvelope) must be called on the JavaFX application thread.
stopRendering() may be called from any thread.
- Author:
- Julien SEINTURIER - Université de Toulon / CNRS LIS umr 7020
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavafx.scene.canvas.CanvasReturns theCanvasnode onto which the map is rendered.voidpaint(org.geotools.map.MapContent content, double w, double h, org.geotools.geometry.jts.ReferencedEnvelope area) Renders the given map content onto the internalCanvas.voidSignals the current render to stop after the current feature.
-
Constructor Details
-
StreamingRendererJFX
public StreamingRendererJFX()Create a streaming renderer with default parameters.
-
-
Method Details
-
getCanvas
public javafx.scene.canvas.Canvas getCanvas()Returns theCanvasnode onto which the map is rendered. Add it to the JavaFX scene graph to display the map.- Specified by:
getCanvasin interfaceGTRendererJFX- Returns:
- the display canvas
-
paint
public void paint(org.geotools.map.MapContent content, double w, double h, org.geotools.geometry.jts.ReferencedEnvelope area) Renders the given map content onto the internalCanvas.Must be called on the JavaFX application thread.
- Specified by:
paintin interfaceGTRendererJFX- Parameters:
content- the map content to renderw- target width in pixelsh- target height in pixelsarea- the world-coordinate envelope to render
-
stopRendering
public void stopRendering()Signals the current render to stop after the current feature. Safe to call from any thread.- Specified by:
stopRenderingin interfaceGTRendererJFX
-