Interface ILcdGXYView

All Superinterfaces:
ILcdGXYViewXYWorldTransformationProvider, ILcdLayered, ILcdPropertyChangeSource, ILcdStatusSource, ILcdTreeLayered, ILcdView, Serializable
All Known Subinterfaces:
ILcdRotationCapableGXYView
All Known Implementing Classes:
TLcdGXYViewBufferedImage, TLcdGXYViewCanvas, TLcdGXYViewJPanel, TLcdGXYViewJPanelLightWeight, TLcdGXYViewPanel, TLcdGXYViewPlanarImage, TLcdMapBufferedImage, TLcdMapCanvas, TLcdMapJPanel, TLcdMapJPanelLightWeight, TLcdMapPanel

An ILcdView to visualize two-dimensional object geometry, based on AWT Graphics and organized in ILcdGXYLayer objects.

View contents

An ILcdGXYView aggregates and displays a number of ILcdGXYLayer objects. For example, a view might display a map's geometry using three layers: states, roads and rivers. The view is painted bottom-to-top, depending on the object representation, in the following order:
  • a background color;
  • the bodies of each contained layer's models. Each layer is asked to paint itself, from bottom to top;
  • the labels of each contained layer's models. Typically labels are painted on top of any bodies. The labels are painted by the layer itself, or by a view label painter, if it is set;
  • the selected bodies of each contained layer's models. Typically selections are painted on top of bodies and labels.
  • the selected labels of each contained layer's models. The labels are painted by the layer itself, or by a view label painter, if it is set;
  • corner icons, if any;
  • the controller handling user interaction.
See ILcdGXYLayer for more information about paint representations.

User interaction

The view offers user interaction with its contained layers' objects through a controller. In the view example of the previous section, the user might pan and zoom on the map, and retrieve more information on the displayed roads. Only one controller can be active at a time. When you instantiate a view implementing ILcdGXYView, it activates a default controller that combines common types of user interaction: view navigation, selection and editing.

Geographical aspects

The AWT coordinate system maps to a 2D world coordinate system, described by an ILcdXYWorldReference. The following properties determine the view-world transformation:

Note that ILcdRotationCapableGXYView adds rotation as an extra view-world transformation parameter. All view coordinates follow the Java AWT convention, meaning that the origin is in the upper-left corner.

Toolkit integration

This interface does not define how a view can be displayed on the screen.
To achieve displaying 2D information, ILcdGXYView extends ILcdView with some AWT Component properties: it has a width, a height, a background color, and a current java.awt.Cursor.

TLcdGXYViewJPanel defines a view that lives in a Swing component. TLcdGXYViewBufferedImage defines a view that can be rendered to an image.

In addition, the ILcdGXYView can be painted on a Graphics or returned as a java.awt.Image.

Invalidating content

An ILcdGXYView can be updated both automatically and manually.
The view's representation is automatically invalidated for the following changes:
  • changes in the containing layer's models;
  • property changes of the containing layers;
  • selection changes of the containing layers;
  • ILcdLayered changes;
  • property changes affecting the view's representation, such as the world reference.
The auto-update property controls whether the view's representation is automatically updated when any of the above changes occur.

Manual invalidations and updates are also possible using the invalidate(boolean, java.lang.Object, java.lang.String) method. Possible uses are updating the view after changing a painter property, or combining several view changes in a single update. Depending on the view's implementation, one can avoid invalidating the entire view using the following methods:

All the invalidation methods have a corresponding method that triggers and waits for a view repaint. This can be used if it is important that the view is updated before returning.

To avoid complete redraws for frequent changes of layers near the top, the ILcdGXYView may cache a number of layers near the bottom. This behavior is controlled by the setNumberOfCachedBackgroundLayers(int) method.

Screen DPI and display scaling

To accurately work with map scales, the view needs the screen's DPI. Refer to TLcdMapScale for more information.

GXY views support high DPI rendering, meaning that map features such as icons, line widths or font sizes will be scaled up in response to the DPI scale settings of the host operating system. This is largely transparent to the user, but some caveats apply when using the custom GXY painters to take into account the scaled view.

If you set the DPI scale factor to 1.5 (150%), for instance, then Swing components will report their size as being 1.5 times smaller than their actual pixel size. This means that the width and height reported by, for instance, a JPanel will be smaller than the panel's size in actual screen pixels.

GXY views will adapt themselves by generating larger views proportional to the DPI scale factor. In case of writing your own custom GXY painters, if you are painting by using image buffers, you should take into account HiDPI support. You have to use properly enlarged images according to the DPI scale factor, which can be retrieved using TLcdGXYContext#getDPIScale().

High DPI rendering can be overridden using the -Dsun.java2d.uiScale=1.0 system property (1.0 corresponds to 100%). This sets the DPI scale to 100% (i.e. it switches DPI scaling off). The same property can also be used to enforce a scale factor other than the one configured in the host operating system.

Further information

Exception handling can be controlled using an ILcdPaintExceptionHandler (see getPaintExceptionHandler(). When the view, a layer or a painter catches an exception during painting, it can retrieve the ILcdPaintExceptionHandler from the view and pass the exception to it.

See Also:
  • Field Details

  • Method Details

    • getLayers

      default List<ILcdGXYLayer> getLayers()
      Description copied from interface: ILcdLayered
      Returns a List of the layers.
      Specified by:
      getLayers in interface ILcdLayered
      Returns:
      an unmodifiable List of the layers in this ILcdLayered
    • putCornerIcon

      void putCornerIcon(ILcdIcon aCornerIcon, int aPosition)
      Sets an ILcdIcon to be painted at the given corner of this view. Only the last set icon for the given position is painted.
      Parameters:
      aCornerIcon - the ILcdIcon to be painted at the given corner or null to unregister the icon
      aPosition - one of ILcdGXYView.UPPERLEFT, ILcdGXYView.UPPERRIGHT, ILcdGXYView.LOWERRIGHT, ILcdGXYView.LOWERLEFT
    • addGXYLayer

      boolean addGXYLayer(ILcdGXYLayer aLayer)
      Adds the given ILcdGXYLayer to this ILcdGXYView. The layer is normally added to the top of the view's layers, but that is implementation specific. The view will be repainted depending on the result of isAutoUpdate. No action is performed if the given layer is already contained in the list.
      Parameters:
      aLayer - the layer to add to this view
      Returns:
      true if the layer was added successfully, false if the view already contained the layer
      See Also:
    • addGXYLayer

      boolean addGXYLayer(ILcdGXYLayer aLayer, boolean aRepaint)
      Adds the given ILcdGXYLayer to this ILcdGXYView, forcing a repaint if desired. The layer is normally added to the top of the view's layers, but that is implementation specific. No action is performed if the given layer is already contained in the list.
      Parameters:
      aLayer - the layer to add to this view
      aRepaint - if true, the view is repainted. If false, the view is not repainted.
      Returns:
      true if the layer was added successfully, false if the view already contained the layer
      See Also:
    • addModelListener

      void addModelListener(ILcdModelListener aModelListener)
      Registers the given ILcdModelListener to be informed of ILcdModel change events from any layer's model in this view.
      Parameters:
      aModelListener - a listener that will be notified of ILcdModel change events from any layer's model in this view
      See Also:
    • removeModelListener

      void removeModelListener(ILcdModelListener aModelListener)
      Unregisters the given ILcdModelListener from receiving ILcdModel change events from any layer's model in this view.
      Parameters:
      aModelListener - a listener that the view will no longer notify of ILcdModel change events
      See Also:
    • addLayerSelectionListener

      void addLayerSelectionListener(ILcdSelectionListener aSelectionListener)
      Registers the given ILcdSelectionListener to be informed of selection change events from any layer in this view.
      Parameters:
      aSelectionListener - a listener that will be notified of selection change events from any layer in this view. The events will have the relevant layer as source.
      See Also:
    • removeLayerSelectionListener

      void removeLayerSelectionListener(ILcdSelectionListener aSelectionListener)
      Unregisters the given ILcdSelectionListener from receiving selection change events from any layer in this view.
      Parameters:
      aSelectionListener - a listener that the view will no longer inform of selection change events
      See Also:
    • getNumberOfCachedBackgroundLayers

      int getNumberOfCachedBackgroundLayers()
      Returns the number of layers whose combined representation is cached across repaints. The layers are always the bottommost layer objects; they are regarded as background layers.
      Returns:
      the number of bottommost layers to cache
      See Also:
    • setNumberOfCachedBackgroundLayers

      void setNumberOfCachedBackgroundLayers(int aNumberOfCachedBackgroundLayers)
      Sets the number of layers whose combined representation is cached across repaints. The layers are the bottommost layer objects; they are regarded as background layers.

      Caching background layers is useful when one upper real-time layer needs to be refreshed often, whereas the contents of the background layers seldom change. When a real-time layer changes and needs to be repainted, the cached representation of the background layers is reused, speeding up the paint process. When a background layer changes, all layers need to be repainted to update the view.

      Parameters:
      aNumberOfCachedBackgroundLayers - the number of bottommost layers to cache. This number applies to the flat list of layers.
      See Also:
    • hasValidImage

      boolean hasValidImage()
      Deprecated.
      getImage() always returns a valid image. Implementations of this method should hence always return true.
      Returns true if the view has a valid image.
      Returns:
      true
      See Also:
    • getImage

      Image getImage()
      Returns an Image of this view. The image has not been painted on by the controller. This method is guaranteed to return an up-to-date image: if the view has been invalidated in some way (e.g. when a layer has been removed) then this method first updates the view before returning an image. To improve performance and conserve memory, the view is allowed to cache, reuse and overwrite the image in subsequent repaints. NOTE: While using High DPI mode, this method will return an image which is bigger than the view dimensions reported by getWidth() and getHeight() methods.
      Returns:
      an image containing the representation of this view
    • getGraphics

      Graphics getGraphics()
      Returns a graphics context for this view. Most view implementations offer this context only to retrieve information from. Typically it cannot be used to draw on the view, especially if the view is automatically repainted.
      Returns:
      a graphics context for this view
    • getWidth

      int getWidth()
      Returns the view's current width in AWT pixels.
      Returns:
      the view's current width in AWT pixels
    • getHeight

      int getHeight()
      Returns the view's current height in AWT pixels.
      Returns:
      the view's current height in AWT pixels
    • getPreferredSize

      Dimension getPreferredSize()
      Returns the preferred size of the view. This interface does not specify a functionality for this property.
      Returns:
      the preferred size of the view in AWT pixels
    • setCursor

      void setCursor(Cursor aCursor)
      Sets the view cursor to the given cursor. Its image is displayed when the mouse is within the view boundaries.
      Parameters:
      aCursor - Cursor instance to use, or null to inherit the cursor of a containing entity, if any
      See Also:
    • setBackground

      void setBackground(Color aColor)
      Sets the background color of the view. This is the color that appears when no objects are painted on top of it.
      Parameters:
      aColor - the color which appears at a location where no data is painted.
      Throws:
      IllegalArgumentException - when the given color is null
      See Also:
    • getBackground

      Color getBackground()
      Returns the background color of the view. This is the color that appears when no objects are painted on top of it.
      Returns:
      the background color of the view
      See Also:
    • setForeground

      void setForeground(Color aColor)
      Deprecated.
      This property is not used. Implementations should remember the field so it can be queried with getForeground()
      Sets the foreground color of the view.
      Parameters:
      aColor - the desired foreground Color
      See Also:
    • getForeground

      Color getForeground()
      Deprecated.
      This property is not used.
      Returns the foreground color of the view.
      Returns:
      the view's foreground color
      See Also:
    • setScale

      void setScale(double aScale)
      Sets the scale of this view, repainting the view according to isAutoUpdate. The scale corresponds to the number of pixels per world unit, as determined by the ILcdXYWorldReference. Hence, increasing the scale zooms in, and decreasing the scale zooms out.

      A view displaying geographical data usually employs a scale in pixels per meter. As an example, to fit the world on a view that is 1000 pixels wide, a scale of about 1000 pixels/40.000km, or 1.0/40.000 is needed.

      For most use cases, we recommended setting the unitless map scale instead.

      Parameters:
      aScale - the new scale of the view. The view is scaled using the world origin as center. The scale is limited so that it does not exceed the interval defined by the minimum and maximum scales.
      See Also:
    • setScale

      void setScale(double aScale, boolean aRepaint)
      Sets the scale of this view, optionally repainting the view. The scale corresponds to the number of pixels per world unit, as determined by the ILcdXYWorldReference. Hence, increasing the scale zooms in, and decreasing the scale zooms out.

      A view displaying geographical data usually employs a scale in pixels per meter. As an example, to fit the world on a view that is 1000 pixels wide, a scale of about 1000 pixels/40.000km, or 1.0/40.000 is needed.

      For most use cases, we recommended setting the unitless map scale instead.

      Parameters:
      aScale - the new scale of the view. The view is scaled using the world origin as center. The scale is limited so that it does not exceed the interval defined by the minimum and maximum scales.
      aRepaint - if true, the view is repainted. If false, the view is not repainted.
      See Also:
    • setScale

      void setScale(double aScale, boolean aRepaint, boolean aAdjusting)
      Sets the scale of this view, optionally indicating subsequent property changes. The scale corresponds to the number of pixels per world unit, as determined by the ILcdXYWorldReference. Hence, increasing the scale zooms in, and decreasing the scale zooms out.

      A view displaying geographical data usually employs a scale in pixels per meter. As an example, to fit the world on a view that is 1000 pixels wide, a scale of about 1000 pixels/40.000km, or 1.0/40.000 is needed.

      For most use cases, we recommended setting the unitless map scale instead.

      Parameters:
      aScale - the new scale of the view. The view is scaled using the world origin as center. The scale is limited so that it does not exceed the interval defined by the minimum and maximum scales.
      aRepaint - if true, the view is repainted. If false, the view is not repainted.
      aAdjusting - if true, the caller indicates that he will trigger another property change right after this call. This is reflected in the associated property change event.
      See Also:
    • setScale

      default void setScale(double aScaleX, double aScaleY, boolean aRepaint, boolean aAdjusting)
      Sets the scale along the x-axis and y-axis of this view, repainting the view according to isAutoUpdate.

      The scale corresponds to the number of pixels per world unit, as determined by the ILcdXYWorldReference. For example, a view displaying geographical data could use a scale in pixels per meter.

      The default implementation in this interface sets both scales to the geometric mean of the requested scales. The concrete view implementations do respect the individual scales.

      Parameters:
      aScaleX - the new scale along the x-axis of the view.
      aScaleY - the new scale along the y-axis of the view.
      aRepaint - if true, the view is repainted. If false, the view is not repainted.
      aAdjusting - if true, the caller indicates that he will trigger another property change right after this call. This is reflected in the associated property change event.
      Since:
      2020.0
      See Also:
    • getScale

      double getScale()
      Returns the scale for which to paint the view contents expressed in toolkit pixels per world unit. The world unit is determined by the view's world reference. Increasing the scale zooms in, and decreasing the scale zooms out.

      For most use cases, we recommended using the unitless map scale instead.

      Returns:
      the scale of this view
      See Also:
    • getMapScale

      default TLcdMapScale getMapScale(TLcdMapScale.ScaleLocation aScaleLocation)
      Returns the unitless map scale ratio for which to paint the view contents.
      Returns:
      the scale of this view
      Since:
      2021.0
      See Also:
    • setMapScale

      default void setMapScale(TLcdMapScale aMapScale, TLcdMapScale.ScaleLocation aScaleLocation)
      Sets the unitless map scale ratio of this view, repainting the view according to isAutoUpdate.
      Parameters:
      aMapScale - the new scale of the view. The view is scaled using the world origin as center. The scale is limited so that it does not exceed the interval defined by the minimum and maximum scales. Never null.
      Since:
      2021.0
      See Also:
    • setMapScaleRange

      default void setMapScaleRange(TLcdDimensionInterval<TLcdMapScale> aMapScaleRange)
      Enforces the given limits on the minimum and maximum scale of the view. Subsequent calls of setScale(double) or setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation) will ensure that the scale falls within the given internal.
      Parameters:
      aMapScaleRange - a range expressing the minimum and maximum allowed scale of the view, or null to disable the scale range
      Since:
      2021.0
      See Also:
    • getMapScaleRange

      default TLcdDimensionInterval<TLcdMapScale> getMapScaleRange()
      Returns the limits on the minimum and maximum scale of the view. Subsequent calls of setScale(double) or setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation) will ensure that the scale falls within the given internal.
      Returns:
      a range expressing the minimum and maximum allowed scale of the view
      Since:
      2021.0
      See Also:
    • setMinScale

      void setMinScale(double aMinScale)
      Limits the maximum zoomed out scale of the view. Subsequent calls of setScale(double) or setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation) will ensure that the scale does not fall below the minimum scale.

      For most use cases, we recommended using the unitless map scale variant instead.

      Parameters:
      aMinScale - the new minimum scale of this view
      See Also:
    • getMinScale

      double getMinScale()
      Returns the maximum zoomed out scale of the view. Subsequent calls of setScale(double) or setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation) will ensure that the scale does not fall below the minimum scale.

      For most use cases, we recommended using the unitless map scale variant instead.

      Returns:
      the minimum scale of the view
      See Also:
    • setMaxScale

      void setMaxScale(double aMaxScale)
      Limits the maximum zoomed in scale of the view. Subsequent calls of setScale(double) or setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation) will ensure that the scale does not rise above the maximum scale.

      For most use cases, we recommended using the unitless map scale variant instead.

      Parameters:
      aMaxScale - the new maximum scale of this view
      See Also:
    • getMaxScale

      double getMaxScale()
      Returns the maximum zoomed in scale of the view. Subsequent calls of setScale(double) or setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation) will ensure that the scale does not rise above the maximum scale.

      For most use cases, we recommended using the unitless map scale variant instead.

      Returns:
      the maximum scale of the view
      See Also:
    • setWorldOrigin

      void setWorldOrigin(ILcdPoint aWorldOrigin)
      Sets the world origin of the view, repainting the view according to isAutoUpdate. The world origin is a point in world coordinates that maps onto the view origin.
      Parameters:
      aWorldOrigin - the new world origin of this view, expressed in world coordinates. Only the XY coordinates are considered.
      See Also:
    • setWorldOrigin

      void setWorldOrigin(ILcdPoint aWorldOrigin, boolean aRepaint)
      Sets the world origin of the view, optionally repainting the view. The world origin is a point in world coordinates that maps onto the view origin.
      Parameters:
      aWorldOrigin - the new world origin of this view, expressed in world coordinates. Only the XY coordinates are considered.
      aRepaint - if true, the view is repainted. If false, the view is not repainted.
      See Also:
    • setWorldOrigin

      void setWorldOrigin(ILcdPoint aWorldOrigin, boolean aRepaint, boolean aAdjusting)
      Sets the world origin of the view, optionally indicating subsequent property changes. The world origin is a point in world coordinates that maps onto the view origin.
      Parameters:
      aWorldOrigin - the new world origin of this view, expressed in world coordinates. Only the XY coordinates are considered.
      aRepaint - if true, the view is repainted. If false, the view is not repainted.
      aAdjusting - if true, the caller indicates that he will trigger another property change right after this call. This is reflected in the associated property change event.
      See Also:
    • getWorldOrigin

      ILcdPoint getWorldOrigin()
      Returns the point in world coordinates that maps onto the view origin. Hence, the combination of world origin and view origin determines which part of the world is visible in the view. The points are considered to be 'on top of each other'
      Returns:
      the world origin of the view, expressed in world coordinates. Only the XY coordinates of the point are relevant.
      See Also:
    • setViewOrigin

      void setViewOrigin(Point aViewOrigin)
      Sets the view origin of the view, repainting the view according to isAutoUpdate. The view origin is a point in AWT pixel coordinates that maps onto the world origin.
      Parameters:
      aViewOrigin - the new view origin of this view, expressed in AWT pixel coordinates
      See Also:
    • setViewOrigin

      void setViewOrigin(Point aViewOrigin, boolean aRepaint)
      Sets the view origin of the view, optionally repainting the view. The view origin is a point in AWT pixel coordinates that maps onto the world origin.
      Parameters:
      aViewOrigin - the new view origin of this view, expressed in AWT pixel coordinates
      aRepaint - if true, the view is repainted. If false, the view is not repainted.
      See Also:
    • setViewOrigin

      void setViewOrigin(Point aViewOrigin, boolean aRepaint, boolean aAdjusting)
      Sets the view origin of the view, optionally indicating subsequent property changes. The view origin is a point in AWT pixel coordinates that maps onto the world origin.
      Parameters:
      aViewOrigin - the new view origin of this view, expressed in AWT pixel coordinates
      aRepaint - if true, the view is repainted. If false, the view is not repainted.
      aAdjusting - if true, the caller indicates that he will trigger another property change right after this call. This is reflected in the associated property change event.
      See Also:
    • getViewOrigin

      Point getViewOrigin()
      Returns the point in AWT pixel coordinates that maps onto the world origin. Hence, the combination of world origin and view origin determines which part of the world is visible in the view. The points are considered to be 'on top of each other'.
      Returns:
      the view origin expressed in AWT pixel coordinates
      See Also:
    • setXYWorldReference

      void setXYWorldReference(ILcdXYWorldReference aXYWorldReference)
      Sets the view's 2D world coordinate system, repainting the view according to isAutoUpdate.
      Parameters:
      aXYWorldReference - the new ILcdXYWorldReference associated to this view
      See Also:
    • setXYWorldReference

      void setXYWorldReference(ILcdXYWorldReference aXYWorldReference, boolean aRepaint)
      Sets the view's 2D world coordinate system, optionally repainting the view.
      Parameters:
      aXYWorldReference - the new ILcdXYWorldReference associated to this view
      aRepaint - if true, the view is repainted. If false, the view is not repainted.
      See Also:
    • setXYWorldReference

      void setXYWorldReference(ILcdXYWorldReference aXYWorldReference, boolean aRepaint, boolean aAdjusting)
      Sets the view's 2D world coordinate system, optionally indicating subsequent property changes.
      Parameters:
      aXYWorldReference - the new ILcdXYWorldReference associated to this view
      aRepaint - if true, the view is repainted. If false, the view is not repainted.
      aAdjusting - if true, the caller indicates that he will trigger another property change right after this call. This is reflected in the associated property change event.
      See Also:
    • getXYWorldReference

      ILcdXYWorldReference getXYWorldReference()
      Returns the view's 2D world coordinate system.
      Returns:
      the view's 2D world coordinate system
      See Also:
    • setGXYController

      void setGXYController(ILcdGXYController aGXYController)

      Makes the given ILcdGXYController handle the user interaction of the view. The view calls the controller's startInteraction method to make the controller aware of this fact, and calls the previous controller's terminateInteraction method, if any.

      Implementations of this method can direct input events to the controller by checking, for example, if the controller implements AWT input interfaces such as KeyListener and MouseListener.

      Parameters:
      aGXYController - the new controller of this view, or null if no controller is to be used
      See Also:
    • getGXYController

      ILcdGXYController getGXYController()
      Returns the ILcdGXYController handling the user interaction of the view.
      Returns:
      the current controller handling the user interaction, or null if no controller is present
      See Also:
    • getDefaultPen

      ILcdGXYPen getDefaultPen()
      Deprecated.
      Use the relevant layer's pen instead. Implementations of this method should return a pen supporting editing and painting on the view.
      Returns an ILcdGXYPen supporting editing and painting on the view.
      Returns:
      the default ILcdGXYPen of this view
      See Also:
    • setPaintingMode

      void setPaintingMode(int aPaintingMode)
      Deprecated.
      This mode is not taken into account. Implementations should remember the value so that it can be queried using getPaintingMode().
      Sets the type or types of layer content to display in the ILcdGXYView.
      Parameters:
      aPaintingMode - a binary OR of ILcdGXYLayer.BODIES, ILcdGXYLayer.LABELS, ILcdGXYLayer.SELECTION
      See Also:
    • getPaintingMode

      int getPaintingMode()
      Deprecated.
      This mode is not taken into account.
      Gets the painting mode for this ILcdGXYView.
      Returns:
      a binary OR of ILcdGXYLayer.BODIES, ILcdGXYLayer.LABELS, ILcdGXYLayer.SELECTION
      See Also:
    • pan

      void pan(int aDeltaX, int aDeltaY, boolean aRepaint)
      Changes the view and/or world origin of the view so that the view contents are panned by the specified AWT delta. Implementations of this method are allowed to only repaint newly exposed areas, hence this method is preferred over simply changing the world origin.
      Parameters:
      aDeltaX - the shift in the X direction in screen coordinates
      aDeltaY - the shift in the Y direction in screen coordinates
      aRepaint - if true, will trigger a repaint of the view's contents. Depending on the implementation, only the newly exposed areas may be painted. If false, the view is not repainted.
    • paintGXYView

      void paintGXYView(Graphics aGraphics)
      Paints the view on the given Graphics. The painted image contains the following:
      • a background color;
      • the bodies of each contained layer's models. Each layer is asked to paint itself, from bottom to top;
      • the labels of each contained layer's models. Typically labels are painted on top of any bodies. The labels are painted by the layer itself, or by a view label painter, if it is set;
      • the selected bodies of each contained layer's models. Typically selections are painted on top of bodies and labels.
      • the selected labels of each contained layer's models. The labels are painted by the layer itself, or by a view label painter, if it is set;
      • corner icons, if any;
      • the controller handling user interaction.
      The view is allowed to reuse earlier painted results as long as they are valid. Invalidation of the contents may occur indirectly (e.g. by changing view or layer properties) or directly by calling one of the invalidate methods.
      Parameters:
      aGraphics - the Graphics to paint the contents of this view on
      See Also:
    • repaint

      void repaint()
      Repaints the view. The view is allowed to reuse earlier painted results as long as they are valid. Invalidation of the contents may occur indirectly (e.g. by changing view or layer properties) or directly by calling one of the invalidate methods. This method may return before the repaint is complete.
      See Also:
    • repaint

      void repaint(int aX, int aY, int aWidth, int aHeight)
      Repaints the view within the given AWT rectangle. The view is allowed to reuse earlier painted results as long as they are valid. Invalidation of the contents may occur indirectly (e.g. by changing view or layer properties) or directly by calling one of the invalidate methods. This method may return before the repaint is complete.
      Parameters:
      aX - the x-coordinate of the rectangle's top-left point
      aY - the y-coordinate of the rectangle's top-left point
      aWidth - the width of the rectangle
      aHeight - the height of the rectangle
      Since:
      3.1
      See Also:
    • invalidate

      void invalidate(boolean aRepaint, Object aSource, String aMessage)
      Asks the view to invalidate its content, optionally repainting the content asynchronously. A subsequent repaint will ask (at the least) all layers to draw their bodies, labels and selection. This method is typically called when the entire view needs to be redrawn, for example, after a zoom operation or projection change.
      Specified by:
      invalidate in interface ILcdView
      Parameters:
      aRepaint - if true, the view is updated immediately, but the method will not wait for the update to finish. If false, the view is updated on the next paint or repaint method call.
      aSource - class instance calling the method. For tracing purposes.
      aMessage - a message associated to this method call. For tracing purposes.
      See Also:
    • invalidateAndWait

      void invalidateAndWait(boolean aRepaint, Object aSource, String aMessage)
      Asks the view to invalidate its content, optionally repainting the content synchronously. A subsequent repaint will ask (at the least) all layers to draw their bodies, labels and selection. This method is typically called when the entire view needs to be redrawn, for example, after a zoom operation or projection change.
      Parameters:
      aRepaint - if true the ILcdGXYView will be updated immediately, and the method will block until the update is complete. If false, the view is updated on the next paint or repaint method call.
      aSource - class instance calling the method. For tracing purposes.
      aMessage - a message associated to this method call. For tracing purposes.
      See Also:
    • invalidateGXYLayer

      void invalidateGXYLayer(ILcdGXYLayer aGXYLayer, boolean aRepaint, Object aSource, String aMessage)
      Asks the view to invalidate the content of the given ILcdGXYLayer, optionally repainting the content asynchronously. A subsequent repaint will (at the least) ask the given layer to draw its bodies, labels and selection, and may reuse earlier generated imagery for the other layers. This method is typically called when a single layer needs to be redrawn, for example, when its painter settings change.
      Parameters:
      aGXYLayer - the layer to invalidate
      aRepaint - if true, the view is updated immediately, but the method will not wait for the update to finish. If false, the view is updated on the next paint or repaint method call.
      aSource - class instance calling the method. For tracing purposes.
      aMessage - a message associated to this method call. For tracing purposes.
    • invalidateGXYLayerAndWait

      void invalidateGXYLayerAndWait(ILcdGXYLayer aGXYLayer, boolean aRepaint, Object aSource, String aMessage)
      Asks the view to invalidate the content of the given ILcdGXYLayer, optionally repainting the content synchronously. A subsequent repaint will (at the least) ask the given layer to draw its bodies, labels and selection, and may reuse earlier generated imagery for the other layers. This method is typically called when a single layer needs to be redrawn, for example, when its painter settings change.
      Parameters:
      aGXYLayer - the layer to invalidate
      aRepaint - if true the ILcdGXYView will be updated immediately, and the method will block until the update is complete. If false, the view is updated on the next paint or repaint method call.
      aSource - class instance calling the method. For tracing purposes.
      aMessage - a message associated to this method call. For tracing purposes.
      See Also:
    • invalidateRegion

      void invalidateRegion(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
      Asks the view to invalidate the content in the given AWT clip, optionally repainting the content asynchronously. A subsequent repaint will ask (at the least) all layers to draw their bodies, labels and selection in the given clip, and may reuse earlier generated imagery for the rest of the view. This method is typically called when a small portion of the view needs to be redrawn, for example, when the objects in that area have changed.
      Parameters:
      aClip - the clip to invalidate
      aRepaint - if true, the view is updated immediately, but the method will not wait for the update to finish. If false, the view is updated on the next paint or repaint method call.
      aSource - class instance calling the method. For tracing purposes.
      aMessage - a message associated to this method call. For tracing purposes.
      See Also:
    • invalidateRegionAndWait

      void invalidateRegionAndWait(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
      Asks the view to invalidate the content in the given AWT clip, optionally repainting the content synchronously. A subsequent repaint will ask (at the least) all layers to draw their bodies, labels and selection in the given clip, and may reuse earlier generated imagery for the rest of the view. This method is typically called when a small portion of the view needs to be redrawn, for example, when the objects in that area have changed.
      Parameters:
      aClip - the clip to invalidate
      aRepaint - if true the ILcdGXYView will be updated immediately, and the method will block until the update is complete. If false, the view is updated on the next paint or repaint method call.
      aSource - class instance calling the method. For tracing purposes.
      aMessage - a message associated to this method call. For tracing purposes.
      See Also:
    • invalidateRegionSelection

      void invalidateRegionSelection(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
      Asks the ILcdGXYView to invalidate its selection in the given AWT clip, optionally repainting the content asynchronously. A subsequent repaint will ask (at the least) all layers to draw their selection in the given clip, and may reuse earlier generated imagery for the bodies, labels, and rest of the view. This method is typically called when the selection of a small portion of the view needs to be redrawn, for example, when changing the selection in that area.
      Parameters:
      aClip - the clip to invalidate
      aRepaint - if true, the view is updated immediately, but the method will not wait for the update to finish. If false, the view is updated on the next paint or repaint method call.
      aSource - class instance calling the method. For tracing purposes.
      aMessage - a message associated to this method call. For tracing purposes.
      See Also:
    • invalidateRegionSelectionAndWait

      void invalidateRegionSelectionAndWait(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
      Asks the ILcdGXYView to invalidate its selection in the given AWT clip, optionally repainting the content synchronously. A subsequent repaint will ask (at the least) all layers to draw their selection in the given clip, and may reuse earlier generated imagery for the bodies, labels, and rest of the view. This method is typically called when the selection of a small portion of the view needs to be redrawn, for example, when changing the selection in that area.
      Parameters:
      aClip - the clip to invalidate
      aRepaint - if true the ILcdGXYView will be updated immediately, and the method will block until the update is complete. If false, the view is updated on the next paint or repaint method call.
      aSource - class instance calling the method. For tracing purposes.
      aMessage - a message associated to this method call. For tracing purposes.
      See Also:
    • invalidateSelection

      void invalidateSelection(boolean aRepaint, Object aSource, String aMessage)
      Asks the ILcdGXYView to invalidate its selection, optionally repainting the content asynchronously. A subsequent repaint will ask (at the least) all layers to draw their selection, and may reuse earlier generated imagery for the bodies and labels. This method is typically called when the selection needs to be redrawn, for example, when changing the selection.
      Parameters:
      aRepaint - if true, the view is updated immediately, but the method will not wait for the update to finish. If false, the view is updated on the next paint or repaint method call.
      aSource - class instance calling the method. For tracing purposes.
      aMessage - a message associated to this method call. For tracing purposes.
      See Also:
    • invalidateSelectionAndWait

      void invalidateSelectionAndWait(boolean aRepaint, Object aSource, String aMessage)
      Asks the ILcdGXYView to invalidate its selection, optionally repainting the content synchronously. A subsequent repaint will ask (at the least) all layers to draw their selection, and may reuse earlier generated imagery for the bodies and labels. This method is typically called when the selection needs to be redrawn, for example, when changing the selection.
      Parameters:
      aRepaint - if true the ILcdGXYView will be updated immediately, and the method will block until the update is complete. If false, the view is updated on the next paint or repaint method call.
      aSource - class instance calling the method. For tracing purposes.
      aMessage - a message associated to this method call. For tracing purposes.
      See Also:
    • setDrawOffScreenImageOnPaint

      void setDrawOffScreenImageOnPaint(boolean aDrawOffScreenImageOnPaint)
      Sets whether the entire view's content is displayed, or only the current controller's representation. The controller can use this method to temporarily override the view's contents. The effect is visible upon the next repaint.
      Parameters:
      aDrawOffScreenImageOnPaint - true to make the view paint itself when one of the paint methods is called. False if only the current controller is painted.
      See Also:
    • isDrawOffScreenImageOnPaint

      boolean isDrawOffScreenImageOnPaint()
      Returns whether the entire view's content is displayed, or only the controller's representation.
      Returns:
      true if the view paints itself when one of the paint methods is called. False if only the current controller is painted.
      See Also:
    • getGXYViewLabelPainter

      ILcdGXYViewLabelPainter getGXYViewLabelPainter()
      Deprecated.
      ILcdGXYViewLabelPlacer offers more powerful and flexible decluttering functionality
      Returns the label painting algorithm for this view. A view label painter handles the labels of all the view's layers. Hence, the layers are not asked to paint their labels if the view label painter is not null. The view label painter can be used for decluttering labels across all layers. To do this, it can select the objects that need a label and delegate the actual painting to the relevant layer's ILcdGXYLabelPainter.
      Returns:
      the painter handling this view's labels, or null
      See Also:
    • getGXYViewLabelPlacer

      default ILcdGXYViewLabelPlacer getGXYViewLabelPlacer()
      Returns the label placer for this view. A view label placer handles the labels of all the view's layers. The layers are only responsible for painting their labels while the label placer declutters the labels.
      Returns:
      the label placer handling this view's labels, or null.
      Since:
      2020.0
      See Also:
    • setGXYViewLabelPlacer

      default void setGXYViewLabelPlacer(ILcdGXYViewLabelPlacer aLabelPlacer)
      This method sets an ILcdGXYViewLabelPlacer to use for global labeling.

      This will override any configured view label painter.

      Parameters:
      aLabelPlacer - a view label placer.
      Since:
      2020.0
      See Also:
    • isPaintInBackground

      boolean isPaintInBackground()
      Deprecated.
      This method has been deprecated in favor of the approach provided by the ILcdGXYAsynchronousLayerWrapper interface and its implementations, which is more versatile and which generally offers better thread safety.
      Returns whether the view is painted in a thread other than the event dispatch thread.
      Returns:
      true if background painting is enabled; false otherwise
    • setPaintInBackground

      void setPaintInBackground(boolean aPaintInBackground)
      Deprecated.
      This method has been deprecated in favor of the approach provided by the ILcdGXYAsynchronousLayerWrapper interface and its implementations, which is more versatile and which generally offers better thread safety.
      Enables or disables painting in a thread other than the event dispatch thread. If background painting is not supported by an implementation, this method throws a runtime exception.
      Parameters:
      aPaintInBackground - true to enable painting in the background; false to disable it
    • getPaintExceptionHandler

      ILcdPaintExceptionHandler getPaintExceptionHandler()
      Returns a handler to report paint exceptions. The view, as well as layers and painters can use this handler if they encounter an exception during painting. Because painting may happen asynchronously, the handler may be called from different threads.
      Returns:
      a handler to report paint exceptions.
    • setPaintExceptionHandler

      default void setPaintExceptionHandler(ILcdPaintExceptionHandler aPaintExceptionHandler)
      Sets a handler to report paint exceptions. Layers and/or painters can use this handler if they encounter a problem during painting. Because painting may happen asynchronously, the handler may be called from different threads.
      Parameters:
      aPaintExceptionHandler - a handler to report paint exceptions. This handler should never be null.
      Since:
      2020.0
    • isAsynchronousAllowed

      boolean isAsynchronousAllowed()

      Returns whether this view allows asynchronous operations. Painters, layers or other parts of a view should not perform asynchronous operations when this method returns false. If this method returns true, they can decide either way.

      When asynchronous operations are allowed, intermediate results of time-consuming asynchronous operations are displayed in order to provide an interactive user experience. For non-interactive applications, it is useful to disable asynchronous operations, since they can lead to more unpredictable results. Examples are tests, or server side functionality like the OGC WMS protocol which paints the view and returns it as an image. In these cases, you want the view to be painted completely without having to deal with intermediate results.

      Returns:
      whether this view allows asynchronous operations.
      Since:
      2017.0
    • isAntiAliased

      boolean isAntiAliased()
      Specifies if anti-aliasing is enabled or not. Anti-aliasing makes lines and text appear smoother, but slows down rendering a little bit. If this property is false, it does not mean anti-aliasing is fully disabled. It only means anti-aliasing is not enabled on the view level, various layers and painters may still decide to enable anti-aliasing for what they render.
      Returns:
      true if anti-aliasing is enabled, false otherwise.
      Since:
      2017.0
    • addStatusListener

      default void addStatusListener(ILcdStatusListener aStatusListener)
      Registers the given ILcdStatusListener to be notified of view status events. The amount, type and order of the status events is subject to change.
      Specified by:
      addStatusListener in interface ILcdStatusSource
      Parameters:
      aStatusListener - the listener that will be informed of status events
      See Also:
    • removeStatusListener

      default void removeStatusListener(ILcdStatusListener aStatusListener)
      Unregisters the given ILcdStatusListener from being notified of view status events.
      Specified by:
      removeStatusListener in interface ILcdStatusSource
      Parameters:
      aStatusListener - the listener that will no longer be informed of status events
      See Also:
    • addViewInvalidationListener

      default void addViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
      Registers an ILcdViewInvalidationListener to be informed when the view's contents are invalid. This can happen directly (e.g. by calling invalidateGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, boolean, java.lang.Object, java.lang.String)) or indirectly (e.g. by calling pan(int, int, boolean))
      Parameters:
      aInvalidationListener - the listener to notify when the view has been invalidated
      Since:
      2020.0
      See Also:
    • removeViewInvalidationListener

      default void removeViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
      Unregisters an ILcdViewInvalidationListener so that it is no longer informed of invalidation events for this view.
      Parameters:
      aInvalidationListener - the listener to no longer notify when the view has been invalidated
      Since:
      2020.0
      See Also: