Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Fix for validation
Browse files Browse the repository at this point in the history
  • Loading branch information
emi420 committed Nov 9, 2023
1 parent ab9e9fc commit 304ca0b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 47 deletions.
48 changes: 26 additions & 22 deletions src/validate/geospatial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,38 @@ Geospatial::checkWay(const osmobjects::OsmWay &way, const std::string &type, yam
// bool check_overlapping = config.get_value("overlapping") == "yes";
// bool check_duplicate = config.get_value("duplicate") == "yes";

if (check_badgeom) {
auto badgeom_minangle = config.get_value("badgeom_minangle");
auto badgeom_maxangle = config.get_value("badgeom_maxangle");
if (badgeom_minangle != "" && badgeom_maxangle != "") {
if (unsquared(way.linestring, std::stod(badgeom_minangle), std::stod(badgeom_maxangle))) {
status->status.insert(badgeom);
if (way.tags.count(type)) {
if (check_badgeom) {
auto badgeom_minangle = config.get_value("badgeom_minangle");
auto badgeom_maxangle = config.get_value("badgeom_maxangle");
if (!way.linestring.empty() && boost::geometry::equals(way.linestring.back(), way.linestring.front())) {
if (badgeom_minangle != "" && badgeom_maxangle != "") {
if (unsquared(way.linestring, std::stod(badgeom_minangle), std::stod(badgeom_maxangle))) {
status->status.insert(badgeom);
}
} else {
if (unsquared(way.linestring)) {
status->status.insert(badgeom);
}
}
}
} else {
if (unsquared(way.linestring)) {
status->status.insert(badgeom);
}
}

}
}

// if (check_overlapping) {
// auto allWays = context.getOverlappingWays();
// if (overlaps(allWays, way)) {
// status->status.insert(overlapping);
// if (check_overlapping) {
// auto allWays = context.getOverlappingWays();
// if (overlaps(allWays, way)) {
// status->status.insert(overlapping);
// }
// }
// }

// if (check_duplicate) {
// auto allWays = context.getOverlappingWays();
// if (overlaps(allWays, way)) {
// status->status.insert(overlapping);
// if (check_duplicate) {
// auto allWays = context.getOverlappingWays();
// if (overlaps(allWays, way)) {
// status->status.insert(overlapping);
// }
// }
// }
}

return status;
}
Expand Down
53 changes: 28 additions & 25 deletions src/validate/semantic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,21 @@ Semantic::checkNode(const osmobjects::OsmNode &node, const std::string &type, ya
int tagexists = 0;
status->center = node.point;

for (auto vit = std::begin(node.tags); vit != std::end(node.tags); ++vit) {
if (!isValidTag(vit->first, vit->second, tags)) {
status->status.insert(badvalue);
status->values.insert(vit->first + "=" + vit->second);
}
if (isRequiredTag(vit->first, required_tags)) {
tagexists++;
if (node.tags.count(type)) {
for (auto vit = std::begin(node.tags); vit != std::end(node.tags); ++vit) {
if (!isValidTag(vit->first, vit->second, tags)) {
status->status.insert(badvalue);
status->values.insert(vit->first + "=" + vit->second);
}
if (isRequiredTag(vit->first, required_tags)) {
tagexists++;
}
checkTag(vit->first, vit->second, status);
}
checkTag(vit->first, vit->second, status);
}

if (tagexists != required_tags.children.size()) {
status->status.insert(incomplete);
if (tagexists != required_tags.children.size()) {
status->status.insert(incomplete);
}
}
return status;
}
Expand Down Expand Up @@ -178,25 +180,26 @@ Semantic::checkWay(const osmobjects::OsmWay &way, const std::string &type, yaml:
}

int tagexists = 0;
for (auto vit = std::begin(way.tags); vit != std::end(way.tags); ++vit) {
if (check_badvalue) {
if (tags.children.size() > 0 && !isValidTag(vit->first, vit->second, tags)) {
status->status.insert(badvalue);
status->values.insert(vit->first + "=" + vit->second);
if (way.tags.count(type)) {
for (auto vit = std::begin(way.tags); vit != std::end(way.tags); ++vit) {
if (check_badvalue) {
if (tags.children.size() > 0 && !isValidTag(vit->first, vit->second, tags)) {
status->status.insert(badvalue);
status->values.insert(vit->first + "=" + vit->second);
}
checkTag(vit->first, vit->second, status);
}
checkTag(vit->first, vit->second, status);
}
if (check_incomplete) {
if (isRequiredTag(vit->first, required_tags)) {
tagexists++;
if (check_incomplete) {
if (isRequiredTag(vit->first, required_tags)) {
tagexists++;
}
}
}
}

if (check_incomplete && tagexists != required_tags.children.size()) {
status->status.insert(incomplete);
if (check_incomplete && tagexists != required_tags.children.size()) {
status->status.insert(incomplete);
}
}

return status;
}

Expand Down

0 comments on commit 304ca0b

Please sign in to comment.