com.google.maps.gwt.client.DirectionsRenderer Maven / Gradle / Ivy
/*
* Copyright 2011 The Google Web Toolkit Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.maps.gwt.client;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.dom.client.Node;
/**
* Renders directions retrieved in the form of a
* DirectionsResult
*
* object retrieved from the
* DirectionsService
*
* .
*
* THIS SOURCE CODE IS GENERATED, DO NOT MODIFY
*/
public class DirectionsRenderer extends MVCObject {
/**
* This event is fired when the rendered directions change, either when a new
* DirectionsResult
*
* is set or when the user finishes dragging a change to the directions path.
*/
public interface DirectionsChangedHandler {
/**
* Override to handle event.
*/
void handle();
}
/**
* Creates the renderer with the given options. Directions can be
* rendered on a map (as visual overlays) or additionally on a
* <div>
*
* panel (as textual instructions).
*/
public static native DirectionsRenderer create(DirectionsRendererOptions opts)/*-{
var _opts;
if(@com.google.gwt.core.client.GWT::isScript()()) {
_opts = opts;
} else {
_opts = {};
for(k in opts) {
if(k != "__gwt_ObjectId") {
_opts[k] = opts[k];
}
}
}
return new $wnd.google.maps.DirectionsRenderer(_opts);
}-*/;
/**
* Creates the renderer with the given options. Directions can be
* rendered on a map (as visual overlays) or additionally on a
* <div>
*
* panel (as textual instructions).
*/
public static native DirectionsRenderer create()/*-{
return new $wnd.google.maps.DirectionsRenderer();
}-*/;
/**
* Protected constructor avoids default public constructor.
*/
protected DirectionsRenderer() {
/* Java constructor is protected, */
}
/**
* Adds the given listener function to the given event name for the
* given object instance. Returns an identifier for this listener that
* can be used with removeListener().
*/
public final native void addDirectionsChangedListener(DirectionsChangedHandler handler)/*-{
var _handler = $entry(function() {
handler.@com.google.maps.gwt.client.DirectionsRenderer.DirectionsChangedHandler::handle()();
});
$wnd.google.maps.event.addListener(this, "directions_changed", _handler);
}-*/;
/**
* Like addListener, but the handler removes itself after handling the first event.
*/
public final native void addDirectionsChangedListenerOnce(DirectionsChangedHandler handler)/*-{
var _handler = $entry(function() {
handler.@com.google.maps.gwt.client.DirectionsRenderer.DirectionsChangedHandler::handle()();
});
$wnd.google.maps.event.addListenerOnce(this, "directions_changed", _handler);
}-*/;
/**
* Removes all listeners for the given event for the given instance.
*/
public final native void clearDirectionsChangedListeners()/*-{
$wnd.google.maps.event.clearListeners(this, "directions_changed");
}-*/;
/**
* Removes all listeners for all events for the given instance.
*/
public final native void clearInstanceListeners()/*-{
$wnd.google.maps.event.clearInstanceListeners(this);
}-*/;
/**
* Returns the renderer's current set of directions.
*/
public final native DirectionsResult getDirections()/*-{
return this.getDirections();
}-*/;
/**
* Returns the map on which the
* DirectionsResult
*
* is rendered.
*/
public final native GoogleMap getMap()/*-{
return this.getMap();
}-*/;
/**
* Returns the panel
* <div>
*
* in which the
* DirectionsResult
*
* is rendered.
*/
public final native Node getPanel()/*-{
return this.getPanel();
}-*/;
/**
* Returns the current (zero-based) route index in use by this
* DirectionsRenderer
*
* object.
*/
public final native double getRouteIndex()/*-{
return this.getRouteIndex();
}-*/;
/**
* Set the renderer to use the result from the
* DirectionsService
*
* . Setting a valid set of directions in this manner will display the
* directions on the renderer's designated map and panel.
*/
public final native void setDirections(DirectionsResult directions)/*-{
this.setDirections(directions);
}-*/;
/**
* This method specifies the map on which directions will be rendered. Pass
* null
*
* to remove the directions from the map.
*/
public final native void setMap(GoogleMap map)/*-{
this.setMap(map);
}-*/;
/**
* Change the options settings of this
* DirectionsRenderer
*
* after initialization.
*/
public final native void setOptions(DirectionsRendererOptions options)/*-{
var _options;
if(@com.google.gwt.core.client.GWT::isScript()()) {
_options = options;
} else {
_options = {};
for(k in options) {
if(k != "__gwt_ObjectId") {
_options[k] = options[k];
}
}
}
this.setOptions(_options);
}-*/;
/**
* This method renders the directions in a
* <div>
*
* . Pass
* null
*
* to remove the content from the panel.
*/
public final native void setPanel(Node panel)/*-{
this.setPanel(panel);
}-*/;
/**
* Set the (zero-based) index of the route in the
* DirectionsResult
*
* object to render. By default, the first route in the array will be rendered.
*/
public final native void setRouteIndex(double routeIndex)/*-{
this.setRouteIndex(routeIndex);
}-*/;
/**
* Triggers the given event. All arguments after eventName are passed as
* arguments to the listeners.
*/
public final native void triggerDirectionsChanged(JavaScriptObject... varargs)/*-{
var _varargs =
@com.google.maps.gwt.client.ArrayHelper::toJsArray([Lcom/google/gwt/core/client/JavaScriptObject;)(varargs);
$wnd.google.maps.event.trigger(this, "directions_changed", _varargs);
}-*/;
}