-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.53..v0.2.54 changeset RemoveElementByEid.cpp
Garret Voltz edited this page Mar 31, 2020
·
1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/ops/RemoveElementByEid.cpp b/hoot-core/src/main/cpp/hoot/core/ops/RemoveElementByEid.cpp
index b789057..53a9158 100644
--- a/hoot-core/src/main/cpp/hoot/core/ops/RemoveElementByEid.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/ops/RemoveElementByEid.cpp
@@ -22,7 +22,7 @@
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
- * @copyright Copyright (C) 2016, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2016, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
*/
#include "RemoveElementByEid.h"
@@ -36,13 +36,17 @@ namespace hoot
{
RemoveElementByEid::RemoveElementByEid(bool doCheck) :
-_doCheck(doCheck)
+_doCheck(doCheck),
+_removeNodeFully(true),
+_removeOnlyUnusedNodes(false)
{
}
RemoveElementByEid::RemoveElementByEid(ElementId eId, bool doCheck) :
_eIdToRemove(eId),
-_doCheck(doCheck)
+_doCheck(doCheck),
+_removeNodeFully(true),
+_removeOnlyUnusedNodes(false)
{
}
@@ -51,7 +55,8 @@ void RemoveElementByEid::apply(OsmMapPtr& map)
if (ElementType::Node == _eIdToRemove.getType().getEnum())
{
// Remove node fully (Removes node from relations & ways, then removes node from map)
- RemoveNodeByEid removeNode(_eIdToRemove.getId(), _doCheck, true);
+ RemoveNodeByEid removeNode(
+ _eIdToRemove.getId(), _doCheck, _removeNodeFully, _removeOnlyUnusedNodes);
removeNode.apply(map);
}
else if (ElementType::Way == _eIdToRemove.getType().getEnum())
@@ -82,5 +87,13 @@ void RemoveElementByEid::removeElementNoCheck(OsmMapPtr map, ElementId eId)
elementRemover.apply(map);
}
+void RemoveElementByEid::removeUnusedElementsOnly(OsmMapPtr map, ElementId eId)
+{
+ RemoveElementByEid elementRemover(eId, true);
+ elementRemover.setRemoveNodeFully(false);
+ elementRemover.setRemoveOnlyUnusedNodes(true);
+ elementRemover.apply(map);
+}
+
}