1 package tim.prune.gui.colour;
5 public abstract class ContinuousPointColourer extends PointColourer
7 /** array of colours to use */
8 private Color[] _colours = null;
12 * @param inStartColour start colour
13 * @param inEndColour end colour
15 public ContinuousPointColourer(Color inStartColour, Color inEndColour)
17 super(inStartColour, inEndColour);
20 /** Continuous colourers don't need a maximum count */
21 public static boolean isMaxColoursRequired() {
26 * Initialise the array to the right size
27 * @param inNumPoints number of points in the track
29 protected void init(int inNumPoints)
31 if (_colours == null || _colours.length != inNumPoints)
33 // Array needs to be created or resized
34 if (inNumPoints > 0) {
35 _colours = new Color[inNumPoints];
44 * Set the colour at the given index
45 * @param inPointIndex point index
46 * @param inColour colour to use, or null
48 protected void setColour(int inPointIndex, Color inColour)
50 if (_colours != null && _colours.length > inPointIndex && inPointIndex >= 0)
52 _colours[inPointIndex] = inColour;
57 * Get the colour for the given point index
58 * @param inPointIndex index of point in track
59 * @return colour object
61 public Color getColour(int inPointIndex)
64 if (_colours != null && _colours.length > inPointIndex && inPointIndex >= 0)
66 colour = _colours[inPointIndex];
69 // not found, use default
70 colour = super.getDefaultColour();