Ignore:
Timestamp:
2016-01-03T15:50:53+01:00 (8 years ago)
Author:
bastiK
Message:

move ElemStyle classes to new package, rename to (Style)Element

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement
Files:
1 added
1 moved

Legend:

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

    r9275 r9278  
    11// License: GPL. For details, see LICENSE file.
    2 package org.openstreetmap.josm.gui.mappaint;
     2package org.openstreetmap.josm.gui.mappaint.styleelement;
    33
    44import java.awt.Color;
     
    1010import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
    1111import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer;
     12import org.openstreetmap.josm.gui.mappaint.Cascade;
     13import org.openstreetmap.josm.gui.mappaint.Environment;
     14import org.openstreetmap.josm.gui.mappaint.Keyword;
     15import org.openstreetmap.josm.gui.mappaint.MultiCascade;
    1216import org.openstreetmap.josm.tools.CheckParameterUtil;
    1317
     
    1519 * Text style attached to a style with a bounding box, like an icon or a symbol.
    1620 */
    17 public class BoxTextElemStyle extends ElemStyle {
     21public class BoxTextElement extends StyleElement {
    1822
    1923    public enum HorizontalTextAlignment { LEFT, CENTER, RIGHT }
     
    8589    public static final Rectangle ZERO_BOX = new Rectangle(0, 0, 0, 0);
    8690
    87     public TextElement text;
     91    public TextLabel text;
    8892    // Either boxProvider or box is not null. If boxProvider is different from
    8993    // null, this means, that the box can still change in future, otherwise
     
    9498    public VerticalTextAlignment vAlign;
    9599
    96     public BoxTextElemStyle(Cascade c, TextElement text, BoxProvider boxProvider, Rectangle box,
     100    public BoxTextElement(Cascade c, TextLabel text, BoxProvider boxProvider, Rectangle box,
    97101            HorizontalTextAlignment hAlign, VerticalTextAlignment vAlign) {
    98102        super(c, 5f);
     
    107111    }
    108112
    109     public static BoxTextElemStyle create(Environment env, BoxProvider boxProvider) {
     113    public static BoxTextElement create(Environment env, BoxProvider boxProvider) {
    110114        return create(env, boxProvider, null);
    111115    }
    112116
    113     public static BoxTextElemStyle create(Environment env, Rectangle box) {
     117    public static BoxTextElement create(Environment env, Rectangle box) {
    114118        return create(env, null, box);
    115119    }
    116120
    117     public static BoxTextElemStyle create(Environment env, BoxProvider boxProvider, Rectangle box) {
     121    public static BoxTextElement create(Environment env, BoxProvider boxProvider, Rectangle box) {
    118122        initDefaultParameters();
    119123        Cascade c = env.mc.getCascade(env.layer);
    120124
    121         TextElement text = TextElement.create(env, DEFAULT_TEXT_COLOR, false);
     125        TextLabel text = TextLabel.create(env, DEFAULT_TEXT_COLOR, false);
    122126        if (text == null) return null;
    123127        // Skip any primitives that don't have text to draw. (Styles are recreated for any tag change.)
    124128        // The concrete text to render is not cached in this object, but computed for each
    125         // repaint. This way, one BoxTextElemStyle object can be used by multiple primitives (to save memory).
     129        // repaint. This way, one BoxTextElement object can be used by multiple primitives (to save memory).
    126130        if (text.labelCompositionStrategy.compose(env.osm) == null) return null;
    127131
     
    154158        }
    155159
    156         return new BoxTextElemStyle(c, text, boxProvider, box, hAlign, vAlign);
     160        return new BoxTextElement(c, text, boxProvider, box, hAlign, vAlign);
    157161    }
    158162
     
    169173    }
    170174
    171     public static final BoxTextElemStyle SIMPLE_NODE_TEXT_ELEMSTYLE;
     175    public static final BoxTextElement SIMPLE_NODE_TEXT_ELEMSTYLE;
    172176    static {
    173177        MultiCascade mc = new MultiCascade();
     
    176180        Node n = new Node();
    177181        n.put("name", "dummy");
    178         SIMPLE_NODE_TEXT_ELEMSTYLE = create(new Environment(n, mc, "default", null), NodeElemStyle.SIMPLE_NODE_ELEMSTYLE.getBoxProvider());
     182        SIMPLE_NODE_TEXT_ELEMSTYLE = create(new Environment(n, mc, "default", null), NodeElement.SIMPLE_NODE_ELEMSTYLE.getBoxProvider());
    179183        if (SIMPLE_NODE_TEXT_ELEMSTYLE == null) throw new AssertionError();
    180184    }
     
    207211        if (obj == null || getClass() != obj.getClass())
    208212            return false;
    209         final BoxTextElemStyle other = (BoxTextElemStyle) obj;
     213        final BoxTextElement other = (BoxTextElement) obj;
    210214        if (!text.equals(other.text)) return false;
    211215        if (boxProvider != null) {
Note: See TracChangeset for help on using the changeset viewer.