Changeset 9623 in osm for applications/editors/josm
- Timestamp:
- 2008-08-10T20:09:05+02:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/slippy_map_chooser
- Files:
-
- 5 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/slippy_map_chooser/src/OsmMapControl.java
r9585 r9623 31 31 32 32 private SizeButton iSizeButton = null; 33 private SourceButton iSourceButton = null; 33 34 34 35 /** 35 36 * Create a new OsmMapControl 36 37 */ 37 public OsmMapControl(SlippyMapChooser navComp, JPanel contentPane, SizeButton sizeButton ) {38 public OsmMapControl(SlippyMapChooser navComp, JPanel contentPane, SizeButton sizeButton, SourceButton sourceButton) { 38 39 this.iSlippyMapChooser = navComp; 39 40 iSlippyMapChooser.addMouseListener(this); … … 53 54 } 54 55 iSizeButton = sizeButton; 56 iSourceButton = sourceButton; 55 57 } 56 58 … … 86 88 public void mouseReleased(MouseEvent e) { 87 89 if (e.getButton() == MouseEvent.BUTTON1) { 90 91 int sourceButton = iSourceButton.hit(e.getPoint()); 92 88 93 if (iSizeButton.hit(e.getPoint())) { 89 94 iSizeButton.toggle(); 90 95 iSlippyMapChooser.resizeSlippyMap(); 91 } else { 96 } 97 else if(sourceButton == SourceButton.HIDE_OR_SHOW) { 98 iSourceButton.toggle(); 99 iSlippyMapChooser.repaint(); 100 101 }else if(sourceButton == SourceButton.MAPNIK || sourceButton == SourceButton.OSMARENDER) { 102 iSlippyMapChooser.toggleMapSource(sourceButton); 103 } 104 else { 92 105 if (e.getClickCount() == 1) { 93 106 iSlippyMapChooser.setSelection(iStartSelectionPoint, e.getPoint()); … … 98 111 } 99 112 } 113 100 114 } 101 115 } -
applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooser.java
r9537 r9623 19 19 import org.openstreetmap.gui.jmapviewer.JMapViewer; 20 20 import org.openstreetmap.gui.jmapviewer.MapMarkerDot; 21 import org.openstreetmap.gui.jmapviewer.MemoryTileCache; 21 22 import org.openstreetmap.gui.jmapviewer.OsmMercator; 23 import org.openstreetmap.gui.jmapviewer.OsmTileLoader; 22 24 import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker; 23 25 import org.openstreetmap.josm.gui.download.DownloadDialog; … … 40 42 41 43 private SizeButton iSizeButton = new SizeButton(); 44 private SourceButton iSourceButton = new SourceButton(); 42 45 43 46 // standard dimension … … 66 69 iGui.tabpane.add(temp, tr("Slippy map")); 67 70 68 new OsmMapControl(this, temp, iSizeButton );71 new OsmMapControl(this, temp, iSizeButton, iSourceButton); 69 72 boundingBoxChanged(gui); 70 73 } … … 103 106 104 107 iSizeButton.paint(g); 108 iSourceButton.paint(g); 105 109 } catch (Exception e) { 106 110 e.printStackTrace(); … … 199 203 int h = iScreenSize.height * 90 / 100; 200 204 co.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h); 205 201 206 } 202 207 // shrink … … 207 212 int h = iDownloadDialogDimension.height; 208 213 co.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h); 209 } 214 215 } 216 210 217 repaint(); 211 218 } 219 220 public void toggleMapSource(int mapSource){ 221 this.tileCache = new MemoryTileCache(); 222 if(mapSource == SourceButton.MAPNIK){ 223 this.tileLoader = new OsmTileLoader(this,OsmTileLoader.MAP_MAPNIK); 224 }else{ 225 this.tileLoader = new OsmTileLoader(this,OsmTileLoader.MAP_OSMA); 226 } 227 repaint(); 228 } 212 229 213 230 }
Note:
See TracChangeset
for help on using the changeset viewer.