Class TLspRadarVideoLayerBuilder

java.lang.Object
com.luciad.view.lightspeed.layer.ALspLayerBuilder
com.luciad.realtime.lightspeed.radarvideo.TLspRadarVideoLayerBuilder

public class TLspRadarVideoLayerBuilder extends ALspLayerBuilder
Builds layers that visualize radar video feeds, for instance from ASTERIX category 240 data. Feeds are visualized in the typical fashion, using a rotating sweep line and afterglow effects on detected objects. This layer builder only accepts models whose model descriptor is an ILcdDataModelDescriptor whose element types contain a TLcdDataType which extends from TLcdRadarVideoDataTypes.RADAR_VIDEO_DATA_TYPE.

Customizing the radar visualization

The appearance of the radar video can be configured using TLspRadarVideoStyle. Additionally, the layers created by this builder support the same styling constructs as TLspShapeLayerBuilder. This allows the user to add decorations (e.g. grid lines) and labels to the radar feed.

The default styler shows the radar video data, a sweep line and a polar grid. This styler is a ILspCustomizableStyler, which means you can adjust the style of these elements after you have created this layer.

The identifiers of this ILspCustomizableStyler are:

You can use these identifiers if you want to change the style of one of these elements. For instance, changing the color of the sweep line:

  private ILspLayer createRadarLayer(ILcdModel aModel) {
    ILspEditableStyledLayer radarLayer = TLspRadarVideoLayerBuilder
        .newBuilder()
        .model(aModel)
        .build();

    ILspCustomizableStyler styler = (ILspCustomizableStyler) radarLayer.getStyler(
        TLspPaintRepresentationState.REGULAR_BODY
    );

    for (TLspCustomizableStyle style : styler.getStyles()) {
      if (style.getIdentifier().equals(TLspRadarVideoLayerBuilder.SWEEP_LINE_STYLE_IDENTIFIER)) {
        TLspLineStyle originalStyle = (TLspLineStyle) style.getStyle();
        style.setStyle(originalStyle.asBuilder().color(Color.BLUE).build());
      }
    }

    return radarLayer;
  }

For deeper customization, you can replace the styler with your own implementation. For example if you want to change the number of range rings:

  public class RadarStyler extends ALspStyler {
    private static final int RING_COUNT = 3;

    private static final ALspStyleTargetProvider sRangeRingStyleTargetProvider = new ALspStyleTargetProvider() {
      @Override
      public void getStyleTargetsSFCT(Object aObject, TLspContext aContext, List<Object> aResultSFCT) {
        double range = (Double) ((ILcdDataObject) aObject).getValue(TLcdRadarVideoDataTypes.RADAR_RANGE_PROPERTY);

        // Range rings
        for (int i = 1; i <= RING_COUNT; i++) {
          TLcdXYCircle c = new TLcdXYCircle(0, 0, i * range / RING_COUNT);
          aResultSFCT.add(c);
        }
      }
    };

    private final ALspStyle fRadarStyle = TLspRadarVideoStyle.newBuilder().build();
    private final ALspStyle fRingStyle = TLspLineStyle.newBuilder().build();

    @Override
    public void style(Collection<?> aObjects, ALspStyleCollector aStyleCollector, com.luciad.view.lightspeed.TLspContext aContext) {
      aStyleCollector
          .objects(aObjects)
          .styles(fRadarStyle)
          .submit();
      aStyleCollector
          .objects(aObjects)
          .geometry(sRangeRingStyleTargetProvider)
          .styles(fRingStyle)
          .submit();
    }
  }

Data resolution

For more information on the modeling of radar data, please refer to TLcdRadar. The resolution of a radar video feed is determined by two properties:
  • The angular resolution depends on the azimuth range covered by each individual data record
  • The radial resolution depends on the "cell length" property of each data record
By default, a radar layer will assume that these properties are constant (see exact details below) for the entire lifetime of the layer. The layer will consume the first 100 data records without painting them, and use them to infer the angular and radial resolution of the data. The resolution of the visualization will match that of the data exactly. The following assumptions are made in this case:
  • The radar data is treated as uniform data: based on the records in the initialization phase, all sweep lines are treated as if they have the same azimuth arc angle. The azimuth arc angle is the difference between start and end azimuth.
  • A sweep line can be provided in multiple parts, meaning two records will be received with the same start and end azimuth, but with a different start range. In that case, the cell lengths in both calls must be equal or an integer multiple of each other.
  • The number of radial steps is chosen based on the smallest encountered cell length. If the cell length is variable, we assume that larger cells use a multiple of the smallest ones.

It is, however, also possible to decouple the resolution of the visualization from that of the data, by calling the displayResolution(TLspRadarDisplayResolution) method. This method allows you to specify the resolution and range of the visualization, thus providing a trade-off between performance and quality. The incoming data records will be resampled to match the resolution you specified. This resampling step is performed by the GPU and is therefore very efficient. If you enable this behavior, your radar layer can support radar data with variable angular or radial resolutions, which does not meet the assumptions outlined above. As a result, such data will not introduce errors in the display.

Since:
2014.1
See Also:
  • Field Details

    • RADAR_VIDEO_STYLE_IDENTIFIER

      public static final String RADAR_VIDEO_STYLE_IDENTIFIER
      Identifier for the TLspCustomizableStyle for the radar video. The style contained in that TLspCustomizableStyle is a TLspRadarVideoStyle.
      Since:
      2018.0
      See Also:
    • GRID_LINE_STYLE_IDENTIFIER

      public static final String GRID_LINE_STYLE_IDENTIFIER
      Identifier for the TLspCustomizableStyle for the polar grid lines. The style contained in that TLspCustomizableStyle is a TLspLineStyle.
      Since:
      2018.0
      See Also:
    • RANGE_RING_STYLE_IDENTIFIER

      public static final String RANGE_RING_STYLE_IDENTIFIER
      Identifier for the TLspCustomizableStyle for the range rings. The style contained in that TLspCustomizableStyle is a TLspLineStyle.
      Since:
      2018.0
      See Also:
    • SWEEP_LINE_STYLE_IDENTIFIER

      public static final String SWEEP_LINE_STYLE_IDENTIFIER
      Identifier for the TLspCustomizableStyle for the sweep line. The style contained in that TLspCustomizableStyle is a TLspLineStyle.
      Since:
      2018.0
      See Also:
  • Method Details

    • newBuilder

      public static TLspRadarVideoLayerBuilder newBuilder()
      Creates a new radar layer builder.
      Returns:
      a new radar layer builder
    • build

      public ILspEditableStyledLayer build()
      Creates a new radar layer using the current settings of this builder.
      Specified by:
      build in class ALspLayerBuilder
      Returns:
      a new radar layer
    • bodyStyler

      public TLspRadarVideoLayerBuilder bodyStyler(TLspPaintState aPaintState, ILspStyler aBodyStyler)
      Sets the body styler for the given paint state. The styler can produce TLspRadarVideoStyles to customize the appearance of the radar feed. Furthermore, the styler may output additional geometries (using a style target provider).e For these additional geometries, all styles supported by TLspShapeLayerBuilder are also supported. This allows the styler to add decorations such as grid lines on top of the radar feed.
      Parameters:
      aPaintState - the paint state for which to set the body styler
      aBodyStyler - the new body styler for the layer
      Returns:
      this
    • labelStyler

      public TLspRadarVideoLayerBuilder labelStyler(TLspPaintState aPaintState, ILspStyler aLabelStyler)
      Sets the label styler for the given paint state. See TLspShapeLayerBuilder for information on the supported styles.
      Parameters:
      aPaintState - the paint state for which to set the label styler
      aLabelStyler - the new label styler for the layer
      Returns:
      this
    • selectable

      public TLspRadarVideoLayerBuilder selectable(boolean aSelectable)
      Specifies whether layers should be made selectable. Set to true by default.
      Parameters:
      aSelectable - whether or not created layers should be selectable
      Returns:
      this
    • selectableSupported

      public TLspRadarVideoLayerBuilder selectableSupported(boolean aSelectableSupported)
      Sets whether the layer should support selection. By default, layers support selection.
      Parameters:
      aSelectableSupported - whether the layer should support selection
      Returns:
      this
    • synchronous

      public TLspRadarVideoLayerBuilder synchronous(boolean aIsSynchronous)
      Specifies whether created layers should paint synchronously. The default is false and allows layers to perform shape discretization and other expensive processing using the view's ILspTaskExecutor. When synchronous mode is on, all such tasks are performed on the EDT.

      It is strongly recommended to leave this setting off, to ensure that the application remains responsive. Applications that need to change the view's world reference on a regular basis, however, may want to consider synchronous mode to avoid flickering.

      Parameters:
      aIsSynchronous - true if the layer should paint synchronously
      Returns:
      this
    • model

      public TLspRadarVideoLayerBuilder model(ILcdModel aModel)
      Description copied from class: ALspLayerBuilder
      Sets the model of the layer.

      The default value is null.

      Overrides:
      model in class ALspLayerBuilder
      Parameters:
      aModel - a model
      Returns:
      this builder
      See Also:
    • label

      public TLspRadarVideoLayerBuilder label(String aLabel)
      Description copied from class: ALspLayerBuilder
      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 null.

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

      public TLspRadarVideoLayerBuilder icon(ILcdIcon aIcon)
      Description copied from class: ALspLayerBuilder
      Sets the icon of the layer.

      The default value is null.

      Overrides:
      icon in class ALspLayerBuilder
      Parameters:
      aIcon - the icon
      Returns:
      this builder
      See Also:
    • layerStyle

      public TLspRadarVideoLayerBuilder 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:
    • layerType

      public TLspRadarVideoLayerBuilder layerType(ILspLayer.LayerType aLayerType)
      This method throws an UnsupportedOperationException. The layer type of radar layers is always ILspLayer.LayerType.REALTIME.
      Overrides:
      layerType in class ALspLayerBuilder
      Parameters:
      aLayerType - the layer type
      Returns:
      this
      See Also:
    • displayResolution

      public TLspRadarVideoLayerBuilder displayResolution(TLspRadarDisplayResolution aSettings)
      Specifies the resolution and range of the radar data that is visualized. Data that lies outside the specified distance range will not be displayed, and incoming data will be resampled to match the requested radial and angular resolution. If this method is not called, the layer will infer the range and resolution of the radar feed by looking at the data records themselves, but this requires the feed resolution to be constant (i.e. the cell size and azimuth interval must be consistently the same in all radar data records).
      Parameters:
      aSettings - the resolution settings to be used for the radar display.
      Returns:
      this
      Since:
      2024.0