org.geotools.renderer.lite
Class RendererUtilities

java.lang.Object
  extended byorg.geotools.renderer.lite.RendererUtilities

public class RendererUtilities
extends java.lang.Object

Class for holding utility functions that are common tasks for people using the "StreamingRenderer/Renderer".

Author:
dblasby

Constructor Summary
RendererUtilities()
           
 
Method Summary
static double calculateScale(com.vividsolutions.jts.geom.Envelope envelope, org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem, int imageWidth, int imageHeight, double DPI)
          Find the scale denominator of the map.
static com.vividsolutions.jts.geom.Envelope createMapEnvelope(java.awt.Rectangle paintArea, java.awt.geom.AffineTransform worldToScreen)
          Creates the map's bounding box in real world coordinates

((Taken from the old LiteRenderer))

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

((Taken from the old LiteRenderer))

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RendererUtilities

public RendererUtilities()
Method Detail

worldToScreenTransform

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

((Taken from the old LiteRenderer))

Parameters:
mapExtent - the map extent
paintArea - the size of the rendering output area
Returns:
a transform that maps from real world coordinates to the screen

createMapEnvelope

public static com.vividsolutions.jts.geom.Envelope createMapEnvelope(java.awt.Rectangle paintArea,
                                                                     java.awt.geom.AffineTransform worldToScreen)
                                                              throws java.awt.geom.NoninvertibleTransformException
Creates the map's bounding box in real world coordinates

((Taken from the old LiteRenderer))

Parameters:
worldToScreen - a transform which converts World coordinates to screen pixel coordinates.
paintArea - the size of the rendering output area
Throws:
java.awt.geom.NoninvertibleTransformException

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
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


Copyright © GeoTools. All Rights Reserved.