public class TLcyMapAddOn extends ALcyAddOn
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.
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"));
}
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);
TLcyLspMapAddOn
Modifier and Type | Field and Description |
---|---|
static TLcyGroupDescriptor |
MAP_GROUP_DESCRIPTOR |
Constructor and Description |
---|
TLcyMapAddOn() |
Modifier and Type | Method and Description |
---|---|
ALcyMapComponentFactory |
getMapComponentFactory()
Returns 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.
|
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
public static final TLcyGroupDescriptor MAP_GROUP_DESCRIPTOR
public void plugInto(ILcyLucyEnv aLucyEnv)
ALcyAddOn
plugInto
in class ALcyAddOn
aLucyEnv
- The lucy environment to plug into.ALcyAddOn.unplugFrom(com.luciad.lucy.ILcyLucyEnv)
public ALcyMapComponentFactory getMapComponentFactory()
TLcyMapComponentFactory
.setMapComponentFactory(com.luciad.lucy.map.ALcyMapComponentFactory)
public void setMapComponentFactory(ALcyMapComponentFactory aMapComponentFactory)
aMapComponentFactory
- The map component factory.getMapComponentFactory()
public void unplugFrom(ILcyLucyEnv aLucyEnv)
ALcyAddOn
unplugFrom
in class ALcyAddOn
aLucyEnv
- The lucy environment to unplug from.ALcyAddOn.plugInto(com.luciad.lucy.ILcyLucyEnv)