RasterMap的 zoomIn,zoomOut 用来放大缩小地图。
//--------------------------------- PACKAGE ------------------------------------
package com.pstreets.gisengine.demo.midp;
//--------------------------------- IMPORTS ------------------------------------
import com.mapdigit.gis.geometry.GeoLatLng;
import com.mapdigit.gis.raster.MapType;
import com.pstreets.gisengine.demo.MapDemoMIDP;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
//[------------------------------ MAIN CLASS ----------------------------------]
/**
* map zoom demo for Guidebee Map API on MIDP platform.
*/
public class MapZoomMIDP extends MapDemoMIDP implements CommandListener{
private Command mapZoomInCommand=new Command("Zoom In",Command.OK,1);
private Command mapZoomOutCommand=new Command("Zoom Out",Command.CANCEL,1);
public void startApp() {
init();
canvas.addCommand(mapZoomInCommand);
canvas.addCommand(mapZoomOutCommand);
canvas.setCommandListener(this);
GeoLatLng center = new GeoLatLng(32.0616667, 118.7777778);
map.setCenter(center, 13, MapType.MICROSOFTCHINA);
Display.getDisplay(this).setCurrent(canvas);
}
public void commandAction(Command c, Displayable d) {
if(c==mapZoomInCommand){
map.zoomIn();
}else if(c==mapZoomOutCommand){
map.zoomOut();
}
}
}