Changeset 5747 in josm


Ignore:
Timestamp:
2013-02-27T08:53:22+01:00 (12 years ago)
Author:
akks
Message:

Extrude mode: not add way modification command when it is not needed (rectangles etc.)
noticed by OverQuantum

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r5746 r5747  
    432432        Collection<Command> cmds = new LinkedList<Command>();
    433433        Way wnew = new Way(selectedSegment.way);
     434        boolean wayWasModified = false;
    434435        int insertionPoint = selectedSegment.lowerIndex + 1;
    435436
     
    447448            Node n1New = new Node(Main.getProjection().eastNorth2latlon(newN1en));
    448449            wnew.addNode(insertionPoint, n1New);
     450            wayWasModified = true;
    449451            insertionPoint ++;
    450452            cmds.add(new AddCommand(n1New));
     
    464466            Node n2New = new Node(Main.getProjection().eastNorth2latlon(newN2en));
    465467            wnew.addNode(insertionPoint, n2New);
     468            wayWasModified = true;
    466469            insertionPoint ++;
    467470            cmds.add(new AddCommand(n2New));
     
    471474        if (wnew.getNodesCount() == 4) {
    472475            wnew.addNode(selectedSegment.getFirstNode());
    473         }
    474 
    475         cmds.add(new ChangeCommand(selectedSegment.way, wnew));
     476            wayWasModified = true;
     477        }
     478        if (wayWasModified) {
     479            // we only need to change the way if its node list was really modified
     480            cmds.add(new ChangeCommand(selectedSegment.way, wnew));
     481        }
    476482        Command c = new SequenceCommand(tr("Extrude Way"), cmds);
    477483        Main.main.undoRedo.add(c);
Note: See TracChangeset for help on using the changeset viewer.