source: josm/trunk/src/com/drew/metadata/exif/makernotes/LeicaMakernoteDescriptor.java@ 12187

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

update to metadata-extractor 2.9.1

File size: 3.8 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.annotations.NotNull;
24import com.drew.lang.annotations.Nullable;
25import com.drew.metadata.TagDescriptor;
26
27import static com.drew.metadata.exif.makernotes.LeicaMakernoteDirectory.*;
28
29/**
30 * Provides human-readable string representations of tag values stored in a {@link LeicaMakernoteDirectory}.
31 * <p>
32 * Tag reference from: http://gvsoft.homedns.org/exif/makernote-leica-type1.html
33 *
34 * @author Drew Noakes https://drewnoakes.com
35 */
36public class LeicaMakernoteDescriptor extends TagDescriptor<LeicaMakernoteDirectory>
37{
38 public LeicaMakernoteDescriptor(@NotNull LeicaMakernoteDirectory directory)
39 {
40 super(directory);
41 }
42
43 @Override
44 @Nullable
45 public String getDescription(int tagType)
46 {
47 switch (tagType) {
48 case TAG_QUALITY:
49 return getQualityDescription();
50 case TAG_USER_PROFILE:
51 return getUserProfileDescription();
52// case TAG_SERIAL:
53// return getSerialNumberDescription();
54 case TAG_WHITE_BALANCE:
55 return getWhiteBalanceDescription();
56 case TAG_EXTERNAL_SENSOR_BRIGHTNESS_VALUE:
57 return getExternalSensorBrightnessValueDescription();
58 case TAG_MEASURED_LV:
59 return getMeasuredLvDescription();
60 case TAG_APPROXIMATE_F_NUMBER:
61 return getApproximateFNumberDescription();
62 case TAG_CAMERA_TEMPERATURE:
63 return getCameraTemperatureDescription();
64 case TAG_WB_RED_LEVEL:
65 case TAG_WB_BLUE_LEVEL:
66 case TAG_WB_GREEN_LEVEL:
67 return getSimpleRational(tagType);
68 default:
69 return super.getDescription(tagType);
70 }
71 }
72
73 @Nullable
74 private String getCameraTemperatureDescription()
75 {
76 return getFormattedInt(TAG_CAMERA_TEMPERATURE, "%d C");
77 }
78
79 @Nullable
80 private String getApproximateFNumberDescription()
81 {
82 return getSimpleRational(TAG_APPROXIMATE_F_NUMBER);
83 }
84
85 @Nullable
86 private String getMeasuredLvDescription()
87 {
88 return getSimpleRational(TAG_MEASURED_LV);
89 }
90
91 @Nullable
92 private String getExternalSensorBrightnessValueDescription()
93 {
94 return getSimpleRational(TAG_EXTERNAL_SENSOR_BRIGHTNESS_VALUE);
95 }
96
97 @Nullable
98 private String getWhiteBalanceDescription()
99 {
100 return getIndexedDescription(TAG_WHITE_BALANCE,
101 "Auto or Manual",
102 "Daylight",
103 "Fluorescent",
104 "Tungsten",
105 "Flash",
106 "Cloudy",
107 "Shadow"
108 );
109 }
110
111 @Nullable
112 private String getUserProfileDescription()
113 {
114 return getIndexedDescription(TAG_QUALITY, 1,
115 "User Profile 1",
116 "User Profile 2",
117 "User Profile 3",
118 "User Profile 0 (Dynamic)"
119 );
120 }
121
122 @Nullable
123 private String getQualityDescription()
124 {
125 return getIndexedDescription(TAG_QUALITY, 1, "Fine", "Basic");
126 }
127}
Note: See TracBrowser for help on using the repository browser.