在android开发中,ArcGIS的API中提供了一个地图旋转功能,只需执行MapView对象map.setAllowRotationByPinch(true)方法,并且添加map的setOnPinchListener监听事件,这是地图即可实现旋转效果,代码如下:
map.setAllowRotationByPinch(true);
map.setOnPinchListener(new OnPinchListener() {
private static final long serialVersionUID = 1L;
@Override
public void prePointersUp(float arg0, float arg1, float arg2, float arg3,
double arg4) {
map.getRotationAngle();
compass.setRotationAngle(map.getRotationAngle());
compass.postInvalidate();
}
@Override
public void prePointersMove(float arg0, float arg1, float arg2, float arg3,
double arg4) {
// TODO Auto-generated method stub
}
@Override
public void prePointersDown(float arg0, float arg1, float arg2, float arg3,
double arg4) {
// TODO Auto-generated method stub
}
@Override
public void postPointersUp(float arg0, float arg1, float arg2, float arg3,
double arg4) {
// TODO Auto-generated method stub
}
@Override
public void postPointersMove(float arg0, float arg1, float arg2,
float arg3, double arg4) {
// TODO Auto-generated method stub
}
@Override
public void postPointersDown(float arg0, float arg1, float arg2,
float arg3, double arg4) {
// TODO Auto-generated method stub
}
})