Class TLcdHypsometricEarthPainter

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

public class TLcdHypsometricEarthPainter extends TLcdEarthGXYRasterPainter
A painter for hypsometric results based on an earth tileset.
Since:
2013.1
See Also:
  • Constructor Details

    • TLcdHypsometricEarthPainter

      public TLcdHypsometricEarthPainter(ILcdHypsometricTileFactory aTileFactory, ILcdHypsometricValueProvider aHypsometricValueProvider, int aUnknownValue)
      Creates a new hypsometric earth painter with the given hypsometric tile factory.
      Parameters:
      aTileFactory - the hypsometric tile factory to use for creating hypsometric tiles based on an earth tileset.
      aHypsometricValueProvider - The hypsometric value provider to use for calculating hypsometric values in an earth tileset
      aUnknownValue - The value to use when no value could be determined in the earth tileset.
    • TLcdHypsometricEarthPainter

      public TLcdHypsometricEarthPainter(TLcdHypsometricTileFactory aTileFactory)
      Creates a new hypsometric earth painter with the given hypsometric tile factory. This convenience constructor only accepts TLcdHypsometricTileFactory and is equivalent to calling:



      new TLcdHypsometricEarthPainter( tileFactory, tileFactory.getHypsometricValueProvider(), tileFactory.getHypsometricColorModel(), tileFactory.getUnknownValue() )
      Parameters:
      aTileFactory - the hypsometric tile factory to use for creating hypsometric tiles
  • Method Details

    • getEmptyTile

      protected ILcdTile getEmptyTile()
      Description copied from class: TLcdEarthGXYRasterPainter
      Returns a representative empty tile for this painter. For example, the tile's default value may be used when painting missing data.
      Overrides:
      getEmptyTile in class TLcdEarthGXYRasterPainter
      Returns:
      an empty tile.
    • getTileFactory

      public ILcdHypsometricTileFactory getTileFactory()
      Gets the tile factory set on this hypsometric earth painter.
      Returns:
      the hypsometric tile factory on this earth painter
    • setTileFactory

      public void setTileFactory(ILcdHypsometricTileFactory aTileFactory)
      Sets the tile factory set on this hypsometric earth painter.
      Parameters:
      aTileFactory - the hypsometric tile factory on this earth painter
    • getHypsometricValueProvider

      public ILcdHypsometricValueProvider getHypsometricValueProvider()
      Returns the hypsometric value provider
      Returns:
      the hypsoemtric value provider
    • setHypsometricValueProvider

      public void setHypsometricValueProvider(ILcdHypsometricValueProvider aHypsometricValueProvider)
      Sets the hypsometric value provider
      Parameters:
      aHypsometricValueProvider - a hypsometric value provider
    • getUnknownValue

      public int getUnknownValue()
      Returns the unknown value that is used when no result could be determined for the input data.
      Returns:
      the unknown value
    • setUnknownValue

      public void setUnknownValue(int aUnknownValue)
      Sets the unknown value when no result could be determined for the input data.
      Parameters:
      aUnknownValue - the unknown value
    • 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.

      Specified by:
      paint in interface ILcdGXYPainter
      Overrides:
      paint in class TLcdEarthGXYRasterPainter
      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.
    • configureBaseTileSet

      protected ILcdEarthTileSet configureBaseTileSet(Object aObject, ILcdEarthTileSet aTileSet)
      Description copied from class: TLcdEarthGXYRasterPainter
      Configures the base tile set.

      The default implementation just returns the base tile set.

      This method can be overridden to add custom tile set wrappers to the tile set.

      Overrides:
      configureBaseTileSet in class TLcdEarthGXYRasterPainter
      Parameters:
      aObject - the object being painted
      aTileSet - the base tile set
      Returns:
      the configured tile set
      See Also:
    • retrieveCachedHypsometricValue

      public double retrieveCachedHypsometricValue(ILcdPoint aPoint, ILcdEarthTileSet aTileset)
      Retrieves a cached hypsometric value from this painter for a given point in model coordinates. This method will only return a valid value if the hypsometry layer is visible and has been painted for the given region.
      Parameters:
      aPoint - The point for which to retrieve the value in model coordinates. The reference of this point should be the same as the earth tileset.
      aTileset - the tileset for which to retrieve the value. This tileset needs to be an element of the model that is being painted. ( In other words "ILcdModel.elements()" should contain the given aTileset ). It is the same tileset that is set on this painter when TLcdEarthGXYRasterPainter.setObject(Object) is called before a paint operation.
      Returns:
      Can return one of the following:
      • The cached hypsometric value at the given point (aPoint). The accuracy of this value will depend on the cache of the painter. This method will try to return the most detailed available values that were calculated with a paint operation.
      • The unknown value: This value will be returned if the given point is out of bounds, the given point is not in the painted (cached) region of the painter, or if the tileset does not contain elevation data in the given point.
    • isValidCoverage

      protected boolean isValidCoverage(ILcdEarthTileSetCoverage aCoverage)
      Description copied from class: TLcdEarthGXYRasterPainter
      Returns whether the given coverage can be drawn by this painter. The returned coverage should support a format that can be handled by TLcdEarthGXYRasterPainter.createRasterTile(com.luciad.earth.tileset.ALcdEarthTile).

      The default implementation returns true if the coverage is a raster coverage and the tiles set supports a format with RenderedImage as format class and no format name with the specified coverage.

      Overrides:
      isValidCoverage in class TLcdEarthGXYRasterPainter
      Parameters:
      aCoverage - the candidate coverage
      Returns:
      true if the given coverage can be painted
      See Also:
    • chooseTileFormat

      protected TLcdEarthTileFormat chooseTileFormat(ILcdEarthTileSet aTileSet, ILcdEarthTileSetCoverage aCoverage)
      Description copied from class: TLcdEarthGXYRasterPainter
      Chooses a tile format from the given tile set and coverage to be used for producing tiles. The format should be supported by TLcdEarthGXYRasterPainter.createRasterTile(com.luciad.earth.tileset.ALcdEarthTile).

      The default implementation returns a format with RenderedImage as format class and no format name.

      Overrides:
      chooseTileFormat in class TLcdEarthGXYRasterPainter
      Parameters:
      aTileSet - the tile set whose tiles are being painted
      aCoverage - the coverage whose tiles are being painted.
      Returns:
      the format in which tiles should be obtained
    • createRasterTile

      protected ILcdTile createRasterTile(ALcdEarthTile aTile)
      Description copied from class: TLcdEarthGXYRasterPainter
      Creates an ILcdTile corresponding to the specified ALcdEarthTile. The resulting raster tile is used in order to draw the output of a tile set using TLcdRasterPainter.

      The default implementation can only create a tile for tiles with a RenderedImage as tile data.

      Overrides:
      createRasterTile in class TLcdEarthGXYRasterPainter
      Parameters:
      aTile - the tile to convert into a raster tile
      Returns:
      a raster tile