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.
Java Source Code
package com.dennytech.smartmap;
/*www.java2s.com*/import android.graphics.drawable.Drawable;
import com.dennytech.smartmap.impl.autonavi.ANItemizedOverlay;
import com.dennytech.smartmap.impl.google.GoogleItemizedOverlay;
publicabstractclass SMItemizedOverlay implements IItemizedOverlay,
ItemizedOverlayCallBack {
IItemizedOverlay mWrapper;
public SMItemizedOverlay(SMMapFragment mapFragment, Drawable defaultMarker) {
if (mapFragment.getActivity() instanceof com.amap.mapapi.map.MapActivity) {
mWrapper = new ANItemizedOverlay(defaultMarker, this);
} else {
mWrapper = new GoogleItemizedOverlay(defaultMarker, this);
}
}
@Override
finalpublicvoid populate() {
mWrapper.populate();
}
@Override
public Object real() {
return mWrapper.real();
}
@Override
public Drawable getDefaultMarker() {
return mWrapper.getDefaultMarker();
}
@Override
publicabstract IOverlayItem createItem(int i);
@Override
publicabstractint size();
// //////////////////////////////////////////////////////////////////////////////////////
// Notice: You must call #boundCenter or #boundCenterBottom for Marker of overlayItem,
// otherwise the icon will not show.
// //////////////////////////////////////////////////////////////////////////////////////
publicstatic Drawable boundCenter(Drawable balloon) {
balloon.setBounds(-balloon.getIntrinsicWidth() / 2,
-balloon.getIntrinsicHeight() / 2,
balloon.getIntrinsicWidth() / 2,
balloon.getIntrinsicHeight() / 2);
return balloon;
}
publicstatic Drawable boundCenterBottom(Drawable balloon) {
balloon.setBounds(-balloon.getIntrinsicWidth() / 2,
-balloon.getIntrinsicHeight(), balloon.getIntrinsicWidth() / 2,
0);
return balloon;
}
@Override
publicboolean onTap(int index) {
return false;
}
}