Changeset 1281 in josm for trunk/src/org


Ignore:
Timestamp:
2009-01-17T19:26:41+01:00 (16 years ago)
Author:
ulfl
Message:

add setIndeterminate() to the PleaseWaitDialog and use it at a few places
add some more user feedback for task long running on huge data

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java

    r1184 r1281  
    5050        });
    5151    }
     52   
     53    public void setIndeterminate(boolean newValue) {
     54        progressBar.setIndeterminate(newValue);
     55    }
    5256}
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r1180 r1281  
    222222    @Override public void mergeFrom(final Layer from) {
    223223        final MergeVisitor visitor = new MergeVisitor(data,((OsmDataLayer)from).data);
    224         for (final OsmPrimitive osm : ((OsmDataLayer)from).data.allPrimitives())
     224        int i=0;
     225        int max = ((OsmDataLayer)from).data.allPrimitives().size();
     226
     227        System.out.format("Add/Merge data:");
     228       
     229        for (final OsmPrimitive osm : ((OsmDataLayer)from).data.allPrimitives()) {
     230            i++;
     231            if(i%100 == 0) {
     232                double perc = (((double)i) / ((double)max) * 100.0);
     233                System.out.format(" " + (int)perc + "%%");
     234            }
    225235            osm.visit(visitor);
     236        }
    226237        visitor.fixReferences();
     238        System.out.println("");
    227239
    228240        // copy the merged layer's data source info
  • trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java

    r1169 r1281  
    9393            Main.pleaseWaitDlg.progress.setValue(0);
    9494            Main.pleaseWaitDlg.currentAction.setText(tr("Contacting OSM Server..."));
     95            Main.pleaseWaitDlg.setIndeterminate(true);
    9596            final InputStream in = getInputStream("map?bbox="+lon1+","+lat1+","+lon2+","+lat2, Main.pleaseWaitDlg);
     97            Main.pleaseWaitDlg.setIndeterminate(false);
    9698            if (in == null)
    9799                return null;
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r1279 r1281  
    501501             throw new SAXException(e1);
    502502        }
     503           
     504          Main.pleaseWaitDlg.currentAction.setText(tr("Prepare OSM data..."));
     505          Main.pleaseWaitDlg.setIndeterminate(true);
    503506
    504507          System.out.println("");
     
    522525                    o.id = 0;
    523526
    524           System.out.println("File loaded!");
     527          System.out.println("Data loaded!");
     528          Main.pleaseWaitDlg.setIndeterminate(false);
     529          Main.pleaseWaitDlg.progress.setValue(0);
    525530         
    526531          return osm;
Note: See TracChangeset for help on using the changeset viewer.