Class ContinousColorMap

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    ContinousZeroBalancedMap

    public abstract class ContinousColorMap
    extends ColorMap
    An Abstract class representing general continuous color maps and providing some functionality for such maps.
    Author:
    Thomas Pfau
    See Also:
    Serialized Form
    • Field Detail

      • maxval

        protected double maxval
      • minval

        protected double minval
      • range

        protected double range
      • oddrange

        protected boolean oddrange
      • ColorPane

        protected JPanel ColorPane
      • DescriptionPanes

        protected Vector<JLabel> DescriptionPanes
      • ColorScaleFractions

        protected float[] ColorScaleFractions
      • ColorScaleColors

        protected Color[] ColorScaleColors
    • Constructor Detail

      • ContinousColorMap

        public ContinousColorMap​(double maxvalue,
                                 double minvalue,
                                 ColorScale cs)
        Generate a continous color map based on a color scale and a minimal and maximal value.
        Parameters:
        maxvalue - the maximum value this map shall be able to map
        minvalue - the minimum this map shall be able to map
        cs - the colorscale this map should use for color generation.
    • Method Detail

      • resetColorData

        protected void resetColorData()
        Clear all color related data i.e. ColorScale Colors, fRactions and Panes.
      • setup

        protected void setup()
        Setup this Color Map.
      • buildColorMapVisualisation

        protected JComponent buildColorMapVisualisation​(HashMap<Double,​String> translate,
                                                        JScrollPane Legend)
        Generate the Color Scale Layout and visual representation based on the Labels used for the respective positions.
        Parameters:
        translate - A Translation between the double values and Strings.
        Legend - The Legend to build this ColorMap Visualisation for (to listen to resize events).
        Returns:
        A JComponent which plots the ColorMap
      • getCenterValue

        protected double getCenterValue()
        Get the center value (i.e. the value in the middle between the minimum and maximum values mapped by this map.
        Returns:
        the center value
      • GetLabelForNumbers

        protected HashMap<Double,​String> GetLabelForNumbers​(HashMap<Double,​Double> fractions)
        Create Strings Representations for the values in a Map which are Doubles. This is a helper function to allow the generation of sensible numbers for legends.
        Parameters:
        fractions - A Translation between double keys to double values. The values will be used to generate strings.
        Returns:
        a Map, that maps the keys of the input to the string representation of the values of the input.
      • getCenterPosition

        public double getCenterPosition()
        Get the central position of the color map (on a 0-1 range). This is the position that returns the value of the ColorScale when 0.5 is requested from a basic colorscale used for this map.
        Returns:
        the central position of the ColorMap