Changeset 21539 in osm for applications/editors
- Timestamp:
- 2010-06-01T09:11:37+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/validator
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/build.xml
r20799 r21539 27 27 --> 28 28 <property name="commit.message" value="don't break relations, when fixing duplicate ways" /> 29 <property name="plugin.main.version" value="3 118" />29 <property name="plugin.main.version" value="3289" /> 30 30 31 31 -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java
r20828 r21539 44 44 import org.openstreetmap.josm.plugins.validator.tests.NodesWithSameName; 45 45 import org.openstreetmap.josm.plugins.validator.tests.OverlappingWays; 46 import org.openstreetmap.josm.plugins.validator.tests.RelationChecker; 46 47 import org.openstreetmap.josm.plugins.validator.tests.SelfIntersectingWay; 47 48 import org.openstreetmap.josm.plugins.validator.tests.SimilarNamedWays; … … 83 84 */ 84 85 @SuppressWarnings("unchecked") 85 public static Class<Test>[] allAvailableTests = new Class[] { DuplicateNode.class, // ID 1 .. 99 86 public static Class<Test>[] allAvailableTests = new Class[] { 87 DuplicateNode.class, // ID 1 .. 99 86 88 OverlappingWays.class, // ID 101 .. 199 87 89 UntaggedNode.class, // ID 201 .. 299 … … 100 102 NameMismatch.class, // ID 1501 .. 1599 101 103 MultipolygonTest.class, // ID 1601 .. 1699 104 RelationChecker.class, // ID 1701 .. 1799 102 105 }; 103 106 -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateAction.java
r20828 r21539 106 106 107 107 class ValidationTask extends PleaseWaitRunnable { 108 109 110 111 108 private Collection<Test> tests; 109 private Collection<OsmPrimitive> validatedPrimitmives; 110 private Collection<OsmPrimitive> formerValidatedPrimitives; 111 private boolean canceled; 112 112 private List<TestError> errors; 113 113 … … 118 118 * @param formerValidatedPrimitives the last collection of primitives being validates. May be null. 119 119 */ 120 121 122 123 124 125 120 public ValidationTask(Collection<Test> tests, Collection<OsmPrimitive> validatedPrimitives, Collection<OsmPrimitive> formerValidatedPrimitives) { 121 super(tr("Validating"), false /*don't ignore exceptions */); 122 this.validatedPrimitmives = validatedPrimitives; 123 this.formerValidatedPrimitives = formerValidatedPrimitives; 124 this.tests = tests; 125 } 126 126 127 128 129 130 127 @Override 128 protected void cancel() { 129 this.canceled = true; 130 } 131 131 132 133 134 132 @Override 133 protected void finish() { 134 if (canceled) return; 135 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 136 // update GUI on Swing EDT 137 // 138 Runnable r = new Runnable() { 139 public void run() { 140 plugin.validationDialog.tree.setErrors(errors); 141 plugin.validationDialog.setVisible(true); 142 Main.main.getCurrentDataSet().fireSelectionChanged(); 143 } 144 }; 145 if (SwingUtilities.isEventDispatchThread()) { 146 r.run(); 147 } else { 148 SwingUtilities.invokeLater(r); 149 } 150 } 151 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 152 @Override 153 protected void realRun() throws SAXException, IOException, 154 OsmTransferException { 155 if (tests == null || tests.isEmpty()) return; 156 errors = new ArrayList<TestError>(200); 157 getProgressMonitor().setTicksCount(tests.size() * validatedPrimitmives.size()); 158 int testCounter = 0; 159 for (Test test : tests) { 160 if (canceled) return; 161 testCounter++; 162 getProgressMonitor().setCustomText(tr("Test {0}/{1}: Starting {2}", testCounter, tests.size(),test.name)); 163 test.setPartialSelection(formerValidatedPrimitives != null); 164 test.startTest(getProgressMonitor().createSubTaskMonitor(validatedPrimitmives.size(), false)); 165 test.visit(validatedPrimitmives); 166 test.endTest(); 167 errors.addAll(test.getErrors()); 168 } 169 tests = null; 170 if (Main.pref.getBoolean(PreferenceEditor.PREF_USE_IGNORE, true)) { 171 getProgressMonitor().subTask(tr("Updating ignored errors ...")); 172 for (TestError error : errors) { 173 if (canceled) return; 174 List<String> s = new ArrayList<String>(); 175 s.add(error.getIgnoreState()); 176 s.add(error.getIgnoreGroup()); 177 s.add(error.getIgnoreSubGroup()); 178 for (String state : s) { 179 if (state != null && plugin.ignoredErrors.contains(state)) { 180 error.setIgnored(true); 181 } 182 } 183 } 184 } 185 } 186 186 } 187 187 }
Note:
See TracChangeset
for help on using the changeset viewer.