Package com.drew.lang

Examples of com.drew.lang.Rational.doubleValue()


        if (!_directory.containsTag(ExifDirectory.TAG_DIGITAL_ZOOM_RATIO)) return null;
        Rational rational = _directory.getRational(ExifDirectory.TAG_DIGITAL_ZOOM_RATIO);
        if (rational.getNumerator()==0)
            return "Digital zoom not used.";

        return SimpleDecimalFormatter.format(rational.doubleValue());
    }

    public String getWhiteBalanceModeDescription() throws MetadataException
    {
        if (!_directory.containsTag(ExifDirectory.TAG_WHITE_BALANCE_MODE)) return null;
View Full Code Here


    public String getFocalLengthDescription() throws MetadataException
    {
        if (!_directory.containsTag(ExifDirectory.TAG_FOCAL_LENGTH)) return null;
        java.text.DecimalFormat formatter = new DecimalFormat("0.0##");
        Rational focalLength = _directory.getRational(ExifDirectory.TAG_FOCAL_LENGTH);
        return formatter.format(focalLength.doubleValue()) + " mm";
    }

    public String getFlashDescription() throws MetadataException
    {
        if (!_directory.containsTag(ExifDirectory.TAG_FLASH)) return null;
View Full Code Here

    public String getSubjectDistanceDescription() throws MetadataException
    {
        if (!_directory.containsTag(ExifDirectory.TAG_SUBJECT_DISTANCE)) return null;
        Rational distance = _directory.getRational(ExifDirectory.TAG_SUBJECT_DISTANCE);
        java.text.DecimalFormat formatter = new DecimalFormat("0.0##");
        return formatter.format(distance.doubleValue()) + " metres";
    }

    public String getCompressionLevelDescription() throws MetadataException
    {
        if (!_directory.containsTag(ExifDirectory.TAG_COMPRESSION_LEVEL)) return null;
View Full Code Here

    public String getFNumberDescription() throws MetadataException
    {
        if (!_directory.containsTag(ExifDirectory.TAG_FNUMBER)) return null;
        Rational fNumber = _directory.getRational(ExifDirectory.TAG_FNUMBER);
        return "F" + SimpleDecimalFormatter.format(fNumber.doubleValue());
    }

    public String getYCbCrPositioningDescription() throws MetadataException
    {
        if (!_directory.containsTag(ExifDirectory.TAG_YCBCR_POSITIONING)) return null;
View Full Code Here

    public void testCreateRational() throws Exception
    {
        Rational rational = new Rational(1, 3);
        assertEquals(1, rational.getNumerator());
        assertEquals(3, rational.getDenominator());
        assertEquals(new Double(1d / 3d), new Double(rational.doubleValue()));
    }

    public void testToString() throws Exception
    {
        Rational rational = new Rational(1, 3);
View Full Code Here

        Rational value = _directory.getRational(ExifSubIFDDirectory.TAG_DIGITAL_ZOOM_RATIO);
        if (value==null)
            return null;
        if (value.getNumerator()==0)
            return "Digital zoom not used.";
        return SimpleDecimalFormatter.format(value.doubleValue());
    }

    @Nullable
    public String getWhiteBalanceModeDescription()
    {
View Full Code Here

    {
        Rational value = _directory.getRational(ExifSubIFDDirectory.TAG_FOCAL_LENGTH);
        if (value==null)
            return null;
        java.text.DecimalFormat formatter = new DecimalFormat("0.0##");
        return formatter.format(value.doubleValue()) + " mm";
    }

    @Nullable
    public String getFlashDescription()
    {
View Full Code Here

    {
        Rational value = _directory.getRational(ExifSubIFDDirectory.TAG_SUBJECT_DISTANCE);
        if (value==null)
            return null;
        java.text.DecimalFormat formatter = new DecimalFormat("0.0##");
        return formatter.format(value.doubleValue()) + " metres";
    }

    @Nullable
    public String getCompressedAverageBitsPerPixelDescription()
    {
View Full Code Here

    public String getFNumberDescription()
    {
        Rational value = _directory.getRational(ExifSubIFDDirectory.TAG_FNUMBER);
        if (value==null)
            return null;
        return "F" + SimpleDecimalFormatter.format(value.doubleValue());
    }

    @Nullable
    public String getSensingMethodDescription()
    {
View Full Code Here

    public String getGpsDirectionDescription(int tagType)
    {
        Rational angle = _directory.getRational(tagType);
        // provide a decimal version of rational numbers in the description, to avoid strings like "35334/199 degrees"
        String value = angle != null
                ? new DecimalFormat("0.##").format(angle.doubleValue())
                : _directory.getString(tagType);
        if (value==null || value.trim().length()==0)
            return null;
        return value.trim() + " degrees";
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.