]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/data/Photo.java
Version 2, March 2007
[GpsPrune.git] / tim / prune / data / Photo.java
1 package tim.prune.data;
2
3 import java.io.File;
4
5 /**
6  * Class to represent a photo and link to DataPoint
7  */
8 public class Photo
9 {
10         /** File where photo is stored */
11         private File _file = null;
12         /** Associated DataPoint if correlated */
13         private DataPoint _dataPoint = null;
14
15
16         /**
17          * Constructor
18          * @param inFile File object for photo
19          */
20         public Photo(File inFile)
21         {
22                 _file = inFile;
23                 // TODO: Cache photo file contents to allow thumbnail preview
24         }
25
26
27         /**
28          * @return File object where photo resides
29          */
30         public File getFile()
31         {
32                 return _file;
33         }
34
35
36         /**
37          * Set the data point associated with the photo
38          * @param inPoint DataPoint with coordinates etc
39          */
40         public void setDataPoint(DataPoint inPoint)
41         {
42                 _dataPoint = inPoint;
43         }
44
45         /**
46          * @return the DataPoint object
47          */
48         public DataPoint getDataPoint()
49         {
50                 return _dataPoint;
51         }
52
53         /**
54          * Check if a Photo object refers to the same File as another
55          * @param inOther other Photo object
56          * @return true if the Files are the same
57          */
58         public boolean equals(Photo inOther)
59         {
60                 return (inOther != null && inOther.getFile() != null && getFile() != null
61                         && inOther.getFile().equals(getFile()));
62         }
63 }