Class TLcyMapManager
- All Implemented Interfaces:
ILcyMapManager
,ILcdPropertyChangeSource
ILcyMapManager
this class is a collection of
ILcyMapComponent
s with one map being the active map. It also adds the mutable property
AsynchronousPaintFacade
, which makes working with or without asynchronous painting
transparent.
Note that this map manager only deals with ILcyMapComponent
s, which are 2D.
For other map components, refer to TLcyCombinedMapManager
, or a specific
TLcyGenericMapManager
for the map component type you are interested in.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMapComponent
(ILcyMapComponent aMapComponent) Adds the given map to thisILcyMapManager
.void
addMapManagerListener
(ILcyMapManagerListener aMapManagerListener) Adds the givenILcyMapManagerListener
to thisILcyMapManager
.void
addMapManagerListener
(ILcyMapManagerListener aListener, boolean aFireEventForExistingMaps) Adds the givenILcyGeneralMapManagerListener
to thisTLcyGeneralMapManager
.void
addPropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) Registers the givenPropertyChangeListener
to be notified when this object's properties change.protected void
fireMapManagerEvent
(TLcyMapManagerEvent aMapManagerEvent) Fires the given event to all associated listeners.protected void
firePropertyChange
(String aPropertyName, Object aOldValue, Object aNewValue) Fires a property change event.Returns null, or the activeILcyMapComponent
.Returns the facade that is used for painting layers asynchronously.getMapComponent
(int aIndex) Returns theILcyMapComponent
at the given index.int
Returns the number of currently existingILcyMapComponent
s.void
removeMapComponent
(ILcyMapComponent aMapComponent) Removes the given map from thisILcyMapManager
.void
removeMapManagerListener
(ILcyMapManagerListener aMapManagerListener) Removes the givenILcyMapManagerListener
to thisILcyMapManager
.void
removePropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) De-registers the givenPropertyChangeListener
from receiving property change events for this object.void
setActiveMapComponent
(ILcyMapComponent aActiveMapComponent) Sets the active map component.void
setAsynchronousPaintFacade
(ALcyAsynchronousPaintFacade aAsynchronousPaintFacade) Sets the facade that is used for painting layers asynchronously.
-
Constructor Details
-
TLcyMapManager
public TLcyMapManager()Creates a newTLcyMapManager
. There is normally no need to use this constructor, the map manager is usually retrieved usingILcyLucyEnv.getMapManager()
.
-
-
Method Details
-
addPropertyChangeListener
Description copied from interface:ILcdPropertyChangeSource
Registers the given
PropertyChangeListener
to be notified when this object's properties change.In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source, you can use a
ALcdWeakPropertyChangeListener
instance as property change listener.- Specified by:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- The listener to be notified- See Also:
-
removePropertyChangeListener
Description copied from interface:ILcdPropertyChangeSource
De-registers the given
PropertyChangeListener
from receiving property change events for this object.If the listener was added more than once, it will be notified one less time after being removed. If the listener is
null
, or was never added, no exception is thrown and no action is taken.- Specified by:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- the listener that should no longer be notified of changes of this object's properties- See Also:
-
firePropertyChange
Fires a property change event. This method must be invoked after a property has been changed.- Parameters:
aPropertyName
- The property name. First letter is lower case, unless there are at least two capitals in the beginning. E.g. for setSelectedIndex, aPropertyName must be "selectedIndex". For setXYWorldReference, aPropertyName must be "XYWorldReference".aOldValue
- The old value of the property.aNewValue
- The new value of the property.
-
addMapManagerListener
Description copied from interface:ILcyMapManager
Adds the givenILcyMapManagerListener
to thisILcyMapManager
.- Specified by:
addMapManagerListener
in interfaceILcyMapManager
- Parameters:
aMapManagerListener
- The listener to add.
-
addMapManagerListener
public void addMapManagerListener(ILcyMapManagerListener aListener, boolean aFireEventForExistingMaps) Adds the given
ILcyGeneralMapManagerListener
to thisTLcyGeneralMapManager
.For every existing map a MAP_COMPONENT_ADDED event will be fired to
aListener
whenaFireEventForExistingMaps
istrue
. A use-case for this is when you want to use the listener to perform an action on any existing map and on all future maps.- Parameters:
aListener
- The listener to be registeredaFireEventForExistingMaps
-true
whenaListener
must be warned about all existing maps,false
otherwise- See Also:
-
removeMapManagerListener
Description copied from interface:ILcyMapManager
Removes the givenILcyMapManagerListener
to thisILcyMapManager
.- Specified by:
removeMapManagerListener
in interfaceILcyMapManager
- Parameters:
aMapManagerListener
- The listener to remove.
-
getMapComponentCount
public int getMapComponentCount()Description copied from interface:ILcyMapManager
Returns the number of currently existingILcyMapComponent
s.- Specified by:
getMapComponentCount
in interfaceILcyMapManager
- Returns:
- the number of currently existing
ILcyMapComponent
s.
-
getMapComponent
Description copied from interface:ILcyMapManager
Returns theILcyMapComponent
at the given index.- Specified by:
getMapComponent
in interfaceILcyMapManager
- Parameters:
aIndex
- the index of theILcyMapComponent
to return.- Returns:
- the
ILcyMapComponent
at the given index.
-
addMapComponent
Adds the given map to thisILcyMapManager
. Whenever a newILcyMapComponent
is instantiated, this method needs to be invoked. The responsibility to do this belongs to whoever created the map, for example theTLcyMapAddOn
.Once an
ILcdMapComponent
has been removed, it must not be re-added.- Specified by:
addMapComponent
in interfaceILcyMapManager
- Parameters:
aMapComponent
- TheILcyMapComponent
to add.- See Also:
-
removeMapComponent
Removes the given map from thisILcyMapManager
. Whenever aILcyMapComponent
is removed, this method needs to be invoked. The responsibility to do this belongs to whoever disposed the map, for example theTLcyMapAddOn
.Once an
ILcdMapComponent
has been removed, it must not be re-added.- Specified by:
removeMapComponent
in interfaceILcyMapManager
- Parameters:
aMapComponent
- TheILcyMapComponent
to remove.- See Also:
-
fireMapManagerEvent
Fires the given event to all associated listeners.- Parameters:
aMapManagerEvent
- The event to fire.
-
getActiveMapComponent
Description copied from interface:ILcyMapManager
Returns null, or the activeILcyMapComponent
. The active map is the one that the user is working on, or has recently worked on. The active map component is typically null if there are no maps.- Specified by:
getActiveMapComponent
in interfaceILcyMapManager
- Returns:
- null, or the active
ILcyMapComponent
.
-
setActiveMapComponent
Description copied from interface:ILcyMapManager
Sets the active map component. This property is typically set by the responsible for the maps, for example theTLcyMapAddOn
, as the user starts working on a different map. Fires a property change event.- Specified by:
setActiveMapComponent
in interfaceILcyMapManager
- Parameters:
aActiveMapComponent
- The active map component, or null.
-
getAsynchronousPaintFacade
Returns the facade that is used for painting layers asynchronously. The facade allows writing code that can transparently handle both synchronous and asynchronous painting.- Returns:
- a facade for painting layers asynchronously
- See Also:
-
setAsynchronousPaintFacade
Sets the facade that is used for painting layers asynchronously.- Parameters:
aAsynchronousPaintFacade
- a facade to be used when painting layers asynchronously- See Also:
-