Class TLspLOSCoveragePainter

java.lang.Object
com.luciad.tea.lightspeed.los.view.TLspLOSCoveragePainter
All Implemented Interfaces:
ILspPaintGroupsChangeListener, ILspEditableStyledPainter, ILspPainter, ILspStyleChangeListener

public class TLspLOSCoveragePainter extends Object implements ILspEditableStyledPainter, ILspStyleChangeListener

A painter that paints ILcdLOSCoverageMatrix instances, which is the result of LOS calculations.

This painter can be used in a lightspeed view to paint any ILcdLOSCoverageMatrix. This painter will use its styler to style the ILcdLOSCoverageMatrix instances. Each coverage matrix needs to be styled using a LOS coverage style in order to be painted.

LOS coverage matrix instances that don't have a matching TLspLOSCoverageStyle will not be painted, and the painter will log a warning if this occurs.

It is possible to use an ALspStyleTargetProvider to convert any domain object into an ILcdLOSCoverageMatrix, but the painter assumes that only one coverage matrix is painted per domain object.

This painter handles style changes and object changes in a synchronous way.

This painter takes a read lock on the model containing the ILcdLOSCoverageMatrix instances while painting the ILcdLOSCoverageMatrixes. Users of this painter should take care to write lock this model while updating the LOS coverage matrix instances it contains.

Since:
2012.0
  • Constructor Details

    • TLspLOSCoveragePainter

      public TLspLOSCoveragePainter()
  • Method Details

    • getRequiredOpenGLProfile

      public TLspOpenGLProfile getRequiredOpenGLProfile()
      Description copied from interface: ILspPainter
      Returns the minimum required OpenGL profile that a view must support in order to be compatible with this painter.
      Specified by:
      getRequiredOpenGLProfile in interface ILspPainter
      Returns:
      a TLspGLProfile
    • paintObjects

      public TLspPaintProgress paintObjects(ILcdGLDrawable aGLDrawable, List<TLspPaintGroup> aPaintGroups, TLspPaintPass aPass, TLspContext aContext)
      Description copied from interface: ILspPainter

      Paints the specified groups of objects into a view. The objects are partitioned into TLspPaintGroups, which are created by the layer which invoked this painter. Painters are advised to also implement ILspPaintGroupsChangeListener, which allows them to keep track of changes to the supplied list of paint groups. This way, the painter can exploit temporal coherence and perform its work in the most optimal way.

      This method returns a TLspPaintProgress which describes the completeness of the paint operation. If the painter scheduled one or more tasks to be executed asynchronously, it may return from its paintObjects() method before having rendered all the objects it was given. In this case, the returned progress object can describe the amount of work that has been done and the work that is still remaining.

      Specified by:
      paintObjects in interface ILspPainter
      Parameters:
      aGLDrawable - the ILcdGLDrawable in which the objects are to be painted
      aPaintGroups - the objects to be painted
      aPass - the current paint pass
      aContext - provides context information to the painter
      Returns:
      a TLspPaintProgress object describing the completeness of the paint operation
    • query

      public <T> boolean query(List<TLspPaintGroup> aPaintGroups, ALspPaintQuery<T> aQuery, TLspPaintRepresentationState aPaintRepresentationState, TLspContext aContext)
      Description copied from interface: ILspPainter
      Retrieves a set of domain objects and data based on the parameters given by the query.
      Specified by:
      query in interface ILspPainter
      Parameters:
      aPaintGroups - the paint groups
      aQuery - the query
      aPaintRepresentationState - the paint representation state for which the query should be performed
      aContext - the context
      Returns:
      true if the query completed, false if it was aborted.
    • prepareChanges

      public void prepareChanges(List<TLspPaintGroupsChangedEvent> aEvents, Object aEventId, ILspPaintGroupsChangeListener.Callback aCallback)
      Description copied from interface: ILspPaintGroupsChangeListener
      Called when the paint groups will change.

      The listener should prepare the necessary changes for the events but not commit them yet. The ILspPaintGroupsChangeListener.Callback.changesReady(java.lang.Object) method must be invoked when the listener is ready to commit the changes.

      If aEventId is null then the changes may be committed immediately. In this case there will be no call to ILspPaintGroupsChangeListener.commitChanges(Object).

      Note that it is not mandatory to do this two-phased commit cycle. You may commit or apply the changes immediately, but you still must invoke the callback.

      Specified by:
      prepareChanges in interface ILspPaintGroupsChangeListener
      Parameters:
      aEvents - the changes
      aEventId - the event id or null
      aCallback - the callback or null
    • commitChanges

      public void commitChanges(Object aEventId)
      Description copied from interface: ILspPaintGroupsChangeListener
      Called when the changes for a specified event should be committed.
      Specified by:
      commitChanges in interface ILspPaintGroupsChangeListener
      Parameters:
      aEventId - the event id
    • styleChanged

      public void styleChanged(TLspStyleChangeEvent aEvent)
      Description copied from interface: ILspStyleChangeListener
      Called by the styler when a change in style occurs.
      Specified by:
      styleChanged in interface ILspStyleChangeListener
      Parameters:
      aEvent - describes the change that occurred
    • getStyler

      public ILspStyler getStyler(TLspPaintState aPaintState)
      Description copied from interface: ILspPainter
      Returns the styler used by this painter for the given PaintState. Can return null in case the painter does not use or expose a styler.
      Specified by:
      getStyler in interface ILspPainter
      Parameters:
      aPaintState - the paint state for which a styler is requested
      Returns:
      the styler used by this object, or null.
    • setStyler

      public void setStyler(TLspPaintState aPaintState, ILspStyler aStyler)
      Description copied from interface: ILspEditableStyledPainter
      Sets the styler used by this object for the given PaintState.
      Specified by:
      setStyler in interface ILspEditableStyledPainter
      Parameters:
      aPaintState - the paint state for which to set a styler
      aStyler - the new styler for the painter
    • registerLayer

      public void registerLayer(ILspInteractivePaintableLayer aLayer, TLspPaintRepresentation aPaintRepresentation)
      Description copied from interface: ILspPainter
      Registers a layer with this painter. This notifies the painter that it is going to be used in combination with the given layer, for the given paint representation. This allows it to implement setup code if necessary, or to keep track of all layers on which it is set.

      Layers registered with this method must be unregistered when the layer stops using this painter, using ILspPainter.unregisterLayer(ILspInteractivePaintableLayer, com.luciad.view.lightspeed.layer.TLspPaintRepresentation).

      Specified by:
      registerLayer in interface ILspPainter
      Parameters:
      aLayer - A layer with which this painter will be used.
      aPaintRepresentation - The paint representation for which this painter will be used.
    • unregisterLayer

      public void unregisterLayer(ILspInteractivePaintableLayer aLayer, TLspPaintRepresentation aPaintRepresentation)
      Description copied from interface: ILspPainter
      Unregisters a layer from this painter. This notifies the painter that it will no longer be used in combination with the given layer, for the given paint representation. This allows it to implement cleanup code if necessary.

      Layers unregistered with this method must have been registered before calling this method with the method ILspPainter.registerLayer(ILspInteractivePaintableLayer, com.luciad.view.lightspeed.layer.TLspPaintRepresentation).

      Specified by:
      unregisterLayer in interface ILspPainter
      Parameters:
      aLayer - A layer that needs to be unregistered
      aPaintRepresentation - The paint representation for which this painter was used with aLayer
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Description copied from interface: ILspPainter
      Adds a PropertyChangeListener to the list of listeners that must be notified when any of the properties of this ILspPainter changes.
      Specified by:
      addPropertyChangeListener in interface ILspPainter
      Parameters:
      listener - the listener that from now on will be notified of all changes to properties of this painter
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Description copied from interface: ILspPainter
      Removes a PropertyChangeListener from the list of listeners. This listener will no longer be notified of any changes to the properties of this ILspPainter
      Specified by:
      removePropertyChangeListener in interface ILspPainter
      Parameters:
      listener - the listener that no longer will be notified of any changes to properties of this painter