Package org.mapfish.print.map
Class Scale
java.lang.Object
org.mapfish.print.map.Scale
- All Implemented Interfaces:
Comparable<Scale>
Represent a scale and provide transformation.
-
Constructor Summary
ConstructorsConstructorDescriptionScale
(double denominator, org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double dpi) Constructor.Scale
(double denominator, DistanceUnit unit, double dpi) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
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.getUnit()
Get the scale unit.int
hashCode()
toResolution
(double newResolution) Construct a scale object from a resolution.toString()
-
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
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
Construct a scale object from a resolution.- Parameters:
resolution
- the resolution of the mapprojectionUnit
- 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 mapprojection
- 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
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
Construct a scale object from a resolution.- Parameters:
newResolution
- the resolution of the map
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Scale>
-
equals
-
hashCode
public int hashCode() -
toString
-