Class Projection

java.lang.Object
com.massifmaps.projections.Projection
Direct Known Subclasses:
EPSG3857, EPSG4326

public class Projection extends Object
An abstract base class for all projections.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this object is equal to the specified object.
    fromLatLong(double lat, double lng)
    Transforms a position given using latitutde-longitude coordinates from the WGS84 coordinate system to the coordinate system of this projection.
    Transforms a position from the WGS84 coordinate system to the coordinate system of this projection.
    Returns the bounds of this projection.
    Return name of this projection in Well-Known format.
    int
    Returns the hash value of this object.
    toLatLong(double x, double y)
    Transforms a position from the coordinate system of this projection to the WGS84 coordinate system latitude-longitute coordinates.
    Transforms a position from the coordinate system of this projection to the WGS84 coordinate system.

    Methods inherited from class java.lang.Object

    clone, getClass, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • equals

      public boolean equals(Object obj)
      Checks if this object is equal to the specified object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The reference object.
      Returns:
      True when objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash value of this object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash value of this object.
    • getBounds

      public MapBounds getBounds()
      Returns the bounds of this projection.
      Returns:
      The bounds of this projection.
    • fromWgs84

      public MapPos fromWgs84(MapPos pos)
      Transforms a position from the WGS84 coordinate system to the coordinate system of this projection.
      Parameters:
      pos - The position in the WGS84 coordinate system. It should be encoded as longitude-latitude.
      Returns:
      The transformed position in the coordinate system of this projection.
    • toWgs84

      public MapPos toWgs84(MapPos pos)
      Transforms a position from the coordinate system of this projection to the WGS84 coordinate system.
      Parameters:
      pos - The position in the coordinate system of this projection.
      Returns:
      The transformed position in the WGS84 coordinate system. It is given as longitude-latitude.
    • fromLatLong

      public MapPos fromLatLong(double lat, double lng)
      Transforms a position given using latitutde-longitude coordinates from the WGS84 coordinate system to the coordinate system of this projection.
      Parameters:
      lat - The latitude in the WGS84 coordinate system. It should be in range -90..90.
      lng - The longitude in the WGS84 coordinate system. It should be in range -180..180.
      Returns:
      The transformed position in the coordinate system of this projection.
    • toLatLong

      public MapPos toLatLong(double x, double y)
      Transforms a position from the coordinate system of this projection to the WGS84 coordinate system latitude-longitute coordinates.
      Parameters:
      x - The x position in the coordinate system of this projection.
      y - The y position in the coordinate system of this projection.
      Returns:
      The transformed position in the WGS84 coordinate system given as latitude-longitude.
    • getName

      public String getName()
      Return name of this projection in Well-Known format. For example, as "EPSG:3857"
      Returns:
      The name of this projection.