Changeset 10862 in josm for trunk/src/com/drew/metadata/exif/ExifDescriptorBase.java
- Timestamp:
- 2016-08-20T20:58:03+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/exif/ExifDescriptorBase.java
r8243 r10862 1 1 /* 2 * Copyright 2002-201 5Drew Noakes2 * Copyright 2002-2016 Drew Noakes 3 3 * 4 4 * Licensed under the Apache License, Version 2.0 (the "License"); … … 30 30 31 31 import java.io.UnsupportedEncodingException; 32 import java.math.RoundingMode; 32 33 import java.text.DecimalFormat; 33 34 import java.util.HashMap; … … 51 52 @NotNull 52 53 private static final java.text.DecimalFormat SimpleDecimalFormatter = new DecimalFormat("0.#"); 53 @NotNull54 private static final java.text.DecimalFormat SimpleDecimalFormatterWithPrecision = new DecimalFormat("0.0");55 54 56 55 // Note for the potential addition of brightness presentation in eV: … … 206 205 case TAG_JPEG_PROC: 207 206 return getJpegProcDescription(); 207 case TAG_LENS_SPECIFICATION: 208 return getLensSpecificationDescription(); 208 209 default: 209 210 return super.getDescription(tagType); … … 509 510 510 511 @Nullable 512 public String getLensSpecificationDescription() 513 { 514 return getLensSpecificationDescription(TAG_LENS_SPECIFICATION); 515 } 516 517 @Nullable 511 518 public String getSharpnessDescription() 512 519 { … … 568 575 ? null 569 576 : value == 0 570 ? "Unknown" 571 : SimpleDecimalFormatter.format(value)+ "mm";577 ? "Unknown" 578 : getFocalLengthDescription(value); 572 579 } 573 580 … … 579 586 ? null 580 587 : value.getNumerator() == 0 581 ? "Digital zoom not used ."582 : SimpleDecimalFormatter.format(value.doubleValue()); 588 ? "Digital zoom not used" 589 : SimpleDecimalFormatter.format(value.doubleValue()); 583 590 } 584 591 … … 711 718 return null; 712 719 double fStop = PhotographicConversions.apertureToFStop(aperture); 713 return "f/" + SimpleDecimalFormatterWithPrecision.format(fStop);720 return getFStopDescription(fStop); 714 721 } 715 722 … … 721 728 return null; 722 729 double fStop = PhotographicConversions.apertureToFStop(aperture); 723 return "f/" + SimpleDecimalFormatterWithPrecision.format(fStop);730 return getFStopDescription(fStop); 724 731 } 725 732 … … 807 814 { 808 815 Rational value = _directory.getRational(TAG_FOCAL_LENGTH); 809 if (value == null) 810 return null; 811 java.text.DecimalFormat formatter = new DecimalFormat("0.0##"); 812 return formatter.format(value.doubleValue()) + " mm"; 816 return value == null ? null : getFocalLengthDescription(value.doubleValue()); 813 817 } 814 818 … … 859 863 public String getWhiteBalanceDescription() 860 864 { 861 // '0' means unknown, '1' daylight, '2' fluorescent, '3' tungsten, '4' flash, 862 // '17' standard light A, '18' standard light B, '19' standard light C, '20' D55, 863 // '21' D65, '22' D75, '255' other. 864 // see http://web.archive.org/web/20131018091152/http://exif.org/Exif2-2.PDF page 35 865 // See http://web.archive.org/web/20131018091152/http://exif.org/Exif2-2.PDF page 35 865 866 final Integer value = _directory.getInteger(TAG_WHITE_BALANCE); 866 867 if (value == null) … … 875 876 case 10: return "Cloudy"; 876 877 case 11: return "Shade"; 877 case 12: return "Daylight Fl ourescent";878 case 13: return "Day White Fl ourescent";879 case 14: return "Cool White Fl ourescent";880 case 15: return "White Fl ourescent";881 case 16: return "Warm White Fl ourescent";878 case 12: return "Daylight Fluorescent"; 879 case 13: return "Day White Fluorescent"; 880 case 14: return "Cool White Fluorescent"; 881 case 15: return "White Fluorescent"; 882 case 16: return "Warm White Fluorescent"; 882 883 case 17: return "Standard light"; 883 884 case 18: return "Standard light (B)"; … … 975 976 if (value == null) 976 977 return null; 977 java.text.DecimalFormat formatter = new DecimalFormat("0.0##");978 DecimalFormat formatter = new DecimalFormat("0.0##"); 978 979 return formatter.format(value.doubleValue()) + " metres"; 979 980 } … … 1018 1019 long apexPower10 = Math.round((double)apexPower * 10.0); 1019 1020 float fApexPower = (float)apexPower10 / 10.0f; 1020 return fApexPower + " sec"; 1021 DecimalFormat format = new DecimalFormat("0.##"); 1022 format.setRoundingMode(RoundingMode.HALF_UP); 1023 return format.format(fApexPower) + " sec"; 1021 1024 } else { 1022 1025 int apexPower = (int)((Math.exp(apexValue * Math.log(2)))); … … 1051 1054 if (value == null) 1052 1055 return null; 1053 return "f/" + SimpleDecimalFormatterWithPrecision.format(value.doubleValue());1056 return getFStopDescription(value.doubleValue()); 1054 1057 } 1055 1058
Note:
See TracChangeset
for help on using the changeset viewer.
