use of org.osmdroid.views.overlay.Overlay in project osmbonuspack by MKergall.
the class MapActivity method updateUIWithPolygon.
// add or replace the polygon overlay
public void updateUIWithPolygon(ArrayList<GeoPoint> polygon, String name) {
List<Overlay> mapOverlays = map.getOverlays();
int location = -1;
if (mDestinationPolygon != null)
location = mapOverlays.indexOf(mDestinationPolygon);
mDestinationPolygon = new Polygon();
mDestinationPolygon.setFillColor(0x15FF0080);
mDestinationPolygon.setStrokeColor(0x800000FF);
mDestinationPolygon.setStrokeWidth(5.0f);
mDestinationPolygon.setTitle(name);
BoundingBox bb = null;
if (polygon != null) {
mDestinationPolygon.setPoints(polygon);
bb = BoundingBox.fromGeoPoints(polygon);
}
if (location != -1)
mapOverlays.set(location, mDestinationPolygon);
else
// insert just above the MapEventsOverlay.
mapOverlays.add(1, mDestinationPolygon);
setViewOn(bb);
map.invalidate();
}
use of org.osmdroid.views.overlay.Overlay in project osmbonuspack by MKergall.
the class FolderZOverlay method draw.
// TODO:
// get highest z-index => getMaxZIndex
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
if (shadow)
return;
Iterator<ZOverlay> itr = mList.iterator();
while (itr.hasNext()) {
ZOverlay item = itr.next();
Overlay overlay = item.mOverlay;
if (overlay != null && overlay.isEnabled()) {
if (item.shouldBeDrawn(mapView.getBoundingBox(), mapView.getMapOrientation())) {
overlay.draw(canvas, mapView, false);
}
}
}
}
use of org.osmdroid.views.overlay.Overlay in project osmbonuspack by MKergall.
the class KmlMultiGeometry method buildOverlay.
/**
* Build a FolderOverlay containing all overlays from this MultiGeometry items
*/
@Override
public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlPlacemark kmlPlacemark, KmlDocument kmlDocument) {
FolderOverlay folderOverlay = new FolderOverlay();
for (KmlGeometry k : mItems) {
Overlay overlay = k.buildOverlay(map, defaultStyle, styler, kmlPlacemark, kmlDocument);
folderOverlay.add(overlay);
}
return folderOverlay;
}
use of org.osmdroid.views.overlay.Overlay in project collect by opendatakit.
the class GeoTraceOsmMapActivityTest method testLocationClientLifecycle.
@Test
public void testLocationClientLifecycle() {
activityController.create();
activityController.start();
verify(locationClient).start();
when(locationClient.isLocationAvailable()).thenReturn(true);
ArrayList<Overlay> overlays = new ArrayList<>();
when(mapView.getOverlays()).thenReturn(overlays);
// When the LocationClient starts, add the overlay and enable location:
activity.onClientStart();
verify(locationClient).requestLocationUpdates(activity);
assertFalse(overlays.isEmpty());
verify(locationOverlay).setEnabled(true);
verify(locationOverlay).enableMyLocation();
activity.setModeActive(true);
GeoPoint geoPoint = mock(GeoPoint.class);
when(locationOverlay.getMyLocation()).thenReturn(geoPoint);
activity.onLocationChanged(newMockLocation());
verify(mapController).setCenter(geoPoint);
activityController.stop();
verify(locationClient).stop();
}
use of org.osmdroid.views.overlay.Overlay in project iGap-Android by KianIranian-STDG.
the class FragmentiGapMap method clickDrawMarkActive.
/**
* activation map for show mark after each tap
*/
private void clickDrawMarkActive() {
Overlay touchOverlay = new Overlay() {
ItemizedIconOverlay<OverlayItem> anotherItemizedIconOverlay = null;
@Override
public void draw(Canvas arg0, MapView arg1, boolean arg2) {
}
@Override
public boolean onSingleTapConfirmed(final MotionEvent e, final MapView mapView) {
drawMark(e, mapView);
return true;
}
@Override
public boolean onLongPress(MotionEvent e, MapView mapView) {
// drawMark(e, mapView);
return super.onLongPress(e, mapView);
}
};
map.getOverlays().add(touchOverlay);
}
Aggregations