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

Last change on this file was 19078, checked in by taylor.smock, 2 years ago

Fix #4142: Track fully downloaded objects (patch by stoecker, GerdP, and myself)

The serialization move from PrimitiveData to AbstractPrimitive should be
reverted prior to 24.05 (see #23677).

The serialization move was required since we want to ensure that all downstream
users of AbstractPrimitive were not using the flags field, which was done by
making the field private instead of protected. They may still be using that
field (via updateFlags) which would not be caught by compile-time or runtime
errors.

Additionally, a good chunk of common functionality was moved up from
OsmPrimitive, even though much of it wasn't useful for PrimitiveData.

  • 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.isReferrersDownloaded()) {
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.