Ignore:
Timestamp:
2009-07-21T21:53:14+02:00 (15 years ago)
Author:
jttt
Message:

Make it work without Main.ds

Location:
applications/editors/josm/plugins/utilsplugin
Files:
3 edited

Legend:

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

    r16290 r16628  
    2525                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    2626                <attribute name="Plugin-Description" value="Several utilities that make your life easier: e.g. simplify way, join areas, jump to position."/>
    27                 <attribute name="Plugin-Mainversion" value="1722"/>
     27                <attribute name="Plugin-Mainversion" value="1815"/>
    2828                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    2929            </manifest>
  • applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/JoinAreasAction.java

    r16419 r16628  
    114114        if(result != 1) return;
    115115
    116         Collection<OsmPrimitive> selection = Main.ds.getSelectedWays();
     116        Collection<OsmPrimitive> selection = Main.main.getCurrentDataSet().getSelectedWays();
    117117
    118118        int ways = 0;
     
    177177        if(joinAreas(selWays[0], selWays[ways == 2 ? 1 : 0])) {
    178178            Main.map.mapView.repaint();
    179             DataSet.fireSelectionChanged(Main.ds.getSelected());
     179            DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected());
    180180        } else
    181181            JOptionPane.showMessageDialog(Main.parent, tr("No intersection found. Nothing was changed."));
     
    448448    private ArrayList<RelationRole> removeFromRelations(OsmPrimitive osm) {
    449449        ArrayList<RelationRole> result = new ArrayList<RelationRole>();
    450         for (Relation r : Main.ds.relations) {
     450        for (Relation r : Main.main.getCurrentDataSet().relations) {
    451451            if (r.deleted || r.incomplete) continue;
    452452            for (RelationMember rm : r.members) {
     
    479479        for (Way way : ways) {
    480480            nodes.add(way);
    481             Main.ds.setSelected(nodes);
     481            Main.main.getCurrentDataSet().setSelected(nodes);
    482482            nodes.remove(way);
    483483            new SplitWayAction().actionPerformed(null);
    484484            cmdsCount++;
    485             affected.addAll(Main.ds.getSelectedWays());
     485            affected.addAll(Main.main.getCurrentDataSet().getSelectedWays());
    486486        }
    487487        return osmprim2way(affected);
     
    584584        if(w.isClosed())
    585585            return w;
    586         Main.ds.setSelected(w);
     586        Main.main.getCurrentDataSet().setSelected(w);
    587587        Way wnew = new Way(w);
    588588        wnew.addNode(wnew.firstNode());
    589589        cmds.add(new ChangeCommand(w, wnew));
    590590        commitCommands(marktr("Closed Way"));
    591         return (Way)(Main.ds.getSelectedWays().toArray())[0];
     591        return (Way)(Main.main.getCurrentDataSet().getSelectedWays().toArray())[0];
    592592    }
    593593
     
    610610            if(a.nodes.get(0).equals(b.nodes.get(0)) ||
    611611               a.nodes.get(a.nodes.size()-1).equals(b.nodes.get(b.nodes.size()-1))) {
    612                 Main.ds.setSelected(b);
     612                Main.main.getCurrentDataSet().setSelected(b);
    613613                new ReverseWayAction().actionPerformed(null);
    614614                cmdsCount++;
     
    616616            a = b;
    617617        }
    618         Main.ds.setSelected(ways);
     618        Main.main.getCurrentDataSet().setSelected(ways);
    619619        // TODO: It might be possible that a confirmation dialog is presented even after reversing (for
    620620        // "strange" ways). If the user cancels this, makeCommitsOneAction will wrongly consume a previous
     
    622622        new CombineWayAction().actionPerformed(null);
    623623        cmdsCount++;
    624         return (Way)(Main.ds.getSelectedWays().toArray())[0];
     624        return (Way)(Main.main.getCurrentDataSet().getSelectedWays().toArray())[0];
    625625    }
    626626
  • applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/SimplifyWayAction.java

    r16419 r16628  
    3636
    3737    public void actionPerformed(ActionEvent e) {
    38         Collection<OsmPrimitive> selection = Main.ds.getSelected();
     38        Collection<OsmPrimitive> selection = Main.main.getCurrentDataSet().getSelected();
    3939
    4040        int ways = 0;
     
    107107        int toI = wnew.nodes.size() - 1;
    108108        for (int i = wnew.nodes.size() - 1; i >= 0; i--) {
    109             CollectBackReferencesVisitor backRefsV = new CollectBackReferencesVisitor(Main.ds, false);
     109            CollectBackReferencesVisitor backRefsV = new CollectBackReferencesVisitor(Main.main.getCurrentDataSet(), false);
    110110            backRefsV.visit(wnew.nodes.get(i));
    111111            boolean used = false;
Note: See TracChangeset for help on using the changeset viewer.