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 | package com.drew.metadata.exif.makernotes;
|
---|
22 |
|
---|
23 | import com.drew.lang.annotations.NotNull;
|
---|
24 | import com.drew.lang.annotations.Nullable;
|
---|
25 | import com.drew.metadata.TagDescriptor;
|
---|
26 |
|
---|
27 | import 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 | */
|
---|
36 | public 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 | }
|
---|