Changeset 5847 in josm for trunk


Ignore:
Timestamp:
2013-04-13T22:47:23+02:00 (7 years ago)
Author:
Don-vip
Message:

Search: fix invalid results for nodes: operator with closed ways

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

Legend:

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

    r5740 r5847  
    884884                return null;
    885885            else
    886                 return (long) ((Way) osm).getNodesCount();
     886                return (long) ((Way) osm).getRealNodesCount();
    887887        }
    888888
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r5694 r5847  
    9696
    9797    /**
    98      * Replies the number of nodes in this ways.
    99      *
    100      * @return the number of nodes in this ways.
     98     * Replies the number of nodes in this way.
     99     *
     100     * @return the number of nodes in this way.
    101101     * @since 1862
    102102     */
     
    104104    public int getNodesCount() {
    105105        return nodes.length;
     106    }
     107   
     108    /**
     109     * Replies the real number of nodes in this way (full number of nodes minus one if this way is closed)
     110     *
     111     * @return the real number of nodes in this way.
     112     * @since 5847
     113     *
     114     * @see #getNodesCount()
     115     * @see #isClosed()
     116     */
     117    public int getRealNodesCount() {
     118        int count = getNodesCount();
     119        return isClosed() ? count-1 : count;
    106120    }
    107121
  • trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java

    r5750 r5847  
    267267            }
    268268
    269             int nodesNo = way.getNodesCount();
    270             if (nodesNo > 1 && way.isClosed()) {
    271                 nodesNo--;
    272             }
     269            int nodesNo = way.getRealNodesCount();
    273270            /* note: length == 0 should no longer happen, but leave the bracket code
    274271               nevertheless, who knows what future brings */
Note: See TracChangeset for help on using the changeset viewer.