net.rim.device.api.lbs.maps.model
Class MapPoint

java.lang.Object
  extended by net.rim.device.api.lbs.maps.model.AbstractMappable
      extended by net.rim.device.api.lbs.maps.model.MapPoint
All Implemented Interfaces:
Comparable, Boxable, Mappable, Persistable
Direct Known Subclasses:
MapMarker, PeerPoint, GsPoint

public class MapPoint
extends AbstractMappable
implements Comparable, Persistable

Represents the coordinates for a location point on a map.

Note: The conversion to and from a Coordinates object is not symmetric. If a Coordinates object is converted to a MapPoint object and then it is converted back to a Coordinates object, the result might not equal the original.

Since:
BlackBerry API 6.0.0

Constructor Summary
MapPoint()
          Constructs a new MapPoint instance.
MapPoint(double lat, double lon)
          Constructs a new MapPoint instance using the specified latitude and longitude coordinates.
MapPoint(Coordinates coord)
          Constructs a copy of a MapPoint instance using a Coordinates object.
MapPoint(MapPoint data)
          Constructs a copy of a MapPoint instance using the specified data.
 
Method Summary
 int compareTo(Object other)
          Compares this object with the specified object for order.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 LatLonRectangle getBoundingBox()
          Retrieves the latitude and longitude-based bounding box of this mappable item.
 double getLat()
          Gets the latitude coordinate in decimal notation.
 double getLon()
          Gets the longitude coordinate in decimal notation.
 int hashCode()
          Returns a hash code value for the object.
 void setLat(double lat)
          Sets the latitude coordinate in decimal notation.
 void setLon(double lon)
          Sets the longitude coordinate in decimal notation.
 Coordinates toCoordinates()
          Converts this MapPoint into a Coordinates object.
 String toString()
          Returns a string representation of the object.
protected  LatLonRectangle updateBoundingBox()
          Updates the bounding box.
 
Methods inherited from class net.rim.device.api.lbs.maps.model.AbstractMappable
getCommandsByType, getStyleId, isClusterable, match, setStyleId
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 



Constructor Detail

MapPoint

public MapPoint()
Constructs a new MapPoint instance.

Since:
BlackBerry API 6.0.0

MapPoint

public MapPoint(MapPoint data)
Constructs a copy of a MapPoint instance using the specified data.

Parameters:
data - MapPoint to clone information from
Since:
BlackBerry API 6.0.0

MapPoint

public MapPoint(double lat,
                double lon)
Constructs a new MapPoint instance using the specified latitude and longitude coordinates.

Parameters:
lat - The latitude in float (decimal) notation.
lon - The longitude in float (decimal) notation.
Since:
BlackBerry API 6.0.0

MapPoint

public MapPoint(Coordinates coord)
Constructs a copy of a MapPoint instance using a Coordinates object.

Parameters:
coord - The coordinates data to use as a source.
Since:
BlackBerry API 6.0.0


Method Detail

hashCode

public int hashCode()
Description copied from class: Object
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Overrides:
hashCode in class AbstractMappable
Returns:
a hash code value for this object.
See Also:
Object.hashCode()
Since:
BlackBerry API 6.0.0

equals

public boolean equals(Object obj)
Description copied from class: Object
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Overrides:
equals in class AbstractMappable
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Object.equals(Object)
Since:
BlackBerry API 6.0.0

compareTo

public int compareTo(Object other)
Description copied from interface: Comparable
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

In the foregoing description, the notation sgn(expression) designates the mathematical signum function, which is defined to return one of -1, 0, or 1 according to whether the value of expression is negative, zero or positive.

The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.

Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.

It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."

Specified by:
compareTo in interface Comparable
Parameters:
other - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
See Also:
Comparable.compareTo(Object)
Since:
BlackBerry API 6.0.0

getBoundingBox

public LatLonRectangle getBoundingBox()
Description copied from interface: Boxable
Retrieves the latitude and longitude-based bounding box of this mappable item.

Note: It's recommended that for classes that implement Boxable that the bounding box calculation be performed at request time, and not at modification time. When there are multiple modifications to perform, continuous recalculation of the bounding box is unnecessary.

It's also recommended that you cache the bounding box information once it's been calculated because requests for the bounding box may be frequent.

Specified by:
getBoundingBox in interface Boxable
Returns:
The axis-aligned bounding box or null if there is no bounding box.
See Also:
Boxable.getBoundingBox()
Since:
BlackBerry API 6.0.0

getLat

public double getLat()
Gets the latitude coordinate in decimal notation.

Returns:
The latitude coordinate.
Since:
BlackBerry API 6.0.0

setLat

public void setLat(double lat)
Sets the latitude coordinate in decimal notation.

Parameters:
lat - The latitude coordinate.
Since:
BlackBerry API 6.0.0

getLon

public double getLon()
Gets the longitude coordinate in decimal notation.

Returns:
The longitude coordinate.
Since:
BlackBerry API 6.0.0

setLon

public void setLon(double lon)
Sets the longitude coordinate in decimal notation.

Parameters:
lon - The longitude coordinate.
Since:
BlackBerry API 6.0.0

toString

public String toString()
Description copied from class: Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString in class Object
Returns:
a string representation of the object.
See Also:
Object.toString()
Since:
BlackBerry API 6.0.0

toCoordinates

public Coordinates toCoordinates()
Converts this MapPoint into a Coordinates object.

Returns:
A Coordinates object.
Since:
BlackBerry API 6.0.0

updateBoundingBox

protected LatLonRectangle updateBoundingBox()
Updates the bounding box.

Returns:
the new bounding box.
Since:
BlackBerry API 7.1.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal