Changeset 25898 in osm for applications


Ignore:
Timestamp:
2011-04-25T20:21:45+02:00 (14 years ago)
Author:
akks
Message:

AddNodesAt intersections now selects added nodes. Two new actions - Alt-Z,Shift-Z - select ways/nodes from mofdification history

Location:
applications/editors/josm
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin2/src/utilsplugin2/AddIntersectionsAction.java

    r24236 r25898  
    88import java.awt.event.KeyEvent;
    99import java.util.Collection;
     10import java.util.HashSet;
    1011import java.util.LinkedList;
    1112import java.util.List;
     13import java.util.Set;
    1214
    1315import javax.swing.JOptionPane;
     
    1517import org.openstreetmap.josm.Main;
    1618import org.openstreetmap.josm.actions.JosmAction;
     19import org.openstreetmap.josm.command.AddCommand;
    1720import org.openstreetmap.josm.command.Command;
    1821import org.openstreetmap.josm.command.SequenceCommand;
     22import org.openstreetmap.josm.data.osm.Node;
    1923import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2024import org.openstreetmap.josm.data.osm.Way;
     
    4852        if (!cmds.isEmpty()) {
    4953            Main.main.undoRedo.add(new SequenceCommand(tr("Add nodes at intersections"),cmds));
     54            Set<Node> nodes = new HashSet<Node>(10);
     55            // find and select newly added nodes
     56            for (Command cmd: cmds) if (cmd instanceof AddCommand){
     57                Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
     58                for ( OsmPrimitive p : pp) { // find all affected nodes
     59                    if (p instanceof Node && p.isNew()) nodes.add((Node)p);
     60                }
     61                if (!nodes.isEmpty()) {
     62                    getCurrentDataSet().setSelected(nodes);
     63                    }
     64                }
    5065        }
    5166    }
  • applications/editors/josm/plugins/utilsplugin2/src/utilsplugin2/UtilsPlugin2.java

    r25876 r25898  
    3232    JMenuItem pasteRelations;
    3333    JMenuItem alignWayNodes;
     34    JMenuItem selModifiedNodes;
     35    JMenuItem selModifiedWays;
    3436
    3537    public UtilsPlugin2(PluginInformation info) {
     
    5658        intWays = MainMenu.add(selectionMenu, new IntersectedWaysAction());
    5759        intWaysR = MainMenu.add(selectionMenu, new IntersectedWaysRecursiveAction());
     60        selModifiedNodes = MainMenu.add(selectionMenu, new SelectModNodesAction());
     61        selModifiedWays = MainMenu.add(selectionMenu, new SelectModWaysAction());
    5862    }
    5963
     
    7983        intWays.setEnabled(enabled);
    8084        intWaysR.setEnabled(enabled);
     85        selModifiedNodes.setEnabled(enabled);
     86        selModifiedWays.setEnabled(enabled);
    8187    }
    8288}
Note: See TracChangeset for help on using the changeset viewer.