Changeset 33967 in osm for applications/editors


Ignore:
Timestamp:
2017-12-30T08:05:03+01:00 (7 years ago)
Author:
bastik
Message:

applied #josm11844 - Show time estimation when geotagging many photos at once (patch by skorbut et al.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java

    r33878 r33967  
    236236            progressMonitor.subTask(tr("Writing position information to image files..."));
    237237            progressMonitor.setTicksCount(images.size());
     238
     239            final long startTime = System.currentTimeMillis();
    238240
    239241            currentIndex = 0;
     
    276278                }
    277279                progressMonitor.worked(1);
     280
     281                float millisecsPerFile = ((float)(System.currentTimeMillis()-startTime))/((currentIndex+1)); // currentIndex starts at 0
     282                int filesLeft = images.size()-currentIndex-1;
     283                int secsLeft = (int)Math.ceil((millisecsPerFile*filesLeft/1000));
     284                String timeLeft;
     285                if (secsLeft < 60) {
     286                        timeLeft = secsLeft + "s";
     287                } else if (secsLeft < 3600) {
     288                        timeLeft = secsLeft/60 + "min " + secsLeft%60 + "s";
     289                } else {
     290                        timeLeft = secsLeft/3600 + "h " + ((secsLeft)/60)%60 + "min " + secsLeft%60 + "s";
     291                }
     292                                progressMonitor.subTask(tr("Writing position information to image files... Estimated time left: {0}", timeLeft));
     293
    278294                if (debug) {
    279295                    System.err.println("finished " + e.getFile());
Note: See TracChangeset for help on using the changeset viewer.