Task
Steps
Modify the center of a
MapField
using pixel values.
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.
Modify the zoom value for a
MapField
.
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
.
Modify the rotation for a
MapField
, in degrees.
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.
Retrieve the latitude of the
center of a
MapField
.
Invoke
getLatitude()
.
Retrieve the longitude of the
center of a
MapField
.
Invoke
getLongitude()
.
Retrieve the zoom value of a
MapField
.
Invoke
getZoom()
.
Retrieve the rotation setting for
a
MapField
.
Invoke
getRotation()
.
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)
.
Development Guide
Displaying location information in your application
24