Changeset 14048 in osm for applications/editors/josm


Ignore:
Timestamp:
2009-03-09T15:46:56+01:00 (16 years ago)
Author:
zere
Message:

Fixed bug in segment length method - index out of bounds.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java

    r14045 r14048  
    321321
    322322        /**
    323          * Calculate the length of a side (from node i to i+1) in a way.
     323         * Calculate the length of a side (from node i to i+1) in a way. This assumes that
     324         * the way is closed, but I only ever call it for buildings.
    324325         */
    325326        private double sideLength(Way w, int i) {
    326327                Node a = w.nodes.get(i);
    327                 Node b = w.nodes.get(i+1);
     328                Node b = w.nodes.get((i+1) % (w.nodes.size() - 1));
    328329                return a.coor.greatCircleDistance(b.coor);
    329330        }
     
    369370
    370371        /**
    371          * Calculate "sideness" metric for each segment in a way.
     372         * Calculate "sideness" metric for each segment in a way. 
    372373         */
    373374        private double[] calculateSideness(Way w) {
Note: See TracChangeset for help on using the changeset viewer.