Skip to content

v0.2.50..v0.2.51 changeset OsmSchema.cpp

Garret Voltz edited this page Jan 15, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/schema/OsmSchema.cpp b/hoot-core/src/main/cpp/hoot/core/schema/OsmSchema.cpp
index 10c6330..a5a8eac 100644
--- a/hoot-core/src/main/cpp/hoot/core/schema/OsmSchema.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/schema/OsmSchema.cpp
@@ -1541,7 +1541,7 @@ Tags OsmSchema::getAliasTags(const Tags& tags)
        itr != schemaVertices.end(); ++itr)
   {
     SchemaVertex vertex = *itr;
-    tagsToReturn.addTags(Tags::kvpListToTags(vertex.aliases));
+    tagsToReturn.add(Tags::kvpListToTags(vertex.aliases));
   }
   return tagsToReturn;
 }
@@ -1770,6 +1770,31 @@ double OsmSchema::score(const SchemaVertex& v1, const SchemaVertex& v2)
   return score(v1.name, v2.name);
 }
 
+double OsmSchema::score(const QString& kvp, const Tags& tags)
+{
+  double maxScore = 0.0;
+  for (Tags::const_iterator tagItr = tags.begin(); tagItr != tags.end(); ++tagItr)
+  {
+    const QString key = tagItr.key().trimmed();
+    const QString value = tagItr.value().trimmed();
+    if (!key.isEmpty() && !value.isEmpty())
+    {
+      //QString kvp2 = tagItr.key() + "=" + tagItr.value();
+      QString kvp2 = "";
+      kvp2.append(key);
+      kvp2.append("=");
+      kvp2.append(value);
+      const double scoreVal = score(kvp, kvp2);
+      if (scoreVal > maxScore)
+      {
+        maxScore = scoreVal;
+      }
+    }
+
+  }
+  return maxScore;
+}
+
 double OsmSchema::scoreOneWay(const QString& kvp1, const QString& kvp2)
 {
   return d->score(kvp1, kvp2);
Clone this wiki locally