Package Roots

Class 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
      class  MapRoot.MapBridge
      The Map bridge which is used by the HTML
    • Constructor Summary

      Constructors 
      Constructor Description
      MapRoot()
      Instantiates a new Map root.
    • Method Summary

      Modifier and Type Method Description
      private java.lang.String getApiKey()
      Method that gets Google Maps Javascript API key Used in 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
      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.
      (package private) void setLayout()
      Sets the layout of the Map root.
      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
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • MapRoot

        MapRoot()
        Instantiates a new Map root.
    • 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.
        Overrides:
        setLayout in class SceneRoot
      • 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