Ignore:
Timestamp:
2026-02-14T12:50:29+01:00 (2 days ago)
Author:
stoecker
Message:

see #24637 - patch by zkir (modified a bit) - allow to handle more than one style in caching

File:
1 edited

Legend:

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

    r17867 r19528  
    164164    public Pair<StyleElementList, Range> getStyleCacheWithRange(IPrimitive osm, double scale, NavigatableComponent nc) {
    165165        synchronized (osm.getStyleCacheSyncObject()) {
    166             if (!osm.isCachedStyleUpToDate() || scale <= 0) {
    167                 osm.setCachedStyle(StyleCache.EMPTY_STYLECACHE);
     166            if (!osm.isCachedStyleUpToDate(this) || scale <= 0) {
     167                osm.setCachedStyle(this, StyleCache.EMPTY_STYLECACHE);
    168168            } else {
    169                 Pair<StyleElementList, Range> lst = osm.getCachedStyle().getWithRange(scale, osm.isSelected());
     169                Pair<StyleElementList, Range> lst = osm.getCachedStyle(this).getWithRange(scale, osm.isSelected());
    170170                if (lst.a != null)
    171171                    return lst;
     
    217217                }
    218218            }
    219             StyleCache style = osm.getCachedStyle() != null ? osm.getCachedStyle() : StyleCache.EMPTY_STYLECACHE;
     219            StyleCache style = osm.getCachedStyle(this) != null ? osm.getCachedStyle(this) : StyleCache.EMPTY_STYLECACHE;
    220220            try {
    221                 osm.setCachedStyle(style.put(p.a, p.b, osm.isSelected()));
     221                osm.setCachedStyle(this, style.put(p.a, p.b, osm.isSelected()));
    222222            } catch (RangeViolatedError e) {
    223223                throw new AssertionError("Range violated: " + e.getMessage()
    224                   + " (object: " + osm.getPrimitiveId() + ", current style: " + osm.getCachedStyle()
     224                  + " (object: " + osm.getPrimitiveId() + ", current style: " + osm.getCachedStyle(this)
    225225                  + ", scale: " + scale + ", new stylelist: " + p.a + ", new range: " + p.b + ')', e);
    226226            }
    227             osm.declareCachedStyleUpToDate();
     227            osm.declareCachedStyleUpToDate(this);
    228228            return p;
    229229        }
Note: See TracChangeset for help on using the changeset viewer.