Ignore:
Timestamp:
2016-05-15T16:37:33+02:00 (8 years ago)
Author:
Don-vip
Message:

findbugs - SF_SWITCH_NO_DEFAULT + various sonar fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/BoxTextElement.java

    r9371 r10217  
    120120    public static BoxTextElement create(Environment env, BoxProvider boxProvider, Rectangle box) {
    121121        initDefaultParameters();
    122         Cascade c = env.mc.getCascade(env.layer);
    123122
    124123        TextLabel text = TextLabel.create(env, DEFAULT_TEXT_COLOR, false);
     
    129128        if (text.labelCompositionStrategy.compose(env.osm) == null) return null;
    130129
    131         HorizontalTextAlignment hAlign = HorizontalTextAlignment.RIGHT;
    132         Keyword hAlignKW = c.get(TEXT_ANCHOR_HORIZONTAL, Keyword.RIGHT, Keyword.class);
    133         switch (hAlignKW.val) {
     130        Cascade c = env.mc.getCascade(env.layer);
     131
     132        HorizontalTextAlignment hAlign;
     133        switch (c.get(TEXT_ANCHOR_HORIZONTAL, Keyword.RIGHT, Keyword.class).val) {
    134134            case "left":
    135135                hAlign = HorizontalTextAlignment.LEFT;
     
    137137            case "center":
    138138                hAlign = HorizontalTextAlignment.CENTER;
    139         }
    140         VerticalTextAlignment vAlign = VerticalTextAlignment.BOTTOM;
    141         Keyword vAlignKW = c.get(TEXT_ANCHOR_VERTICAL, Keyword.BOTTOM, Keyword.class);
    142         switch (vAlignKW.val) {
    143             case "bottom":
    144                 vAlign = VerticalTextAlignment.BOTTOM;
    145                 break;
     139                break;
     140            case "right":
     141            default:
     142                hAlign = HorizontalTextAlignment.RIGHT;
     143        }
     144        VerticalTextAlignment vAlign;
     145        switch (c.get(TEXT_ANCHOR_VERTICAL, Keyword.BOTTOM, Keyword.class).val) {
    146146            case "above":
    147147                vAlign = VerticalTextAlignment.ABOVE;
     
    155155            case "below":
    156156                vAlign = VerticalTextAlignment.BELOW;
     157                break;
     158            case "bottom":
     159            default:
     160                vAlign = VerticalTextAlignment.BOTTOM;
    157161        }
    158162
Note: See TracChangeset for help on using the changeset viewer.