X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FDataPoint.java;h=e053e1ad14405add6a237b4e748884c8575fe3c4;hp=bba7adc670f90078a8deb0a3280b6fa109ef8a39;hb=f35b6d628f68e3b5ef19965ad8988d0dd1eb8efa;hpb=3745d70b1427bb8ac1a085e47cbdc566936784e1 diff --git a/tim/prune/data/DataPoint.java b/tim/prune/data/DataPoint.java index bba7adc..e053e1a 100644 --- a/tim/prune/data/DataPoint.java +++ b/tim/prune/data/DataPoint.java @@ -17,7 +17,10 @@ public class DataPoint private Coordinate _latitude = null, _longitude = null; private Altitude _altitude; private Timestamp _timestamp = null; + /** Attached photo */ private Photo _photo = null; + /** Attached audio file */ + private AudioFile _audio = null; private String _waypointName = null; private boolean _startOfSegment = false; private boolean _markedForDeletion = false; @@ -299,20 +302,51 @@ public class DataPoint * Set the photo for this data point * @param inPhoto Photo object */ - public void setPhoto(Photo inPhoto) - { + public void setPhoto(Photo inPhoto) { _photo = inPhoto; + _modifyCount++; } - /** * @return associated Photo object */ - public Photo getPhoto() - { + public Photo getPhoto() { return _photo; } + /** + * Set the audio file for this point + * @param inAudio audio object + */ + public void setAudio(AudioFile inAudio) { + _audio = inAudio; + _modifyCount++; + } + + /** + * @return associated audio object + */ + public AudioFile getAudio() { + return _audio; + } + + /** + * Attach the given media object according to type + * @param inMedia either a photo or an audio file + */ + public void attachMedia(MediaFile inMedia) + { + if (inMedia != null) { + if (inMedia instanceof Photo) { + setPhoto((Photo) inMedia); + inMedia.setDataPoint(this); + } + else if (inMedia instanceof AudioFile) { + setAudio((AudioFile) inMedia); + inMedia.setDataPoint(this); + } + } + } /** * @return true if the point is valid @@ -322,6 +356,13 @@ public class DataPoint return _latitude.isValid() && _longitude.isValid(); } + /** + * @return true if the point has either a photo or audio attached + */ + public boolean hasMedia() { + return _photo != null || _audio != null; + } + /** * Interpolate a set of points between this one and the given one * @param inEndPoint end point of interpolation