[Paraview] Example of displaying information

Bryn Lloyd blloyd at vision.ee.ethz.ch
Tue Nov 25 11:01:06 EST 2008


Thanks, I had a look at the code. I think it will make things a lot 
clearer for me. Thanks for making it available.

Cheers, Bryn





Michael Jackson wrote:
> The code can be viewed from the following web address:
> 
> http://www.bluequartz.net/viewvc/CTMD/PVRoboMet
> 
> (It is a slow CVS server so give it some time..)
> 
> I'll try to summarize what you will need to do.
> 
> SERVER SIDE:
>    Within your filter/reader that you want to get information about you 
> will need to implement all the Get* methods of the values that you want 
> information about. For example in the file 
> src/Readers/vtkH5RoboMetReader.h you will see methods such as
> 
> vtkTypeInt32 GetCurrentMosaicWidth();
> vtkTypeInt32 GetCurrentMosaicHeight();
> 
> Once you have those implemented you will next need to add some XML to 
> the Server Manager XML file (pv3_xml/PVRoboMet_PVSM.xml in my code base)
> 
> To expose those 2 properties from above we need to add the following xml 
> (Assuming you already have a complete Server Manager XML file working..)
> 
> <IntVectorProperty name="CurrentMosaicWidth"
>                    command="GetCurrentMosaicWidth"
>            number_of_elements="1"
>                    default_values="0"
>                    information_only="1"  >
>                 <SimpleIntInformationHelper />
> </IntVectorProperty>
> 
> <IntVectorProperty name="CurrentMosaicHeight"
>                    command="GetCurrentMosaicHeight"
>                    number_of_elements="1"
>                    default_values="0"
>                    information_only="1"  >
>                 <SimpleIntInformationHelper />
> </IntVectorProperty>
> 
> That is all for the SERVER SIDE of things. Now for the Client Side of 
> things.
> 
> Take a look in the src/PV3ClientPlugin folder for the source.
> 
> In the pqH5RoboMetReaderPanel class you will see that I inherit from 
> pqLoadedFormObjectPanel. There may be other ways to do this but I used 
> this class. I then created my GUI QtPanel inside of QtDesigner placing 
> my QLabels into my design. Name all the QLabels appropriately for your 
> case.
>   Some of the details of the class can be seen in the .cpp file. In the 
> constructor of the class I get pointers to all the QLabels that I want 
> to set the value for.
> MosaicWidth = qFindChild<QLabel*>(this, "MosaicWidth");
> MosaicHeight = qFindChild<QLabel*>(this, "MosaicHeight");
> 
> Note the value in the double quotes in the arguments is the "Object 
> Name" that you gave to your label in QtDesigner.
> 
> You need to implement the updateInformationAndDomains() methods from the 
> super class to actually get the information from the server side:
> 
> void pqH5RoboMetReaderPanel::updateInformationAndDomains()
> {
>   pqLoadedFormObjectPanel::updateInformationAndDomains();
>   updateIntValue(this->MosaicWidth, "CurrentMosaicWidth", 0);
>   updateIntValue(this->MosaicHeight, "CurrentMosaicHeight", 0);
> }
> 
> and I implemented this method:
> 
> void pqH5RoboMetReaderPanel::updateIntValue(QLabel* qLabel,
>                         QString property,
>                                             qint32 index)
> {
>   vtkSMProperty* smProperty = 
> this->proxy()->GetProperty(property.toAscii());
>   if (NULL == smProperty)
>   {
>     std::string msg = "SMProperty [int] was NULL for ";
>     msg.append(property.toAscii() );
>     DebugTrace(<< msg.c_str() );
>   }
>   vtkSMIntVectorProperty* dvp = 
> vtkSMIntVectorProperty::SafeDownCast(smProperty);
>   int value = dvp->GetElement(index);
>   qLabel->setText(QString::number(value));
> }
> 
> That should get you going enough. Let me know if you have any questions. 
> I guess this might be a good one to put on the Wiki as a tutorial.
> 
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
>             www.bluequartz.net
> 
> 
> On Nov 25, 2008, at 2:44 AM, Bryn Lloyd wrote:
> 
>> Hi Micheal,
>>
>> Yes, I would be interested. Thanks!
>>
>> -Bryn
>>
>>
>>
>> Michael Jackson wrote:
>>> I have some example code that might help if you are interested..
>>> On Nov 24, 2008, at 5:43 PM, Moreland, Kenneth wrote:
>>>> A straightforward way of implementing this would be to add a custom 
>>>> view via a plugin.  The Plugin HowTo Wiki page describes how to make 
>>>> a plugin with a custom view in it.  The implementation to get the 
>>>> data you need to display in the view is up to you.
>>>>
>>>>  http://www.paraview.org/Wiki/Plugin_HowTo
>>>>
>>>> -Ken
>>>>
>>>>
>>>> On 11/24/08 10:24 AM, "Bryn Lloyd" <blloyd at vision.ee.ethz.ch> wrote:
>>>>
>>>> Hi
>>>>
>>>> I have been looking for an example, which would help me understand how
>>>> I can get some information about a dataset and display it in a GUI
>>>> element (e.g. in a QLabel).
>>>>
>>>> E.g. as an example, I would like to have a panel or some other gui
>>>> element, which displays certain values which it gets from a data set
>>>> (e.g. number of lines in a polydata, or total volume of a unstructured
>>>> grid, or ...)
>>>>
>>>> Can you please suggest how I could achieve this?
>>>>
>>>> Thanks,
>>>> Bryn
>>>>
>>>>   ****      Kenneth Moreland
>>>>    ***      Sandia National Laboratories
>>>> ***********
>>>> *** *** ***  email: kmorel at sandia.gov
>>>> **  ***  **  phone: (505) 844-8919
>>>>    ***      web:   http://www.cs.unm.edu/~kmorel
>>>>
>>> _________________________________________________________
>>> Mike Jackson                  mike.jackson at bluequartz.net
>>> BlueQuartz Software                    www.bluequartz.net
>>> Principal Software Engineer                  Dayton, Ohio
>>
>>
>> -- 
>> -------------------------------------------------
>> Bryn Lloyd
>> Computer Vision Laboratory
>> ETH Zürich, Sternwartstrasse 7
>> CH - 8092 Zürich, Switzerland
>> Tel: +41 44 63 27690
>> Fax: +41 44 63 21199
>> -------------------------------------------------
> 
> 
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
> 


-- 
-------------------------------------------------
Bryn Lloyd
Computer Vision Laboratory
ETH Zürich, Sternwartstrasse 7
CH - 8092 Zürich, Switzerland
Tel: +41 44 63 27690
Fax: +41 44 63 21199
-------------------------------------------------


More information about the ParaView mailing list