001    package com.google.gwt.maps.client.services;
002    
003    import com.google.gwt.core.client.JavaScriptObject;
004    import com.google.gwt.dom.client.Element;
005    import com.google.gwt.maps.client.MapImpl;
006    import com.google.gwt.maps.client.MapWidget;
007    import com.google.gwt.maps.client.overlays.InfoWindow;
008    import com.google.gwt.maps.client.overlays.MarkerOptions;
009    import com.google.gwt.maps.client.overlays.PolylineOptions;
010    
011    /**
012     * This object defines the properties that can be set on a DirectionsRenderer object.
013     * <br><br>
014     * See <a href="https://developers.google.com/maps/documentation/javascript/reference#DirectionsRendererOptions">DirectionsRendererOptions API Doc</a>
015     */
016    public class DirectionsRendererOptions extends JavaScriptObject {
017      
018      /**
019       * use newInstance();
020       */
021      protected DirectionsRendererOptions() {}
022      
023      /**
024       * This object defines the properties that can be set on a DirectionsRenderer object.
025       */
026      public static final DirectionsRendererOptions newInstance() {
027        return JavaScriptObject.createObject().cast();
028      }
029    
030      /**
031       * The directions to display on the map and/or in a <code>&lt;div&gt;</code> panel, retrieved as a DirectionsResult object from DirectionsService.
032       * @param directions
033       */
034      public final native void setDirections(DirectionsResult directions) /*-{
035        this.directions = directions;
036      }-*/;
037      
038      /**
039       * The directions to display on the map and/or in a <code>&lt;div&gt;</code> panel, retrieved as a DirectionsResult object from DirectionsService.
040       */
041      public final native DirectionsResult getDirections() /*-{
042        return this.directions;
043      }-*/;
044      
045      /**
046       * If true, allows the user to drag and modify the paths of routes rendered by this DirectionsRenderer.
047       * @param draggable
048       */
049      public final native void setDraggable(boolean draggable) /*-{
050        this.draggable = draggable;
051      }-*/;
052      
053      /**
054       * If true, allows the user to drag and modify the paths of routes rendered by this DirectionsRenderer.
055       */
056      public final native boolean getDraggable() /*-{
057        return this.draggable;
058      }-*/;
059      
060      /**
061       * This property indicates whether the renderer should provide UI to select amongst alternative routes. By default, this flag is false and a user-selectable list of routes will be shown in the directions' associated panel. To hide that list, set hideRouteList to true. 
062       * @param hideRouteList
063       */
064      public final native void setHideRouteList(boolean hideRouteList) /*-{
065        this.hideRouteList = hideRouteList;
066      }-*/;
067      
068      /**
069       * This property indicates whether the renderer should provide UI to select amongst alternative routes. By default, this flag is false and a user-selectable list of routes will be shown in the directions' associated panel. To hide that list, set hideRouteList to true.
070       */
071      public final native boolean getHideRouteList() /*-{
072        return hideRouteList;
073      }-*/;
074      
075      /**
076       * The InfoWindow in which to render text information when a marker is clicked. Existing info window content will be overwritten and its position moved. If no info window is specified, the DirectionsRenderer will create and use its own info window. This property will be ignored if suppressInfoWindows is set to true.
077       * @param infoWindow
078       */
079      public final native void setInfoWindow(InfoWindow infoWindow) /*-{
080        this.infoWindow = infoWindow;
081      }-*/;
082      
083      /**
084       * The InfoWindow in which to render text information when a marker is clicked. Existing info window content will be overwritten and its position moved. If no info window is specified, the DirectionsRenderer will create and use its own info window. This property will be ignored if suppressInfoWindows is set to true.
085       */
086      public final native InfoWindow getInfoWindow() /*-{
087        return this.infoWindow;
088      }-*/;
089      
090      /**
091       * Map on which to display the directions.
092       * @param mapWidget
093       */
094      public final void setMap(MapWidget mapWidget) {
095        setMapImpl(mapWidget.getJso());
096      }
097    
098      private final native void setMapImpl(MapImpl map) /*-{
099        this.map = map;
100      }-*/;
101      
102      /**
103       * Map on which to display the directions.
104       */
105      public final MapWidget getMapWidget() {
106        return MapWidget.newInstance(getMapImpl());
107      }
108      
109      private final native MapImpl getMapImpl() /*-{
110        return this.map;
111      }-*/;
112      
113      /**
114       * Options for the markers. All markers rendered by the DirectionsRenderer will use these options.
115       * @param markerOptions
116       */
117      public final native void setMarkerOptions(MarkerOptions markerOptions) /*-{
118        this.markerOptions = markerOptions;
119      }-*/;
120      
121      /**
122       * Options for the markers. All markers rendered by the DirectionsRenderer will use these options.
123       */
124      public final native MarkerOptions getMarkerOptions() /*-{
125        return this.markerOptions;
126      }-*/;
127      
128      /**
129       * The <code>&lt;div&gt;</code> in which to display the directions steps.
130       * @param panel
131       */
132      public final native void setPanel(Element panel) /*-{
133        this.panel = panel;
134      }-*/;
135      
136      /**
137       * The <code>&lt;div&gt;</code> in which to display the directions steps.
138       */
139      public final native Element getPanel() /*-{
140        return this.panel;
141      }-*/;
142      
143      /**
144       * Options for the polylines. All polylines rendered by the DirectionsRenderer will use these options.
145       * @param polylineOptions
146       */
147      public final native void setPolylineOptions(PolylineOptions polylineOptions) /*-{
148        this.polylineOptions = polylineOptions;
149      }-*/;
150      
151      /**
152       * Options for the polylines. All polylines rendered by the DirectionsRenderer will use these options.
153       */
154      public final native PolylineOptions getPolylineOptions() /*-{
155        return this.polylineOptions;
156      }-*/;
157      
158      /**
159       * By default, the input map is centered and zoomed to the bounding box of this set of directions. If this option is set to true, the viewport is left unchanged, unless the map's center and zoom were never set.
160       * @param preserveViewport
161       */
162      public final native void setPreserveViewport(boolean preserveViewport) /*-{
163        this.preserveViewport = preserveViewport;
164      }-*/;
165      
166      /**
167       * By default, the input map is centered and zoomed to the bounding box of this set of directions. If this option is set to true, the viewport is left unchanged, unless the map's center and zoom were never set.
168       */
169      public final native boolean getPreserveViewport() /*-{
170        return this.preserveViewport;
171      }-*/;
172      
173      /**
174       * The index of the route within the DirectionsResult object. The default value is 0.
175       * @param routeIndex
176       */
177      public final native void setRouteIndex(int routeIndex) /*-{
178        this.routeIndex = routeIndex;
179      }-*/;
180      
181      /**
182       * The index of the route within the DirectionsResult object. The default value is 0.
183       */
184      public final native int getRouteIndex() /*-{
185        return this.routeIndex;
186      }-*/;
187      
188      /**
189       * Suppress the rendering of the BicyclingLayer when bicycling directions are requested.
190       * @param suppressBicyclingLayer
191       */
192      public final native void setSuppressBicyclingLayer(boolean suppressBicyclingLayer) /*-{
193        this.suppressBicyclingLayer = suppressBicyclingLayer;
194      }-*/;
195      
196      /**
197       * Suppress the rendering of the BicyclingLayer when bicycling directions are requested.
198       */
199      public final native boolean getSuppressBicyclingLayer() /*-{
200        return this.suppressBicyclingLayer;
201      }-*/;
202      
203      /**
204       * Suppress the rendering of info windows.
205       * @param suppressInfoWindows
206       */
207      public final native void setSuppressInfoWindows(boolean suppressInfoWindows) /*-{
208        this.suppressInfoWindows = suppressInfoWindows;
209      }-*/;
210      
211      /**
212       * Suppress the rendering of info windows.
213       */
214      public final native boolean getSuppressInfoWindows() /*-{
215        return this.suppressInfoWindows;
216      }-*/;
217      
218      /**
219       * Suppress the rendering of markers.
220       * @param suppressMarkers
221       */
222      public final native void setSuppressMarkers(boolean suppressMarkers) /*-{
223        this.suppressMarkers = suppressMarkers;
224      }-*/;
225      
226      /**
227       * Suppress the rendering of markers.
228       */
229      public final native boolean getSuppressMarkers() /*-{
230        return this.suppressMarkers;
231      }-*/;
232      
233      /**
234       * Suppress the rendering of polylines.
235       * @param suppressPolylines
236       */
237      public final native void setSuppressPolylines(boolean suppressPolylines) /*-{
238        this.suppressPolylines = suppressPolylines;
239      }-*/;
240      
241      /**
242       * Suppress the rendering of polylines.
243       */
244      public final native boolean getSuppressPolylines() /*-{
245        return this.suppressPolylines;
246      }-*/;
247        
248    }