javax.microedition.location
Class CircleGeographicArea

java.lang.Object
  extended by javax.microedition.location.GeographicArea
      extended by javax.microedition.location.CircleGeographicArea

public class CircleGeographicArea
extends GeographicArea

This class represents a circular geographical area on WGS 84 Ellipsoid (see reference [WGS84]). Applications can use this object to request services, for example, from the MapServiceProvider.

A circular geographic area is a circular area on a surface of the WGS 84 Ellipsoid. The area is formed by a track of points on the distance of the radius from the center point. The track follows the surface of the earth.

This class is immutable. It means that if an application wants to modify the circular geographic area, it must instantiate a new object for the new area.

Since:
2.0

Constructor Summary
CircleGeographicArea(Coordinates center, float radius)
          Constructs a CircleGeographicArea object.
 
Method Summary
 boolean containsCoordinates(Coordinates coordinate)
          With this method an application can check if the given coordinate is inside this GeographicArea object.
 boolean equals(java.lang.Object obj)
          Overriding the equals method in Object class to compare the equality of values in two CircleGeographicArea objects.
 RectangleGeographicArea getBoundingBox()
          Returns the RectangleGeographicArea object that surrounds this geographic area completely.
 Coordinates getCenterPoint()
          Returns the coordinates of the center point of this geographic area.
 float getRadius()
          Returns the radius of the CircleGeographicArea that was given in the constructor.
 int hashCode()
          Overriding the hashCode method in Object class.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CircleGeographicArea

public CircleGeographicArea(Coordinates center,
                            float radius)

Constructs a CircleGeographicArea object. The radius is given in meters.

If the distance from center point to a pole is less than or equal to radius, implicating that the area contains a pole, an IllegalArgumentException is thrown. This restriction is needed because the bounding box for that area can not be constructed.

Parameters:
center - center point of the circular geographic area
radius - radius of the geographic area in meters
Throws:
java.lang.IllegalArgumentException - if radius < 0.0 or if the resulting area goes over the polar areas
java.lang.NullPointerException - if center is null
Method Detail

getRadius

public float getRadius()

Returns the radius of the CircleGeographicArea that was given in the constructor.

Returns:
the radius of the circular geographic area

containsCoordinates

public boolean containsCoordinates(Coordinates coordinate)
Description copied from class: GeographicArea

With this method an application can check if the given coordinate is inside this GeographicArea object. If the given coordinate is null, false is returned.

Specified by:
containsCoordinates in class GeographicArea
Parameters:
coordinate - a coordinates to be checked
Returns:
true, if the given point is inside this geographical area, else false

getBoundingBox

public RectangleGeographicArea getBoundingBox()
Description copied from class: GeographicArea

Returns the RectangleGeographicArea object that surrounds this geographic area completely. This is the smallest rectangle that can be drawn around the area. If the area is bigger than what is allowed in WGS 84 coordinate system, the rectangle is truncated to valid WGS 84 coordinate values. The RectangeleGeographicArea is always aligned with parallels and meridians.

Specified by:
getBoundingBox in class GeographicArea
Returns:
a RectangleGeographicArea object containing this area

getCenterPoint

public Coordinates getCenterPoint()
Description copied from class: GeographicArea

Returns the coordinates of the center point of this geographic area.

Specified by:
getCenterPoint in class GeographicArea
Returns:
the center point coordinates of the area

equals

public boolean equals(java.lang.Object obj)

Overriding the equals method in Object class to compare the equality of values in two CircleGeographicArea objects.

Overrides:
equals in class java.lang.Object
Parameters:
obj - object to which the comparison is done
Returns:
true if objects are equal, else false

hashCode

public int hashCode()

Overriding the hashCode method in Object class. The method returns a hash code value for the circle geographic area object. Two CircleGeographicArea objects that are equal must have the same hash code. For more information see java.lang.Object.hashCode() method.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of the circle geographic area


Copyright © 2003-2008 Nokia Corporation. All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.