Class ALspStyle

java.lang.Object
com.luciad.view.lightspeed.style.ALspStyle
All Implemented Interfaces:
ILspStyler
Direct Known Subclasses:
ALspDensityStyle, ALspLabelTextProviderStyle, TLsp3DIconStyle, TLsp3DMeshStyle, TLspAPP6ASymbolStyle, TLspColorLookupTableFilterStyle, TLspComplexStrokedLineStyle, TLspFillStyle, TLspHypsometricShadingStyle, TLspIconStyle, TLspImageProcessingStyle, TLspImageProjectionStyle, TLspIndexColorModelStyle, TLspLabelBoxStyle, TLspLabelOpacityStyle, TLspLineStyle, TLspLOSCoverageStyle, TLspMS2525bSymbolStyle, TLspParameterizedFillStyle, TLspParameterizedIconStyle, TLspParameterizedLineStyle, TLspParameterizedRasterIconStyle, TLspPlotStyle, TLspPointCloudStyle, TLspRadarVideoStyle, TLspRasterStyle, TLspStrokedLineStyle, TLspTextStyle, TLspVerticalLineStyle, TLspViewDisplacementStyle, TLspWorldSizedLineStyle

public abstract class ALspStyle extends Object implements ILspStyler
Base class for style objects, containing common properties that are applicable to all domain objects. Styles can be associated with domain objects using an ILspStyler.

For convenience, this class also implements ILspStyler by styling all objects using itself. This makes it very easy to configure a layer or painter with only one style. Do note that it will never fire style change events, because styles are immutable.

Subclasses introducing state should override the equals and hashCode methods, check their own state, and delegate to this class.

Since:
2012.0
  • Constructor Details

    • ALspStyle

      protected ALspStyle(int aZOrder)
      Constructs a style.

      Parameters:
      aZOrder - defines the relative ordering of this style with respect to other styles in the same layer
  • Method Details

    • isTransparent

      public abstract boolean isTransparent()
      Determines whether this style is transparent.

      Shapes that are transparent can be painted in a different paint phase than shapes that are not transparent.

      Returns:
      whether or not this style is transparent
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • addStyleChangeListener

      public void addStyleChangeListener(ILspStyleChangeListener aListener)
      Description copied from interface: ILspStyler
      Registers a style change listener with this styler. Appropriate events will be passed to this listener whenever a style changes.
      Specified by:
      addStyleChangeListener in interface ILspStyler
      Parameters:
      aListener - the style change listener to add
    • removeStyleChangeListener

      public void removeStyleChangeListener(ILspStyleChangeListener aListener)
      Description copied from interface: ILspStyler
      Unregisters a style change listener from this styler.
      Specified by:
      removeStyleChangeListener in interface ILspStyler
      Parameters:
      aListener - the style change listener to remove
    • style

      public void style(Collection<?> aObjects, ALspStyleCollector aStyleCollector, TLspContext aContext)
      Description copied from interface: ILspStyler

      Styles the objects or labels contained in aObjects using the methods provided by ALspStyleCollector.

      Example usages for object styling:

      
       // Same style for all objects:
       aStyleCollector.objects(aObjects).style(myStyle).submit();
      
       // Object specific styling:
       aStyleCollector.object(myObject1).style(myStyle1).submit();
       aStyleCollector.object(myObject2).style(myStyle2).submit();
       

      Example usages for label styling:

      
       if (aStyleCollector instanceof ALspLabelStyleCollector) {
         ALspLabelStyleCollector labelStyleCollector = (ALspLabelStyleCollector)aStyleCollector;
      
         // Specify a priority for all labels of all objects:
         labelStyleCollector.objects(aDomainObjects).allLabels().priority(3).styles(...).submit();
      
         // Specify an algorithm for a specific label:
         labelStyleCollector.object(myObject1).label(123).algorithm(...).styles(...).submit();
       }
       

      The objects that are provided to aStyleCollector must be objects that are contained in aObjects. Note that not all objects have to be styled. Objects that are not submitted in aStyleCollector will not be painted.

      This method can be called very frequently, depending on the (amount of) data. If this method is not implemented efficiently, painting performance may be affected.

      Specified by:
      style in interface ILspStyler
      Parameters:
      aObjects - The objects to be styled.
      aStyleCollector - A style collector to which all styling information should be passed, this collector is only valid within this method call, and can no longer be used afterwards.
      aContext - Provides context information that may affect styling, such as view specific properties.
    • isCompatible

      public boolean isCompatible(TLspPaintPass aPaintPass)
      Utility method to determine whether the style is compatible with the given paint pass.

      A style and paint pass are compatible if they use or request the same terrain and transparency properties.

      Parameters:
      aPaintPass - the paint pass
      Returns:
      true if the style can be used in the given paint pass, false otherwise.
    • getZOrder

      public int getZOrder()

      Returns the Z-order of this style. Styles of the same type should be painted from lowest to highest Z-order. This means that styles with the highest Z-order will be painted on top.

      For optimal results, use values between 0 and 100.

      Increasing the number of different Z-orders can negatively impact painting performance. By default, it is set to 0.

      Returns:
      the Z-Order
    • asBuilder

      public abstract ALspStyle.Builder<?> asBuilder()
      Creates a new builder initialized with all the properties of this style.
      Returns:
      the new builder.