Changeset 2327 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2009-10-27T01:21:32+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 10 edited
-
MapView.java (modified) (4 diffs)
-
NavigatableComponent.java (modified) (6 diffs)
-
download/BookmarkSelection.java (modified) (4 diffs)
-
download/BoundingBoxSelection.java (modified) (6 diffs)
-
download/DownloadDialog.java (modified) (9 diffs)
-
download/PlaceSelection.java (modified) (3 diffs)
-
download/SlippyMapChooser.java (modified) (5 diffs)
-
download/TileSelection.java (modified) (4 diffs)
-
layer/OsmDataLayer.java (modified) (1 diff)
-
preferences/ProjectionPreference.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapView.java
r2192 r2327 369 369 tempG.setColor(Color.WHITE); 370 370 Bounds b = getProjection().getWorldBoundsLatLon(); 371 double lat = b. min.lat();372 double lon = b. min.lon();373 374 Point p = getPoint(b. min);371 double lat = b.getMin().lat(); 372 double lon = b.getMin().lon(); 373 374 Point p = getPoint(b.getMin()); 375 375 376 376 GeneralPath path = new GeneralPath(); 377 377 378 378 path.moveTo(p.x, p.y); 379 double max = b. max.lat();379 double max = b.getMax().lat(); 380 380 for(; lat <= max; lat += 1.0) 381 381 { … … 383 383 path.lineTo(p.x, p.y); 384 384 } 385 lat = max; max = b. max.lon();385 lat = max; max = b.getMax().lon(); 386 386 for(; lon <= max; lon += 1.0) 387 387 { … … 389 389 path.lineTo(p.x, p.y); 390 390 } 391 lon = max; max = b. min.lat();391 lon = max; max = b.getMin().lat(); 392 392 for(; lat >= max; lat -= 1.0) 393 393 { … … 395 395 path.lineTo(p.x, p.y); 396 396 } 397 lat = max; max = b. min.lon();397 lat = max; max = b.getMin().lon(); 398 398 for(; lon >= max; lon -= 1.0) 399 399 { -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r2273 r2327 60 60 private EastNorth calculateDefaultCenter() { 61 61 Bounds b = Main.proj.getWorldBoundsLatLon(); 62 double lat = (b. max.lat() + b.min.lat())/2;63 double lon = (b. max.lon() + b.min.lon())/2;62 double lat = (b.getMax().lat() + b.getMin().lat())/2; 63 double lon = (b.getMax().lon() + b.getMin().lon())/2; 64 64 65 65 return Main.proj.latlon2eastNorth(new LatLon(lat, lon)); … … 128 128 public ProjectionBounds getMaxProjectionBounds() { 129 129 Bounds b = getProjection().getWorldBoundsLatLon(); 130 return new ProjectionBounds(getProjection().latlon2eastNorth(b. min),131 getProjection().latlon2eastNorth(b. max));130 return new ProjectionBounds(getProjection().latlon2eastNorth(b.getMin()), 131 getProjection().latlon2eastNorth(b.getMax())); 132 132 } 133 133 … … 193 193 double lat = cl.lat(); 194 194 double lon = cl.lon(); 195 if(lat < b. min.lat()) {changed = true; lat = b.min.lat(); }196 else if(lat > b. max.lat()) {changed = true; lat = b.max.lat(); }197 if(lon < b. min.lon()) {changed = true; lon = b.min.lon(); }198 else if(lon > b. max.lon()) {changed = true; lon = b.max.lon(); }195 if(lat < b.getMin().lat()) {changed = true; lat = b.getMin().lat(); } 196 else if(lat > b.getMax().lat()) {changed = true; lat = b.getMax().lat(); } 197 if(lon < b.getMin().lon()) {changed = true; lon = b.getMin().lon(); } 198 else if(lon > b.getMax().lon()) {changed = true; lon = b.getMax().lon(); } 199 199 if(changed) { 200 200 newCenter = new CachedLatLon(lat, lon).getEastNorth(); … … 209 209 int width = getWidth()/2; 210 210 int height = getHeight()/2; 211 LatLon l1 = new LatLon(b. min.lat(), lon);212 LatLon l2 = new LatLon(b. max.lat(), lon);211 LatLon l1 = new LatLon(b.getMin().lat(), lon); 212 LatLon l2 = new LatLon(b.getMax().lat(), lon); 213 213 EastNorth e1 = getProjection().latlon2eastNorth(l1); 214 214 EastNorth e2 = getProjection().latlon2eastNorth(l2); … … 217 217 { 218 218 double newScaleH = d/height; 219 e1 = getProjection().latlon2eastNorth(new LatLon(lat, b. min.lon()));220 e2 = getProjection().latlon2eastNorth(new LatLon(lat, b. max.lon()));219 e1 = getProjection().latlon2eastNorth(new LatLon(lat, b.getMin().lon())); 220 e2 = getProjection().latlon2eastNorth(new LatLon(lat, b.getMax().lon())); 221 221 d = e2.east() - e1.east(); 222 222 if(d < width*newScale) { … … 292 292 293 293 public void zoomTo(Bounds box) { 294 zoomTo(new ProjectionBounds(getProjection().latlon2eastNorth(box. min),295 getProjection().latlon2eastNorth(box. max)));294 zoomTo(new ProjectionBounds(getProjection().latlon2eastNorth(box.getMin()), 295 getProjection().latlon2eastNorth(box.getMax()))); 296 296 } 297 297 -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
r2142 r2327 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.ActionListener; 10 import java.awt.event.MouseAdapter;11 import java.awt.event.MouseEvent;12 import java.awt.event.MouseListener;13 10 14 11 import javax.swing.DefaultListModel; … … 42 39 43 40 JPanel dlg = new JPanel(new GridBagLayout()); 44 gui. tabpane.addTab(tr("Bookmarks"), dlg);41 gui.addDownloadAreaSelector(dlg, tr("Bookmarks")); 45 42 46 43 bookmarks = new BookmarkList(); … … 49 46 Preferences.Bookmark b = (Preferences.Bookmark)bookmarks.getSelectedValue(); 50 47 if (b != null) { 51 gui.minlat = b.latlon[0]; 52 gui.minlon = b.latlon[1]; 53 gui.maxlat = b.latlon[2]; 54 gui.maxlon = b.latlon[3]; 55 gui.boundingBoxChanged(BookmarkSelection.this); 48 gui.boundingBoxChanged(b.asBounds(),BookmarkSelection.this); 56 49 } 57 50 } … … 108 101 109 102 public void boundingBoxChanged(DownloadDialog gui) { 110 tempBookmark = new Preferences.Bookmark(); 111 tempBookmark.latlon[0] = gui.minlat; 112 tempBookmark.latlon[1] = gui.minlon; 113 tempBookmark.latlon[2] = gui.maxlat; 114 tempBookmark.latlon[3] = gui.maxlon; 103 tempBookmark = new Preferences.Bookmark(gui.getSelectedDownloadArea()); 115 104 bookmarks.clearSelection(); 116 105 } -
trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
r2142 r2327 9 9 import java.awt.event.FocusEvent; 10 10 import java.awt.event.FocusListener; 11 import java.awt.event.KeyEvent;12 import java.awt.event.KeyListener;13 11 14 12 import javax.swing.JLabel; … … 56 54 double maxlat = Double.parseDouble(latlon[2].getText()); 57 55 double maxlon = Double.parseDouble(latlon[3].getText()); 58 if(minlat!= gui.minlat || minlon != gui.minlon ||maxlat!= gui.maxlat || maxlon != gui.maxlon){59 gui.minlat = minlat; gui.minlon = minlon;60 gui.maxlat =maxlat; gui.maxlon = maxlon;61 gui.boundingBoxChanged(BoundingBoxSelection.this); 56 Bounds b = new Bounds(minlat,minlon, maxlat,maxlon); 57 if (gui.getSelectedDownloadArea() == null) return; 58 if (gui.getSelectedDownloadArea() == null || !gui.getSelectedDownloadArea().equals(new Bounds(minlat,minlon, maxlat,maxlon))) { 59 gui.boundingBoxChanged(b, BoundingBoxSelection.this); 62 60 } 63 61 } catch (NumberFormatException x) { … … 119 117 }); 120 118 121 gui. tabpane.addTab(tr("Bounding Box"), dlg);119 gui.addDownloadAreaSelector(dlg, tr("Bounding Box")); 122 120 } 123 121 … … 132 130 private boolean parseURL(DownloadDialog gui) { 133 131 Bounds b = OsmUrlToBounds.parse(osmUrl.getText()); 134 if(b == null) return false; 135 gui.minlon = b.min.lon(); 136 gui.minlat = b.min.lat(); 137 gui.maxlon = b.max.lon(); 138 gui.maxlat = b.max.lat(); 139 gui.boundingBoxChanged(BoundingBoxSelection.this); 132 if(b == null) return false; 133 gui.boundingBoxChanged(b,BoundingBoxSelection.this); 140 134 updateBboxFields(gui); 141 135 updateUrl(gui); … … 144 138 145 139 private void updateBboxFields(DownloadDialog gui) { 146 latlon[0].setText(Double.toString(gui.minlat)); 147 latlon[1].setText(Double.toString(gui.minlon)); 148 latlon[2].setText(Double.toString(gui.maxlat)); 149 latlon[3].setText(Double.toString(gui.maxlon)); 140 Bounds b = gui.getSelectedDownloadArea(); 141 if (b == null) return; 142 latlon[0].setText(Double.toString(b.getMin().lat())); 143 latlon[1].setText(Double.toString(b.getMin().lon())); 144 latlon[2].setText(Double.toString(b.getMax().lat())); 145 latlon[3].setText(Double.toString(b.getMax().lon())); 150 146 for (JTextField f : latlon) { 151 147 f.setCaretPosition(0); … … 154 150 155 151 private void updateUrl(DownloadDialog gui) { 156 showUrl.setText(OsmUrlToBounds.getURL(new Bounds(157 new LatLon(gui.minlat, gui.minlon), new LatLon(gui.maxlat, gui.maxlon))));152 if (gui.getSelectedDownloadArea() == null) return; 153 showUrl.setText(OsmUrlToBounds.getURL(gui.getSelectedDownloadArea())); 158 154 } 159 155 } -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r2322 r2327 15 15 import java.util.ArrayList; 16 16 import java.util.List; 17 import java.util.logging.Logger; 17 18 18 19 import javax.swing.AbstractAction; … … 24 25 25 26 import org.openstreetmap.josm.Main; 26 import org.openstreetmap.josm.actions.DownloadAction;27 import org.openstreetmap.josm.actions.downloadtasks.DownloadGpsTask;28 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask;29 import org.openstreetmap.josm.actions.downloadtasks.DownloadTask;30 27 import org.openstreetmap.josm.data.Bounds; 31 28 import org.openstreetmap.josm.gui.MapView; 32 import org.openstreetmap.josm.gui.progress.ProgressMonitor;33 29 import org.openstreetmap.josm.plugins.PluginHandler; 34 30 import org.openstreetmap.josm.tools.GBC; … … 46 42 */ 47 43 public class DownloadDialog extends JPanel { 48 49 /** 50 * The list of download tasks. First entry should be the osm data entry 51 * and the second the gps entry. After that, plugins can register additional 52 * download possibilities. 53 */ 54 public final List<DownloadTask> downloadTasks = new ArrayList<DownloadTask>(5); 55 56 public final List<DownloadSelection> downloadSelections = new ArrayList<DownloadSelection>(); 57 public final JTabbedPane tabpane = new JTabbedPane(); 58 public final JCheckBox newLayer; 59 public final JLabel sizeCheck = new JLabel(); 60 61 public double minlon; 62 public double minlat; 63 public double maxlon; 64 public double maxlat; 44 static private final Logger logger = Logger.getLogger(DownloadDialog.class.getName()); 45 46 private final List<DownloadSelection> downloadSelections = new ArrayList<DownloadSelection>(); 47 private final JTabbedPane tpDownloadAreaSelectors = new JTabbedPane(); 48 private final JCheckBox cbNewLayer; 49 private final JLabel sizeCheck = new JLabel(); 50 51 private Bounds currentBounds = null; 52 53 private JCheckBox cbDownloadOsmData = new JCheckBox(tr("OpenStreetMap data"), true); 54 private JCheckBox cbDownloadGpxData = new JCheckBox(tr("Raw GPS data")); 65 55 66 56 … … 68 58 setLayout(new GridBagLayout()); 69 59 70 downloadTasks.add(new DownloadOsmTask());71 downloadTasks.add(new DownloadGpsTask());72 73 60 // adding the download tasks 74 61 add(new JLabel(tr("Data Sources and Types")), GBC.eol().insets(0,5,0,0)); 75 for (DownloadTask task : downloadTasks) { 76 add(task.getCheckBox(), GBC.eol().insets(20,0,0,0)); 77 // don't override defaults, if we (initially) don't have any preferences 78 if(Main.pref.hasKey("download."+task.getPreferencesSuffix())) { 79 task.getCheckBox().setSelected(Main.pref.getBoolean("download."+task.getPreferencesSuffix())); 80 } 81 } 82 62 add(cbDownloadOsmData, GBC.eol().insets(20,0,0,0)); 63 add(cbDownloadGpxData, GBC.eol().insets(20,0,0,0)); 64 83 65 // predefined download selections 84 66 downloadSelections.add(new SlippyMapChooser()); … … 97 79 s.addGui(this); 98 80 } 99 100 if (Main.map != null) { 101 MapView mv = Main.map.mapView; 102 minlon = mv.getLatLon(0, mv.getHeight()).lon(); 103 minlat = mv.getLatLon(0, mv.getHeight()).lat(); 104 maxlon = mv.getLatLon(mv.getWidth(), 0).lon(); 105 maxlat = mv.getLatLon(mv.getWidth(), 0).lat(); 106 boundingBoxChanged(null); 107 } 108 else if (Main.pref.hasKey("osm-download.bounds")) { 109 // read the bounding box from the preferences 110 try { 111 String bounds[] = Main.pref.get("osm-download.bounds").split(";"); 112 minlat = Double.parseDouble(bounds[0]); 113 minlon = Double.parseDouble(bounds[1]); 114 maxlat = Double.parseDouble(bounds[2]); 115 maxlon = Double.parseDouble(bounds[3]); 116 boundingBoxChanged(null); 117 } 118 catch (Exception e) { 119 e.printStackTrace(); 120 } 121 } 122 123 newLayer = new JCheckBox(tr("Download as new layer"), Main.pref.getBoolean("download.newlayer", false)); 124 add(newLayer, GBC.eol().insets(0,5,0,0)); 81 82 cbNewLayer = new JCheckBox(tr("Download as new layer")); 83 add(cbNewLayer, GBC.eol().insets(0,5,0,0)); 125 84 126 85 add(new JLabel(tr("Download Area")), GBC.eol().insets(0,5,0,0)); 127 add(t abpane, GBC.eol().fill());86 add(tpDownloadAreaSelectors, GBC.eol().fill()); 128 87 129 88 try { 130 t abpane.setSelectedIndex(Main.pref.getInteger("download.tab", 0));89 tpDownloadAreaSelectors.setSelectedIndex(Main.pref.getInteger("download.tab", 0)); 131 90 } catch (Exception ex) { 132 91 Main.pref.putInteger("download.tab", 0); … … 145 104 } 146 105 }); 106 107 restoreSettings(); 147 108 } 148 109 … … 163 124 Bounds b = OsmUrlToBounds.parse(result); 164 125 if (b != null) { 165 minlon = b.min.lon(); 166 minlat = b.min.lat(); 167 maxlon = b.max.lon(); 168 maxlat = b.max.lat(); 169 boundingBoxChanged(null); 126 boundingBoxChanged(new Bounds(b),null); 170 127 } 171 128 } 172 129 173 130 private void updateSizeCheck() { 174 if ((maxlon-minlon)*(maxlat-minlat) > Main.pref.getDouble("osm-server.max-request-area", 0.25)) { 131 if (currentBounds == null) { 132 sizeCheck.setText(tr("No area selected yet")); 133 sizeCheck.setForeground(Color.darkGray); 134 } else if (currentBounds.getArea() > Main.pref.getDouble("osm-server.max-request-area", 0.25)) { 175 135 sizeCheck.setText(tr("Download area too large; will probably be rejected by server")); 176 136 sizeCheck.setForeground(Color.red); … … 188 148 * @param eventSource - the DownloadSelection object that fired this notification. 189 149 */ 190 public void boundingBoxChanged(DownloadSelection eventSource) { 150 public void boundingBoxChanged(Bounds b, DownloadSelection eventSource) { 151 this.currentBounds = b; 191 152 for (DownloadSelection s : downloadSelections) { 192 153 if (s != eventSource) { … … 196 157 updateSizeCheck(); 197 158 } 198 199 /* 200 * Returns currently selected tab. 201 */ 202 public int getSelectedTab() { 203 return tabpane.getSelectedIndex(); 204 } 159 160 /** 161 * Replies true if the user selected to download OSM data 162 * 163 * @return true if the user selected to download OSM data 164 */ 165 public boolean isDownloadOsmData() { 166 return cbDownloadOsmData.isSelected(); 167 } 168 169 /** 170 * Replies true if the user selected to download GPX data 171 * 172 * @return true if the user selected to download GPX data 173 */ 174 public boolean isDownloadGpxData() { 175 return cbDownloadGpxData.isSelected(); 176 } 177 178 /** 179 * Replies true if the user requires to download into a new layer 180 * 181 * @return true if the user requires to download into a new layer 182 */ 183 public boolean isNewLayerRequired() { 184 return cbNewLayer.isSelected(); 185 } 186 187 /** 188 * Adds a new download area selector to the download dialog 189 * 190 * @param selector the download are selector 191 * @param displayName the display name of the selector 192 */ 193 public void addDownloadAreaSelector(JPanel selector, String displayName) { 194 tpDownloadAreaSelectors.add(displayName, selector); 195 } 196 197 /** 198 * Remembers the current settings in the download dialog 199 * 200 */ 201 public void rememberSettings() { 202 Main.pref.put("download.tab", Integer.toString(tpDownloadAreaSelectors.getSelectedIndex())); 203 Main.pref.put("download.osm", cbDownloadOsmData.isSelected()); 204 Main.pref.put("download.gps", cbDownloadGpxData.isSelected()); 205 Main.pref.put("download.newlayer", cbNewLayer.isSelected()); 206 if (currentBounds != null) { 207 Main.pref.put("osm-download.bounds", currentBounds.encodeAsString(";")); 208 } 209 } 210 211 public void restoreSettings() { 212 cbDownloadOsmData.setSelected(Main.pref.getBoolean("download.osm", true)); 213 cbDownloadGpxData.setSelected(Main.pref.getBoolean("download.gps", false)); 214 cbNewLayer.setSelected(Main.pref.getBoolean("download.newlayer", false)); 215 int idx = Main.pref.getInteger("download.tab", 0); 216 if (idx < 0 || idx > tpDownloadAreaSelectors.getTabCount()) { 217 idx = 0; 218 } 219 tpDownloadAreaSelectors.setSelectedIndex(idx); 220 221 if (Main.map != null) { 222 MapView mv = Main.map.mapView; 223 currentBounds = new Bounds( 224 mv.getLatLon(0, mv.getHeight()), 225 mv.getLatLon(mv.getWidth(), 0) 226 ); 227 boundingBoxChanged(currentBounds,null); 228 } 229 else if (Main.pref.hasKey("osm-download.bounds")) { 230 // read the bounding box from the preferences 231 try { 232 currentBounds = new Bounds(Main.pref.get("osm-download.bounds"), ";"); 233 boundingBoxChanged(currentBounds,null); 234 } 235 catch (Exception e) { 236 e.printStackTrace(); 237 } 238 } 239 } 240 241 /** 242 * Replies the currently selected download area. May be null, if no download area is selected 243 * yet. 244 */ 245 public Bounds getSelectedDownloadArea() { 246 return currentBounds; 247 } 248 205 249 } -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r2017 r2327 32 32 33 33 import org.openstreetmap.josm.Main; 34 import org.openstreetmap.josm.data.Bounds; 35 import org.openstreetmap.josm.data.coor.LatLon; 34 36 import org.openstreetmap.josm.tools.GBC; 35 37 import org.xml.sax.Attributes; … … 224 226 scrollPane.setPreferredSize(new Dimension(200,200)); 225 227 panel.add(scrollPane, c); 226 gui. tabpane.add(panel, tr("Places"));228 gui.addDownloadAreaSelector(panel, tr("Places")); 227 229 228 230 scrollPane.setPreferredSize(scrollPane.getPreferredSize()); … … 298 300 { 299 301 double size = 180.0 / Math.pow(2, r.zoom); 300 gui.minlat = r.lat - size / 2; 301 gui.maxlat = r.lat + size / 2; 302 gui.minlon = r.lon - size; 303 gui.maxlon = r.lon + size; 302 Bounds b = new Bounds( 303 new LatLon( 304 r.lat - size / 2, 305 r.lat + size / 2 306 ), 307 new LatLon( 308 r.lon - size, 309 r.lon + size 310 ) 311 ); 304 312 updatingSelf = true; 305 gui.boundingBoxChanged(null); 313 gui.boundingBoxChanged(b,null); 306 314 updatingSelf = false; 307 315 } -
trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java
r2093 r2327 30 30 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 31 31 import org.openstreetmap.josm.Main; 32 import org.openstreetmap.josm.data.Bounds; 33 import org.openstreetmap.josm.data.coor.LatLon; 32 34 33 35 /** … … 120 122 String labelText = tr("<b>Zoom:</b> Mousewheel, double click or Ctrl + Up/Down " 121 123 + "<b>Move map:</b> Hold right mousebutton and move mouse or use cursor keys. <b>Select:</b> Hold left mousebutton and draw a frame."); 122 slipyyMapTabPanel.add(new JLabel("<html>" + labelText + "</html>"), BorderLayout.SOUTH); 123 iGui. tabpane.add(slipyyMapTabPanel, tr("Slippy map"));124 slipyyMapTabPanel.add(new JLabel("<html>" + labelText + "</html>"), BorderLayout.SOUTH); 125 iGui.addDownloadAreaSelector(slipyyMapTabPanel, tr("Slippy map")); 124 126 new OsmMapControl(this, slipyyMapTabPanel, iSizeButton, iSourceButton); 125 127 } … … 165 167 166 168 public void boundingBoxChanged(DownloadDialog gui) { 167 169 Bounds b = gui.getSelectedDownloadArea(); 170 if (b == null) 171 return; 172 168 173 // test if a bounding box has been set set 169 if ( gui.minlat== 0.0 &&gui.minlon== 0.0 &&gui.maxlat== 0.0 &&gui.maxlon== 0.0)174 if (b.getMin().lat() == 0.0 && b.getMin().lon() == 0.0 && b.getMax().lat() == 0.0 && b.getMax().lon() == 0.0) 170 175 return; 171 176 172 int y1 = OsmMercator.LatToY( gui.minlat, MAX_ZOOM);173 int y2 = OsmMercator.LatToY( gui.maxlat, MAX_ZOOM);174 int x1 = OsmMercator.LonToX( gui.minlon, MAX_ZOOM);175 int x2 = OsmMercator.LonToX( gui.maxlon, MAX_ZOOM);177 int y1 = OsmMercator.LatToY(b.getMin().lat(), MAX_ZOOM); 178 int y2 = OsmMercator.LatToY(b.getMax().lat(), MAX_ZOOM); 179 int x1 = OsmMercator.LonToX(b.getMin().lon(), MAX_ZOOM); 180 int x2 = OsmMercator.LonToX(b.getMax().lon(), MAX_ZOOM); 176 181 177 182 iSelectionRectStart = new Point(Math.min(x1, x2), Math.min(y1, y2)); … … 179 184 180 185 // calc the screen coordinates for the new selection rectangle 181 MapMarkerDot xmin_ymin = new MapMarkerDot( gui.minlat, gui.minlon);182 MapMarkerDot xmax_ymax = new MapMarkerDot( gui.maxlat, gui.maxlon);186 MapMarkerDot xmin_ymin = new MapMarkerDot(b.getMin()); 187 MapMarkerDot xmax_ymax = new MapMarkerDot(b.getMax()); 183 188 184 189 Vector<MapMarker> marker = new Vector<MapMarker>(2); … … 218 223 Coordinate l1 = getPosition(p_max); 219 224 Coordinate l2 = getPosition(p_min); 220 iGui.minlon = Math.min(l2.getLon(), l1.getLon()); 221 iGui.minlat = Math.min(l1.getLat(), l2.getLat()); 222 iGui.maxlon = Math.max(l2.getLon(), l1.getLon()); 223 iGui.maxlat = Math.max(l1.getLat(), l2.getLat()); 224 225 iGui.boundingBoxChanged(this); 225 Bounds b = new Bounds( 226 new LatLon( 227 Math.min(l2.getLat(), l1.getLat()), 228 Math.min(l1.getLon(), l2.getLon()) 229 ), 230 new LatLon( 231 Math.max(l2.getLat(), l1.getLat()), 232 Math.max(l1.getLon(), l2.getLon())) 233 ); 234 iGui.boundingBoxChanged(b, this); 226 235 repaint(); 227 236 } -
trunk/src/org/openstreetmap/josm/gui/download/TileSelection.java
r1169 r2327 16 16 import javax.swing.SpinnerNumberModel; 17 17 18 import org.openstreetmap.josm.data.Bounds; 19 import org.openstreetmap.josm.data.coor.LatLon; 18 20 import org.openstreetmap.josm.tools.GBC; 19 21 /** … … 65 67 if (toy<fromy) { int i = fromy; fromy=toy; toy=i; } 66 68 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); 72 74 //repaint(); 73 75 } catch (NumberFormatException x) { … … 82 84 } 83 85 84 gui. tabpane.addTab(tr("Tile Numbers"), smpanel);86 gui.addDownloadAreaSelector(smpanel, tr("Tile Numbers")); 85 87 } 86 88 … … 94 96 private void updateBboxFields(DownloadDialog gui) { 95 97 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()))); 100 105 } 101 106 -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r2325 r2327 226 226 // now succesively subtract downloaded areas 227 227 for (DataSource src : data.dataSources) { 228 if (src.bounds != null && !src.bounds. min.equals(src.bounds.max)) {229 EastNorth en1 = mv.getProjection().latlon2eastNorth(src.bounds. min);230 EastNorth en2 = mv.getProjection().latlon2eastNorth(src.bounds. max);228 if (src.bounds != null && !src.bounds.getMin().equals(src.bounds.getMax())) { 229 EastNorth en1 = mv.getProjection().latlon2eastNorth(src.bounds.getMin()); 230 EastNorth en2 = mv.getProjection().latlon2eastNorth(src.bounds.getMax()); 231 231 Point p1 = mv.getPoint(en1); 232 232 Point p2 = mv.getPoint(en2); -
trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java
r2272 r2327 97 97 Bounds b = Main.proj.getWorldBoundsLatLon(); 98 98 CoordinateFormat cf = CoordinateFormat.getDefaultFormat(); 99 bounds.setText(b. min.latToString(cf)+"; "+b.min.lonToString(cf)+" : "+b.max.latToString(cf)+"; "+b.max.lonToString(cf));99 bounds.setText(b.getMin().latToString(cf)+"; "+b.getMin().lonToString(cf)+" : "+b.getMax().latToString(cf)+"; "+b.getMax().lonToString(cf)); 100 100 /* TODO: Fix bugs, refresh code line and world bounds, fix design (e.g. add border around sub-prefs-stuff */ 101 101 }
Note:
See TracChangeset
for help on using the changeset viewer.
