
For RIM and BlackBerry partner use only. Beta documentation. Content and software are subject to change.
26
GPS and BlackBerry Maps Development Guide
Configure a map in a UI field
Perform any of the following tasks:
Converting latitudinal and longitudinal coordinates to pixel values
A BlackBerry® Application can convert latitudinal and longitudinal coordinates to field coordinates, in pixels. 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 are given using
World Geodetic System 1984 (WGS84) data.
Convert latitudinal and longitudinal coordinates to pixels
The XYPoint object stores the initial coordinates and changes to the converted coordinates.
Invoke convertWorldToField(Coordinates worldIn, XYPoint fieldOut) or
convertWorldToField(XYPoint worldIn, XYPoint fieldOut).
Convert pixels to latitudinal and longitudinal coordinates
The XYPoint object stores the initial coordinates and changes to the converted coordinates.
Invoke convertFieldToWorld(XYPoint fieldIn, Coordinates worldOut) or
convertFieldToWorld(XYPoint fieldIn, XYPoint worldOut).
Task Steps
Set the center of a MapField using
latitudinal and longitudinal values, in
degrees.
>Invoke moveTo(int latitude, int longitude). The latitude and longitude values are
calculated as degrees multiplied by 100,000.
Set the center of a MapField to specific
coordinates.
>Invoke moveTo(javax.microedition.location.Coordinates coords).
Set the center of a MapField using pixel
values.
>Invoke move(int dx, int dy). The move(dx, dy) method moves the map in terms of
relative pixels. A positive
dx moves east if rotation is 0, and a positive dy moves north if
rotation is 0.
Set 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 view.
Set 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().
Kommentare zu diesen Handbüchern