Ignore:
Timestamp:
2009-01-23T19:26:39+01:00 (16 years ago)
Author:
tim
Message:

ADDED: CycleMap is now available in slippy_map_chooser

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/slippy_map_chooser/src/SourceButton.java

    r13260 r13327  
    1515    private ImageIcon imageMapnik;
    1616    private ImageIcon imageOsmarender;
     17    private ImageIcon imageCycleMap;
    1718
    1819    private boolean isEnlarged = false;
    1920
    20     private boolean isMapnik = true;
     21    private int currentMap = MAPNIK;
    2122
    2223    public static final int HIDE_OR_SHOW = 1;
    2324    public static final int MAPNIK = 2;
    2425    public static final int OSMARENDER = 3;
     26    public static final int CYCLEMAP = 4;
    2527
    2628    public SourceButton() {
     
    2931        imageMapnik = ImageProvider.get("", "blue_Mapnik.png");
    3032        imageOsmarender = ImageProvider.get("", "blue_Osmarender.png");
     33        imageCycleMap = ImageProvider.get("","blue_CycleMap.png");
    3134    }
    3235
     
    3437
    3538        if (isEnlarged) {
    36             if (isMapnik) {
     39            if (currentMap == MAPNIK) {
    3740                g.drawImage(imageMapnik.getImage(), g.getClipBounds().width
    3841                        - 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 {
    4047                g.drawImage(imageOsmarender.getImage(), g.getClipBounds().width
    4148                        - imageMapnik.getIconWidth(), y, null);
     
    6774                }
    6875            } 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;
    7178                    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
    7384                        && point.y < y + imageMapnik.getIconHeight()) {
    74                     isMapnik = true;
    75                     return MAPNIK;
     85                    currentMap = CYCLEMAP;
     86                    System.out.println("HIT Cycle");
     87                    return CYCLEMAP;
    7688                }
    7789            }
     
    8799    }
    88100   
    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;
    91109    }
    92110}
Note: See TracChangeset for help on using the changeset viewer.