Class TLcyMapAddOn
Addon that creates one map when it is plugged into lucy. It also adds a menu item that allows you to create more maps.
The map components are created by a ALcyMapComponentFactory
. The factory
instance can be explicitly set by using setMapComponentFactory
or the class
can be set by using the configuration file. If no factory is set, a default
factory will be used.
This addon will try to load the specified data on the maps. It therefore
needs the necessary model decoders and layer factories. This addon assumes
that those are already added to the lucy environment. For instance, if you
want to load shp files on your map, you might want to plug the
TLcyDefaultDecodersAddOn
before this one.
The default map layer control factory uses the
ILcyCustomizerPanel
mechanism to
display and modify the properties of a layer. It iterates over the registered
ILcyCustomizerPanelFactory
objects with a TLcyLayerContext
object. This
context object contains the layer for which the properties should be displayed and the view in
which it is contained.
This addon also uses the ILcyCustomizerPanel
mechanism to customize the
properties of the model encoders used to save the ILcdGXYView of a map component as a
georeferenced image. To this end it iterates over the registered
ILcyCustomizerPanelFactory
objects with an TLcyModelEncoderContext
object. This context object contains the model encoder and, optionally, the model that will be
encoded by that model encoder.
Typical use-cases
Creating a new map
Creating a map and adding it the UI can be done by triggering the action available in the UI:
ILcyLucyEnv lucy = ...;
//Search for the create map action
TLcyActionBarManager actionBarManager = lucy.getUserInterfaceManager().getActionBarManager();
ILcdAction createMapAction = TLcyActionBarUtil.findAction("TLcyMapAddOn.createMapAction",
"menuBar",
null,
actionBarManager);
//If the action is found, trigger it
if(createMapAction != null){
createMapAction.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Create map"));
}
Removing a map
Removing a map is done by disposing the application pane containing the map:
ILcyLucyEnv lucy = ...;
ILcyGenericMapComponent map = ...;
//Request the manager of the UI panels in Lucy
TLcyApplicationPaneManager applicationPaneManager = lucy.getUserInterfaceManager().getApplicationPaneManager();
//Ask the manager to dispose the application pane of the map
//This will trigger all necessary clean-up code
applicationPaneManager.applyOnApplicationPane(map.getComponent(), ILcyApplicationPane::disposeApp);
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the map component factory used to create the map components.void
plugInto
(ILcyLucyEnv aLucyEnv) Plugs this addon into the given lucy environment.void
setMapComponentFactory
(ALcyMapComponentFactory aMapComponentFactory) Sets the map component factory used to create the map components.void
unplugFrom
(ILcyLucyEnv aLucyEnv) Unplugs this addon from the given Lucy environment.Methods inherited from class com.luciad.lucy.addons.ALcyAddOn
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
-
Field Details
-
MAP_GROUP_DESCRIPTOR
-
-
Constructor Details
-
TLcyMapAddOn
public TLcyMapAddOn()
-
-
Method Details
-
plugInto
Description copied from class:ALcyAddOn
Plugs this addon into the given lucy environment. It is in the implementation of this method that the addon adds its functionality to the Lucy backend. -
getMapComponentFactory
Returns the map component factory used to create the map components. The default is aTLcyMapComponentFactory
.- Returns:
- the map component factory used to create the map components.
- See Also:
-
setMapComponentFactory
Sets the map component factory used to create the map components.- Parameters:
aMapComponentFactory
- The map component factory.- See Also:
-
unplugFrom
Description copied from class:ALcyAddOn
Unplugs this addon from the given Lucy environment. It removes the functionality previously added to the Lucy backend.- Specified by:
unplugFrom
in classALcyAddOn
- Parameters:
aLucyEnv
- The lucy environment to unplug from.- See Also:
-