|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectanl.aida.gis.StreamingRenderer
public final class StreamingRenderer
A streaming implementation of the GTRenderer interface.
At the moment the streaming renderer is not thread safe
Nested Class Summary | |
---|---|
private class |
StreamingRenderer.RenderableFeature
A class transforming (and caching) feature's geometries to shapes |
Field Summary | |
---|---|
private boolean |
canTransform
|
private boolean |
concatTransforms
Flag which controls behaviour for applying affine transformation to the graphics object. |
private org.geotools.map.MapContext |
context
Context which contains the layers and the bounding box which needs to be rendered. |
static java.lang.String |
DECLARED_SCALE_DENOM_KEY
|
private static org.opengis.filter.expression.PropertyName |
defaultGeometryPropertyName
|
private static int |
defaultMaxFiltersToSendToDatastore
|
private org.opengis.referencing.crs.CoordinateReferenceSystem |
destinationCrs
|
static java.lang.String |
DPI_KEY
|
(package private) int |
error
|
private static org.opengis.filter.FilterFactory |
filterFactory
Filter factory for creating bounding box filters |
static java.lang.String |
FORCE_CRS_KEY
|
private double |
generalizationDistance
Maximum displacement for generalization during rendering |
private static org.opengis.filter.expression.PropertyName |
gridPropertyName
|
private org.geotools.renderer.lite.IndexedFeatureResults |
indexedFeatureResults
|
private boolean |
inMemoryGeneralization
Whether the renderer must perform generalization for the current set of features. |
private boolean |
interactive
Flag which determines if the renderer is interactive or not. |
private java.awt.RenderingHints |
java2dHints
|
static java.lang.String |
LABEL_CACHE_KEY
|
protected org.geotools.renderer.lite.LabelCache |
labelCache
|
static java.lang.String |
LINE_WIDTH_OPTIMIZATION_KEY
Whether the thin line width optimization should be used, or not. |
private static java.util.logging.Logger |
LOGGER
The logger for the rendering module. |
private org.geotools.geometry.jts.ReferencedEnvelope |
mapExtent
Geographic map extent, eventually expanded to consider buffer area around the map |
static java.lang.String |
MEMORY_PRE_LOADING_KEY
|
private boolean |
memoryPreloadingEnabledDEFAULT
|
private static org.geotools.geometry.jts.Decimator |
NULL_DECIMATOR
A decimator that will just transform coordinates |
static java.lang.String |
OPTIMIZE_FTS_RENDERING_KEY
Boolean flag controlling a memory/speed trade off related to how multiple feature type styles are rendered. |
static java.lang.String |
OPTIMIZED_DATA_LOADING_KEY
|
private boolean |
optimizedDataLoadingEnabledDEFAULT
|
private org.geotools.geometry.jts.ReferencedEnvelope |
originalMapExtent
Geographic map extent, as provided by the caller |
private org.geotools.renderer.lite.StyledShapePainter |
painter
The painter class we use to depict shapes onto the screen |
private static org.opengis.filter.expression.PropertyName |
paramsPropertyName
|
private java.util.Map |
rendererHints
"optimizedDataLoadingEnabled" - Boolean yes/no (see default optimizedDataLoadingEnabledDEFAULT) "memoryPreloadingEnabled" - Boolean yes/no (see default memoryPreloadingEnabledDEFAULT) "declaredScaleDenominator" - Double the value of the scale denominator to use by the renderer. |
private int |
renderingBufferDEFAULT
|
private boolean |
renderingStopRequested
This flag is set to false when starting rendering, and will be checked during the rendering loop in order to make it stop forcefully |
private org.geotools.renderer.lite.ListenerList |
renderListeners
|
static java.lang.String |
SCALE_ACCURATE
Computes 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 java.lang.String |
SCALE_COMPUTATION_METHOD_KEY
|
static java.lang.String |
SCALE_OGC
Very simple and lenient scale computation method that conforms to the OGC SLD specification 1.0, page 26. |
private java.lang.String |
scaleComputationMethodDEFAULT
|
private double |
scaleDenominator
The ratio required to scale the features to be rendered so that they fit into the output space. |
private java.awt.Rectangle |
screenSize
The size of the output area in output units. |
private org.geotools.renderer.style.SLDStyleFactory |
styleFactory
Factory that will resolve symbolizers into rendered styles |
static java.lang.String |
TEXT_RENDERING_KEY
The text rendering method, either TEXT_RENDERING_OUTLINE or TEXT_RENDERING_STRING |
static java.lang.String |
TEXT_RENDERING_OUTLINE
Text will be rendered using the associated GlyphVector outline, that is, a Shape . |
static java.lang.String |
TEXT_RENDERING_STRING
Text will be rendered using the usual calls gc.drawString/drawGlyphVector. |
private java.lang.String |
textRenderingModeDEFAULT
|
private static double |
TOLERANCE
Tolerance used to compare doubles for equality |
private java.awt.geom.AffineTransform |
worldToScreenTransform
|
Constructor Summary | |
---|---|
StreamingRenderer()
Creates a new instance of LiteRenderer without a context. |
Method Summary | |
---|---|
void |
addRenderListener(org.geotools.renderer.RenderListener listener)
adds a listener that responds to error events of feature rendered events. |
private org.opengis.referencing.operation.MathTransform2D |
buildFullTransform(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
org.opengis.referencing.crs.CoordinateReferenceSystem destCRS,
java.awt.geom.AffineTransform worldToScreenTransform)
Builds a full transform going from the source CRS to the denstionan CRS and from there to the screen |
private double |
computeScale(org.geotools.geometry.jts.ReferencedEnvelope envelope,
java.awt.Rectangle paintArea,
java.util.Map hints)
|
private org.opengis.filter.Filter |
createBBoxFilters(org.opengis.feature.simple.SimpleFeatureType schema,
java.lang.String[] attributes,
com.vividsolutions.jts.geom.Envelope bbox)
Creates the bounding box filters (one for each geometric attribute) needed to query a MapLayer 's feature source to return
just the features for the target rendering extent |
private java.util.ArrayList |
createLiteFeatureTypeStyles(org.geotools.styling.FeatureTypeStyle[] featureStyles,
java.lang.Object typeDescription,
java.awt.Graphics2D graphics)
Creates a list of LiteFeatureTypeStyle s with:
|
private java.util.ArrayList |
createLiteFeatureTypeStyles(org.geotools.styling.FeatureTypeStyle[] featureStyles,
org.opengis.feature.simple.SimpleFeatureType ftype,
java.awt.Graphics2D graphics)
creates a list of LiteFeatureTypeStyles a) out-of-scale rules removed b) incompatible FeatureTypeStyles removed |
private void |
drawOptimized(java.awt.Graphics2D graphics,
org.geotools.map.MapLayer currLayer,
java.awt.geom.AffineTransform at,
org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs,
java.lang.String layerId,
java.util.Collection collection,
org.geotools.feature.FeatureCollection features,
org.geotools.util.NumberRange scaleRange,
java.util.ArrayList lfts)
Performs rendering so that the collection is scanned only once even in presence of multiple feature type styles, using the in memory buffer for each feature type style other than the first one (that uses the graphics provided by the user)s |
private void |
drawPlain(java.awt.Graphics2D graphics,
org.geotools.map.MapLayer currLayer,
java.awt.geom.AffineTransform at,
org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs,
java.lang.String layerId,
java.util.Collection collection,
org.geotools.feature.FeatureCollection features,
org.geotools.util.NumberRange scaleRange,
java.util.ArrayList lfts)
Performs all rendering on the user provided graphics object by scanning the collection multiple times, one for each feature type style provided |
private com.vividsolutions.jts.geom.Envelope |
expandEnvelope(com.vividsolutions.jts.geom.Envelope envelope,
java.awt.geom.AffineTransform worldToScreen,
int buffer)
Extends the provided Envelope in order to add the number of pixels
specified by buffer in every direction. |
private com.vividsolutions.jts.geom.Geometry |
findGeometry(java.lang.Object drawMe,
org.geotools.styling.Symbolizer s)
Finds the geometric attribute requested by the symbolizer |
private org.opengis.referencing.crs.CoordinateReferenceSystem |
findGeometryCS(org.geotools.map.MapLayer currLayer,
java.lang.Object drawMe,
org.geotools.styling.Symbolizer s)
Finds the geometric attribute coordinate reference system. |
private int |
findRenderingBuffer(org.geotools.renderer.lite.LiteFeatureTypeStyle[] styles)
Returns an estimate of the rendering buffer needed to properly display this layer taking into consideration the constant stroke sizes in the feature type styles. |
private java.lang.String[] |
findStyleAttributes(org.geotools.renderer.lite.LiteFeatureTypeStyle[] styles,
org.opengis.feature.simple.SimpleFeatureType schema)
Inspects the MapLayer 's style and retrieves it's needed
attribute names, returning at least the default geometry attribute name. |
private void |
fireErrorEvent(java.lang.Exception e)
|
private void |
fireFeatureRenderedEvent(java.lang.Object feature)
|
boolean |
getConcatTransforms()
Flag which controls behaviour for applying affine transformation to the graphics object. |
org.geotools.map.MapContext |
getContext()
|
double |
getGeneralizationDistance()
Returns the generalization distance in the screen space. |
private org.opengis.filter.expression.PropertyName |
getGeometryPropertyName(org.geotools.styling.Symbolizer s)
|
java.awt.RenderingHints |
getJava2DHints()
|
static org.opengis.referencing.operation.MathTransform |
getMathTransform(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
org.opengis.referencing.crs.CoordinateReferenceSystem destCRS)
|
private int |
getMaxFiltersToSendToDatastore()
find out the maximum number of filters we're going to send off to the datastore. |
private org.opengis.referencing.crs.CoordinateReferenceSystem |
getNativeCRS(org.opengis.feature.simple.SimpleFeatureType schema,
java.util.List<java.lang.String> attNames)
Scans the schema for the specified attributes are returns a single CRS if all the geometric attributes in the lot share one CRS, null if there are different ones |
java.util.Map |
getRendererHints()
|
private int |
getRenderingBuffer()
Returns the rendering buffer, a measure in pixels used to expand the geometry search area enough to capture the geometries that do stay outside of the current rendering bounds but do affect them because of their large strokes (labels and graphic symbols are handled differently, see the label chache). |
private java.lang.String |
getScaleComputationMethod()
Returns scale computation algorithm to be used. |
private java.lang.String |
getTextRenderingMethod()
Returns the text rendering method |
boolean |
isCanTransform()
|
boolean |
isInteractive()
Getter for property interactive. |
private boolean |
isMemoryPreloadingEnabled()
Deprecated. this method shall be killed, its of no use |
private boolean |
isOptimizedDataLoadingEnabled()
Returns true if the optimized data loading is enabled, false otherwise. |
private boolean |
isOptimizedFTSRenderingEnabled()
Checks if optimized feature type style rendering is enabled, or not. |
private boolean |
isWithInScale(org.geotools.styling.Rule r)
Checks if a rule can be triggered at the current scale level |
void |
paint(java.awt.Graphics2D graphics,
java.awt.Rectangle paintArea,
java.awt.geom.AffineTransform worldToScreen)
Deprecated. Use paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea) or paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea, AffineTransform worldToScreen) instead. |
void |
paint(java.awt.Graphics2D graphics,
java.awt.Rectangle paintArea,
com.vividsolutions.jts.geom.Envelope mapArea)
Deprecated. Use paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea) or paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea, AffineTransform worldToScreen) instead. |
void |
paint(java.awt.Graphics2D graphics,
java.awt.Rectangle paintArea,
com.vividsolutions.jts.geom.Envelope mapArea,
java.awt.geom.AffineTransform worldToScreen)
Deprecated. Use paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea) or paint(Graphics2D graphics, Rectangle paintArea, ReferencedEnvelope mapArea, AffineTransform worldToScreen) instead. |
void |
paint(java.awt.Graphics2D graphics,
java.awt.Rectangle paintArea,
org.geotools.geometry.jts.ReferencedEnvelope mapArea)
Renders features based on the map layers and their styles as specified in the map context using setContext . |
void |
paint(java.awt.Graphics2D graphics,
java.awt.Rectangle paintArea,
org.geotools.geometry.jts.ReferencedEnvelope mapArea,
java.awt.geom.AffineTransform worldToScreen)
Renders features based on the map layers and their styles as specified in the map context using setContext . |
private org.geotools.feature.FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
prepFeatureCollection(org.geotools.feature.FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> features,
org.opengis.referencing.crs.CoordinateReferenceSystem sourceCrs)
Prepair a FeatureCollection |
private void |
process(StreamingRenderer.RenderableFeature rf,
org.geotools.renderer.lite.LiteFeatureTypeStyle style,
org.geotools.util.NumberRange scaleRange,
java.awt.geom.AffineTransform at,
org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs,
java.lang.String layerId)
|
private void |
processRuleForQuery(org.geotools.renderer.lite.LiteFeatureTypeStyle[] styles,
org.geotools.data.DefaultQuery q)
JE: If there is a single rule "and" its filter together with the query's filter and send it off to datastore. |
private void |
processStylers(java.awt.Graphics2D graphics,
org.geotools.map.MapLayer currLayer,
java.awt.geom.AffineTransform at,
org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs,
com.vividsolutions.jts.geom.Envelope mapArea,
java.awt.Rectangle screenSize,
java.lang.String layerId)
Applies each feature type styler in turn to all of the features. |
private void |
processSymbolizers(java.awt.Graphics2D graphics,
StreamingRenderer.RenderableFeature drawMe,
org.geotools.styling.Symbolizer[] symbolizers,
org.geotools.util.NumberRange scaleRange,
java.awt.geom.AffineTransform at,
org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs,
java.lang.String layerId)
Applies each of a set of symbolizers in turn to a given feature. |
(package private) java.util.Collection |
queryLayer(org.geotools.map.MapLayer currLayer,
org.geotools.data.memory.CollectionSource source)
Queries a given layer's Source instance to be rendered. |
(package private) org.geotools.feature.FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
queryLayer(org.geotools.map.MapLayer currLayer,
org.geotools.data.FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> source,
org.opengis.feature.simple.SimpleFeatureType schema,
org.geotools.renderer.lite.LiteFeatureTypeStyle[] styles,
com.vividsolutions.jts.geom.Envelope mapArea,
org.opengis.referencing.crs.CoordinateReferenceSystem mapCRS,
org.opengis.referencing.crs.CoordinateReferenceSystem featCrs,
java.awt.Rectangle screenSize,
org.opengis.feature.type.GeometryDescriptor geometryAttribute,
java.awt.geom.AffineTransform worldToScreenTransform)
Queries a given layer's features to be rendered based on the target rendering bounding box. |
void |
removeRenderListener(org.geotools.renderer.RenderListener listener)
Removes a render listener. |
private void |
renderRaster(java.awt.Graphics2D graphics,
java.lang.Object drawMe,
org.geotools.styling.RasterSymbolizer symbolizer,
org.opengis.referencing.crs.CoordinateReferenceSystem destinationCRS,
org.geotools.util.Range scaleRange)
Renders a grid coverage on the device. |
void |
setConcatTransforms(boolean flag)
Sets the flag which controls behaviour for applying affine transformation to the graphics object. |
void |
setContext(org.geotools.map.MapContext context)
|
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(java.awt.RenderingHints hints)
|
void |
setRendererHints(java.util.Map hints)
|
void |
stopRendering()
If you call this method from another thread than the one that called paint or render the rendering will be
forcefully stopped before termination |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int defaultMaxFiltersToSendToDatastore
public static final java.lang.String SCALE_ACCURATE
public static final java.lang.String SCALE_OGC
private static final double TOLERANCE
private static final java.util.logging.Logger LOGGER
int error
private static final org.opengis.filter.FilterFactory filterFactory
private static final org.opengis.filter.expression.PropertyName gridPropertyName
private static final org.opengis.filter.expression.PropertyName paramsPropertyName
private static final org.opengis.filter.expression.PropertyName defaultGeometryPropertyName
private org.geotools.map.MapContext context
private boolean interactive
private boolean concatTransforms
private org.geotools.geometry.jts.ReferencedEnvelope mapExtent
private org.geotools.geometry.jts.ReferencedEnvelope originalMapExtent
private java.awt.Rectangle screenSize
private boolean renderingStopRequested
private double scaleDenominator
private double generalizationDistance
private org.geotools.renderer.style.SLDStyleFactory styleFactory
protected org.geotools.renderer.lite.LabelCache labelCache
private org.geotools.renderer.lite.StyledShapePainter painter
private org.geotools.renderer.lite.IndexedFeatureResults indexedFeatureResults
private org.geotools.renderer.lite.ListenerList renderListeners
private java.awt.RenderingHints java2dHints
private boolean optimizedDataLoadingEnabledDEFAULT
private boolean memoryPreloadingEnabledDEFAULT
private int renderingBufferDEFAULT
private java.lang.String scaleComputationMethodDEFAULT
public static final java.lang.String TEXT_RENDERING_STRING
public static final java.lang.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 java.lang.String TEXT_RENDERING_KEY
private java.lang.String textRenderingModeDEFAULT
public static final java.lang.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 java.lang.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 java.lang.String LABEL_CACHE_KEY
public static final java.lang.String FORCE_CRS_KEY
public static final java.lang.String DPI_KEY
public static final java.lang.String DECLARED_SCALE_DENOM_KEY
public static final java.lang.String MEMORY_PRE_LOADING_KEY
public static final java.lang.String OPTIMIZED_DATA_LOADING_KEY
public static final java.lang.String SCALE_COMPUTATION_METHOD_KEY
private java.util.Map rendererHints
private java.awt.geom.AffineTransform worldToScreenTransform
private org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs
private boolean canTransform
private boolean inMemoryGeneralization
private static final org.geotools.geometry.jts.Decimator NULL_DECIMATOR
Constructor Detail |
---|
public StreamingRenderer()
Method Detail |
---|
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(org.geotools.renderer.RenderListener listener)
addRenderListener
in interface org.geotools.renderer.GTRenderer
listener
- the listener to add.RenderListener
public void removeRenderListener(org.geotools.renderer.RenderListener listener)
removeRenderListener
in interface org.geotools.renderer.GTRenderer
listener
- the listener to remove.RenderListener
private void fireFeatureRenderedEvent(java.lang.Object feature)
private void fireErrorEvent(java.lang.Exception e)
public void stopRendering()
paint
or render
the rendering will be
forcefully stopped before termination
stopRendering
in interface org.geotools.renderer.GTRenderer
public void paint(java.awt.Graphics2D graphics, java.awt.Rectangle paintArea, java.awt.geom.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 org.geotools.renderer.GTRenderer
graphics
- 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(java.awt.Graphics2D graphics, java.awt.Rectangle paintArea, com.vividsolutions.jts.geom.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 org.geotools.renderer.GTRenderer
graphics
- 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(java.awt.Graphics2D graphics, java.awt.Rectangle paintArea, org.geotools.geometry.jts.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 org.geotools.renderer.GTRenderer
graphics
- 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(java.awt.Graphics2D graphics, java.awt.Rectangle paintArea, com.vividsolutions.jts.geom.Envelope mapArea, java.awt.geom.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 org.geotools.renderer.GTRenderer
graphics
- 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.private double computeScale(org.geotools.geometry.jts.ReferencedEnvelope envelope, java.awt.Rectangle paintArea, java.util.Map hints)
public void paint(java.awt.Graphics2D graphics, java.awt.Rectangle paintArea, org.geotools.geometry.jts.ReferencedEnvelope mapArea, java.awt.geom.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 org.geotools.renderer.GTRenderer
graphics
- 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.private com.vividsolutions.jts.geom.Envelope expandEnvelope(com.vividsolutions.jts.geom.Envelope envelope, java.awt.geom.AffineTransform worldToScreen, int buffer)
Envelope
in order to add the number of pixels
specified by buffer
in every direction.
envelope
- to extend.worldToScreen
- by means of which doing the extension.buffer
- to use for the extension.
Envelope
.java.util.Collection queryLayer(org.geotools.map.MapLayer currLayer, org.geotools.data.memory.CollectionSource source)
Source
instance to be rendered.
Note: This is proof-of-concept quality only! At
the moment the query is not filtered, that means all objects with all
fields are read from the datastore for every call to this method. This
method should work like
#queryLayer(MapLayer, FeatureSource, SimpleFeatureType, LiteFeatureTypeStyle[], Envelope, CoordinateReferenceSystem, CoordinateReferenceSystem, Rectangle, GeometryAttributeType)
and eventually replace it.
currLayer
- The actually processed layer for renderingsource
- Source to read data fromorg.geotools.feature.FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> queryLayer(org.geotools.map.MapLayer currLayer, org.geotools.data.FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> source, org.opengis.feature.simple.SimpleFeatureType schema, org.geotools.renderer.lite.LiteFeatureTypeStyle[] styles, com.vividsolutions.jts.geom.Envelope mapArea, org.opengis.referencing.crs.CoordinateReferenceSystem mapCRS, org.opengis.referencing.crs.CoordinateReferenceSystem featCrs, java.awt.Rectangle screenSize, org.opengis.feature.type.GeometryDescriptor geometryAttribute, java.awt.geom.AffineTransform worldToScreenTransform) throws org.geotools.filter.IllegalFilterException, java.io.IOException, org.geotools.feature.IllegalAttributeException
If optimizedDataLoadingEnabled
attribute has been set to
true
, the following optimization will be performed in
order to limit the number of features returned:
envelope
will be queriedQuery
has been set to limit the resulting
layer's features, the final filter to obtain them will respect it. This
means that the bounding box filter and the Query filter will be combined,
also including maxFeatures from Query
NOTE : This is an internal method and should only be called by
paint(Graphics2D, Rectangle, AffineTransform)
. It is
package protected just to allow unit testing it.
currLayer
- the actually processing layer for renderitionschema
- source
- envelope
- the spatial extent which is the target area of the rendering
processdestinationCrs
- DOCUMENT ME!sourceCrs
- screenSize
- geometryAttribute
-
currLayer
after
querying its feature source
org.geotools.filter.IllegalFilterException
- if something goes wrong constructing the bbox filter
java.io.IOException
org.geotools.feature.IllegalAttributeException
MapLayer.setQuery(org.geotools.data.Query)
private org.opengis.referencing.operation.MathTransform2D buildFullTransform(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem destCRS, java.awt.geom.AffineTransform worldToScreenTransform) throws org.opengis.referencing.FactoryException
org.opengis.referencing.FactoryException
private org.opengis.referencing.crs.CoordinateReferenceSystem getNativeCRS(org.opengis.feature.simple.SimpleFeatureType schema, java.util.List<java.lang.String> attNames)
schema
-
private void processRuleForQuery(org.geotools.renderer.lite.LiteFeatureTypeStyle[] styles, org.geotools.data.DefaultQuery q)
styles
- q
- private int getMaxFiltersToSendToDatastore()
private boolean isMemoryPreloadingEnabled()
private boolean isOptimizedFTSRenderingEnabled()
OPTIMIZE_FTS_RENDERING_KEY
description for a full explanation.
private int findRenderingBuffer(org.geotools.renderer.lite.LiteFeatureTypeStyle[] styles)
styles
- the feature type styles to be applied to the layer
private java.lang.String[] findStyleAttributes(org.geotools.renderer.lite.LiteFeatureTypeStyle[] styles, org.opengis.feature.simple.SimpleFeatureType schema)
MapLayer
's style and retrieves it's needed
attribute names, returning at least the default geometry attribute name.
layer
- the MapLayer
to determine the needed attributes
fromschema
- the layer
's FeatureSourcelayer
private org.opengis.filter.Filter createBBoxFilters(org.opengis.feature.simple.SimpleFeatureType schema, java.lang.String[] attributes, com.vividsolutions.jts.geom.Envelope bbox) throws org.geotools.filter.IllegalFilterException
MapLayer
's feature source to return
just the features for the target rendering extent
schema
- the layer's feature source schemaattributes
- set of needed attributesbbox
- the expression holding the target rendering bounding box
attributes
. If there are just one geometric
attribute, just returns its corresponding
GeometryFilter
.
org.geotools.filter.IllegalFilterException
- if something goes wrong creating the filterprivate boolean isWithInScale(org.geotools.styling.Rule r)
r
- The rule
private java.util.ArrayList createLiteFeatureTypeStyles(org.geotools.styling.FeatureTypeStyle[] featureStyles, java.lang.Object typeDescription, java.awt.Graphics2D graphics) throws java.io.IOException
Creates a list of LiteFeatureTypeStyle
s with:
Note: This method has a lot of duplication with
createLiteFeatureTypeStyles(FeatureTypeStyle[], SimpleFeatureType, Graphics2D)
.
featureStyles
- Styles to processtypeDescription
- The type description that has to be matched
java.io.IOException
private java.util.ArrayList createLiteFeatureTypeStyles(org.geotools.styling.FeatureTypeStyle[] featureStyles, org.opengis.feature.simple.SimpleFeatureType ftype, java.awt.Graphics2D graphics) throws java.io.IOException
featureStylers
- features
-
java.lang.Exception
java.io.IOException
private org.geotools.feature.FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> prepFeatureCollection(org.geotools.feature.FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> features, org.opengis.referencing.crs.CoordinateReferenceSystem sourceCrs)
What is really going on is the need to set up for reprojection; but *after* decimation has occured.
features
- sourceCrs
-
private final void processStylers(java.awt.Graphics2D graphics, org.geotools.map.MapLayer currLayer, java.awt.geom.AffineTransform at, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs, com.vividsolutions.jts.geom.Envelope mapArea, java.awt.Rectangle screenSize, java.lang.String layerId) throws org.geotools.filter.IllegalFilterException, java.io.IOException, org.geotools.feature.IllegalAttributeException
In most cases, this is the desired effect. For example, all line features may be rendered with a fat line and then a thin line. This produces a 'cased' effect without any strange overlaps.
This method is internal and should only be called by render.
graphics
- DOCUMENT ME!features
- An array of features to be renderedfeatureStylers
- An array of feature stylers to be appliedat
- DOCUMENT ME!destinationCrs
- -
The destination CRS, or null if no reprojection is requiredscreenSize
- layerId
-
java.io.IOException
org.geotools.feature.IllegalAttributeException
org.geotools.filter.IllegalFilterException
private void drawPlain(java.awt.Graphics2D graphics, org.geotools.map.MapLayer currLayer, java.awt.geom.AffineTransform at, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs, java.lang.String layerId, java.util.Collection collection, org.geotools.feature.FeatureCollection features, org.geotools.util.NumberRange scaleRange, java.util.ArrayList lfts)
private void drawOptimized(java.awt.Graphics2D graphics, org.geotools.map.MapLayer currLayer, java.awt.geom.AffineTransform at, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs, java.lang.String layerId, java.util.Collection collection, org.geotools.feature.FeatureCollection features, org.geotools.util.NumberRange scaleRange, java.util.ArrayList lfts)
private final void process(StreamingRenderer.RenderableFeature rf, org.geotools.renderer.lite.LiteFeatureTypeStyle style, org.geotools.util.NumberRange scaleRange, java.awt.geom.AffineTransform at, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs, java.lang.String layerId) throws org.opengis.referencing.operation.TransformException, org.opengis.referencing.FactoryException
rf
- feature
- style
- layerId
-
org.opengis.referencing.operation.TransformException
org.opengis.referencing.FactoryException
private final void processSymbolizers(java.awt.Graphics2D graphics, StreamingRenderer.RenderableFeature drawMe, org.geotools.styling.Symbolizer[] symbolizers, org.geotools.util.NumberRange scaleRange, java.awt.geom.AffineTransform at, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs, java.lang.String layerId) throws org.opengis.referencing.operation.TransformException, org.opengis.referencing.FactoryException
This is an internal method and should only be called by processStylers.
currLayer
- graphics
- drawMe
- The feature to be renderedsymbolizers
- An array of symbolizers which actually perform the rendering.scaleRange
- The scale range we are working on... provided in order to make
the style factory happyshape
- destinationCrs
- layerId
-
org.opengis.referencing.operation.TransformException
org.opengis.referencing.FactoryException
private void renderRaster(java.awt.Graphics2D graphics, java.lang.Object drawMe, org.geotools.styling.RasterSymbolizer symbolizer, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCRS, org.geotools.util.Range scaleRange)
graphics
- DOCUMENT ME!drawMe
- the feature that contains the GridCoverage. The grid coverage
must be contained in the "grid" attributesymbolizer
- The raster symbolizerscaleRange
- world2Grid
- private com.vividsolutions.jts.geom.Geometry findGeometry(java.lang.Object drawMe, org.geotools.styling.Symbolizer s)
drawMe
- The features
- /** Finds the geometric attribute requested by the symbolizerdrawMe
- The features
- The symbolizer
private org.opengis.referencing.crs.CoordinateReferenceSystem findGeometryCS(org.geotools.map.MapLayer currLayer, java.lang.Object drawMe, org.geotools.styling.Symbolizer s)
drawMe2
- f
- The features
- The symbolizer
private org.opengis.filter.expression.PropertyName getGeometryPropertyName(org.geotools.styling.Symbolizer s)
public boolean isInteractive()
public void setInteractive(boolean interactive)
interactive
- new value for the interactive propertyprivate boolean isOptimizedDataLoadingEnabled()
Returns true if the optimized data loading is enabled, false otherwise.
When optimized data loading is enabled, lite renderer will try to load only the needed feature attributes (according to styles) and to load only the features that are in (or overlaps with)the bounding box requested for painting
private int getRenderingBuffer()
Returns the rendering buffer, a measure in pixels used to expand the geometry search area enough to capture the geometries that do stay outside of the current rendering bounds but do affect them because of their large strokes (labels and graphic symbols are handled differently, see the label chache).
private java.lang.String getScaleComputationMethod()
Returns scale computation algorithm to be used.
private java.lang.String getTextRenderingMethod()
public double getGeneralizationDistance()
public void setGeneralizationDistance(double d)
Sets the generalizazion distance in the screen space.
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(java.awt.RenderingHints hints)
setJava2DHints
in interface org.geotools.renderer.GTRenderer
public java.awt.RenderingHints getJava2DHints()
getJava2DHints
in interface org.geotools.renderer.GTRenderer
public void setRendererHints(java.util.Map hints)
setRendererHints
in interface org.geotools.renderer.GTRenderer
public java.util.Map getRendererHints()
getRendererHints
in interface org.geotools.renderer.GTRenderer
public void setContext(org.geotools.map.MapContext context)
setContext
in interface org.geotools.renderer.GTRenderer
public org.geotools.map.MapContext getContext()
getContext
in interface org.geotools.renderer.GTRenderer
public boolean isCanTransform()
public static org.opengis.referencing.operation.MathTransform getMathTransform(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem destCRS)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |