Example usage for com.google.gwt.maps.client.overlay EncodedPolyline setColor

List of usage examples for com.google.gwt.maps.client.overlay EncodedPolyline setColor

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.overlay EncodedPolyline setColor.

Prototype

public final native void setColor(String colorIn) ;

Source Link

Document

Sets the color of the Polyline .

Usage

From source file:org.onebusaway.webapp.gwt.where_library.view.stops.TransitMapManager.java

License:Apache License

public void showStopsForRoute(RouteBean route, StopsForRouteBean stopsForRoute, boolean centerViewOnRoute) {

    reset(false, stopsForRoute.getStops());
    _selectedRoute = route;//w  ww  . j a v  a  2 s  .c  o m

    for (EncodedPolylineBean path : stopsForRoute.getPolylines()) {

        EncodedPolyline epl = EncodedPolyline.newInstance(path.getPoints(), 32, path.getLevels(3), 4);
        epl.setColor("#4F64BA");
        epl.setWeight(3);
        epl.setOpacity(1.0);
        Polyline polyline = Polyline.fromEncoded(epl);
        _manager.addOverlay(polyline);
        _otherOverlays.add(polyline);
    }

    if (centerViewOnRoute) {
        System.out.println("center on route");
        // Center the map on the bounds of the route
        LatLngBounds bounds = LatLngBounds.newInstance();
        for (StopBean stop : stopsForRoute.getStops())
            bounds.extend(LatLng.newInstance(stop.getLat(), stop.getLon()));

        if (!bounds.isEmpty()) {
            int zoomLevel = _map.getBoundsZoomLevel(bounds);
            _map.setCenter(bounds.getCenter(), zoomLevel);
        }
    }
}