Class TLcdEarthGXYVectorPainter

All Implemented Interfaces:
ILcdCloneable, ILcdPropertyChangeSource, ILcdGXYPainter, ILcdGXYPainterProvider, Serializable, Cloneable

public class TLcdEarthGXYVectorPainter extends ALcdEarthGXYPainter
This ILcdGXYPainter can paint the vector data of ILcdEarthTileSet instances in a 2D view.

Supported objects

This painter can visualize any ILcdEarthTileSet that can produce tiles with an array as the tile data, assuming that the data painter can paint the array elements. The first such coverage in the tileset will be used (see chooseTileSetCoverage(com.luciad.earth.tileset.ILcdEarthTileSet)).

Visualization

The tile level is chosen using the getLodStrategy(). By default a TLcdEarthGXYPointDensityLodStrategy is used.

If some tiles are not available, the tiles at lower levels will be used automatically to avoid gaps. However because a tile at level i+1 covers the same area as 4 tiles at level i, a tile may or may not be painted if one of the tiles in its 2x2 block with the same parent at the previous level is not available. In general a tileset should make sure that either no tiles or all tiles in such a block are available to ensure all its tiles can be painted.

The actual painting of the tile data elements is delegated to the tile data painter.

Since:
8.2
See Also:
  • Constructor Details

    • TLcdEarthGXYVectorPainter

      public TLcdEarthGXYVectorPainter(ILcdGXYPainter aTileDataPainter)
      Creates a new 2D Painter that delegates painting of the tile data to the given painter.
      Parameters:
      aTileDataPainter - The painter to delegate the painting of the tile data to.
    • TLcdEarthGXYVectorPainter

      public TLcdEarthGXYVectorPainter(ILcdGXYPainter aTileDataPainter, ILcdEarthGXYLodSelectionStrategy aLodStrategy)
      Creates a new 2D Painter that delegates painting of the tile data to the given painter.
      Parameters:
      aTileDataPainter - The painter to delegate the painting of the tile data to.
      aLodStrategy - The strategy to use for selecting a LOD.
    • TLcdEarthGXYVectorPainter

      public TLcdEarthGXYVectorPainter(ILcdGXYPainter aTileDataPainter, ILcdEarthGXYLodSelectionStrategy aLodStrategy, int aCacheSize)
      Creates a new 2D Painter with the specified cache size, which delegates painting of the tile data to the given painter.
      Parameters:
      aTileDataPainter - The painter to delegate the painting of the tile data to.
      aLodStrategy - The strategy to use for selecting a LOD.
      aCacheSize - The number of entries in the tile cache.
  • Method Details

    • getTileDataPainter

      public ILcdGXYPainter getTileDataPainter()
      Returns the current gxy painter for the tile data.
      Returns:
      A gxy painter.
    • setTileDataPainter

      public void setTileDataPainter(ILcdGXYPainter aDelegate)
      Sets the gxy painter for the tile data.
      Parameters:
      aDelegate - The new gxy painter.
    • getLodStrategy

      public ILcdEarthGXYLodSelectionStrategy getLodStrategy()
      Returns the current LOD strategy.
      Returns:
      A gxy LOD strategy.
    • setLodStrategy

      public void setLodStrategy(ILcdEarthGXYLodSelectionStrategy aLodStrategy)
      Sets the LOD strategy.
      Parameters:
      aLodStrategy - The new gxy LOD strategy.
    • setCacheSize

      public void setCacheSize(int aCacheSize)
      Description copied from class: ALcdEarthGXYPainter
      Sets the size of the cache (in #tiles). If the new cache size is smaller than the current cache size some elements will be removed from the cache.
      Overrides:
      setCacheSize in class ALcdEarthGXYPainter
      Parameters:
      aCacheSize - the new cache size
    • clearCache

      public void clearCache()
      Description copied from class: ALcdEarthGXYPainter
      Clears the cache.
      Overrides:
      clearCache in class ALcdEarthGXYPainter
    • chooseTileSetCoverage

      protected ILcdEarthTileSetCoverage chooseTileSetCoverage(ILcdEarthTileSet aTileSet)
      Description copied from class: ALcdEarthGXYPainter
      Chooses a coverage in a tile set.
      Specified by:
      chooseTileSetCoverage in class ALcdEarthGXYPainter
      Parameters:
      aTileSet - the tile set that will be painted
      Returns:
      a coverage in the specified tile set that should be painted
    • paint

      public void paint(Graphics aGraphics, int aMode, ILcdGXYContext aContext)
      Description copied from interface: ILcdGXYPainter
      Displays the representation of the object in the given mode on the Graphics passed, taking into account the supplied context.

      The visual representation of an object depends on the context. Depending on the context (e.g. is the location covered by the view), an object may or may not have a representation. The context contains:

      • transformations which allow to compute the location in view space of points and bounds given in model, space
      • a pen which can connect points with a line or create arcs around a point,
      • the view for which the object's representation must be painted. This can be useful when the painted object depends on the scale of the view, or the presence of other layers in the view.
      • the current location(s) of the mouse or input device and the last location(s) the mouse or input device was pressed.

      The mode passed in this method indicates what part of the object must be painted, whether it should be painted as selected or not, and whether user interaction (via mouse movements) must be taken into account.

      When the mode passed contains either TRANSLATING, RESHAPING or CREATING, this method is also responsible for interpreting interaction on the representation of an object and modifying the representation of the object accordingly. The painter is not responsible for modifying the object itself, this is done by a corresponding ILcdGXYEditor . Implementations of ILcdGXYPainter and ILcdGXYEditor interfaces must be consistent for an object: the painter must display the result of the user interaction on the object, while the editor is responsible for modifying the object as a result of the user interaction. A good practice to ensure a consistent implementation is to implement both the ILcdGXYPainter and ILcdGXYEditor interfaces in a single class.

      When the mode passed includes SNAPS, the part of the representation which corresponds to the object returned as snap target by the method snapTarget must be painted in order to provide the user with a visual indication of the snap target.

      The Graphics passed in this method can be different from the Graphics returned by a view due to techniques such as double buffering (as applied in Swing). Basic drawing operations must always be performed on the Graphics passed as an argument in this method.

      Parameters:
      aGraphics - the Graphics on which the representation of the object is painted
      aMode - the mode the object is represented in (see class documentation).
      aContext - the ILcdGXYContext the drawing depends on.
    • getDisplayName

      public String getDisplayName()
      Description copied from class: ALcdGXYPainter
      Returns the display name of this ILcdGXYPainter.
      Specified by:
      getDisplayName in interface ILcdGXYPainter
      Overrides:
      getDisplayName in class ALcdGXYPainter
      Returns:
      the name that has been set using setDisplayName(), or this.toString() if no name has been set.
    • clone

      public Object clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from java.lang.Object, it can be implemented like this:
      
       public Object clone() {
         try {
           return super.clone();
         } catch ( CloneNotSupportedException e ) {
           // Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
           throw new RuntimeException( e );
         }
       }
       
      Specified by:
      clone in interface ILcdCloneable
      Specified by:
      clone in interface ILcdGXYPainterProvider
      Overrides:
      clone in class ALcdEarthGXYPainter
      Returns:
      a clone of this painter provider.
      See Also: