Uploaded image for project: 'GeoServer'
  1. GEOS-7698

Raster legend border colour ignored

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 2.8.4, 2.9.1
    • Fix Version/s: 2.9.2, 2.10-RC1
    • Component/s: WMS
    • Labels:
    • Environment:

      Java 1.8 Windows 7

      Description

      The raster legend border colour is ignored.

      In class org.geoserver.wms.legendgraphic.RasterLayerLegendHelper the method parseRequest() creates all the necessary objects with the correct legend configuration.

          private void parseRequest(final GetLegendGraphicRequest request,Style gt2Style,String ruleName) {
      
      
         ...
                  // passing additional options
                  cmapLegendBuilder.setAdditionalOptions(request.getLegendOptions());
      
      ...
      
                  // adding the colormap entries
                  final ColorMapEntry[] colorMapEntries = cmap.getColorMapEntries();
                  ColorMapEntryLegendBuilder lastEntry = null;
                  boolean first = true;
                  for (ColorMapEntry ce : colorMapEntries) {
                      if(ce == null) {
                          continue;
                      }
                      final Double qty = ce.getQuantity().evaluate(null, Double.class);
                      if(cmap.getType() == ColorMap.TYPE_INTERVALS && first && qty < 0 && Double.isInfinite(qty)) {
                          continue;
                      }
                      lastEntry = cmapLegendBuilder.addColorMapEntry(ce);
                      first = false;
                  }
                  if(lastEntry != null) {
                      lastEntry.setLastRow();
                  }
      
                  // check the additional options before proceeding
                  cmapLegendBuilder.checkAdditionalOptions();
      }
      

      The following line creates all the necessary raster legend with configuration:

                      lastEntry = cmapLegendBuilder.addColorMapEntry(ce);
      

      However the border colour is not available until the following line is called:

                  cmapLegendBuilder.checkAdditionalOptions();
      

      This is after the colour entry objects are created hence the border colours are always black.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              robward Robert Ward
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified