Top Fields Constructors Methods
com.dlsc.gmapsfx.javascript.object

public Class GoogleMap

extends JavascriptObject
Class Inheritance
Known Direct Subclasses
com.dlsc.gmapsfx.javascript.object.ClusteredGoogleMap
Imports
com.dlsc.gmapsfx.javascript.JavascriptObject, .JavascriptRuntime, com.dlsc.gmapsfx.javascript.event.EventHandlers, .GFXEventHandler, .MapStateEventType, .MouseEventHandler, .StateEventHandler, .UIEventHandler, .UIEventType, java.util.Collection, .HashSet, .Set, javafx.beans.property.IntegerProperty, .ReadOnlyObjectProperty, .ReadOnlyObjectWrapper, .SimpleIntegerProperty, javafx.beans.value.ObservableValue, javafx.geometry.Point2D, javafx.util.Callback, netscape.javascript.JSObject

Author
Rob Terpilowski

Field Summary

Modifier and TypeField and Description
private ReadOnlyObjectWrapper<LatLongBounds>
private ReadOnlyObjectWrapper<LatLong>
protected static String
private final EventHandlers
private boolean
private Set<Marker>
protected MapOptions
private boolean
private boolean
private IntegerProperty
Inherited from com.dlsc.gmapsfx.javascript.JavascriptObject:
jsObjectobjectCounterpeerRegistryruntimevariableName

Constructor Summary

AccessConstructor and Description
public
public
GoogleMap(MapOptions mapOptions)

Method Summary

Modifier and TypeMethod and Description
public void
public void
addMarker(Marker marker)

Adds the supplied marker to the map.

public void
addMarkers(Collection<Marker> col)

Adds all of the markers in the supplied collection to the map.

public void
public void
addMouseEventHandler(UIEventType
The type of event to listen for
type
,
MouseEventHandler
The MouseEventHandler that will handle the event.
h
)

Adds a handler for a mouse type event and returns an object that does not require interaction with the underlying Javascript API.

public void
addStateEventHandler(MapStateEventType
Type of the event to register against.
type
,
StateEventHandler
Handler that will be called when the event occurs.
h
)

Adds a handler for a state type event on the map.

public void
addUIEventHandler(UIEventType
Type of the event to register against.
type
,
UIEventHandler
Handler that will be called when the event occurs.
h
)

Adds a handler for a mouse type event on the map.

public void
addUIEventHandler(JavascriptObject
The object that the event should be registered on.
obj
,
UIEventType
Type of the event to register against.
type
,
UIEventHandler
Handler that will be called when the event occurs.
h
)

Adds a handler for a mouse type event on the map.

protected void
public final ReadOnlyObjectProperty<LatLongBounds>
boundsProperty()

A property tied to the map, updated when the idle state event is fired.

public final ReadOnlyObjectProperty<LatLong>
public void
clearMarkers()

Removes all of the markers from the map.

public void
fitBounds(LatLongBounds bounds)

Moves the map to ensure the given bounds fit within the viewport.

public Point2D
fromLatLngToPoint(LatLong loc)

Returns the screen point for the provided LatLong.

public LatLongBounds
getBounds()

Returns the LatLongBounds of the visual area.

public LatLong
public double
public Projection
public int
public void
protected void
private int
private void
internalSetZoom(int zoom)

public void
panBy(double
delta x value in pixels.
x
,
double
delta y value in pixels.
y
)

Pans the map by the supplied values.

public void
panTo(LatLong latLong)

Pans the map to the specified latitude and longitude.

public void
private String

Returns:

Callback key that Javascript will use to find this handler.
registerEventHandler
(GFXEventHandler
Event handler to be registered.
h
)

Registers an event handler in the repository shared between Javascript and Java.

public void
public void
removeMarker(Marker marker)

Removes the supplied marker from the map.

public void
removeMarkers(Collection<Marker> col)

Removes the markers in the supplied collection from the map.

public void
setCenter(LatLong latLong)

public void
setHeading(double heading)

public void
setMapType(MapTypeIdEnum type)

Sets the map type.

public void
setZoom(int zoom)

public void
public IntegerProperty
Inherited from com.dlsc.gmapsfx.javascript.JavascriptObject:
checkBooleancheckIntegercheckUndefinedgetJSObjectgetNextVariableNamegetPropertygetPropertygetVariableNameinvokeJavascriptinvokeJavascriptinvokeJavascriptReturnValueinvokeJavascriptReturnValueisMemberDefinedsetPropertysetPropertysetProperty

Field Detail

boundsback to summary
private ReadOnlyObjectWrapper<LatLongBounds> bounds
centerback to summary
private ReadOnlyObjectWrapper<LatLong> center
divArgback to summary
protected static String divArg
jsHandlersback to summary
private final EventHandlers jsHandlers
mapPromptedZoomChangeback to summary
private boolean mapPromptedZoomChange
markersback to summary
private Set<Marker> markers
optionsback to summary
protected MapOptions options
registeredOnJSback to summary
private boolean registeredOnJS
userPromptedZoomChangeback to summary
private boolean userPromptedZoomChange
zoomback to summary
private IntegerProperty zoom

Constructor Detail

GoogleMapback to summary
public GoogleMap()
GoogleMapback to summary
public GoogleMap(MapOptions mapOptions)

Method Detail

addMapShapeback to summary
public void addMapShape(MapShape shape)
addMarkerback to summary
public void addMarker(Marker marker)

Adds the supplied marker to the map.

addMarkersback to summary
public void addMarkers(Collection<Marker> col)

Adds all of the markers in the supplied collection to the map. Existing markers, if any, are retained.

addMarkersback to summary
public void addMarkers(Collection<Marker> col, UIEventType type, Callback<Marker, UIEventHandler> h)
addMouseEventHandlerback to summary
public void addMouseEventHandler(UIEventType type, MouseEventHandler h)

Adds a handler for a mouse type event and returns an object that does not require interaction with the underlying Javascript API.

Parameters
type:UIEventType

The type of event to listen for

h:MouseEventHandler

The MouseEventHandler that will handle the event.

addStateEventHandlerback to summary
public void addStateEventHandler(MapStateEventType type, StateEventHandler h)

Adds a handler for a state type event on the map.

We could allow this to handle any state event by adding a parameter JavascriptObject obj, but we would then need to loosen up the event type and either accept a String value, or fill an enum with all potential state events.

Parameters
type:MapStateEventType

Type of the event to register against.

h:StateEventHandler

Handler that will be called when the event occurs.

addUIEventHandlerback to summary
public void addUIEventHandler(UIEventType type, UIEventHandler h)

Adds a handler for a mouse type event on the map.

Parameters
type:UIEventType

Type of the event to register against.

h:UIEventHandler

Handler that will be called when the event occurs.

addUIEventHandlerback to summary
public void addUIEventHandler(JavascriptObject obj, UIEventType type, UIEventHandler h)

Adds a handler for a mouse type event on the map.

Parameters
obj:JavascriptObject

The object that the event should be registered on.

type:UIEventType

Type of the event to register against.

h:UIEventHandler

Handler that will be called when the event occurs.

addUIHandlerback to summary
protected void addUIHandler(JavascriptObject obj, UIEventType type, GFXEventHandler h)
boundsPropertyback to summary
public final ReadOnlyObjectProperty<LatLongBounds> boundsProperty()

A property tied to the map, updated when the idle state event is fired.

centerPropertyback to summary
public final ReadOnlyObjectProperty<LatLong> centerProperty()
clearMarkersback to summary
public void clearMarkers()

Removes all of the markers from the map.

fitBoundsback to summary
public void fitBounds(LatLongBounds bounds)

Moves the map to ensure the given bounds fit within the viewport.

Note that the Google Maps API will add a buffer around this value, so assuming you can store this and use it to later restore the view will give incorrect results. Calling map.fitBounds(map.getBounds()); will result in the map gradually zooming outward.

fromLatLngToPointback to summary
public Point2D fromLatLngToPoint(LatLong loc)

Returns the screen point for the provided LatLong.

Note

Unexpected results can be obtained if this method is called as a result of a zoom change, as the zoom event is fired before the bounds are updated, and bounds need to be used to obtain the answer!

One workaround is to only operate off bounds_changed events.

getBoundsback to summary
public LatLongBounds getBounds()

Returns the LatLongBounds of the visual area.

Note

on zoom changes the bounds are reset after the zoom event is fired, which can cause unexpected results.

getCenterback to summary
public LatLong getCenter()
getHeadingback to summary
public double getHeading()
getProjectionback to summary
public Projection getProjection()
getZoomback to summary
public int getZoom()
hideDirectionsPaneback to summary
public void hideDirectionsPane()
initializeback to summary
protected void initialize()
internalGetZoomback to summary
private int internalGetZoom()
internalSetZoomback to summary
private void internalSetZoom(int zoom)
panByback to summary
public void panBy(double x, double y)

Pans the map by the supplied values.

Parameters
x:double

delta x value in pixels.

y:double

delta y value in pixels.

panToback to summary
public void panTo(LatLong latLong)

Pans the map to the specified latitude and longitude.

panToBoundsback to summary
public void panToBounds(LatLongBounds bounds)
registerEventHandlerback to summary
private String registerEventHandler(GFXEventHandler h)

Registers an event handler in the repository shared between Javascript and Java.

Parameters
h:GFXEventHandler

Event handler to be registered.

Returns:String

Callback key that Javascript will use to find this handler.

removeMapShapeback to summary
public void removeMapShape(MapShape shape)
removeMarkerback to summary
public void removeMarker(Marker marker)

Removes the supplied marker from the map.

removeMarkersback to summary
public void removeMarkers(Collection<Marker> col)

Removes the markers in the supplied collection from the map.

setCenterback to summary
public void setCenter(LatLong latLong)
setHeadingback to summary
public void setHeading(double heading)
setMapTypeback to summary
public void setMapType(MapTypeIdEnum type)

Sets the map type. This is equivalent to the javascript method setMapTypeId.

setZoomback to summary
public void setZoom(int zoom)
showDirectionsPaneback to summary
public void showDirectionsPane()
zoomPropertyback to summary
public IntegerProperty zoomProperty()