The map manager fires a PropertyChangeEvent
each time the active map changes.
To keep track of the active map, you can register a property change listener with the map manager:
ILcyLucyEnv lucy = ...;
//Retrieve the map manager
TLcyCombinedMapManager mapManager = lucy.getCombinedMapManager();
//Register the property change listener
mapManager.addPropertyChangeListener(evt -> {
String propertyName = evt.getPropertyName();
if("activeMapComponent".equals(propertyName)){
ILcyGenericMapComponent activeMap = (ILcyGenericMapComponent) evt.getNewValue();
if(activeMap != null){
//do something with the map
}
}
});