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


Ignore:
Timestamp:
2014-04-27T13:28:43+02:00 (10 years ago)
Author:
akks
Message:

If 2 nodes are selected, show distance in status line (idea by esaulenka)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r7005 r7010  
    1717import java.util.Comparator;
    1818import java.util.HashSet;
     19import java.util.Iterator;
    1920import java.util.LinkedList;
    2021import java.util.List;
     
    545546                    if (selection != null) {
    546547                        remember(selection);
     548                        if (selection.size() == 2) {
     549                            Iterator<? extends OsmPrimitive> it = selection.iterator();
     550                            OsmPrimitive n1 = it.next(), n2=it.next();
     551                            // show distance between two selected nodes
     552                            if (n1 instanceof Node && n2 instanceof Node) {
     553                                double d = ((Node) n1).getCoor().greatCircleDistance(((Node) n2).getCoor());
     554                                Main.map.statusLine.setDist(d);
     555                                return;
     556                            }
     557                        }
    547558                        Main.map.statusLine.setDist(new SubclassFilteredCollection<OsmPrimitive, Way>(selection, OsmPrimitive.wayPredicate));
    548559                    }
Note: See TracChangeset for help on using the changeset viewer.