Changeset 13220 in josm for trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
- Timestamp:
- 2017-12-18T00:46:58+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
r13060 r13220 21 21 import com.drew.metadata.exif.ExifIFD0Directory; 22 22 import com.drew.metadata.exif.GpsDirectory; 23 import com.drew.metadata.jpeg.JpegDirectory; 23 24 24 25 /** … … 53 54 private Date gpsTime; 54 55 56 private int width; 57 private int height; 58 55 59 /** 56 60 * When the correlation dialog is open, we like to show the image position … … 77 81 78 82 /** 83 * Returns width of the image this ImageEntry represents. 84 * @return width of the image this ImageEntry represents 85 * @since 13220 86 */ 87 public int getWidth() { 88 return width; 89 } 90 91 /** 92 * Returns height of the image this ImageEntry represents. 93 * @return height of the image this ImageEntry represents 94 * @since 13220 95 */ 96 public int getHeight() { 97 return height; 98 } 99 100 /** 79 101 * Returns the position value. The position value from the temporary copy 80 102 * is returned if that copy exists. … … 142 164 */ 143 165 public Integer getExifOrientation() { 144 return exifOrientation; 166 return exifOrientation != null ? exifOrientation : 1; 145 167 } 146 168 … … 228 250 new ThumbsLoader(Collections.singleton(this)).run(); 229 251 } 252 } 253 254 /** 255 * Sets the width of this ImageEntry. 256 * @param width set the width of this ImageEntry 257 * @since 13220 258 */ 259 public void setWidth(int width) { 260 this.width = width; 261 } 262 263 /** 264 * Sets the height of this ImageEntry. 265 * @param height set the height of this ImageEntry 266 * @since 13220 267 */ 268 public void setHeight(int height) { 269 this.height = height; 230 270 } 231 271 … … 457 497 } 458 498 499 final Directory dir = metadata.getFirstDirectoryOfType(JpegDirectory.class); 459 500 final Directory dirExif = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class); 460 501 final GpsDirectory dirGps = metadata.getFirstDirectoryOfType(GpsDirectory.class); … … 464 505 int orientation = dirExif.getInt(ExifIFD0Directory.TAG_ORIENTATION); 465 506 setExifOrientation(orientation); 507 } 508 } catch (MetadataException ex) { 509 Logging.debug(ex); 510 } 511 512 try { 513 if (dir != null) { 514 // there are cases where these do not match width and height stored in dirExif 515 int width = dir.getInt(JpegDirectory.TAG_IMAGE_WIDTH); 516 int height = dir.getInt(JpegDirectory.TAG_IMAGE_HEIGHT); 517 setWidth(width); 518 setHeight(height); 466 519 } 467 520 } catch (MetadataException ex) {
Note:
See TracChangeset
for help on using the changeset viewer.