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

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

Introduction

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

Prototype

public static final EncodedPolyline newInstance(String points, int zoomFactor, String levels, int numLevels) 

Source Link

Document

Create a new encoded polyline.

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