Ticket #687: patch

File patch, 1.1 KB (added by anonymous, 17 years ago)

Patch to allow align in line with way selected

  • src/org/openstreetmap/josm/actions/AlignInLineAction.java

     
    1616import org.openstreetmap.josm.command.SequenceCommand;
    1717import org.openstreetmap.josm.data.osm.Node;
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
     19import org.openstreetmap.josm.data.osm.Way;
    1920
    2021/**
    2122 * Aligns all selected nodes into a straight line (useful for
     
    4445                                nodes.add((Node)osm);
    4546                                itnodes.add((Node)osm);
    4647                        }
     48                // special case if no single nodes are selected and exactly one way is:
     49                // then use the way's nodes
     50                if ((nodes.size() == 0) && (sel.size() == 1))
     51                        for (OsmPrimitive osm : sel)
     52                                if (osm instanceof Way) {
     53                                        nodes.addAll(((Way)osm).nodes);
     54                                        itnodes.addAll(((Way)osm).nodes);
     55                                }
    4756                if (nodes.size() < 3) {
    4857                        JOptionPane.showMessageDialog(Main.parent, tr("Please select at least three nodes."));
    4958                        return;