X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Fgui%2Fcolour%2FFileColourer.java;fp=src%2Ftim%2Fprune%2Fgui%2Fcolour%2FFileColourer.java;h=2a0e8cb9903c205d3703cbdf6da6e5453a96a9ed;hp=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465 diff --git a/src/tim/prune/gui/colour/FileColourer.java b/src/tim/prune/gui/colour/FileColourer.java new file mode 100644 index 0000000..2a0e8cb --- /dev/null +++ b/src/tim/prune/gui/colour/FileColourer.java @@ -0,0 +1,70 @@ +package tim.prune.gui.colour; + +import java.awt.Color; +import java.util.ArrayList; + +import tim.prune.data.DataPoint; +import tim.prune.data.FileInfo; +import tim.prune.data.SourceInfo; +import tim.prune.data.TrackInfo; + +/** + * Colours points according to which file (or source) they came from + */ +public class FileColourer extends DiscretePointColourer +{ + /** + * Constructor + * @param inStartColour start colour of scale + * @param inEndColour end colour of scale + * @param inWrapLength number of unique colours before wrap + */ + public FileColourer(Color inStartColour, Color inEndColour, int inWrapLength) + { + super(inStartColour, inEndColour, inWrapLength); + } + + /** + * Calculate the colours for each of the points in the given track + * @param inTrack track object + */ + @Override + public void calculateColours(TrackInfo inTrackInfo) + { + // initialise the array to the right size + final int numPoints = inTrackInfo == null ? 0 : inTrackInfo.getTrack().getNumPoints(); + init(numPoints); + + // loop over track points + FileInfo fInfo = inTrackInfo.getFileInfo(); + ArrayList sourceList = new ArrayList(); + for (int i=0; i