|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectRendererUtilities
public final class RendererUtilities
Class for holding utility functions that are common tasks for people using the "StreamingRenderer/Renderer".
modules/library/render (gt-render.jar)
Method Summary | |
---|---|
static double |
calculateOGCScale(ReferencedEnvelope envelope,
int imageWidth,
Map hints)
This method performs the computation using the methods suggested by the OGC SLD specification, page 26. |
static double |
calculateOGCScaleAffine(CoordinateReferenceSystem crs,
AffineTransform worldToScreen,
Map hints)
This method performs the computation using the methods suggested by the OGC SLD specification, page 26. |
static double |
calculateScale(Envelope envelope,
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,
Map hints)
First searches the hints for the scale denominator hint otherwise calls calculateScale(Envelope, CoordinateReferenceSystem, int, int, double) . |
static Envelope |
createMapEnvelope(Rectangle paintArea,
AffineTransform worldToScreen)
Creates the map's bounding box in real world coordinates. |
static ReferencedEnvelope |
createMapEnvelope(Rectangle paintArea,
AffineTransform worldToScreen,
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 Geometry |
getCentroid(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 AffineTransform |
worldToScreenTransform(Envelope mapExtent,
Rectangle paintArea)
Deprecated. Uses the alternative based on ReferencedEnvelope
that doe not assume anything on axes order. |
static AffineTransform |
worldToScreenTransform(Envelope mapExtent,
Rectangle paintArea,
CoordinateReferenceSystem destinationCrs)
This worldToScreenTransform method makes the assumption that the crs is in Lon,Lat or Lat,Lon. |
static AffineTransform |
worldToScreenTransform(ReferencedEnvelope mapExtent,
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 Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static AffineTransform worldToScreenTransform(Envelope mapExtent, Rectangle paintArea)
ReferencedEnvelope
that doe not assume anything on axes order.
mapExtent
- the map extentpaintArea
- the size of the rendering output area
public static AffineTransform worldToScreenTransform(ReferencedEnvelope mapExtent, Rectangle paintArea)
mapExtent
- the map extentpaintArea
- the size of the rendering output area
public static Envelope createMapEnvelope(Rectangle paintArea, AffineTransform worldToScreen) throws 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
NoninvertibleTransformException
public static ReferencedEnvelope createMapEnvelope(Rectangle paintArea, AffineTransform worldToScreen, CoordinateReferenceSystem crs) throws NoninvertibleTransformException
worldToScreen
- a transform which converts World coordinates to screen pixel coordinates.paintArea
- the size of the rendering output area
NoninvertibleTransformException
public static double calculateScale(Envelope envelope, CoordinateReferenceSystem coordinateReferenceSystem, int imageWidth, int imageHeight, double DPI) throws TransformException, FactoryException
envelope
- coordinateReferenceSystem
- imageWidth
- imageHeight
- DPI
- screen dots per inch (OGC standard is 90)
TransformException
FactoryException
public static double calculateOGCScale(ReferencedEnvelope envelope, int imageWidth, Map hints)
envelope
- imageWidth
-
public static double calculateOGCScaleAffine(CoordinateReferenceSystem crs, AffineTransform worldToScreen, 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, Map hints) throws TransformException, 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).
TransformException
FactoryException
public static double calculateScale(ReferencedEnvelope envelope, int imageWidth, int imageHeight, double DPI) throws TransformException, 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).
TransformException
FactoryException
public static AffineTransform worldToScreenTransform(Envelope mapExtent, Rectangle paintArea, CoordinateReferenceSystem destinationCrs) throws TransformException
mapExtent
- The envelope of the map in lon,latpaintArea
- The area to paint as a rectangledestinationCrs
-
TransformException
public static Geometry getCentroid(Geometry g)
g
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |