Ticket #2963: dont-count-layers.patch
| File dont-count-layers.patch, 1.9 KB (added by , 17 years ago) |
|---|
-
src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
40 40 private boolean newLayer; 41 41 private String msg = ""; 42 42 43 public Task(boolean newLayer, OsmServerReader reader, boolean silent, 44 int numLayers, String msg) { 43 public Task(boolean newLayer, OsmServerReader reader, boolean silent, String msg) { 45 44 super(tr("Downloading data")); 46 45 this.msg = msg; 47 46 this.reader = reader; … … 112 111 Task t = new Task(newLayer, 113 112 new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon), 114 113 silent, 115 getDataLayersCount(),116 114 message); 117 115 currentBounds = new Bounds(new LatLon(minlat, minlon), new LatLon(maxlat, maxlon)); 118 116 // We need submit instead of execute so we can wait for it to finish and get the error … … 134 132 Task t = new Task(new_layer, 135 133 new OsmServerLocationReader(url), 136 134 false, 137 getDataLayersCount(),138 135 ""); 139 136 task = Main.worker.submit(t, t); 140 137 } … … 147 144 return "osm"; 148 145 } 149 146 150 /**151 * Finds the number of data layers currently opened152 * @return Number of data layers153 */154 private int getDataLayersCount() {155 if(Main.map == null || Main.map.mapView == null)156 return 0;157 int num = 0;158 for(Layer l : Main.map.mapView.getAllLayers())159 if(l instanceof OsmDataLayer) {160 num++;161 }162 return num;163 }164 165 147 /* 166 148 * (non-Javadoc) 167 149 * @see org.openstreetmap.josm.gui.download.DownloadDialog.DownloadTask#getErrorMessage()
