public class StreamingRenderer extends Object implements GTRenderer
The streaming renderer is not thread safe
| Modifier and Type | Class and Description | 
|---|---|
| protected class  | StreamingRenderer.EndRequestMarks the end of the request flow, instructs the painting thread to exit | 
| protected class  | StreamingRenderer.FeatureRenderedRequestA request to paint a shape with a specific Style2D | 
| protected class  | StreamingRenderer.MargeCompositingGroupRequest | 
| protected class  | StreamingRenderer.MergeLayersRequestA request to merge multiple back buffers to the main graphics | 
| protected class  | StreamingRenderer.PaintShapeRequestA request to paint a shape with a specific Style2D | 
| protected class  | StreamingRenderer.RenderCoverageReaderRequestA request to render a raster | 
| protected class  | StreamingRenderer.RenderDirectLayerRequest | 
| class  | StreamingRenderer.RenderingBlockingQueueA blocking queue subclass with a special behavior for the occasion when the rendering stop
 has been requested: puts are getting ignored, and take always returns an EndRequest | 
| protected class  | StreamingRenderer.RenderingRequestA request sent to the painting thread | 
| protected class  | StreamingRenderer.RenderRasterRequestA request to render a raster | 
| Modifier and Type | Field and Description | 
|---|---|
| static String | ADVANCED_PROJECTION_HANDLING_KEYEnables advanced reprojection handling. | 
| static String | BYLAYER_INTERPOLATION | 
| static String | CONTINUOUS_MAP_WRAPPINGEnabled continuous cartographic wrapping for projections that can wrap around their edges
 (e.g., Mercator): this results in a continous horizontal map much like Google Maps | 
| static String | DECLARED_SCALE_DENOM_KEY | 
| static String | DPI_KEY | 
| protected static FilterFactory2 | filterFactoryFilter factory for creating bounding box filters | 
| static String | FORCE_EPSG_AXIS_ORDER_KEY | 
| static String | LABEL_CACHE_KEY | 
| protected LabelCache | labelCache | 
| static String | LINE_WIDTH_OPTIMIZATION_KEYWhether the thin line width optimization should be used, or not. | 
| static String | OPTIMIZE_FTS_RENDERING_KEYBoolean flag controlling a memory/speed trade off related to how multiple feature type styles
 are rendered. | 
| protected StyledShapePainter | painterThe painter class we use to depict shapes onto the screen | 
| static String | RENDERING_BUFFERThe rendering buffer grows the query area to account for features that are contributing to
 the requested area due to their large symbolizer, or long label | 
| static String | SCALE_ACCURATEComputes the scale as the ratio between map distances and real world distances, assuming
 90dpi and taking into consideration projection deformations and actual earth shape. | 
| static String | SCALE_COMPUTATION_METHOD_KEY | 
| static String | SCALE_OGCVery simple and lenient scale computation method that conforms to the OGC SLD specification
 1.0, page 26. | 
| protected double | scaleDenominatorThe ratio required to scale the features to be rendered so that they fit into the output
 space. | 
| static String | TEXT_RENDERING_ADAPTIVEWill use STRING mode for horizontal labels, OUTLINE mode for all other labels. | 
| static String | TEXT_RENDERING_KEYThe text rendering method, either TEXT_RENDERING_OUTLINE or TEXT_RENDERING_STRING | 
| static String | TEXT_RENDERING_OUTLINEText will be rendered using the associated  GlyphVectoroutline, that is, aShape. | 
| static String | TEXT_RENDERING_STRINGText will be rendered using the usual calls gc.drawString/drawGlyphVector. | 
| static String | VECTOR_RENDERING_KEYBoolean flag indicating whether vector rendering should be preferred when painting graphic
 fills. | 
| Constructor and Description | 
|---|
| StreamingRenderer()Creates a new instance of LiteRenderer without a context. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addRenderListener(RenderListener listener)adds a listener that responds to error events of feature rendered events. | 
| boolean | getConcatTransforms()Flag which controls behaviour for applying affine transformation to the graphics object. | 
| MapContext | getContext()Deprecated. 
 The  MapContextclass is being phased out. Please usesetMapContent(org.geotools.map.MapContent). | 
| double | getGeneralizationDistance()Returns the generalization distance in the screen space. | 
| RenderingHints | getJava2DHints()Hints used to configure Java2D Graphics prior to rendering. | 
| MapContent | getMapContent()Gets the  MapContentinstance which contains the data being rendered. | 
| static MathTransform | getMathTransform(CoordinateReferenceSystem sourceCRS,
                CoordinateReferenceSystem destCRS) | 
| int | getMaxBackBufferMemory(int width,
                      int height)When drawing in optimized mode a 32bit surface is created for each FeatureTypeStyle other
 than the first in order to draw features in parallel while respecting the feature draw
 ordering multiple FTS impose. | 
| Map | getRendererHints()Hints used to configure rendering process | 
| protected BlockingQueue<StreamingRenderer.RenderingRequest> | getRequestsQueue()Builds the blocking queue used to bridge between the data loading thread and the painting one | 
| boolean | isCanTransform() | 
| boolean | isInteractive()Getter for property interactive. | 
| void | paint(Graphics2D graphics,
     Rectangle paintArea,
     AffineTransform worldToScreen)Deprecated. 
 Use paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea)
     or paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea,
     AffineTransform worldToScreen) instead. | 
| void | paint(Graphics2D graphics,
     Rectangle paintArea,
     Envelope mapArea)Deprecated. 
 Use paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea)
     or paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea,
     AffineTransform worldToScreen) instead. | 
| void | paint(Graphics2D graphics,
     Rectangle paintArea,
     Envelope mapArea,
     AffineTransform worldToScreen)Deprecated. 
 Use paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea)
     or paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea,
     AffineTransform worldToScreen) instead. | 
| void | paint(Graphics2D graphics,
     Rectangle paintArea,
     ReferencedEnvelope mapArea)Renders features based on the map layers and their styles as specified in the map context
 using  setContext. | 
| void | paint(Graphics2D graphics,
     Rectangle paintArea,
     ReferencedEnvelope mapArea,
     AffineTransform worldToScreen)Renders features based on the map layers and their styles as specified in the map context
 using  setContext. | 
| void | removeRenderListener(RenderListener listener)Removes a render listener. | 
| void | setConcatTransforms(boolean flag)Sets the flag which controls behaviour for applying affine transformation to the graphics
 object. | 
| void | setContext(MapContext context)Deprecated. 
 The  MapContextclass is being phased out. Please usesetMapContent(org.geotools.map.MapContent). | 
| void | setGeneralizationDistance(double d)Sets the generalizazion distance in the screen space. | 
| void | setInteractive(boolean interactive)Sets the interactive status of the renderer. | 
| void | setJava2DHints(RenderingHints hints)Hints used to configure Java2D Graphics prior to rendering. | 
| void | setMapContent(MapContent mapContent)Sets the  MapContentwhich contains the data to be rendered. | 
| void | setRendererHints(Map hints)Hints used to configure rendering process. | 
| void | setThreadPool(ExecutorService threadPool)Sets a thread pool to be used in parallel rendering | 
| void | stopRendering()If you call this method from another thread than the one that called  paintorrenderthe rendering will be forcefully stopped before termination | 
public static final String SCALE_ACCURATE
public static final String SCALE_OGC
public static final String RENDERING_BUFFER
protected static final FilterFactory2 filterFactory
protected double scaleDenominator
protected LabelCache labelCache
protected StyledShapePainter painter
public static final String TEXT_RENDERING_STRING
public static final String TEXT_RENDERING_OUTLINE
GlyphVector outline, that is, a Shape. This ensures perfect centering between the text and the halo, but introduces more
 text aliasing.public static final String TEXT_RENDERING_ADAPTIVE
RenderingHints.VALUE_FRACTIONALMETRICS_ONpublic static final String TEXT_RENDERING_KEY
public static final String LINE_WIDTH_OPTIMIZATION_KEY
When rendering non antialiased lines adopting a width of 0 makes the java2d renderer get into a fast path that generates the same output as a 1 pixel wide line
Unfortunately for antialiased rendering that optimization does not help, and disallows controlling the width of thin lines. It is provided as an explicit option as the optimization has been hard coded for years, removing it when antialiasing is on by default will invalidate lots of existing styles (making lines appear thicker).
public static final String OPTIMIZE_FTS_RENDERING_KEY
When enabled (by default) multiple feature type styles against the same data source will be rendered in separate memory back buffers in a way that allows the source to be scanned only once (each back buffer is as big as the image being rendered).
When disabled no memory back buffers will be used but the feature source will be scanned once for every feature type style declared against it
public static final String ADVANCED_PROJECTION_HANDLING_KEY
public static final String CONTINUOUS_MAP_WRAPPING
public static final String VECTOR_RENDERING_KEY
SLDStyleFactory.isVectorRenderingEnabled() for more details.public static final String LABEL_CACHE_KEY
public static final String FORCE_EPSG_AXIS_ORDER_KEY
public static final String DPI_KEY
public static final String DECLARED_SCALE_DENOM_KEY
public static final String SCALE_COMPUTATION_METHOD_KEY
public static final String BYLAYER_INTERPOLATION
public StreamingRenderer()
public void setThreadPool(ExecutorService threadPool)
threadPool - public void setConcatTransforms(boolean flag)
flag - If true then the transform will be concatenated to the existing transform. If
     false it will be replaced.public boolean getConcatTransforms()
public void addRenderListener(RenderListener listener)
addRenderListener in interface GTRendererlistener - the listener to add.RenderListenerpublic void removeRenderListener(RenderListener listener)
removeRenderListener in interface GTRendererlistener - the listener to remove.RenderListenerpublic void stopRendering()
paint or
 render the rendering will be forcefully stopped before terminationstopRendering in interface GTRendererpublic void paint(Graphics2D graphics, Rectangle paintArea, AffineTransform worldToScreen)
setContext.
 This version of the method assumes that the size of the output area and the transformation from coordinates to pixels are known. The latter determines the map scale. The viewport (the visible part of the map) will be calculated internally.
paint in interface GTRenderergraphics - The graphics object to draw to.paintArea - The size of the output area in output units (eg: pixels).worldToScreen - A transform which converts World coordinates to Screen coordinates.public void paint(Graphics2D graphics, Rectangle paintArea, Envelope mapArea)
setContext.
 This version of the method assumes that the area of the visible part of the map and the size of the output area are known. The transform between the two is calculated internally.
paint in interface GTRenderergraphics - The graphics object to draw to.paintArea - The size of the output area in output units (eg: pixels).mapArea - the map's visible area (viewport) in map coordinates.public void paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea)
setContext.
 This version of the method assumes that the area of the visible part of the map and the size of the output area are known. The transform between the two is calculated internally.
paint in interface GTRenderergraphics - The graphics object to draw to.paintArea - The size of the output area in output units (eg: pixels).mapArea - the map's visible area (viewport) in map coordinates.public void paint(Graphics2D graphics, Rectangle paintArea, Envelope mapArea, AffineTransform worldToScreen)
setContext.
 This version of the method assumes that paint area, envelope and worldToScreen transform are already computed. Use this method to avoid recomputation. Note however that no check is performed that they are really in sync!
paint in interface GTRenderergraphics - The graphics object to draw to.paintArea - The size of the output area in output units (eg: pixels).mapArea - the map's visible area (viewport) in map coordinates.worldToScreen - A transform which converts World coordinates to Screen coordinates.public void paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea, AffineTransform worldToScreen)
setContext.
 This version of the method assumes that paint area, envelope and worldToScreen transform are already computed. Use this method to avoid recomputation. Note however that no check is performed that they are really in sync!
paint in interface GTRenderergraphics - The graphics object to draw to.paintArea - The size of the output area in output units (eg: pixels).mapArea - the map's visible area (viewport) in map coordinates. Its associate CRS is
     ALWAYS 2DworldToScreen - A transform which converts World coordinates to Screen coordinates.protected BlockingQueue<StreamingRenderer.RenderingRequest> getRequestsQueue()
public int getMaxBackBufferMemory(int width,
                                  int height)
MapContext, assuming the
 feature type style optimizations are turned on (in the case they are off, no extra memory
 will be used).width - the image widthheight - the image heightpublic boolean isInteractive()
public void setInteractive(boolean interactive)
interactive - new value for the interactive propertypublic double getGeneralizationDistance()
public void setGeneralizationDistance(double d)
Default value is 0.8, meaning that two subsequent points are collapsed to one if their on screen distance is less than one pixel
Set the distance to 0 if you don't want any kind of generalization
d - public void setJava2DHints(RenderingHints hints)
GTRenderersetJava2DHints in interface GTRendererpublic RenderingHints getJava2DHints()
GTRenderergetJava2DHints in interface GTRendererpublic void setRendererHints(Map hints)
GTRenderersetRendererHints in interface GTRendererpublic Map getRendererHints()
GTRenderergetRendererHints in interface GTRendererpublic void setContext(MapContext context)
MapContext class is being phased out. Please use setMapContent(org.geotools.map.MapContent).setContext in interface GTRendererpublic MapContext getContext()
MapContext class is being phased out. Please use setMapContent(org.geotools.map.MapContent).getContext in interface GTRendererpublic void setMapContent(MapContent mapContent)
GTRendererMapContent which contains the data to be rendered.setMapContent in interface GTRenderermapContent - the map contentpublic MapContent getMapContent()
GTRendererMapContent instance which contains the data being rendered.getMapContent in interface GTRendererMapContent instancepublic boolean isCanTransform()
public static MathTransform getMathTransform(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem destCRS)
Copyright © 1996–2019 Geotools. All rights reserved.