Ignore:
Timestamp:
2016-08-20T20:58:03+02:00 (8 years ago)
Author:
Don-vip
Message:

update to metadata-extractor 2.9.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/drew/metadata/exif/ExifDescriptorBase.java

    r8243 r10862  
    11/*
    2  * Copyright 2002-2015 Drew Noakes
     2 * Copyright 2002-2016 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
     
    3030
    3131import java.io.UnsupportedEncodingException;
     32import java.math.RoundingMode;
    3233import java.text.DecimalFormat;
    3334import java.util.HashMap;
     
    5152    @NotNull
    5253    private static final java.text.DecimalFormat SimpleDecimalFormatter = new DecimalFormat("0.#");
    53     @NotNull
    54     private static final java.text.DecimalFormat SimpleDecimalFormatterWithPrecision = new DecimalFormat("0.0");
    5554
    5655    // Note for the potential addition of brightness presentation in eV:
     
    206205            case TAG_JPEG_PROC:
    207206                return getJpegProcDescription();
     207            case TAG_LENS_SPECIFICATION:
     208                return getLensSpecificationDescription();
    208209            default:
    209210                return super.getDescription(tagType);
     
    509510
    510511    @Nullable
     512    public String getLensSpecificationDescription()
     513    {
     514        return getLensSpecificationDescription(TAG_LENS_SPECIFICATION);
     515    }
     516
     517    @Nullable
    511518    public String getSharpnessDescription()
    512519    {
     
    568575            ? null
    569576            : value == 0
    570             ? "Unknown"
    571             : SimpleDecimalFormatter.format(value) + "mm";
     577                ? "Unknown"
     578                : getFocalLengthDescription(value);
    572579    }
    573580
     
    579586            ? null
    580587            : value.getNumerator() == 0
    581             ? "Digital zoom not used."
    582             : SimpleDecimalFormatter.format(value.doubleValue());
     588                ? "Digital zoom not used"
     589                : SimpleDecimalFormatter.format(value.doubleValue());
    583590    }
    584591
     
    711718            return null;
    712719        double fStop = PhotographicConversions.apertureToFStop(aperture);
    713         return "f/" + SimpleDecimalFormatterWithPrecision.format(fStop);
     720        return getFStopDescription(fStop);
    714721    }
    715722
     
    721728            return null;
    722729        double fStop = PhotographicConversions.apertureToFStop(aperture);
    723         return "f/" + SimpleDecimalFormatterWithPrecision.format(fStop);
     730        return getFStopDescription(fStop);
    724731    }
    725732
     
    807814    {
    808815        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());
    813817    }
    814818
     
    859863    public String getWhiteBalanceDescription()
    860864    {
    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
    865866        final Integer value = _directory.getInteger(TAG_WHITE_BALANCE);
    866867        if (value == null)
     
    875876            case 10: return "Cloudy";
    876877            case 11: return "Shade";
    877             case 12: return "Daylight Flourescent";
    878             case 13: return "Day White Flourescent";
    879             case 14: return "Cool White Flourescent";
    880             case 15: return "White Flourescent";
    881             case 16: return "Warm White Flourescent";
     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";
    882883            case 17: return "Standard light";
    883884            case 18: return "Standard light (B)";
     
    975976        if (value == null)
    976977            return null;
    977         java.text.DecimalFormat formatter = new DecimalFormat("0.0##");
     978        DecimalFormat formatter = new DecimalFormat("0.0##");
    978979        return formatter.format(value.doubleValue()) + " metres";
    979980    }
     
    10181019            long apexPower10 = Math.round((double)apexPower * 10.0);
    10191020            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";
    10211024        } else {
    10221025            int apexPower = (int)((Math.exp(apexValue * Math.log(2))));
     
    10511054        if (value == null)
    10521055            return null;
    1053         return "f/" + SimpleDecimalFormatterWithPrecision.format(value.doubleValue());
     1056        return getFStopDescription(value.doubleValue());
    10541057    }
    10551058
Note: See TracChangeset for help on using the changeset viewer.