String path = leg.getPath();
if (path != null) {
List<CoordinatePoint> points = PolylineEncoder.decode(path);
EncodedPolylineBean bean = PolylineEncoder.createEncodings(points);
Polyline line = getPathAsPolyline(bean);
PolyStyleOptions style = PolyStyleOptions.newInstance("#0000FF", 4,
0.5);
line.setStrokeStyle(style);
resultingOverlays.add(line);
addBoundsToBounds(line.getBounds(), bounds);
}
StopBean stop = leg.getFromStop();
if (stop != null) {
String routeName = leg.getRouteShortName();
TripPlannerResources resources = TripPlannerResources.INSTANCE;
SpanPanel w = new SpanPanel();
w.addStyleName(_css.routeTinyInfoWindow());
Image image = new Image(resources.getBus14x14().getUrl());
image.addStyleName(_css.routeModeIcon());
w.add(image);
SpanWidget name = new SpanWidget(routeName);
name.setStyleName(_css.routeName());
w.add(name);
LatLng point = LatLng.newInstance(stop.getLat(), stop.getLon());
TinyInfoWindowMarker marker = new TinyInfoWindowMarker(point, w);
resultingOverlays.add(marker);
bounds.extend(point);
}
} else if (mode.equals("walk")) {
List<StreetLegBean> streetLegs = segment.getStreetLegs();
List<CoordinatePoint> allPoints = new ArrayList<CoordinatePoint>();
for (StreetLegBean streetLeg : streetLegs) {
String path = streetLeg.getPath();
List<CoordinatePoint> points = PolylineEncoder.decode(path);
allPoints.addAll(points);
}
EncodedPolylineBean polyline = PolylineEncoder.createEncodings(allPoints);
Polyline line = getPathAsPolyline(polyline);
PolyStyleOptions style = PolyStyleOptions.newInstance("#000000", 4, 0.8);
line.setStrokeStyle(style);
resultingOverlays.add(line);