source: josm/trunk/src/com/drew/metadata/exif/makernotes/NikonType1MakernoteDescriptor.java@ 13500

Last change on this file since 13500 was 13061, checked in by Don-vip, 6 years ago

fix #15505 - update to metadata-extractor 2.10.1

File size: 4.9 KB
Line 
1/*
2 * Copyright 2002-2017 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 */
21package com.drew.metadata.exif.makernotes;
22
23import com.drew.lang.Rational;
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.NikonType1MakernoteDirectory.*;
29
30/**
31 * Provides human-readable string representations of tag values stored in a {@link NikonType1MakernoteDirectory}.
32 * <p>
33 * Type-1 is for E-Series cameras prior to (not including) E990. For example: E700, E800, E900,
34 * E900S, E910, E950.
35 * <p>
36 * Makernote starts from ASCII string "Nikon". Data format is the same as IFD, but it starts from
37 * offset 0x08. This is the same as Olympus except start string. Example of actual data
38 * structure is shown below.
39 * <pre><code>
40 * :0000: 4E 69 6B 6F 6E 00 01 00-05 00 02 00 02 00 06 00 Nikon...........
41 * :0010: 00 00 EC 02 00 00 03 00-03 00 01 00 00 00 06 00 ................
42 * </code></pre>
43 *
44 * @author Drew Noakes https://drewnoakes.com
45 */
46@SuppressWarnings("WeakerAccess")
47public class NikonType1MakernoteDescriptor extends TagDescriptor<NikonType1MakernoteDirectory>
48{
49 public NikonType1MakernoteDescriptor(@NotNull NikonType1MakernoteDirectory directory)
50 {
51 super(directory);
52 }
53
54 @Override
55 @Nullable
56 public String getDescription(int tagType)
57 {
58 switch (tagType) {
59 case TAG_QUALITY:
60 return getQualityDescription();
61 case TAG_COLOR_MODE:
62 return getColorModeDescription();
63 case TAG_IMAGE_ADJUSTMENT:
64 return getImageAdjustmentDescription();
65 case TAG_CCD_SENSITIVITY:
66 return getCcdSensitivityDescription();
67 case TAG_WHITE_BALANCE:
68 return getWhiteBalanceDescription();
69 case TAG_FOCUS:
70 return getFocusDescription();
71 case TAG_DIGITAL_ZOOM:
72 return getDigitalZoomDescription();
73 case TAG_CONVERTER:
74 return getConverterDescription();
75 default:
76 return super.getDescription(tagType);
77 }
78 }
79
80 @Nullable
81 public String getConverterDescription()
82 {
83 return getIndexedDescription(TAG_CONVERTER, "None", "Fisheye converter");
84 }
85
86 @Nullable
87 public String getDigitalZoomDescription()
88 {
89 Rational value = _directory.getRational(TAG_DIGITAL_ZOOM);
90 return value == null
91 ? null
92 : value.getNumerator() == 0
93 ? "No digital zoom"
94 : value.toSimpleString(true) + "x digital zoom";
95 }
96
97 @Nullable
98 public String getFocusDescription()
99 {
100 Rational value = _directory.getRational(TAG_FOCUS);
101 return value == null
102 ? null
103 : value.getNumerator() == 1 && value.getDenominator() == 0
104 ? "Infinite"
105 : value.toSimpleString(true);
106 }
107
108 @Nullable
109 public String getWhiteBalanceDescription()
110 {
111 return getIndexedDescription(TAG_WHITE_BALANCE,
112 "Auto",
113 "Preset",
114 "Daylight",
115 "Incandescence",
116 "Florescence",
117 "Cloudy",
118 "SpeedLight"
119 );
120 }
121
122 @Nullable
123 public String getCcdSensitivityDescription()
124 {
125 return getIndexedDescription(TAG_CCD_SENSITIVITY,
126 "ISO80",
127 null,
128 "ISO160",
129 null,
130 "ISO320",
131 "ISO100"
132 );
133 }
134
135 @Nullable
136 public String getImageAdjustmentDescription()
137 {
138 return getIndexedDescription(TAG_IMAGE_ADJUSTMENT,
139 "Normal",
140 "Bright +",
141 "Bright -",
142 "Contrast +",
143 "Contrast -"
144 );
145 }
146
147 @Nullable
148 public String getColorModeDescription()
149 {
150 return getIndexedDescription(TAG_COLOR_MODE,
151 1,
152 "Color",
153 "Monochrome"
154 );
155 }
156
157 @Nullable
158 public String getQualityDescription()
159 {
160 return getIndexedDescription(TAG_QUALITY,
161 1,
162 "VGA Basic",
163 "VGA Normal",
164 "VGA Fine",
165 "SXGA Basic",
166 "SXGA Normal",
167 "SXGA Fine"
168 );
169 }
170}
Note: See TracBrowser for help on using the repository browser.