_scaled = false;
}
+ /**
+ * Constructor using fields and points from another Track
+ * @param inFieldList Field list from another Track object
+ * @param inPoints (edited) point array
+ */
+ public Track(FieldList inFieldList, DataPoint[] inPoints)
+ {
+ _masterFieldList = inFieldList;
+ _dataPoints = inPoints;
+ if (_dataPoints == null) _dataPoints = new DataPoint[0];
+ _numPoints = _dataPoints.length;
+ _scaled = false;
+ }
/**
* Load method, for initialising and reinitialising data
{
DataPoint point = _dataPoints[i];
// Don't delete photo points
- if (point.getPhoto() != null || !point.getDeleteFlag())
+ if (point.hasMedia() || !point.getDeleteFlag())
{
newPointArray[numCopied] = point;
numCopied++;
* @param inStart start of range
* @param inEnd end of range
* @param inOffset offset to add (-ve to subtract)
+ * @param inUndo true for undo operation
* @return true on success
*/
- public boolean addTimeOffset(int inStart, int inEnd, long inOffset)
+ public boolean addTimeOffset(int inStart, int inEnd, long inOffset, boolean inUndo)
{
// sanity check
if (inStart < 0 || inEnd < 0 || inStart >= inEnd || inEnd >= _numPoints) {
// This point has a timestamp so add the offset to it
foundTimestamp = true;
timestamp.addOffset(inOffset);
+ _dataPoints[i].setModified(inUndo);
}
}
return foundTimestamp;
// This point has an altitude so add the offset to it
foundAlt = true;
alt.addOffset(inOffset, inFormat, inDecimals);
+ _dataPoints[i].setModified(false);
}
}
// needs to be scaled again
*/
public DataPoint getPreviousTrackPoint(int inStartIndex)
{
+ // end index is given as _numPoints but actually it just counts down to -1
return getNextTrackPoint(inStartIndex, _numPoints, false);
}
}
return false;
}
+
+ /**
+ * @param inPoint point to check
+ * @return true if this track contains the given point
+ */
+ public boolean containsPoint(DataPoint inPoint)
+ {
+ if (inPoint == null) return false;
+ for (int i=0; i < getNumPoints(); i++)
+ {
+ if (getPoint(i) == inPoint) return true;
+ }
+ return false; // not found
+ }
}