background image

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

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

Содержание GPS and BlackBerry Maps

Страница 1: ...GPS and BlackBerry Maps Version 4 7 0 Development Guide...

Страница 2: ...SWD 596846 1209055709 001...

Страница 3: ...adings using the cell site mode 7 Get GPS information during a call 7 Get location information updates 8 Change the criteria for obtaining location information 8 2 BlackBerry Maps location information...

Страница 4: ...was unsuccessful 26 Open BlackBerry Maps from the browser 26 Clearing data from the map 27 Clear data from a location document with an id attribute 27 Clear data from all location documents with an i...

Страница 5: ...ocation Criteriaclass invoketheappropriatesetmethods andthenpasstheinstance to LocationProvider getInstance cell site Use this mode to get location information from cell site towers This mode allows a...

Страница 6: ...latitudinal accuracy is not required 4 Invoke criteria setCostAllowed true to specify that this mode can incur cost 5 Invoke criteria setPreferredPowerConsumption int level using one of POWER_USAGE_ME...

Страница 7: ...ormation using the GPS receiver on a BlackBerry device Task Steps Specify a level of accuracy with no cost and no power consumption a Invokecriteria setHorizontalAccuracy int accuracy using an integer...

Страница 8: ...n Specify a response time for getting the location of the BlackBerry device Invoke Criteria setPreferredResponseTime and specify the response time in milliseconds Get the location information for a Bl...

Страница 9: ...ed GPS information Invoke Location getTimeStamp The time is retrieved from the GPS receiver on the BlackBerry device Location location provider getLocation 1 myLocation getTimeStamp Maintain a connect...

Страница 10: ...teria 2 Invoke the setHorizontalAccuracy setVerticalAccuracy setCostAllowed and setPreferredPowerConsumption methods of the new Criteria object to specify the new criteria 3 Invoke LocationProvider re...

Страница 11: ...erry Maps is included on BlackBerry devices that run BlackBerry Device Software version 4 2 or later Displaying location information on a BlackBerry device Displaying location information in BlackBerr...

Страница 12: ...nt represents the starting point of a route while the second location element represents the ending point of a route You can only use the x and y attributes in a location element that is nested within...

Страница 13: ...g email address no 4 2 1 or later categories String category no 4 2 1 or later rating String rating information between 0 and 5 no 4 2 1 or later Create a location document to display location informa...

Страница 14: ...s object that does not contain any arguments View a sample application that displays the default map 1 From the BlackBerry Integrated Development Environment launch the BlackBerryMapsDemo project 2 In...

Страница 15: ...n document location lon 7938675 lat 4367022 label Toronto ON description Toronto zoom 10 location document 3 Invoke invokeApplication using the APP_TYPE_MAPS constant parameter a new MapsArguments obj...

Страница 16: ...e Invoke net rim blackberry api invoke MapsArguments 2 Create a String that contains location information for multiple locations String document location document location lon 8030000 lat 4326000 labe...

Страница 17: ...enu and click View Multiple Locations Open BlackBerry Maps to display a route between locations on a map 1 Import the following classes net rim blackberry api invoke Invoke net rim blackberry api invo...

Страница 18: ...ents ARG_LOCATION_DOCUMENT document View a sample application that displays a route between locations on a map 1 From the BlackBerry Integrated Development Environment launch the BlackBerryMapsDemo pr...

Страница 19: ...APS new MapsArguments mapView View a sample application that displays a custom map view 1 From the BlackBerry Integrated Development Environment launch the BlackBerryMapsDemo project 2 In the BlackBer...

Страница 20: ...APP_TYPE_MAPS new MapsArguments c 0 notFinished 0 catch PIMException e 7 If a contact address is not found display the default map in the BlackBerry Maps if null Invoke invokeApplication Invoke APP_T...

Страница 21: ...rgument in the main method of the BlackBerry Application 6 Select Auto run on startup 7 Select System module 8 Click OK 9 Import the following classes import net rim device api ui import net rim devic...

Страница 22: ...e main method register a menu item with BlackBerry Maps public static void main String args if args null args length 0 if args 0 equals startup Register an ApplicationMenuItem when the BlackBerry smar...

Страница 23: ...mv The int values that getLatitude and getLongitude return are 100 000 times the values specified by WGS84 _latitudeField new BasicEditField Latitude _mv getLatitude 100000 0 9 BasicEditField FILTER_R...

Страница 24: ...iew setLatitude latitude _mapview setLongitude longitude Invoke BlackBerry Maps with a MapView object Invoke invokeApplication Invoke APP_TYPE_MAPS new MapsArguments _mapview close catch RuntimeExcept...

Страница 25: ...ion based services A MapField gets data either from a map server for location based services or the BlackBerry device with BlackBerry Maps installed If location information is not present on the Black...

Страница 26: ...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 pi...

Страница 27: ...al and longitudinal data for the address If the request is unsuccessful the server throws aLocatorException exception that contains the reason for the unsuccessful request A BlackBerry device applicat...

Страница 28: ...rCode try catch LocationException e System err println LocationException e getErrorCode Open BlackBerry Maps from the browser A BlackBerry device user can use the browser on a BlackBerry device to acc...

Страница 29: ...you send to BlackBerry Maps configure the clear attribute to the value of the id attribute of the location document that contains information for Kitchener String document lbs clear Kit location lon...

Страница 30: ...d attribute set to a value Create a String that configures the clear attribute to a comma delimited list of ids String document lbs clear MONTREAL OTTAWA location lon 7938675 lat 4367022 label Toronto...

Страница 31: ...tem JSR Java Specification Request MIME Multipurpose Internet Mail Extensions NMEA National Marine Electronics Association PDE Position Determination Entity SIM Subscriber Identity Module WGS World Ge...

Страница 32: ...Provide feedback 4 To provide feedback on this deliverable visit www blackberry com docsfeedback Development Guide Provide feedback 30...

Страница 33: ...u in a timely manner or at all This documentation might contain references to third party sources of information hardware or software products or services including components and content such as cont...

Страница 34: ...UDING AIRTIME SERVICE PROVIDERS AND THEIR RESPECTIVE DIRECTORS EMPLOYEES AND INDEPENDENT CONTRACTORS IN ADDITION TO THE LIMITATIONS AND EXCLUSIONS SET OUT ABOVE IN NO EVENT SHALL ANY DIRECTOR EMPLOYEE...

Страница 35: ...TOSUPERSEDEANYEXPRESSWRITTENAGREEMENTSORWARRANTIES PROVIDED BY RIM FOR PORTIONS OF ANY RIM PRODUCT OR SERVICE OTHER THAN THIS DOCUMENTATION Research In Motion Limited 295 Phillip Street Waterloo ON N2...

Отзывы: