Example usage for com.google.gwt.maps.client.overlay Polyline fromEncoded

List of usage examples for com.google.gwt.maps.client.overlay Polyline fromEncoded

Introduction

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

Prototype

public static Polyline fromEncoded(EncodedPolyline polyline) 

Source Link

Document

Create a polyline from an encoded string.

Usage

From source file:org.onebusaway.webapp.gwt.tripplanner_library.view.TripBeanMapPresenter.java

License:Apache License

private Polyline getPathAsPolyline(EncodedPolylineBean path) {
    EncodedPolyline epl = EncodedPolyline.newInstance(path.getPoints(), 32, path.getLevels(3), 4);
    return Polyline.fromEncoded(epl);
}

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  w ww  .  j  a  v  a  2 s .c om

    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);
        }
    }
}