Changeset 3871 in josm


Ignore:
Timestamp:
2011-02-08T14:29:23+01:00 (14 years ago)
Author:
bastiK
Message:

mapcss: font attributes & text alignment

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

Legend:

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

    r3867 r3871  
    1313import java.awt.Rectangle;
    1414import java.awt.TexturePaint;
     15import java.awt.font.FontRenderContext;
     16import java.awt.font.LineMetrics;
    1517import java.awt.geom.GeneralPath;
    1618import java.awt.geom.Rectangle2D;
     
    3335import org.openstreetmap.josm.gui.NavigatableComponent;
    3436import org.openstreetmap.josm.gui.mappaint.NodeElemStyle;
     37import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.HorizontalTextAlignment;
    3538import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.Symbol;
     39import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.TextElement;
     40import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.VerticalTextAlignment;
    3641import org.openstreetmap.josm.tools.ImageProvider;
    3742import org.openstreetmap.josm.tools.LanguageInfo;
     
    188193    }
    189194
    190     public void drawNodeIcon(Node n, ImageIcon icon, float iconAlpha, boolean selected, boolean member, String name) {
     195    public void drawNodeIcon(Node n, ImageIcon icon, float iconAlpha, boolean selected, boolean member, TextElement text) {
    191196        Point p = nc.getPoint(n);
    192197        if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
     
    198203        icon.paintIcon ( nc, g, p.x-w/2, p.y-h/2 );
    199204        g.setPaintMode();
    200         if(name != null) {
    201             if (inactive || n.isDisabled()) {
    202                 g.setColor(inactiveColor);
    203             } else {
    204                 g.setColor(textColor);
    205             }
    206             Font defaultFont = g.getFont();
    207             g.setFont (orderFont);
    208             g.drawString (name, p.x+w/2+2, p.y+h/2+2);
    209             g.setFont(defaultFont);
    210         }
     205        drawNodeText(n, text, p, w/2, h/2);
    211206        if (selected || member)
    212207        {
     
    216211    }
    217212
    218     public void drawNodeSymbol(Node n, Symbol s, boolean selected, boolean member, String name) {
     213    public void drawNodeSymbol(Node n, Symbol s, boolean selected, boolean member, TextElement text) {
    219214        Point p = nc.getPoint(n);
    220215        if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
    221         int radius = (int) (s.size / 2);
     216        int radius = s.size / 2;
    222217
    223218        if (s.fillColor != null) {
    224             g.setColor(s.fillColor);
     219            if (inactive || n.isDisabled()) {
     220                g.setColor(inactiveColor);
     221            } else {
     222                g.setColor(s.fillColor);
     223            }
    225224            switch (s.symbol) {
     225                case SQUARE:
     226                    g.fillRect(p.x - radius, p.y - radius, s.size, s.size);
     227                    break;
    226228                case CIRCLE:
    227                     g.fillOval(p.x - radius, p.y - radius, (int) s.size, (int) s.size);
     229                    g.fillOval(p.x - radius, p.y - radius, s.size, s.size);
    228230                    break;
    229                 case SQUARE:
    230                     g.fillRect(p.x - radius, p.y - radius, (int) s.size, (int) s.size);
    231                     break;
     231                default:
     232                    throw new AssertionError();
    232233            }
    233234        }
    234235        if (s.stroke != null) {
    235236            g.setStroke(s.stroke);
    236             g.setColor(s.strokeColor);
     237            if (inactive || n.isDisabled()) {
     238                g.setColor(inactiveColor);
     239            } else {
     240                g.setColor(s.strokeColor);
     241            }
    237242            switch (s.symbol) {
     243                case SQUARE:
     244                    g.drawRect(p.x - radius, p.y - radius, s.size - 1, s.size - 1);
     245                    break;
    238246                case CIRCLE:
    239                     g.drawOval(p.x - radius, p.y - radius, (int) s.size - 1, (int) s.size - 1);
     247                    g.drawOval(p.x - radius, p.y - radius, s.size - 1, s.size - 1);
    240248                    break;
    241                 case SQUARE:
    242                     g.drawRect(p.x - radius, p.y - radius, (int) s.size - 1, (int) s.size - 1);
    243                     break;
     249                default:
     250                    throw new AssertionError();
    244251            }
    245252            g.setStroke(new BasicStroke());
    246253        }
     254        drawNodeText(n, text, p, radius, radius);
    247255    }
    248256
     
    253261     * @param color The color of the node.
    254262     */
    255     public void drawNode(Node n, Color color, int size, boolean fill, String name) {
     263    public void drawNode(Node n, Color color, int size, boolean fill, TextElement text) {
    256264        if (size > 1) {
    257265            Point p = nc.getPoint(n);
     
    270278            }
    271279
    272             if(name != null)            {
    273                 if (inactive || n.isDisabled()) {
    274                     g.setColor(inactiveColor);
    275                 } else {
    276                     g.setColor(textColor);
    277                 }
    278                 Font defaultFont = g.getFont();
    279                 g.setFont (orderFont);
    280                 g.drawString (name, p.x+radius+2, p.y+radius+2);
    281                 g.setFont(defaultFont);
    282             }
    283         }
     280            drawNodeText(n, text, p, radius, radius + 4);
     281        }
     282    }
     283
     284    private void drawNodeText(Node n, TextElement text, Point p, int w_half, int h_half) {
     285        if (!isShowNames() || text == null)
     286            return;
     287
     288        String s = text.textKey == null ? getNodeName(n) : n.get(text.textKey);
     289        if (s == null)
     290            return;
     291
     292        if (inactive || n.isDisabled()) {
     293            g.setColor(inactiveColor);
     294        } else {
     295            g.setColor(text.color);
     296        }
     297        Font defaultFont = g.getFont();
     298        g.setFont(text.font);
     299
     300        int x = p.x + text.xOffset;
     301        int y = p.y + text.yOffset;
     302        /**
     303         *
     304         *       left-above __center-above___ right-above
     305         *         left-top|                 |right-top
     306         *                 |                 |
     307         *      left-center|  center-center  |right-center
     308         *                 |                 |
     309         *      left-bottom|_________________|right-bottom
     310         *       left-below   center-below    right-below
     311         *
     312         */
     313        if (text.hAlign == HorizontalTextAlignment.RIGHT) {
     314            x += w_half + 2;
     315        } else {
     316            FontRenderContext frc = g.getFontRenderContext();
     317            Rectangle2D bounds = text.font.getStringBounds(s, frc);
     318            int textWidth = (int) bounds.getWidth();
     319            if (text.hAlign == HorizontalTextAlignment.CENTER) {
     320                x -= textWidth / 2;
     321            } else if (text.hAlign == HorizontalTextAlignment.LEFT) {
     322                x -= w_half + 4 + textWidth;
     323            } else throw new AssertionError();
     324        }
     325
     326        if (text.vAlign == VerticalTextAlignment.BOTTOM) {
     327            y += h_half - 2;
     328        } else {
     329            FontRenderContext frc = g.getFontRenderContext();
     330            LineMetrics metrics = text.font.getLineMetrics(s, frc);
     331            if (text.vAlign == VerticalTextAlignment.ABOVE) {
     332                y -= h_half + metrics.getDescent();
     333            } else if (text.vAlign == VerticalTextAlignment.TOP) {
     334                y -= h_half - metrics.getAscent();
     335            } else if (text.vAlign == VerticalTextAlignment.CENTER) {
     336                y += (metrics.getAscent() - metrics.getDescent()) / 2;
     337            } else if (text.vAlign == VerticalTextAlignment.BELOW) {
     338                y += h_half + metrics.getAscent();
     339            } else throw new AssertionError();
     340        }
     341        g.drawString(s, x, y);
     342        g.setFont(defaultFont);
    284343    }
    285344
  • trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java

    r3865 r3871  
    99
    1010import org.openstreetmap.josm.gui.mappaint.mapcss.CSSColors;
     11import org.openstreetmap.josm.tools.Utils;
    1112
    1213/**
     
    183184                res.append(Arrays.toString((float[]) val));
    184185            } else if (val instanceof Color) {
    185                 res.append(String.format("#%x", ((Color) val).getRGB()));
     186                res.append(Utils.toString((Color)val));
    186187            } else {
    187188                res.append(val+"");
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java

    r3865 r3871  
    164164
    165165        float miterlimit = c.get(prefix + "miterlimit", 10f, Float.class);
     166        if (miterlimit < 1f) {
     167            miterlimit = 10f;
     168        }
    166169
    167170        BasicStroke line = new BasicStroke(width, cap, join, miterlimit, dashes, dashesOffset);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java

    r3865 r3871  
    66import java.awt.BasicStroke;
    77import java.awt.Color;
     8import java.awt.Font;
    89import java.awt.Stroke;
    910
     
    1718import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
    1819import org.openstreetmap.josm.data.osm.visitor.paint.MapPainter;
     20import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
    1921import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
     22import org.openstreetmap.josm.tools.CheckParameterUtil;
    2023import org.openstreetmap.josm.tools.Utils;
    2124
     
    2427 */
    2528public class NodeElemStyle extends ElemStyle {
    26     public boolean annotate;
    27     public String annotation_key;
     29
    2830    public ImageIcon icon;
    2931    public int iconAlpha;
    3032    public Symbol symbol;
     33    public TextElement text;
    3134
    3235    private ImageIcon disabledIcon;
     36
     37    public enum SymbolShape { SQUARE, CIRCLE }
     38    public enum HorizontalTextAlignment { LEFT, CENTER, RIGHT }
     39    public enum VerticalTextAlignment { ABOVE, TOP, CENTER, BOTTOM, BELOW }
    3340
    3441    public static class Symbol {
    3542        public SymbolShape symbol;
    36         public float size;
     43        public int size;
    3744        public Stroke stroke;
    3845        public Color strokeColor;
    3946        public Color fillColor;
    4047
    41         public Symbol(SymbolShape symbol, float size, Stroke stroke, Color strokeColor, Color fillColor) {
     48        public Symbol(SymbolShape symbol, int size, Stroke stroke, Color strokeColor, Color fillColor) {
    4249            if (stroke != null && strokeColor == null)
    4350                throw new IllegalArgumentException();
     
    6774            int hash = 7;
    6875            hash = 67 * hash + symbol.hashCode();
    69             hash = 67 * hash + Float.floatToIntBits(size);
     76            hash = 67 * hash + size;
    7077            hash = 67 * hash + (stroke != null ? stroke.hashCode() : 0);
    7178            hash = 67 * hash + (strokeColor != null ? strokeColor.hashCode() : 0);
     
    8188        }
    8289    }
     90
     91    public static class TextElement {
     92        public String textKey;
     93        public HorizontalTextAlignment hAlign;
     94        public VerticalTextAlignment vAlign;
     95        public Font font;
     96        public int xOffset;
     97        public int yOffset;
     98        public Color color;
     99
     100        public TextElement(String textKey, HorizontalTextAlignment hAlign, VerticalTextAlignment vAlign, Font font, int xOffset, int yOffset, Color color) {
     101            CheckParameterUtil.ensureParameterNotNull(hAlign);
     102            CheckParameterUtil.ensureParameterNotNull(vAlign);
     103            CheckParameterUtil.ensureParameterNotNull(font);
     104            CheckParameterUtil.ensureParameterNotNull(color);
     105            this.textKey = textKey;
     106            this.hAlign = hAlign;
     107            this.vAlign = vAlign;
     108            this.font = font;
     109            this.xOffset = xOffset;
     110            this.yOffset = yOffset;
     111            this.color = color;
     112        }
     113
     114        @Override
     115        public boolean equals(Object obj) {
     116            if (obj == null || getClass() != obj.getClass())
     117                return false;
     118            final TextElement other = (TextElement) obj;
     119            return  equal(textKey, other.textKey) &&
     120                    hAlign == other.hAlign &&
     121                    vAlign == other.vAlign &&
     122                    equal(font, other.font) &&
     123                    xOffset == other.xOffset &&
     124                    yOffset == other.yOffset &&
     125                    equal(color, other.color);
     126        }
     127
     128        @Override
     129        public int hashCode() {
     130            int hash = 3;
     131            hash = 79 * hash + (textKey != null ? textKey.hashCode() : 0);
     132            hash = 79 * hash + hAlign.hashCode();
     133            hash = 79 * hash + vAlign.hashCode();
     134            hash = 79 * hash + font.hashCode();
     135            hash = 79 * hash + xOffset;
     136            hash = 79 * hash + yOffset;
     137            hash = 79 * hash + color.hashCode();
     138            return hash;
     139        }
     140    }
    83141   
    84     public enum SymbolShape { SQUARE, CIRCLE }
    85 
    86     public static final NodeElemStyle SIMPLE_NODE_ELEMSTYLE = new NodeElemStyle(Cascade.EMPTY_CASCADE, true, null, null, 0, null);
    87 
    88     protected NodeElemStyle(Cascade c, boolean annotate, String annotation_key, ImageIcon icon, int iconAlpha, Symbol symbol) {
     142    public static final NodeElemStyle SIMPLE_NODE_ELEMSTYLE;
     143    static {
     144        Cascade c = new Cascade(false);
     145        c.put("text", "auto");
     146        SIMPLE_NODE_ELEMSTYLE = create(c, true);
     147    }
     148
     149    protected NodeElemStyle(Cascade c, ImageIcon icon, int iconAlpha, Symbol symbol, TextElement text) {
    89150        super(c);
    90         this.annotate = annotate;
    91         this.annotation_key = annotation_key;
    92151        this.icon = icon;
    93152        this.iconAlpha = iconAlpha;
    94153        this.symbol = symbol;
     154        this.text = text;
    95155    }
    96156
    97157    public static NodeElemStyle create(Cascade c) {
     158        return create(c, false);
     159    }
     160
     161    private static NodeElemStyle create(Cascade c, boolean allowOnlyText) {
    98162        IconReference iconRef = c.get("icon-image", null, IconReference.class);
    99163        ImageIcon icon = null;
     
    109173            }
    110174        } else {
    111             SymbolShape shape;
    112             String shapeStr = c.get("symbol-shape", null, String.class);
    113             if (equal(shapeStr, "square")) {
    114                 shape = SymbolShape.SQUARE;
    115             } else if (equal(shapeStr, "circle")) {
    116                 shape = SymbolShape.CIRCLE;
    117             } else
    118                 return null;
    119 
    120             Float size = c.get("symbol-size", null, Float.class);
    121             if (size == null || size <= 0)
    122                 return null;
    123 
    124             Float strokeWidth = c.get("symbol-stroke-width", null, Float.class);
    125             Color strokeColor = c.get("symbol-stroke-color", null, Color.class);
    126             if (strokeColor != null) {
    127                 float strokeAlpha = c.get("symbol-stroke-opacity", 1f, Float.class);
    128                 strokeColor = new Color(strokeColor.getRed(), strokeColor.getGreen(),
    129                         strokeColor.getBlue(), Utils.color_float2int(strokeAlpha));
    130             }
    131             Stroke stroke = null;
    132             if (strokeWidth != null && strokeWidth > 0 && strokeColor != null) {
    133                 stroke = new BasicStroke(strokeWidth);
    134             }
    135 
    136             Color fillColor = c.get("symbol-fill-color", null, Color.class);
    137             if (fillColor != null) {
    138                 float fillAlpha = c.get("symbol-fill-opacity", 1f, Float.class);
    139                 fillColor = new Color(fillColor.getRed(), fillColor.getGreen(),
    140                         fillColor.getBlue(), Utils.color_float2int(fillAlpha));
    141             }
    142 
    143             if ((stroke == null || strokeColor == null) && fillColor == null)
    144                 return null;
    145 
    146             symbol = new Symbol(shape, size, stroke, strokeColor, fillColor);
    147         }
    148 
    149         String text = c.get("text", null, String.class);
    150 
    151         boolean annotate = text != null;
    152         String annotation_key = null;
    153 
    154         if (annotate && !"auto".equalsIgnoreCase(text)) {
    155             annotation_key = text;
    156         }
    157         return new NodeElemStyle(c, annotate, annotation_key, icon, iconAlpha, symbol);
     175            symbol = createSymbol(c);
     176        }
     177
     178        if (icon == null && symbol == null && !allowOnlyText)
     179            return null;
     180
     181        TextElement text = null;
     182        String textStr = c.get("text", null, String.class);
     183        if (textStr != null) {
     184            String textKey = null;
     185            if (!"auto".equalsIgnoreCase(textStr)) {
     186                textKey = textStr;
     187            }
     188            HorizontalTextAlignment hAlign = HorizontalTextAlignment.RIGHT;
     189            String hAlignStr = c.get("text-anchor-horizontal", null, String.class);
     190            if (equal(hAlignStr, "left")) {
     191                hAlign = HorizontalTextAlignment.LEFT;
     192            } else if (equal(hAlignStr, "center")) {
     193                hAlign = HorizontalTextAlignment.CENTER;
     194            } else if (equal(hAlignStr, "right")) {
     195                hAlign = HorizontalTextAlignment.RIGHT;
     196            }
     197            VerticalTextAlignment vAlign = VerticalTextAlignment.BOTTOM;
     198            String vAlignStr = c.get("text-anchor-vertical", null, String.class);
     199            if (equal(vAlignStr, "above")) {
     200                vAlign = VerticalTextAlignment.ABOVE;
     201            } else if (equal(vAlignStr, "top")) {
     202                vAlign = VerticalTextAlignment.TOP;
     203            } else if (equal(vAlignStr, "center")) {
     204                vAlign = VerticalTextAlignment.CENTER;
     205            } else if (equal(vAlignStr, "bottom")) {
     206                vAlign = VerticalTextAlignment.BOTTOM;
     207            } else if (equal(vAlignStr, "below")) {
     208                vAlign = VerticalTextAlignment.BELOW;
     209            }
     210            String name = c.get("font-family", Main.pref.get("mappaint.font", "Helvetica"), String.class);
     211            float size = c.get("font-size", (float) Main.pref.getInteger("mappaint.fontsize", 8), Float.class);
     212            int weight = Font.PLAIN;
     213            String weightStr = c.get("font-wheight", null, String.class);
     214            if (equal(weightStr, "bold")) {
     215                weight = Font.BOLD;
     216            }
     217            int style = Font.PLAIN;
     218            String styleStr = c.get("font-style", null, String.class);
     219            if (equal(styleStr, "italic")) {
     220                style = Font.ITALIC;
     221            }
     222            Font font = new Font(name, weight | style, Math.round(size));
     223            int xOffset = c.get("text-offset-x", 0f, Float.class).intValue();
     224            int yOffset = c.get("text-offset-y", 0f, Float.class).intValue();
     225            Color color = c.get("text-color", PaintColors.TEXT.get(), Color.class);
     226            text = new TextElement(textKey, hAlign, vAlign, font, xOffset, yOffset, color);
     227        }
     228       
     229        return new NodeElemStyle(c, icon, iconAlpha, symbol, text);
     230    }
     231
     232    private static Symbol createSymbol(Cascade c) {
     233        SymbolShape shape;
     234        String shapeStr = c.get("symbol-shape", null, String.class);
     235        if (equal(shapeStr, "square")) {
     236            shape = SymbolShape.SQUARE;
     237        } else if (equal(shapeStr, "circle")) {
     238            shape = SymbolShape.CIRCLE;
     239        } else
     240            return null;
     241
     242        Float size = c.get("symbol-size", null, Float.class);
     243        if (size == null || size <= 0)
     244            return null;
     245
     246        Float strokeWidth = c.get("symbol-stroke-width", null, Float.class);
     247        Color strokeColor = c.get("symbol-stroke-color", null, Color.class);
     248        if (strokeColor != null) {
     249            float strokeAlpha = c.get("symbol-stroke-opacity", 1f, Float.class);
     250            strokeColor = new Color(strokeColor.getRed(), strokeColor.getGreen(),
     251                    strokeColor.getBlue(), Utils.color_float2int(strokeAlpha));
     252        }
     253        Stroke stroke = null;
     254        if (strokeWidth != null && strokeWidth > 0 && strokeColor != null) {
     255            stroke = new BasicStroke(strokeWidth);
     256        }
     257
     258        Color fillColor = c.get("symbol-fill-color", null, Color.class);
     259        if (fillColor != null) {
     260            float fillAlpha = c.get("symbol-fill-opacity", 1f, Float.class);
     261            fillColor = new Color(fillColor.getRed(), fillColor.getGreen(),
     262                    fillColor.getBlue(), Utils.color_float2int(fillAlpha));
     263        }
     264
     265        if ((stroke == null || strokeColor == null) && fillColor == null)
     266            return null;
     267
     268        return new Symbol(shape, size.intValue(), stroke, strokeColor, fillColor);
    158269    }
    159270
     
    164275            if (icon != null && painter.isShowIcons()) {
    165276                painter.drawNodeIcon(n, (painter.isInactive() || n.isDisabled()) ? getDisabledIcon() : icon,
    166                         Utils.color_int2float(iconAlpha), selected, member, getName(n, painter));
     277                        Utils.color_int2float(iconAlpha), selected, member, text);
    167278            } else if (symbol != null) {
    168                 painter.drawNodeSymbol(n, symbol, selected, member, getName(n, painter));
     279                painter.drawNodeSymbol(n, symbol, selected, member, text);
    169280            } else {
    170281                if (n.isHighlighted()) {
    171                     painter.drawNode(n, settings.getHighlightColor(), settings.getSelectedNodeSize(), settings.isFillSelectedNode(), getName(n, painter));
     282                    painter.drawNode(n, settings.getHighlightColor(), settings.getSelectedNodeSize(), settings.isFillSelectedNode(), text);
    172283                } else {
    173284                    Color color;
     
    204315                                            settings.isFillUnselectedNode();
    205316
    206                     painter.drawNode(n, color, size, fill, getName(n, painter));
     317                    painter.drawNode(n, color, size, fill, text);
    207318                }
    208319            }
     
    220331    }
    221332
    222     protected String getName(Node n, MapPainter painter) {
    223         if (painter.isShowNames() && annotate) {
    224             if (annotation_key != null) {
    225                 return n.get(annotation_key);
    226             } else {
    227                 return painter.getNodeName(n);
    228             }
    229         }
    230         return null;
    231     }
    232 
    233333    @Override
    234334    public int hashCode() {
    235335        int hash = super.hashCode();
    236         hash = 17 * hash + (annotate ? 1 : 0);
    237         hash = 17 * hash + (annotation_key != null ? annotation_key.hashCode() : 0);
    238336        hash = 17 * hash + (icon != null ? icon.getImage().hashCode() : 0);
    239         hash = 17 * hash + this.iconAlpha;
    240         hash = 17 * hash + (this.symbol != null ? this.symbol.hashCode() : 0);
     337        hash = 17 * hash + iconAlpha;
     338        hash = 17 * hash + (symbol != null ? symbol.hashCode() : 0);
     339        hash = 17 * hash + (text != null ? text.hashCode() : 0);
    241340        return hash;
    242341    }
     
    253352        if (icon != other.icon && (icon == null || other.icon == null || icon.getImage() != other.icon.getImage()))
    254353            return false;
    255         if (annotate != other.annotate)
    256             return false;
    257         if (!equal(annotation_key, annotation_key))
    258             return false;
    259354        if (this.iconAlpha != other.iconAlpha)
    260355            return false;
    261356        if (!equal(symbol, other.symbol))
     357            return false;
     358        if (!equal(text, other.text))
    262359            return false;
    263360        return true;
     
    267364    @Override
    268365    public String toString() {
    269         return "NodeElemStyle{" + super.toString() + "annotate=" + annotate + " annotation_key=" + annotation_key +
    270                 (icon != null ? (" icon=" + icon + " iconAlpha=" + iconAlpha) : "") +
     366        return "NodeElemStyle{" + super.toString() +
     367                (icon != null ? ("icon=" + icon + " iconAlpha=" + iconAlpha) : "") +
    271368                (symbol != null ? (" symbol=[" + symbol + "]") : "") + '}';
    272369    }
  • trunk/src/org/openstreetmap/josm/tools/CheckParameterUtil.java

    r3083 r3871  
    3333
    3434    /**
     35     * can find line number in the stack trace, so parameter name is optional
     36     */
     37    public static void ensureParameterNotNull(Object value) {
     38        if (value == null)
     39            throw new IllegalArgumentException("Parameter must not be null");
     40    }
     41
     42    /**
    3543     * Ensures that <code>id</code> is non-null primitive id of type {@see OsmPrimitiveType#NODE}
    3644     *
Note: See TracChangeset for help on using the changeset viewer.