<div dir="ltr"><div><div><div>Sorry but I'm still getting a seg fault and I'm not sure why. This is the relevant code within the plugin. Thanks. <br><br></div>XML: <br><br> <StringVectorProperty<br> name="CPOList"<br>
label="CPOList"<br> command="SetCPOList"<br> number_of_elements_per_command="1"<br> information_property="CPOListInfo"<br> panel_visibility="default"><br>
<StringListDomain name="array_list"><br> <RequiredProperties><br> <Property function="ArrayList"<br> name="CPOListInfo"/><br> </RequiredProperties><br>
</StringListDomain><br><br> <Documentation><br> This property helps select the CPO.<br> </Documentation><br> </StringVectorProperty><br><br> <StringVectorProperty<br>
name="CPOListInfo"<br> label="CPOListInfo"<br> command="GetCPOList"<br> information_only="1" ><br> <StringArrayHelper /><br> </StringVectorProperty><br>
<br></div>C++:<br><br>vtkStringArray* ReadUALGrid::GetCPOList(){<br><br><br> vtkNew<vtkStringArray> labels;<br><br><br> labels->InsertNextValue("hello");<br> labels->InsertNextValue("world");<br>
<br><br> return labels.GetPointer();<br><br>}<br><br>void ReadUALGrid::SetCPOList(int index)<br><br>{<br><br>}<br><br><br></div>I'm just using a random vtkStringArray for testing, but it still segfaults. Thank you for the help. <br>
<br>Regards,<br>Girish<br><div><div><br><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 18 August 2014 15:31, Girish Ramesh <span dir="ltr"><<a href="mailto:rgirish28@gmail.com" target="_blank">rgirish28@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank you very much Cory for your help. I guess the forum shall be peppered with any more problems I have!<br>
<br>Regards, <br>Girish<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On 18 August 2014 15:29, Cory Quammen <span dir="ltr"><<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Girish,<br>
<br>
Unfortunately, there isn't much documentation about the server manager<br>
XMLs. Finding something that looks like what you are trying to do in<br>
the UI and then tracking it down in the XML is currently the best way.<br>
<br>
Thanks,<br>
Cory<br>
<div><div><br>
On Mon, Aug 18, 2014 at 9:25 AM, Girish Ramesh <<a href="mailto:rgirish28@gmail.com" target="_blank">rgirish28@gmail.com</a>> wrote:<br>
> Dear Cory,<br>
><br>
> Thank you very much. Your hints were very helpful. Option 2 was what I was<br>
> looking for, but I didn't use the StringListDomain in the second property to<br>
> connect the information. So my plugin was seg faulting repeatedly even<br>
> though I thought my logic was correct. Also, is there any resource to find<br>
> more about servermanager xmls and how to connect the different classes<br>
> together or is the only option to look at examples. Sorry for the trouble<br>
> :)Thanks again!<br>
><br>
> Regards,<br>
> Girish<br>
><br>
><br>
><br>
><br>
> On 18 August 2014 15:16, Cory Quammen <<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>> wrote:<br>
>><br>
>> Girish,<br>
>><br>
>> Is the list of strings fixed, or can it vary depending on the file?<br>
>> There are three things you can do depending on what you need:<br>
>><br>
>> 1). If you have a fixed set of strings, you can use an<br>
>> IntVectorProperty, and set its domain as a list of strings with an<br>
>> associated integer, i.e., an enumeration.<br>
>><br>
>> <IntVectorProperty command="SetVariableType"<br>
>> default_values="0"<br>
>> name="VariableType"<br>
>> number_of_elements="1"><br>
>> <EnumerationDomain name="enum"><br>
>> <Entry text="Variable 1"<br>
>> value="0" /><br>
>> <Entry text="Variable 2"<br>
>> value="1" /><br>
>> <Entry text="Variable 3"<br>
>> value="2" /><br>
>> </EnumerationDomain><br>
>> </IntVectorProperty><br>
>><br>
>> This generates a combo box in the UI, and only one element can be<br>
>> selected at a time. It will expect your reader to have methods with<br>
>> the signature<br>
>><br>
>> virtual void SetVariableType(int i);<br>
>> virtual int GetVariableType();<br>
>><br>
>> Within your reader, you can use this enumeration value to do whatever<br>
>> you'd like.<br>
>><br>
>> 2). If you just have a list of strings generated in your reader and<br>
>> want to enable the selection of one, you can use a<br>
>> StringVectorProperty with a StringListDomain, e.g.<br>
>><br>
>> <StringVectorProperty command="GetAllDimensions"<br>
>> information_only="1"<br>
>> name="DimensionInfo"><br>
>> <StringArrayHelper /><br>
>> </StringVectorProperty><br>
>> <StringVectorProperty animatelable="0"<br>
>> command="SetDimensions"<br>
>> name="Dimensions"<br>
>> number_of_elements="1"<br>
>> panel_visibility="default"><br>
>> <StringListDomain name="array_list"><br>
>> <RequiredProperties><br>
>> <Property function="ArrayList"<br>
>> name="DimensionInfo" /><br>
>> </RequiredProperties><br>
>> </StringListDomain><br>
>> </StringVectorProperty><br>
>><br>
>> The first property here is an "information-only" property. ParaView<br>
>> will invoke the method "GetAllDimensions" in your reader which should<br>
>> return a vtkStringArray. The second property is responsible for<br>
>> displaying the string array as a combobox, and invokes the method<br>
>> "SetDimensions" with the value selected in the combobox. You need the<br>
>> StringListDomain in the second property to connect the<br>
>> information-only property to the second property.<br>
>><br>
>> 3). If you need to populate the list depending on what is in the file<br>
>> and be able to select/deselect list entries (e.g., to pick which<br>
>> variables are loaded from the file), then see the XML file<br>
>><br>
>> ParaView/ParaViewCore/ServerManager/SMApplication/Resources/readers.xml<br>
>><br>
>> and search for the SourceProxy named "FlashReaderCore". You'll find<br>
>> this XML property definition:<br>
>><br>
>> <!-- Array Selection GUI Component --><br>
>> <StringVectorProperty information_only="1"<br>
>> name="CellArrayInfo"><br>
>> <ArraySelectionInformationHelper attribute_name="Cell" /><br>
>> </StringVectorProperty><br>
>> <StringVectorProperty command="SetCellArrayStatus"<br>
>> element_types="2 0"<br>
>> information_property="CellArrayInfo"<br>
>> label="Cell Arrays"<br>
>> name="CellArrayStatus"<br>
>> number_of_elements="0"<br>
>> number_of_elements_per_command="2"<br>
>> repeat_command="1"><br>
>> <ArraySelectionDomain name="array_list"><br>
>> <RequiredProperties><br>
>> <Property function="ArrayList"<br>
>> name="CellArrayInfo" /><br>
>> </RequiredProperties><br>
>> </ArraySelectionDomain><br>
>> <Documentation>This property lists which cell-centered arrays to<br>
>> read.</Documentation><br>
>> </StringVectorProperty><br>
>> <StringVectorProperty information_only="1"<br>
>> name="PointArrayInfo"><br>
>> <ArraySelectionInformationHelper attribute_name="Point" /><br>
>> </StringVectorProperty><br>
>><br>
>> This XML is responsible for showing in the GUI the list of<br>
>> cell-associated arrays. In the vtkAMRFlashReader, there are a number<br>
>> of<br>
>> methods that are defined to make this work. (These are actually<br>
>> defined in vtkAMRFlashReader's parent class, vtkAMRBaseReader.h)<br>
>><br>
>> // Description:<br>
>> // Get the data array selection tables used to configure which data<br>
>> // arrays are loaded by the reader.<br>
>> vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);<br>
>><br>
>> // Description:<br>
>> // Get the number of point or cell arrays available in the input.<br>
>> int GetNumberOfCellArrays();<br>
>><br>
>> // Description:<br>
>> // Get the name of the point or cell array with the given index in<br>
>> // the input.<br>
>> const char* GetCellArrayName(int index);<br>
>><br>
>> // Description:<br>
>> // Get/Set whether the point or cell array with the given name is to<br>
>> // be read.<br>
>> int GetCellArrayStatus(const char* name);<br>
>> void SetCellArrayStatus(const char* name, int status);<br>
>><br>
>> The first method listed above might not be necessary in your reader;<br>
>> I'm not sure. The rest are necessary.<br>
>><br>
>> Note in this XML and method definitions that "Cell" is the name of the<br>
>> given to the association of array the reader can load. You can replace<br>
>> all occurrences of "Cell" with whatever name is more appropriate for<br>
>> your needs.<br>
>><br>
>> I hope that helps,<br>
>> Cory<br>
>><br>
>> On Mon, Aug 18, 2014 at 5:46 AM, Girish Ramesh <<a href="mailto:rgirish28@gmail.com" target="_blank">rgirish28@gmail.com</a>><br>
>> wrote:<br>
>> > Hi,<br>
>> ><br>
>> > I have been breaking my head over this problem for a while now as there<br>
>> > are<br>
>> > no servermanager xml explanations anywhere. So, what I want to<br>
>> > accomplish is<br>
>> > populate a GUI list with a vtkStringArray and be able to select strings<br>
>> > within the list in order to fill a variable . Can someone please help me<br>
>> > or<br>
>> > point me in the right direction in this task? I am writing my own plugin<br>
>> > reader as you may have understood, but I'm stuck at this point for a<br>
>> > while.<br>
>> > Thanks.<br>
>> ><br>
>> > Regards,<br>
>> > Girish<br>
>> ><br>
>> > _______________________________________________<br>
>> > Paraview-developers mailing list<br>
>> > <a href="mailto:Paraview-developers@paraview.org" target="_blank">Paraview-developers@paraview.org</a><br>
>> > <a href="http://public.kitware.com/mailman/listinfo/paraview-developers" target="_blank">http://public.kitware.com/mailman/listinfo/paraview-developers</a><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>