no.ubicollab.osgi.service.location
Interface LocationService

All Known Implementing Classes:
LocationImpl

public interface LocationService

Interface for the LocationService
The location service handles mappings from positions (coordinates) to locations. E.g. It-building, Manhattan, Europe etc..

Author:
Andreas Brustad

Method Summary
 boolean addLocation(java.lang.String locationName, double[] longitudes, double[] latitudes, int altitude)
          Adds a new location to the service's list of locations.
 java.lang.String getLocation(double longitude, double latitude)
          Returns the name of the location containing the position specified by the parameters, without considering altitude.
 java.lang.String getLocation(double longitude, double latitude, int altitude, int altitudeErrorMargin)
          Returns the name of the location containing the position specified by the parameters.
 boolean removeLocatoin(java.lang.String locationName)
          Removes a location from the service's list of locations.
 

Method Detail

addLocation

boolean addLocation(java.lang.String locationName,
                    double[] longitudes,
                    double[] latitudes,
                    int altitude)
Adds a new location to the service's list of locations. Overrides the old location if locationName already exists.
The location has the shape of a polygon. The first latitude and the first longitude in the lists define the first point of the polygon etc. The two lists must therefore have the same length

Parameters:
locationName - Name of the new location
longitudes - List of longitudes (x-axis) expressed in decimal degrees. Max precision is 6 decimals. Use negative values for west
latitudes - List of latitudes (y-axis) expressed in decimal degrees. Max precision is 6 decimals. Use negative values on the southern hemisphere
Returns:
true
See Also:
Polygon

removeLocatoin

boolean removeLocatoin(java.lang.String locationName)
Removes a location from the service's list of locations. Does nothing if the locationName is not found

Parameters:
locationName - Name of the location to remove
Returns:
true

getLocation

java.lang.String getLocation(double longitude,
                             double latitude,
                             int altitude,
                             int altitudeErrorMargin)
Returns the name of the location containing the position specified by the parameters.
The first maching location is returned if the position is found in several locations.

Parameters:
longitude - Longitude of the position expressed in decimal degrees. Use negative values for west
latitude - Latitude of the position expressed in decimal degrees. Use negative values for south
altitude - Altitude of the position
altitudeErrorMargin - Allowed altitude error.
Location is returned if Math.abs(correctAltitude-altitude)<=altitudeErrorMargin;
Returns:
Name of the location containing the spesified position, or null if no location contains the position.
The first maching location is returned if the position is found in several locations.

getLocation

java.lang.String getLocation(double longitude,
                             double latitude)
Returns the name of the location containing the position specified by the parameters, without considering altitude.
The first maching location is returned if the position is found in several locations.

Parameters:
longitude - Longitude of the position expressed in decimal degrees. Use negative values for west
latitude - Latitude of the position expressed in decimal degrees. Use negative values for south
Returns:
Name of the location containing the spesified position, or null if no location contains the position.
The first maching location is returned if the position is found in several locations.