Class TLspXYGridOverlayLabelBuilder

java.lang.Object
com.luciad.view.lightspeed.painter.grid.TLspXYGridOverlayLabelBuilder

public class TLspXYGridOverlayLabelBuilder extends Object

Builder that makes it possible to create XY grid overlay labels. These are text labels that are added to the view and show a grid coordinate. These labels can have a pre-defined content, and style. Note that overlay labels are not attached to grid lines, but are added to the view.

The overlay label builder can be used in 2 ways:

  • To build a JComponent that contains a coordinate readout. This component can be used as any Swing component. It can for example be added to the overlay panel or to a UI panel.
  • To add to TLspXYGridLayerBuilder, see TLspXYGridLayerBuilder#overlayLabel. When using this method, the overlay label will be added to the overlay panel of the view. On top of that, the visibility of the overlay label will be synchronized with the visibility of the layer.

An example of how to use this builder:


   JComponent component = TLspXYGridOverlayLabelBuilder.newBuilder(view)
       .content(TLspXYGridOverlayLabelBuilder.Content.COORDINATE_AT_CENTER)
       .style(gridStyle)
       .build();
 
Since:
2016.0
  • Method Details

    • newBuilder

      public static TLspXYGridOverlayLabelBuilder newBuilder()
      Creates a new builder, capable of adding XY grid labels.
      Returns:
      a new builder
    • view

      The view for which the overlay labels should be added. This method should not be called when adding this overlay layer builder to the grid layer, see TLspXYGridLayerBuilder#overlayLabel.
      Parameters:
      aView - the view.
      Returns:
      this builder.
    • useWorldReference

      public TLspXYGridOverlayLabelBuilder useWorldReference(boolean aUseWorldReference)

      When set to true, the world reference of the view will be used as reference in which the overlay label displays coordinates. When not calling the view() method when this method is used, an exception will be thrown when trying to build an overlay label. Note that the view method will be called automatically when adding this TLspXYGridOverlayLabelBuilder to the grid layer builder, see TLspXYGridLayerBuilder#overlayLabel.

      When this method is called with true as argument, the modelReference method will have no effect. When this method is called with false as argument, the modelReference method must be called.

      Returns:
      this builder
    • modelReference

      public TLspXYGridOverlayLabelBuilder modelReference(ILcdModelReference aModelReference)
      The model reference in which the overlay label displays its coordinates. This method will have no effect when useWorldReference(boolean) is called with true as argument. When calling this method, useWorldReference() will be set to false.
      Parameters:
      aModelReference - the model reference of the grid for which an overlay label should be displayed.
      Returns:
      this builder.
    • content

      The content which is being displayed.

      By default, the content is COORDINATE_AT_CENTER.

      Parameters:
      aContent - coordinate which is being displayed.
      Returns:
      this builder
    • style

      public TLspXYGridOverlayLabelBuilder style(TLspXYGridStyle aXYGridStyle)

      The style with which the overlay label is being displayed. When using this method, only styles and formats set after using the TLspXYGridStyle.Builder.overlay() method are used. Only the following styles are supported:

      This method is optional: when it is not called, a default style is used.

      Parameters:
      aXYGridStyle - the XY grid style.
      Returns:
      this builder.
    • all

      Copies all properties from the given builder.
      Parameters:
      aBuilder - a builder
      Returns:
      this builder.
    • build

      public JComponent build()
      Creates an XY grid label.
      Returns:
      the created label.