source: josm/trunk/src/org/openstreetmap/josm/data/validation/tests/BarriersEntrances.java@ 17243

Last change on this file since 17243 was 11129, checked in by simon04, 8 years ago

fix #13799 - Use builder pattern for TestError

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.validation.tests;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import org.openstreetmap.josm.data.osm.Node;
7import org.openstreetmap.josm.data.osm.OsmPrimitive;
8import org.openstreetmap.josm.data.validation.Severity;
9import org.openstreetmap.josm.data.validation.Test;
10import org.openstreetmap.josm.data.validation.TestError;
11
12/**
13 * Performs validation tests on barriers and entrances.
14 * @since 6192
15 */
16public class BarriersEntrances extends Test {
17
18 protected static final int BARRIER_ENTRANCE_WITHOUT_BARRIER = 2801;
19
20 /**
21 * Constructor
22 */
23 public BarriersEntrances() {
24 super(tr("Barriers and entrances"), tr("Checks for errors in barriers and entrances."));
25 }
26
27 @Override
28 public void visit(Node n) {
29 if (n.hasTag("barrier", "entrance") && !n.isOutsideDownloadArea()) {
30 for (OsmPrimitive p : n.getReferrers()) {
31 if (p.hasKey("barrier")) {
32 return;
33 }
34 }
35 errors.add(TestError
36 .builder(this, Severity.WARNING, BARRIER_ENTRANCE_WITHOUT_BARRIER)
37 .message(tr("Barrier entrance not set on a barrier"))
38 .primitives(n)
39 .build());
40 }
41 }
42}
Note: See TracBrowser for help on using the repository browser.