X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FDataPoint.java;h=3d17cbc5edec4797a3dd63fee6e58579bcdd6025;hb=649c5da6ee1bbc590699e11a92316ece2ea8512d;hp=bba7adc670f90078a8deb0a3280b6fa109ef8a39;hpb=140e9d165f85c3d4f0435a311e091209313faa2a;p=GpsPrune.git diff --git a/tim/prune/data/DataPoint.java b/tim/prune/data/DataPoint.java index bba7adc..3d17cbc 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 clip */ + private AudioClip _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 clip for this point + * @param inAudio audio object + */ + public void setAudio(AudioClip inAudio) { + _audio = inAudio; + _modifyCount++; + } + + /** + * @return associated audio object + */ + public AudioClip getAudio() { + return _audio; + } + + /** + * Attach the given media object according to type + * @param inMedia either a photo or an audio clip + */ + public void attachMedia(MediaObject inMedia) + { + if (inMedia != null) { + if (inMedia instanceof Photo) { + setPhoto((Photo) inMedia); + inMedia.setDataPoint(this); + } + else if (inMedia instanceof AudioClip) { + setAudio((AudioClip) 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