Changeset 18252 in josm for trunk/src


Ignore:
Timestamp:
2021-10-05T23:47:54+02:00 (3 years ago)
Author:
Don-vip
Message:

see #16472 - Move xmp and iptc parsing to before gps short circuit (patch by taylor.smock)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxImageEntry.java

    r18246 r18252  
    694694        }
    695695
     696        IptcDirectory dirIptc = metadata.getFirstDirectoryOfType(IptcDirectory.class);
     697        if (dirIptc != null) {
     698            ifNotNull(ExifReader.readCaption(dirIptc), this::setIptcCaption);
     699            ifNotNull(ExifReader.readHeadline(dirIptc), this::setIptcHeadline);
     700            ifNotNull(ExifReader.readKeywords(dirIptc), this::setIptcKeywords);
     701            ifNotNull(ExifReader.readObjectName(dirIptc), this::setIptcObjectName);
     702        }
     703
     704        for (XmpDirectory xmpDirectory : metadata.getDirectoriesOfType(XmpDirectory.class)) {
     705            Map<String, String> properties = xmpDirectory.getXmpProperties();
     706            final String projectionType = "GPano:ProjectionType";
     707            if (properties.containsKey(projectionType)) {
     708                Stream.of(Projections.values()).filter(p -> p.name().equalsIgnoreCase(properties.get(projectionType)))
     709                        .findFirst().ifPresent(projection -> this.cameraProjection = projection);
     710                break;
     711            }
     712        }
     713
    696714        // Changed to silently cope with no time info in exif. One case
    697715        // of person having time that couldn't be parsed, but valid GPS info
     
    756774
    757775        ifNotNull(dirGps.getGpsDate(), d -> setExifGpsTime(d.toInstant()));
    758 
    759         IptcDirectory dirIptc = metadata.getFirstDirectoryOfType(IptcDirectory.class);
    760         if (dirIptc != null) {
    761             ifNotNull(ExifReader.readCaption(dirIptc), this::setIptcCaption);
    762             ifNotNull(ExifReader.readHeadline(dirIptc), this::setIptcHeadline);
    763             ifNotNull(ExifReader.readKeywords(dirIptc), this::setIptcKeywords);
    764             ifNotNull(ExifReader.readObjectName(dirIptc), this::setIptcObjectName);
    765         }
    766 
    767         for (XmpDirectory xmpDirectory : metadata.getDirectoriesOfType(XmpDirectory.class)) {
    768             Map<String, String> properties = xmpDirectory.getXmpProperties();
    769             final String projectionType = "GPano:ProjectionType";
    770             if (properties.containsKey(projectionType)) {
    771                 Stream.of(Projections.values()).filter(p -> p.name().equalsIgnoreCase(properties.get(projectionType)))
    772                         .findFirst().ifPresent(projection -> this.cameraProjection = projection);
    773                 break;
    774             }
    775         }
    776776    }
    777777
Note: See TracChangeset for help on using the changeset viewer.