Changeset 6127 in josm for trunk/src/com/drew/metadata/exif/PentaxMakernoteDescriptor.java
- Timestamp:
- 2013-08-09T18:05:11+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/exif/PentaxMakernoteDescriptor.java
r4231 r6127 1 1 /* 2 * This is public domain software - that is, you can do whatever you want 3 * with it, and include it software that is licensed under the GNU or the 4 * BSD license, or whatever other licence you choose, including proprietary 5 * closed source licenses. I do ask that you leave this header in tact. 6 * 7 * If you make modifications to this code that you think would benefit the 8 * wider community, please send me a copy and I'll post it on my site. 9 * 10 * If you make use of this code, I'd appreciate hearing about it. 11 * drew@drewnoakes.com 12 * Latest version of this software kept at 13 * http://drewnoakes.com/ 2 * Copyright 2002-2012 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 * http://drewnoakes.com/code/exif/ 19 * http://code.google.com/p/metadata-extractor/ 14 20 */ 15 21 package com.drew.metadata.exif; 16 22 17 import com.drew. metadata.Directory;18 import com.drew. metadata.MetadataException;23 import com.drew.lang.annotations.NotNull; 24 import com.drew.lang.annotations.Nullable; 19 25 import com.drew.metadata.TagDescriptor; 20 26 21 27 /** 22 * Provides human-readable string versions of the tags stored in PentaxMakernoteDirectory.23 * 28 * Provides human-readable string representations of tag values stored in a <code>PentaxMakernoteDirectory</code>. 29 * <p/> 24 30 * Some information about this makernote taken from here: 25 31 * http://www.ozhiker.com/electronics/pjmt/jpeg_info/pentax_mn.html 32 * 33 * @author Drew Noakes http://drewnoakes.com 26 34 */ 27 public class PentaxMakernoteDescriptor extends TagDescriptor 35 public class PentaxMakernoteDescriptor extends TagDescriptor<PentaxMakernoteDirectory> 28 36 { 29 public PentaxMakernoteDescriptor(Directory directory) 37 public PentaxMakernoteDescriptor(@NotNull PentaxMakernoteDirectory directory) 30 38 { 31 39 super(directory); 32 40 } 33 41 34 public String getDescription(int tagType) throws MetadataException 42 @Nullable 43 public String getDescription(int tagType) 35 44 { 36 45 switch (tagType) … … 59 68 return getColourDescription(); 60 69 default: 61 return _directory.getString(tagType); 62 } 63 } 64 65 public String getColourDescription() throws MetadataException 66 { 67 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_COLOUR)) return null; 68 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_COLOUR); 70 return super.getDescription(tagType); 71 } 72 } 73 74 @Nullable 75 public String getColourDescription() 76 { 77 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_COLOUR); 78 if (value==null) 79 return null; 69 80 switch (value) 70 81 { … … 76 87 } 77 88 78 public String getIsoSpeedDescription() throws MetadataException 79 { 80 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_ISO_SPEED)) return null; 81 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_ISO_SPEED); 89 @Nullable 90 public String getIsoSpeedDescription() 91 { 92 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_ISO_SPEED); 93 if (value==null) 94 return null; 82 95 switch (value) 83 96 { … … 91 104 } 92 105 93 public String getSaturationDescription() throws MetadataException 94 { 95 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_SATURATION)) return null; 96 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_SATURATION); 106 @Nullable 107 public String getSaturationDescription() 108 { 109 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_SATURATION); 110 if (value==null) 111 return null; 97 112 switch (value) 98 113 { … … 104 119 } 105 120 106 public String getContrastDescription() throws MetadataException 107 { 108 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_CONTRAST)) return null; 109 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_CONTRAST); 121 @Nullable 122 public String getContrastDescription() 123 { 124 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_CONTRAST); 125 if (value==null) 126 return null; 110 127 switch (value) 111 128 { … … 117 134 } 118 135 119 public String getSharpnessDescription() throws MetadataException 120 { 121 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_SHARPNESS)) return null; 122 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_SHARPNESS); 136 @Nullable 137 public String getSharpnessDescription() 138 { 139 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_SHARPNESS); 140 if (value==null) 141 return null; 123 142 switch (value) 124 143 { … … 130 149 } 131 150 132 public String getDigitalZoomDescription() throws MetadataException 133 { 134 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_DIGITAL_ZOOM)) return null; 135 float value = _directory.getFloat(PentaxMakernoteDirectory.TAG_PENTAX_DIGITAL_ZOOM); 151 @Nullable 152 public String getDigitalZoomDescription() 153 { 154 Float value = _directory.getFloatObject(PentaxMakernoteDirectory.TAG_PENTAX_DIGITAL_ZOOM); 155 if (value==null) 156 return null; 136 157 if (value==0) 137 158 return "Off"; … … 139 160 } 140 161 141 public String getWhiteBalanceDescription() throws MetadataException 142 { 143 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_WHITE_BALANCE)) return null; 144 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_WHITE_BALANCE); 162 @Nullable 163 public String getWhiteBalanceDescription() 164 { 165 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_WHITE_BALANCE); 166 if (value==null) 167 return null; 145 168 switch (value) 146 169 { … … 155 178 } 156 179 157 public String getFlashModeDescription() throws MetadataException 158 { 159 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_FLASH_MODE)) return null; 160 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_FLASH_MODE); 180 @Nullable 181 public String getFlashModeDescription() 182 { 183 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_FLASH_MODE); 184 if (value==null) 185 return null; 161 186 switch (value) 162 187 { … … 169 194 } 170 195 171 public String getFocusModeDescription() throws MetadataException 172 { 173 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_FOCUS_MODE)) return null; 174 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_FOCUS_MODE); 196 @Nullable 197 public String getFocusModeDescription() 198 { 199 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_FOCUS_MODE); 200 if (value==null) 201 return null; 175 202 switch (value) 176 203 { … … 181 208 } 182 209 183 public String getQualityLevelDescription() throws MetadataException 184 { 185 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_QUALITY_LEVEL)) return null; 186 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_QUALITY_LEVEL); 210 @Nullable 211 public String getQualityLevelDescription() 212 { 213 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_QUALITY_LEVEL); 214 if (value==null) 215 return null; 187 216 switch (value) 188 217 { … … 194 223 } 195 224 196 public String getCaptureModeDescription() throws MetadataException 197 { 198 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PENTAX_CAPTURE_MODE)) return null; 199 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PENTAX_CAPTURE_MODE); 225 @Nullable 226 public String getCaptureModeDescription() 227 { 228 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PENTAX_CAPTURE_MODE); 229 if (value==null) 230 return null; 200 231 switch (value) 201 232 { … … 209 240 210 241 /* 211 public String getPrintImageMatchingInfoDescription() throws MetadataException 212 { 213 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PANASONIC_PRINT_IMAGE_MATCHING_INFO)) return null; 242 public String getPrintImageMatchingInfoDescription() 243 { 214 244 byte[] bytes = _directory.getByteArray(PentaxMakernoteDirectory.TAG_PANASONIC_PRINT_IMAGE_MATCHING_INFO); 245 if (bytes==null) 246 return null; 215 247 return "(" + bytes.length + " bytes)"; 216 248 } 217 249 218 public String getMacroModeDescription() throws MetadataException 219 { 220 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PANASONIC_MACRO_MODE)) return null; 221 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PANASONIC_MACRO_MODE); 250 public String getMacroModeDescription() 251 { 252 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PANASONIC_MACRO_MODE); 253 if (value==null) 254 return null; 222 255 switch (value) { 223 256 case 1: … … 230 263 } 231 264 232 public String getRecordModeDescription() throws MetadataException 233 { 234 if (!_directory.containsTag(PentaxMakernoteDirectory.TAG_PANASONIC_RECORD_MODE)) return null; 235 int value = _directory.getInt(PentaxMakernoteDirectory.TAG_PANASONIC_RECORD_MODE); 265 public String getRecordModeDescription() 266 { 267 Integer value = _directory.getInteger(PentaxMakernoteDirectory.TAG_PANASONIC_RECORD_MODE); 268 if (value==null) 269 return null; 236 270 switch (value) { 237 271 case 1:
Note:
See TracChangeset
for help on using the changeset viewer.
