Class BoundsPaintScale

java.lang.Object
org.opentrafficsim.draw.BoundsPaintScale
All Implemented Interfaces:
org.jfree.chart.renderer.PaintScale, ColorPaintScale

public class BoundsPaintScale extends Object implements ColorPaintScale
Paint scale interpolating between colors at values.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

    • BoundsPaintScale

      public BoundsPaintScale(double[] bounds, Color[] boundColors) throws IllegalArgumentException
      Constructor.
      Parameters:
      bounds - value bounds
      boundColors - colors at bounds
      Throws:
      IllegalArgumentException - if less than 2 bounds, unequal number of bounds and colors, or duplicate bounds
    • BoundsPaintScale

      public BoundsPaintScale(double[] bounds, Color[] boundColors, Color notApplicable) throws IllegalArgumentException
      Constructor.
      Parameters:
      bounds - value bounds
      boundColors - colors at bounds
      notApplicable - color for NaN values
      Throws:
      IllegalArgumentException - if less than 2 bounds, unequal number of bounds and colors, or duplicate bounds
  • Method Details

    • getPaint

      public Color getPaint(double value)
      Specified by:
      getPaint in interface ColorPaintScale
      Specified by:
      getPaint in interface org.jfree.chart.renderer.PaintScale
    • getLowerBound

      public final double getLowerBound()
      Specified by:
      getLowerBound in interface org.jfree.chart.renderer.PaintScale
    • getUpperBound

      public final double getUpperBound()
      Specified by:
      getUpperBound in interface org.jfree.chart.renderer.PaintScale
    • getBounds

      public double[] getBounds()
      Returns the bound values.
      Returns:
      bound values
    • getBoundColors

      public Color[] getBoundColors()
      Returns the bound colors.
      Returns:
      bound colors
    • toString

      public String toString()
      Overrides:
      toString in class Object