Package globus.glmap
Class MapPoint
java.lang.Object
globus.glmap.MapPoint
- All Implemented Interfaces:
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(double x, double y) Add x and yAdd x and y of other pointassign(double x, double y) Copies data from given pointstatic MapPointCreateFromGeoCoordinates(double lat, double lon) Converts geographic coordinates (WGS84 degrees) into internal map coordinates.doubledistance(double x, double y) Returns Euclidean distance to a point in internal map units.doubleReturns Euclidean distance to a point in internal map units.booleaninthashCode()voidset(MapGeoPoint geoPoint) Replaces this point with coordinates converted from a geographic point.
-
Field Details
-
Max
public static final int Max- See Also:
-
x
public double xX coordinate in internal map units. -
y
public double yY 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
Creates a map point from geographic coordinates.- Parameters:
geoPoint- Geo point
-
MapPoint
Copies constructor- Parameters:
point- source point
-
-
Method Details
-
set
Replaces this point with coordinates converted from a geographic point.- Parameters:
geoPoint- Geographic point (WGS84 degrees).
-
CreateFromGeoCoordinates
Converts geographic coordinates (WGS84 degrees) into internal map coordinates.- Parameters:
lat- Latitude in degrees.lon- Longitude in degrees.- Returns:
- A new
MapPointconverted from the given coordinates.
-
assign
Copies data from given point- Parameters:
point- source point- Returns:
- this to use in chain operations
-
assign
- Parameters:
x- New x value.y- New y value.- Returns:
thisfor call-chaining.
-
distance
public double distance(double x, double y) Returns Euclidean distance to a point in internal map units.- Parameters:
x- x of pointy- y of point- Returns:
- Distance to the point in internal map units.
-
distance
Returns Euclidean distance to a point in internal map units.- Parameters:
point- point- Returns:
- Distance to the point in internal map units.
-
add
Add x and y of other point- Parameters:
other- point- Returns:
- this to use in chain operations
-
add
Add x and y- Parameters:
x- x to addy- y to add- Returns:
- this to use in chain operations
-
equals
-
hashCode
public int hashCode()
-