Top Inners Fields Constructors Methods
com.dlsc.gmapsfx

public Class GoogleMapView

extends AnchorPane
Class Inheritance
Known Direct Subclasses
com.dlsc.gmapsfx.ClusteredGoogleMapView
Imports
com.dlsc.gmapsfx.javascript.JavaFxWebEngine, .JavascriptRuntime, com.dlsc.gmapsfx.javascript.event.MapStateEventType, com.dlsc.gmapsfx.javascript.object.DirectionsPane, .GoogleMap, .LatLong, .MapOptions, java.util.ArrayList, .List, java.util.concurrent.CountDownLatch, .CyclicBarrier, javafx.application.Platform, javafx.beans.value.ChangeListener, .ObservableValue, javafx.concurrent.Worker, javafx.event.Event, .EventDispatchChain, .EventDispatcher, javafx.geometry.Point2D, javafx.scene.input.MouseEvent, javafx.scene.layout.AnchorPane, javafx.scene.web.WebEngine, .WebView, netscape.javascript.JSObject, org.slf4j.Logger, .LoggerFactory, org.w3c.dom.Document, .Element, .Text

Author
Rob Terpilowski

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
public class

Field Summary

Modifier and TypeField and Description
protected final CyclicBarrier
protected DirectionsPane
protected boolean
protected static final String
protected static final String
protected boolean
protected String
protected final String
private static final Logger
protected GoogleMap
protected final List<MapComponentInitializedListener>
protected final List<MapReadyListener>
protected final String
private boolean
protected JavaFxWebEngine
protected WebView

Constructor Summary

AccessConstructor and Description
public
public
GoogleMapView(boolean debug)

public
GoogleMapView(String mapResourcePath)

Allows for the creation of the map using external resources from another jar for the html page and markers.

public
GoogleMapView(String mapResourcePath, boolean
true if the FireBug pane should be displayed in the WebView.
debug
)

Creates a new map view and specifies if the FireBug pane should be displayed in the WebView

public
GoogleMapView(String
map display language, null for default
language
,
String
Google Maps API key or null
key
)

Creates a new map view and specifies the display language and API key.

public
GoogleMapView(String mapResourcePath, String
map display language, null for default
language
,
String
Google Maps API key or null
key
,
boolean
true if the FireBug pane should be displayed in the WebView.
debug
)

Creates a new map view and specifies the display language and API key.

public
GoogleMapView(String mapResourcePath, String
map display language, null for default
language
,
String region, String
Google Maps API key or null
key
,
boolean
true if the FireBug pane should be displayed in the WebView.
debug
)

Creates a new map view and specifies the display language and API key.

Method Summary

Modifier and TypeMethod and Description
public void
public void
protected void
public GoogleMap
createMap(MapOptions mapOptions)

public GoogleMap
public GoogleMap
createMap(boolean withDirectionsPanel)

public GoogleMap
createMap(MapOptions mapOptions, boolean withDirectionsPanel)

protected JSObject
executeJavascript(String function)
References Deprecated JSObject is deprecated or references (maybe indirectly) at least one deprecated element.

protected void
protected void
public Point2D
public DirectionsPane
protected String
getHtmlFile(boolean debug)

protected String
getJavascriptMethod(String methodName, Object... args)

public GoogleMap
public WebView
private void
protected GoogleMap
protected GoogleMap
public boolean
private void
public void
panBy(double x, double y)

public void
public void
public void
setCenter(double latitude, double longitude)

public void
setDisableDoubleClick(boolean disableDoubleClick)

private void
setFont(WebEngine webEngine)

protected void
setInitialized(boolean initialized)

public void
public void
setZoom(int zoom)

Inherited from javafx.scene.layout.AnchorPane:
clearConstraintscomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthgetBottomAnchorgetLeftAnchorgetRightAnchorgetTopAnchorlayoutChildrensetBottomAnchorsetLeftAnchorsetRightAnchorsetTopAnchor

Field Detail

barrierback to summary
protected final CyclicBarrier barrier
direcback to summary
protected DirectionsPane direc
disableDoubleClickback to summary
protected boolean disableDoubleClick
GOOGLE_MAPS_API_VERSIONback to summary
protected static final String GOOGLE_MAPS_API_VERSION
initializedback to summary
protected boolean initialized
keyback to summary
protected String key
languageback to summary
protected final String language
LOGback to summary
private static final Logger LOG
mapback to summary
protected GoogleMap map
mapInitializedListenersback to summary
protected final List<MapComponentInitializedListener> mapInitializedListeners
mapReadyListenersback to summary
protected final List<MapReadyListener> mapReadyListeners
regionback to summary
protected final String region
usingCustomHtmlback to summary
private boolean usingCustomHtml
webengineback to summary
protected JavaFxWebEngine webengine
webviewback to summary
protected WebView webview

Constructor Detail

GoogleMapViewback to summary
public GoogleMapView()
GoogleMapViewback to summary
public GoogleMapView(boolean debug)
GoogleMapViewback to summary
public GoogleMapView(String mapResourcePath)

Allows for the creation of the map using external resources from another jar for the html page and markers. The map html page must be sourced from the jar containing any marker images for those to function.

The html page is, at it's simplest: null <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>My Map</title> <style> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } </style> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> </head> <body> <div id="map-canvas"></div> </body> </html>

If you store this file in your project jar, under my.gmapsfx.project.resources as mymap.html then you should call using "/my/gmapsfx/project/resources/mymap.html" for the mapResourcePath.

Your marker images should be stored in the same folder as, or below the map file. You then reference them using relative notation. If you put them in a subpackage "markers" you would create your MarkerOptions object as follows: null myMarkerOptions.position(myLatLong) .title("My Marker") .icon("markers/mymarker.png") .visible(true);

GoogleMapViewback to summary
public GoogleMapView(String mapResourcePath, boolean debug)

Creates a new map view and specifies if the FireBug pane should be displayed in the WebView

Parameters
debug:boolean

true if the FireBug pane should be displayed in the WebView.

GoogleMapViewback to summary
public GoogleMapView(String language, String key)

Creates a new map view and specifies the display language and API key.

Parameters
language:String

map display language, null for default

key:String

Google Maps API key or null

GoogleMapViewback to summary
public GoogleMapView(String mapResourcePath, String language, String key, boolean debug)

Creates a new map view and specifies the display language and API key.

Parameters
language:String

map display language, null for default

key:String

Google Maps API key or null

debug:boolean

true if the FireBug pane should be displayed in the WebView.

GoogleMapViewback to summary
public GoogleMapView(String mapResourcePath, String language, String region, String key, boolean debug)

Creates a new map view and specifies the display language and API key.

If you are specifying your own HTML page for mapResourcePath in a jar of your own then you should include a script element to pull in the Google Maps API with any API keys, language and region parameters.

Parameters
language:String

map display language, null for default

key:String

Google Maps API key or null

debug:boolean

true if the FireBug pane should be displayed in the WebView.

Method Detail

addMapInitializedListenerback to summary
public void addMapInitializedListener(MapComponentInitializedListener listener)
addMapReadyListenerback to summary
public void addMapReadyListener(MapReadyListener listener)
checkInitializedback to summary
protected void checkInitialized()
createMapback to summary
public GoogleMap createMap(MapOptions mapOptions)
createMapback to summary
public GoogleMap createMap()
createMapback to summary
public GoogleMap createMap(boolean withDirectionsPanel)
createMapback to summary
public GoogleMap createMap(MapOptions mapOptions, boolean withDirectionsPanel)
executeJavascriptback to summary
protected JSObject executeJavascript(String function)

References Deprecated

JSObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

fireMapInitializedListenersback to summary
protected void fireMapInitializedListeners()
fireMapReadyListenersback to summary
protected void fireMapReadyListeners()
fromLatLngToPointback to summary
public Point2D fromLatLngToPoint(LatLong loc)
getDirecback to summary
public DirectionsPane getDirec()
getHtmlFileback to summary
protected String getHtmlFile(boolean debug)
getJavascriptMethodback to summary
protected String getJavascriptMethod(String methodName, Object... args)
getMapback to summary
public GoogleMap getMap()
getWebviewback to summary
public WebView getWebview()
initialiseScriptback to summary
private void initialiseScript()
internal_createMapback to summary
protected GoogleMap internal_createMap()
internal_createMapback to summary
protected GoogleMap internal_createMap(MapOptions mapOptions)
isDisableDoubleClickback to summary
public boolean isDisableDoubleClick()
mapResizedback to summary
private void mapResized()
panByback to summary
public void panBy(double x, double y)
removeMapInitializedListenerback to summary
public void removeMapInitializedListener(MapComponentInitializedListener listener)
removeReadyListenerback to summary
public void removeReadyListener(MapReadyListener listener)
setCenterback to summary
public void setCenter(double latitude, double longitude)
setDisableDoubleClickback to summary
public void setDisableDoubleClick(boolean disableDoubleClick)
setFontback to summary
private void setFont(WebEngine webEngine)
setInitializedback to summary
protected void setInitialized(boolean initialized)
setKeyback to summary
public void setKey(String key)
setZoomback to summary
public void setZoom(int zoom)
com.dlsc.gmapsfx back to summary

public Class GoogleMapView.MapLibraryLoadBridge

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MapLibraryLoadBridgeback to summary
public MapLibraryLoadBridge()

Method Detail

mapLibraryLoadedback to summary
public void mapLibraryLoaded()
com.dlsc.gmapsfx back to summary

public Class GoogleMapView.MyEventDispatcher

extends Object
implements EventDispatcher
Class Inheritance
All Implemented Interfaces
javafx.event.EventDispatcher

Field Summary

Modifier and TypeField and Description
private final EventDispatcher

Constructor Summary

AccessConstructor and Description
public
MyEventDispatcher(EventDispatcher originalDispatcher)

Method Summary

Modifier and TypeMethod and Description
public Event
dispatchEvent(Event
the event do dispatch
event
,
EventDispatchChain
the rest of the chain to dispatch event to
tail
)

Implements javafx.event.EventDispatcher.dispatchEvent.

Dispatches the specified event by this EventDispatcher.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

originalDispatcherback to summary
private final EventDispatcher originalDispatcher

Constructor Detail

MyEventDispatcherback to summary
public MyEventDispatcher(EventDispatcher originalDispatcher)

Method Detail

dispatchEventback to summary
public Event dispatchEvent(Event event, EventDispatchChain tail)

Implements javafx.event.EventDispatcher.dispatchEvent.

Doc from javafx.event.EventDispatcher.dispatchEvent.

Dispatches the specified event by this EventDispatcher. Does any required event processing. Both the event and its further path can be modified in this method. If the event is not handled / consumed during the capturing phase, it should be dispatched to the rest of the chain (event = tail.dispatch(event);).

Parameters
event:Event

the event do dispatch

tail:EventDispatchChain

the rest of the chain to dispatch event to

Returns:Event

the return event or null if the event has been handled / consumed

Annotations
@Override