Class TLspXYGridLayerBuilder

java.lang.Object
com.luciad.view.lightspeed.layer.ALspLayerBuilder
com.luciad.view.lightspeed.painter.grid.TLspXYGridLayerBuilder

public class TLspXYGridLayerBuilder extends ALspLayerBuilder

Builder for creating ILspLayer instances that visualize cartesian (XY) grid data. The styling of the XY grid and its labels can be done using TLspXYGridStyle.

An example of how to use this builder:


   TLspXYGridStyle gridStyle = ...; // See TLspXYGridStyle documentation
   ILcdModel gridModel = TLspXYGridLayerBuilder.createModel("XY grid");
   ILspLayer layer = TLspXYGridLayerBuilder.newBuilder()
       .model(gridModel)
       .label("XY grid")
       .style(gridStyle)
       .build();
 

It is possible to specify a model reference for the xy grid, or to make the grid always use the world reference. Note that not all model references are supported. Geocentric references are not supported for example, which means that this grid can not be used in a (geocentric) 3D view. In that case nothing is visualized.

Since:
2016.0
  • Method Details

    • newBuilder

      public static TLspXYGridLayerBuilder newBuilder()
      Returns a new XY grid layer builder
      Returns:
      a new XY grid layer builder
    • createModel

      public static ILcdModel createModel(String aModelName, ILcdModelReference aModelReference)

      Creates a model that can be used by this builder. This method makes it is possible to specify the used model reference and model name. The model name is used as a default display name for the layer created by this builder. This method throws an exception when the given model reference is not an ILcdXYWorldReference.

      Use this method when you want your grid to be warped by the world reference.

      Parameters:
      aModelName - The desired model name
      aModelReference - The model reference in which the grid is defined
      Returns:
      A model that can be used in this builder.
    • createModel

      public static ILcdModel createModel(String aModelName)

      Creates a model that can be used by this builder and uses the same reference as the view it is visualized in. This means that the grid uses a different reference during painting when the world reference of the view changes. The model name is used as a default display name for the layer created by this builder.

      Use this method when you always want to display an axis-aligned grid.

      When the world reference of the view to which this grid model is added is not an ILcdXYWorldReference, nothing will be painted.

      Note that the returned model will always have a default geodetic model reference. So the model reference of the created model will not be changed to the model reference of the view. The XY grid layer will make sure that the grid is generated/painted for the world reference though. This is not explicitly modelled though.

      Calling this method is optional. If not called, the layer builder will create a default model using this method.

      Parameters:
      aModelName - The desired model name
      Returns:
      A model that can be used in this builder.
    • model

      public TLspXYGridLayerBuilder model(ILcdModel aModel)

      Sets the model of the layer. This model should be created using one of the following methods:

      Calling this method is optional. If not called, the layer builder will create a default model using the createModel(String) method.

      Overrides:
      model in class ALspLayerBuilder
      Parameters:
      aModel - a model
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the given model is not a valid xy grid model.
      See Also:
    • label

      public TLspXYGridLayerBuilder label(String aLabel)
      Sets the label of the layer. This is a short textual representation for it, often used to represent the layer to end-users.

      The default value is "XY Grid".

      Overrides:
      label in class ALspLayerBuilder
      Parameters:
      aLabel - the label
      Returns:
      this builder
      See Also:
    • layerType

      public TLspXYGridLayerBuilder layerType(ILspLayer.LayerType aLayerType)
      This method is not supported for XY grid layers
      Overrides:
      layerType in class ALspLayerBuilder
      Parameters:
      aLayerType - the layer type
      Returns:
      this builder
      Throws:
      UnsupportedOperationException - this method is not supported for XY grid layers
      See Also:
    • layerStyle

      public TLspXYGridLayerBuilder layerStyle(TLspLayerStyle aLayerStyle)
      Description copied from class: ALspLayerBuilder
      Set a layer style to be used during the rendering of the layer. TLspLayerStyle is used to style the layer as a whole. Layer style can for example modify the transparency of a layer. Also, layer style can be modified after building the layer by calling ILspLayer.setLayerStyle(TLspLayerStyle).
      Overrides:
      layerStyle in class ALspLayerBuilder
      Parameters:
      aLayerStyle - the layer style. Must not be null. If you want to set the default layer style, set TLspLayerStyle.newBuilder().build()
      Returns:
      this
      See Also:
    • style

      public TLspXYGridLayerBuilder style(TLspXYGridStyle aXYGridStyle)

      Sets the style to be used by this layer. This method is optional: when it is not called, a default style is used.

      Parameters:
      aXYGridStyle - the XY grid style to use.
      Returns:
      this builder.
    • overlayLabel

      public TLspXYGridLayerBuilder overlayLabel(TLspXYGridOverlayLabelBuilder aOverlayLabelBuilder, Object aConstraint)

      Adds an overlay label to be used. When the layer (built using this builder) is added to the view, this overlay label builder is used to add an overlay component to a view. The overlay component is also removed when the layer is removed from a view.

      Parameters:
      aOverlayLabelBuilder - the overlay label builder used to create an overlay component. It is not needed to call the TLspXYGridOverlayLabelBuilder.view() method before calling this method. This will be done automatically when the build() method is called.
      aConstraint - an object expressing layout constraints for this component, usually one of these location constants.
      Returns:
      this builder.
    • build

      public ILspStyledLayer build()

      Creates a new layer instance.

      This builder returns an ILspStyledLayer that contains ILspCustomizableStyler instances.

      Specified by:
      build in class ALspLayerBuilder
      Returns:
      the new layer instance