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

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

update to metadata-extractor 2.9.1

File size: 4.9 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 */
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 */
46public class NikonType1MakernoteDescriptor extends TagDescriptor<NikonType1MakernoteDirectory>
47{
48 public NikonType1MakernoteDescriptor(@NotNull NikonType1MakernoteDirectory directory)
49 {
50 super(directory);
51 }
52
53 @Override
54 @Nullable
55 public String getDescription(int tagType)
56 {
57 switch (tagType) {
58 case TAG_QUALITY:
59 return getQualityDescription();
60 case TAG_COLOR_MODE:
61 return getColorModeDescription();
62 case TAG_IMAGE_ADJUSTMENT:
63 return getImageAdjustmentDescription();
64 case TAG_CCD_SENSITIVITY:
65 return getCcdSensitivityDescription();
66 case TAG_WHITE_BALANCE:
67 return getWhiteBalanceDescription();
68 case TAG_FOCUS:
69 return getFocusDescription();
70 case TAG_DIGITAL_ZOOM:
71 return getDigitalZoomDescription();
72 case TAG_CONVERTER:
73 return getConverterDescription();
74 default:
75 return super.getDescription(tagType);
76 }
77 }
78
79 @Nullable
80 public String getConverterDescription()
81 {
82 return getIndexedDescription(TAG_CONVERTER, "None", "Fisheye converter");
83 }
84
85 @Nullable
86 public String getDigitalZoomDescription()
87 {
88 Rational value = _directory.getRational(TAG_DIGITAL_ZOOM);
89 return value == null
90 ? null
91 : value.getNumerator() == 0
92 ? "No digital zoom"
93 : value.toSimpleString(true) + "x digital zoom";
94 }
95
96 @Nullable
97 public String getFocusDescription()
98 {
99 Rational value = _directory.getRational(TAG_FOCUS);
100 return value == null
101 ? null
102 : value.getNumerator() == 1 && value.getDenominator() == 0
103 ? "Infinite"
104 : value.toSimpleString(true);
105 }
106
107 @Nullable
108 public String getWhiteBalanceDescription()
109 {
110 return getIndexedDescription(TAG_WHITE_BALANCE,
111 "Auto",
112 "Preset",
113 "Daylight",
114 "Incandescence",
115 "Florescence",
116 "Cloudy",
117 "SpeedLight"
118 );
119 }
120
121 @Nullable
122 public String getCcdSensitivityDescription()
123 {
124 return getIndexedDescription(TAG_CCD_SENSITIVITY,
125 "ISO80",
126 null,
127 "ISO160",
128 null,
129 "ISO320",
130 "ISO100"
131 );
132 }
133
134 @Nullable
135 public String getImageAdjustmentDescription()
136 {
137 return getIndexedDescription(TAG_IMAGE_ADJUSTMENT,
138 "Normal",
139 "Bright +",
140 "Bright -",
141 "Contrast +",
142 "Contrast -"
143 );
144 }
145
146 @Nullable
147 public String getColorModeDescription()
148 {
149 return getIndexedDescription(TAG_COLOR_MODE,
150 1,
151 "Color",
152 "Monochrome"
153 );
154 }
155
156 @Nullable
157 public String getQualityDescription()
158 {
159 return getIndexedDescription(TAG_QUALITY,
160 1,
161 "VGA Basic",
162 "VGA Normal",
163 "VGA Fine",
164 "SXGA Basic",
165 "SXGA Normal",
166 "SXGA Fine"
167 );
168 }
169}
Note: See TracBrowser for help on using the repository browser.