Skip to content
Snippets Groups Projects
Commit 8b4986e4 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add layer to callback

parent 6f163341
No related branches found
No related tags found
1 merge request!63Add introspection to Arviz
......@@ -250,7 +250,7 @@ namespace armarx::viz
// << "\nTotal: " << (time_remove - time_start1).toMilliSecondsDouble();
// }
emitLayerUpdated(layerID);
emitLayerUpdated(layerID, layer);
}
void CoinVisualizer::update()
......@@ -397,13 +397,13 @@ namespace armarx::viz
}
}
void CoinVisualizer::emitLayerUpdated(const CoinLayerID& layerID)
void CoinVisualizer::emitLayerUpdated(const CoinLayerID& layerID, const CoinLayer& layer)
{
for (auto& callback : layerUpdatedCallbacks)
{
if (callback)
{
callback(layerID);
callback(layerID, layer);
}
}
}
......
......@@ -37,7 +37,7 @@ namespace armarx::viz
}
CoinLayer(CoinLayer&& other)
: node(other.node)
: node(other.node), elements(std::move(other.elements))
{
other.node = nullptr;
}
......@@ -57,6 +57,7 @@ namespace armarx::viz
{
node = other.node;
other.node = nullptr;
elements = std::move(other.elements);
}
SoSeparator* node = nullptr;
......@@ -111,7 +112,7 @@ namespace armarx::viz
std::vector<CoinLayerID> getLayerIDs();
void emitLayersChanged(std::vector<CoinLayerID> const& layerIDs);
void emitLayerUpdated(CoinLayerID const& layerID);
void emitLayerUpdated(CoinLayerID const& layerID, CoinLayer const& layer);
void onUpdateSuccess(data::LayerUpdates const& updates);
void onUpdateFailure(Ice::Exception const& ex);
......@@ -139,7 +140,7 @@ namespace armarx::viz
std::function<void(std::vector<CoinLayerID> const&)> layersChangedCallback;
/// A layer's data has changed.
std::vector<std::function<void(CoinLayerID const& layerID)>> layerUpdatedCallbacks;
std::vector<std::function<void(CoinLayerID const& layerID, CoinLayer const& layer)>> layerUpdatedCallbacks;
};
}
......@@ -29,11 +29,12 @@ namespace armarx
void LayerInfoTreeWidget::registerVisualizerCallbacks(viz::CoinVisualizer& visualizer)
{
visualizer.layerUpdatedCallbacks.emplace_back([this](const viz::CoinLayerID & layer)
visualizer.layerUpdatedCallbacks.emplace_back(
[this](const viz::CoinLayerID & layerID, const viz::CoinLayer & layer)
{
ARMARX_INFO << "Received callback";
if (layer == this->layerID)
if (layerID == this->layerID)
{
ARMARX_CHECK_EQUAL(this->layer, &layer) << "Layer pointer is not expected to change.";
this->update();
}
});
......
......@@ -45,7 +45,7 @@ namespace armarx
QTreeWidget* widget;
viz::CoinLayerID layerID = {"", ""};
viz::CoinLayer* layer = nullptr;
const viz::CoinLayer* layer = nullptr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment