Class Scale

java.lang.Object
org.mapfish.print.map.Scale
All Implemented Interfaces:
Comparable<Scale>

public final class Scale extends Object implements Comparable<Scale>
Represent a scale and provide transformation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Scale(double denominator, org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi)
    Constructor.
    Scale(double denominator, DistanceUnit unit, double dpi)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    boolean
     
    static Scale
    fromResolution(double resolution, org.geotools.api.referencing.crs.CoordinateReferenceSystem projection)
    Construct a scale object from a resolution.
    static Scale
    fromResolution(double resolution, DistanceUnit projectionUnit)
    Construct a scale object from a resolution.
    double
     
    static double
    getDenominator(boolean geodetic, double scaleDenominator, org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi, org.locationtech.jts.geom.Coordinate position)
     
    double
    getDenominator(boolean geodetic, org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi, org.locationtech.jts.geom.Coordinate position)
     
    double
    getDenominator(double dpi)
     
    static double
    getGeodeticDenominator(double scaleDenominator, org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi, org.locationtech.jts.geom.Coordinate position)
     
    double
    getGeodeticDenominator(org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi, org.locationtech.jts.geom.Coordinate position)
     
    double
    Get the resolution in meters.
    double
    Get the resolution in inches.
    Get the scale unit.
    int
     
    toResolution(double newResolution)
    Construct a scale object from a resolution.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Scale

      public Scale(double denominator, @Nonnull org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi)
      Constructor.
      Parameters:
      denominator - the scale denominator. a value of 1'000 would be a scale of 1:1'000.
      projection - the projection.
      dpi - the DPI on witch the scale is valid.
    • Scale

      public Scale(double denominator, @Nonnull DistanceUnit unit, double dpi)
      Constructor.
      Parameters:
      denominator - the scale denominator. a value of 1'000 would be a scale of 1:1'000.
      unit - the unit used by the projection.
      dpi - the DPI on witch the scale is valid.
  • Method Details

    • getDenominator

      public static double getDenominator(boolean geodetic, double scaleDenominator, @Nonnull org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi, org.locationtech.jts.geom.Coordinate position)
      Parameters:
      geodetic - Do in geodetic.
      scaleDenominator - the scale denominator.
      projection - the projection to perform the calculation in.
      dpi - the dpi of the display device.
      position - the position on the map.
      Returns:
      the scale denominator.
    • getGeodeticDenominator

      public static double getGeodeticDenominator(double scaleDenominator, @Nonnull org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi, org.locationtech.jts.geom.Coordinate position)
      Parameters:
      scaleDenominator - the scale denominator.
      projection - the projection to perform the calculation in.
      dpi - the dpi of the display device.
      position - the position on the map.
      Returns:
      the scale denominator.
    • fromResolution

      public static Scale fromResolution(double resolution, @Nonnull DistanceUnit projectionUnit)
      Construct a scale object from a resolution.
      Parameters:
      resolution - the resolution of the map
      projectionUnit - the unit used by the projection.
    • fromResolution

      public static Scale fromResolution(double resolution, @Nonnull org.geotools.api.referencing.crs.CoordinateReferenceSystem projection)
      Construct a scale object from a resolution.
      Parameters:
      resolution - the resolution of the map
      projection - the projection to perform the calculation in.
    • getResolution

      public double getResolution()
      Get the resolution in meters.
      Returns:
      the resolution
    • getResolutionInInches

      public double getResolutionInInches()
      Get the resolution in inches.
      Returns:
      the resolution
    • getUnit

      public DistanceUnit getUnit()
      Get the scale unit.
      Returns:
      the unit
    • getDenominator

      public double getDenominator(boolean geodetic, @Nonnull org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi, org.locationtech.jts.geom.Coordinate position)
      Parameters:
      geodetic - geodetic mode.
      projection - the projection to perform the calculation in.
      dpi - the dpi of the display device.
      position - the position on the map.
      Returns:
      the scale denominator
    • getDenominator

      public double getDenominator(double dpi)
      Parameters:
      dpi - the dpi of the display device.
      Returns:
      the scale denominator
    • getDenominator

      public double getDenominator()
      Returns:
      the scale denominator in the PDF resolution
    • getGeodeticDenominator

      public double getGeodeticDenominator(@Nonnull org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi, org.locationtech.jts.geom.Coordinate position)
      Parameters:
      projection - the projection to perform the calculation in.
      dpi - the dpi of the display device.
      position - the position on the map.
      Returns:
      the scale denominator
    • toResolution

      public Scale toResolution(double newResolution)
      Construct a scale object from a resolution.
      Parameters:
      newResolution - the resolution of the map
    • compareTo

      public int compareTo(Scale scale)
      Specified by:
      compareTo in interface Comparable<Scale>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object