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/data
Files:
2 edited

Legend:

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

    r9243 r9278  
    5959import org.openstreetmap.josm.data.osm.visitor.paint.relations.MultipolygonCache;
    6060import org.openstreetmap.josm.gui.NavigatableComponent;
    61 import org.openstreetmap.josm.gui.mappaint.AreaElemStyle;
    62 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle;
    63 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.HorizontalTextAlignment;
    64 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.VerticalTextAlignment;
    65 import org.openstreetmap.josm.gui.mappaint.ElemStyle;
    6661import org.openstreetmap.josm.gui.mappaint.ElemStyles;
    67 import org.openstreetmap.josm.gui.mappaint.MapImage;
    6862import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
    69 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle;
    70 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.Symbol;
    71 import org.openstreetmap.josm.gui.mappaint.RepeatImageElemStyle.LineImageAlignment;
    7263import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList;
    73 import org.openstreetmap.josm.gui.mappaint.TextElement;
    7464import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
    7565import org.openstreetmap.josm.gui.mappaint.mapcss.Selector;
     66import org.openstreetmap.josm.gui.mappaint.styleelement.AreaElement;
     67import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement;
     68import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.HorizontalTextAlignment;
     69import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.VerticalTextAlignment;
     70import org.openstreetmap.josm.gui.mappaint.styleelement.MapImage;
     71import org.openstreetmap.josm.gui.mappaint.styleelement.NodeElement;
     72import org.openstreetmap.josm.gui.mappaint.styleelement.NodeElement.Symbol;
     73import org.openstreetmap.josm.gui.mappaint.styleelement.RepeatImageElement.LineImageAlignment;
     74import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement;
     75import org.openstreetmap.josm.gui.mappaint.styleelement.TextLabel;
    7676import org.openstreetmap.josm.tools.CompositeList;
    7777import org.openstreetmap.josm.tools.Geometry;
     
    190190
    191191    private static class StyleRecord implements Comparable<StyleRecord> {
    192         private final ElemStyle style;
     192        private final StyleElement style;
    193193        private final OsmPrimitive osm;
    194194        private final int flags;
    195195
    196         StyleRecord(ElemStyle style, OsmPrimitive osm, int flags) {
     196        StyleRecord(StyleElement style, OsmPrimitive osm, int flags) {
    197197            this.style = style;
    198198            this.osm = osm;
     
    223223
    224224            // simple node on top of icons and shapes
    225             if (this.style == NodeElemStyle.SIMPLE_NODE_ELEMSTYLE && other.style != NodeElemStyle.SIMPLE_NODE_ELEMSTYLE)
     225            if (this.style == NodeElement.SIMPLE_NODE_ELEMSTYLE && other.style != NodeElement.SIMPLE_NODE_ELEMSTYLE)
    226226                return 1;
    227             if (this.style != NodeElemStyle.SIMPLE_NODE_ELEMSTYLE && other.style == NodeElemStyle.SIMPLE_NODE_ELEMSTYLE)
     227            if (this.style != NodeElement.SIMPLE_NODE_ELEMSTYLE && other.style == NodeElement.SIMPLE_NODE_ELEMSTYLE)
    228228                return -1;
    229229
     
    418418     * @param text text style to use
    419419     */
    420     private void displayText(GlyphVector gv, String s, int x, int y, boolean disabled, TextElement text) {
     420    private void displayText(GlyphVector gv, String s, int x, int y, boolean disabled, TextLabel text) {
    421421        if (gv == null && s.isEmpty()) return;
    422422        if (isInactiveMode || disabled) {
     
    472472     */
    473473    protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color,
    474             MapImage fillImage, Float extent, Path2D.Double pfClip, boolean disabled, TextElement text) {
     474            MapImage fillImage, Float extent, Path2D.Double pfClip, boolean disabled, TextLabel text) {
    475475
    476476        Shape area = path.createTransformedShape(nc.getAffineTransform());
     
    525525    }
    526526
    527     private void drawAreaText(OsmPrimitive osm, TextElement text, Shape area) {
     527    private void drawAreaText(OsmPrimitive osm, TextLabel text, Shape area) {
    528528        if (text != null && isShowNames()) {
    529529            // abort if we can't compose the label to be rendered
     
    612612     * @param text The text to write on the area.
    613613     */
    614     public void drawArea(Relation r, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled, TextElement text) {
     614    public void drawArea(Relation r, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled, TextLabel text) {
    615615        Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, r);
    616616        if (!r.isDisabled() && !multipolygon.getOuterWays().isEmpty()) {
     
    648648     * @param text The text to write on the area.
    649649     */
    650     public void drawArea(Way w, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled, TextElement text) {
     650    public void drawArea(Way w, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled, TextLabel text) {
    651651        Path2D.Double pfClip = null;
    652652        if (extent != null) {
     
    678678    }
    679679
    680     public void drawBoxText(Node n, BoxTextElemStyle bs) {
     680    public void drawBoxText(Node n, BoxTextElement bs) {
    681681        if (!isShowNames() || bs == null)
    682682            return;
    683683
    684684        Point p = nc.getPoint(n);
    685         TextElement text = bs.text;
     685        TextLabel text = bs.text;
    686686        String s = text.labelCompositionStrategy.compose(n);
    687687        if (s == null) return;
     
    12041204     * @param text The text definition (font/.../text content) to draw.
    12051205     */
    1206     public void drawTextOnPath(Way way, TextElement text) {
     1206    public void drawTextOnPath(Way way, TextLabel text) {
    12071207        if (way == null || text == null)
    12081208            return;
     
    18261826        public void add(Node osm, int flags) {
    18271827            StyleList sl = styles.get(osm, circum, nc);
    1828             for (ElemStyle s : sl) {
     1828            for (StyleElement s : sl) {
    18291829                output.add(new StyleRecord(s, osm, flags));
    18301830            }
     
    18331833        public void add(Relation osm, int flags) {
    18341834            StyleList sl = styles.get(osm, circum, nc);
    1835             for (ElemStyle s : sl) {
    1836                 if (drawMultipolygon && drawArea && s instanceof AreaElemStyle && (flags & FLAG_DISABLED) == 0) {
     1835            for (StyleElement s : sl) {
     1836                if (drawMultipolygon && drawArea && s instanceof AreaElement && (flags & FLAG_DISABLED) == 0) {
    18371837                    output.add(new StyleRecord(s, osm, flags));
    1838                 } else if (drawRestriction && s instanceof NodeElemStyle) {
     1838                } else if (drawRestriction && s instanceof NodeElement) {
    18391839                    output.add(new StyleRecord(s, osm, flags));
    18401840                }
     
    18441844        public void add(Way osm, int flags) {
    18451845            StyleList sl = styles.get(osm, circum, nc);
    1846             for (ElemStyle s : sl) {
    1847                 if (!(drawArea && (flags & FLAG_DISABLED) == 0) && s instanceof AreaElemStyle) {
     1846            for (StyleElement s : sl) {
     1847                if (!(drawArea && (flags & FLAG_DISABLED) == 0) && s instanceof AreaElement) {
    18481848                    continue;
    18491849                }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

    r9087 r9278  
    3131import org.openstreetmap.josm.data.validation.TestError;
    3232import org.openstreetmap.josm.gui.DefaultNameFormatter;
    33 import org.openstreetmap.josm.gui.mappaint.AreaElemStyle;
     33import org.openstreetmap.josm.gui.mappaint.styleelement.AreaElement;
    3434import org.openstreetmap.josm.gui.mappaint.ElemStyles;
    3535import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
     
    182182
    183183            if (styles != null && !"boundary".equals(r.get("type"))) {
    184                 AreaElemStyle area = ElemStyles.getAreaElemStyle(r, false);
     184                AreaElement area = ElemStyles.getAreaElemStyle(r, false);
    185185                boolean areaStyle = area != null;
    186186                // If area style was not found for relation then use style of ways
     
    206206                if (area != null) {
    207207                    for (Way wInner : polygon.getInnerWays()) {
    208                         AreaElemStyle areaInner = ElemStyles.getAreaElemStyle(wInner, false);
     208                        AreaElement areaInner = ElemStyles.getAreaElemStyle(wInner, false);
    209209
    210210                        if (areaInner != null && area.equals(areaInner)) {
     
    218218                    }
    219219                    for (Way wOuter : polygon.getOuterWays()) {
    220                         AreaElemStyle areaOuter = ElemStyles.getAreaElemStyle(wOuter, false);
     220                        AreaElement areaOuter = ElemStyles.getAreaElemStyle(wOuter, false);
    221221                        if (areaOuter != null) {
    222222                            List<OsmPrimitive> l = new ArrayList<>();
Note: See TracChangeset for help on using the changeset viewer.