[Paraview] Object Panel <-> Model Communication

Nehme Bilal nbilal at mirarco.org
Sun Jan 4 03:05:12 EST 2009


Thanks for your responses.

I know how to create a custom panel and how to use 
"SimpleDoubleInformationHelper". My problem is how to get 
a "DoubleArrayInformationHelper" from a vtkDoubleArray 
with unknown size and send it to my custom panel. The 
compoment of this vtkDoubleArray ( called "VolumesArray" 
here) will be added in ResquestData().

I found a way to do it:

XML:
       <StringVectorProperty
          name="VolumesArray"
          command="GetVolumesArray"
          information_only="1">
         <SimpleStringInformationHelper/>
       </StringVectorProperty>

In RequestData(), I will set VolumesArray to some values 
like "1223.44|2244.09|233232|..." Note the "|" separator 
after each volume.

In my .ui, I created a QLineEdit with the same name 
("VolumesArray").

In my pqCustomPanel.cxx:

pqComputeVolumes::pqComputeVolumes(pqProxy* pxy, QWidget* 
p) :
   pqLoadedFormObjectPanel(":/CustomWidget/pqComputeVolumes.ui", 
pxy, p)
   {

		this->volumes = 
this->findChild<QLineEdit*>("VolumesArray");
		this->volumesList = 
this->findChild<QListWidget*>("volumesList");

		this->volumes->setVisible(false);

		QObject::connect(this->volumes, SIGNAL(textChanged(const 
QString&)),
			this, SLOT(onShowVolumesList(const 
QString&)),Qt::QueuedConnection);

	  this->linkServerManagerProperties();	
	}


void pqComputeVolumes::onShowVolumesList(const QString& 
text)
{
	int i=0;
	QStringList list = 
text.split("|",QString::SkipEmptyParts);

	foreach( QString v, list)
	{
		i++;
		this->volumesList->addItem("Volume " + 
QString::number(i) + "             " + v);
	}
}

This works fine for me but I think there is an easier way.


Nehme




On Sat, 03 Jan 2009 21:08:46 -0700
  Clinton Stimpson <clinton at elemtech.com> wrote:
> 
> If its because its an information property, I think 
>adding a show="1" attribute to the property will make it 
>show up.
> 
> Clint
> 
> Utkarsh Ayachit wrote:
>> You will have to create a custom panel. Look at the 
>>custom panel
>> example in Examples/Plugin.
>>
>> Utkarsh
>>
>> On Sat, Jan 3, 2009 at 4:29 PM, Nehme Bilal 
>><nbilal at mirarco.org> wrote:
>>   
>>> Hi,
>>>
>>> I am trying to use "DoubleArrayInformationHelper" to get 
>>>a vtkDoubleArray
>>> from server side and show it in my filter GUI.
>>> XML code:
>>>
>>>      <DoubleVectorProperty
>>>         name="volumesArray"
>>>         command="GetVolumesArray"
>>>         information_only="1">
>>>        <DoubleArrayInformationHelper/>
>>>      </DoubleVectorProperty>
>>>
>>> C++:
>>>        vtkDoubleArray* GetVolumesArray()
>>>        {
>>>                return this->volumesArray;
>>>        }
>>> The current code don't show anything in the GUI.
>>> I would like to see the content of volumesArray in a 
>>>Table, List or a Tree
>>> widget.
>>>
>>> How can I do that ?
>>>
>>> Nehme
>>>
>>>
>>>
>>>     
>>>> From: Utkarsh Ayachit <utkarsh.ayachit at kitware.com>
>>>> Subject: Re: [Paraview] Object Panel <-> Model 
>>>>Communication
>>>> To: rafaelmarch3 at yahoo.com
>>>> Cc: paraview at paraview.org
>>>> Date: Tuesday, December 16, 2008, 2:17 PM
>>>>
>>>> To get back "values" from the server, you can use either
>>>> "information
>>>> properties" or "information objects".
>>>>
>>>> Information properties are properites with 
>>>>information_only="1" set
>>>> in
>>>> the XML (eg. in 
>>>>Servers/ServerManager/Resources/rendering.xml the
>>>> "Camera" proxy has "CameraPositionInfo" as an 
>>>>information
>>>> property).
>>>> Such properties need an "InformationHelper" which knows 
>>>>how to obtain
>>>> the values from the server. For simple Get*() methods, 
>>>>you can use the
>>>> <SimpleDoubleInformationHelper/> or 
>>>><SimpleIntInformationHelper />
>>>> etc. based on the type of the property. Complex 
>>>>information helpers
>>>> can be written as well. Look at
>>>> TimeStepsInformationHelper
>>>> (vtkSMTimeStepsInformationHelper.h|cxx) as an example.
>>>>
>>>> Information objects are used to get data from server 
>>>>which cannot be
>>>> simply put in a property for example information about 
>>>>the data object
>>>> produced by a filter (vtkPVDataInformation). These are
>>>> vtkPVInformation subclasses. You can create you own 
>>>>vtkPVInformation
>>>> subclass that knows how to collect information and then
>>>> serialize/deserialize it for transfer to the client from 
>>>>the server
>>>> (if needed). To gather such information, one uses
>>>> vtkProcessModule::GatherInformation(vtkIdType 
>>>>connectionID,
>>>> vtkTypeUInt32 serverFlags, vtkPVInformation* info, 
>>>>vtkClientServerID
>>>> id) where "id" is vtkSMProxy::GetID() returned for the 
>>>>proxy from
>>>> which you want to collect the information.
>>>>
>>>> In your case, information property may be an easier 
>>>>solution -- if I
>>>> understand your problem correctly.
>>>>
>>>> There is a pqServerManagerModel instance
>>>> accessible as
>>>> pqApplicationCore::instance()->getServerManagerModel() 
>>>>that can be
>>>> used to access sources/filters their representations, 
>>>>views etc. Take
>>>> a look at Qt/Core/pqServerManagerModel.h for the API. 
>>>>That should help
>>>> you access the visualization pipeline.
>>>>
>>>> "How to get, for instance, the ids of the nodes which 
>>>>are displayed
>>>> after the application of a filter to the model ?"
>>>> Not sure I understand what you mean by that. Can you 
>>>>please elaborate?
>>>>
>>>> Utkarsh
>>>>
>>>> On Tue, Dec 16, 2008 at 6:38 AM, Rafael March 
>>>><rafaelmarch3 at yahoo.com>
>>>> wrote:
>>>>       
>>>>> Hey all,
>>>>>
>>>>> I'm programming a filter with a custom Object Panel,
>>>>> and I'm feeling a little bit lost about the ParaView 
>>>>>architecture and
>>>>> code design.
>>>>>
>>>>> My great problem is the comunication between the
>>>>> Object Panel and the Model. I know I can't have a 
>>>>>pointer to my
>>>>> vtkUnstructuredGrid displayed, 'cause they are not
>>>>>         
>>>> necessarily at the
>>>>       
>>>>> same machine or process. I also know that I'm able to 
>>>>>send information
>>>>> to the model through properties, since I can get the 
>>>>>vtkSMProxy in my
>>>>> panel. But what about the way back ? Is there a way to 
>>>>>send information
>>>>> from the display view to the panel ? How can I display 
>>>>>in a QTable, for
>>>>> instance, the nodes of my model which have some property 
>>>>>equals to 1 ?
>>>>>
>>>>> Another problem is the Visualization Pipeline: is there 
>>>>>a way to
>>>>>         
>>>> "walk" on
>>>>       
>>>>> it ?
>>>>> I mean, if I have a filter name, am I able to get the 
>>>>>the filter no
>>>>> matter where it is in the Pipeline ?
>>>>>
>>>>> Sorry for the mess with the questions. I hope I made it 
>>>>>clear and someone
>>>>> can help me ! :)
>>>>>
>>>>> Regards,
>>>>> Rafael March.
>>>>>
>>>>> _______________________________________________
>>>>> ParaView mailing list
>>>>> ParaView at paraview.org
>>>>>
>>>>>         
>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>       
>>>>>         
>>>> _______________________________________________
>>>> ParaView mailing list
>>>> ParaView at paraview.org
>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>
>>>>
>>>>       
>>> _______________________________________________
>>> ParaView mailing list
>>> ParaView at paraview.org
>>> http://www.paraview.org/mailman/listinfo/paraview
>>>
>>>     
>> _______________________________________________
>> ParaView mailing list
>> ParaView at paraview.org
>> http://www.paraview.org/mailman/listinfo/paraview
>>   
> 
> 



More information about the ParaView mailing list