Package com.drew.lang

Examples of com.drew.lang.Rational


    }

    @Nullable
    public String getFNumberDescription()
    {
        Rational value = _directory.getRational(TAG_FNUMBER);
        if (value == null)
            return null;
        return "F" + SimpleDecimalFormatter.format(value.doubleValue());
    }
View Full Code Here


    }

    @Nullable
    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);
        return value == null || value.trim().length() == 0 ? null : value.trim() + " degrees";
    }
View Full Code Here

    }

    @Nullable
    public String getGpsAltitudeDescription()
    {
        final Rational value = _directory.getRational(TAG_ALTITUDE);
        return value == null ? null : value.intValue() + " metres";
    }
View Full Code Here

    }

    @Nullable
    public String getFlashExposureValueDescription()
    {
        Rational value = _directory.getRational(TAG_FLASH_EV);
        return value == null ? null : value.toSimpleString(false) + " EV (Apex)";
    }
View Full Code Here

    }

    @Nullable
    public String getDigitalZoomDescription()
    {
        Rational value = _directory.getRational(TAG_DIGITAL_ZOOM);
        if (value==null)
            return null;
        return value.intValue() == 1
                ? "No digital zoom"
                : value.toSimpleString(true) + "x digital zoom";
    }
View Full Code Here

    }

    @Nullable
    public String getDigitalZoomDescription()
    {
        Rational value = _directory.getRational(TAG_DIGITAL_ZOOM);
        return value == null
            ? null
            : value.getNumerator() == 0
                ? "No digital zoom"
                : value.toSimpleString(true) + "x digital zoom";
    }
View Full Code Here

    }

    @Nullable
    public String getFocusDescription()
    {
        Rational value = _directory.getRational(TAG_FOCUS);
        return value == null
            ? null
            : value.getNumerator() == 1 && value.getDenominator() == 0
                ? "Infinite"
                : value.toSimpleString(true);
    }
View Full Code Here

        assertEquals(Integer.valueOf(value), _directory.getInteger(tagType));
        assertEquals((float)value, _directory.getFloat(tagType), 0.00001);
        assertEquals((double)value, _directory.getDouble(tagType), 0.00001);
        assertEquals((long)value, _directory.getLong(tagType));
        assertEquals(Integer.toString(value), _directory.getString(tagType));
        assertEquals(new Rational(value, 1), _directory.getRational(tagType));
        assertArrayEquals(new int[]{value}, _directory.getIntArray(tagType));
        assertArrayEquals(new byte[]{(byte)value}, _directory.getByteArray(tagType));
    }
View Full Code Here

    }

    @Test
    public void testExtract_FNumber() throws Exception
    {
        assertEquals(new Rational(11, 1), _directory.getRational(XmpDirectory.TAG_F_NUMBER));
    }
View Full Code Here

    }

    @Test
    public void testExtract_FocalLength() throws Exception
    {
        assertEquals(new Rational(57, 1), _directory.getRational(XmpDirectory.TAG_FOCAL_LENGTH));
    }
View Full Code Here

TOP

Related Classes of com.drew.lang.Rational

Copyright © 2018 www.massapicom. 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.