Ignore:
Timestamp:
2017-09-26T19:23:48+02:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12840

Location:
applications/editors/josm/plugins/utilsplugin2
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin2

    • Property svn:ignore
      •  

        old new  
        33findbugs-josm-utilsplugin2.xml
        44MANIFEST
         5spotbugs-josm-utilsplugin2.xml
  • applications/editors/josm/plugins/utilsplugin2/build.xml

    r33579 r33676  
    55    <property name="commit.message" value="[josm_utilsplugin2]: select boundary by double-click; multitagger table highlights"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="12678"/>
     7    <property name="plugin.main.version" value="12840"/>
    88
    99    <property name="plugin.author" value="Kalle Lampila, Upliner, Zverik, akks, joshdoe and others"/>
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/ExtractPointAction.java

    r33579 r33676  
    1414import javax.swing.JOptionPane;
    1515
    16 import org.openstreetmap.josm.Main;
    1716import org.openstreetmap.josm.actions.JosmAction;
    1817import org.openstreetmap.josm.command.AddCommand;
     
    2120import org.openstreetmap.josm.command.MoveCommand;
    2221import org.openstreetmap.josm.command.SequenceCommand;
     22import org.openstreetmap.josm.data.osm.DataSet;
    2323import org.openstreetmap.josm.data.osm.Node;
    2424import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    4646    @Override
    4747    public void actionPerformed(ActionEvent e) {
    48         Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected();
     48        DataSet ds = getLayerManager().getEditDataSet();
     49        Collection<OsmPrimitive> selection = ds.getSelected();
    4950        List<Node> selectedNodes = OsmPrimitive.getFilteredList(selection, Node.class);
    5051        if (selectedNodes.size() != 1) {
     
    6162            cmds.add(new MoveCommand(nd, MainApplication.getMap().mapView.getLatLon(p.x, p.y)));
    6263        List<OsmPrimitive> refs = nd.getReferrers();
    63         cmds.add(new AddCommand(ndCopy));
     64        cmds.add(new AddCommand(ds, ndCopy));
    6465
    6566        for (OsmPrimitive pr: refs) {
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java

    r33579 r33676  
    1919
    2020import org.openstreetmap.josm.actions.JosmAction;
    21 import org.openstreetmap.josm.actions.SplitWayAction;
    2221import org.openstreetmap.josm.command.DeleteCommand;
     22import org.openstreetmap.josm.command.SplitWayCommand;
    2323import org.openstreetmap.josm.data.osm.Node;
    2424import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    185185        }
    186186
    187         List<List<Node>> wayChunks = SplitWayAction.buildSplitChunks(selectedWay, selectedNodes);
     187        List<List<Node>> wayChunks = SplitWayCommand.buildSplitChunks(selectedWay, selectedNodes);
    188188        if (wayChunks != null) {
    189189            // close the chunks
     
    208208                }
    209209            }
    210             SplitWayAction.SplitWayResult result = SplitWayAction.splitWay(
    211                     getLayerManager().getEditLayer(), selectedWay, wayChunks, Collections.<OsmPrimitive>emptyList());
    212             MainApplication.undoRedo.add(result.getCommand());
     210            SplitWayCommand result = SplitWayCommand.splitWay(
     211                    selectedWay, wayChunks, Collections.<OsmPrimitive>emptyList());
     212            MainApplication.undoRedo.add(result);
    213213            if (splitWay != null)
    214214                MainApplication.undoRedo.add(new DeleteCommand(splitWay));
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java

    r33579 r33676  
    1616
    1717import org.openstreetmap.josm.actions.JosmAction;
    18 import org.openstreetmap.josm.actions.SplitWayAction;
    1918import org.openstreetmap.josm.command.Command;
    2019import org.openstreetmap.josm.command.SequenceCommand;
     20import org.openstreetmap.josm.command.SplitWayCommand;
    2121import org.openstreetmap.josm.data.osm.Node;
    2222import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    8585
    8686        for (Way splitWay : splitWays.keySet()) {
    87             List<List<Node>> wayChunks = SplitWayAction.buildSplitChunks(splitWay, splitWays.get(splitWay));
     87            List<List<Node>> wayChunks = SplitWayCommand.buildSplitChunks(splitWay, splitWays.get(splitWay));
    8888            if (wayChunks != null) {
    89                 List<OsmPrimitive> sel = new ArrayList<>(selectedWays.size());
    90                 sel.addAll(selectedWays);
    91                 SplitWayAction.SplitWayResult result = SplitWayAction.splitWay(getLayerManager().getEditLayer(), splitWay, wayChunks, sel);
    92                 list.add(result.getCommand());
     89                list.add(SplitWayCommand.splitWay(splitWay, wayChunks, new ArrayList<>(selectedWays)));
    9390            }
    9491        }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/UnGlueRelationAction.java

    r33579 r33676  
    1111import java.util.List;
    1212
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.actions.JosmAction;
    1514import org.openstreetmap.josm.command.AddCommand;
    1615import org.openstreetmap.josm.command.Command;
    1716import org.openstreetmap.josm.command.SequenceCommand;
     17import org.openstreetmap.josm.data.osm.DataSet;
    1818import org.openstreetmap.josm.data.osm.Node;
    1919import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    5252        LinkedList<Command> cmds = new LinkedList<>();
    5353        List<OsmPrimitive> newPrimitives = new LinkedList<>();
    54         Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected();
     54        DataSet ds = getLayerManager().getEditDataSet();
     55        Collection<OsmPrimitive> selection = ds.getSelected();
    5556
    5657        for (OsmPrimitive p : selection) {
     
    6970                    }
    7071                    newPrimitives.add(newp);
    71                     cmds.add(new AddCommand(newp));
    72                     cmds.add(new ChangeRelationMemberCommand(relation, p, newp));
     72                    cmds.add(new AddCommand(ds, newp));
     73                    cmds.add(new ChangeRelationMemberCommand(ds, relation, p, newp));
    7374                } else {
    7475                    first = false;
     
    8384            //Set selection all primiteves (new and old)
    8485            newPrimitives.addAll(selection);
    85             getLayerManager().getEditDataSet().setSelected(newPrimitives);
     86            ds.setSelected(newPrimitives);
    8687            MainApplication.getMap().mapView.repaint();
    8788        }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/command/ChangeRelationMemberCommand.java

    r33522 r33676  
    99
    1010import org.openstreetmap.josm.command.Command;
     11import org.openstreetmap.josm.data.osm.DataSet;
    1112import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    1213import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2526    private boolean oldModified;
    2627
    27     public ChangeRelationMemberCommand(Relation relation, OsmPrimitive oldMember, OsmPrimitive newMember) {
     28    public ChangeRelationMemberCommand(DataSet ds, Relation relation, OsmPrimitive oldMember, OsmPrimitive newMember) {
     29        super(ds);
    2830        this.relation = relation;
    2931        this.oldMember = oldMember;
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java

    r32725 r33676  
    1818import org.openstreetmap.josm.command.Command;
    1919import org.openstreetmap.josm.data.coor.EastNorth;
     20import org.openstreetmap.josm.data.osm.DataSet;
    2021import org.openstreetmap.josm.data.osm.Node;
    2122import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2223import org.openstreetmap.josm.data.osm.Way;
     24import org.openstreetmap.josm.gui.MainApplication;
    2325
    2426public final class CircleArcMaker {
     
    6870
    6971        Set<Way> targetWays = new HashSet<>();
     72        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
    7073
    7174        boolean nodesHaveBeenChoosen = false;
     
    7982                Way newWay = new Way();
    8083                targetWays.add(newWay);
    81                 cmds.add(new AddCommand(newWay));
     84                cmds.add(new AddCommand(ds, newWay));
    8285                newWay.addNode(n1);
    8386                newWay.addNode(n2);
     
    149152                Node n = new Node(p);
    150153                arcNodes.add(n);
    151                 cmds.add(new AddCommand(n));
     154                cmds.add(new AddCommand(ds, n));
    152155            }
    153156            i++;
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CurveAction.java

    r33579 r33676  
    3939    private void updatePreferences() {
    4040        // @formatter:off
    41         angleSeparation = Main.pref.getInteger(prefKey("circlearc.angle-separation"), 20);
     41        angleSeparation = Main.pref.getInt(prefKey("circlearc.angle-separation"), 20);
    4242        // @formatter:on
    4343    }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java

    r32410 r33676  
    8787        if (dialog.getValue() == 1 && idx >= 0) {
    8888            URLList.select(vals[idx]);
    89             Main.pref.put("utilsplugin2.askurl", check1.isSelected());
     89            Main.pref.putBoolean("utilsplugin2.askurl", check1.isSelected());
    9090        }
    9191    }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java

    r33579 r33676  
    4747        items.add("Browse element [demo, =Ctrl-Shift-I]");
    4848        items.add("https://www.openstreetmap.org/{#type}/{#id}");
    49         Main.pref.putCollection("utilsplugin2.urlHistory", items);
     49        Main.pref.putList("utilsplugin2.urlHistory", items);
    5050        Main.pref.put("utilsplugin2.customurl", items.get(9));
    5151        return items;
     
    5353
    5454    public static List<String> getURLList() {
    55         List<String> items = (List<String>) Main.pref.getCollection("utilsplugin2.urlHistory");
     55        List<String> items = Main.pref.getList("utilsplugin2.urlHistory");
    5656        if (items == null || items.isEmpty()) {
    5757            resetURLList();
    58             items = (List<String>) Main.pref.getCollection("utilsplugin2.urlHistory");
     58            items = Main.pref.getList("utilsplugin2.urlHistory");
    5959        }
    6060        return items;
     
    6262
    6363    public static void updateURLList(List<String> lst) {
    64         Main.pref.putCollection("utilsplugin2.urlHistory", lst);
     64        Main.pref.putList("utilsplugin2.urlHistory", lst);
    6565        try {
    6666            Main.pref.save();
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java

    r33579 r33676  
    1616import org.openstreetmap.josm.command.SequenceCommand;
    1717import org.openstreetmap.josm.data.coor.LatLon;
     18import org.openstreetmap.josm.data.osm.DataSet;
    1819import org.openstreetmap.josm.data.osm.Node;
    1920import org.openstreetmap.josm.data.osm.Way;
     
    6263        // first we create all the nodes, then we do extra stuff based on what geometry type we need.
    6364        LinkedList<Node> nodes = new LinkedList<>();
     65        DataSet ds = getLayerManager().getEditDataSet();
    6466
    6567        for (LatLon ll : coordinates) {
    6668            Node nnew = new Node(ll);
    6769            nodes.add(nnew);
    68             cmds.add(new AddCommand(nnew));
     70            cmds.add(new AddCommand(ds, nnew));
    6971        }
    7072
     
    7476            Way wnew = new Way();
    7577            wnew.setNodes(nodes);
    76             cmds.add(new AddCommand(wnew));
     78            cmds.add(new AddCommand(ds, wnew));
    7779        } else if ("area".equals(type)) {
    7880            nodes.add(nodes.get(0)); // this is needed to close the way.
    7981            Way wnew = new Way();
    8082            wnew.setNodes(nodes);
    81             cmds.add(new AddCommand(wnew));
     83            cmds.add(new AddCommand(ds, wnew));
    8284        }
    8385        MainApplication.undoRedo.add(new SequenceCommand(tr("Lat Lon tool"), cmds));
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java

    r33579 r33676  
    3333
    3434import org.openstreetmap.josm.Main;
    35 import org.openstreetmap.josm.data.coor.CoordinateFormat;
    3635import org.openstreetmap.josm.data.coor.LatLon;
     36import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager;
     37import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat;
     38import org.openstreetmap.josm.data.coor.conversion.LatLonParser;
    3739import org.openstreetmap.josm.gui.ExtendedDialog;
    3840import org.openstreetmap.josm.gui.util.WindowGeometry;
     
    5860    private static final String SEC = "\u2033";
    5961
    60     private static final char N_TR = LatLon.NORTH.charAt(0);
    61     private static final char S_TR = LatLon.SOUTH.charAt(0);
    62     private static final char E_TR = LatLon.EAST.charAt(0);
    63     private static final char W_TR = LatLon.WEST.charAt(0);
     62    private static final char N_TR = LatLonParser.NORTH.charAt(0);
     63    private static final char S_TR = LatLonParser.SOUTH.charAt(0);
     64    private static final char E_TR = LatLonParser.EAST.charAt(0);
     65    private static final char W_TR = LatLonParser.WEST.charAt(0);
    6466
    6567    private static final Pattern p = Pattern.compile(
     
    179181        this.latLonCoordinates = ll;
    180182        String text = "";
     183        ICoordinateFormat format = CoordinateFormatManager.getDefaultFormat();
    181184        for (LatLon latlon : ll) {
    182             text = text + latlon.latToString(CoordinateFormat.getDefaultFormat())
    183             + " " + latlon.lonToString(CoordinateFormat.getDefaultFormat()) + "\n";
     185            text = text + format.latToString(latlon) + " " + format.lonToString(latlon) + "\n";
    184186        }
    185187        taLatLon.setText(text);
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java

    r33579 r33676  
    151151    private void loadHistory() {
    152152        List<String> cmtHistory = new LinkedList<>(
    153                 Main.pref.getCollection(HISTORY_KEY, Arrays.asList(defaultHistory)));
     153                Main.pref.getList(HISTORY_KEY, Arrays.asList(defaultHistory)));
    154154        Collections.reverse(cmtHistory);
    155155        cbTagSet.setPossibleItems(cmtHistory);
     
    213213    private void initAutocompletion() {
    214214        OsmDataLayer l = MainApplication.getLayerManager().getEditLayer();
    215         AutoCompletionManager autocomplete = l.data.getAutoCompletionManager();
     215        AutoCompletionManager autocomplete = AutoCompletionManager.of(l.data);
    216216        for (int i = 0; i < tableModel.mainTags.length; i++) {
    217217            if (tableModel.isSpecialTag[i]) continue;
     
    303303                history = Arrays.asList(defaultHistory);
    304304            }
    305             Main.pref.putCollection(HISTORY_KEY, history);
     305            Main.pref.putList(HISTORY_KEY, history);
    306306            loadHistory();
    307307        }
     
    336336            oldTags = s;
    337337            cbTagSet.addCurrentItemToHistory();
    338             Main.pref.putCollection(HISTORY_KEY, cbTagSet.getHistory());
     338            Main.pref.putList(HISTORY_KEY, cbTagSet.getHistory());
    339339            specifyTagSet(s);
    340340        }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java

    r33579 r33676  
    112112        // FIXME: handle different layers
    113113        List<Command> commands = new ArrayList<>();
    114         Command c = MergeNodesAction.mergeNodes(MainApplication.getLayerManager().getEditLayer(),
     114        Command c = MergeNodesAction.mergeNodes(
    115115            Arrays.asList(subjectNode, referenceNode), referenceNode);
    116116        if (c == null) {
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInRelationsMatch.java

    r33522 r33676  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import org.openstreetmap.josm.data.osm.Changeset;
    76import org.openstreetmap.josm.data.osm.Node;
    87import org.openstreetmap.josm.data.osm.OsmPrimitive;
    98import org.openstreetmap.josm.data.osm.Relation;
    109import org.openstreetmap.josm.data.osm.Way;
     10import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
    1111import org.openstreetmap.josm.data.osm.search.SearchParseError;
    12 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
    13 import org.openstreetmap.josm.data.osm.visitor.Visitor;
     12import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor;
    1413
    1514/**
     
    2524    }
    2625
    27     private static class RelationCounter implements Visitor {
     26    private static class RelationCounter implements OsmPrimitiveVisitor {
    2827        int count;
    2928        @Override
     
    4039        public void visit(Relation r) {
    4140            count++;
    42         }
    43 
    44         @Override
    45         public void visit(Changeset cs) {
    46             // Do nothing
    4741        }
    4842    }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInWaysMatch.java

    r33522 r33676  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import org.openstreetmap.josm.data.osm.Changeset;
    76import org.openstreetmap.josm.data.osm.Node;
    87import org.openstreetmap.josm.data.osm.OsmPrimitive;
    98import org.openstreetmap.josm.data.osm.Relation;
    109import org.openstreetmap.josm.data.osm.Way;
     10import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
    1111import org.openstreetmap.josm.data.osm.search.SearchParseError;
    12 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
    13 import org.openstreetmap.josm.data.osm.visitor.Visitor;
     12import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor;
    1413
    1514/**
     
    2524    }
    2625
    27     private static class WayCounter implements Visitor {
     26    private static class WayCounter implements OsmPrimitiveVisitor {
    2827        int count;
    2928        @Override
     
    3938        @Override
    4039        public void visit(Relation r) {
    41             // Do nothing
    42         }
    43 
    44         @Override
    45         public void visit(Changeset cs) {
    4640            // Do nothing
    4741        }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java

    r32725 r33676  
    3232public final class NodeWayUtils {
    3333
    34     static final int maxLevel = Main.pref.getInteger("selection.maxrecursion", 15);
    35     static final int maxWays = Main.pref.getInteger("selection.maxfoundways", 2000);
    36     static final int maxWays1 = Main.pref.getInteger("selection.maxfoundways.intersection", 500);
     34    static final int maxLevel = Main.pref.getInt("selection.maxrecursion", 15);
     35    static final int maxWays = Main.pref.getInt("selection.maxfoundways", 2000);
     36    static final int maxWays1 = Main.pref.getInt("selection.maxfoundways.intersection", 500);
    3737
    3838    private NodeWayUtils() {
Note: See TracChangeset for help on using the changeset viewer.