Package provided.owlMaps.control.impl
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 useprivate static java.lang.String
defaultPage
Location of default map parent page fileprivate java.lang.String
googleMapsApiKey
The local Google Maps API key to useprivate java.util.function.Consumer<java.lang.String>
loggerFn
Logging strategy to log to outside entitiesprivate IMapComponentFactory
mapComponentFac
The current IMapComponentFactory objectprivate IOwlMap
owlMap
The current IOwlMap objectprivate 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 objectIMapComponentFactory
getMapComponentFactory()
Get the current IMapComponentFactory objectIOwlMapUtils
getMapUtils()
Get the IOwlMapUtils configured for this system.private IMapComponentFactory
makeMapComponentFactory(ICefUtils cefUtils)
Make a new IMapComponentFactory objectprivate 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 windowjavax.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 defaultPageLocation of default map parent page file- See Also:
- Constant Field Values
-
googleMapsApiKey
private java.lang.String googleMapsApiKeyThe local Google Maps API key to use -
loggerFn
private java.util.function.Consumer<java.lang.String> loggerFnLogging strategy to log to outside entities -
owlMap
The current IOwlMap object -
mapComponentFac
The current IMapComponentFactory object -
cefUtils
The IJsUtils utility to use -
systemLengthUnit
The current length unit being used by the system. -
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 useloggerFn
- An consumer to log strings to an external entitysystemLengthUnit
- The length unit to use by the system.
-
-
Method Details
-
getMapUtils
Get the IOwlMapUtils configured for this system.- Specified by:
getMapUtils
in interfaceIOwlMapControl
- Returns:
- an IOwlMapUtils instance
-
start
public javax.swing.JComponent start(provided.mixedData.IMixedDataDictionary mapOptions, java.lang.Runnable onMapLoad) throws java.lang.ClassNotFoundExceptionMake the map JComponent and start the mapping system. THIS METHOD MUST BE RUN FROM THE GUI THREAD!!- Specified by:
start
in interfaceIOwlMapControl
- Parameters:
mapOptions
- A dictionary of IMapOptions to use when creating the maponMapLoad
- 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 maponMapLoad
- Callback for when the map reloads
-
getMap
Get the map object- Specified by:
getMap
in interfaceIOwlMapControl
- Returns:
- The map object
-
makeOwlMap
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 interfaceIOwlMapControl
-
getMapComponentFactory
Get the current IMapComponentFactory object- Specified by:
getMapComponentFactory
in interfaceIOwlMapControl
- Returns:
- The current IMapComponentFactory object
-
makeMapComponentFactory
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 interfaceIOwlMapControl
- Parameters:
makeDevTools
- If true, show the dev console window
-