Changeset 18237 in josm for trunk/src/org


Ignore:
Timestamp:
2021-09-30T01:35:56+02:00 (3 years ago)
Author:
Don-vip
Message:

see #21144 - fix #21334 - fix correlated image direction when position is between 2 gpx points

File:
1 edited

Legend:

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

    r18211 r18237  
    273273            // This code gives a simple linear interpolation of the coordinates between current and
    274274            // previous track point assuming a constant speed in between
     275            LatLon nextCoorForDirection = nextWp != null ? nextWp.getCoor() : null;
    275276            while (i >= 0) {
    276277                final GpxImageEntry curImg = images.get(i);
    277                 final GpxImageEntry curTmp = curImg.getTmp();
    278278                final long imgTime = curImg.getExifInstant().toEpochMilli();
    279279                if (imgTime < prevWpTime) {
    280280                    break;
    281281                }
     282                final GpxImageEntry curTmp = curImg.getTmp();
    282283                if (!curTmp.hasNewGpsData()) {
    283284                    // The values of timeDiff are between 0 and 1, it is not seconds but a dimensionless variable
     
    287288                    final LatLon curCoor = curWp.getCoor();
    288289                    LatLon position = prevCoor.interpolate(curCoor, timeDiff);
    289                     if (nextWp != null && (shiftXY || dirpos.isSetImageDirection())) {
    290                         double direction = curCoor.bearing(nextWp.getCoor());
     290                    if (nextCoorForDirection != null && (shiftXY || dirpos.isSetImageDirection())) {
     291                        double direction = position.bearing(nextCoorForDirection);
    291292                        if (dirpos.isSetImageDirection()) {
    292293                            curTmp.setExifImgDir(computeDirection(direction, dirpos.getImageDirectionAngleOffset()));
     
    311312                    curImg.tmpUpdated();
    312313
     314                    nextCoorForDirection = curCoor;
    313315                    ret++;
    314316                }
Note: See TracChangeset for help on using the changeset viewer.