Package Roots
Class MapRoot
- java.lang.Object
-
- Roots.SceneRoot
-
- Roots.MapRoot
-
final class MapRoot extends SceneRoot
Class for the map root, where the map with all the photo locations is displayed
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classMapRoot.MapBridgeThe Map bridge which is used by the HTML
-
Field Summary
Fields Modifier and Type Field Description private MapRoot.MapBridgeMAP_BRIDGEprivate java.util.List<Photo>PHOTO_LISTprivate javafx.scene.layout.StackPaneSTACK_PANEprivate javafx.scene.web.WebViewWEB_VIEW
-
Constructor Summary
Constructors Constructor Description MapRoot()Instantiates a new Map root.
-
Method Summary
Modifier and Type Method Description private java.lang.StringgetApiKey()Method that gets Google Maps Javascript API key Used in getHtmlprivate java.lang.StringgetHtml()Get a html string which creates a map with markers where the uploaded photos was photographed Used in setUpMapprivate java.lang.StringgetMarkerSize(Photo photo)Calculates size of the map marker based on the photo's width and height to avoid stretching the photo.(package private) voidsetLayout()Sets the layout of the Map root.private voidsetUpMap()Sets up the the webview by loading the html and initialising a listener which makes it possible to call methods in MapBridge from the javascript Used in setLayout-
Methods inherited from class Roots.SceneRoot
getBorderPane, getGridPane, setGridPane, setPageTitle
-
-
-
-
Field Detail
-
PHOTO_LIST
private final java.util.List<Photo> PHOTO_LIST
-
WEB_VIEW
private final javafx.scene.web.WebView WEB_VIEW
-
STACK_PANE
private final javafx.scene.layout.StackPane STACK_PANE
-
MAP_BRIDGE
private final MapRoot.MapBridge MAP_BRIDGE
-
-
Method Detail
-
setLayout
void setLayout()
Sets the layout of the Map root. The setLayout() method from SceneRoot is overridden, but also called in the method in order to modify the method.
-
setUpMap
private void setUpMap()
Sets up the the webview by loading the html and initialising a listener which makes it possible to call methods in MapBridge from the javascript Used in setLayout
-
getHtml
private java.lang.String getHtml()
Get a html string which creates a map with markers where the uploaded photos was photographed Used in setUpMap- Returns:
- string with HTML
-
getMarkerSize
private java.lang.String getMarkerSize(Photo photo)
Calculates size of the map marker based on the photo's width and height to avoid stretching the photo. Used in getHtml- Parameters:
photo- the photo- Returns:
- string with width and height separated by a comma
-
getApiKey
private java.lang.String getApiKey()
Method that gets Google Maps Javascript API key Used in getHtml- Returns:
- returns a string with the API key
-
-