001    package com.google.gwt.maps.client.services;
002    
003    import com.google.gwt.core.client.JavaScriptObject;
004    import com.google.gwt.core.client.JsArray;
005    import com.google.gwt.maps.client.base.LatLng;
006    
007    /**
008     * A single leg consisting of a set of steps in a DirectionsResult. Some fields in the leg may not be returned for all requests. (This object was formerly known as "DirectionsRoute".) Note that though this result is "JSON-like," it is not strictly JSON, as it directly and indirectly includes LatLng objects.
009     * <br><br>
010     * See <a href="https://developers.google.com/maps/documentation/javascript/reference#DirectionsLeg">DirectionsLeg API Doc</a>
011     */
012    public class DirectionsLeg extends JavaScriptObject {
013      
014      /**
015       * use newInstance();
016       */
017      protected DirectionsLeg() {}
018      
019      /**
020       * A single leg consisting of a set of steps in a DirectionsResult. Some fields in the leg may not be returned for all requests. (This object was formerly known as "DirectionsRoute".) Note that though this result is "JSON-like," it is not strictly JSON, as it directly and indirectly includes LatLng objects.
021       */
022      public static final DirectionsLeg newInstance() {
023        return JavaScriptObject.createObject().cast();
024      }
025    
026      /**
027       * The total distance covered by this leg. This property may be undefined as the distance may be unknown.
028       * @param distance
029       */
030      public final native void setDistance(Distance distance) /*-{
031        this.distance = distance;
032      }-*/;
033      
034      /**
035       * The total distance covered by this leg. This property may be undefined as the distance may be unknown.
036       */
037      public final native Distance getDistance() /*-{
038        return this.distance;
039      }-*/;
040      
041      /**
042       * The total duration of this leg. This property may be undefined as the duration may be unknown.
043       * @param duration
044       */
045      public final native void setDuration(Duration duration) /*-{
046        this.duration = duration;
047      }-*/;
048      
049      /**
050       * The total duration of this leg. This property may be undefined as the duration may be unknown.
051       */
052      public final native Duration getDuration() /*-{
053        return this.duration;
054      }-*/;
055      
056      /**
057       * The address of the destination of this leg.
058       * @param end_address
059       */
060      public final native void setEnd_Address(String end_address) /*-{
061        this.end_address = end_address;
062      }-*/;
063      
064      /**
065       * The address of the destination of this leg.
066       */
067      public final native String getEnd_Address() /*-{
068        return this.end_address;
069      }-*/;
070    
071      /**
072       * The DirectionsService calculates directions between locations by using the nearest transportation option (usually a road) at the start and end locations. end_location indicates the actual geocoded destination, which may be different than the end_location of the last step if, for example, the road is not near the destination of this leg.
073       * @param end_location
074       */
075      public final native void setEnd_Location(LatLng end_location) /*-{
076        this.end_location = end_location;
077      }-*/;
078      
079      /**
080       * The DirectionsService calculates directions between locations by using the nearest transportation option (usually a road) at the start and end locations. end_location indicates the actual geocoded destination, which may be different than the end_location of the last step if, for example, the road is not near the destination of this leg.
081       */
082      public final native LatLng getEnd_Location() /*-{
083        return this.end_location;
084      }-*/;
085      
086      /**
087       * The address of the origin of this leg.
088       * @param start_address
089       */
090      public final native void setStart_Address(String start_address) /*-{
091        this.start_address = start_address;
092      }-*/;
093      
094      /**
095       * The address of the origin of this leg.
096       */
097      public final native String getStart_Address() /*-{
098        return this.start_address;
099      }-*/;
100      
101      /**
102       * The DirectionsService calculates directions between locations by using the nearest transportation option (usually a road) at the start and end locations. start_location indicates the actual geocoded origin, which may be different than the start_location of the first step if, for example, the road is not near the origin of this leg.
103       * @param start_location
104       */
105      public final native void setStart_Location(LatLng start_location) /*-{
106        this.start_location = start_location;
107      }-*/;
108      
109      /**
110       * The DirectionsService calculates directions between locations by using the nearest transportation option (usually a road) at the start and end locations. start_location indicates the actual geocoded origin, which may be different than the start_location of the first step if, for example, the road is not near the origin of this leg.
111       */
112      public final native LatLng getStart_Location() /*-{
113        return this.start_location;
114      }-*/;
115      
116      /**
117       * An array of DirectionsSteps, each of which contains information about the individual steps in this leg.
118       * @param steps
119       */
120      public final native void setSteps(JsArray<DirectionsStep> steps) /*-{
121        this.steps = steps;
122      }-*/;
123      
124      /**
125       * An array of DirectionsSteps, each of which contains information about the individual steps in this leg.
126       */
127      public final native JsArray<DirectionsStep> getSteps() /*-{
128        return this.steps;
129      }-*/;
130      
131      /**
132       * An array of waypoints along this leg that were not specified in the original request, either as a result of a user dragging the polyline or selecting an alternate route.
133       * @param via_waypoints
134       */
135      public final native void setVia_Waypoints(JsArray<LatLng> via_waypoints) /*-{
136        this.via_waypoints = via_waypoints;
137      }-*/;
138     
139      /**
140       * An array of waypoints along this leg that were not specified in the original request, either as a result of a user dragging the polyline or selecting an alternate route.
141       */
142      public final native JsArray<LatLng> getVia_Waypoints() /*-{
143        return this.via_waypoints;
144      }-*/;
145      
146    }