[Paraview-developers] String/Array List domain regular expression
Biddiscombe, John A.
biddisco at cscs.ch
Wed Apr 14 04:46:53 EDT 2010
Question :
The string array name regex stuff seems to work very nicely. Will check in later today I hope. But here's a problem
I'd like the user to be able to specify a string (in some config dialog created by the plugin) and have the ArrayListDomain, or StringListDomain, pick up the regex from the user.
If I create a custom panel for a particular filter, I reckon I can get the ArrayListDomain from the filter proxy property.
Is there another way that doesn't involve extra work?
thanks
JB
> -----Original Message-----
> From: paraview-developers-bounces at paraview.org [mailto:paraview-developers-
> bounces at paraview.org] On Behalf Of Biddiscombe, John A.
> Sent: 06 April 2010 15:35
> To: paraview-developers at paraview.org
> Subject: [Paraview-developers] String/Array List domain regular expression
>
> I get a lot of data where scalars are defined by names like Density,
> density, rho, RHO, m_c_rho, rho_ - or any other possibly name that vaguely
> describes the data.
>
>
>
> I've added a couple of new fields to the string array XML - an example is
> best
>
> name="Yarray"
>
> command="SetYarray"
>
> default_values="Coords_1"
>
> default_regex_delimiter=","
>
> default_regex=".*Y,.*y,.*oords_1"
>
> number_of_elements="1">
>
>
>
> Now the regex is used to search all possible scalar arrays to find the first
> match. Not very complex, but my first tests show that for reasonably simple
> regexs (and data arrays), all seems good and I'm now able to save several
> array selection clicks by getting the default found for me.
>
>
>
> In order to make this work, I added to vtkSMStringVectorProperty
>
> // Description:
>
> // If this string vector has regular expression searches attached
>
> // then provide a hook so that the a string list domain can pass in a list
>
> // of possible strings from which a default can be selected
>
> bool GetDefaultUsesRegex();
>
>
>
> // Description:
>
> // Using the regular expression list, pick one of the possible string
>
> // to be used as the default value
>
> const char* GetDefaultValue(vtkStringList *list);
>
>
>
> and some tweaks to vtkSMStringListDomain so that the calls are made
> appropriately.
>
> unfortunately, in order to pick a default, the vtkSMStringListDomain has to
> copy all of its internal array values into a vtkStringList, pass them to the
> VectorProperty, let it choose one and then destroy the list afterwards. This
> is because we are not allowed to use vtkstd::anything in headers and the
> list is already stored internally as a vtkstd::vector< ... >
>
>
>
> I don't like it.
>
>
>
> however, when I'm sure I've not broken anything I'll check the stuff in. I'd
> be grateful if one of the ServerManager Proxy whizzes from Kitware would
> take a glance at the code when it goes in to see if there's a tidier
> (/better) way of doing it. I'm never quite sure of the
> ArrayListDomain/StringListDomain/StringVectorProperty/etc etc as to who is
> supposed to own what.
>
>
>
> Thanks
>
>
>
> JB
>
>
>
>
>
> --
>
> John Biddiscombe, email:biddisco @ cscs.ch
>
> http://www.cscs.ch/ <http://www.cscs.ch/>
>
> CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
>
> Via Cantonale, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82
>
>
More information about the Paraview-developers
mailing list