X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FPhoto.java;h=7ffe35dec984511a6de8d7e522cb1aa25b4c7932;hb=140e9d165f85c3d4f0435a311e091209313faa2a;hp=805e22ea6254b8f88f78ca9b766d6d6c699590eb;hpb=54b9d8bc8f0025ccf97a67d9dd217ef1f9cf082f;p=GpsPrune.git diff --git a/tim/prune/data/Photo.java b/tim/prune/data/Photo.java index 805e22e..7ffe35d 100644 --- a/tim/prune/data/Photo.java +++ b/tim/prune/data/Photo.java @@ -22,6 +22,8 @@ public class Photo private Status _originalStatus = Status.NOT_CONNECTED; /** Current photo status */ private Status _currentStatus = Status.NOT_CONNECTED; + /** rotation flag (clockwise from 0 to 3) */ + private int _rotation = 0; // TODO: Need to store caption for image? // thumbnail for image (from exif) private byte[] _exifThumbnail = null; @@ -36,7 +38,6 @@ public class Photo CONNECTED }; - /** * Constructor * @param inFile File object for photo @@ -64,12 +65,10 @@ public class Photo { _dataPoint = inPoint; // set status according to point - if (inPoint == null) - { + if (inPoint == null) { setCurrentStatus(Status.NOT_CONNECTED); } - else - { + else { setCurrentStatus(Status.CONNECTED); } } @@ -182,6 +181,14 @@ public class Photo _currentStatus = inStatus; } + /** + * @return true if photo is connected to a point + */ + public boolean isConnected() + { + return _currentStatus != Status.NOT_CONNECTED; + } + /** * @return byte array of thumbnail data */ @@ -217,4 +224,32 @@ public class Photo return (inOther != null && inOther.getFile() != null && getFile() != null && inOther.getFile().equals(getFile())); } + + /** + * @param inRotation initial rotation value (from exif) + */ + public void setRotation(int inRotation) + { + if (inRotation >= 0 && inRotation <= 3) { + _rotation = inRotation; + } + } + + /** + * Rotate the image by 90 degrees + * @param inRight true to rotate right, false for left + */ + public void rotate(boolean inRight) + { + int dir = inRight?1:3; + _rotation = (_rotation + dir) % 4; + } + + /** + * @return rotation status + */ + public int getRotationDegrees() + { + return _rotation * 90; + } }