Class OwlMapControl

java.lang.Object
provided.owlMaps.control.impl.OwlMapControl
All Implemented Interfaces:
IOwlMapControl

public class OwlMapControl
extends java.lang.Object
implements IOwlMapControl
The main map controlling and instantiating entity of the OwlMaps system. Instantiate the OwlMapControl first, which will instantiate the map when started. Once the map has been created, OwlMapControl provides factories for all other map components. In an RMI-based system, the OwlMapControl should be instantiated after the RMI system has started.
Author:
swong
  • Field Summary

    Fields
    Modifier and Type Field Description
    private ICefUtils cefUtils
    The IJsUtils utility to use
    private static java.lang.String defaultPage
    Location of default map parent page file
    private java.lang.String googleMapsApiKey
    The local Google Maps API key to use
    private java.util.function.Consumer<java.lang.String> loggerFn
    Logging strategy to log to outside entities
    private IMapComponentFactory mapComponentFac
    The current IMapComponentFactory object
    private IOwlMap owlMap
    The current IOwlMap object
    private IOwlMapUtils owlMapUtils
    The IOwlMapUtils that is tied to this instance of the system.
    private MapLengthUnits systemLengthUnit
    The current length unit being used by the system.
  • Constructor Summary

    Constructors
    Constructor Description
    OwlMapControl​(java.lang.String googleMapsApiKey, MapLengthUnits systemLengthUnit, java.util.function.Consumer<java.lang.String> loggerFn)
    Instantiate the OwlMapControl
  • Method Summary

    Modifier and Type Method Description
    IOwlMap getMap()
    Get the map object
    IMapComponentFactory getMapComponentFactory()
    Get the current IMapComponentFactory object
    IOwlMapUtils getMapUtils()
    Get the IOwlMapUtils configured for this system.
    private IMapComponentFactory makeMapComponentFactory​(ICefUtils cefUtils)
    Make a new IMapComponentFactory object
    private IOwlMap makeOwlMap​(ICefUtils cefUtils)
    Make a new IOwlMap using the given IJsUtils utility.
    void resetMap​(provided.mixedData.IMixedDataDictionary mapOptions, java.lang.Runnable onMapLoad)
    Experimental method.
    void setMakeDevTools​(boolean makeDevTools)
    Enables the display of the browser dev console window
    javax.swing.JComponent start​(provided.mixedData.IMixedDataDictionary mapOptions, java.lang.Runnable onMapLoad)
    Make the map JComponent and start the mapping system.
    void stop()
    Stop the map engine.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • defaultPage

      private static final java.lang.String defaultPage
      Location of default map parent page file
      See Also:
      Constant Field Values
    • googleMapsApiKey

      private java.lang.String googleMapsApiKey
      The local Google Maps API key to use
    • loggerFn

      private java.util.function.Consumer<java.lang.String> loggerFn
      Logging strategy to log to outside entities
    • owlMap

      private IOwlMap owlMap
      The current IOwlMap object
    • mapComponentFac

      private IMapComponentFactory mapComponentFac
      The current IMapComponentFactory object
    • cefUtils

      private ICefUtils cefUtils
      The IJsUtils utility to use
    • systemLengthUnit

      private MapLengthUnits systemLengthUnit
      The current length unit being used by the system.
    • owlMapUtils

      private IOwlMapUtils owlMapUtils
      The IOwlMapUtils that is tied to this instance of the system.
  • Constructor Details

    • OwlMapControl

      public OwlMapControl​(java.lang.String googleMapsApiKey, MapLengthUnits systemLengthUnit, java.util.function.Consumer<java.lang.String> loggerFn)
      Instantiate the OwlMapControl
      Parameters:
      googleMapsApiKey - The Google Maps API key to use
      loggerFn - An consumer to log strings to an external entity
      systemLengthUnit - The length unit to use by the system.
  • Method Details

    • getMapUtils

      public IOwlMapUtils getMapUtils()
      Get the IOwlMapUtils configured for this system.
      Specified by:
      getMapUtils in interface IOwlMapControl
      Returns:
      an IOwlMapUtils instance
    • start

      public javax.swing.JComponent start​(provided.mixedData.IMixedDataDictionary mapOptions, java.lang.Runnable onMapLoad) throws java.lang.ClassNotFoundException
      Make the map JComponent and start the mapping system. THIS METHOD MUST BE RUN FROM THE GUI THREAD!!
      Specified by:
      start in interface IOwlMapControl
      Parameters:
      mapOptions - A dictionary of IMapOptions to use when creating the map
      onMapLoad - A Runnable to run when the map has finished loading.
      Returns:
      A JComponent that will display the map.
      Throws:
      java.lang.ClassNotFoundException - If an unknown map option is encountered
    • resetMap

      public void resetMap​(provided.mixedData.IMixedDataDictionary mapOptions, java.lang.Runnable onMapLoad)
      Experimental method. Not fully implemented yet.
      Parameters:
      mapOptions - New options for the map
      onMapLoad - Callback for when the map reloads
    • getMap

      public IOwlMap getMap()
      Get the map object
      Specified by:
      getMap in interface IOwlMapControl
      Returns:
      The map object
    • makeOwlMap

      private IOwlMap makeOwlMap​(ICefUtils cefUtils)
      Make a new IOwlMap using the given IJsUtils utility. Note that the underlying Javascript map has already been made.
      Parameters:
      cefUtils - The IJsUtils utility to use
      Returns:
      A new IOwlMap object
    • stop

      public void stop()
      Stop the map engine. Must be called when app exits or engine will keep running.
      Specified by:
      stop in interface IOwlMapControl
    • getMapComponentFactory

      public IMapComponentFactory getMapComponentFactory()
      Get the current IMapComponentFactory object
      Specified by:
      getMapComponentFactory in interface IOwlMapControl
      Returns:
      The current IMapComponentFactory object
    • makeMapComponentFactory

      private IMapComponentFactory makeMapComponentFactory​(ICefUtils cefUtils)
      Make a new IMapComponentFactory object
      Parameters:
      cefUtils - The IJsUtils utility to use
      Returns:
      A new IMapComponentFactory object
    • setMakeDevTools

      public void setMakeDevTools​(boolean makeDevTools)
      Description copied from interface: IOwlMapControl
      Enables the display of the browser dev console window
      Specified by:
      setMakeDevTools in interface IOwlMapControl
      Parameters:
      makeDevTools - If true, show the dev console window