Package org.openstreetmap.josm.data.validation

Examples of org.openstreetmap.josm.data.validation.TestError


        }
        if (!wrongTypes.isEmpty()) {
            String s = marktr("Member for role {0} of wrong type");
            LinkedList<OsmPrimitive> highlight = new LinkedList<>(wrongTypes);
            highlight.addFirst(n);
            errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG,
                    tr(s, keyname), MessageFormat.format(s, keyname), WRONG_TYPE,
                    highlight, wrongTypes));
        }
    }
View Full Code Here


        long count = (ri == null) ? 0 : ri.total;
        long vc = r.getValidCount(count);
        if (count != vc) {
            if (count == 0) {
                String s = marktr("Role {0} missing");
                errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG,
                        tr(s, keyname), MessageFormat.format(s, keyname), ROLE_MISSING, n));
            }
            else if (vc > count) {
                String s = marktr("Number of {0} roles too low ({1})");
                errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG,
                        tr(s, keyname, count), MessageFormat.format(s, keyname, count), LOW_COUNT, n));
            } else {
                String s = marktr("Number of {0} roles too high ({1})");
                errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG,
                        tr(s, keyname, count), MessageFormat.format(s, keyname, count), HIGH_COUNT, n));
            }
        }
    }
View Full Code Here

            for (OsmPrimitive p : n.getReferrers()) {
                if (p.hasKey("barrier")) {
                    return;
                }
            }
            errors.add(new TestError(this, Severity.WARNING, tr("Barrier entrance not set on a barrier"), BARRIER_ENTRANCE_WITHOUT_BARRIER, n));
        }
    }
View Full Code Here

            if (lastN == null) {
                lastN = n;
                continue;
            }
            if (lastN == n) {
                errors.add(new TestError(this, Severity.ERROR, tr("Duplicated way nodes"), DUPLICATE_WAY_NODE,
                        Arrays.asList(w), Arrays.asList(n)));
                break;
            }
            lastN = n;
        }
View Full Code Here

        return (p.hasKey("landuse") || p.hasKey("natural"))
                && ElemStyles.hasAreaElemStyle(p, false);
    }

    private void addError(Way w, Node wayNode, OsmPrimitive p) {
        errors.add(new TestError(this, Severity.WARNING,
                tr("Way terminates on Area"), 2301,
                Arrays.asList(w, p),
                Arrays.asList(wayNode)));
    }
View Full Code Here

         * @param key The incriminated key, used for display.
         * @return The real test error given to JOSM validator. Can be fixable or not if a prettified values has been determined.
         */
        public TestError getTestError(final OsmPrimitive p, final String key) {
            if (prettifiedValue == null) {
                return new TestError(OpeningHourTest.this, severity, message, 2901, p);
            } else {
                return new FixableTestError(OpeningHourTest.this, severity, message, 2901, p,
                        new ChangePropertyCommand(p, key, prettifiedValue));
            }
        }
View Full Code Here

                        highlight = new ArrayList<>();
                        highlight.add(es1);
                        highlight.add(es2);

                        final String message = createMessage(es1.way, es2.way);
                        errors.add(new TestError(this, Severity.WARNING,
                                message,
                                CROSSING_WAYS,
                                prims,
                                highlight));
                        seenWays.put(prims, highlight);
View Full Code Here

                if (tailWays == 0 && tail.getCoor().isIn(downloadedArea)) {
                    highlight.add(tail);
                }

                if (!highlight.isEmpty()) {
                    errors.add(new TestError(this, Severity.ERROR, tr("Unconnected coastline"),
                            UNCONNECTED_COASTLINE, primitives, highlight));
                }
            }

            boolean unordered = false;
            boolean reversed = headWays == 1 && headReversed && tailWays == 1 && tailReversed;

            if (headWays > 1 || tailWays > 1) {
                unordered = true;
            } else if (headUnordered || tailUnordered) {
                unordered = true;
            } else if (reversed && next == prev) {
                unordered = true;
            } else if ((headReversed || tailReversed) && headReversed != tailReversed) {
                unordered = true;
            }

            if (unordered) {
                List<OsmPrimitive> highlight = new ArrayList<>();

                if (headWays > 1 || headUnordered || headReversed || reversed) {
                    highlight.add(head);
                }
                if (tailWays > 1 || tailUnordered || tailReversed || reversed) {
                    highlight.add(tail);
                }

                errors.add(new TestError(this, Severity.ERROR, tr("Unordered coastline"),
                        UNORDERED_COASTLINE, primitives, highlight));
            }
            else if (reversed) {
                errors.add(new TestError(this, Severity.ERROR, tr("Reversed coastline"),
                        REVERSED_COASTLINE, primitives));
            }
        }

        coastlines = null;
View Full Code Here

                    } else {
                        errortype = tr("Overlapping ways");
                        type = OVERLAPPING_WAY;
                    }

                    preliminaryErrors.add(new TestError(this,
                            type < OVERLAPPING_HIGHWAY_AREA ? Severity.WARNING : Severity.OTHER,
                                    errortype, type, prims, duplicated));
                    seenWays.put(currentWays, duplicated);
                } else { /* way seen, mark highlight layer only */
                    for (WaySegment ws : duplicated) {
View Full Code Here

    @Override
    public void visit(Way w) {

        final Set<WaySegment> duplicateWaySegment = checkDuplicateWaySegment(w);
        if (duplicateWaySegment != null) {
            errors.add(new TestError(this, Severity.ERROR, tr("Way contains segment twice"),
                    DUPLICATE_WAY_SEGMENT, Collections.singleton(w), duplicateWaySegment));
            return;
        }

        Node lastN = null;
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.data.validation.TestError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.