Class ALspStyleTargetProvider

java.lang.Object
com.luciad.view.lightspeed.style.styler.ALspStyleTargetProvider

public abstract class ALspStyleTargetProvider extends Object
This abstract class is used by ILspStyler implementations that want to convert an object into a list of targets to which the styles should be applied. Objects for which no geometry is returned will not be painted, in which case this interface acts as a filter.

The possible uses of this interface are very broad, so we can only list a few examples.

  • Applying different icon style to points in a point list.
  • Applying styles to complex objects that do not implement ILcdShape directly.
  • Creating entirely different geometries from objects (e.g. pie charts from countries)
  • Moving points to the height of the terrain before painting.
  • Filtering objects for which a style should not be applied. This can be more efficient compared to applying the filtering in the ILspStyler.

This class should implement the Object.equals(Object) and Object.hashCode() method to ensure that two providers with the same behavior are recognized as such.

These providers can be considered immutable by its users.

Since:
2012.0
  • Constructor Details

    • ALspStyleTargetProvider

      public ALspStyleTargetProvider()
  • Method Details

    • getStyleTargetTypes

      public Set<ALspStyleTargetProvider.StyleTargetType> getStyleTargetTypes()
      Deprecated.
      Value returned by this method has no functional effect.
      Returns all geometry target types to which this ALspStyleTargetProvider can convert objects. By default it returns a set of all available geometry types.
      Returns:
      all geometry target types, supported by this ALspStyleTargetProvider.
    • getStyleTargetsSFCT

      public abstract void getStyleTargetsSFCT(Object aObject, TLspContext aContext, List<Object> aResultSFCT)
      Returns the list of objects to which styles can be applied by a painter. When applied to the same object twice, the result should always be the same.

      If a change in the aContext triggers a change in the style targets, the ILspStyler that provided this provider should use a style change event to notify its users, and a new ALspStyleTargetProvider that is not equal to the current one should be returned upon querying the updated style.

      It is allowed to leave aResultSFCT empty. In this case nothing will be visualized for aObject, allowing this method to be used as a basic filter.

      Parameters:
      aObject - The object from which the style targets should be derived
      aContext - The current context in which the objects will be styled.
      aResultSFCT - A list of objects that are supported by the painter or layer on which the ILspStyler has been configured. In case the object itself should be visualized, aObject should be added to the list. List should not contain null values.
    • getEditTargetsSFCT

      public void getEditTargetsSFCT(Object aObject, TLspContext aContext, List<Object> aResultSFCT)
      Returns the list of objects that can be edited by an editor. When applied to the same object twice, the results should always be the same. (Meaning that the resulting objects should have instance equality)

      This method acts as a filter for editable style targets. Only the objects that are included in the aResultSFCT parameter will be editable. By default, all objects are editable. Override this method to customize this behavior, and fine-tune which style targets are editable or not.

      If a change in the aContext triggers a change in the style targets, the ILspStyler that provided this provider should use a style change event to notify its users, and a new ALspStyleTargetProvider that is not equal to the current one should be returned upon querying the updated style.

      Returning an empty list indicates that none of the targets of the object should be editable.

      Note: The list of object should be a subset of the getStyleTargetsSFCT method. By default this method simply calls getStyleTargetsSFCT.

      Parameters:
      aObject - The object from which the edit targets should be derived
      aContext - The current context in which the objects will be styled.
      aResultSFCT - A list of objects (that is a subset of the objects generated by getStyleTargetsSFCT) that indicate which style targets are editable. In case the input object itself is editable, it should be added to the list.
    • getStyleTargetReference

      public ILcdModelReference getStyleTargetReference(TLspContext aContext)
      Returns the reference of the style targets used by this provider. In most cases, this will be the model reference.

      The current default implementation is the following:
      return aContext.getModelReference();

      If the geometry is defined in screen coordinates, return null.

      Parameters:
      aContext - The context for which the reference needs to be returned.
      Returns:
      A valid reference