Package globus.glmap

Class MapPoint

java.lang.Object
globus.glmap.MapPoint
All Implemented Interfaces:
Serializable

public class MapPoint extends Object implements Serializable
A point in GLMap's internal map coordinate system.

This coordinate space is used by the rendering engine and is not expressed in meters. To work with latitude/longitude in degrees, use MapGeoPoint and convert via MapPoint(MapGeoPoint) or CreateFromGeoCoordinates(double, double).

Valid coordinates are in the range [0, Max] for both axes. The origin is at the top-left corner of the world.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Maximum valid value of x and y.
    double
    X coordinate in internal map units.
    double
    Y coordinate in internal map units.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor
    MapPoint(double x, double y)
    Creates a point from internal map coordinates.
    Creates a map point from geographic coordinates.
    Copies constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    add(double x, double y)
    Add x and y
    add(MapPoint other)
    Add x and y of other point
    assign(double x, double y)
    Sets x and y and returns this instance.
    Copies data from given point
    static MapPoint
    CreateFromGeoCoordinates(double lat, double lon)
    Converts geographic coordinates (WGS84 degrees) into internal map coordinates.
    double
    distance(double x, double y)
    Returns Euclidean distance to a point in internal map units.
    double
    Returns Euclidean distance to a point in internal map units.
    boolean
    equals(Object other)
     
    int
     
    void
    set(MapGeoPoint geoPoint)
    Replaces this point with coordinates converted from a geographic point.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • Max

      public static final int Max
      Maximum valid value of x and y.
      See Also:
    • x

      public double x
      X coordinate in internal map units.
    • y

      public double y
      Y coordinate in internal map units.
  • Constructor Details

    • MapPoint

      public MapPoint()
      Default constructor
    • MapPoint

      public MapPoint(double x, double y)
      Creates a point from internal map coordinates.
      Parameters:
      x - X coordinate in internal map units. Valid values are in range [0, Max].
      y - Y coordinate in internal map units. Valid values are in range [0, Max].
    • MapPoint

      public MapPoint(@NonNull MapGeoPoint geoPoint)
      Creates a map point from geographic coordinates.
      Parameters:
      geoPoint - Geo point
    • MapPoint

      public MapPoint(@NonNull MapPoint point)
      Copies constructor
      Parameters:
      point - source point
  • Method Details

    • set

      public void set(@NonNull MapGeoPoint geoPoint)
      Replaces this point with coordinates converted from a geographic point.
      Parameters:
      geoPoint - Geographic point (WGS84 degrees).
    • CreateFromGeoCoordinates

      public static MapPoint CreateFromGeoCoordinates(double lat, double lon)
      Converts geographic coordinates (WGS84 degrees) into internal map coordinates.
      Parameters:
      lat - Latitude in degrees.
      lon - Longitude in degrees.
      Returns:
      A new MapPoint converted from the given coordinates.
    • assign

      public MapPoint assign(@NonNull MapPoint point)
      Copies data from given point
      Parameters:
      point - source point
      Returns:
      this to use in chain operations
    • assign

      public MapPoint assign(double x, double y)
      Sets x and y and returns this instance.
      Parameters:
      x - New x value.
      y - New y value.
      Returns:
      this for call-chaining.
    • distance

      public double distance(double x, double y)
      Returns Euclidean distance to a point in internal map units.
      Parameters:
      x - x of point
      y - y of point
      Returns:
      Distance to the point in internal map units.
    • distance

      public double distance(MapPoint point)
      Returns Euclidean distance to a point in internal map units.
      Parameters:
      point - point
      Returns:
      Distance to the point in internal map units.
    • add

      public MapPoint add(@NonNull MapPoint other)
      Add x and y of other point
      Parameters:
      other - point
      Returns:
      this to use in chain operations
    • add

      public MapPoint add(double x, double y)
      Add x and y
      Parameters:
      x - x to add
      y - y to add
      Returns:
      this to use in chain operations
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object