[Paraview] vtkGeometryRepresentation and server-mode

Stephan Rogge Stephan.Rogge at tu-cottbus.de
Wed Jun 5 09:29:33 EDT 2013


Ok, after sleeping on it one night I found the solution by myself. For those
who were faced with the same question I'd liked to share my code snipped
that does work for me. It takes all Pipeline Source objects and search for
the right GeometryRepresenation property. If there is an easier way feel
free to correct me. My goal was to find the geometry representation for a
certain pipeline source (named "Plane1"). Since I wasn't able to find a
direct mapping between source and representation proxies, I had to compare
all input proxies of the GeometryRepresentation proxies. Hope this is
useful.

pqServerManagerModel* smmodel =
pqApplicationCore::instance()->getServerManagerModel();

QList<pqPipelineSource*> sources = smmodel->findItems<pqPipelineSource*>();

vtkSMSessionProxyManager* proxySM =
vtkSMProxyManager::GetProxyManager()->GetActiveSessionProxyManager();

unsigned int numReps = proxySM->GetNumberOfProxies("representations");
vtkSMProxy *srcProxy = proxySM->GetProxy("sources", "Plane1");

for(int i = 0; i < sources.size(); i++)
   {
  // get source
  pqPipelineSource* source = sources.at(i);          
  QString name = source->getSMName();

  if(name == QString("Plane1"))
    {
    vtkSMProxy *geoRepProxy = NULL;

    for(int i = 0; i < numReps; i++)
      {
      vtkSMProxy *proxy = proxySM->GetProxy("representations", 
        proxySM->GetProxyName("representations", i));

      vtkSMProxyProperty *poxyProp1 =
        vtkSMProxyProperty::SafeDownCast(proxy->GetProperty("Input"));
      vtkSMProxy *tmpSrcProxy = poxyProp1->GetProxy(0);
      if(tmpSrcProxy == srcProxy)
         {
         geoRepProxy = proxy;
         break;
         }
      }
   }
}


Best regards,
Stephan



More information about the ParaView mailing list