From 0d2aee9e3ba3f07678d5175f139cecf72f4b2ac5 Mon Sep 17 00:00:00 2001 From: Eric Bryant Date: Tue, 2 Nov 2021 12:44:04 -0400 Subject: [PATCH] Do flag mislabeled U-turns https://github.com/TravelMapping/DataProcessing/pull/472#issuecomment-957720572 --- siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp | 8 +++++++- siteupdate/python-teresco/siteupdate.py | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp b/siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp index e08afbb2..5e8eabf0 100644 --- a/siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp +++ b/siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp @@ -454,8 +454,14 @@ void Waypoint::label_selfref(const char *slash) std::string rte_ban = route->route + route->banner; if ( strncmp(label.data(), rte_ban.data(), rte_ban.size()) ) return; const char *c = label.data()+rte_ban.size(); - if (*c == 0 || *c == '_' && (c[1] != 'U' || c[2] && !isdigit(c[2])) || *c == '/') + if (*c == 0 || *c == '/') Datacheck::add(route, label, "", "", "LABEL_SELFREF", ""); + else if (*c == '_') + if (*++c != 'U') + Datacheck::add(route, label, "", "", "LABEL_SELFREF", ""); + else { while (isdigit(*++c)); + if (*c) Datacheck::add(route, label, "", "", "LABEL_SELFREF", ""); + } } void Waypoint::label_slashes(const char *slash) diff --git a/siteupdate/python-teresco/siteupdate.py b/siteupdate/python-teresco/siteupdate.py index 73246d0e..bcbed1fb 100755 --- a/siteupdate/python-teresco/siteupdate.py +++ b/siteupdate/python-teresco/siteupdate.py @@ -831,8 +831,9 @@ def label_selfref(self): rte_ban = r.route+r.banner if self.label.startswith(rte_ban): c = len(rte_ban) - if c == len(self.label) or self.label[c] == '_' and (self.label[c+1] != 'U' or len(self.label) > c+2 and not self.label[c+2].isdigit()) or self.label[c] == '/': - datacheckerrors.append(DatacheckEntry(r,[self.label],'LABEL_SELFREF')) + l = self.label + if len(l) == c or l[c] == '_' and (len(l) == c+1 or l[c+1] != 'U' or len(l) > c+2 and not l[c+2:].isdigit()) or l[c] == '/': + datacheckerrors.append(DatacheckEntry(r,[l],'LABEL_SELFREF')) class HighwaySegment: """This class represents one highway segment: the connection between two