X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FDataPoint.java;h=c2446228161401202b4d3cbfba107a56f3cfde70;hp=4de97ef219bb60f05153dc4f3a4cbbdf72a2e672;hb=326f489e36aa7f235bc19409a57bf4955cd50f24;hpb=8c8868ae29b3252f02e094c02307384cf61ba667 diff --git a/tim/prune/data/DataPoint.java b/tim/prune/data/DataPoint.java index 4de97ef..c244622 100644 --- a/tim/prune/data/DataPoint.java +++ b/tim/prune/data/DataPoint.java @@ -138,7 +138,7 @@ public class DataPoint * @param inIndex index number starting at zero * @return field value, or null if not found */ - public String getFieldValue(int inIndex) + private String getFieldValue(int inIndex) { if (_fieldValues == null || inIndex < 0 || inIndex >= _fieldValues.length) return null; @@ -338,6 +338,46 @@ public class DataPoint return (inOther._waypointName != null && inOther._waypointName.equals(_waypointName)); } + /** + * Add an altitude offset to this point, and keep the point's string value in sync + * @param inOffset offset as double + * @param inUnit unit of offset, feet or metres + * @param inDecimals number of decimal places + */ + public void addAltitudeOffset(double inOffset, Unit inUnit, int inDecimals) + { + if (hasAltitude()) + { + _altitude.addOffset(inOffset, inUnit, inDecimals); + _fieldValues[_fieldList.getFieldIndex(Field.ALTITUDE)] = _altitude.getStringValue(null); + setModified(false); + } + } + + /** + * Reset the altitude to the previous value (by an undo) + * @param inClone altitude object cloned from earlier + */ + public void resetAltitude(Altitude inClone) + { + _altitude.reset(inClone); + _fieldValues[_fieldList.getFieldIndex(Field.ALTITUDE)] = _altitude.getStringValue(null); + setModified(true); + } + + /** + * Add a time offset to this point + * @param inOffset offset to add (-ve to subtract) + */ + public void addTimeOffset(long inOffset) + { + if (hasTimestamp()) + { + _timestamp.addOffset(inOffset); + _fieldValues[_fieldList.getFieldIndex(Field.TIMESTAMP)] = _timestamp.getText(); + setModified(false); + } + } /** * Set the photo for this data point