Changeset 30687 in osm


Ignore:
Timestamp:
2014-09-24T01:51:24+02:00 (12 years ago)
Author:
donvip
Message:

[josm_simplifyarea] code cleanup

Location:
applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaAction.java

    r30623 r30687  
    1 // License: GPL. Copyright 2007 by Immanuel Scholz and others
     1// License: GPL. For details, see LICENSE file.
    22package sk.zdila.josm.plugin.simplify;
    33
    … …  
    6262        final ButtonSpec[] options = new ButtonSpec[] { new ButtonSpec(tr("Yes, delete nodes"), ImageProvider.get("ok"), tr("Delete nodes outside of downloaded data regions"), null),
    6363                new ButtonSpec(tr("No, abort"), ImageProvider.get("cancel"), tr("Cancel operation"), null) };
    64         final int ret = HelpAwareOptionPane.showOptionDialog(
     64        return 0 == HelpAwareOptionPane.showOptionDialog(
    6565                Main.parent,
    6666                "<html>" + trn("The selected way has nodes outside of the downloaded data region.", "The selected ways have nodes outside of the downloaded data region.", getCurrentDataSet().getSelectedWays().size())
    … …  
    6868                tr("Delete nodes outside of data regions?"), JOptionPane.WARNING_MESSAGE, null, // no special icon
    6969                options, options[0], null);
    70         return ret == 0;
    7170    }
    7271
    … …  
    7877        final ButtonSpec[] options = new ButtonSpec[] { new ButtonSpec(tr("Yes"), ImageProvider.get("ok"), tr("Simplify all selected ways"), null),
    7978                new ButtonSpec(tr("Cancel"), ImageProvider.get("cancel"), tr("Cancel operation"), null) };
    80         final int ret = HelpAwareOptionPane.showOptionDialog(Main.parent, tr("The selection contains {0} ways. Are you sure you want to simplify them all?", numWays), tr("Simplify ways?"),
     79        return 0 == HelpAwareOptionPane.showOptionDialog(Main.parent, tr("The selection contains {0} ways. Are you sure you want to simplify them all?", numWays), tr("Simplify ways?"),
    8180                JOptionPane.WARNING_MESSAGE, null, // no special icon
    8281                options, options[0], null);
    83         return ret == 0;
    8482    }
    8583
    … …  
    115113        }
    116114
    117         final List<Node> nodesToDelete = new ArrayList<Node>(); // can contain duplicate instances
     115        final List<Node> nodesToDelete = new ArrayList<>(); // can contain duplicate instances
    118116
    119117        for (final Way way : ways) {
    … …  
    125123        }
    126124
    127         final Map<Node, Count> nodeCountMap = new HashMap<Node, Count>();
     125        final Map<Node, Count> nodeCountMap = new HashMap<>();
    128126        for (final Node node : nodesToDelete) {
    129127            Count count = nodeCountMap.get(node);
    … …  
    135133        }
    136134
    137         final Collection<Node> nodesReallyToRemove = new ArrayList<Node>();
     135        final Collection<Node> nodesReallyToRemove = new ArrayList<>();
    138136
    139137        for (final Entry<Node, Count> entry : nodeCountMap.entrySet()) {
    … …  
    146144        }
    147145
    148         final Collection<Command> allCommands = new ArrayList<Command>();
     146        final Collection<Command> allCommands = new ArrayList<>();
    149147
    150148        if (!nodesReallyToRemove.isEmpty()) {
    … …  
    186184        final double mergeThreshold = Main.pref.getDouble(SimplifyAreaPreferenceSetting.MERGE_THRESHOLD, 0.2);
    187185
    188         final Map<Node, LatLon> coordMap = new HashMap<Node, LatLon>();
     186        final Map<Node, LatLon> coordMap = new HashMap<>();
    189187        for (final Way way : ways) {
    190188            for (final Node n : way.getNodes()) {
    … …  
    266264        }
    267265
    268         final Collection<Command> commands = new ArrayList<Command>();
    269         final Set<Node> nodesToDelete2 = new HashSet<Node>();
     266        final Collection<Command> commands = new ArrayList<>();
     267        final Set<Node> nodesToDelete2 = new HashSet<>();
    270268        for (final Way way : ways) {
    271269            final List<Node> nodesToDelete = way.getNodes();
    … …  
    329327        // remove nodes within threshold
    330328
    331         final List<Double> weightList = new ArrayList<Double>(nodes.size()); // weight cache
     329        final List<Double> weightList = new ArrayList<>(nodes.size()); // weight cache
    332330        for (int i = 0; i < nodes.size(); i++) {
    333331            weightList.add(null);
    … …  
    396394        }
    397395
    398         final HashSet<Node> delNodes = new HashSet<Node>(w.getNodes());
     396        final HashSet<Node> delNodes = new HashSet<>(w.getNodes());
    399397        delNodes.removeAll(nodes);
    400398
  • applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaPlugin.java

    r29778 r30687  
     1// License: GPL. For details, see LICENSE file.
    12package sk.zdila.josm.plugin.simplify;
    23
    … …  
    1819        return new SimplifyAreaPreferenceSetting();
    1920    }
    20 
    2121}
  • applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaPreferenceSetting.java

    r28353 r30687  
     1// License: GPL. For details, see LICENSE file.
    12package sk.zdila.josm.plugin.simplify;
    23
    … …  
    7273
    7374        mergeThreshold.setText(Main.pref.get(MERGE_THRESHOLD, "0.2"));
    74         // mergeThreshold.setToolTipText(tr("bla bla"));
    7575        tab.add(new JLabel(tr("Merge Nearby Nodes Threshold")), GBC.std());
    7676        tab.add(mergeThreshold, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
    … …  
    9090        return false;
    9191    }
    92 
    9392}
Note: See TracChangeset for help on using the changeset viewer.