com.drew.metadata.Directory.getRational()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中com.drew.metadata.Directory.getRational()方法的一些代码示例,展示了Directory.getRational()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Directory.getRational()方法的具体详情如下:
包路径:com.drew.metadata.Directory
类名称:Directory
方法名:getRational

Directory.getRational介绍

[英]Returns the specified tag's value as a Rational. If the value is unset or cannot be converted, null is returned.
[中]将指定标记的值作为有理数返回。如果该值未设置或无法转换,则返回null

代码示例

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
protected String getDecimalRational(final int tagType, final int decimalPlaces)
{
  Rational value = _directory.getRational(tagType);
  if (value == null)
    return null;
  return String.format("%." + decimalPlaces + "f", value.doubleValue());
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getTemperatureDescription()
{
  Rational value = _directory.getRational(TAG_TEMPERATURE);
  if (value == null)
    return null;
  if (value.getDenominator() == 0xFFFFFFFFL)
    return "Unknown";
  DecimalFormat formatter = new DecimalFormat("0.0");
  return formatter.format(value.doubleValue()) + " °C";
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getHumidityDescription()
{
  Rational value = _directory.getRational(TAG_HUMIDITY);
  if (value == null)
    return null;
  if (value.getDenominator() == 0xFFFFFFFFL)
    return "Unknown";
  DecimalFormat formatter = new DecimalFormat("0.0");
  return formatter.format(value.doubleValue()) + " %";
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getPressureDescription()
{
  Rational value = _directory.getRational(TAG_PRESSURE);
  if (value == null)
    return null;
  if (value.getDenominator() == 0xFFFFFFFFL)
    return "Unknown";
  DecimalFormat formatter = new DecimalFormat("0.0");
  return formatter.format(value.doubleValue()) + " hPa";
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getCameraElevationAngleDescription()
{
  Rational value = _directory.getRational(TAG_CAMERA_ELEVATION_ANGLE);
  if (value == null)
    return null;
  if (value.getDenominator() == 0xFFFFFFFFL)
    return "Unknown";
  DecimalFormat formatter = new DecimalFormat("0.##");
  return formatter.format(value.doubleValue()) + " degrees";
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getXResolutionDescription()
{
  Rational value = _directory.getRational(TAG_X_RESOLUTION);
  if (value == null)
    return null;
  final String unit = getResolutionDescription();
  return String.format("%s dots per %s",
    value.toSimpleString(_allowDecimalRepresentationOfRationals),
    unit == null ? "unit" : unit.toLowerCase());
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getYResolutionDescription()
{
  Rational value = _directory.getRational(TAG_Y_RESOLUTION);
  if (value==null)
    return null;
  final String unit = getResolutionDescription();
  return String.format("%s dots per %s",
    value.toSimpleString(_allowDecimalRepresentationOfRationals),
    unit == null ? "unit" : unit.toLowerCase());
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getExposureBiasDescription()
{
  Rational value = _directory.getRational(TAG_EXPOSURE_BIAS);
  if (value == null)
    return null;
  return value.toSimpleString(true) + " EV";
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getWaterDepthDescription()
{
  Rational value = _directory.getRational(TAG_WATER_DEPTH);
  if (value == null)
    return null;
  if (value.getDenominator() == 0xFFFFFFFFL)
    return "Unknown";
  DecimalFormat formatter = new DecimalFormat("0.0##");
  return formatter.format(value.doubleValue()) + " metres";
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getAccelerationDescription()
{
  Rational value = _directory.getRational(TAG_ACCELERATION);
  if (value == null)
    return null;
  if (value.getDenominator() == 0xFFFFFFFFL)
    return "Unknown";
  DecimalFormat formatter = new DecimalFormat("0.0##");
  return formatter.format(value.doubleValue()) + " mGal";
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getBrightnessValueDescription()
{
  Rational value = _directory.getRational(TAG_BRIGHTNESS_VALUE);
  if (value == null)
    return null;
  if (value.getNumerator() == 0xFFFFFFFFL)
    return "Unknown";
  DecimalFormat formatter = new DecimalFormat("0.0##");
  return formatter.format(value.doubleValue());
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
protected String getSimpleRational(final int tagType)
{
  Rational value = _directory.getRational(tagType);
  if (value == null)
    return null;
  return value.toSimpleString(true);
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getDigitalZoomRatioDescription()
{
  Rational value = _directory.getRational(TAG_DIGITAL_ZOOM_RATIO);
  return value == null
    ? null
    : value.getNumerator() == 0
      ? "Digital zoom not used"
      : new DecimalFormat("0.#").format(value.doubleValue());
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
protected String getRationalOrDoubleString(int tagType)
{
  Rational rational = _directory.getRational(tagType);
  if (rational != null)
    return rational.toSimpleString(true);
  Double d = _directory.getDoubleObject(tagType);
  if (d != null) {
    DecimalFormat format = new DecimalFormat("0.###");
    return format.format(d);
  }
  return null;
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getSubjectDistanceDescription()
{
  Rational value = _directory.getRational(TAG_SUBJECT_DISTANCE);
  if (value == null)
    return null;
  if (value.getNumerator() == 0xFFFFFFFFL)
    return "Infinity";
  if (value.getNumerator() == 0)
    return "Unknown";
  DecimalFormat formatter = new DecimalFormat("0.0##");
  return formatter.format(value.doubleValue()) + " metres";
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getFocalLengthDescription()
{
  Rational value = _directory.getRational(TAG_FOCAL_LENGTH);
  return value == null ? null : getFocalLengthDescription(value.doubleValue());
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getFocalPlaneXResolutionDescription()
{
  Rational rational = _directory.getRational(TAG_FOCAL_PLANE_X_RESOLUTION);
  if (rational == null)
    return null;
  final String unit = getFocalPlaneResolutionUnitDescription();
  return rational.getReciprocal().toSimpleString(_allowDecimalRepresentationOfRationals)
    + (unit == null ? "" : " " + unit.toLowerCase());
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getFNumberDescription()
{
  Rational value = _directory.getRational(TAG_FNUMBER);
  if (value == null)
    return null;
  return getFStopDescription(value.doubleValue());
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getFocalPlaneYResolutionDescription()
{
  Rational rational = _directory.getRational(TAG_FOCAL_PLANE_Y_RESOLUTION);
  if (rational == null)
    return null;
  final String unit = getFocalPlaneResolutionUnitDescription();
  return rational.getReciprocal().toSimpleString(_allowDecimalRepresentationOfRationals)
    + (unit == null ? "" : " " + unit.toLowerCase());
}

代码示例来源:origin: drewnoakes/metadata-extractor

@Nullable
public String getCompressedAverageBitsPerPixelDescription()
{
  Rational value = _directory.getRational(TAG_COMPRESSED_AVERAGE_BITS_PER_PIXEL);
  if (value == null)
    return null;
  String ratio = value.toSimpleString(_allowDecimalRepresentationOfRationals);
  return value.isInteger() && value.intValue() == 1
    ? ratio + " bit/pixel"
    : ratio + " bits/pixel";
}

相关文章