source: josm/trunk/src/com/drew/metadata/exif/makernotes/SigmaMakernoteDescriptor.java@ 11277

Last change on this file since 11277 was 10862, checked in by Don-vip, 9 years ago

update to metadata-extractor 2.9.1

File size: 2.6 KB
Line 
1/*
2 * Copyright 2002-2016 Drew Noakes
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * More information about this project is available at:
17 *
18 * https://drewnoakes.com/code/exif/
19 * https://github.com/drewnoakes/metadata-extractor
20 */
21
22package com.drew.metadata.exif.makernotes;
23
24import com.drew.lang.annotations.NotNull;
25import com.drew.lang.annotations.Nullable;
26import com.drew.metadata.TagDescriptor;
27
28import static com.drew.metadata.exif.makernotes.SigmaMakernoteDirectory.*;
29
30/**
31 * Provides human-readable string representations of tag values stored in a {@link SigmaMakernoteDirectory}.
32 *
33 * @author Drew Noakes https://drewnoakes.com
34 */
35public class SigmaMakernoteDescriptor extends TagDescriptor<SigmaMakernoteDirectory>
36{
37 public SigmaMakernoteDescriptor(@NotNull SigmaMakernoteDirectory directory)
38 {
39 super(directory);
40 }
41
42 @Override
43 public String getDescription(int tagType)
44 {
45 switch (tagType) {
46 case TAG_EXPOSURE_MODE:
47 return getExposureModeDescription();
48 case TAG_METERING_MODE:
49 return getMeteringModeDescription();
50 }
51 return super.getDescription(tagType);
52 }
53
54 @Nullable
55 private String getMeteringModeDescription()
56 {
57 String value = _directory.getString(TAG_METERING_MODE);
58 if (value == null || value.length() == 0)
59 return null;
60 switch (value.charAt(0)) {
61 case '8': return "Multi Segment";
62 case 'A': return "Average";
63 case 'C': return "Center Weighted Average";
64 default:
65 return value;
66 }
67 }
68
69 @Nullable
70 private String getExposureModeDescription()
71 {
72 String value = _directory.getString(TAG_EXPOSURE_MODE);
73 if (value == null || value.length() == 0)
74 return null;
75 switch (value.charAt(0)) {
76 case 'A': return "Aperture Priority AE";
77 case 'M': return "Manual";
78 case 'P': return "Program AE";
79 case 'S': return "Shutter Speed Priority AE";
80 default:
81 return value;
82 }
83 }
84}
Note: See TracBrowser for help on using the repository browser.