[Paraview] Populating a servermanager list widget with string array

Girish Ramesh rgirish28 at gmail.com
Thu Aug 21 08:25:14 EDT 2014


Dear Utkarsh,

Thank you for the email. I tried modelling it along the example mentioned.
This is the code that I have written but it segfaults for no reason that is
apparent to me.

C++ Code:

ReadUALGrid::ReadUALGrid()
{
  //this->FileName = NULL;
  this->SetNumberOfInputPorts(0);
  this->SetNumberOfOutputPorts(1);
  this->trial=vtkSmartPointer<vtkDataArraySelection>::New();
  this->trial->AddArray("hello");
  this->trial->AddArray("world");
  this->trial->EnableAllArrays();
}


}

vtkDataArraySelection * ReadUALGrid::GetCPOListSelection(){

return this->trial.GetPointer();
}


int ReadUALGrid::GetCPOListArrayStatus(char *name){

return this->trial->GetArraySetting(name);
}

void ReadUALGrid::SetCPOListArrayStatus(const char * name, int status){

        if (status){
                this->trial->EnableArray(name);
        }
        else{
                this->trial->DisableArray(name);
        }


}


int ReadUALGrid::GetNumberOfCPOListArrays(){


return this->trial->GetNumberOfArrays();
}


const char * ReadUALGrid::GetCPOListArrayName(int index){

return this->trial->GetArrayName(index);

}


XML:

<StringVectorProperty
       name="CPOList"
       label="CPOList"
       command="SetCPOListArrayStatus"
       number_of_elements="0"
       number_of_elements_per_command="2"
       element_types="2 0"
       information_property="CPOListArrayStatus"
       panel_visibility="default">
       <ArraySelectionDomain name="array_list">
        <RequiredProperties>
        <Property function="ArrayList"
                name="CPOListArrayStatus"/>
        </RequiredProperties>
        </ArraySelectionDomain>
        <Documentation>
          This property specifies the CPO on the UAL Database.
        </Documentation>
     </StringVectorProperty>


     <StringVectorProperty
       name="CPOListArrayStatus"
       information_only="1">
        <ArraySelectionInformationHelper attribute_name="CPOList"/>
     </StringVectorProperty>


Any idea where I am making the mistake? Can I initialize a
DataArraySelection that way? Thanks.

Regards,
Girish


On 20 August 2014 22:49, Utkarsh Ayachit <utkarsh.ayachit at kitware.com>
wrote:

> Try modeling this on "Point/Cell" array selection properties provided
> by readers (in readers.xml). You'd need to use the
> ArraySelectionDomain, the StringListDomain won't work.
>
> e.g.
>       <StringVectorProperty command="SetPointArrayStatus"
>                             element_types="2 0"
>                             information_property="PointArrayInfo"
>                             label="Point Arrays"
>                             name="PointArrayStatus"
>                             number_of_elements="0"
>                             number_of_elements_per_command="2"
>                             repeat_command="1">
>         <ArraySelectionDomain name="array_list">
>           <RequiredProperties>
>             <Property function="ArrayList"
>                       name="PointArrayInfo" />
>           </RequiredProperties>
>         </ArraySelectionDomain>
>         <Documentation>This property lists which point-centered arrays to
>         read.</Documentation>
>       </StringVectorProperty>
>
>
>
> On Wed, Aug 20, 2014 at 9:37 AM, Girish Ramesh <rgirish28 at gmail.com>
> wrote:
> > Hi,
> >
> > I would like to use the panel_widget option in the servermanager XML
> with a
> > String Array, but whenever I try to do it, it doesn't display anything.
> So,
> > I'm wondering how it can be done even though it works with a normal
> > StringVectorProperty for the default widget. Thank you. The XML and
> > screenshot is given below.
> >
> > XML:
> >
> > <StringVectorProperty
> >        name="CPOList"
> >        label="CPOList"
> >        command="SetCPOList"
> >        number_of_elements="1"
> >        panel_visibility="default"
> >        panel_widget="list">
> >        <StringListDomain name="array_list">
> >         <RequiredProperties>
> >         <Property function="ArrayList"
> >                 name="CPOListInfo"/>
> >         </RequiredProperties>
> >         </StringListDomain>
> >         <Documentation>
> >           This property specifies the CPO on the UAL Database.
> >         </Documentation>
> >      </StringVectorProperty>
> >
> >
> >      <StringVectorProperty
> >        name="CPOListInfo"
> >        label="CPOListInfo"
> >        command="GetCPOList"
> >        information_only="1">
> >         <StringArrayHelper />
> >      </StringVectorProperty>
> >
> > Screenshot of option working with default widget:
> >
> > https://imageshack.com/i/eyhM3mFKp
> >
> > Regards,
> > Girish
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the ParaView Wiki at:
> > http://paraview.org/Wiki/ParaView
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/paraview
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140821/711b0d82/attachment.html>


More information about the ParaView mailing list