Changeset 13327 in osm for applications/editors/josm/plugins/slippy_map_chooser/src/SourceButton.java
- Timestamp:
- 2009-01-23T19:26:39+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.