Ignore:
Timestamp:
2017-11-22T00:51:06+01:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12643

Location:
applications/editors/josm/plugins/michigan_left
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/michigan_left/build.xml

    r32680 r33880  
    44    <property name="commit.message" value="Changed the constructor signature of the plugin main class"/>
    55    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    6     <property name="plugin.main.version" value="10580"/>
     6    <property name="plugin.main.version" value="12643"/>
    77       
    88    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/michigan_left/src/MichiganLeft/MichiganLeft.java

    r32536 r33880  
    2020import org.openstreetmap.josm.command.Command;
    2121import org.openstreetmap.josm.command.SequenceCommand;
     22import org.openstreetmap.josm.data.osm.DataSet;
    2223import org.openstreetmap.josm.data.osm.Node;
    2324import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2526import org.openstreetmap.josm.data.osm.RelationMember;
    2627import org.openstreetmap.josm.data.osm.Way;
     28import org.openstreetmap.josm.gui.MainApplication;
    2729import org.openstreetmap.josm.gui.MainMenu;
    2830import org.openstreetmap.josm.plugins.Plugin;
     
    4345    public MichiganLeft(PluginInformation info) {
    4446        super(info);
    45         MichiganLeft = MainMenu.add(Main.main.menu.dataMenu, new MichiganLeftAction());
     47        MichiganLeft = MainMenu.add(MainApplication.getMenu().dataMenu, new MichiganLeftAction());
    4648    }
    4749
    48     private class MichiganLeftAction extends JosmAction {
     50    private static class MichiganLeftAction extends JosmAction {
    4951        private LinkedList<Command> cmds = new LinkedList<>();
    5052
     
    5860        @Override
    5961        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();
    6164
    6265            ArrayList<OsmPrimitive> selection = new ArrayList<>();
     
    125128                    Node lastNode = firstWay.lastNode();
    126129
    127                     buildRelation(firstWay, lastWay, lastNode);
     130                    cmds.add(new AddCommand(ds, buildRelation(firstWay, lastWay, lastNode)));
    128131                }
    129132                Command c = new SequenceCommand(tr("Create Michigan left turn restriction"), cmds);
     
    203206            if (hash.containsKey(node)) {
    204207                Integer nb = hash.get(node);
    205                 hash.put(node, new Integer(nb.intValue() + 1));
     208                hash.put(node, Integer.valueOf(nb.intValue() + 1));
    206209            } else {
    207                 hash.put(node, new Integer(1));
    208             }
    209         }
    210 
    211         public void buildRelation(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) {
    212215            Relation relation = new Relation();
    213216
     
    224227            relation.put("restriction", "no_left_turn");
    225228
    226             cmds.add(new AddCommand(relation));
     229            return relation;
    227230        }
    228231
Note: See TracChangeset for help on using the changeset viewer.