1 package tim.prune.gui.colour;
5 import tim.prune.data.DataPoint;
6 import tim.prune.data.Track;
7 import tim.prune.data.TrackInfo;
10 * Point colourer using the segment indices
12 public class SegmentColourer extends DiscretePointColourer
16 * @param inStartColour start colour of scale
17 * @param inEndColour end colour of scale
18 * @param inWrapLength number of unique colours before wrap
20 public SegmentColourer(Color inStartColour, Color inEndColour, int inWrapLength)
22 super(inStartColour, inEndColour, inWrapLength);
26 * Calculate the colours for each of the points in the given track
27 * @param inTrackInfo track info object
30 public void calculateColours(TrackInfo inTrackInfo)
32 // initialise the array to the right size
33 Track track = inTrackInfo == null ? null : inTrackInfo.getTrack();
34 final int numPoints = track == null ? 0 : track.getNumPoints();
36 // loop over track points
37 int c = -1; // first track point will increment this to 0
38 for (int i=0; i<numPoints; i++)
40 DataPoint p = track.getPoint(i);
41 if (p != null && !p.isWaypoint())
43 if (p.getSegmentStart()) {
49 // generate the colours needed
50 generateDiscreteColours(c+1);