1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| public class CalqueSites extends ItemizedOverlay<OverlayItem> {
..............
public CalqueSites(Drawable marker, Context context) {
super(marker);
this.marker = marker;
this.context = context;
marqueur = this.context.getResources().getDrawable(
R.drawable.flagexport);
marqueur.setBounds(0, 0, marqueur.getIntrinsicWidth(),
marqueur.getIntrinsicHeight());
marqueurInt = this.context.getResources().getDrawable(
R.drawable.flaginter);
marqueurInt.setBounds(0, 0, marqueurInt.getIntrinsicWidth(),
marqueurInt.getIntrinsicHeight());
marqueurFin = this.context.getResources().getDrawable(
R.drawable.flagfinal);
marqueurFin.setBounds(0, 0, marqueurFin.getIntrinsicWidth(),
marqueurFin.getIntrinsicHeight());
}
@Override
public boolean onTouchEvent(MotionEvent event, MapView mapView) {
final int action = event.getAction();
GeoPoint p = mapView.getProjection().fromPixels(
(int) event.getX(), (int) event.getY());
OverlayItem step = new OverlayItem(GeoTools.makeGeoPoint(
p.getLatitudeE6() / 1E6, p.getLongitudeE6() / 1E6), "",
"");
if (type == "Begin") {
step.setMarker(marqueur);
} else if (type == "Nothing") {
step.setMarker(marqueurInt);
} else if (type == "End") {
step.setMarker(marqueurFin);
}
items.add(step);
populate();
return false;
}
.........
} |
Partager