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

Last change on this file since 7308 was 6639, checked in by simon04, 10 years ago

fix #9544 - Skip nodes outside of download area for BarriersEntrances and WayConnectedToArea validation tests

File size: 1.2 KB
Line 
1// License: GPL. See LICENSE file for details.
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(new TestError(this, Severity.WARNING, tr("Barrier entrance not set on a barrier"), BARRIER_ENTRANCE_WITHOUT_BARRIER, n));
36 }
37 }
38}
Note: See TracBrowser for help on using the repository browser.