diff --git a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp index 3e8f406fc695943e33ade62a3405bfab1022d187..b7696a628ecbba97f223fae013581de9a5be5b5e 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() +