-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.50..v0.2.51 changeset CopyMapSubsetOp.cpp
Garret Voltz edited this page Jan 15, 2020
·
1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/ops/CopyMapSubsetOp.cpp b/hoot-core/src/main/cpp/hoot/core/ops/CopyMapSubsetOp.cpp
index 0953ea4..8072ba4 100644
--- a/hoot-core/src/main/cpp/hoot/core/ops/CopyMapSubsetOp.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/ops/CopyMapSubsetOp.cpp
@@ -28,8 +28,8 @@
#include <hoot/core/elements/ConstElementVisitor.h>
#include <hoot/core/util/Log.h>
-#include <hoot/core/visitors/UniqueElementIdVisitor.h>
#include <hoot/core/visitors/FilteredVisitor.h>
+#include <hoot/core/visitors/UniqueElementIdVisitor.h>
using namespace std;
@@ -70,17 +70,24 @@ public:
_from->getElement(eid)->visitRo(*_from, v);
// finally, add this element to the map.
_to->addElement(ee);
+ // Add all of the elements affected
+ _elementsAdded.insert(v._elementsAdded.begin(), v._elementsAdded.end());
}
+ // Add this element to the list
+ _elementsAdded.insert(eid);
}
}
virtual QString getDescription() const { return ""; }
+ std::set<ElementId>& getElementsAdded() { return _elementsAdded; }
+
private:
ConstOsmMapPtr _from;
OsmMapPtr _to;
ElementId _exempt;
+ std::set<ElementId> _elementsAdded;
};
CopyMapSubsetOp::CopyMapSubsetOp(const ConstOsmMapPtr& from, const set<ElementId>& eids) :
@@ -102,6 +109,12 @@ CopyMapSubsetOp::CopyMapSubsetOp(const ConstOsmMapPtr& from, const vector<long>&
}
}
+CopyMapSubsetOp::CopyMapSubsetOp(const ConstOsmMapPtr& from, ElementId eid)
+ : _from(from)
+{
+ _eids.insert(eid);
+}
+
CopyMapSubsetOp::CopyMapSubsetOp(const ConstOsmMapPtr& from, ElementId eid1, ElementId eid2) :
_from(from)
{
@@ -118,7 +131,7 @@ _crit(crit)
_from->visitRo(idVis);
_eids = getIdVis->getElementSet();
LOG_VARD(_eids.size());
- LOG_VARD(_eids);
+ LOG_VART(_eids);
}
void CopyMapSubsetOp::apply(OsmMapPtr &map)
@@ -134,6 +147,8 @@ void CopyMapSubsetOp::apply(OsmMapPtr &map)
}
_from->getElement(*it)->visitRo(*_from, v);
}
+ std::set<ElementId> eids = v.getElementsAdded();
+ _eidsCopied.insert(eids.begin(), eids.end());
}
}