Class TLcyLspXYGridAddOn


public class TLcyLspXYGridAddOn extends ALcyLspFormatAddOn

This add-on adds the capability to add an XY grid layer to every Lightspeed map.

Adding XY grids is only supported for Lightspeed maps that use an ILcdXYWorldReference as world reference (2D maps). In other cases, the grid layer is not visualized.

The configuration options allow to add such a layer automatically to every new map. Manually adding a grid layer is possible using the action in the menu bar.

The layers will be encoded in the workspace. This add-on can add the grid to newly created Lightspeed maps, but when loading a map from a workspace the layers are only added if they were saved in the workspace.

Since:
2016.0
See Also:
  • Constructor Details

    • TLcyLspXYGridAddOn

      public TLcyLspXYGridAddOn()
      Default constructor
  • Method Details

    • plugInto

      public void plugInto(ILcyLucyEnv aLucyEnv)
      Description copied from class: ALcyLspFormatAddOn
      Creates and plugs in the add-on's format and preferences tool.
      Overrides:
      plugInto in class ALcyLspFormatAddOn
      Parameters:
      aLucyEnv - the Lucy environment to plug into
      See Also:
    • createBaseFormat

      protected ALcyLspFormat createBaseFormat()
      Description copied from class: ALcyLspFormatAddOn

      Returns a new data format for this add-on. Override this method to extend the default format with new functionality.

      For example, to alter the icon of the layers of this format, you can decorate the layer factory created in the format:

      
       @Override
       protected ALcyLspFormat createBaseFormat() {
         return new ALcyLspFormatWrapper(super.createBaseFormat()){
           @Override
           protected ILspLayerFactory createLayerFactory(){
             final ILspLayerFactory delegate = super.createLayerFactory();
             return new ILspLayerFactory(){
               @Override
               public boolean canCreateLayers(ILcdModel aModel){
                 return delegate.canCreateLayers(aModel);
               }
      
               @Override
               public Collection<ILspLayer> createLayers(ILcdModel aModel){
                 Collection<ILspLayer> layers = delegate.createLayers(aModel);
                 for(ILspLayer layer : layers){
                   ILcdIcon icon = ...;
                   layer.setIcon(icon)
                 }
                 return layers;
               }
             }
           }
         }
       }
       
      Specified by:
      createBaseFormat in class ALcyLspFormatAddOn
      Returns:
      a new format for this add-on
    • createFormatWrapper

      protected final ALcyLspFormat createFormatWrapper(ALcyLspFormat aBaseFormat)
      Description copied from class: ALcyLspFormatAddOn

      Returns a new data format wrapper for this add-on. A format wrapper extends the base format with aspects such as safe guarding, etc.

      Overriding this method of an existing add-on should be done with extreme care as add-ons typically rely on the wrappers that should be present (e.g. a safe guard).

      Specified by:
      createFormatWrapper in class ALcyLspFormatAddOn
      Parameters:
      aBaseFormat - the base format to wrap
      Returns:
      a new format for this add-on
      See Also:
    • getAddGridActionForMap

      public final ILcdAction getAddGridActionForMap(ILcyGenericMapComponent<?,?> aMapComponent)

      Returns the ILcdAction which can be used to add an XY grid on the specified map.

      Parameters:
      aMapComponent - The map component
      Returns:
      the ILcdAction which can be used to add an XY grid on aMapComponent, or null when no such action is available (for example when the map has already been closed).