You can change the visibility colors in several ways:

  • As the end user of a Lucy application, you can change the colors in the layer properties dialog box of the Observation Results layer.

  • You can change the default colors in the default style file. See the TLcyLspShapeVisibilityFormatAddOn.observationResults.defaultStyleFile property in the TLcyLspShapeVisibilityFormatAddOn configuration file.

  • As a developer, you can change the colors through the TLspIndexColorModelStyle exposed by the ILspCustomizableStyler used on the layer. You can modify the style to change the colors:

    //Retrieve the body styler from the observation results layer
    ILspCustomizableStyler styler = (ILspCustomizableStyler) aObservationResultsLayer.getStyler(TLspPaintRepresentationState.REGULAR_BODY);
    
    //Ask the styler for its styles, and find the index color model style
    Optional<TLspCustomizableStyle> customizableIndexColorModelStyle =
        styler.getStyles()
              .stream()
              .filter(customizableStyle -> customizableStyle.getStyle() instanceof TLspIndexColorModelStyle)
              .findFirst();
    
    //Update the colors in the index color model style
    customizableIndexColorModelStyle.ifPresent(customizableStyle -> {
      //Create a color map for the visibility values
      TLcdColorMap colorMap =
          new TLcdColorMap(new TLcdInterval(TLcyLspShapeVisibilityFormatAddOn.VISIBLE_VALUE - 1, TLcyLspShapeVisibilityFormatAddOn.NOT_COMPUTED_VALUE),
                           new double[]{TLcyLspShapeVisibilityFormatAddOn.VISIBLE_VALUE,
                                        TLcyLspShapeVisibilityFormatAddOn.INVISIBLE_VALUE,
                                        TLcyLspShapeVisibilityFormatAddOn.UNCERTAIN_VALUE,
                                        TLcyLspShapeVisibilityFormatAddOn.OUTSIDE_SHAPE_VALUE},
                           new Color[]{new Color(50, 255, 131, 128),
                                       new Color(221, 54, 34, 128),
                                       new Color(248, 255, 139, 128),
                                       new Color(255, 255, 255, 0),
                                       new Color(128, 128, 128, 128)});
      colorMap.setLevelInclusion(TLcdColorMap.LevelInclusion.INCLUDES_END_POINT);
      //Wrap the color map in a TLspIndexColorModelStyle
      TLspIndexColorModelStyle updatedStyle = TLspIndexColorModelStyle.newBuilder()
                                                                      .all(customizableStyle.getStyle())
                                                                      .indexColorModel(new TLcdIndexColorModel(8, colorMap))
                                                                      .build();
      //Update the style in the TLspCustomizableStyle
      customizableStyle.setStyle(updatedStyle);
    });