Changes between Initial Version and Version 1 of Ticket #11710, comment 3


Ignore:
Timestamp:
2021-05-06T20:43:41+02:00 (5 years ago)
Author:
Bjoeni

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11710, comment 3

    initial v1  
    11Prevent removal of geotags from files that weren't matched to the track:
    22{{{#!diff
    3 Index: src/org/openstreetmap/josm/data/gpx/GpxImageCorrelation.java
    4 ===================================================================
    5 --- src/org/openstreetmap/josm/data/gpx/GpxImageCorrelation.java        (revision 17821)
    6 +++ src/org/openstreetmap/josm/data/gpx/GpxImageCorrelation.java        (working copy)
    7 @@ -229,9 +229,8 @@
    8                      break;
    9                  }
    10                  long tagms = TimeUnit.MINUTES.toMillis(tagTime);
    11 -                if (curTmp.getPos() == null &&
    12 -                        (Math.abs(time - curWpTime) <= tagms
    13 -                        || Math.abs(prevWpTime - time) <= tagms)) {
    14 +                if (Math.abs(time - curWpTime) <= tagms
    15 +                        || Math.abs(prevWpTime - time) <= tagms) {
    16                      if (prevWp != null && time < curWpTime - half) {
    17                          curTmp.setPos(prevWp.getCoor());
    18                      } else {
    19 @@ -255,20 +254,18 @@
    20                  if (imgTime < prevWpTime) {
    21                      break;
    22                  }
    23 -                if (curTmp.getPos() == null) {
    24 -                    // The values of timeDiff are between 0 and 1, it is not seconds but a dimensionless variable
    25 -                    double timeDiff = (double) (imgTime - prevWpTime) / Math.abs(curWpTime - prevWpTime);
    26 -                    curTmp.setPos(prevWp.getCoor().interpolate(curWp.getCoor(), timeDiff));
    27 -                    curTmp.setSpeed(speed);
    28 -                    if (curElevation != null && prevElevation != null) {
    29 -                        curTmp.setElevation(prevElevation + (curElevation - prevElevation) * timeDiff);
    30 -                    }
    31 -                    curTmp.setGpsTime(curImg.getExifInstant().minusMillis(offset));
    32 -                    curTmp.flagNewGpsData();
    33 -                    curImg.tmpUpdated();
    34 +                // The values of timeDiff are between 0 and 1, it is not seconds but a dimensionless variable
    35 +                double timeDiff = (double) (imgTime - prevWpTime) / Math.abs(curWpTime - prevWpTime);
    36 +                curTmp.setPos(prevWp.getCoor().interpolate(curWp.getCoor(), timeDiff));
    37 +                curTmp.setSpeed(speed);
    38 +                if (curElevation != null && prevElevation != null) {
    39 +                    curTmp.setElevation(prevElevation + (curElevation - prevElevation) * timeDiff);
    40 +                }
    41 +                curTmp.setGpsTime(curImg.getExifInstant().minusMillis(offset));
    42 +                curTmp.flagNewGpsData();
    43 +                curImg.tmpUpdated();
    44 
    45 -                    ret++;
    46 -                }
    47 +                ret++;
    48                  i--;
    49              }
    50          }
    51 Index: src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
    52 ===================================================================
    53 --- src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java   (revision 17821)
    54 +++ src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java   (working copy)
    55 @@ -1090,10 +1090,7 @@
    56              // Construct a list of images that have a date, and sort them on the date.
    57              List<ImageEntry> dateImgLst = getSortedImgList();
    58              // Create a temporary copy for each image
    59 -            for (ImageEntry ie : dateImgLst) {
    60 -                ie.createTmp();
    61 -                ie.getTmp().setPos(null);
    62 -            }
    63 +            dateImgLst.forEach(ImageEntry::createTmp);
    64 
    65              GpxDataWrapper selGpx = selectedGPX(false);
    66              if (selGpx == null)
     3-- see new patch below --
    674}}}
    685See also the changes from #16681 allowing the user to determine what images should be matched.