|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.location.GeographicArea
javax.microedition.location.RectangleGeographicArea
public class RectangleGeographicArea
This class represents a rectangular geographical area on WGS 84 Ellipsoid
(see reference [WGS84]). Applications can use this object to request services
from, for example, the MapServiceProvider.
A rectangle geographic area has a two pairs of sides that are parallel with each other. The pairs are orthogonal and aligned with the parallels and meridians. The boundary of the rectangle follows the surface of the earth.
This class is immutable. It means that if an application wants to modify the rectangle geographic area, it must instantiate a new object for the new area.
| Constructor Summary | |
|---|---|
RectangleGeographicArea(Coordinates lowerLeftCorner,
Coordinates upperRightCorner)
Constructs a RectangleGeographicArea object. |
|
RectangleGeographicArea(double minLat,
double maxLat,
double minLon,
double maxLon)
Constructs a RectangleGeographicArea 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 RectangleGeographicArea
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. |
Coordinates[] |
getCoordinates()
Returns the two Coordinates objects that were used to
construct this rectangle geographical area. |
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 |
|---|
public RectangleGeographicArea(Coordinates lowerLeftCorner,
Coordinates upperRightCorner)
Constructs a RectangleGeographicArea object. The object is
created as a rectangle from the given lowerLeftCorner and
upperRightCorner coordinates. The coordinates are combined with
lines that are aligned with parallels and meridians.
Creating the object always from the lowerLeftCorner to
upperRightCorner allows also crossing the 180 longitude.
Longitudes -180 and 180 denote the same longitude. If an application
wants to create a rectangle that crosses the -180 longitude, it sets the
longitude of lowerLeftCorner to a bigger value than the
longitude of the upperRightCorner. This ensures that the
rectangle is created with crossing the 180 longitude. Constructing an
area with longitude of lowerLeftCorner -180 and longitude of
upperRightCorner 180 must construct and area
that goes around the earth.
lowerLeftCorner - coordinates of the lower left corner of the rectangleupperRightCorner - coordinates of the upper right corner of the rectangle
java.lang.IllegalArgumentException - if lowerLeftCorder.latitude
> upperRightCorner.latitude
java.lang.NullPointerException - if lowerLeftCorner or
upperRightCorner is null
public RectangleGeographicArea(double minLat,
double maxLat,
double minLon,
double maxLon)
Constructs a RectangleGeographicArea object. The object is
constructed as a rectangle from given parameter values. This method is the
same as calling the other constructor with coordinates constructed from
minLat, minLon pair and maxLat,
maxLon pair. The valid values for minLat and
maxLat are [-90.0, 90.0]. The valid values for minLon
and maxLon are [-180.0, 180.0]. If minLon >
maxLon the rectangle is created so that 180 longitude is crossed.
The API implementation constructs Coordinates objects from
the parameter values and it must set the altitude to
Float.NaN..
minLat - the minimum latitude of the rectangle area, valid range
[-90.0, 90.0]maxLat - the maximum latitude of the rectangle area, valid range
[-90.0, 90.0]minLon - the minimum longitude of the rectangle area, valid range
[-180.0, 180.0]maxLon - the maximum longitude of the rectangle area, valid range
[-180.0, 180.0]
java.lang.IllegalArgumentException - if minLat >
maxLat or if an input parameter is out of the
valid range| Method Detail |
|---|
public Coordinates[] getCoordinates()
Returns the two Coordinates objects that were used to
construct this rectangle geographical area. First element in the returned
array contains the lowerLeftCorner and the second element
the upperRightCorner coordinates. If the constructor taking the
double values is used, this method returns in the first element
an Coordinates object constructed from minLat and
minLon values. The second element contains a Coordinates
object constructed from maxLat and maxLon values.
public boolean containsCoordinates(Coordinates coordinate)
GeographicAreaWith this method an application can check if the given coordinate is
inside this GeographicArea object. If the given coordinate is
null, false is returned.
containsCoordinates in class GeographicAreacoordinate - a coordinates to be checked
true, if the given point is inside this geographical
area, else falsepublic Coordinates getCenterPoint()
Returns the coordinates of the center point of this geographic area.
The center point of the rectangle is the point with mean latitude and mean longitude.
getCenterPoint in class GeographicAreapublic RectangleGeographicArea getBoundingBox()
GeographicAreaReturns 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.
getBoundingBox in class GeographicAreaRectangleGeographicArea object containing this areapublic boolean equals(java.lang.Object obj)
Overriding the equals method in Object class
to compare the equality of values in two RectangleGeographicArea
objects.
equals in class java.lang.Objectobj - object to which the comparison is done
true if all fields in the objects are equal,
else falsepublic int hashCode()
Overriding the hashCode method in Object class.
The method returns a hash code value for the rectangle geographic area object.
Two RectangleGeographicArea objects that are equal
must have the same hash code. For more information see
java.lang.Object.hashCode() method.
hashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||