Changeset 4138 in josm


Ignore:
Timestamp:
2011-06-16T16:26:37+02:00 (10 years ago)
Author:
stoecker
Message:

show way length in status when only one way is selected (side effect: when drawing way and a segment is finished the total length is shown until next segment starts)

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r4100 r4138  
    532532        return super.isDrawable() && !hasIncompleteNodes();
    533533    }
     534
     535
     536    /* since revision 4138 */
     537    public double getLength() {
     538        double length = 0;
     539        Node lastN = null;
     540        for (Node n:nodes) {
     541            if(lastN != null)
     542                length += n.getCoor().greatCircleDistance(lastN.getCoor());
     543            lastN = n;
     544        }
     545        return length;
     546    }
    534547}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r4113 r4138  
    624624            fireContentsChanged(this, 0, getSize());
    625625            remember(selection);
     626            double dist = -1;
     627            if(this.selection.size() == 1) {
     628                OsmPrimitive o = this.selection.get(0);
     629                if(o instanceof Way)
     630                   dist = ((Way)o).getLength();
     631            }
     632            Main.map.statusLine.setDist(dist);
    626633        }
    627634
Note: See TracChangeset for help on using the changeset viewer.