Ticket #969: bbnorefresh.diff

File bbnorefresh.diff, 1.7 KB (added by stoecker, 18 years ago)
  • src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java

     
    4040                        new JTextField(11),
    4141                        new JTextField(11) };
    4242        final JTextArea osmUrl = new JTextArea();
     43        String oldUrl = new String("");
    4344       
    4445        final JLabel sizeCheck = new JLabel();
    4546       
     
    8182                        public void insertUpdate(DocumentEvent e) { dowork(); }
    8283                        public void removeUpdate(DocumentEvent e) { dowork(); }
    8384                        private void dowork() {
    84                                 Bounds b = osmurl2bounds(osmUrl.getText());
    85                                 if (b != null) {
    86                                         gui.minlon = b.min.lon();
    87                                         gui.minlat = b.min.lat();
    88                                         gui.maxlon = b.max.lon();
    89                                         gui.maxlat = b.max.lat();
    90                                         gui.boundingBoxChanged(BoundingBoxSelection.this);
    91                                         updateBboxFields(gui);
    92                                         updateSizeCheck(gui);
     85                                if(!oldUrl.equals(osmUrl.getText()))
     86                                {
     87                                        Bounds b = osmurl2bounds(osmUrl.getText());
     88                                        if (b != null) {
     89                                                gui.minlon = b.min.lon();
     90                                                gui.minlat = b.min.lat();
     91                                                gui.maxlon = b.max.lon();
     92                                                gui.maxlat = b.max.lat();
     93                                                gui.boundingBoxChanged(BoundingBoxSelection.this);
     94                                                updateBboxFields(gui);
     95                                                updateSizeCheck(gui);
     96                                        }
    9397                                }
    9498                        }
    9599                };
     
    162166                        size *= 2;
    163167                        zoom++;
    164168                }
    165                 osmUrl.setText("http://www.openstreetmap.org/index.html?mlat="+lat+"&mlon="+lon+"&zoom="+zoom);
     169                // setting old URL prevents refresh based on this URL
     170                oldUrl = "http://www.openstreetmap.org/index.html?mlat="+lat+"&mlon="+lon+"&zoom="+zoom;
     171                osmUrl.setText(oldUrl);
    166172        }
    167173       
    168174        private void updateSizeCheck(DownloadDialog gui) {