- Timestamp:
- 2020-08-23T21:02:52+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r16913 r16920 69 69 private static final StringProperty PROP_MAPSTYLE = new StringProperty("slippy_map_chooser.mapstyle", "Mapnik"); 70 70 private static final BooleanProperty PROP_SHOWDLAREA = new BooleanProperty("slippy_map_chooser.show_downloaded_area", true); 71 71 72 /** 72 73 * The property name used for the resize button. … … 74 75 */ 75 76 public static final String RESIZE_PROP = SlippyMapBBoxChooser.class.getName() + ".resize"; 77 78 /** 79 * The property name used for the {@link org.openstreetmap.josm.data.coor.ILatLon} of the mouse cursor on the map. 80 * @see #addPropertyChangeListener(java.beans.PropertyChangeListener) 81 */ 82 public static final String CURSOR_COORDINATE_PROP = SlippyMapBBoxChooser.class.getName() + ".coordinate"; 76 83 77 84 private final SizeButton iSizeButton; … … 236 243 PROP_SHOWDLAREA.put(this.showDownloadAreaButtonModel.isSelected()); 237 244 this.repaint(); 245 } 246 247 /** 248 * Handles a {@link SlippyMapControler#mouseMoved} event 249 * @param point The point in the view 250 */ 251 public void handleMouseMoved(Point point) { 252 final ICoordinate coordinate = getPosition(point); 253 final LatLon latLon = new LatLon(coordinate.getLat(), coordinate.getLon()); 254 firePropertyChange(CURSOR_COORDINATE_PROP, null, latLon); 238 255 } 239 256 -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapControler.java
r16913 r16920 162 162 @Override 163 163 public void mouseMoved(MouseEvent e) { 164 iSlippyMapChooser.handleMouseMoved(e.getPoint()); 164 165 iSlippyMapChooser.handleAttribution(e.getPoint(), false); 165 166 } -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r16918 r16920 6 6 7 7 import java.awt.BorderLayout; 8 import java.awt.Color; 8 9 import java.awt.Component; 9 10 import java.awt.Dimension; … … 24 25 25 26 import javax.swing.AbstractAction; 27 import javax.swing.BorderFactory; 26 28 import javax.swing.Box; 27 29 import javax.swing.Icon; … … 40 42 import org.openstreetmap.josm.actions.ExpertToggleAction; 41 43 import org.openstreetmap.josm.data.Bounds; 44 import org.openstreetmap.josm.data.coor.ILatLon; 45 import org.openstreetmap.josm.data.coor.LatLon; 46 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 47 import org.openstreetmap.josm.data.coor.conversion.DMSCoordinateFormat; 48 import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat; 42 49 import org.openstreetmap.josm.data.preferences.BooleanProperty; 43 50 import org.openstreetmap.josm.data.preferences.IntegerProperty; … … 52 59 import org.openstreetmap.josm.gui.util.GuiHelper; 53 60 import org.openstreetmap.josm.gui.util.WindowGeometry; 61 import org.openstreetmap.josm.gui.widgets.ImageLabel; 54 62 import org.openstreetmap.josm.io.NetworkManager; 55 63 import org.openstreetmap.josm.io.OnlineResource; … … 101 109 protected final DownloadSourceTabs downloadSourcesTab = new DownloadSourceTabs(); 102 110 111 private final ImageLabel latText; 112 private final ImageLabel lonText; 113 private final ImageLabel bboxText; 114 { 115 final LatLon sample = new LatLon(90, 180); 116 final ICoordinateFormat sampleFormat = DMSCoordinateFormat.INSTANCE; 117 final Color background = new JPanel().getBackground(); 118 latText = new ImageLabel("lat", null, sampleFormat.latToString(sample).length(), background); 119 lonText = new ImageLabel("lon", null, sampleFormat.lonToString(sample).length(), background); 120 bboxText = new ImageLabel("name", null, sampleFormat.toString(sample, "").length() * 2, background); 121 } 122 103 123 protected JCheckBox cbStartup; 104 124 protected JCheckBox cbZoomToDownloadedData; … … 158 178 159 179 mainPanel.add(dialogSplit, GBC.eol().fill()); 180 181 JPanel statusBarPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); 182 statusBarPanel.setBorder(BorderFactory.createLineBorder(Color.GRAY)); 183 statusBarPanel.add(latText); 184 statusBarPanel.add(lonText); 185 statusBarPanel.add(bboxText); 186 mainPanel.add(statusBarPanel, GBC.eol().fill(GBC.HORIZONTAL)); 187 ExpertToggleAction.addVisibilitySwitcher(statusBarPanel); 160 188 161 189 cbStartup = new JCheckBox(tr("Open this dialog on startup")); … … 283 311 ds.boundingBoxChanged(b); 284 312 } 313 314 bboxText.setText(b == null ? "" : String.join(" ", 315 CoordinateFormatManager.getDefaultFormat().toString(b.getMin(), " "), 316 CoordinateFormatManager.getDefaultFormat().toString(b.getMax(), " "))); 317 } 318 319 /** 320 * Updates the coordinates after moving the mouse cursor 321 * @param latLon the coordinates under the mouse cursor 322 */ 323 public void mapCursorChanged(ILatLon latLon) { 324 latText.setText(CoordinateFormatManager.getDefaultFormat().latToString(latLon)); 325 lonText.setText(CoordinateFormatManager.getDefaultFormat().lonToString(latLon)); 285 326 } 286 327 -
trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java
r16892 r16920 11 11 12 12 import org.openstreetmap.josm.data.Bounds; 13 import org.openstreetmap.josm.data.coor.ILatLon; 13 14 import org.openstreetmap.josm.gui.bbox.BBoxChooser; 14 15 import org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser; … … 73 74 // resize and center the DownloadDialog 74 75 iGui.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h); 76 } else if (evt.getPropertyName().equals(SlippyMapBBoxChooser.CURSOR_COORDINATE_PROP)) { 77 iGui.mapCursorChanged((ILatLon) evt.getNewValue()); 75 78 } 76 79 }
Note:
See TracChangeset
for help on using the changeset viewer.