Class GeometryRenderer

java.lang.Object
nz.org.riskscape.engine.geo.GeometryRenderer

public class GeometryRenderer extends Object

Tweaks the display of some GeoTools geometry so that it's more user-friendly.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    getAxisDirection(org.geotools.api.referencing.crs.CoordinateReferenceSystem crs, int dimension)
    Displays the AxisDirection for the given axis (i.e.
    static String
    getAxisOrder(org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
    Returns the axis-order of the given CRS in a user-friendly string.
    static String
    getBounds(org.geotools.geometry.jts.ReferencedEnvelope env)
    Displays the bounds of an envelope.
    static String
    getBoundsInCrs(org.geotools.geometry.jts.ReferencedEnvelope envelope, org.geotools.api.referencing.crs.CoordinateReferenceSystem targetCrs)
    Displays the bounds in the given targetCrs.
    static String
    getCode(org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)
    Returns the code we use to refer to the CRS, i.e.
    static boolean
    isCrsEquivalent(org.geotools.api.referencing.crs.CoordinateReferenceSystem a, org.geotools.api.referencing.crs.CoordinateReferenceSystem b)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GeometryRenderer

      public GeometryRenderer()
  • Method Details

    • getAxisOrder

      public static String getAxisOrder(org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)

      Returns the axis-order of the given CRS in a user-friendly string.

    • getCode

      public static String getCode(org.geotools.api.referencing.crs.CoordinateReferenceSystem crs)

      Returns the code we use to refer to the CRS, i.e. what we pass to CRS.decode(String). This can often be different to what crs.getName() returns, e.g. "EPSG:4326" rather than "EPSG:WGS 84".

    • getAxisDirection

      public static String getAxisDirection(org.geotools.api.referencing.crs.CoordinateReferenceSystem crs, int dimension)

      Displays the AxisDirection for the given axis (i.e. dimension=0 for x-axis, 1 for y). Typically this will display "North" and "East", but there are a wide range of axis directions.

    • getBounds

      public static String getBounds(org.geotools.geometry.jts.ReferencedEnvelope env)

      Displays the bounds of an envelope. The important difference this has over the vanilla GeoTools toString() is that we display the x,y direction that the coordinates are in (i.e. x=North), along with the EPSG code of the CRS.

    • getBoundsInCrs

      public static String getBoundsInCrs(org.geotools.geometry.jts.ReferencedEnvelope envelope, org.geotools.api.referencing.crs.CoordinateReferenceSystem targetCrs)

      Displays the bounds in the given targetCrs. This can be handy when you have geometry in a different CRS, but want to display it in a CRS that the user is familiar with (e.g. WGS84).

    • isCrsEquivalent

      public static boolean isCrsEquivalent(org.geotools.api.referencing.crs.CoordinateReferenceSystem a, org.geotools.api.referencing.crs.CoordinateReferenceSystem b)
      Returns:
      true if the 2 CRSs are roughly equivalent (at least for display purposes). The 2 CRSs may still have differences, like axis orientation for example. The point is to avoid displaying fundamentally the same coordinates twice.