Mixin LatLonMixin

This mixin provides additional properties and methods which you can invoke on an instance of LatLon.

Name Description
Properties
lat Get the latitude.
lon Get the longitude.
Methods
make Create a LatLon from a javascript object.

This mixin provides additional properties and methods for the native Java class LatLon, whose native public methods are available for scripting, too. If a native method name is hidden by a property name in the mixin, then prefix the native name with $.

Properties

lat:number

Get the latitude.

var LatLon = org.openstreetmap.josm.data.coor.LatLon;

// set members 
var pos = new LatLon(1,2);
pos.lat;     // -> 1

// you can still invoke the native java method lat(), just add $ as prefix.
// Note the parentheses - the native method has to be called as function!
pos.$lat();  // -> 1

lon:number

Get the longitude.

var LatLon = org.openstreetmap.josm.data.coor.LatLon;

// set members 
var pos = new LatLon(1,2);
pos.lon;     // -> 2

// you can still invoke the native java method lon(), just add $ as prefix.
// Note the parentheses - the native method has to be called as function!
pos.$lon();  // -> 1

Functions

make:LatLon

Creates a LatLon from a javascript object.

Parameters

Name Type Description
obj object a javascript object with two number properties lat: and lon:

Examples

var pos = LatLon.make({lat: 1, lon: 2});