Example usage for com.google.gwt.maps.client.services UnitSystem METRIC

List of usage examples for com.google.gwt.maps.client.services UnitSystem METRIC

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.services UnitSystem METRIC.

Prototype

UnitSystem METRIC

To view the source code for com.google.gwt.maps.client.services UnitSystem METRIC.

Click Source Link

Document

Specifies that distances in the DirectionsResult should be expressed in metric units.

Usage

From source file:net.cbtltd.client.field.RouteField.java

public void setValue(String value) {
    String args[] = value.split("-");
    DirectionsRequest rq = DirectionsRequest.newInstance();
    rq.setAvoidHighways(false);/*from   w  ww.  ja v a 2  s .  c  om*/
    rq.setAvoidTolls(true);
    rq.setOrigin(args[0]);
    rq.setDestination(args[1]);
    if (args.length > 2) {
        rq.setRegion(args[2]);
    }
    rq.setOptimizeWaypoints(true);
    rq.setProvideRouteAlternatives(false);
    rq.setTravelMode(TravelMode.DRIVING);
    rq.setUnitSystem(UnitSystem.METRIC);

    DirectionsService directions = DirectionsService.newInstance();
    directions.route(rq, new DirectionsResultHandler() {
        public void onCallback(DirectionsResult rs, DirectionsStatus status) {
            setResult(rs);
        }
    });
}