}
@Override
public MapModel getMapModelFromTrip(Trip trip) throws ServiceException {
MapModel mapModel = new DefaultMapModel();
List<Point> pointList = getPointsForTrip(trip);
if (pointList.isEmpty()) {
pointList = this.loadAndPersistGoogleData(trip);
}
Polyline polyline = new Polyline();
polyline.getPaths().addAll(pointList);
Marker beginMarker = new Marker(pointList.get(0), trip.getWaypoint()
.getFromLocation().getCity());
Marker endMarker = new Marker(pointList.get(pointList.size() - 1), trip
.getWaypoint().getToLocation().getCity());
polyline.setStrokeWeight(10);
polyline.setStrokeColor("#FF9900");
polyline.setStrokeOpacity(0.7);
mapModel.addOverlay(beginMarker);
mapModel.addOverlay(polyline);
mapModel.addOverlay(endMarker);
return mapModel;
}