use of org.osmdroid.views.overlay.Overlay in project osmbonuspack by MKergall.
the class MapActivity method updateUIWithRoads.
void updateUIWithRoads(Road[] roads) {
mRoadNodeMarkers.getItems().clear();
TextView textView = (TextView) findViewById(R.id.routeInfo);
textView.setText("");
List<Overlay> mapOverlays = map.getOverlays();
if (mRoadOverlays != null) {
for (int i = 0; i < mRoadOverlays.length; i++) mapOverlays.remove(mRoadOverlays[i]);
mRoadOverlays = null;
}
if (roads == null)
return;
if (roads[0].mStatus == Road.STATUS_TECHNICAL_ISSUE)
Toast.makeText(map.getContext(), "Technical issue when getting the route", Toast.LENGTH_SHORT).show();
else if (// functional issues
roads[0].mStatus > Road.STATUS_TECHNICAL_ISSUE)
Toast.makeText(map.getContext(), "No possible route here", Toast.LENGTH_SHORT).show();
mRoadOverlays = new Polyline[roads.length];
for (int i = 0; i < roads.length; i++) {
Polyline roadPolyline = RoadManager.buildRoadOverlay(roads[i]);
mRoadOverlays[i] = roadPolyline;
if (mWhichRouteProvider == GRAPHHOPPER_BICYCLE || mWhichRouteProvider == GRAPHHOPPER_PEDESTRIAN) {
Paint p = roadPolyline.getPaint();
p.setPathEffect(new DashPathEffect(new float[] { 10, 5 }, 0));
}
String routeDesc = roads[i].getLengthDurationText(this, -1);
roadPolyline.setTitle(getString(R.string.route) + " - " + routeDesc);
roadPolyline.setInfoWindow(new BasicInfoWindow(org.osmdroid.bonuspack.R.layout.bonuspack_bubble, map));
roadPolyline.setRelatedObject(i);
roadPolyline.setOnClickListener(new RoadOnClickListener());
mapOverlays.add(1, roadPolyline);
// we insert the road overlays at the "bottom", just above the MapEventsOverlay,
// to avoid covering the other overlays.
}
selectRoad(0);
}
use of org.osmdroid.views.overlay.Overlay in project osmbonuspack by MKergall.
the class KmlFolder method buildOverlay.
/**
* Build a FolderOverlay, containing (recursively) overlays from all items of this Folder.
* @param map
* @param defaultStyle to apply when an item has no Style defined.
* @param styler to apply
* @param kmlDocument for Styles
* @return the FolderOverlay built
*/
@Override
public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlDocument kmlDocument) {
FolderOverlay folderOverlay = new FolderOverlay();
folderOverlay.setName(mName);
folderOverlay.setDescription(mDescription);
for (KmlFeature k : mItems) {
Overlay overlay = k.buildOverlay(map, defaultStyle, styler, kmlDocument);
if (overlay != null)
folderOverlay.add(overlay);
}
if (styler == null)
folderOverlay.setEnabled(mVisibility);
else
styler.onFeature(folderOverlay, this);
return folderOverlay;
}
Aggregations