Beispiel #1
0
 /**
  * Puts a key/value pair into this directory. For a Olympus tag that has subfields, expands the
  * values into multiple key/value pairs.
  *
  * @param tagID The metadata tag ID (the key).
  * @param value The value to put.
  * @see #valueToString(ImageMetaValue)
  */
 public void putValue(Integer tagID, ImageMetaValue value) {
   switch (tagID) {
     case OLYMPUS_CAMERA_SETTINGS:
     case OLYMPUS_CAMERA_SETTINGS_OLD:
       explodeSubfields(tagID, 0, value, true);
       break;
     case OLYMPUS_ISO:
       {
         final float n = value.getFloatValue();
         value = new UnsignedShortMetaValue((int) (100 * Math.pow(2, n - 5)));
         break;
       }
     case OLYMPUS_WHITE_BALANCE_MODE:
       final long[] v = ((LongMetaValue) value).getLongValues();
       final int n;
       switch (v.length) {
         case 1:
           n = (int) v[0];
           break;
         case 2:
           n = (int) (v[0] * 10 + v[1]);
           break;
         default:
           return;
       }
       value = new UnsignedShortMetaValue(n);
       break;
   }
   super.putValue(tagID, value);
 }
Beispiel #2
0
 /** {@inheritDoc} */
 public String valueToString(ImageMetaValue value) {
   switch (value.getOwningTagID()) {
     case OLYMPUS_BLUE_BALANCE:
     case OLYMPUS_RED_BALANCE:
       return TextUtil.tenths(value.getFloatValue() / 256);
     case OLYMPUS_CS_CUSTOM_SATURATION:
       {
         final String model = getOwningMetadata().getCameraMake(true);
         if (model != null && model.contains("E-1")) {
           final long[] n = ((LongMetaValue) value).getLongValues();
           n[0] -= n[1];
           n[2] -= n[1];
           return n[0] + " (0," + n[2] + ')';
         }
         // no break;
       }
     case OLYMPUS_CS_CONTRAST_SETTING:
     case OLYMPUS_CS_PM_CONTRAST:
     case OLYMPUS_CS_PM_SATURATION:
     case OLYMPUS_CS_PM_SHARPNESS:
     case OLYMPUS_CS_SHARPNESS_SETTING:
       {
         final String[] values = value.getValues();
         if (values.length != 3) return null;
         return values[0] + " (" + values[1] + ',' + values[2] + ')';
       }
     case OLYMPUS_CS_PANORAMA_MODE:
       {
         if (value.getValueCount() != 2) break;
         final int tagID = value.getOwningTagID();
         return getTagValueLabelFor(tagID, value.getIntValue()) + ", " + value.getValues()[1];
       }
     case OLYMPUS_FOCAL_PLANE_DIAGONAL:
       return value.getStringValue() + "mm"; // TODO: localize
   }
   return super.valueToString(value);
 }