1 | /*
|
---|
2 | * Copyright 2002-2019 Drew Noakes and contributors
|
---|
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 | @SuppressWarnings("WeakerAccess")
|
---|
37 | public class LeicaMakernoteDescriptor extends TagDescriptor<LeicaMakernoteDirectory>
|
---|
38 | {
|
---|
39 | public LeicaMakernoteDescriptor(@NotNull LeicaMakernoteDirectory directory)
|
---|
40 | {
|
---|
41 | super(directory);
|
---|
42 | }
|
---|
43 |
|
---|
44 | @Override
|
---|
45 | @Nullable
|
---|
46 | public String getDescription(int tagType)
|
---|
47 | {
|
---|
48 | switch (tagType) {
|
---|
49 | case TAG_QUALITY:
|
---|
50 | return getQualityDescription();
|
---|
51 | case TAG_USER_PROFILE:
|
---|
52 | return getUserProfileDescription();
|
---|
53 | // case TAG_SERIAL:
|
---|
54 | // return getSerialNumberDescription();
|
---|
55 | case TAG_WHITE_BALANCE:
|
---|
56 | return getWhiteBalanceDescription();
|
---|
57 | case TAG_EXTERNAL_SENSOR_BRIGHTNESS_VALUE:
|
---|
58 | return getExternalSensorBrightnessValueDescription();
|
---|
59 | case TAG_MEASURED_LV:
|
---|
60 | return getMeasuredLvDescription();
|
---|
61 | case TAG_APPROXIMATE_F_NUMBER:
|
---|
62 | return getApproximateFNumberDescription();
|
---|
63 | case TAG_CAMERA_TEMPERATURE:
|
---|
64 | return getCameraTemperatureDescription();
|
---|
65 | case TAG_WB_RED_LEVEL:
|
---|
66 | case TAG_WB_BLUE_LEVEL:
|
---|
67 | case TAG_WB_GREEN_LEVEL:
|
---|
68 | return getSimpleRational(tagType);
|
---|
69 | default:
|
---|
70 | return super.getDescription(tagType);
|
---|
71 | }
|
---|
72 | }
|
---|
73 |
|
---|
74 | @Nullable
|
---|
75 | private String getCameraTemperatureDescription()
|
---|
76 | {
|
---|
77 | return getFormattedInt(TAG_CAMERA_TEMPERATURE, "%d C");
|
---|
78 | }
|
---|
79 |
|
---|
80 | @Nullable
|
---|
81 | private String getApproximateFNumberDescription()
|
---|
82 | {
|
---|
83 | return getSimpleRational(TAG_APPROXIMATE_F_NUMBER);
|
---|
84 | }
|
---|
85 |
|
---|
86 | @Nullable
|
---|
87 | private String getMeasuredLvDescription()
|
---|
88 | {
|
---|
89 | return getSimpleRational(TAG_MEASURED_LV);
|
---|
90 | }
|
---|
91 |
|
---|
92 | @Nullable
|
---|
93 | private String getExternalSensorBrightnessValueDescription()
|
---|
94 | {
|
---|
95 | return getSimpleRational(TAG_EXTERNAL_SENSOR_BRIGHTNESS_VALUE);
|
---|
96 | }
|
---|
97 |
|
---|
98 | @Nullable
|
---|
99 | private String getWhiteBalanceDescription()
|
---|
100 | {
|
---|
101 | return getIndexedDescription(TAG_WHITE_BALANCE,
|
---|
102 | "Auto or Manual",
|
---|
103 | "Daylight",
|
---|
104 | "Fluorescent",
|
---|
105 | "Tungsten",
|
---|
106 | "Flash",
|
---|
107 | "Cloudy",
|
---|
108 | "Shadow"
|
---|
109 | );
|
---|
110 | }
|
---|
111 |
|
---|
112 | @Nullable
|
---|
113 | private String getUserProfileDescription()
|
---|
114 | {
|
---|
115 | return getIndexedDescription(TAG_QUALITY, 1,
|
---|
116 | "User Profile 1",
|
---|
117 | "User Profile 2",
|
---|
118 | "User Profile 3",
|
---|
119 | "User Profile 0 (Dynamic)"
|
---|
120 | );
|
---|
121 | }
|
---|
122 |
|
---|
123 | @Nullable
|
---|
124 | private String getQualityDescription()
|
---|
125 | {
|
---|
126 | return getIndexedDescription(TAG_QUALITY, 1, "Fine", "Basic");
|
---|
127 | }
|
---|
128 | }
|
---|