Changeset 12777 in osm for applications
- Timestamp:
- 2009-01-01T18:22:57+01:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/validator
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/build.xml
r12598 r12777 42 42 <attribute name="Plugin-Description" value="A OSM data validator"/> 43 43 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 44 <attribute name="Plugin-Mainversion" value="1 180"/>44 <attribute name="Plugin-Mainversion" value="1200"/> 45 45 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/> 46 46 <attribute name="Author" value="Francisco R. Santos"/> -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java
r12279 r12777 44 44 import org.openstreetmap.josm.plugins.validator.tests.SelfIntersectingWay; 45 45 import org.openstreetmap.josm.plugins.validator.tests.SimilarNamedWays; 46 import org.openstreetmap.josm.plugins.validator.tests.TagChecker; 46 47 import org.openstreetmap.josm.plugins.validator.tests.UnclosedWays; 47 48 import org.openstreetmap.josm.plugins.validator.tests.UnconnectedWays; … … 94 95 WronglyOrderedWays.class, // ID 1001 .. 1099 95 96 UnclosedWays.class, // ID 1101 .. 1199 97 TagChecker.class, // ID 1201 .. 1299 96 98 UnconnectedWays.class, // ID 1301 .. 1399 97 99 }; -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/PreferenceEditor.java
r12670 r12777 102 102 StringBuilder tests = new StringBuilder(); 103 103 StringBuilder testsBeforeUpload = new StringBuilder(); 104 Boolean res = false; 104 105 105 106 for (Test test : allTests) 106 107 { 107 test.ok(); 108 if(test.ok()) 109 res = false; 108 110 String name = test.getClass().getSimpleName(); 109 111 tests.append( ',' ).append( name ).append( '=' ).append( test.enabled ); -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Test.java
r11530 r12777 155 155 * Called when the used submits the preferences 156 156 */ 157 public void ok()157 public boolean ok() 158 158 { 159 159 enabled = checkEnabled.isSelected(); 160 160 testBeforeUpload = checkBeforeUpload.isSelected(); 161 return false; 161 162 } 162 163 -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java
r12707 r12777 81 81 public static final String PREF_CHECK_COMPLEX = PREFIX + ".checkComplex"; 82 82 public static final String PREF_CHECK_FIXMES = PREFIX + ".checkFixmes"; 83 public static final String PREF_CHECK_PAINT = PREFIX + ".paint"; 83 84 84 85 public static final String PREF_SOURCES = PREFIX + ".sources"; … … 86 87 public static final String PREF_USE_SPELL_FILE = PREFIX + ".usespellfile"; 87 88 88 public static final String PREF_CHECK_KEYS_BEFORE_UPLOAD = PREFIX + ".checkKeysBeforeUpload"; 89 public static final String PREF_CHECK_VALUES_BEFORE_UPLOAD = PREFIX + ".checkValuesBeforeUpload"; 90 public static final String PREF_CHECK_COMPLEX_BEFORE_UPLOAD = PREFIX + ".checkComplexBeforeUpload"; 91 public static final String PREF_CHECK_FIXMES_BEFORE_UPLOAD = PREFIX + ".checkFixmesBeforeUpload"; 89 public static final String PREF_CHECK_KEYS_BEFORE_UPLOAD = PREF_CHECK_KEYS + "BeforeUpload"; 90 public static final String PREF_CHECK_VALUES_BEFORE_UPLOAD = PREF_CHECK_VALUES + "BeforeUpload"; 91 public static final String PREF_CHECK_COMPLEX_BEFORE_UPLOAD = PREF_CHECK_COMPLEX + "BeforeUpload"; 92 public static final String PREF_CHECK_FIXMES_BEFORE_UPLOAD = PREF_CHECK_FIXMES + "BeforeUpload"; 93 public static final String PREF_CHECK_PAINT_BEFORE_UPLOAD = PREF_CHECK_PAINT + "BeforeUpload"; 92 94 93 95 protected boolean checkKeys = false; … … 95 97 protected boolean checkComplex = false; 96 98 protected boolean checkFixmes = false; 99 protected boolean checkPaint = false; 97 100 98 101 protected JCheckBox prefCheckKeys; … … 100 103 protected JCheckBox prefCheckComplex; 101 104 protected JCheckBox prefCheckFixmes; 105 protected JCheckBox prefCheckPaint; 102 106 103 107 protected JCheckBox prefCheckKeysBeforeUpload; … … 105 109 protected JCheckBox prefCheckComplexBeforeUpload; 106 110 protected JCheckBox prefCheckFixmesBeforeUpload; 111 protected JCheckBox prefCheckPaintBeforeUpload; 107 112 108 113 protected JCheckBox prefUseDataFile; … … 120 125 protected static int INVALID_KEY_SPACE = 1205; 121 126 protected static int INVALID_HTML = 1206; 127 protected static int PAINT = 1207; 122 128 /** 1250 and up is used by tagcheck */ 123 129 … … 278 284 279 285 @Override 286 public void visit(Relation n) 287 { 288 checkPrimitive(n); 289 } 290 291 292 @Override 280 293 public void visit(Way w) 281 294 { … … 305 318 } 306 319 } 320 if(checkPaint && p.errors != null) 321 { 322 for(String s: p.errors) 323 { 324 /* passing translated text also to original string, as we already 325 translated the stuff before. Makes the ignore file language dependend. */ 326 errors.add( new TestError(this, Severity.WARNING, tr("Painting problem"), 327 s, s, PAINT, p) ); 328 withErrors.add(p, "P"); 329 } 330 } 307 331 308 332 Map<String, String> props = (p.keys == null) ? Collections.<String, String>emptyMap() : p.keys; … … 383 407 if( isBeforeUpload ) 384 408 checkFixmes = checkFixmes && Main.pref.getBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, true); 409 410 checkPaint = Main.pref.getBoolean(PREF_CHECK_PAINT, true); 411 if( isBeforeUpload ) 412 checkPaint = checkPaint && Main.pref.getBoolean(PREF_CHECK_PAINT_BEFORE_UPLOAD, true); 385 413 } 386 414 … … 520 548 testPanel.add(prefCheckFixmesBeforeUpload, a); 521 549 550 prefCheckPaint = new JCheckBox(tr("Check for paint notes."), Main.pref.getBoolean(PREF_CHECK_PAINT, true)); 551 prefCheckPaint.setToolTipText(tr("Check if map paining found data errors.")); 552 testPanel.add(prefCheckPaint, GBC.std().insets(20,0,0,0)); 553 554 prefCheckPaintBeforeUpload = new JCheckBox(); 555 prefCheckPaintBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_PAINT_BEFORE_UPLOAD, true)); 556 testPanel.add(prefCheckPaintBeforeUpload, a); 557 522 558 prefUseDataFile = new JCheckBox(tr("Use default data file."), Main.pref.getBoolean(PREF_USE_DATA_FILE, true)); 523 559 prefUseDataFile.setToolTipText(tr("Use the default data file (recommended).")); … … 540 576 541 577 @Override 542 public voidok()578 public boolean ok() 543 579 { 544 580 enabled = prefCheckKeys.isSelected() || prefCheckValues.isSelected() || prefCheckComplex.isSelected() || prefCheckFixmes.isSelected(); … … 550 586 Main.pref.put(PREF_CHECK_KEYS, prefCheckKeys.isSelected()); 551 587 Main.pref.put(PREF_CHECK_FIXMES, prefCheckFixmes.isSelected()); 588 Main.pref.put(PREF_CHECK_PAINT, prefCheckPaint.isSelected()); 552 589 Main.pref.put(PREF_CHECK_VALUES_BEFORE_UPLOAD, prefCheckValuesBeforeUpload.isSelected()); 553 590 Main.pref.put(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, prefCheckComplexBeforeUpload.isSelected()); 554 591 Main.pref.put(PREF_CHECK_KEYS_BEFORE_UPLOAD, prefCheckKeysBeforeUpload.isSelected()); 555 592 Main.pref.put(PREF_CHECK_FIXMES_BEFORE_UPLOAD, prefCheckFixmesBeforeUpload.isSelected()); 593 Main.pref.put(PREF_CHECK_PAINT_BEFORE_UPLOAD, prefCheckPaintBeforeUpload.isSelected()); 556 594 Main.pref.put(PREF_USE_DATA_FILE, prefUseDataFile.isSelected()); 557 595 Main.pref.put(PREF_USE_SPELL_FILE, prefUseSpellFile.isSelected()); … … 566 604 if(sources.length() == 0) 567 605 sources = null; 568 Main.pref.put(PREF_SOURCES, sources);606 return Main.pref.put(PREF_SOURCES, sources); 569 607 } 570 608 -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/AgregatePrimitivesVisitor.java
r10519 r12777 3 3 import java.util.Collection; 4 4 import java.util.Comparator; 5 import java.util. TreeSet;5 import java.util.LinkedList; 6 6 7 7 import org.openstreetmap.josm.data.osm.*; … … 25 25 public AgregatePrimitivesVisitor() 26 26 { 27 aggregatedData = new TreeSet<OsmPrimitive>( new PrimitiveComparator());27 aggregatedData = new LinkedList<OsmPrimitive>(); 28 28 } 29 29 … … 45 45 public void visit(Node n) 46 46 { 47 aggregatedData.add(n); 47 if(!aggregatedData.contains(n)) 48 aggregatedData.add(n); 48 49 } 49 50 50 51 public void visit(Way w) 51 52 { 52 aggregatedData.add(w); 53 for (Node n : w.nodes) 54 visit(n); 53 if(!aggregatedData.contains(w)) 54 { 55 aggregatedData.add(w); 56 for (Node n : w.nodes) 57 visit(n); 58 } 55 59 } 56 60 57 61 public void visit(Relation r) { 58 // Relations can be cyclic so don't visit them twice.59 62 if (!aggregatedData.contains(r)) { 60 63 aggregatedData.add(r); … … 64 67 } 65 68 } 66 67 /**68 * A comparator that orders nodes first, ways last.69 *70 * @author frsantos71 */72 class PrimitiveComparator implements Comparator<OsmPrimitive>73 {74 public int compare(OsmPrimitive o1, OsmPrimitive o2)75 {76 if( o1 instanceof Node)77 {78 return o2 instanceof Node ? o1.hashCode() - o2.hashCode() : -1;79 }80 else if( o1 instanceof Way)81 {82 return o2 instanceof Way ? o1.hashCode() - o2.hashCode() : 1;83 } else {84 return o1.hashCode() - o2.hashCode();85 }86 }87 }88 69 }
Note:
See TracChangeset
for help on using the changeset viewer.