Changeset 7587 in josm


Ignore:
Timestamp:
2014-09-29T23:41:46+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #10557 - node icon not updated properly after undoing/redoing addition of a way

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/AddCommand.java

    r6881 r7587  
    1212import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     14import org.openstreetmap.josm.data.osm.Way;
    1415import org.openstreetmap.josm.gui.DefaultNameFormatter;
    1516import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    4849    }
    4950
     51    protected static final void checkNodeStyles(OsmPrimitive osm) {
     52        if (osm instanceof Way) {
     53            // Fix #10557 - node icon not updated after undoing/redoing addition of a way
     54            ((Way)osm).clearCachedNodeStyles();
     55        }
     56    }
     57
    5058    @Override
    5159    public boolean executeCommand() {
    5260        getLayer().data.addPrimitive(osm);
    5361        osm.setModified(true);
     62        checkNodeStyles(osm);
    5463        return true;
    5564    }
     
    5867    public void undoCommand() {
    5968        getLayer().data.removePrimitive(osm);
     69        checkNodeStyles(osm);
    6070    }
    6171
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r7509 r7587  
    739739    protected void keysChangedImpl(Map<String, String> originalKeys) {
    740740        super.keysChangedImpl(originalKeys);
     741        clearCachedNodeStyles();
     742    }
     743
     744    public final void clearCachedNodeStyles() {
    741745        for (final Node n : nodes) {
    742746            n.clearCachedStyle();
    743747        }
    744748    }
    745 
    746749}
Note: See TracChangeset for help on using the changeset viewer.