Class TLcyDrawingAddOn


public class TLcyDrawingAddOn extends ALcyFormatAddOn

An addon that provides an ALcyFormat supporting the out-of-the-box shapes of LuciadLightspeed (e.g. points, polylines, circles, ...), together with a file format etc. The format also has a tool bar for creating new layers, drawing new objects and modifying the style of existing objects.

This drawing tool bar is in fact an ALcyFormatBar, that is displayed by the TLcyFormatBarAddOn. So if that add-on isn't loaded, the drawing tool bar can't be shown below the map.

The ALcyFormat of the TLcyDrawingAddOn can be extended with additional domain objects. See ALcyDomainObjectSupplier for more information on extending the drawing format.

The default shapes of the drawing format are styled using Styled Layer Descriptors (SLD). Reusing this styling mechanism for custom shapes, is possible through TLcySLDDomainObjectSupplier.

This addon provides the domain model and the facilities to paint the domain objects on a flat, 2D map. Interoperability with the TEA Industry Specific Component is provided in the TLcyDrawingTEAAddOn.

Customizing the format bar

Through the configuration file

All the actions and active settables available in the format bar are configured through the configuration file of this add-on. This allows for the regular customizations:
  • Changing icons, names, tool tips, ...
  • Changing the location of the entries
  • Removing entries

Through the API

The API allows for more elaborate customizations. The actual contents of the format bar is created by an ALcyGUIFactory, which is exposed in TLcyDrawingFormat.createGUIFactory(). The default ALcyGUIFactory is the TLcyDrawingToolBarFactory, which can be extended as starting point for a custom implementation.

Replacing this GUI factory with a custom one (possibly extending from TLcyDrawingToolBarFactory) can be done by:


   @Override
   protected TLcyDrawingFormat createBaseFormat(){
     return new TLcyDrawingFormat(this){
       @Override
       protected ALcyGUIFactory<Component> createGUIFactory() {
         return new CustomGUIFactory();
       }
     }
   }
 

Note: The format bar factory provided by this add-on is only used for GXY maps. The one for Lightspeed maps is created in the TLcyLspDrawingAddOn.

Since:
8.2
  • Field Details

    • DRAWING_FLAVOR

      public static final DataFlavor DRAWING_FLAVOR

      Data flavor for the drawing format. It is used for copy and paste support, see ALcyLayerSelectionTransferHandler.

      The transfer data for this DataFlavor is an com.luciad.lucy.map.ILcyLayerSubsetList. All elements in this subset list are guaranteed/required to be drawing domain objects.

  • Constructor Details

    • TLcyDrawingAddOn

      public TLcyDrawingAddOn()
      The default constructor by which the Lucy frontend will instantiate the drawing add-on
  • Method Details

    • createBaseFormat

      protected TLcyDrawingFormat createBaseFormat()

      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 ALcyFormat createBaseFormat() {
         return new ALcyFormatWrapper(super.createBaseFormat()){
           @Override
           protected ILcdGXYLayerFactory createGXYLayerFactory(){
             final ILcdGXYLayerFactory delegate = super.createGXYLayerFactory();
             return new ILcdGXYLayerFactory(){
               @Override
               public ILcdGXYLayer createGXYLayer(ILcdModel aModel){
                 ILcdGXYLayer layer = delegate.createGXYLayer(aModel);
                 if (layer != null){
                   ILcdIcon icon = ...;
                   layer.setIcon(icon);
                 }
                 return layer;
               }
             }
           }
         }
       }
       

      Returns an instance of TLcyDrawingFormat. One can use getPreferencesTool().getCompositeWorkspacePreferences()

      for the ALcyProperties that need to be given to the constructor of TLcyDrawingFormat.

      Specified by:
      createBaseFormat in class ALcyFormatAddOn
      Returns:
      a new format for this add-on
      See Also:
    • getDrawingFormat

      public TLcyDrawingFormat getDrawingFormat()

      Returns the TLcyDrawingFormat as created by createBaseFormat(). It is typically used to retrieve the ALcyDomainObjectSuppliers from it, or to retrieve the ALcyDomainObjectConverter using getDomainObjectConverter.

      This method is different from ALcyFormatAddOn.getFormat() because the format returned by that method might for example be wrapped with some ALcyFormatWrappers, such as TLcyAsynchronousFormatWrapper.

      Returns:
      the TLcyDrawingFormat.
      See Also:
    • createFormatWrapper

      protected final ALcyFormat createFormatWrapper(ALcyFormat aBaseFormat)
      Description copied from class: ALcyFormatAddOn

      Returns a new data format wrapper for this add-on. A format wrapper extends the base format with aspects such as asynchronous painting, mutable file behavior, 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 ALcyFormatAddOn
      Parameters:
      aBaseFormat - the base format to wrap
      Returns:
      a new format for this add-on
      See Also:
    • createFormatTool

      protected TLcyFormatTool createFormatTool(ALcyFormat aFormat)
      Description copied from class: ALcyFormatAddOn

      Creates a new format tool for the given format. It is used to plug all parts of the format ( e.g. ILcdGXYLayerFactory, ILcdModelDecoder, etc.) into ILcyLucyEnv.

      Overrides:
      createFormatTool in class ALcyFormatAddOn
      Parameters:
      aFormat - the format for which to create a tool
      Returns:
      the created TLcyFormatTool
    • createPreferencesTool

      protected TLcyPreferencesTool createPreferencesTool()
      Description copied from class: ALcyPreferencesAddOn

      Creates the TLcyPreferencesTool to be used by this add-on. Overwriting this method for example allows to register additional ILcyPropertyConverters for (complex) custom properties, to make sure they are correctly decoded from the add-on's configuration file and/or saved to the workspace. Note that this isn't required for simple properties such as String, int, double, etc.

      The default implementation creates a new tool based on the ALcyAddOn.getConfigSourceName() and the add-on's prefixes.

      Overrides:
      createPreferencesTool in class ALcyPreferencesAddOn
      Returns:
      the created TLcyPreferencesTool.
    • plugInto

      public void plugInto(ILcyLucyEnv aLucyEnv)
      Description copied from class: ALcyFormatAddOn

      Creates and plugs in the add-on's format.

      Overrides:
      plugInto in class ALcyFormatAddOn
      Parameters:
      aLucyEnv - the Lucy environment to plug into
      See Also:
    • getDrawingSettingsForMap

      public TLcyDrawingSettings getDrawingSettingsForMap(ILcdView aView)
      Method to retrieve the drawing settings for a certain view.
      Parameters:
      aView - the view for which the drawing settings must be retrieved
      Returns:
      the drawing settings for the view aView