From b44372e3cb8863a374bc08ede94a7f82c4ae189f Mon Sep 17 00:00:00 2001 From: Peter Kaiser <peter.kaiser@kit.edu> Date: Sun, 7 Feb 2016 22:08:46 +0100 Subject: [PATCH] DebugDrawer: Finally fixed clearing of line sets --- .../DebugDrawer/DebugDrawerComponent.cpp | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp index 3e8f406fc..b7696a628 100644 --- a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp +++ b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp @@ -448,7 +448,7 @@ namespace armarx auto& layer = requestLayer(d.layerName); - removeBox(d.layerName, d.name); + removeLineSet(d.layerName, d.name); if (!d.active) { @@ -990,14 +990,22 @@ namespace armarx void DebugDrawerComponent::removeLineSet(const std::string& layerName, const std::string& name) { + ScopedRecursiveLockPtr l = getScopedVisuLock(); + + if (!hasLayer(layerName)) { - ScopedRecursiveLockPtr l = getScopedAccumulatedDataLock(); - std::string entryName = "__" + layerName + "__" + name + "__"; - LineSetData& d = accumulatedUpdateData.lineSet[entryName]; - d.layerName = layerName; - d.name = name; - d.active = false; + return; + } + + auto& layer = layers.at(layerName); + + if (layer.addedLineSetVisualizations.find(name) == layer.addedLineSetVisualizations.end()) + { + return; } + + layer.mainNode->removeChild(layer.addedLineSetVisualizations[name]); + layer.addedLineSetVisualizations.erase(name); } void DebugDrawerComponent::removeBox(const std::string& layerName, const std::string& name) @@ -1372,7 +1380,14 @@ namespace armarx void DebugDrawerComponent::removeLineSetVisu(const std::string& layerName, const std::string& lineSetName, const Ice::Current&) { - + { + ScopedRecursiveLockPtr l = getScopedAccumulatedDataLock(); + std::string entryName = "__" + layerName + "__" + lineSetName + "__"; + LineSetData& d = accumulatedUpdateData.lineSet[entryName]; + d.layerName = layerName; + d.name = lineSetName; + d.active = false; + } } void DebugDrawerComponent::removeLineSetDebugLayerVisu(const std::string& lineSetName, const Ice::Current&) @@ -1813,7 +1828,7 @@ namespace armarx removeLineVisu(layerName, i.first); } - for (const auto& i : layer.addedLineVisualizations) + for (const auto& i : layer.addedLineSetVisualizations) { removeLineSetVisu(layerName, i.first); } @@ -2312,6 +2327,7 @@ namespace armarx { int count = layer.second.addedCoordVisualizations.size() + layer.second.addedLineVisualizations.size() + + layer.second.addedLineSetVisualizations.size() + layer.second.addedBoxVisualizations.size() + layer.second.addedTextVisualizations.size() + layer.second.addedSphereVisualizations.size() + -- GitLab