Changeset 3888 in josm for trunk/src


Ignore:
Timestamp:
2011-02-11T13:21:33+01:00 (13 years ago)
Author:
bastiK
Message:

mapcss: several small fixes

Location:
trunk/src/org/openstreetmap/josm
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPainter.java

    r3880 r3888  
    5656
    5757    private final Color inactiveColor;
    58     private final Color textColor;
    5958    private final Color selectedColor;
    6059    private final Color relationSelectedColor;
    61     private final Color areaTextColor;
    6260    private final Color nodeColor;
    6361    private final Color backgroundColor;
     
    9088
    9189        this.inactiveColor = PaintColors.INACTIVE.get();
    92         this.textColor = PaintColors.TEXT.get();
    9390        this.selectedColor = PaintColors.SELECTED.get();
    9491        this.relationSelectedColor = PaintColors.RELATIONSELECTED.get();
    95         this.areaTextColor = PaintColors.AREA_TEXT.get();
    9692        this.nodeColor = PaintColors.NODE.get();
    9793        this.backgroundColor = PaintColors.BACKGROUND.get();
     
    493489                    polygon.contains(centeredNBounds) // slow but nice
    494490            ) {
    495                 g.setColor(areaTextColor);
     491                g.setColor(text.color);
    496492                Font defaultFont = g.getFont();
    497                 g.setFont (orderFont);
     493                g.setFont (text.font);
    498494                g.drawString (name,
    499495                        (int)(centeredNBounds.getMinX() - nb.getMinX()),
  • trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java

    r3880 r3888  
    1313import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
    1414import org.openstreetmap.josm.data.osm.visitor.paint.MapPainter;
     15import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
    1516import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
    1617import org.openstreetmap.josm.tools.CheckParameterUtil;
     
    7980        String textPos = c.get("text-position", null, String.class);
    8081        if (textPos == null || Utils.equal(textPos, "center")) {
    81             text = TextElement.create(c);
     82            text = TextElement.create(c, PaintColors.AREA_TEXT.get());
    8283        }
    8384       
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java

    r3880 r3888  
    4747                RelativeFloat width_rel = c.get(key, null, RelativeFloat.class, true);
    4848                if (width_rel != null)
    49                     return relativeTo + width_rel.val;
     49                    return relativeTo + 2*width_rel.val;
    5050            }
    5151        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java

    r3880 r3888  
    5353        LineElemStyle casing =  createImpl(env, true);
    5454        if (casing != null) {
    55             casing.object_z_index = -1;
     55            casing.z_index = -100;
     56            casing.isModifier = true;
    5657        }
    5758        return casing;
     
    179180            String textPos = c.get("text-position", null, String.class);
    180181            if (textPos == null || equal(textPos, "line")) {
    181                 text = TextElement.create(c);
     182                text = TextElement.create(c, PaintColors.TEXT.get());
    182183            }
    183184        }
     
    192193        the way is tagged with a direction key
    193194        (even if the tag is negated as in oneway=false) or the way is selected */
    194         boolean showDirection = selected || ((!paintSettings.isUseRealWidth()) && (paintSettings.isShowDirectionArrow()
    195                 && (!paintSettings.isShowRelevantDirectionsOnly() || w.hasDirectionKeys())));
     195        boolean showDirection = !isModifier && (selected || ((!paintSettings.isUseRealWidth()) && (paintSettings.isShowDirectionArrow()
     196                && (!paintSettings.isShowRelevantDirectionsOnly() || w.hasDirectionKeys()))));
    196197        boolean reversedDirection = w.reversedDirection();
    197198        /* head only takes over control if the option is true,
  • trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java

    r3880 r3888  
    1818import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
    1919import org.openstreetmap.josm.data.osm.visitor.paint.MapPainter;
     20import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
    2021import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
    2122import org.openstreetmap.josm.tools.CheckParameterUtil;
     
    161162
    162163        NodeTextElement text = null;
    163         TextElement te = TextElement.create(c);
     164        TextElement te = TextElement.create(c, PaintColors.TEXT.get());
    164165        if (te != null) {
    165166            HorizontalTextAlignment hAlign = HorizontalTextAlignment.RIGHT;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java

    r3882 r3888  
    77import java.awt.Font;
    88
    9 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
    109import org.openstreetmap.josm.tools.CheckParameterUtil;
    1110
     
    2726    }
    2827
    29     public static TextElement create(Cascade c) {
     28    public static TextElement create(Cascade c, Color defTextColor) {
    3029        String textStr = c.get("text", null, String.class);
    3130        if (textStr == null)
     
    5352        yOffset = c.get("text-offset-y", yOffset, Float.class);
    5453       
    55         Color color = c.get("text-color", PaintColors.TEXT.get(), Color.class);
     54        Color color = c.get("text-color", defTextColor, Color.class);
    5655       
    57         return new TextElement(textKey, font, (int) xOffset, (int) yOffset, color);
     56        return new TextElement(textKey, font, (int) xOffset, - (int) yOffset, color);
    5857    }
    5958
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java

    r3876 r3888  
    4343        public boolean applies(Environment env) {
    4444            String val = env.osm.get(k);
    45             if (val == null)
     45            if (val == null && op != Op.NEQ)
    4646                return false;
    4747            switch (op) {
     
    127127        @Override
    128128        public boolean applies(Environment e) {
     129            return not ^ appliesImpl(e);
     130        }
     131
     132        public boolean appliesImpl(Environment e) {
    129133            if (equal(id, "closed")) {
    130134                if (e.osm instanceof Way && ((Way) e.osm).isClosed())
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/parser/MapCSSParser.java

    r3876 r3888  
    283283      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    284284      case LSQUARE:
     285      case EXCLAMATION:
    285286      case COLON:
    286287        ;
     
    294295        c = condition();
    295296        break;
     297      case EXCLAMATION:
    296298      case COLON:
    297299        c = pseudoclass();
     
    516518    Token t;
    517519    boolean not = false;
    518     jj_consume_token(COLON);
    519520    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    520521    case EXCLAMATION:
     
    526527      ;
    527528    }
     529    jj_consume_token(COLON);
    528530    t = jj_consume_token(IDENT);
    529531      {if (true) return new Condition.PseudoClassCondition(t.image, not);}
     
    10261028  }
    10271029
    1028   private boolean jj_3R_29() {
    1029     if (jj_3R_45()) return true;
    1030     return false;
    1031   }
    1032 
    10331030  private boolean jj_3R_17() {
    10341031    if (jj_scan_token(IDENT)) return true;
     
    10431040  }
    10441041
     1042  private boolean jj_3R_29() {
     1043    if (jj_3R_45()) return true;
     1044    return false;
     1045  }
     1046
    10451047  private boolean jj_3R_24() {
    10461048    Token xsp;
     
    11171119  }
    11181120
    1119   private boolean jj_3R_39() {
    1120     if (jj_scan_token(LESS)) return true;
    1121     return false;
    1122   }
    1123 
    11241121  private boolean jj_3R_62() {
    11251122    if (jj_scan_token(PIPE)) return true;
     
    11311128  }
    11321129
    1133   private boolean jj_3R_38() {
    1134     if (jj_scan_token(LESS_EQUAL)) return true;
     1130  private boolean jj_3R_39() {
     1131    if (jj_scan_token(LESS)) return true;
    11351132    return false;
    11361133  }
     
    11451142  }
    11461143
     1144  private boolean jj_3R_38() {
     1145    if (jj_scan_token(LESS_EQUAL)) return true;
     1146    return false;
     1147  }
     1148
     1149  private boolean jj_3R_60() {
     1150    if (jj_scan_token(LESS)) return true;
     1151    if (jj_3R_15()) return true;
     1152    if (jj_3R_43()) return true;
     1153    if (jj_3R_15()) return true;
     1154    return false;
     1155  }
     1156
    11471157  private boolean jj_3R_37() {
    11481158    if (jj_scan_token(GREATER)) return true;
     
    11551165  }
    11561166
    1157   private boolean jj_3R_60() {
    1158     if (jj_scan_token(LESS)) return true;
     1167  private boolean jj_3R_59() {
     1168    if (jj_scan_token(EQUAL)) return true;
     1169    Token xsp;
     1170    xsp = jj_scanpos;
     1171    if (jj_scan_token(22)) jj_scanpos = xsp;
    11591172    if (jj_3R_15()) return true;
    11601173    if (jj_3R_43()) return true;
     
    11651178  private boolean jj_3R_36() {
    11661179    if (jj_scan_token(GREATER_EQUAL)) return true;
    1167     return false;
    1168   }
    1169 
    1170   private boolean jj_3R_59() {
    1171     if (jj_scan_token(EQUAL)) return true;
    1172     Token xsp;
    1173     xsp = jj_scanpos;
    1174     if (jj_scan_token(22)) jj_scanpos = xsp;
    1175     if (jj_3R_15()) return true;
    1176     if (jj_3R_43()) return true;
    1177     if (jj_3R_15()) return true;
    11781180    return false;
    11791181  }
     
    12021204  }
    12031205
     1206  private boolean jj_3R_69() {
     1207    if (jj_scan_token(SLASH)) return true;
     1208    if (jj_3R_15()) return true;
     1209    if (jj_3R_43()) return true;
     1210    if (jj_3R_15()) return true;
     1211    return false;
     1212  }
     1213
     1214  private boolean jj_3R_56() {
     1215    if (jj_scan_token(GREATER_EQUAL)) return true;
     1216    if (jj_3R_15()) return true;
     1217    if (jj_3R_43()) return true;
     1218    if (jj_3R_15()) return true;
     1219    return false;
     1220  }
     1221
    12041222  private boolean jj_3R_47() {
    12051223    if (jj_3R_19()) return true;
    1206     return false;
    1207   }
    1208 
    1209   private boolean jj_3R_69() {
    1210     if (jj_scan_token(SLASH)) return true;
    1211     if (jj_3R_15()) return true;
    1212     if (jj_3R_43()) return true;
    1213     if (jj_3R_15()) return true;
    1214     return false;
    1215   }
    1216 
    1217   private boolean jj_3R_56() {
    1218     if (jj_scan_token(GREATER_EQUAL)) return true;
    1219     if (jj_3R_15()) return true;
    1220     if (jj_3R_43()) return true;
    1221     if (jj_3R_15()) return true;
    12221224    return false;
    12231225  }
     
    14251427  }
    14261428
     1429  private boolean jj_3R_27() {
     1430    if (jj_3R_43()) return true;
     1431    if (jj_3R_15()) return true;
     1432    Token xsp;
     1433    xsp = jj_scanpos;
     1434    if (jj_3R_44()) jj_scanpos = xsp;
     1435    return false;
     1436  }
     1437
    14271438  private boolean jj_3R_20() {
    14281439    Token xsp;
     
    14471458  }
    14481459
    1449   private boolean jj_3R_27() {
    1450     if (jj_3R_43()) return true;
    1451     if (jj_3R_15()) return true;
    1452     Token xsp;
    1453     xsp = jj_scanpos;
    1454     if (jj_3R_44()) jj_scanpos = xsp;
    1455     return false;
    1456   }
    1457 
    14581460  private boolean jj_3R_26() {
    14591461    if (jj_scan_token(MINUS)) return true;
     
    14821484  }
    14831485
     1486  private boolean jj_3R_16() {
     1487    Token xsp;
     1488    xsp = jj_scanpos;
     1489    if (jj_3R_25()) {
     1490    jj_scanpos = xsp;
     1491    if (jj_3R_26()) {
     1492    jj_scanpos = xsp;
     1493    if (jj_3R_27()) return true;
     1494    }
     1495    }
     1496    return false;
     1497  }
     1498
     1499  private boolean jj_3_4() {
     1500    if (jj_3R_16()) return true;
     1501    Token xsp;
     1502    xsp = jj_scanpos;
     1503    if (jj_scan_token(27)) {
     1504    jj_scanpos = xsp;
     1505    if (jj_scan_token(13)) return true;
     1506    }
     1507    return false;
     1508  }
     1509
    14841510  private boolean jj_3R_13() {
    14851511    if (jj_3R_19()) return true;
     
    14891515    jj_scanpos = xsp;
    14901516    if (jj_3R_21()) return true;
    1491     }
    1492     return false;
    1493   }
    1494 
    1495   private boolean jj_3R_16() {
    1496     Token xsp;
    1497     xsp = jj_scanpos;
    1498     if (jj_3R_25()) {
    1499     jj_scanpos = xsp;
    1500     if (jj_3R_26()) {
    1501     jj_scanpos = xsp;
    1502     if (jj_3R_27()) return true;
    1503     }
    1504     }
    1505     return false;
    1506   }
    1507 
    1508   private boolean jj_3_4() {
    1509     if (jj_3R_16()) return true;
    1510     Token xsp;
    1511     xsp = jj_scanpos;
    1512     if (jj_scan_token(27)) {
    1513     jj_scanpos = xsp;
    1514     if (jj_scan_token(13)) return true;
    15151517    }
    15161518    return false;
     
    16041606  }
    16051607
     1608  private boolean jj_3R_70() {
     1609    if (jj_3R_16()) return true;
     1610    Token xsp;
     1611    while (true) {
     1612      xsp = jj_scanpos;
     1613      if (jj_3R_75()) { jj_scanpos = xsp; break; }
     1614    }
     1615    return false;
     1616  }
     1617
    16061618  private boolean jj_3_2() {
    16071619    if (jj_3R_13()) return true;
    16081620    if (jj_scan_token(RSQUARE)) return true;
    1609     return false;
    1610   }
    1611 
    1612   private boolean jj_3R_70() {
    1613     if (jj_3R_16()) return true;
    1614     Token xsp;
    1615     while (true) {
    1616       xsp = jj_scanpos;
    1617       if (jj_3R_75()) { jj_scanpos = xsp; break; }
    1618     }
    16191621    return false;
    16201622  }
     
    16511653   }
    16521654   private static void jj_la1_init_0() {
    1653       jj_la1_0 = new int[] {0xc,0xc,0x12,0x200,0x200,0x200,0x10000000,0x402,0x10000000,0x402,0x40000000,0x2004000,0x2004000,0x4000000,0x4,0x0,0x4,0x8081011e,0x800000,0x1000012,0x1c00400,0x3c0000,0x1fc0400,0x800000,0x402,0x2,0x8002000,0x8002000,0x80000000,0x400,0x0,0x800,0x400000,0xa07c0c00,0xa07c0c00,0x8081011e,0x8001011e,0x10000000,0x8081011e,0x8000011e,};
     1655      jj_la1_0 = new int[] {0xc,0xc,0x12,0x200,0x200,0x200,0x10000000,0x402,0x10000000,0x402,0x40000000,0x2804000,0x2804000,0x4000000,0x4,0x0,0x4,0x8081011e,0x800000,0x1000012,0x1c00400,0x3c0000,0x1fc0400,0x800000,0x402,0x2,0x8002000,0x8002000,0x80000000,0x400,0x0,0x800,0x400000,0xa07c0c00,0xa07c0c00,0x8081011e,0x8001011e,0x10000000,0x8081011e,0x8000011e,};
    16541656   }
    16551657   private static void jj_la1_init_1() {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/parser/MapCSSParser.jj

    r3876 r3888  
    349349}
    350350{
     351    ( <EXCLAMATION> { not = true; } )?
    351352    <COLON>
    352     ( <EXCLAMATION> { not = true; } )? t=<IDENT>
     353    t=<IDENT>
    353354    { return new Condition.PseudoClassCondition(t.image, not); }
    354355}
Note: See TracChangeset for help on using the changeset viewer.