Skip to content
Snippets Groups Projects
Commit 55e93590 authored by Raphael Grimm's avatar Raphael Grimm
Browse files

Add ArVizComponentPluginUser::getArvizClient and clean up client code

parent dc1e1876
No related branches found
No related tags found
No related merge requests found
......@@ -19,20 +19,19 @@ namespace armarx::viz
Client(armarx::Component& component, std::string topicNameProperty = "ArVizTopicName")
{
componentName = component.getName();
topic = component.getTopicFromProperty<decltype(topic)>(topicNameProperty);
component.getTopicFromProperty(_topic, topicNameProperty);
}
Client(ManagedIceObject& obj, const std::string& topicName = "ArVizTopic")
{
componentName = obj.getName();
obj.getTopic(topic, topicName);
obj.getTopic(_topic, topicName);
}
static Client createFromTopic(const std::string arvizNamespace, armarx::viz::Topic::ProxyType topic)
{
Client client;
client.componentName = arvizNamespace;
client.topic = topic;
client._topic = topic;
return client;
}
......@@ -46,7 +45,7 @@ namespace armarx::viz
name = name.substr(0, dashPos);
}
client.componentName = name;
client.topic = component.getTopic<decltype(topic)>(topicName);
component.getTopic(client._topic, topicName);
return client;
}
......@@ -129,7 +128,7 @@ namespace armarx::viz
void commit()
{
topic->updateLayers(updates);
_topic->updateLayers(updates);
updates.clear();
}
......@@ -138,9 +137,14 @@ namespace armarx::viz
{
commit(layerContaining(name, std::forward<Ts>(elems)...));
}
const armarx::viz::TopicPrx& topic() const
{
return _topic;
}
private:
std::string componentName;
armarx::viz::TopicPrx topic;
armarx::viz::TopicPrx _topic;
data::LayerUpdateSeq updates;
};
......
......@@ -41,6 +41,15 @@ namespace armarx
armarx::viz::Client arviz;
armarx::viz::Client& getArvizClient()
{
if (!arviz.topic())
{
arviz = createArVizClient();
}
return arviz;
}
private:
armarx::plugins::ArVizComponentPlugin* plugin = 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