Class MapPos

java.lang.Object
com.massifmaps.core.MapPos

public class MapPos extends Object
A double precision map position defined using three coordinates. X and y coordinates denote positions on the map,
while z coordinate is height from the ground plane. Actual units for x, y and z depend on map projection.
For example, in EPSG:4326 x is used for latitude, y for longitude and z for height in meters.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a MapPos object.
    MapPos(double x, double y)
    Constructs a MapPos object from 2 coordinates.
    MapPos(double x, double y, double z)
    Constructs a MapPos object from 3 coordinates.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new map position by adding a map vector to this map position.
    boolean
    Checks if this object is equal to the specified object.
    double
    Returns the x coordinate of this map position.
    double
    Returns the y coordinate of this map position.
    double
    Returns the z coordinate of this map position.
    int
    Returns the hash value of this object.
    Creates a new map vector by subtracting a map position from this map position.
    Creates a new map position by subtracting a map vector from this map position.
    Creates a string representation of this map position, useful for logging.

    Methods inherited from class java.lang.Object

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

    • MapPos

      public MapPos()
      Constructs a MapPos object. All coordinates will be 0.
    • MapPos

      public MapPos(double x, double y)
      Constructs a MapPos object from 2 coordinates. The z coordinate will be 0.
      Parameters:
      x - The x coordinate.
      y - The y coordinate.
    • MapPos

      public MapPos(double x, double y, double z)
      Constructs a MapPos object from 3 coordinates.
      Parameters:
      x - The x coordinate.
      y - The y coordinate.
      z - The z coordinate.
  • 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.
    • getX

      public double getX()
      Returns the x coordinate of this map position.
      Returns:
      The x coordinate of this map position.
    • getY

      public double getY()
      Returns the y coordinate of this map position.
      Returns:
      The y coordinate of this map position.
    • getZ

      public double getZ()
      Returns the z coordinate of this map position.
      Returns:
      The z coordinate of this map position.
    • add

      public MapPos add(MapVec v)
      Creates a new map position by adding a map vector to this map position.
      Parameters:
      v - The map vector to be added.
      Returns:
      The new map position.
    • subVec

      public MapPos subVec(MapVec v)
      Creates a new map position by subtracting a map vector from this map position.
      Parameters:
      v - The map vector to be subtracted.
      Returns:
      The new map position.
    • subPos

      public MapVec subPos(MapPos p)
      Creates a new map vector by subtracting a map position from this map position.
      Parameters:
      p - The map position to be subtracted.
      Returns:
      The new map vector.
    • toString

      public String toString()
      Creates a string representation of this map position, useful for logging.
      Overrides:
      toString in class Object
      Returns:
      The string representation of this map position.