org.elkoserver.server.context
Class GeoPosition

java.lang.Object
  extended by org.elkoserver.server.context.GeoPosition
All Implemented Interfaces:
Encodable, Position

public class GeoPosition
extends Object
implements Position

Position class representing a latitude/longitude position on the surface of the earth.


Field Summary
 double lat
          Position latitude, in decimal degrees.
 double lon
          Position longitude, in decimal degrees.
 
Constructor Summary
GeoPosition(double lat, double lon)
          JSON-driven constructor.
 
Method Summary
 JSONLiteral encode(EncodeControl control)
          Encode this position for transmission or persistence.
static void setPosition(BasicObject obj, double lat, double lon)
          Generate a new geo-position and assign it to an object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lat

public final double lat
Position latitude, in decimal degrees.


lon

public final double lon
Position longitude, in decimal degrees.

Constructor Detail

GeoPosition

@JSONMethod(value={"lat","lon"})
public GeoPosition(double lat,
                                   double lon)
JSON-driven constructor.

Parameters:
lat - Latitude (decimal degrees)
lon - Longitude (decimal degrees)
Method Detail

encode

public JSONLiteral encode(EncodeControl control)
Encode this position for transmission or persistence.

Specified by:
encode in interface Encodable
Parameters:
control - Encode control determining what flavor of encoding should be done.
Returns:
a JSON literal representing this position.

setPosition

public static void setPosition(BasicObject obj,
                               double lat,
                               double lon)
Generate a new geo-position and assign it to an object.

Parameters:
obj - The object to be given the new position
lat - The new latitude
lon - The new longitude

toString

public String toString()
Overrides:
toString in class Object