Class TLcyMapAddOn

java.lang.Object
com.luciad.lucy.addons.ALcyAddOn
com.luciad.lucy.addons.map.TLcyMapAddOn

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.

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: