[vtkusers] Highlight lines in a parallel coordinates view and add new lines

C P cp.user.vtk at gmail.com
Thu Feb 20 18:55:29 EST 2014


Hi,

1) I would like to highlight lines (change their color) in a parallel
coordinates view. When I select lines with the mouse, they are just painted
over the coordinate axes but not highlighted. Since I have thousands of
lines and they are on top of each other, I can not see at all which ones
are selected.

Here are the most important parts of the code:

 // Convert the features to vtk arrays
  for (int i = 0; i < feature_space_dim; ++i)
  {
    // The axis label is just i
    ostringstream label; label << i;
    axis_labels[i] = label.str();

    // Create the array
    vtkDoubleArray* array = vtkDoubleArray::New();
    array->SetName(axis_labels[i].c_str());
    array->SetNumberOfComponents(1);

    // Fill the array with data
    for (vector<FeatureSpace::Feature>::const_iterator f =
features.begin(); f != features.end(); ++f)
      array->InsertNextValue((*f)[i]);

    // Save the array to the poly data object
    data->GetPointData()->AddArray(array);
    array->Delete();
  }

  // Create the object to visualize
  vtkParallelCoordinatesRepresentation* rep =
vtkParallelCoordinatesRepresentation::New();
  rep->SetInputData(data);
  for (int i = 0; i < feature_space_dim; ++i)
    rep->SetInputArrayToProcess(i, 0, 0, 0, axis_labels[i].c_str());
  rep->SetLineColor(1, 0, 0);
  rep->SetAxisColor(0, 1, 0);
  rep->SetLineOpacity(0.5);
  rep->Update();
  // Set the right range for the parallel coordinates
  for (int i = 0; i < feature_space_dim; ++i)
    rep->SetRangeAtPosition(i, features_range);
  // Connect the annotation link to the parallel coordinates representation
  rep->SetAnnotationLink(m_annotation_link);

  // Some updates
  m_parallel_coordinates_view->RemoveAllRepresentations();
  m_parallel_coordinates_view->Update();
  m_parallel_coordinates_view->SetRepresentation(rep);
  m_parallel_coordinates_view->ResetCamera();

  // Clean up
  data->Delete();
  rep->Delete();


2) How can I add lines to the view? These lines should have different color.

Thank you very much.

Regards
cp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140220/f33aadaf/attachment.html>


More information about the vtkusers mailing list