Skip to content
Snippets Groups Projects
Commit 6eed5610 authored by MelanieCarriere's avatar MelanieCarriere
Browse files

Merge branch 'allowApplyPropertyToTheProxyGroup' into 'master'

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

See merge request !149
parents 73e40f4f a11a9010
No related branches found
No related tags found
1 merge request!149[fix] Allow applying a property to a proxy of the same group in LoadLidarState
Pipeline #202110 failed
Pipeline: LidarView

#202111

    ...@@ -91,6 +91,14 @@ void lqLoadLidarStateReaction::onTriggered() ...@@ -91,6 +91,14 @@ void lqLoadLidarStateReaction::onTriggered()
    std::string propertyName = currentProp.propertyName; std::string propertyName = currentProp.propertyName;
    vtkSMProxy* lidarProxy = SearchProxyByName(lidarCurrentProxy, proxyName); 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 proxyGroupName = GetGroupName(lidarCurrentProxy, proxyName);
    lidarProxy = SearchProxyByGroupName(lidarCurrentProxy, proxyGroupName);
    }
    if (lidarProxy == nullptr) if (lidarProxy == nullptr)
    { {
    std::string message = "No matching proxy found. Property " + propertyName + " of the proxy " + proxyName + " not applied"; std::string message = "No matching proxy found. Property " + propertyName + " of the proxy " + proxyName + " not applied";
    ......
    ...@@ -6,9 +6,13 @@ ...@@ -6,9 +6,13 @@
    #include "vtkLidarReader.h" #include "vtkLidarReader.h"
    #include "vtkLidarStream.h" #include "vtkLidarStream.h"
    #include <vtkSMSessionProxyManager.h>
    #include <vtkSMBooleanDomain.h> #include <vtkSMBooleanDomain.h>
    #include <vtkSMPropertyIterator.h> #include <vtkSMPropertyIterator.h>
    #include <vtkSMPropertyHelper.h> #include <vtkSMPropertyHelper.h>
    #include <vtkSMProxyDefinitionManager.h>
    #include <vtkSMSessionProxyManager.h>
    #include <vtkPVProxyDefinitionIterator.h>
    #include <pqApplicationCore.h> #include <pqApplicationCore.h>
    #include <pqPipelineSource.h> #include <pqPipelineSource.h>
    ...@@ -206,3 +210,34 @@ void UpdateProperty(vtkSMProxy * proxy, const std::string &propNameToFind, ...@@ -206,3 +210,34 @@ void UpdateProperty(vtkSMProxy * proxy, const std::string &propNameToFind,
    } }
    } }
    } }
    //-----------------------------------------------------------------------------
    std::string GetGroupName(vtkSMProxy * existingProxy, const std::string & proxyToFindName)
    {
    vtkSMSessionProxyManager* pxm = existingProxy->GetSessionProxyManager();
    if(!pxm)
    {
    std::cout << "Couldn't get the SM Session Proxy Manager" << std::endl;
    return "";
    }
    vtkSMProxyDefinitionManager* pxdm = pxm->GetProxyDefinitionManager();
    if(!pxdm)
    {
    std::cout << "Couldn't get the SM Proxy Definition Manager" << std::endl;
    return "";
    }
    vtkPVProxyDefinitionIterator* iter = pxdm->NewIterator();
    for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())
    {
    if(strcmp(iter->GetProxyName(), proxyToFindName.c_str()) == 0)
    {
    return iter->GetGroupName();
    }
    }
    return "";
    }
    ...@@ -60,4 +60,12 @@ vtkSMProperty* GetPropertyFromProxy(vtkSMProxy * proxy, const std::string &propN ...@@ -60,4 +60,12 @@ vtkSMProperty* GetPropertyFromProxy(vtkSMProxy * proxy, const std::string &propN
    void UpdateProperty(vtkSMProxy * proxy, const std::string & propNameToFind, void UpdateProperty(vtkSMProxy * proxy, const std::string & propNameToFind,
    const std::vector<std::string> & values); const std::vector<std::string> & values);
    /**
    * @brief GetGroupName Get the name of the first group where appear a proxy
    * @param existingProxy a proxy of the pipeline, use to get the ProxyDefinitionManager
    * @param proxyToFindName name of the proxy to look for
    * @return the name of the first group where a corresponding proxy is found
    */
    std::string GetGroupName(vtkSMProxy * existingProxy, const std::string & proxyToFindName);
    #endif // LQHELPER_H #endif // LQHELPER_H
    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