Ignore:
Timestamp:
27.10.2009 01:21:32 (3 years ago)
Author:
Gubaer
Message:

Cleanup in download logic (less global, more encapsulation)

File:
1 edited

Legend:

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

    r1169 r2327  
    1616import javax.swing.SpinnerNumberModel; 
    1717 
     18import org.openstreetmap.josm.data.Bounds; 
     19import org.openstreetmap.josm.data.coor.LatLon; 
    1820import org.openstreetmap.josm.tools.GBC; 
    1921/** 
     
    6567                    if (toy<fromy) { int i = fromy; fromy=toy; toy=i; } 
    6668 
    67                     gui.minlat = tileYToLat(zoomlvl, toy+1); 
    68                     gui.minlon = tileXToLon(zoomlvl, fromx); 
    69                     gui.maxlat = tileYToLat(zoomlvl, fromy); 
    70                     gui.maxlon = tileXToLon(zoomlvl, tox+1); 
    71                     gui.boundingBoxChanged(TileSelection.this); 
     69                    Bounds b = new Bounds( 
     70                            new LatLon(tileYToLat(zoomlvl, toy + 1), tileXToLon(zoomlvl, fromx)), 
     71                            new LatLon(tileYToLat(zoomlvl, fromy), tileXToLon(zoomlvl, tox + 1)) 
     72                            ); 
     73                    gui.boundingBoxChanged(b, TileSelection.this); 
    7274                    //repaint(); 
    7375                } catch (NumberFormatException x) { 
     
    8284        } 
    8385 
    84         gui.tabpane.addTab(tr("Tile Numbers"), smpanel); 
     86        gui.addDownloadAreaSelector(smpanel, tr("Tile Numbers")); 
    8587    } 
    8688 
     
    9496    private void updateBboxFields(DownloadDialog gui) { 
    9597        int z = ((Integer) tileZ.getValue()).intValue(); 
    96         tileX0.setText(Integer.toString(lonToTileX(z, gui.minlon))); 
    97         tileX1.setText(Integer.toString(lonToTileX(z, gui.maxlon-.00001))); 
    98         tileY0.setText(Integer.toString(latToTileY(z, gui.maxlat-.00001))); 
    99         tileY1.setText(Integer.toString(latToTileY(z, gui.minlat))); 
     98        Bounds b = gui.getSelectedDownloadArea(); 
     99        if (b == null) 
     100            return; 
     101        tileX0.setText(Integer.toString(lonToTileX(z, b.getMin().lon()))); 
     102        tileX1.setText(Integer.toString(lonToTileX(z, b.getMax().lon()-.00001))); 
     103        tileY0.setText(Integer.toString(latToTileY(z, b.getMax().lat()-.00001))); 
     104        tileY1.setText(Integer.toString(latToTileY(z, b.getMin().lat()))); 
    100105    } 
    101106 
Note: See TracChangeset for help on using the changeset viewer.