Changeset 583 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2008-03-16T01:21:49+01:00 (17 years ago)
Author:
framm
Message:
  • the "align nodes in circle" tool will now also work if one single way is selected (uses all the way's nodes then). before it used to complain about no nodes being selected.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java

    r564 r583  
    1919import org.openstreetmap.josm.data.osm.Node;
    2020import org.openstreetmap.josm.data.osm.OsmPrimitive;
     21import org.openstreetmap.josm.data.osm.Way;
    2122
    2223/**
     
    3435                Collection<OsmPrimitive> sel = Main.ds.getSelected();
    3536                Collection<Node> nodes = new LinkedList<Node>();
     37               
    3638                for (OsmPrimitive osm : sel)
    3739                        if (osm instanceof Node)
    3840                                nodes.add((Node)osm);
     41               
     42                // special case if no single nodes are selected and exactly one way is:
     43                // then use the way's nodes
     44                if ((nodes.size() == 0) && (sel.size() == 1))
     45                        for (OsmPrimitive osm : sel)
     46                                if (osm instanceof Way)
     47                                        nodes.addAll(((Way)osm).nodes);
     48               
    3949                if (nodes.size() < 4) {
    4050                        JOptionPane.showMessageDialog(Main.parent, tr("Please select at least four nodes."));
Note: See TracChangeset for help on using the changeset viewer.