Skip to content

v0.2.52..v0.2.53 changeset OsmApiChangeset.cpp

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/io/OsmApiChangeset.cpp b/hoot-core/src/main/cpp/hoot/core/io/OsmApiChangeset.cpp
index c63d49d..e425d27 100644
--- a/hoot-core/src/main/cpp/hoot/core/io/OsmApiChangeset.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/io/OsmApiChangeset.cpp
@@ -365,6 +365,41 @@ void XmlChangeset::updateChangeset(const QString &changes)
   }
 }
 
+void XmlChangeset::updateChangeset(const ChangesetInfoPtr& changeset_info)
+{
+  //  Iterate the three changeset type arrays looking for elements to mark
+  for (int current_type = ChangesetType::TypeCreate; current_type != ChangesetType::TypeMax; ++current_type)
+  {
+    //  Set the relation's status to failed
+    for (ChangesetInfo::iterator it = changeset_info->begin(ElementType::Relation, (ChangesetType)current_type);
+         it != changeset_info->end(ElementType::Relation, (ChangesetType)current_type); ++it)
+    {
+      //  Finalize the relation
+      _allRelations[*it]->setStatus(ChangesetElement::ElementStatus::Finalized);
+      //  Update the processed count
+      _processedCount++;
+    }
+    //  Set the way's status to failed
+    for (ChangesetInfo::iterator it = changeset_info->begin(ElementType::Way, (ChangesetType)current_type);
+         it != changeset_info->end(ElementType::Way, (ChangesetType)current_type); ++it)
+    {
+      //  Finalize the way
+      _allWays[*it]->setStatus(ChangesetElement::ElementStatus::Finalized);
+      //  Update the processed count
+      _processedCount++;
+    }
+    //  Set the node's status to failed
+    for (ChangesetInfo::iterator it = changeset_info->begin(ElementType::Node, (ChangesetType)current_type);
+         it != changeset_info->end(ElementType::Node, (ChangesetType)current_type); ++it)
+    {
+      //  Finalize the node
+      _allNodes[*it]->setStatus(ChangesetElement::ElementStatus::Finalized);
+      //  Update the processed count
+      _processedCount++;
+    }
+  }
+}
+
 bool XmlChangeset::fixChangeset(const QString& update)
 {
   /* <osm>
@@ -1224,7 +1259,7 @@ bool XmlChangeset::matchesChangesetClosedFailure(const QString& hint)
 {
   //  Changeset conflict: The changeset 49514098 was closed at 2020-01-08 16:28:56 UTC
   QRegularExpression reg(
-        "Changeset conflict: The changeset ([0-9]+) was closed.*",
+        ".*The changeset ([0-9]+) was closed.*",
         QRegularExpression::CaseInsensitiveOption);
   QRegularExpressionMatch match = reg.match(hint);
   return match.hasMatch();
Clone this wiki locally