Blackberry GPS and BlackBerry Maps Manual - Page 26

Browse online or download pdf Manual for Software Blackberry GPS and BlackBerry Maps. Blackberry GPS and BlackBerry Maps 35 pages. Version: 4.7.0

Development Guide
Task
Modify the center of a
MapField using pixel values.
Modify the zoom value for a
MapField.
Modify the rotation for a
MapField, in degrees.
Retrieve the latitude of the
center of a MapField.
Retrieve the longitude of the
center of a MapField.
Retrieve the zoom value of a
MapField.
Retrieve the rotation setting for
a MapField.

Converting latitudinal and longitudinal coordinates to pixel values

You can create a BlackBerry® device application to convert latitudinal and longitudinal coordinates to pixel values. For latitude,
north is a positive value, and south is a negative value. For longitude, east is a positive value and west is a negative value.
The Coordinates class represents coordinates as latitudinal, longitudinal, and altitudinal values. The latitudinal and
longitudinal values are expressed in degrees using floating point values. The Coordinates class provides coordinates using
World Geodetic System 1984 (WGS 84) data.
Convert latitudinal and longitudinal coordinates
The XYPoint object stores the initial coordinates and changes to the converted coordinates.
1.
Import the net.rim.device.api.lbs.MapField class.
2.
To convert latitudinal and longitudinal coordinates to pixels, invoke
convertWorldToField(Coordinates worldIn, XYPoint fieldOut) or
convertWorldToField(XYPoint worldIn, XYPoint fieldOut).
24
Steps
Invoke move(int dx,int dy). The move(dx,dy) method moves
center of the map in terms of relative pixels. A positive dx moves the center of
the map east if the rotation is 0, and a positive dy moves the center of the map
north if the rotation is 0.
Invoke setZoom(int z). Zoom values can be from 0 to 15. The zoom
operation is performed to the center of the map in the MapField.
Invoke setRotation(int r). Rotation can be set from 0 to 360,
clockwise. A rotation setting of 0 sets north at the top of the map view.
Invoke getLatitude().
Invoke getLongitude().
Invoke getZoom().
Invoke getRotation().
Displaying location information in your application