- Timestamp:
- 2019-07-07T02:23:14+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxImageEntry.java
r14624 r15219 5 5 import java.io.IOException; 6 6 import java.util.Date; 7 import java.util.List; 7 8 import java.util.Objects; 8 9 import java.util.function.Consumer; … … 21 22 import com.drew.metadata.exif.ExifIFD0Directory; 22 23 import com.drew.metadata.exif.GpsDirectory; 24 import com.drew.metadata.iptc.IptcDirectory; 23 25 import com.drew.metadata.jpeg.JpegDirectory; 24 26 … … 41 43 /** Temporary source of GPS time if not correlated with GPX track. */ 42 44 private Date exifGpsTime; 45 46 private String iptcCaption; 47 private String iptcHeadline; 48 private List<String> iptcKeywords; 49 private String iptcObjectName; 43 50 44 51 /** … … 333 340 public void setExifImgDir(Double exifDir) { 334 341 this.exifImgDir = exifDir; 342 } 343 344 /** 345 * Sets the IPTC caption. 346 * @param iptcCaption the IPTC caption 347 * @since 15219 348 */ 349 public void setIptcCaption(String iptcCaption) { 350 this.iptcCaption = iptcCaption; 351 } 352 353 /** 354 * Sets the IPTC headline. 355 * @param iptcHeadline the IPTC headline 356 * @since 15219 357 */ 358 public void setIptcHeadline(String iptcHeadline) { 359 this.iptcHeadline = iptcHeadline; 360 } 361 362 /** 363 * Sets the IPTC keywords. 364 * @param iptcKeywords the IPTC keywords 365 * @since 15219 366 */ 367 public void setIptcKeywords(List<String> iptcKeywords) { 368 this.iptcKeywords = iptcKeywords; 369 } 370 371 /** 372 * Sets the IPTC object name. 373 * @param iptcObjectName the IPTC object name 374 * @since 15219 375 */ 376 public void setIptcObjectName(String iptcObjectName) { 377 this.iptcObjectName = iptcObjectName; 378 } 379 380 /** 381 * Returns the IPTC caption. 382 * @return the IPTC caption 383 * @since 15219 384 */ 385 public String getIptcCaption() { 386 return iptcCaption; 387 } 388 389 /** 390 * Returns the IPTC headline. 391 * @return the IPTC headline 392 * @since 15219 393 */ 394 public String getIptcHeadline() { 395 return iptcHeadline; 396 } 397 398 /** 399 * Returns the IPTC keywords. 400 * @return the IPTC keywords 401 * @since 15219 402 */ 403 public List<String> getIptcKeywords() { 404 return iptcKeywords; 405 } 406 407 /** 408 * Returns the IPTC object name. 409 * @return the IPTC object name 410 * @since 15219 411 */ 412 public String getIptcObjectName() { 413 return iptcObjectName; 335 414 } 336 415 … … 556 635 557 636 ifNotNull(dirGps.getGpsDate(), this::setExifGpsTime); 637 638 IptcDirectory dirIptc = metadata.getFirstDirectoryOfType(IptcDirectory.class); 639 if (dirIptc != null) { 640 ifNotNull(ExifReader.readCaption(dirIptc), this::setIptcCaption); 641 ifNotNull(ExifReader.readHeadline(dirIptc), this::setIptcHeadline); 642 ifNotNull(ExifReader.readKeywords(dirIptc), this::setIptcKeywords); 643 ifNotNull(ExifReader.readObjectName(dirIptc), this::setIptcObjectName); 644 } 558 645 } 559 646 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
r14903 r15219 14 14 import java.text.DateFormat; 15 15 import java.text.SimpleDateFormat; 16 import java.util.Optional; 16 17 17 18 import javax.swing.Box; … … 473 474 osd.append(tr("\nGPS time: {0}", dtf.format(entry.getGpsTime()))); 474 475 } 476 Optional.ofNullable(entry.getIptcCaption()).map(s -> tr("\nCaption: {0}", s)).ifPresent(osd::append); 477 Optional.ofNullable(entry.getIptcHeadline()).map(s -> tr("\nHeadline: {0}", s)).ifPresent(osd::append); 478 Optional.ofNullable(entry.getIptcKeywords()).map(s -> tr("\nKeywords: {0}", s)).ifPresent(osd::append); 479 Optional.ofNullable(entry.getIptcObjectName()).map(s -> tr("\nObject name: {0}", s)).ifPresent(osd::append); 475 480 476 481 imgDisplay.setOsdText(osd.toString()); -
trunk/src/org/openstreetmap/josm/tools/ExifReader.java
r14159 r15219 7 7 import java.time.DateTimeException; 8 8 import java.util.Date; 9 import java.util.List; 9 10 import java.util.concurrent.TimeUnit; 10 11 … … 24 25 import com.drew.metadata.exif.ExifSubIFDDirectory; 25 26 import com.drew.metadata.exif.GpsDirectory; 27 import com.drew.metadata.iptc.IptcDirectory; 26 28 27 29 /** … … 327 329 328 330 /** 331 * Returns the caption of the given IPTC directory. 332 * @param dirIptc The IPTC directory 333 * @return The caption entered, or {@code null} if missing or if {@code dirIptc} is null 334 * @since 15219 335 */ 336 public static String readCaption(IptcDirectory dirIptc) { 337 return dirIptc == null ? null : dirIptc.getDescription(IptcDirectory.TAG_CAPTION); 338 } 339 340 /** 341 * Returns the headline of the given IPTC directory. 342 * @param dirIptc The IPTC directory 343 * @return The headline entered, or {@code null} if missing or if {@code dirIptc} is null 344 * @since 15219 345 */ 346 public static String readHeadline(IptcDirectory dirIptc) { 347 return dirIptc == null ? null : dirIptc.getDescription(IptcDirectory.TAG_HEADLINE); 348 } 349 350 /** 351 * Returns the keywords of the given IPTC directory. 352 * @param dirIptc The IPTC directory 353 * @return The keywords entered, or {@code null} if missing or if {@code dirIptc} is null 354 * @since 15219 355 */ 356 public static List<String> readKeywords(IptcDirectory dirIptc) { 357 return dirIptc == null ? null : dirIptc.getKeywords(); 358 } 359 360 /** 361 * Returns the object name of the given IPTC directory. 362 * @param dirIptc The IPTC directory 363 * @return The object name entered, or {@code null} if missing or if {@code dirIptc} is null 364 * @since 15219 365 */ 366 public static String readObjectName(IptcDirectory dirIptc) { 367 return dirIptc == null ? null : dirIptc.getDescription(IptcDirectory.TAG_OBJECT_NAME); 368 } 369 370 /** 329 371 * Returns a Transform that fixes the image orientation. 330 372 *
Note:
See TracChangeset
for help on using the changeset viewer.