Changeset 13327 in osm for applications/editors/josm/plugins/slippy_map_chooser
- Timestamp:
- 2009-01-23T19:26:39+01:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/slippy_map_chooser
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/slippy_map_chooser/build.xml
r12780 r13327 6 6 <os family="windows"/> 7 7 </and> 8 </condition> 8 </condition> 9 9 <!-- compilation properties --> 10 10 <property name="josm.build.dir" value="../../core"/> -
applications/editors/josm/plugins/slippy_map_chooser/src/OsmMapControl.java
r12778 r13327 99 99 iSlippyMapChooser.repaint(); 100 100 101 }else if(sourceButton == SourceButton.MAPNIK || sourceButton == SourceButton.OSMARENDER ) {101 }else if(sourceButton == SourceButton.MAPNIK || sourceButton == SourceButton.OSMARENDER || sourceButton == SourceButton.CYCLEMAP) { 102 102 iSlippyMapChooser.toggleMapSource(sourceButton); 103 103 } -
applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooser.java
r13260 r13327 26 26 import org.openstreetmap.gui.jmapviewer.OsmTileLoader; 27 27 import org.openstreetmap.gui.jmapviewer.OsmTileSource; 28 import org.openstreetmap.gui.jmapviewer.OsmTileSource.CycleMap; 28 29 import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker; 29 30 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader; … … 56 57 private Dimension iScreenSize; 57 58 58 private TileSource[] sources = { new OsmTileSource.Mapnik(), new OsmTileSource.TilesAtHome() 59 private TileSource[] sources = { new OsmTileSource.Mapnik(), new OsmTileSource.TilesAtHome(),new OsmTileSource.CycleMap()}; 59 60 TileLoader cachedLoader; 60 61 TileLoader uncachedLoader; … … 78 79 String mapStyle = Main.pref.get("slippy_map_chooser.mapstyle", "mapnik"); 79 80 if(mapStyle.equals("osmarender")) { 80 iSourceButton.set IsMapStyleMapnik(false);81 iSourceButton.setMapStyle(SourceButton.OSMARENDER); 81 82 this.setTileSource(sources[1]); 83 }else if(mapStyle.equals("cyclemap")){ 84 iSourceButton.setMapStyle(SourceButton.CYCLEMAP); 85 this.setTileSource(sources[2]); 82 86 } 83 87 else { … … 261 265 this.setTileSource(sources[0]); 262 266 Main.pref.put("slippy_map_chooser.mapstyle", "mapnik"); 263 } else { 267 }else if (mapSource == SourceButton.CYCLEMAP) { 268 this.setTileSource(sources[2]); 269 Main.pref.put("slippy_map_chooser.mapstyle", "cyclemap"); 270 }else { 264 271 this.setTileSource(sources[1]); 265 272 Main.pref.put("slippy_map_chooser.mapstyle", "osmarender"); -
applications/editors/josm/plugins/slippy_map_chooser/src/SourceButton.java
r13260 r13327 15 15 private ImageIcon imageMapnik; 16 16 private ImageIcon imageOsmarender; 17 private ImageIcon imageCycleMap; 17 18 18 19 private boolean isEnlarged = false; 19 20 20 private boolean isMapnik = true;21 private int currentMap = MAPNIK; 21 22 22 23 public static final int HIDE_OR_SHOW = 1; 23 24 public static final int MAPNIK = 2; 24 25 public static final int OSMARENDER = 3; 26 public static final int CYCLEMAP = 4; 25 27 26 28 public SourceButton() { … … 29 31 imageMapnik = ImageProvider.get("", "blue_Mapnik.png"); 30 32 imageOsmarender = ImageProvider.get("", "blue_Osmarender.png"); 33 imageCycleMap = ImageProvider.get("","blue_CycleMap.png"); 31 34 } 32 35 … … 34 37 35 38 if (isEnlarged) { 36 if ( isMapnik) {39 if (currentMap == MAPNIK) { 37 40 g.drawImage(imageMapnik.getImage(), g.getClipBounds().width 38 41 - imageMapnik.getIconWidth(), y, null); 39 } else { 42 }else if(currentMap == CYCLEMAP){ 43 g.drawImage(imageCycleMap.getImage(), g.getClipBounds().width 44 - imageCycleMap.getIconWidth(), y, null); 45 } 46 else { 40 47 g.drawImage(imageOsmarender.getImage(), g.getClipBounds().width 41 48 - imageMapnik.getIconWidth(), y, null); … … 67 74 } 68 75 } else if (x - imageMapnik.getIconWidth() < point.x && point.x < x) { 69 if (y < point.y && point.y < y + imageMapnik.getIconHeight() / 2) {70 isMapnik = false;76 if (y < point.y && point.y < y + imageMapnik.getIconHeight() / 3) { 77 currentMap = OSMARENDER; 71 78 return OSMARENDER; 72 } else if (y + imageMapnik.getIconHeight() / 2 < point.y 79 } else if (y + imageMapnik.getIconHeight() / 3 < point.y 80 && point.y < y + imageMapnik.getIconHeight() *2/3) { 81 currentMap = MAPNIK; 82 return MAPNIK; 83 } else if (y + imageMapnik.getIconHeight()* 2/3 < point.y 73 84 && point.y < y + imageMapnik.getIconHeight()) { 74 isMapnik = true; 75 return MAPNIK; 85 currentMap = CYCLEMAP; 86 System.out.println("HIT Cycle"); 87 return CYCLEMAP; 76 88 } 77 89 } … … 87 99 } 88 100 89 public void setIsMapStyleMapnik (boolean style) { 90 isMapnik = style; 101 /** 102 * One of the constants OSMARENDER,MAPNIK or CYCLEMAP 103 */ 104 public void setMapStyle (int style) { 105 if(style < 2 || style > 4){ 106 currentMap = MAPNIK; 107 } 108 currentMap = style; 91 109 } 92 110 }
Note:
See TracChangeset
for help on using the changeset viewer.