Skip to content

v0.2.52..v0.2.53 changeset PolygonCriterion.cpp

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/criterion/PolygonCriterion.cpp b/hoot-core/src/main/cpp/hoot/core/criterion/PolygonCriterion.cpp
index b81a80b..0c8e3e4 100644
--- a/hoot-core/src/main/cpp/hoot/core/criterion/PolygonCriterion.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/criterion/PolygonCriterion.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 
 #include "PolygonCriterion.h"
@@ -45,6 +45,8 @@ PolygonCriterion::PolygonCriterion()
 
 bool PolygonCriterion::isSatisfied(const ConstElementPtr& e) const
 {
+  LOG_VART(e->getElementId());
+
   bool result = false;
 
   if (e->getElementType() == ElementType::Node)
@@ -60,24 +62,14 @@ bool PolygonCriterion::isSatisfied(const ConstElementPtr& e) const
   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::ClosedWay | OsmGeometries::Area))
+    if (way->isValidPolygon() && way->isClosedArea())
     {
-      result = true;
-      break;
+      LOG_TRACE("Way is valid closed area; crit satisfied.");
+      return true;
     }
   }
 
+  LOG_VART(result);
   return result;
 }
 
Clone this wiki locally