Example of developing a map of Blackberry web bees: local query

Source: Internet
Author: User

Local query can be used to query areas of interest to users such as hotels and post offices in a specified region. Its usage is similar to address query.
The following example queries the information of a hotel in a certain area in the central point of 32.0616667 and 118.7777778.

[Java]
// ----------------------------------- PACKAGE ------------------------------------
Package com. pstreets. gisengine. demo. rim;

// ------------------------------------- IMPORTS ------------------------------------
Import com. mapdigit. gis. MapPoint;
Import com. mapdigit. gis. geometry. GeoLatLng;
Import com. mapdigit. gis. raster. MapType;
Import com. mapdigit. gis. service. IGeocodingListener;
Import com. pstreets. gisengine. demo. MapDemoRIM;
Import net. rim. device. api. ui. component. Menu;
Import net. rim. device. api. ui. MenuItem;


// [-------------------------------- Main class ----------------------------------]
/**
* Map pan demo for Guidebee Map API on MIDP platform.
* <Hr> <B>©Copyright 2011 Guidebee, Inc. All Rights Reserved. </B>
* @ Version 1.00, 09/02/11
* @ Author Guidebee Pty Ltd.
*/
Public class MapLocalSearchRIM extends MapDemoRIM implements IGeocodingListener {

/**
* Entry point for application
* @ Param args Command line arguments (not used)
*/
Public static void main (String [] args)
{
// Create a new instance of the application and make the currently
// Running thread the application's event dispatch thread.
MapLocalSearchRIM theApp = new MapLocalSearchRIM ();
TheApp. enterEventDispatcher ();
}

Private MenuItem mapFindAddressMenuItem = new MenuItem ("Find Address", 0, 0 ){
Public void run (){
String name = "hotel ";
GeoLatLng screenCenter = map. getScreenCenter ();
Map. getLocations (name, 0, screenCenter,
Map. getScreenBounds (screenCenter ));
}
};

Public MapLocalSearchRIM (){

Init ();
PushScreen (canvas );
Map. setGeocodingListener (this );
GeoLatLng center = new GeoLatLng (32.0616667, 118.7777778 );
Map. setCenter (center, 13, MapType. MICROSOFTCHINA );

}


Public void done (String arg0, MapPoint [] result ){
If (result! = Null ){
Map. panTo (result [0]. getPoint ());
For (int I = 0; I <result. length; I ++ ){
System. out. println (result [I]. objectNote );
}
}
}

Protected void createMenu (Menu menu, int instance ){
Menu. add (mapFindAddressMenuItem );
}
}

// ----------------------------------- PACKAGE ------------------------------------
Package com. pstreets. gisengine. demo. rim;
 
// ------------------------------------- IMPORTS ------------------------------------
Import com. mapdigit. gis. MapPoint;
Import com. mapdigit. gis. geometry. GeoLatLng;
Import com. mapdigit. gis. raster. MapType;
Import com. mapdigit. gis. service. IGeocodingListener;
Import com. pstreets. gisengine. demo. MapDemoRIM;
Import net. rim. device. api. ui. component. Menu;
Import net. rim. device. api. ui. MenuItem;
 
 
// [-------------------------------- Main class ----------------------------------]
/**
* Map pan demo for Guidebee Map API on MIDP platform.
* <Hr> <B>©Copyright 2011 Guidebee, Inc. All Rights Reserved. </B>
* @ Version 1.00, 09/02/11
* @ Author Guidebee Pty Ltd.
*/
Public class MapLocalSearchRIM extends MapDemoRIM implements IGeocodingListener {
 
/**
* Entry point for application
* @ Param args Command line arguments (not used)
*/
Public static void main (String [] args)
{
// Create a new instance of the application and make the currently
// Running thread the application's event dispatch thread.
MapLocalSearchRIM theApp = new MapLocalSearchRIM ();
TheApp. enterEventDispatcher ();
}

Private MenuItem mapFindAddressMenuItem = new MenuItem ("Find Address", 0, 0 ){
Public void run (){
String name = "hotel ";
GeoLatLng screenCenter = map. getScreenCenter ();
Map. getLocations (name, 0, screenCenter,
Map. getScreenBounds (screenCenter ));
}
};
 
Public MapLocalSearchRIM (){
 
Init ();
PushScreen (canvas );
Map. setGeocodingListener (this );
GeoLatLng center = new GeoLatLng (32.0616667, 118.7777778 );
Map. setCenter (center, 13, MapType. MICROSOFTCHINA );

}
 

Public void done (String arg0, MapPoint [] result ){
If (result! = Null ){
Map. panTo (result [0]. getPoint ());
For (int I = 0; I <result. length; I ++ ){
System. out. println (result [I]. objectNote );
}
}
}

Protected void createMenu (Menu menu, int instance ){
Menu. add (mapFindAddressMenuItem );
}
} Local query method
Public void getLocations (String address, int start, GeoLatLng center, GeoBounds bound, IGeocodingListener listener );
Specify the central point and query area. The local query can return results multiple times. start indicates the Starting sequence of the query results. Each returned result is defined in SearchOptions. Four results are returned each time by default.
The returned results may be different. Www.2cto.com
"Jingli hotel 025-83310818 025-83310818212223 025-86636636"
"Celebrity hotels in cities 025-83123333 025-83123888"
"Nanjing Xuanwu hotel 025-83358888"
"Sofitel Galaxy Nanjing-Sofitel Nanjing Galaxy Hotel 025-83718888"

 

Author: mapdigit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.