MCPcopy Create free account
hub / github.com/Kitware/VTK / SelectRows

Method SelectRows

Views/Infovis/vtkParallelCoordinatesRepresentation.cxx:1683–1786  ·  view source on GitHub ↗

------------------------------------------------------------------------------ does the actual selection, including joining the new selection with the old selection of the same class with various set operations.

Source from the content-addressed store, hash-verified

1681// does the actual selection, including joining the new selection with the
1682// old selection of the same class with various set operations.
1683void vtkParallelCoordinatesRepresentation::SelectRows(
1684 vtkIdType brushClass, vtkIdType brushOperator, vtkIdTypeArray* newSelectedIds)
1685{
1686 // keep making new selection nodes (and initializing them) until a node for
1687 // brushClass actually exists.
1688 vtkSelection* selection = this->GetAnnotationLink()->GetCurrentSelection();
1689 vtkSelectionNode* node = selection->GetNode(brushClass);
1690 while (!node)
1691 {
1692 vtkSmartPointer<vtkSelectionNode> newnode = vtkSmartPointer<vtkSelectionNode>::New();
1693 newnode->GetProperties()->Set(vtkSelectionNode::CONTENT_TYPE(), vtkSelectionNode::PEDIGREEIDS);
1694 newnode->GetProperties()->Set(vtkSelectionNode::FIELD_TYPE(), vtkSelectionNode::ROW);
1695 selection->AddNode(newnode);
1696
1697 // initialize the selection data
1698 vtkSmartPointer<vtkIdTypeArray> selectedIds = vtkSmartPointer<vtkIdTypeArray>::New();
1699 newnode->SetSelectionList(selectedIds);
1700
1701 // initialize everything for drawing the selection
1702 vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
1703 vtkSmartPointer<vtkActor2D> actor = vtkSmartPointer<vtkActor2D>::New();
1704 vtkSmartPointer<vtkPolyDataMapper2D> mapper = vtkSmartPointer<vtkPolyDataMapper2D>::New();
1705 mapper.TakeReference(this->InitializePlotMapper(polyData, actor));
1706
1707 this->I->SelectionData.push_back(polyData);
1708 this->I->SelectionMappers.push_back(mapper);
1709 this->I->SelectionActors.push_back(actor);
1710
1711 this->AddPropOnNextRender(actor);
1712
1713 node = selection->GetNode(brushClass);
1714 }
1715
1716 vtkIdTypeArray* oldSelectedIds = vtkArrayDownCast<vtkIdTypeArray>(node->GetSelectionList());
1717
1718 // no selection list yet? that shouldn't be possible...it was allocated above
1719 if (!oldSelectedIds)
1720 {
1721 return;
1722 }
1723
1724 vtkSmartPointer<vtkIdTypeArray> outSelectedIds = vtkSmartPointer<vtkIdTypeArray>::New();
1725
1726 int numOldIds = oldSelectedIds->GetNumberOfTuples();
1727 int numNewIds = newSelectedIds->GetNumberOfTuples();
1728 switch (brushOperator)
1729 {
1730 case vtkParallelCoordinatesView::VTK_BRUSHOPERATOR_ADD:
1731 // add all of the old ones, clobbering the class if it's in the new array
1732 for (int i = 0; i < numOldIds; i++)
1733 {
1734 outSelectedIds->InsertNextValue(oldSelectedIds->GetValue(i));
1735 }
1736
1737 // add all of the new ones, as long as they aren't in the old array
1738 for (int i = 0; i < numNewIds; i++)
1739 {
1740 if (oldSelectedIds->LookupValue(newSelectedIds->GetValue(i)) == -1)

Callers 3

LassoSelectMethod · 0.95
AngleSelectMethod · 0.95
FunctionSelectMethod · 0.95

Calls 15

InitializePlotMapperMethod · 0.95
BuildInverseSelectionMethod · 0.95
GetAnnotationLinkMethod · 0.80
SetSelectionListMethod · 0.80
AddPropOnNextRenderMethod · 0.80
GetSelectionListMethod · 0.80
UpdateSelectionMethod · 0.80
NewFunction · 0.50
SortFunction · 0.50
GetCurrentSelectionMethod · 0.45
GetNodeMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected