Ignore:
Timestamp:
2018-12-24T09:40:06+01:00 (5 years ago)
Author:
GerdP
Message:

fix #17035: Validator: Improve progress monitor (17035-progress-monitor-v2.patch)

  • Each test can enable a counter that shows "{0} of {1} elements done" for the tested OSM elements. The counter is increased in steps of 1000. For now this is only enabled for MapCSSTagChecker.
  • Don't show the name of the last executed test while postprocessing the results of all tests.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/Test.java

    r14473 r14599  
    7777    protected long startTime;
    7878
     79    private boolean showElementCount;
     80
    7981    /**
    8082     * Constructor
     
    203205            progressMonitor.setTicksCount(selection.size());
    204206        }
     207        long cnt = 0;
    205208        for (OsmPrimitive p : selection) {
    206209            if (isCanceled()) {
     
    212215            if (progressMonitor != null) {
    213216                progressMonitor.worked(1);
     217                cnt++;
     218                // add frequently changing info to progress monitor so that it
     219                // doesn't seem to hang when test takes long
     220                if (showElementCount && cnt % 1000 == 0) {
     221                    progressMonitor.setExtraText(tr("{0} of {1} elements done", cnt, selection.size()));
     222                }
    214223            }
    215224        }
     
    381390        errors.clear();
    382391    }
     392
     393    protected void setShowElements(boolean b) {
     394        showElementCount = b;
     395    }
    383396}
Note: See TracChangeset for help on using the changeset viewer.