Ticket #7508: possible_fix_7508.patch
File possible_fix_7508.patch, 3.0 KB (added by , 13 years ago) |
---|
-
src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
106 106 GpxLayer layer = new GpxLayer(rawData, name); 107 107 Layer x = findMergeLayer(); 108 108 if (newLayer || x == null) { 109 final boolean isDisplayingMapView = Main.isDisplayingMapView(); 109 110 Main.main.addLayer(layer); 111 // if the GPX layer is the only one and no data is available, prevent 112 // the MapView from zooming in on (0,0), which makes starting another 113 // download unnecessarily difficult. See #7508. 114 if(!isDisplayingMapView && rawData.isEmpty() && reader instanceof BoundingBoxDownloader) { 115 Bounds b = ((BoundingBoxDownloader) reader).getBounds(); 116 Main.map.mapView.zoomTo(b); 117 } 110 118 } else { 111 119 x.mergeFrom(layer); 112 120 Main.map.repaint(); -
src/org/openstreetmap/josm/gui/NavigatableComponent.java
311 311 EastNorth e1 = getProjection().latlon2eastNorth(l1); 312 312 EastNorth e2 = getProjection().latlon2eastNorth(l2); 313 313 double d = e2.north() - e1.north(); 314 if(d < height*newScale) 315 { 316 double newScaleH = d/height; 314 if(d < height*newScale && height != 0 && width != 0) { 317 315 e1 = getProjection().latlon2eastNorth(new LatLon(lat, b.getMin().lon())); 318 316 e2 = getProjection().latlon2eastNorth(new LatLon(lat, b.getMax().lon())); 319 317 d = e2.east() - e1.east(); 320 318 if(d < width*newScale) { 321 newScale = Math.max( newScaleH, d/width);319 newScale = Math.max(d/height, d/width); 322 320 } 323 } 324 else 325 { 321 } else if (height != 0) { 326 322 d = d/(l1.greatCircleDistance(l2)*height*10); 327 323 if(newScale < d) { 328 324 newScale = d; -
src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
31 31 this.crosses180th = downloadArea.crosses180thMeridian(); 32 32 } 33 33 34 public Bounds getBounds() { 35 return new Bounds(lat1, lon1, lat2, lon2); 36 } 37 34 38 private GpxData downloadRawGps(String url, ProgressMonitor progressMonitor) throws IOException, OsmTransferException, SAXException { 35 39 boolean done = false; 36 40 GpxData result = null;