
Originally Posted by
jasfox
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.
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);
}
}
}
Thanks Sir..