Ignore:
Timestamp:
2007-06-18T21:03:26+02:00 (17 years ago)
Author:
frsantos
Message:

Restrict the type of highways that can be named

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java

    r3038 r3259  
    33import static org.openstreetmap.josm.tools.I18n.tr;
    44
    5 import java.util.Map;
     5import java.util.*;
    66
    77import org.openstreetmap.josm.data.osm.Way;
     
    1414public class UntaggedWay extends Test
    1515{
    16         /** Tags allowed in a way */
    17         public static String[] allowedTags = new String[] { "created_by", "converted_by" };
    18        
     16    /** Tags allowed in a way */
     17    public static final String[] ALLOWED_TAGS = new String[] { "created_by", "converted_by" };
     18
     19    /** Ways that must have a name */
     20    public static final Set<String> NAMED_WAYS = new HashSet<String>();
     21    static
     22    {
     23        NAMED_WAYS.add( "motorway" );
     24        NAMED_WAYS.add( "trunk" );
     25        NAMED_WAYS.add( "primary" );
     26        NAMED_WAYS.add( "secondary" );
     27        NAMED_WAYS.add( "tertiary" );
     28        NAMED_WAYS.add( "residential" );
     29        NAMED_WAYS.add( "pedestrian" ); ;
     30    }
     31   
    1932    /**
    2033         * Constructor
     
    3447                {
    3548                        numTags = tags.size();
    36                         for( String tag : allowedTags)
     49                        for( String tag : ALLOWED_TAGS)
    3750                                if( tags.containsKey(tag) ) numTags--;
    3851           
    39             if( numTags != 0 && tags.containsKey("highway" ) )
     52            String highway = tags.get("highway");
     53            if( numTags != 0 && highway != null && NAMED_WAYS.contains(highway))
    4054            {
    4155                if( !tags.containsKey("name") && !tags.containsKey("ref") )
Note: See TracChangeset for help on using the changeset viewer.