Skip to content

v0.2.48..v0.2.49 changeset LinearCriterion.cpp

Garret Voltz edited this page Oct 2, 2019 · 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 dbe948c..c3938e7 100644
--- a/hoot-core/src/main/cpp/hoot/core/criterion/LinearCriterion.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/criterion/LinearCriterion.cpp
@@ -32,12 +32,17 @@
 #include <hoot/core/schema/OsmSchema.h>
 #include <hoot/core/elements/Relation.h>
 #include <hoot/core/schema/MetadataTags.h>
+#include <hoot/core/elements/Way.h>
 
 namespace hoot
 {
 
 HOOT_FACTORY_REGISTER(ElementCriterion, LinearCriterion)
 
+LinearCriterion::LinearCriterion()
+{
+}
+
 bool LinearCriterion::isSatisfied(const ConstElementPtr& e) const
 {
   bool result = false;
@@ -46,22 +51,28 @@ bool LinearCriterion::isSatisfied(const ConstElementPtr& e) const
   {
     return false;
   }
-
-  const Tags& t = e->getTags();
-
-  if (e->getElementType() == ElementType::Relation)
+  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();
   }
+  else if (e->getElementType() == ElementType::Way)
+  {
+    ConstWayPtr way = std::dynamic_pointer_cast<const Way>(e);
+    if (way->isClosedArea())
+    {
+      return false;
+    }
+  }
 
+  const Tags& t = e->getTags();
   for (Tags::const_iterator it = t.constBegin(); it != t.constEnd(); ++it)
   {
     const SchemaVertex& tv = OsmSchema::getInstance().getTagVertex(it.key() + "=" + it.value());
     uint16_t g = tv.geometries;
-    if (g & (OsmGeometries::LineString | OsmGeometries::ClosedWay) && !(g & OsmGeometries::Area))
+    if (g & (OsmGeometries::LineString /*| OsmGeometries::ClosedWay*/) && !(g & OsmGeometries::Area))
     {
       result = true;
       break;
Clone this wiki locally