Changeset 33880 in osm for applications/editors/josm/plugins/michigan_left/src
- Timestamp:
- 2017-11-22T00:51:06+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/michigan_left/src/MichiganLeft/MichiganLeft.java
r32536 r33880 20 20 import org.openstreetmap.josm.command.Command; 21 21 import org.openstreetmap.josm.command.SequenceCommand; 22 import org.openstreetmap.josm.data.osm.DataSet; 22 23 import org.openstreetmap.josm.data.osm.Node; 23 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 25 26 import org.openstreetmap.josm.data.osm.RelationMember; 26 27 import org.openstreetmap.josm.data.osm.Way; 28 import org.openstreetmap.josm.gui.MainApplication; 27 29 import org.openstreetmap.josm.gui.MainMenu; 28 30 import org.openstreetmap.josm.plugins.Plugin; … … 43 45 public MichiganLeft(PluginInformation info) { 44 46 super(info); 45 MichiganLeft = MainMenu.add(Main .main.menu.dataMenu, new MichiganLeftAction());47 MichiganLeft = MainMenu.add(MainApplication.getMenu().dataMenu, new MichiganLeftAction()); 46 48 } 47 49 48 private class MichiganLeftAction extends JosmAction {50 private static class MichiganLeftAction extends JosmAction { 49 51 private LinkedList<Command> cmds = new LinkedList<>(); 50 52 … … 58 60 @Override 59 61 public void actionPerformed(ActionEvent e) { 60 Collection<OsmPrimitive> mainSelection = Main.getLayerManager().getEditDataSet().getSelected(); 62 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); 63 Collection<OsmPrimitive> mainSelection = ds.getSelected(); 61 64 62 65 ArrayList<OsmPrimitive> selection = new ArrayList<>(); … … 125 128 Node lastNode = firstWay.lastNode(); 126 129 127 buildRelation(firstWay, lastWay, lastNode);130 cmds.add(new AddCommand(ds, buildRelation(firstWay, lastWay, lastNode))); 128 131 } 129 132 Command c = new SequenceCommand(tr("Create Michigan left turn restriction"), cmds); … … 203 206 if (hash.containsKey(node)) { 204 207 Integer nb = hash.get(node); 205 hash.put(node, new Integer(nb.intValue() + 1));208 hash.put(node, Integer.valueOf(nb.intValue() + 1)); 206 209 } else { 207 hash.put(node, new Integer(1));208 } 209 } 210 211 public voidbuildRelation(Way fromWay, Way toWay, Node viaNode) {210 hash.put(node, Integer.valueOf(1)); 211 } 212 } 213 214 public Relation buildRelation(Way fromWay, Way toWay, Node viaNode) { 212 215 Relation relation = new Relation(); 213 216 … … 224 227 relation.put("restriction", "no_left_turn"); 225 228 226 cmds.add(new AddCommand(relation));229 return relation; 227 230 } 228 231
Note:
See TracChangeset
for help on using the changeset viewer.