@SuppressWarnings("PMD.NPathComplexity") // external code, do not split
    public void checkMatchedWaypointAgainstNogos(List<MatchedWaypoint> matchedWaypoints) {
        if (nogopoints == null) {
            return;
        }
        final int theSize = matchedWaypoints.size();
        if (theSize < 2) {
            return;
        }
        int removed = 0;
        final List<MatchedWaypoint> newMatchedWaypoints = new ArrayList<>();
        MatchedWaypoint prevMwp = null;
        boolean prevMwpIsInside = false;
        for (int i = 0; i < theSize; i++) {
            final MatchedWaypoint mwp = matchedWaypoints.get(i);
            boolean isInsideNogo = false;
            final OsmNode wp = mwp.crosspoint;
            for (OsmNodeNamed nogo : nogopoints) {
                if (Double.isNaN(nogo.nogoWeight)
                        && wp.calcDistance(nogo) < nogo.radius
                        && (!(nogo instanceof OsmNogoPolygon)
                        || (((OsmNogoPolygon) nogo).isClosed
                        ? ((OsmNogoPolygon) nogo).isWithin(wp.ilon, wp.ilat)
                        : ((OsmNogoPolygon) nogo).isOnPolyline(wp.ilon, wp.ilat)))) {
                    isInsideNogo = true;
                    break;
                }
            }
            if (isInsideNogo) {
                boolean useAnyway = false;
                if (prevMwp == null) {
                    useAnyway = true;
                } else if (mwp.direct) {
                    useAnyway = true;
                } else if (prevMwp.direct) {
                    useAnyway = true;
                } else if (prevMwpIsInside) {
                    useAnyway = true;
                } else if (i == theSize - 1) {
                    throw new IllegalArgumentException("last wpt in restricted area ");
                }
                if (useAnyway) {
                    prevMwpIsInside = true;
                    newMatchedWaypoints.add(mwp);
                } else {
                    removed++;
                    prevMwpIsInside = false;
                }

            } else {
                prevMwpIsInside = false;
                newMatchedWaypoints.add(mwp);
            }
            prevMwp = mwp;
        }
        if (newMatchedWaypoints.size() < 2) {
            throw new IllegalArgumentException("a wpt in restricted area ");
        }
        if (removed > 0) {
            matchedWaypoints.clear();
            matchedWaypoints.addAll(newMatchedWaypoints);
        }
    }
clean the nogolist (previoulsy saved by saveFullNogolist())
by removing nogos with waypoints within
main/src/main/java/cgeo/geocaching/brouter/core/RoutingContext.java