Class Map.Renderer

java.lang.Object
com.luciad.maps.Map.Renderer
All Implemented Interfaces:
AutoCloseable
Enclosing class:
Map

public static final class Map.Renderer extends Object implements AutoCloseable
The Map renderer.

This class allows you to paint the Map.

Note: all methods must be called on the render thread. See here for more details on the threading rules.

  • Method Details

    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • paint

      public boolean paint()
      To be called by the host widget/component to paint.

      For OpenGL you must ensure that we have a current context.

      The invalidation callback mechanism (Map#setMapInvalidationCallback) provides information on when something has changed on the Map, and a repaint is needed. This allows to only call the paint() method when it is needed.

      Returns:
      whether the Map is idle. Idle means that no background processes are executing inside the Map, and that the result of the painting completely reflects the state of the Map.
    • toImage

      @NotNull public Image toImage()
      Copies the most recent contents of the Map to an Image.

      This function does not wait for the Renderer to finish all background processing, nor does it perform a repaint. It only provides a snapshot of the contents that were painted last.

      The image size is equal to the map size, multiplied by the display scale at the moment when the last paint call was executed. Note that this may mean that when the Map has been resized but not repainted yet, the returned image will have a size based on the Map before the resize happened. This is usually not an issue since this function is typically called right after a repaint.

      Returns:
      an Image that contains the content of the Map.
    • projectPointOnTerrain

      @NotNull public Coordinate projectPointOnTerrain(@NotNull Coordinate mapPoint)
      Projects the given point by moving it up or down towards the terrain.

      The projection is done along the axis that runs perpendicular to the ellipsoid surface at that point. If no terrain is available, the point is projected on the ellipsoid of the map reference.

      Parameters:
      mapPoint - a point in map coordinates
      Returns:
      the projected location, in map coordinates.