}
}
if (inField == null || inField == Field.TIMESTAMP) {
- _timestamp = new Timestamp(getFieldValue(Field.TIMESTAMP));
+ _timestamp = new TimestampUtc(getFieldValue(Field.TIMESTAMP));
}
if (inField == null || inField == Field.WAYPT_NAME) {
_waypointName = getFieldValue(Field.WAYPT_NAME);
_altitude = inAltitude;
_fieldValues[2] = "" + inAltitude.getValue();
}
- _timestamp = new Timestamp(null);
+ _timestamp = new TimestampUtc(null);
}
* @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;
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 addTimeOffsetSeconds(long inOffset)
+ {
+ if (hasTimestamp())
+ {
+ _timestamp.addOffsetSeconds(inOffset);
+ _fieldValues[_fieldList.getFieldIndex(Field.TIMESTAMP)] = _timestamp.getText(null);
+ setModified(false);
+ }
+ }
/**
* Set the photo for this data point