v0.2.54..v0.2.55 changeset LinearCriterion.cpp
Garret Voltz edited this page Aug 14, 2020
·
1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/criterion/LinearCriterion.cpp b/hoot-core/src/main/cpp/hoot/core/criterion/LinearCriterion.cpp
index 7dbcd1a..2879510 100644
--- a/hoot-core/src/main/cpp/hoot/core/criterion/LinearCriterion.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/criterion/LinearCriterion.cpp
@@ -46,6 +46,7 @@ LinearCriterion::LinearCriterion()
bool LinearCriterion::isSatisfied(const ConstElementPtr& e) const
{
LOG_VART(e->getElementId());
+ //LOG_VART(e);
bool result = false;
if (e->getElementType() == ElementType::Node)
@@ -54,10 +55,8 @@ bool LinearCriterion::isSatisfied(const ConstElementPtr& e) const
}
else if (e->getElementType() == ElementType::Relation)
{
- ConstRelationPtr r = std::dynamic_pointer_cast<const Relation>(e);
- result |= r->getType() == MetadataTags::RelationMultilineString();
- result |= r->getType() == MetadataTags::RelationRoute();
- result |= r->getType() == MetadataTags::RelationBoundary();
+ ConstRelationPtr relation = std::dynamic_pointer_cast<const Relation>(e);
+ result = isLinearRelation(relation);
}
else if (e->getElementType() == ElementType::Way)
{
@@ -74,6 +73,10 @@ bool LinearCriterion::isSatisfied(const ConstElementPtr& e) const
{
const SchemaVertex& tv = OsmSchema::getInstance().getTagVertex(it.key() + "=" + it.value());
uint16_t g = tv.geometries;
+
+ LOG_VART(g & OsmGeometries::LineString);
+ LOG_VART(g & OsmGeometries::Area);
+
if (g & OsmGeometries::LineString && !(g & OsmGeometries::Area))
{
result = true;
@@ -85,5 +88,15 @@ bool LinearCriterion::isSatisfied(const ConstElementPtr& e) const
return result;
}
+bool LinearCriterion::isLinearRelation(const ConstRelationPtr& relation)
+{
+ return relation->getType() == MetadataTags::RelationMultilineString() ||
+ relation->getType() == MetadataTags::RelationRoute() ||
+ relation->getType() == MetadataTags::RelationBoundary() ||
+ relation->getType() == MetadataTags::RelationRouteMaster() ||
+ relation->getType() == MetadataTags::RelationSuperRoute() ||
+ relation->getType() == MetadataTags::RelationRestriction();
+}
+
}