Ignore:
Timestamp:
2009-01-01T18:28:53+01:00 (16 years ago)
Author:
stoecker
Message:

removed tab stop usage

File:
1 edited

Legend:

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

    r9819 r12778  
    88public class SourceButton {
    99
    10         private int x = 0;
    11         private int y = 30;
     10    private int x = 0;
     11    private int y = 30;
    1212
    13         private ImageIcon enlargeImage;
    14         private ImageIcon shrinkImage;
    15         private ImageIcon imageMapnik;
    16         private ImageIcon imageOsmarender;
     13    private ImageIcon enlargeImage;
     14    private ImageIcon shrinkImage;
     15    private ImageIcon imageMapnik;
     16    private ImageIcon imageOsmarender;
    1717
    18         private boolean isEnlarged = false;
     18    private boolean isEnlarged = false;
    1919
    20         private boolean isMapnik = true;
     20    private boolean isMapnik = true;
    2121
    22         public static final int HIDE_OR_SHOW = 1;
    23         public static final int MAPNIK = 2;
    24         public static final int OSMARENDER = 3;
     22    public static final int HIDE_OR_SHOW = 1;
     23    public static final int MAPNIK = 2;
     24    public static final int OSMARENDER = 3;
    2525
    26         public SourceButton() {
    27                 enlargeImage = ImageProvider.get("", "layer-switcher-maximize.png");
    28                 shrinkImage = ImageProvider.get("", "layer-switcher-minimize.png");
    29                 imageMapnik = ImageProvider.get("", "blue_Mapnik.png");
    30                 imageOsmarender = ImageProvider.get("", "blue_Osmarender.png");
    31         }
     26    public SourceButton() {
     27        enlargeImage = ImageProvider.get("", "layer-switcher-maximize.png");
     28        shrinkImage = ImageProvider.get("", "layer-switcher-minimize.png");
     29        imageMapnik = ImageProvider.get("", "blue_Mapnik.png");
     30        imageOsmarender = ImageProvider.get("", "blue_Osmarender.png");
     31    }
    3232
    33         public void paint(Graphics g) {
     33    public void paint(Graphics g) {
    3434
    35                 if (isEnlarged) {
    36                         if (isMapnik) {
    37                                 g.drawImage(imageMapnik.getImage(), g.getClipBounds().width
    38                                                 - imageMapnik.getIconWidth(), y, null);
    39                         } else {
    40                                 g.drawImage(imageOsmarender.getImage(), g.getClipBounds().width
    41                                                 - imageMapnik.getIconWidth(), y, null);
    42                         }
     35        if (isEnlarged) {
     36            if (isMapnik) {
     37                g.drawImage(imageMapnik.getImage(), g.getClipBounds().width
     38                        - imageMapnik.getIconWidth(), y, null);
     39            } else {
     40                g.drawImage(imageOsmarender.getImage(), g.getClipBounds().width
     41                        - imageMapnik.getIconWidth(), y, null);
     42            }
    4343
    44                         if (shrinkImage != null) {
    45                                 this.x = g.getClipBounds().width - shrinkImage.getIconWidth();
    46                                 g.drawImage(shrinkImage.getImage(), x, y, null);
    47                         }
     44            if (shrinkImage != null) {
     45                this.x = g.getClipBounds().width - shrinkImage.getIconWidth();
     46                g.drawImage(shrinkImage.getImage(), x, y, null);
     47            }
    4848
    49                 } else {
    50                         if (enlargeImage != null) {
    51                                 this.x = g.getClipBounds().width - enlargeImage.getIconWidth();
    52                                 g.drawImage(enlargeImage.getImage(), x, y, null);
    53                         }
    54                 }
    55         }
     49        } else {
     50            if (enlargeImage != null) {
     51                this.x = g.getClipBounds().width - enlargeImage.getIconWidth();
     52                g.drawImage(enlargeImage.getImage(), x, y, null);
     53            }
     54        }
     55    }
    5656
    57         public void toggle() {
    58                 this.isEnlarged = !this.isEnlarged;
     57    public void toggle() {
     58        this.isEnlarged = !this.isEnlarged;
    5959
    60         }
     60    }
    6161
    62         public int hit(Point point) {
    63                 if (isEnlarged) {
    64                         if (x < point.x && point.x < x + shrinkImage.getIconWidth()) {
    65                                 if (y < point.y && point.y < y + shrinkImage.getIconHeight()) {
    66                                         return HIDE_OR_SHOW;
    67                                 }
    68                         } else if (x - imageMapnik.getIconWidth() < point.x && point.x < x) {
    69                                 if (y < point.y && point.y < y + imageMapnik.getIconHeight() / 2) {
    70                                         isMapnik = false;
    71                                         return OSMARENDER;
    72                                 } else if (y + imageMapnik.getIconHeight() / 2 < point.y
    73                                                 && point.y < y + imageMapnik.getIconHeight()) {
    74                                         isMapnik = true;
    75                                         return MAPNIK;
    76                                 }
    77                         }
    78                 } else {
    79                         if (x < point.x && point.x < x + enlargeImage.getIconWidth()) {
    80                                 if (y < point.y && point.y < y + enlargeImage.getIconHeight()) {
    81                                         return HIDE_OR_SHOW;
    82                                 }
    83                         }
    84                 }
     62    public int hit(Point point) {
     63        if (isEnlarged) {
     64            if (x < point.x && point.x < x + shrinkImage.getIconWidth()) {
     65                if (y < point.y && point.y < y + shrinkImage.getIconHeight()) {
     66                    return HIDE_OR_SHOW;
     67                }
     68            } else if (x - imageMapnik.getIconWidth() < point.x && point.x < x) {
     69                if (y < point.y && point.y < y + imageMapnik.getIconHeight() / 2) {
     70                    isMapnik = false;
     71                    return OSMARENDER;
     72                } else if (y + imageMapnik.getIconHeight() / 2 < point.y
     73                        && point.y < y + imageMapnik.getIconHeight()) {
     74                    isMapnik = true;
     75                    return MAPNIK;
     76                }
     77            }
     78        } else {
     79            if (x < point.x && point.x < x + enlargeImage.getIconWidth()) {
     80                if (y < point.y && point.y < y + enlargeImage.getIconHeight()) {
     81                    return HIDE_OR_SHOW;
     82                }
     83            }
     84        }
    8585
    86                 return 0;
    87         }
     86        return 0;
     87    }
    8888}
Note: See TracChangeset for help on using the changeset viewer.