Changeset 1038 in josm for trunk/src/org
- Timestamp:
- 2008-10-13T10:53:44+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/download
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
r1020 r1038 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Color;7 6 import java.awt.Dimension; 8 import java.awt.Font;9 7 import java.awt.GridBagLayout; 10 8 import java.awt.event.FocusAdapter; … … 44 42 String noteUrl = tr("You can paste an URL here to download the area."); 45 43 46 final JLabel sizeCheck = new JLabel();47 48 44 public void addGui(final DownloadDialog gui) { 49 45 … … 69 65 } 70 66 updateUrl(gui); 71 updateSizeCheck(gui);72 67 } 73 68 }); … … 93 88 updateBboxFields(gui); 94 89 updateUrl(gui); 95 updateSizeCheck(gui);96 90 } 97 91 } … … 115 109 osmUrl.setBorder(latlon[0].getBorder()); 116 110 117 Font labelFont = sizeCheck.getFont();118 sizeCheck.setFont(labelFont.deriveFont(Font.PLAIN, labelFont.getSize()));119 120 111 dlg.add(new JLabel(tr("min lat")), GBC.std().insets(10,20,5,0)); 121 112 dlg.add(latlon[0], GBC.std().insets(0,20,0,0)); … … 129 120 dlg.add(new JLabel(tr("URL from www.openstreetmap.org")), GBC.eol().insets(10,20,5,0)); 130 121 dlg.add(osmUrl, GBC.eop().insets(10,0,5,0).fill()); 131 dlg.add(showUrl, GBC.eop().insets(10,0,5,20)); 132 dlg.add(sizeCheck, GBC.eop().insets(10,0,5,20)); 122 dlg.add(showUrl, GBC.eop().insets(10,0,5,5)); 133 123 134 124 gui.tabpane.addTab(tr("Bounding Box"), dlg); … … 141 131 updateBboxFields(gui); 142 132 updateUrl(gui); 143 updateSizeCheck(gui);144 133 } 145 134 … … 168 157 } 169 158 showUrl.setText("http://www.openstreetmap.org/index.html?mlat="+lat+"&mlon="+lon+"&zoom="+zoom); 170 }171 172 private void updateSizeCheck(DownloadDialog gui) {173 double squareDegrees = (gui.maxlon-gui.minlon)*(gui.maxlat-gui.minlat);174 double maxBboxSize = 0.25;175 try {176 Double.parseDouble(Main.pref.get("osm-server.max-request-area", "0.25"));177 } catch (NumberFormatException nfe) {178 maxBboxSize = 0.25;179 }180 if (squareDegrees > maxBboxSize) {181 sizeCheck.setText(tr("Download area too large; will probably be rejected by server"));182 sizeCheck.setForeground(Color.red);183 } else {184 sizeCheck.setText(tr("Download area ok, size probably acceptable to server"));185 sizeCheck.setForeground(Color.darkGray);186 }187 159 } 188 160 -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r979 r1038 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Color; 7 import java.awt.Font; 6 8 import java.awt.GridBagLayout; 7 9 import java.util.ArrayList; … … 63 65 public final JTabbedPane tabpane = new JTabbedPane(); 64 66 public final JCheckBox newLayer; 67 public final JLabel sizeCheck = new JLabel(); 65 68 66 69 public double minlon; … … 138 141 Main.pref.put("download.tab", "0"); 139 142 } 143 144 Font labelFont = sizeCheck.getFont(); 145 sizeCheck.setFont(labelFont.deriveFont(Font.PLAIN, labelFont.getSize())); 146 add(sizeCheck, GBC.eop().insets(0,5,5,10)); 147 } 148 149 private void updateSizeCheck() { 150 double squareDegrees = (maxlon-minlon)*(maxlat-minlat); 151 double maxBboxSize = 0.25; 152 try { 153 Double.parseDouble(Main.pref.get("osm-server.max-request-area", "0.25")); 154 } catch (NumberFormatException nfe) { 155 maxBboxSize = 0.25; 156 } 157 if (squareDegrees > maxBboxSize) { 158 sizeCheck.setText(tr("Download area too large; will probably be rejected by server")); 159 sizeCheck.setForeground(Color.red); 160 } else { 161 sizeCheck.setText(tr("Download area ok, size probably acceptable to server")); 162 sizeCheck.setForeground(Color.darkGray); 163 } 140 164 } 141 165 … … 151 175 if (s != eventSource) s.boundingBoxChanged(this); 152 176 } 177 updateSizeCheck(); 153 178 } 154 179
Note:
See TracChangeset
for help on using the changeset viewer.