Class ALcyShapeSupplier

java.lang.Object
com.luciad.lucy.addons.drawing.format.ALcyShapeSupplier
Direct Known Subclasses:
ALcyShapeSupplierWrapper

public abstract class ALcyShapeSupplier extends Object

Provides the shape specific functionality to a TLcySLDDomainObjectSupplier. This shape specific functionality consists of:

  • Creating of an ILcdShape for specific ILcdModels
  • Creating xml marshallers and unmarshallers
  • Providing a painting and editing support for the shape
  • Providing an ALcyShapeCodec
  • Providing an ILcyCustomizerPanelFactory which can create a GUI element, allowing the user to change the specific properties of the shape.
Since:
8.2
  • Constructor Details

    • ALcyShapeSupplier

      public ALcyShapeSupplier(String aShapeID, String aDisplayName, TLcyDrawingSymbolizerType aDrawingSymbolizerType, ALcyProperties aProperties)
      Creates a new ALcyShapeSupplier.
      Parameters:
      aShapeID - Unique ID of this ALcyShapeSupplier. It is also used as the domain object ID of the TLcySLDDomainObjectSupplier.
      aDisplayName - The untranslated (US English) display name for this shape
      aDrawingSymbolizerType - a type-safe enumeration. The symbolizer type that should be used to decide with which style new shapes will be created.
      aProperties - The ALcyProperties holding the configuration of this shape supplier. Must not be null.
  • Method Details

    • canCreateShape

      public boolean canCreateShape(ILcdModel aForModel)
      Indicates whether this supplier can create a shape for the model aForModel
      Parameters:
      aForModel - The target model, for which this shape supplier should create a shape
      Returns:
      if this supplier can create a shape for this model. The default implementation returns true.
    • createShape

      public abstract ILcdShape createShape(ILcdModel aForModel)
      Creates the shape of the domain object. This method is allowed to interact with the UI: it should be able to pop up a dialog asking for details. (eg as is the case with MS2525b) This method is always called from the EDT thread All this means that this method must not be called during workspace decoding or model decoding
      Parameters:
      aForModel - The ILcdModel for which the shape is created. The implementation of this method can use this model to determine, for instance, the model reference or the ILcdDataModelDescriptor. Never null. The implementation of this method should not insert the created shape in this ILcdModel.
      Returns:
      A new instance of the domain object represented by this domain object supplier implementation. Must not be null.
    • canHandle

      public abstract boolean canHandle(ILcdShape aShape)
      Checks whether this supplier can handle the shape aShape
      Parameters:
      aShape - the ILcdShape to check
      Returns:
      true when this shape is capable of handling the shape aShape
    • createXMLSchemaBasedEncoderLibrary

      public abstract ILcdXMLSchemaBasedEncoderLibrary createXMLSchemaBasedEncoderLibrary()
      Creates the XML marshaller library which will be used to save shapes to the native format.

      An XML marshaller library should typically implement the following actions:

      • An XML element should be registered for this supplier's XML geometry property type.
      • An XML element should be registered for this supplier's XML geometry type.
      • A type marshaller for the [supplier's shape class, XML geometry property type] pair should be registered.
      • A type marshaller for the [supplier's shape class, XML geometry type] pair should be registered.

      The following code snippet shows a typical implementation for the ILcdXMLSchemaBasedEncoderLibrary.configureEncoder method:

      
         public void configureEncoder( TLcdXMLSchemaBasedEncoder aEncoder ) {
           TLcdXMLSchemaSet schema = aEncoder.getMapping().getSchemaSet();
           schema.registerElement( MY_GEOMETRY_PROPERTY_ELEMENT );
           schema.registerElement( MY_GEOMETRY_ELEMENT );
      
           TLcdXMLTypeMarshallerProvider provider = aEncoder.getTypeMarshallerProvider();
           provider.registerTypeMarshaller( MY_GEOMETRY_PROPERTY_ELEMENT.getType(), MyShape.class, new MyShapePropertyMarshaller( aMarshallerContext ) );
           provider.registerTypeMarshaller( MY_GEOMETRY_ELEMENT.getType(), MyShape.class, new MyShapeMarshaller( aMarshallerContext ) );
         }
       
      Returns:
      an XML encoder library that is capable of saving shapes to the native format.
    • createXMLSchemaBasedDecoderLibrary

      public abstract ILcdXMLSchemaBasedDecoderLibrary createXMLSchemaBasedDecoderLibrary()
      Creates the XML decoder library which will be used to load shapes from the native format.

      An XML decoder library should typically implement the following actions:

      • An XML element should be registered for this supplier's XML geometry property type.
      • An XML element should be registered for this supplier's XML geometry type.
      • A type unmarshaller for the [supplier's shape class, XML geometry property type] pair should be registered.
      • A type unmarshaller for the [supplier's shape class, XML geometry type] pair should be registered.

      The following code snippet shows a typical implementation for the ILcdXMLSchemaBasedDecoderLibrary.configureDecoder method:

      
         public void configureDecoder( TLcdXMLSchemaBasedDecoder aDecoder ) {
           TLcdXMLSchemaSet schema = aDecoder.getMapping().getSchemaSet();
           schema.registerElement( MY_GEOMETRY_PROPERTY_ELEMENT );
           schema.registerElement( MY_GEOMETRY_ELEMENT );
      
           TLcdXMLTypeUnmarshallerProvider provider = aDecoder.getTypeUnmarshallerProvider();
           provider.registerTypeUnmarshaller( MY_GEOMETRY_PROPERTY_ELEMENT.getType(), MyShape.class, new MyShapePropertyUnmarshaller( aDecoder ) );
           provider.registerTypeUnmarshaller( MY_GEOMETRY_ELEMENT.getType(), MyShape.class, new MyShapeUnmarshaller( aDecoder ) );
         }
       
      Returns:
      an XML decoder library that is capable of loading shapes from the native format.
    • createShapeCustomizerPanelFactories

      public abstract ILcyCustomizerPanelFactory[] createShapeCustomizerPanelFactories()

      Returns a ILcyCustomizerPanelFactory that creates ILcyCustomizerPanels for the shapes created by this class.

      The objects set on the customizer panels are instances of TLcyShapeContext. This context also contains a reference to the shape and an ILcdModel, but the shape is not an element of this model.

      Returns:
      a ILcyCustomizerPanelFactory that creates ILcyCustomizerPanels for the shapes created by this class.
    • createShapePainterProviderContainer

      public abstract TLcyShapePainterProviderContainer createShapePainterProviderContainer()
      Creates the painters and editors that can paint and edit the shape returned by createShape(com.luciad.model.ILcdModel). These painters don't have to perform any styling, see TLcyShapePainterProviderContainer for more details.
      Returns:
      The TLcyShapePainterProviderContainer that can paint the delegate shape. Must not be null.
    • createShapeCodec

      public abstract ALcyShapeCodec createShapeCodec()
      Returns a ALcyShapeCodec for shapes which can be handled by this shape supplier
      Returns:
      A ALcyShapeCodec for shapes which can be handled by this shape supplier. Must not be null.
    • getShapeID

      public String getShapeID()
      Returns the ID of this supplier. Can for example be used to find out which 2D domain object suppliers match with which 3D domain object suppliers.
      Returns:
      the ID of this supplier
      See Also:
    • getDisplayName

      public String getDisplayName()
      Returns the untranslated (US English) display name for this shape
      Returns:
      The untranslated (US English) display name for this shape
    • getDrawingSymbolizerType

      public TLcyDrawingSymbolizerType getDrawingSymbolizerType()
      Returns the symbolizer type that should be used to decide with which style to create new shapes.
      Returns:
      the symbolizer type that should be used to decide with which style to create new shapes. Must not be null.
    • createDomainObjectConverter

      public ALcyDomainObjectConverter createDomainObjectConverter()

      Creates the domain object converter that can convert the shapes of this supplier instance to other shapes or, conversely, import the data of other flavors to the shapes of this supplier.

      The default implementation returns a domain object converter based on the ALcyShapeCodec.
      Returns:
      The shape converter of this supplier. Must not be null.
    • getProperties

      public ALcyProperties getProperties()

      Returns the ALcyProperties holding the configuration of this shape supplier.

      Returns:
      The ALcyProperties holding the configuration. Never null.