Changeset 10310 in osm
- Timestamp:
- 2008-08-29T15:28:56+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooser.java
r9851 r10310 11 11 import java.awt.Point; 12 12 import java.awt.Toolkit; 13 import java.awt.event.ComponentEvent; 14 import java.awt.event.ComponentListener; 13 15 import java.awt.geom.Point2D; 14 16 import java.util.Vector; … … 36 38 * 37 39 */ 38 public class SlippyMapChooser extends JMapViewer implements DownloadSelection {40 public class SlippyMapChooser extends JMapViewer implements DownloadSelection, ComponentListener { 39 41 40 42 private DownloadDialog iGui; … … 56 58 TileLoader cachedLoader; 57 59 TileLoader uncachedLoader; 60 JPanel slipyyMapTabPanel; 61 boolean firstShown = true; 58 62 59 63 /** … … 69 73 setFileCacheEnabled(SlippyMapChooserPlugin.ENABLE_FILE_CACHE); 70 74 setMaxTilesInmemory(SlippyMapChooserPlugin.MAX_TILES_IN_MEMORY); 75 addComponentListener(this); 71 76 } 72 77 … … 84 89 public void addGui(final DownloadDialog gui) { 85 90 iGui = gui; 86 JPanel temp= new JPanel();87 temp.setLayout(new BorderLayout());88 temp.add(this, BorderLayout.CENTER);89 temp.add(new JLabel((tr("Zoom: Mousewheel or double click. "91 slipyyMapTabPanel = new JPanel(); 92 slipyyMapTabPanel.setLayout(new BorderLayout()); 93 slipyyMapTabPanel.add(this, BorderLayout.CENTER); 94 slipyyMapTabPanel.add(new JLabel((tr("Zoom: Mousewheel or double click. " 90 95 + "Move map: Hold right mousebutton and move mouse. Select: Click."))), 91 96 BorderLayout.SOUTH); 92 iGui.tabpane.add(temp, tr("Slippy map")); 93 94 new OsmMapControl(this, temp, iSizeButton, iSourceButton); 95 boundingBoxChanged(gui); 97 iGui.tabpane.add(slipyyMapTabPanel, tr("Slippy map")); 98 iGui.tabpane.addComponentListener(this); 99 new OsmMapControl(this, slipyyMapTabPanel, iSizeButton, iSourceButton); 96 100 } 97 101 … … 250 254 } 251 255 256 public void componentHidden(ComponentEvent e) { 257 } 258 259 public void componentMoved(ComponentEvent e) { 260 } 261 262 public void componentShown(ComponentEvent e) { 263 } 264 265 public void componentResized(ComponentEvent e) { 266 if (!this.equals(e.getSource()) || getHeight() == 0 || getWidth() == 0) 267 return; 268 firstShown = false; 269 // The bounding box has to be set after SlippyMapChooser's size has been 270 // finally set - otherwise the zoom level will be totally wrong (too wide) 271 boundingBoxChanged(iGui); 272 } 273 252 274 }
Note:
See TracChangeset
for help on using the changeset viewer.