Changeset 4033 in osm for applications/editors/josm
- Timestamp:
- 2007-08-08T23:58:24+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java
r3259 r4033 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import java.util.*; 5 import java.util.HashSet; 6 import java.util.Map; 7 import java.util.Set; 6 8 9 import org.openstreetmap.josm.command.Command; 10 import org.openstreetmap.josm.command.DeleteCommand; 7 11 import org.openstreetmap.josm.data.osm.Way; 8 import org.openstreetmap.josm.plugins.validator.*; 12 import org.openstreetmap.josm.plugins.validator.Severity; 13 import org.openstreetmap.josm.plugins.validator.Test; 14 import org.openstreetmap.josm.plugins.validator.TestError; 9 15 /** 10 16 * Checks for untagged ways … … 14 20 public class UntaggedWay extends Test 15 21 { 22 /** Empty way error */ 23 protected static final int EMPTY_WAY = 0; 24 /** Untagged way error */ 25 protected static final int UNTAGGED_WAY = 1; 26 /** Unnamed way error */ 27 protected static final int UNNAMED_WAY = 2; 28 16 29 /** Tags allowed in a way */ 17 30 public static final String[] ALLOWED_TAGS = new String[] { "created_by", "converted_by" }; … … 64 77 65 78 if( !hasName) 66 errors.add( new TestError(this, Severity.WARNING, tr("Unnamed ways"), w ) );79 errors.add( new TestError(this, Severity.WARNING, tr("Unnamed ways"), w, UNNAMED_WAY ) ); 67 80 } 68 81 } … … 71 84 if( numTags == 0 ) 72 85 { 73 errors.add( new TestError(this, Severity.WARNING, tr("Untagged ways"), w ) );86 errors.add( new TestError(this, Severity.WARNING, tr("Untagged ways"), w, UNTAGGED_WAY) ); 74 87 } 88 89 if( w.segments.size() == 0 ) 90 { 91 errors.add( new TestError(this, Severity.ERROR, tr("Empty ways"), w, EMPTY_WAY) ); 92 } 93 75 94 } 95 96 @Override 97 public boolean isFixable(TestError testError) 98 { 99 if( testError.getTester() instanceof UntaggedWay ) 100 { 101 return testError.getInternalCode() == EMPTY_WAY; 102 } 103 104 return false; 105 } 106 107 @Override 108 public Command fixError(TestError testError) 109 { 110 return new DeleteCommand(testError.getPrimitives()); 111 } 76 112 }
Note:
See TracChangeset
for help on using the changeset viewer.