|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.renderer.lite.RendererUtilities
public final class RendererUtilities
Class for holding utility functions that are common tasks for people using the "StreamingRenderer/Renderer".
Method Summary | |
---|---|
static double |
calculateOGCScale(ReferencedEnvelope envelope,
int imageWidth,
java.util.Map hints)
This method performs the computation using the methods suggested by the OGC SLD specification, page 26. |
static double |
calculateOGCScaleAffine(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
java.awt.geom.AffineTransform worldToScreen,
java.util.Map hints)
This method performs the computation using the methods suggested by the OGC SLD specification, page 26. |
static double |
calculatePixelsPerMeterRatio(double scaleDenominator,
java.util.Map hints)
Calculates the pixels per meter ratio based on a scale denominator. |
static double |
calculateScale(com.vividsolutions.jts.geom.Envelope envelope,
org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem,
int imageWidth,
int imageHeight,
double DPI)
Deprecated. |
static double |
calculateScale(ReferencedEnvelope envelope,
int imageWidth,
int imageHeight,
double DPI)
Find the scale denominator of the map. |
static double |
calculateScale(ReferencedEnvelope envelope,
int imageWidth,
int imageHeight,
java.util.Map hints)
First searches the hints for the scale denominator hint otherwise calls calculateScale(Envelope, CoordinateReferenceSystem, int, int, double) . |
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. |
static ReferencedEnvelope |
createMapEnvelope(java.awt.Rectangle paintArea,
java.awt.geom.AffineTransform worldToScreen,
org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Creates the map's bounding box in real world coordinates NOTE It is worth to note that here we do not take into account the half a pixel translation stated by ogc for coverages bounds. |
static com.vividsolutions.jts.geom.Geometry |
getCentroid(com.vividsolutions.jts.geom.Geometry g)
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 |
static double |
getDpi(java.util.Map hints)
Either gets a DPI from the hints, or return the OGC standard, stating that a pixel is 0.28 mm (the result is a non integer DPI...) |
static java.awt.geom.AffineTransform |
worldToScreenTransform(com.vividsolutions.jts.geom.Envelope mapExtent,
java.awt.Rectangle paintArea)
Deprecated. Uses the alternative based on ReferencedEnvelope
that doe not assume anything on axes order. |
static java.awt.geom.AffineTransform |
worldToScreenTransform(com.vividsolutions.jts.geom.Envelope mapExtent,
java.awt.Rectangle paintArea,
org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs)
This worldToScreenTransform method makes the assumption that the crs is in Lon,Lat or Lat,Lon. |
static java.awt.geom.AffineTransform |
worldToScreenTransform(ReferencedEnvelope mapExtent,
java.awt.Rectangle paintArea)
Sets up the affine transform NOTE It is worth to note that here we do not take into account the half a pixel translation stated by ogc for coverages bounds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.awt.geom.AffineTransform worldToScreenTransform(com.vividsolutions.jts.geom.Envelope mapExtent, java.awt.Rectangle paintArea)
ReferencedEnvelope
that doe not assume anything on axes order.
mapExtent
- the map extentpaintArea
- the size of the rendering output area
public static java.awt.geom.AffineTransform worldToScreenTransform(ReferencedEnvelope mapExtent, java.awt.Rectangle paintArea)
mapExtent
- the map extentpaintArea
- the size of the rendering output area
public static com.vividsolutions.jts.geom.Envelope createMapEnvelope(java.awt.Rectangle paintArea, java.awt.geom.AffineTransform worldToScreen) throws java.awt.geom.NoninvertibleTransformException
worldToScreen
- a transform which converts World coordinates to screen pixel coordinates. No
assumptions are done on axis order as this is assumed to be pre-calculated. The
affine transform may specify an rotation, in case the envelope will encompass the
complete (rotated) world polygon.paintArea
- the size of the rendering output area
java.awt.geom.NoninvertibleTransformException
public static ReferencedEnvelope createMapEnvelope(java.awt.Rectangle paintArea, java.awt.geom.AffineTransform worldToScreen, org.opengis.referencing.crs.CoordinateReferenceSystem crs) throws java.awt.geom.NoninvertibleTransformException
worldToScreen
- a transform which converts World coordinates to screen pixel coordinates.paintArea
- the size of the rendering output area
java.awt.geom.NoninvertibleTransformException
public static double calculateScale(com.vividsolutions.jts.geom.Envelope envelope, org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem, int imageWidth, int imageHeight, double DPI) throws org.opengis.referencing.operation.TransformException, org.opengis.referencing.FactoryException
envelope
- coordinateReferenceSystem
- imageWidth
- imageHeight
- DPI
- screen dots per inch (OGC standard is 90)
org.opengis.referencing.operation.TransformException
org.opengis.referencing.FactoryException
public static double calculatePixelsPerMeterRatio(double scaleDenominator, java.util.Map hints)
scaleDenominator
- The scale denominator value.hints
- The hints used in calculation. if "dpi" key is present, it
uses it's Integer value as the dpi of the current device. if
not it uses 90 that is the OGC default value.
public static double calculateOGCScale(ReferencedEnvelope envelope, int imageWidth, java.util.Map hints)
envelope
- imageWidth
-
public static double calculateOGCScaleAffine(org.opengis.referencing.crs.CoordinateReferenceSystem crs, java.awt.geom.AffineTransform worldToScreen, java.util.Map hints)
CRS
- the coordinate reference system. Used to check if we are operating in degrees or
meters.worldToScreen
- the transformation mapping world coordinates to screen coordinates. Might
specify a rotation in addition to translation and scaling.
public static double calculateScale(ReferencedEnvelope envelope, int imageWidth, int imageHeight, java.util.Map hints) throws org.opengis.referencing.operation.TransformException, org.opengis.referencing.FactoryException
calculateScale(Envelope, CoordinateReferenceSystem, int, int, double)
. If
the hints contains a DPI then that DPI is used otherwise 90 is used (the OGS default).
org.opengis.referencing.operation.TransformException
org.opengis.referencing.FactoryException
public static double getDpi(java.util.Map hints)
hints
-
public static double calculateScale(ReferencedEnvelope envelope, int imageWidth, int imageHeight, double DPI) throws org.opengis.referencing.operation.TransformException, org.opengis.referencing.FactoryException
envelope
- imageWidth
- imageHeight
- DPI
- screen dots per inch (OGC standard is 90)
TODO should I take into account also the destination CRS? Otherwise I am
just assuming that the final crs is lon,lat that is it maps lon to x (n
raster space) and lat to y (in raster space).
org.opengis.referencing.operation.TransformException
org.opengis.referencing.FactoryException
public static java.awt.geom.AffineTransform worldToScreenTransform(com.vividsolutions.jts.geom.Envelope mapExtent, java.awt.Rectangle paintArea, org.opengis.referencing.crs.CoordinateReferenceSystem destinationCrs) throws org.opengis.referencing.operation.TransformException
mapExtent
- The envelope of the map in lon,latpaintArea
- The area to paint as a rectangledestinationCrs
-
org.opengis.referencing.operation.TransformException
public static com.vividsolutions.jts.geom.Geometry getCentroid(com.vividsolutions.jts.geom.Geometry g)
g
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |