Ignore:
Timestamp:
2018-04-15T18:58:21+02:00 (6 years ago)
Author:
Don-vip
Message:

extract style methods to a new Stylable interface

File:
1 edited

Legend:

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

    r13420 r13636  
    105105    }
    106106
     107    /**
     108     * Returns the background color.
     109     * @return the background color
     110     */
    107111    public Color getBackgroundColor() {
    108112        if (backgroundColorCache != null)
     
    144148    public Pair<StyleElementList, Range> getStyleCacheWithRange(OsmPrimitive osm, double scale, NavigatableComponent nc) {
    145149        if (!osm.isCachedStyleUpToDate() || scale <= 0) {
    146             osm.mappaintStyle = StyleCache.EMPTY_STYLECACHE;
     150            osm.setCachedStyle(StyleCache.EMPTY_STYLECACHE);
    147151        } else {
    148             Pair<StyleElementList, Range> lst = osm.mappaintStyle.getWithRange(scale, osm.isSelected());
     152            Pair<StyleElementList, Range> lst = osm.getCachedStyle().getWithRange(scale, osm.isSelected());
    149153            if (lst.a != null)
    150154                return lst;
     
    191195            }
    192196        }
    193         StyleCache style = osm.mappaintStyle != null ? osm.mappaintStyle : StyleCache.EMPTY_STYLECACHE;
     197        StyleCache style = osm.getCachedStyle() != null ? osm.getCachedStyle() : StyleCache.EMPTY_STYLECACHE;
    194198        try {
    195             osm.mappaintStyle = style.put(p.a, p.b, osm.isSelected());
     199            osm.setCachedStyle(style.put(p.a, p.b, osm.isSelected()));
    196200        } catch (RangeViolatedError e) {
    197201            throw new AssertionError("Range violated: " + e.getMessage()
    198                     + " (object: " + osm.getPrimitiveId() + ", current style: "+osm.mappaintStyle
     202                    + " (object: " + osm.getPrimitiveId() + ", current style: "+osm.getCachedStyle()
    199203                    + ", scale: " + scale + ", new stylelist: " + p.a + ", new range: " + p.b + ')', e);
    200204        }
     
    462466    }
    463467
     468    /**
     469     * Determines whether multipolygons must be drawn.
     470     * @return whether multipolygons must be drawn.
     471     */
    464472    public boolean isDrawMultipolygon() {
    465473        return drawMultipolygon;
    466474    }
    467475
     476    /**
     477     * Sets whether multipolygons must be drawn.
     478     * @param drawMultipolygon whether multipolygons must be drawn
     479     */
    468480    public void setDrawMultipolygon(boolean drawMultipolygon) {
    469481        this.drawMultipolygon = drawMultipolygon;
Note: See TracChangeset for help on using the changeset viewer.