Changeset 2327 in josm for trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java
- Timestamp:
- 27.10.2009 01:21:32 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.
