Back to project page SmartMap.
The source code is released under:
Apache License
If you think the Android project SmartMap listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.dennytech.smartmap.impl.autonavi; // w w w. j a v a 2 s .c o m import android.content.Context; import android.view.View; import android.view.View.OnTouchListener; import android.view.ViewGroup.LayoutParams; import com.amap.mapapi.core.GeoPoint; import com.amap.mapapi.map.MapView; import com.amap.mapapi.map.Overlay; import com.dennytech.smartmap.IGeoPoint; import com.dennytech.smartmap.IMapView; import com.dennytech.smartmap.IMapViewLayoutParams; import com.dennytech.smartmap.IOverlay; import com.dennytech.smartmap.IProjection; import com.dennytech.smartmap.MapViewCallback; public class ANMapView implements IMapView { MyANMapView mapView; ANMapController mapController; ANGeoPoint mapCenter; public ANMapView(Context context, String apiKey) { mapView = new MyANMapView(context, apiKey); // ????????? // mapView.setVectorMap(true); mapController = new ANMapController(); mapCenter = new ANGeoPoint(); } public View real() { return mapView; } @Override public ANMapController getController() { return mapController.wrap(mapView.getController()); } public void setCallback(MapViewCallback callback) { mapView.setCallback(callback); } @Override public ANGeoPoint getMapCenter() { return mapCenter.wrap(mapView.getMapCenter()); } @Override public void setBuiltInZoomControls(boolean on) { mapView.setBuiltInZoomControls(on); } @Override public void addOverlay(IOverlay ol) { mapView.getOverlays().add((Overlay) ol.real()); } @Override public void removeOverlay(IOverlay ol) { mapView.getOverlays().remove(ol.real()); } @Override public void clearOverlay() { mapView.getOverlays().clear(); } public int getMaxZoomLevel() { return mapView.getMaxZoomLevel(); } @Override public int getZoomLevel() { return mapView.getZoomLevel(); } public void setLayoutParams(LayoutParams params) { mapView.setLayoutParams(params); } public void setClickable(boolean clickable) { mapView.setClickable(clickable); } @Override public IProjection getProjection() { return new ANProjection().wrap(mapView.getProjection()); } @Override public void invalidate() { mapView.invalidate(); } @Override public void addView(View child, IMapViewLayoutParams params) { mapView.addView(child, (MapView.LayoutParams) params.real()); } @Override public void updateViewLayout(View view, LayoutParams params) { mapView.updateViewLayout(view, params); } @Override public void setOnTouchListener(OnTouchListener listener) { mapView.setOnTouchListener(listener); } public static class MVLayoutParams implements IMapViewLayoutParams { private MapView.LayoutParams mReal; public MVLayoutParams(int width, int height, IGeoPoint point, int alignment) { mReal = new MapView.LayoutParams(width, height, (GeoPoint) (point == null ? null : point.real()), alignment); } public MVLayoutParams(MapView.LayoutParams params) { mReal = params; } @Override public Object real() { return mReal; } @Override public int getWidth() { return mReal.width; } @Override public int getHeight() { return mReal.height; } @Override public IGeoPoint getPoint() { return new ANGeoPoint(mReal.point); } @Override public void setPoint(IGeoPoint point) { mReal.point = (GeoPoint) point.real(); } @Override public int getAlignment() { return mReal.alignment; } @Override public int getMode() { return mReal.mode; } } }