org.geotools.renderer.lite
Class LiteRenderer2

java.lang.Object
  extended byorg.geotools.renderer.lite.LiteRenderer2
All Implemented Interfaces:
Renderer, Renderer2D

Deprecated. LiteRenderer has been replaced by StreamingRenderer.

public class LiteRenderer2
extends java.lang.Object
implements Renderer, Renderer2D

A lite implementation of the Renderer and Renderer2D interfaces. Lite means that:

Use this class if you need a stateless renderer that provides low memory footprint and decent rendering performance on the first call but don't need good optimal performance on subsequent calls on the same data. Notice: for the time being, this class doesn't support GridCoverage stylers, that will be rendered using the non geophisics version of the GridCoverage, if available, with the geophisics one, otherwise.

Version:
$Id: LiteRenderer2.java 18021 2006-02-14 20:36:18Z jdeolive $
Author:
James Macgill, Andrea Aime

Field Summary
static org.geotools.renderer.lite.LiteRenderer2.DefaultRenderListener DEFAULT_LISTENER
          Deprecated. This listener is added to the list of listeners automatically.
 
Constructor Summary
LiteRenderer2()
          Deprecated. Creates a new instance of LiteRenderer without a context.
LiteRenderer2(MapContext context)
          Deprecated. Creates a new instance of Java2DRenderer.
 
Method Summary
 void addRenderListener(RenderListener listener)
          Deprecated. adds a listener that responds to error events of feature rendered events.
static double calculateScale(com.vividsolutions.jts.geom.Envelope envelope, org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem, int imageWidth, int imageHeight, double DPI)
          Deprecated. Find the scale denominator of the map.
 com.vividsolutions.jts.geom.Geometry getCentroid(com.vividsolutions.jts.geom.Geometry g)
          Deprecated. Finds the centroid of the input geometry if input = point, line, polygon --> return a point that represents the centroid of that geom if input = geometry collection --> return a multipoint that represents the centoid of each sub-geom
 boolean getConcatTransforms()
          Deprecated. Flag which controls behaviour for applying affine transformation to the graphics object.
 double getGeneralizationDistance()
          Deprecated. Returns the generalization distance in the screen space.
static long getImageLoadingTimeout()
          Deprecated. Returns the amount of time the renderer waits for loading an external image before giving up and examining the other images in the Graphic object
 boolean isInteractive()
          Deprecated. Getter for property interactive.
 boolean isOptimizedDataLoadingEnabled()
          Deprecated.  Returns true if the optimized data loading is enabled, false otherwise.
 void paint(java.awt.Graphics2D graphics, java.awt.Rectangle paintArea, java.awt.geom.AffineTransform transform)
          Deprecated. Render features based on the LayerList, BoundBox and Style specified in this.context.
 void paint(java.awt.Graphics2D graphics, java.awt.Rectangle paintArea, com.vividsolutions.jts.geom.Envelope envelope)
          Deprecated. TODO summary sentence for paint ...
 com.vividsolutions.jts.geom.Coordinate pixelToWorld(int x, int y, com.vividsolutions.jts.geom.Envelope map)
          Deprecated. Converts a coordinate expressed on the device space back to real world coordinates
 void removeRenderListener(RenderListener listener)
          Deprecated. Removes a render listener.
 void render(FeatureCollection features, com.vividsolutions.jts.geom.Envelope map, Style s)
          Deprecated. Performs the actual rendering process to the graphics context set in setOutput.
 void setConcatTransforms(boolean flag)
          Deprecated. Sets the flag which controls behaviour for applying affine transformation to the graphics object.
 void setGeneralizationDistance(double d)
          Deprecated.  Sets the generalizazion distance in the screen space.
static void setImageLoadingTimeout(long newTimeout)
          Deprecated. Sets the maximum time to wait for getting an external image.
 void setInteractive(boolean interactive)
          Deprecated. Sets the interactive status of the renderer.
 void setMemoryPreloadingEnabled(boolean enabled)
          Deprecated.  
 void setOptimizedDataLoadingEnabled(boolean b)
          Deprecated. Enables/disable optimized data loading
 void setOutput(java.awt.Graphics g, java.awt.Rectangle bounds)
          Deprecated. Graphics and bounds is to be set in renderer().
 void setRenderingHint(java.awt.RenderingHints.Key key, java.lang.Object value)
          Deprecated.  
 void setRenderingHints(java.awt.RenderingHints hints)
          Deprecated.  
protected  void setScaleDenominator(double scaleDenominator)
          Deprecated. Setter for property scaleDenominator.
 void stopRendering()
          Deprecated. If you call this method from another thread than the one that called paint or render the rendering will be forcefully stopped before termination
 java.awt.geom.AffineTransform worldToScreenTransform(com.vividsolutions.jts.geom.Envelope mapExtent, java.awt.Rectangle screenSize)
          Deprecated. Sets up the affine transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LISTENER

public static final org.geotools.renderer.lite.LiteRenderer2.DefaultRenderListener DEFAULT_LISTENER
Deprecated. 
This listener is added to the list of listeners automatically. It should be removed if the default logging is not needed.

Constructor Detail

LiteRenderer2

public LiteRenderer2()
Deprecated. 
Creates a new instance of LiteRenderer without a context. Use it only to gain access to utility methods of this class or if you want to render random feature collections instead of using the map context interface


LiteRenderer2

public LiteRenderer2(MapContext context)
Deprecated. 
Creates a new instance of Java2DRenderer.

Parameters:
context - Contains pointers to layers, bounding box, and style required for rendering.
Method Detail

setConcatTransforms

public void setConcatTransforms(boolean flag)
Deprecated. 
Sets the flag which controls behaviour for applying affine transformation to the graphics object.

Parameters:
flag - If true then the transform will be concatenated to the existing transform. If false it will be replaced.

getImageLoadingTimeout

public static long getImageLoadingTimeout()
Deprecated. 
Returns the amount of time the renderer waits for loading an external image before giving up and examining the other images in the Graphic object

Returns:
the timeout in milliseconds

setImageLoadingTimeout

public static void setImageLoadingTimeout(long newTimeout)
Deprecated. 
Sets the maximum time to wait for getting an external image. Set it to -1 to wait undefinitely. The default value is 10 seconds

Parameters:
newTimeout - the new timeout value in milliseconds

getConcatTransforms

public boolean getConcatTransforms()
Deprecated. 
Flag which controls behaviour for applying affine transformation to the graphics object.

Returns:
a boolean flag. If true then the transform will be concatenated to the existing transform. If false it will be replaced.

setOutput

public void setOutput(java.awt.Graphics g,
                      java.awt.Rectangle bounds)
Deprecated. Graphics and bounds is to be set in renderer().

Called before render, this sets where any output will be sent.

Specified by:
setOutput in interface Renderer
Parameters:
g - A graphics object for future rendering to be sent to. Note: must be an instance of lite renderer.
bounds - The size of the output area, required so that scale can be calculated.

addRenderListener

public void addRenderListener(RenderListener listener)
Deprecated. 
adds a listener that responds to error events of feature rendered events.

Parameters:
listener - the listener to add.
See Also:
RenderListener

removeRenderListener

public void removeRenderListener(RenderListener listener)
Deprecated. 
Removes a render listener.

Parameters:
listener - the listener to remove.
See Also:
RenderListener

setScaleDenominator

protected void setScaleDenominator(double scaleDenominator)
Deprecated. 
Setter for property scaleDenominator.

Parameters:
scaleDenominator - New value of property scaleDenominator.

stopRendering

public void stopRendering()
Deprecated. 
If you call this method from another thread than the one that called paint or render the rendering will be forcefully stopped before termination


paint

public void paint(java.awt.Graphics2D graphics,
                  java.awt.Rectangle paintArea,
                  java.awt.geom.AffineTransform transform)
Deprecated. 
Render features based on the LayerList, BoundBox and Style specified in this.context. Don't mix calls to paint and setOutput, when calling this method the graphics set in the setOutput method is discarded.

Specified by:
paint in interface Renderer2D
Parameters:
graphics - The graphics object to draw to.
paintArea - The size of the output area in output units (eg: pixels).
transform - A transform which converts World coordinates to Screen coordinates.
Task:
Need to check if the Layer CoordinateSystem is different to the BoundingBox rendering CoordinateSystem and if so, then transform the coordinates.

paint

public void paint(java.awt.Graphics2D graphics,
                  java.awt.Rectangle paintArea,
                  com.vividsolutions.jts.geom.Envelope envelope)
Deprecated. 
TODO summary sentence for paint ...

Parameters:
graphics -
paintArea -
envelope -

calculateScale

public static double calculateScale(com.vividsolutions.jts.geom.Envelope envelope,
                                    org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem,
                                    int imageWidth,
                                    int imageHeight,
                                    double DPI)
                             throws java.lang.Exception
Deprecated. 
Find the scale denominator of the map. Method: 1. find the diagonal distance (meters) 2. find the diagonal distance (pixels) 3. find the diagonal distance (meters) -- use DPI 4. calculate scale (#1/#2) NOTE: return the scale denominator not the actual scale (1/scale = denominator) TODO: (SLD spec page 28): Since it is common to integrate the output of multiple servers into a single displayed result in the web-mapping environment, it is important that different map servers have consistent behaviour with respect to processing scales, so that all of the independent servers will select or deselect rules at the same scales. To insure consistent behaviour, scales relative to coordinate spaces must be handled consistently between map servers. For geographic coordinate systems, which use angular units, the angular coverage of a map should be converted to linear units for computation of scale by using the circumference of the Earth at the equator and by assuming perfectly square linear units. For linear coordinate systems, the size of the coordinate space should be used directly without compensating for distortions in it with respect to the shape of the real Earth. NOTE: we are actually doing a a much more exact calculation, and accounting for non-square pixels (which are allowed in WMS)

Parameters:
envelope -
coordinateReferenceSystem -
imageWidth -
imageHeight -
DPI - screen dots per inch (OGC standard is 90)
Returns:
Throws:
java.lang.Exception

render

public void render(FeatureCollection features,
                   com.vividsolutions.jts.geom.Envelope map,
                   Style s)
Deprecated. 
Performs the actual rendering process to the graphics context set in setOutput.

The style parameter controls the appearance features. Rules within the style object may cause some features to be rendered multiple times or not at all.

Specified by:
render in interface Renderer
Parameters:
features - the feature collection to be rendered
map - Controls the full extent of the input space. Used in the calculation of scale.
s - A style object. Contains a set of FeatureTypeStylers that are to be applied in order to control the rendering process.

worldToScreenTransform

public java.awt.geom.AffineTransform worldToScreenTransform(com.vividsolutions.jts.geom.Envelope mapExtent,
                                                            java.awt.Rectangle screenSize)
Deprecated. 
Sets up the affine transform

Parameters:
mapExtent - the map extent
screenSize - the screen size
Returns:
a transform that maps from real world coordinates to the screen

pixelToWorld

public com.vividsolutions.jts.geom.Coordinate pixelToWorld(int x,
                                                           int y,
                                                           com.vividsolutions.jts.geom.Envelope map)
Deprecated. 
Converts a coordinate expressed on the device space back to real world coordinates

Specified by:
pixelToWorld in interface Renderer
Parameters:
x - horizontal coordinate on device space
y - vertical coordinate on device space
map - The map extent
Returns:
The correspondent real world coordinate

getCentroid

public com.vividsolutions.jts.geom.Geometry getCentroid(com.vividsolutions.jts.geom.Geometry g)
Deprecated. 
Finds the centroid of the input geometry if input = point, line, polygon --> return a point that represents the centroid of that geom if input = geometry collection --> return a multipoint that represents the centoid of each sub-geom

Parameters:
g -
Returns:

isInteractive

public boolean isInteractive()
Deprecated. 
Getter for property interactive.

Specified by:
isInteractive in interface Renderer
Returns:
Value of property interactive.

setInteractive

public void setInteractive(boolean interactive)
Deprecated. 
Sets the interactive status of the renderer. An interactive renderer won't wait for long image loading, preferring an alternative mark instead

Specified by:
setInteractive in interface Renderer
Parameters:
interactive - new value for the interactive property

isOptimizedDataLoadingEnabled

public boolean isOptimizedDataLoadingEnabled()
Deprecated. 

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

Returns:

setOptimizedDataLoadingEnabled

public void setOptimizedDataLoadingEnabled(boolean b)
Deprecated. 
Enables/disable optimized data loading

Parameters:
b -

getGeneralizationDistance

public double getGeneralizationDistance()
Deprecated. 
Returns the generalization distance in the screen space.

Returns:

setGeneralizationDistance

public void setGeneralizationDistance(double d)
Deprecated. 

Sets the generalizazion distance in the screen space.

Default value is 1, 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

Parameters:
d -

setMemoryPreloadingEnabled

public void setMemoryPreloadingEnabled(boolean enabled)
Deprecated. 
Parameters:
enabled -

setRenderingHints

public void setRenderingHints(java.awt.RenderingHints hints)
Deprecated. 

setRenderingHint

public void setRenderingHint(java.awt.RenderingHints.Key key,
                             java.lang.Object value)
Deprecated. 


Copyright © GeoTools. All Rights Reserved.