public class GoogleMap extends JavascriptObject
| Type | Property and Description |
|---|---|
javafx.beans.property.ReadOnlyObjectProperty<LatLongBounds> |
bounds
A property tied to the map, updated when the idle state event is fired.
|
javafx.beans.property.ReadOnlyObjectProperty<LatLong> |
center |
javafx.beans.property.IntegerProperty |
zoom |
| Modifier and Type | Field and Description |
|---|---|
protected static String |
divArg |
protected MapOptions |
options |
jsObject, objectCounter, peerRegistry, runtime, variableName| Constructor and Description |
|---|
GoogleMap() |
GoogleMap(MapOptions mapOptions) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMapShape(MapShape shape) |
void |
addMarker(Marker marker)
Adds the supplied marker to the map.
|
void |
addMarkers(Collection<Marker> col)
Adds all of the markers in the supplied collection to the map.
|
void |
addMarkers(Collection<Marker> col,
UIEventType type,
javafx.util.Callback<Marker,UIEventHandler> h) |
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.
|
void |
addStateEventHandler(MapStateEventType type,
StateEventHandler h)
Adds a handler for a state type event on the map.
|
void |
addUIEventHandler(JavascriptObject obj,
UIEventType type,
UIEventHandler h)
Adds a handler for a mouse type event on the map.
|
void |
addUIEventHandler(UIEventType type,
UIEventHandler h)
Adds a handler for a mouse type event on the map.
|
protected void |
addUIHandler(JavascriptObject obj,
UIEventType type,
GFXEventHandler h) |
javafx.beans.property.ReadOnlyObjectProperty<LatLongBounds> |
boundsProperty()
A property tied to the map, updated when the idle state event is fired.
|
javafx.beans.property.ReadOnlyObjectProperty<LatLong> |
centerProperty() |
void |
clearMarkers()
Removes all of the markers from the map.
|
void |
fitBounds(LatLongBounds bounds)
Moves the map to ensure the given bounds fit within the viewport.
|
javafx.geometry.Point2D |
fromLatLngToPoint(LatLong loc)
Returns the screen point for the provided LatLong.
|
LatLongBounds |
getBounds()
Returns the LatLongBounds of the visual area.
|
LatLong |
getCenter()
Gets the value of the property center.
|
double |
getHeading() |
Projection |
getProjection() |
int |
getZoom()
Gets the value of the property zoom.
|
void |
hideDirectionsPane() |
protected void |
initialize() |
void |
panBy(double x,
double y)
Pans the map by the supplied values.
|
void |
panTo(LatLong latLong)
Pans the map to the specified latitude and longitude.
|
void |
panToBounds(LatLongBounds bounds) |
void |
removeMapShape(MapShape shape) |
void |
removeMarker(Marker marker)
Removes the supplied marker from the map.
|
void |
removeMarkers(Collection<Marker> col)
Removes the markers in the supplied collection from the map.
|
void |
setCenter(LatLong latLong)
Sets the value of the property center.
|
void |
setHeading(double heading) |
void |
setMapType(MapTypeIdEnum type)
Sets the map type.
|
void |
setZoom(int zoom)
Sets the value of the property zoom.
|
void |
showDirectionsPane() |
javafx.beans.property.IntegerProperty |
zoomProperty() |
checkBoolean, checkInteger, checkUndefined, getJSObject, getNextVariableName, getProperty, getProperty, getVariableName, invokeJavascript, invokeJavascript, invokeJavascriptReturnValue, invokeJavascriptReturnValue, isMemberDefined, setProperty, setProperty, setPropertypublic javafx.beans.property.IntegerProperty zoomProperty
getZoom(),
setZoom(int)public final javafx.beans.property.ReadOnlyObjectProperty<LatLong> centerProperty
getCenter(),
setCenter(LatLong)public final javafx.beans.property.ReadOnlyObjectProperty<LatLongBounds> boundsProperty
getBounds()protected MapOptions options
protected static String divArg
public GoogleMap()
public GoogleMap(MapOptions mapOptions)
protected void initialize()
public void setZoom(int zoom)
public int getZoom()
public void showDirectionsPane()
public void hideDirectionsPane()
public javafx.beans.property.IntegerProperty zoomProperty()
getZoom(),
setZoom(int)public final javafx.beans.property.ReadOnlyObjectProperty<LatLong> centerProperty()
getCenter(),
setCenter(LatLong)public LatLong getCenter()
public void setCenter(LatLong latLong)
public LatLongBounds getBounds()
public void fitBounds(LatLongBounds bounds)
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.
bounds - public void panToBounds(LatLongBounds bounds)
public final javafx.beans.property.ReadOnlyObjectProperty<LatLongBounds> boundsProperty()
getBounds()public void setHeading(double heading)
public double getHeading()
public void addMarker(Marker marker)
marker - public void removeMarker(Marker marker)
marker - public void clearMarkers()
public void addMarkers(Collection<Marker> col)
col - public void addMarkers(Collection<Marker> col, UIEventType type, javafx.util.Callback<Marker,UIEventHandler> h)
public void removeMarkers(Collection<Marker> col)
col - public void setMapType(MapTypeIdEnum type)
type - public void addMapShape(MapShape shape)
public void removeMapShape(MapShape shape)
public Projection getProjection()
public void panBy(double x,
double y)
x - delta x value in pixels.y - delta y value in pixels.public void panTo(LatLong latLong)
latLong - public javafx.geometry.Point2D fromLatLngToPoint(LatLong loc)
One workaround is to only operate off bounds_changed events.
loc - public void addUIEventHandler(UIEventType type, UIEventHandler h)
type - Type of the event to register against.h - Handler that will be called when the event occurs.public void addUIEventHandler(JavascriptObject obj, UIEventType type, UIEventHandler h)
obj - The object that the event should be registered on.type - Type of the event to register against.h - Handler that will be called when the event occurs.public void addMouseEventHandler(UIEventType type, MouseEventHandler h)
type - The type of event to listen forh - The MouseEventHandler that will handle the event.protected void addUIHandler(JavascriptObject obj, UIEventType type, GFXEventHandler h)
public void addStateEventHandler(MapStateEventType type, StateEventHandler h)
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.
type - Type of the event to register against.h - Handler that will be called when the event occurs.Copyright © 2017. All rights reserved.