Class Scale

  • All Implemented Interfaces:
    java.lang.Comparable<Scale>

    public final class Scale
    extends java.lang.Object
    implements java.lang.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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Scale scale)  
      boolean equals​(java.lang.Object o)  
      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 getDenominator()  
      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 getResolution()
      Get the resolution in meters.
      double getResolutionInInches()
      Get the resolution in inches.
      DistanceUnit getUnit()
      Get the scale unit.
      int hashCode()  
      Scale toResolution​(double newResolution)
      Construct a scale object from a resolution.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • 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 Detail

      • 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 java.lang.Comparable<Scale>
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object