Ignore:
Timestamp:
2010-04-04T17:42:05+02:00 (15 years ago)
Author:
skela
Message:

'Adjust to read-only JOSM selection object'

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

Legend:

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

    r20482 r20784  
    3131
    3232        <!-- enter the SVN commit message -->
    33         <property name="commit.message" value="Initial release of the Way Selector plugin" />
     33        <property name="commit.message" value="Adjust to read-only JOSM selection object" />
    3434        <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    3535        <property name="plugin.main.version" value="3095" />
  • applications/editors/josm/plugins/wayselector/src/org/openstreetmap/josm/plugins/wayselector/WaySelection.java

    r20482 r20784  
    33import java.util.ArrayList;
    44import java.util.Collection;
     5import java.util.LinkedList;
    56import java.util.List;
    67import java.util.TreeSet;
     
    103104     @param data the data set in which to extend the selection */
    104105    void extend(DataSet data) {
    105         Collection<OsmPrimitive> selection = data.getSelected();
     106        Collection<OsmPrimitive> currentSelection;
     107        LinkedList<OsmPrimitive> selection;
    106108        boolean selectionChanged = false;
    107109        Way way;
     
    110112            return;
    111113
    112         while ((way = findWay(selection)) != null) {
     114        currentSelection = data.getSelected();
     115
     116        way = findWay(currentSelection);
     117
     118        if (way == null)
     119            return;
     120
     121        selection = new LinkedList<OsmPrimitive>();
     122        for (OsmPrimitive primitive : currentSelection)
     123            selection.add(primitive);
     124
     125        do {
    113126            if (!selection.add(way))
    114127                break;
     
    117130            ways.add(way);
    118131            addNodes(way);
    119         }
     132
     133            way = findWay(selection);
     134        } while (way != null);
    120135
    121136        if (selectionChanged)
Note: See TracChangeset for help on using the changeset viewer.