[Paraview] Assigning string labels to datasets?

Berk Geveci berk.geveci at kitware.com
Fri Mar 7 07:05:42 EST 2008


Yup. It is on our list of top-priority items. It will be in 3.4.

-berk

On 3/7/08, OSHIMA Takuya <oshima at eng.niigata-u.ac.jp> wrote:
> Hi,
>
>  As I play with the new composite dataset structures, I came to think
>  it would indeed be nice if ParaView3 can handle datasets with string
>  labels ("Porous Material," "Air," ... , rather than "DataSet 0,"
>  "DataSet 1," ...). I mean, for example, VTK/IO/vtkEnsight6Reader.cxx
>  has a fragment of code to assign its output a string label.
>
>   vtkCharArray* nmArray = vtkCharArray::New();
>   nmArray->SetName("Name");
>   size_t len = strlen(name);
>   nmArray->SetNumberOfTuples(static_cast<vtkIdType>(len)+1);
>   char* copy = nmArray->GetPointer(0);
>   memcpy(copy, name, len);
>   copy[len] = '\0';
>   output->GetFieldData()->AddArray(nmArray);
>   nmArray->Delete();
>
>  I can do the same thing to each member dataset in a MultiBlockDataSet,
>  but it doesn't seem there's a way to display the labels in
>  ParaView. However if I rewrite the code a bit for Information tab of
>  Object Inspector (of the CVS head)
>
>  --- Qt/Components/pqProxyInformationWidget.cxx.orig     2008-02-20 08:56:03.000000000 +0900
>  +++ Qt/Components/pqProxyInformationWidget.cxx  2008-03-07 18:40:06.000000000 +0900
>  @@ -387,7 +387,8 @@
>   {
>    QTreeWidgetItem* node = 0;
>
>  -  QString label = info? info->GetPrettyDataTypeString() : "NA";
>  +  QString label = info?
>  +    (parentItem? info->GetName() : info->GetPrettyDataTypeString()): "NA";
>    if (parentItem)
>      {
>      node = new QTreeWidgetItem(parentItem, QStringList(label));
>
>  or the one for Properties tab of the Extract Block filter,
>
>  --- Qt/Components/pqSignalAdaptorCompositeTreeWidget.cxx.orig   2008-03-01 10:59:23.000000000 +0900
>  +++ Qt/Components/pqSignalAdaptorCompositeTreeWidget.cxx        2008-03-07 18:12:23.000000000 +0900
>  @@ -395,7 +395,15 @@
>    for (unsigned int cc=0; cc < cinfo->GetNumberOfChildren(); cc++)
>      {
>      vtkPVDataInformation* childInfo = cinfo->GetDataInformation(cc);
>  -    QString childLabel = QString("DataSet %1").arg(cc);
>  +    QString childLabel;
>  +    if(childInfo)
>  +      {
>  +      childLabel = QString("DataSet %1  %2").arg(cc).arg(childInfo->GetName());
>  +      }
>  +    else
>  +      {
>  +      childLabel = QString("DataSet %1").arg(cc);
>  +      }
>      bool is_leaf = true;
>      if (childInfo && childInfo->GetCompositeDataInformation()->GetDataIsComposite())
>        {
>
>  I can see the string labels in addition to dataset numbers. Searching
>  the list archives of ParaView and VTK I found several similar
>  discussions held in the past. The modifications above are just
>  concepts, not ment to be applied to the real source, but would things
>  like this be an option?
>
>  Takuya
>  _______________________________________________
>  ParaView mailing list
>  ParaView at paraview.org
>  http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list