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

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

Introduction

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

Prototype

public final native void setOpacity(double opacityIn) ;

Source Link

Document

Sets the opacity 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;//from  ww  w  .  j a  va 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);
        }
    }
}