If you think the Android project smartnavi 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 org.osmdroid.bonuspack.overlays;
/*www.java2s.com*/import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.view.MotionEvent;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.Overlay;
import org.osmdroid.views.overlay.OverlayManager;
import java.util.AbstractList;
/**
* An overlay which is just a group of other overlays.
*
* @author M.Kergall
*/publicclass FolderOverlay extends Overlay {
protected OverlayManager mOverlayManager;
protected String mName, mDescription;
public FolderOverlay(Context ctx) {
super(ctx);
mOverlayManager = new OverlayManager(null);
mName = "";
mDescription = "";
}
public String getName() {
return mName;
}
publicvoid setName(String name) {
mName = name;
}
public String getDescription() {
return mDescription;
}
publicvoid setDescription(String description) {
mDescription = description;
}
/**
* @return the list of components of this folder.
* Doesn't provide a copy, but the actual list.
*/public AbstractList<Overlay> getItems() {
return mOverlayManager;
}
publicboolean add(Overlay item) {
return mOverlayManager.add(item);
}
publicboolean remove(Overlay item) {
return mOverlayManager.remove(item);
}
@SuppressLint("WrongCall")
@Override
protectedvoid draw(Canvas canvas, MapView osm, boolean shadow) {
if (shadow)
return;
mOverlayManager.onDraw(canvas, osm);
}
@Override
publicboolean onSingleTapUp(MotionEvent e, MapView mapView) {
if (isEnabled())
return mOverlayManager.onSingleTapUp(e, mapView);
elsereturn false;
}
@Override
publicboolean onSingleTapConfirmed(MotionEvent e, MapView mapView) {
if (isEnabled())
return mOverlayManager.onSingleTapConfirmed(e, mapView);
elsereturn false;
}
@Override
publicboolean onLongPress(MotionEvent e, MapView mapView) {
if (isEnabled())
return mOverlayManager.onLongPress(e, mapView);
elsereturn false;
}
@Override
publicboolean onTouchEvent(MotionEvent e, MapView mapView) {
if (isEnabled())
return mOverlayManager.onTouchEvent(e, mapView);
elsereturn false;
}
//TODO: implement other events...
}