Skip to content
Snippets Groups Projects

[fix] Allow applying a property to a proxy of the same group in LoadLidarState

Merged MelanieCarriere requested to merge allowApplyPropertyToTheProxyGroup into master
All threads resolved!
3 files
+ 47
3
Compare changes
  • Side-by-side
  • Inline
Files
3
  • During loadLidarState function, the property was applied only if a proxy of the same name of the one saved was found in the pipeline.
    For exemple :
    If you save the LidarState with a LidarPacketInterpreter i1 and you open a file using a LidarPacketInterpreter i2
    The properties saved from i1 couldn't be applied to i2.
    This commit allows applying the property to a proxy of the same group.
    
    If the property is not found in this proxy, the message is still display to the user.
@@ -72,7 +72,7 @@ void lqLoadLidarStateReaction::onTriggered()
std::vector<propertyInfo> propertyInfo;
try
{
this->ParseJsonContent(contents, "",propertyInfo);
this->ParseJsonContent(contents, "", propertyInfo);
}
catch(std::exception e)
{
@@ -91,9 +91,17 @@ void lqLoadLidarStateReaction::onTriggered()
std::string propertyName = currentProp.propertyName;
vtkSMProxy* lidarProxy = SearchProxyByName(lidarCurrentProxy, proxyName);
// If the proxy is not found, search proxy from the same proxygroup
// ex : Apply a property from an other LidarPacketInterpreter to the current one
if (lidarProxy == nullptr)
{
std::string message = "No matching proxy found. Property " + propertyName + " of the proxy " + proxyName + " not applied";
std::string proxyGroupName = GetGroupName(lidarCurrentProxy, proxyName);
lidarProxy = SearchProxyByGroupName(lidarCurrentProxy, proxyGroupName);
}
if (lidarProxy == nullptr)
{
std::string message = "No matching proxy found. Property " + propertyName + " of the proxy " + proxyName + " of group "+ proxyGroupName + " not applied";
QMessageBox::information(nullptr, tr(""), tr(message.c_str()) );
}
else
@@ -115,7 +123,7 @@ void lqLoadLidarStateReaction::onTriggered()
//-----------------------------------------------------------------------------
void lqLoadLidarStateReaction::ParseJsonContent(Json::Value contents, std::string ObjectName,
std::vector<propertyInfo>& propertiesInfo)
std::vector<propertyInfo>& propertiesInfo)
{
for(auto it = contents.begin(); it != contents.end(); it++)
{
Loading