public class TLcyMapManager extends Object implements ILcyMapManager
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.ALcyAsynchronousPaintFacade
Constructor and Description |
---|
TLcyMapManager()
Creates a new
TLcyMapManager . |
Modifier and Type | Method and Description |
---|---|
void |
addMapComponent(ILcyMapComponent aMapComponent)
Adds the given map to this
ILcyMapManager . |
void |
addMapManagerListener(ILcyMapManagerListener aMapManagerListener)
Adds the given
ILcyMapManagerListener to this ILcyMapManager . |
void |
addMapManagerListener(ILcyMapManagerListener aListener,
boolean aFireEventForExistingMaps)
Adds the given
ILcyGeneralMapManagerListener to this
TLcyGeneralMapManager . |
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Registers the given
PropertyChangeListener 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.
|
ILcyMapComponent |
getActiveMapComponent()
Returns null, or the active
ILcyMapComponent . |
ALcyAsynchronousPaintFacade |
getAsynchronousPaintFacade()
Returns the facade that is used for painting layers asynchronously.
|
ILcyMapComponent |
getMapComponent(int aIndex)
Returns the
ILcyMapComponent at the given index. |
int |
getMapComponentCount()
Returns the number of currently existing
ILcyMapComponent s. |
void |
removeMapComponent(ILcyMapComponent aMapComponent)
Removes the given map from this
ILcyMapManager . |
void |
removeMapManagerListener(ILcyMapManagerListener aMapManagerListener)
Removes the given
ILcyMapManagerListener to this ILcyMapManager . |
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
De-registers the given
PropertyChangeListener 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.
|
public TLcyMapManager()
TLcyMapManager
. There is normally no need to use this
constructor, the map manager is usually retrieved using
ILcyLucyEnv.getMapManager()
.public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
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.
addPropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- The listener to be notifiedALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
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.
removePropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- the listener that should no longer be notified of changes of
this object's propertiesILcdPropertyChangeSource.addPropertyChangeListener(java.beans.PropertyChangeListener)
protected void firePropertyChange(String aPropertyName, Object aOldValue, Object aNewValue)
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.public void addMapManagerListener(ILcyMapManagerListener aMapManagerListener)
ILcyMapManager
ILcyMapManagerListener
to this ILcyMapManager
.addMapManagerListener
in interface ILcyMapManager
aMapManagerListener
- The listener to add.public void addMapManagerListener(ILcyMapManagerListener aListener, boolean aFireEventForExistingMaps)
Adds the given ILcyGeneralMapManagerListener
to this
TLcyGeneralMapManager
.
For every existing map a MAP_COMPONENT_ADDED event will be fired to aListener
when
aFireEventForExistingMaps
is true
. 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.
aListener
- The listener to be registeredaFireEventForExistingMaps
- true
when aListener
must be warned
about all existing maps, false
otherwiseaddMapManagerListener(ILcyMapManagerListener)
public void removeMapManagerListener(ILcyMapManagerListener aMapManagerListener)
ILcyMapManager
ILcyMapManagerListener
to this ILcyMapManager
.removeMapManagerListener
in interface ILcyMapManager
aMapManagerListener
- The listener to remove.public int getMapComponentCount()
ILcyMapManager
ILcyMapComponent
s.getMapComponentCount
in interface ILcyMapManager
ILcyMapComponent
s.public ILcyMapComponent getMapComponent(int aIndex)
ILcyMapManager
ILcyMapComponent
at the given index.getMapComponent
in interface ILcyMapManager
aIndex
- the index of the ILcyMapComponent
to return.ILcyMapComponent
at the given index.public void addMapComponent(ILcyMapComponent aMapComponent)
ILcyMapManager
. Whenever
a new ILcyMapComponent
is instantiated, this method needs to
be invoked. The responsibility to do this belongs to whoever created the
map, for example the TLcyMapAddOn
.
Once an ILcdMapComponent
has been removed, it must not be re-added.
addMapComponent
in interface ILcyMapManager
aMapComponent
- The ILcyMapComponent
to add.ILcyMapManager
public void removeMapComponent(ILcyMapComponent aMapComponent)
ILcyMapManager
. Whenever
a ILcyMapComponent
is removed, this method needs to
be invoked. The responsibility to do this belongs to whoever disposed
the map, for example the TLcyMapAddOn
.
Once an ILcdMapComponent
has been removed, it must not be re-added.
removeMapComponent
in interface ILcyMapManager
aMapComponent
- The ILcyMapComponent
to remove.ILcyMapManager
protected void fireMapManagerEvent(TLcyMapManagerEvent aMapManagerEvent)
aMapManagerEvent
- The event to fire.public ILcyMapComponent getActiveMapComponent()
ILcyMapManager
ILcyMapComponent
. 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.getActiveMapComponent
in interface ILcyMapManager
ILcyMapComponent
.public void setActiveMapComponent(ILcyMapComponent aActiveMapComponent)
ILcyMapManager
TLcyMapAddOn
, as the user starts working
on a different map.
Fires a property change event.setActiveMapComponent
in interface ILcyMapManager
aActiveMapComponent
- The active map component, or null.public ALcyAsynchronousPaintFacade getAsynchronousPaintFacade()
setAsynchronousPaintFacade(com.luciad.lucy.map.asynchronous.ALcyAsynchronousPaintFacade)
public void setAsynchronousPaintFacade(ALcyAsynchronousPaintFacade aAsynchronousPaintFacade)
aAsynchronousPaintFacade
- a facade to be used when painting layers asynchronouslygetAsynchronousPaintFacade()