Re: [Ask] about Nokia Map API - Java ME
The relevant class diagram can be found below.
[IMG]http://www.developer.nokia.com/pics/java_me_standard_markers01.jpg[/IMG]
If your mnRute class [B]extends MapCanvas[/B], you don't need to instantiate your own instance of
[CODE]MapCanvas mapCanvas;
MapDisplay mapDisplay;[/CODE]
The subclass can access those already found in the [B]MapCanvas [/B]class.
[LIST][*]All instances of [B]mapCanvas.addCommand()[/B] can be replaced with [B]addCommand()[/B] and so on.[*]All instances of [B]mapDisplay.addMapObject()[/B] can be replaced with [B]getDisplay().addMapObject()[/B] and so on.[/LIST]
I suspect the code as currently written is displaying the [B]MapDisplay [/B]contained in the base class whereas you are attaching objects to your own private instance of [B]MapDisplay [/B]which is not current
For a fully working 1.0 example check out the code commentary at:
[url]http://www.developer.nokia.com/Develop/Maps/Maps_API_for_Java_ME/Code_examples/#routing[/url]
Or the article at:
[url]http://www.developer.nokia.com/Community/Wiki/How_to_calculate_and_show_a_route_with_Maps_API_for_Java_ME[/url]
Re: [Ask] about Nokia Map API - Java ME
[QUOTE=jasfox;895082]
If your mnRute class [B]extends MapCanvas[/B], you don't need to instantiate your own instance of
[CODE]MapCanvas mapCanvas;
MapDisplay mapDisplay;[/CODE]
The subclass can access those already found in the [B]MapCanvas [/B]class.
[LIST][*]All instances of [B]mapCanvas.addCommand()[/B] can be replaced with [B]addCommand()[/B] and so on.[*]All instances of [B]mapDisplay.addMapObject()[/B] can be replaced with [B]getDisplay().addMapObject()[/B] and so on.[/LIST]
I suspect the code as currently written is displaying the [B]MapDisplay [/B]contained in the base class whereas you are attaching objects to your own private instance of [B]MapDisplay [/B]which is not current
[/QUOTE]
Ok thanks sir, its working :) :)
====================================
I want to display the navigation for a route.
what nokia Map API support to navigate?
if so, how to display navigation on a route that has been gained?
thank you sir
Re: [Ask] about Nokia Map API - Java ME
[QUOTE=Arif_Mubashir;895095]I want to display the navigation for a route.
what nokia Map API support to navigate?
if so, how to display navigation on a route that has been gained?
[/QUOTE]
You should look up the use of the [B]Route[/B] and [B]Maneuver[/B] classes in the JavaDoc available with the API download. You can get summary information from your [B]Route[/B] and the starting [B]Maneuver[/B] from [B]route.getFirstManeuver(); [/B], thereafter the [B]Maneuvers[/B] can be read from a doubly linked list .
The following articles should help:
[LIST][*][url]http://www.developer.nokia.com/Community/Wiki/How_to_calculate_and_show_a_route_with_Maps_API_for_Java_ME[/url]
[*][url]http://www.developer.nokia.com/Community/Wiki/Advanced_Routing_with_Java_ME[/url][/LIST]
Re: [Ask] about Nokia Map API - Java ME
[QUOTE=jasfox;895152]You should look up the use of the [B]Route[/B] and [B]Maneuver[/B] classes in the JavaDoc available with the API download. You can get summary information from your [B]Route[/B] and the starting [B]Maneuver[/B] from [B]route.getFirstManeuver(); [/B], thereafter the [B]Maneuvers[/B] can be read from a doubly linked list .
The following articles should help:
[LIST][*][url]http://www.developer.nokia.com/Community/Wiki/How_to_calculate_and_show_a_route_with_Maps_API_for_Java_ME[/url]
[*][url]http://www.developer.nokia.com/Community/Wiki/Advanced_Routing_with_Java_ME[/url][/LIST][/QUOTE]
I create setCurrentManeuver() method in my mnRute class
[CODE]
private synchronized void setCurrentManeuver(RouteManeuver maneuver) {
if (currentMarker == null) {
currentMarker = getMapFactory().createStandardMarker(maneuver.getPosition());
getMapDisplay().addMapObject(currentMarker);
} else {
currentMarker.setCoordinate(maneuver.getPosition());
}
currentManeuver = maneuver;
getMapDisplay().setCenter(currentManeuver.getPosition());
}
[/CODE]
But, error in:
[CODE]
[B]currentMarker = getMapFactory().createStandardMarker(maneuver.getPosition());[/B]
[/CODE]
error:
[CODE]
method createStandardMarker in class com.nokia.maps.map.MapFactory cannot be applied to given types
required: com.nokia.maps.common.GeoCoordinate,int,java.lang.String,com.nokia.maps.map.MapShapeType
found: com.nokia.maps.common.Geocoordinate
[/CODE]
thanks sir..
Re: [Ask] about Nokia Map API - Java ME
This is because the code in the article has been written to work with Nokia Maps for Java ME[B] v1.0 [/B], not the beta release you are currently using. You can tell this by looking at the Article Meta Data:
Compatibility:
Platform(s): [I]Series 40[/I]
Dependencies: [I]Maps API for Java ME v1.0[/I]
I would strongly urge you to update to the later version.
In the 1.0 API, [B]MapFactory.createStandardMarker(GeoCoordinate) [/B]is a convenience overload of [B]createStandardMarker(GeoCoordinate , int , String , int )[/B],
If you must stick with the obsolete version of the API try adding in default values for the missing parameters, something like:
[CODE]currentMarker = getMapFactory().createStandardMarker(maneuver.getPosition() , -1, "", MapStandardMarker.BALLOON);[/CODE]
Re: [Ask] about Nokia Map API - Java ME
[QUOTE=jasfox;895279]
If you must stick with the obsolete version of the API try adding in default values for the missing parameters, something like:
[CODE]currentMarker = getMapFactory().createStandardMarker(maneuver.getPosition() , -1, "", MapStandardMarker.BALLOON);[/CODE][/QUOTE]
Thank sir, its working
I was able to navigate. but still I want to ask. during navigation. There are guidelines for the information to the destination point with Map Image. Could I just show the form of information without a Map?
example:
from A Street to D Street
Form Navigational directions:
Right A street. Go to 20m
Left B Street. Go to 200m
Thank you sir...
Re: [Ask] about Nokia Map API - Java ME
[QUOTE=Arif_Mubashir;895319]Thank sir, its working
I was able to navigate. but still I want to ask. during navigation. There are guidelines for the information to the destination point with Map Image. Could I just show the form of information without a Map?
[/QUOTE]
The Code in the Wiki article is free for you to alter as you see fit. If you don't need/want to display the turnpoint images, then you don't have to. An added advantage of not displaying turnpoints is that you are saving on http requests and therefore reducing network traffic for your end user.
Re: [Ask] about Nokia Map API - Java ME
[QUOTE=jasfox;895321]The Code in the Wiki article is free for you to alter as you see fit. If you don't need/want to display the turnpoint images, then you don't have to. An added advantage of not displaying turnpoints is that you are saving on http requests and therefore reducing network traffic for your end user.[/QUOTE]
ok thank you sir..
==============================================
I use JSR-179 to display my current position..
I have made that and run in my handphone..
When I move, the marker (my positon marker) is not move..
How to move my position marker when I move? (Real-time position)
This is my code for display my current position
[CODE]
public mnPosisiku (mnUtm midlet, Display display) {
this.midlet = midlet;
this.display = display;
wpl = new WaypointParameterList();
skala = new skalaMap();
kompas = new legendaMap();
}
public void pos() {
try {
//Make MapCanvas
mapCanvas = new MapCanvas(display);
mapDisplay = mapCanvas.getMapDisplay();
//Make Command
cmKembali = new Command("Kembali", Command.BACK, 0);
cmInfo = new Command("Info", Command.OK, 1);
mapCanvas.addCommand(cmKembali);
mapCanvas.addCommand(cmInfo);
mapCanvas.setCommandListener(this);
//Current position with JSR-179
Criteria cr = new Criteria();
cr.setHorizontalAccuracy(500);
lp = LocationProvider.getInstance(cr);
Location l = lp.getLocation(60);
Coordinates c = l.getQualifiedCoordinates();
if (c != null) {
double lat = c.getLatitude();
double lon = c.getLongitude();
mapCanvas.getMapDisplay().setCenter(new GeoCoordinate(lat, lon, 0));
mapCanvas.getMapDisplay().setZoomLevel(16,0,0);
//Make marker (my current position) in Map
Point center = new Point(mapCanvas.getWidth()/2, mapCanvas.getHeight()/2);
GeoCoordinate gc = mapDisplay.pixelToGeo(center);
wpl.addCoordinate(gc);
pos = mapCanvas.getMapFactory().createStandardMarker(gc, 10, null, MapShapeType.bed);
mapDisplay.addMapObject(pos);
mapDisplay.addMapComponent(skala);
mapDisplay.addMapComponent(kompas);
mapCanvas.setTitle("Posisi Saat Ini");
string = "Posisi Anda Saat ini Berada di :" +
"\nLatitude : " + lat + "\nLongitude : " + lon;
//Display Map
display.setCurrent(mapCanvas);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void commandAction(Command c, Displayable d) {
//Back to Main Menu
if (c == cmKembali) {
display.setCurrent(midlet.menu);
}
//Display Coordinates my position
if (c == cmInfo) {
info = new Alert("Detail Posisi", string, null, AlertType.INFO);
info.setTimeout(60000);
display.setCurrent(info, mapCanvas);
}
}
}
[/CODE]
Thanks Sir..
Re: [Ask] about Nokia Map API - Java ME
[QUOTE=Arif_Mubashir;895387]
I use JSR-179 to display my current position..
I have made that and run in my handset..
When I move, the marker (my position marker) is not move..
[/QUOTE]
There are various articles on the best practices for using JSR-179, I would suggest you look at the following:
[url]http://www.developer.nokia.com/Community/Wiki/How_to_get_Location_Using_Location_API_JSR_179[/url]
[url]http://www.developer.nokia.com/Community/Wiki/Finding_position_in_Java_ME[/url]
[url]http://www.developer.nokia.com/Community/Wiki/Determining_Current_Location_via_Cell_ID[/url]
[url]http://www.developer.nokia.com/Community/Wiki/Best_practises_for_listening_to_location_updates[/url]
Basically there are two ways of achieving this - if your handset contains GPS you can set up a [B]location listener [/B] which will periodically callback [B]locationUpdated()[/B] when the location has changed. I believe your code is implementing [B]Cell-ID[/B] based location however which cannot use this. You'll need to set up a loop to periodically call [B]getLocation() [/B] instead.
[QUOTE=Arif_Mubashir;895387]
How to move my position marker when I move? (Real-time position)
[/QUOTE]
Once you have retrieved a location update, you can display the result on a map as shown in the following article: [url]http://www.developer.nokia.com/Community/Wiki/Using_a_JSR-179_Location_Provider_and_displaying_the_result_on_a_Map[/url]
If you require further information about how set up the code to [B]locate[/B] a device, I would suggest you ask a separate question on the LBS sub-forum:
[url]http://www.developer.nokia.com/Community/Discussion/forumdisplay.php?159-Location-Based-Services-and-Navigation[/url] rather than extending this thread on the [B]maps [/B]sub-forum.
Re: [Ask] about Nokia Map API - Java ME
[QUOTE=jasfox;894413]An article on how to do this has now been submitted to the Community Wiki: [url]http://www.developer.nokia.com/Community/Wiki/Creating_Touchable_Custom_Map_Components_for_the_Maps_API_for_Java_ME#ScaleBarComponent[/url][/QUOTE]
I set zoom level (17, 0, 0) in my aplication
I run my application, on a map written 25 m
what the meaning of 25 m in scale?
1 cm in map = 25 m at the real condition?
and when I zoom in, that still 25 m why the scale is not change?
I want to set the zoom level is only reached level 17 so if it is at level 17 can not zoom in
how to set the zooming level sir?
thank you sir.
Re: [Ask] about Nokia Map API - Java ME
[QUOTE=Arif_Mubashir;895636]I set zoom level (17, 0, 0) in my aplication
I run my application, on a map written 25 m
what the meaning of 25 m in scale?
1 cm in map = 25 m at the real condition?
and when I zoom in, that still 25 m why the scale is not change?
[/QUOTE]
The scale is the distance of the black line below the text. Only zooms <18 are supported. To add more levels add entries to [B]SCALE_IN_METRES[/B], [B]SCALE_IN_IMPERIAL[/B] and so on.
[QUOTE=Arif_Mubashir;895636]
I want to set the zoom level is only reached level 17 so if it is at level 17 can not zoom in
.[/QUOTE]
To restrict the zoom level add something like the following to any MapComponent:
[CODE]
public void mapUpdated(boolean zoomChanged) {
if (zoomChanged && getMap().getZoomLevel() > 17){
getMap().setZoomLevel(17, 0, 0);
}
}[/CODE]
Re: [Ask] about Nokia Map API - Java ME
I have question about downloading Image Map, sir
How to set the zoom level Image Map view ? I want to set size downloading Image Map.
and
when routing , polyline color is only black or can be change? If can be change, how to change color polyline?
Thank you sir
Re: [Ask] about Nokia Map API - Java ME
[QUOTE=Arif_Mubashir;895985]
How to set the zoom level Image Map view ? I want to set size downloading Image Map.
[/QUOTE]
Use [B]map.setState(new MapDisplayState(new GeoCoordinate(51.477, 0.0, 0), 15));[/B]
or [B]map.setZoomLevel(15, 0, 0);[/B] to set the zoom level on start up.
To alter the size of the Image, you'll need to create your own custom [I]MapCanvas[/I], and example is given here:
[url]http://www.developer.nokia.com/Community/Wiki/Creating_a_custom_Map_Item_with_Maps_API_for_Java_ME[/url]
[QUOTE=Arif_Mubashir;895985]
when routing , polyline color is only black or can be change? If can be change, how to change color polyline?
[/QUOTE]
[B]MapFactory.createMapPolyline() [/B] will give a black line by default. Use [B]MapPolyline.setColor()[/B] to alter it to the ARGB color of your choice.
Re: [Ask] about Nokia Map API - Java ME
Hi Arif.
When i use c.getLatitude() and c.getLongitude(), why my device "searching for device" with bluetooth??i use Asha 300.i think this device support JSR-179
Thanks
Re: [Ask] about Nokia Map API - Java ME
Hi littlemanz77,
I think you would be more likely to get a response about a Geolocation issue if you create a new thread here: [url]http://www.developer.nokia.com/Community/Discussion/forumdisplay.php?159-Geolocation-and-Navigation[/url]. It would also help if you could supply a snippet of your code.
This is the wrong discussion board for your question as it is focused on [B]displaying stuff[/B] and [B]interacting with [/B] the Maps API for Java ME