X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Fgui%2Fcolour%2FSegmentColourer.java;fp=src%2Ftim%2Fprune%2Fgui%2Fcolour%2FSegmentColourer.java;h=942622251e27c4f82084f97e9abfe8d6cbca07cd;hp=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465 diff --git a/src/tim/prune/gui/colour/SegmentColourer.java b/src/tim/prune/gui/colour/SegmentColourer.java new file mode 100644 index 0000000..9426222 --- /dev/null +++ b/src/tim/prune/gui/colour/SegmentColourer.java @@ -0,0 +1,52 @@ +package tim.prune.gui.colour; + +import java.awt.Color; + +import tim.prune.data.DataPoint; +import tim.prune.data.Track; +import tim.prune.data.TrackInfo; + +/** + * Point colourer using the segment indices + */ +public class SegmentColourer extends DiscretePointColourer +{ + /** + * Constructor + * @param inStartColour start colour of scale + * @param inEndColour end colour of scale + * @param inWrapLength number of unique colours before wrap + */ + public SegmentColourer(Color inStartColour, Color inEndColour, int inWrapLength) + { + super(inStartColour, inEndColour, inWrapLength); + } + + /** + * Calculate the colours for each of the points in the given track + * @param inTrackInfo track info object + */ + @Override + public void calculateColours(TrackInfo inTrackInfo) + { + // initialise the array to the right size + Track track = inTrackInfo == null ? null : inTrackInfo.getTrack(); + final int numPoints = track == null ? 0 : track.getNumPoints(); + init(numPoints); + // loop over track points + int c = -1; // first track point will increment this to 0 + for (int i=0; i