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

Method BuildInverseSelection

Views/Infovis/vtkParallelCoordinatesRepresentation.cxx:1790–1842  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1788//------------------------------------------------------------------------------
1789//
1790void vtkParallelCoordinatesRepresentation::BuildInverseSelection()
1791{
1792 vtkSelection* selection = this->GetAnnotationLink()->GetCurrentSelection();
1793
1794 this->InverseSelection->RemoveAllNodes();
1795
1796 int numNodes = selection->GetNumberOfNodes();
1797 if (numNodes <= 0)
1798 {
1799 return;
1800 }
1801
1802 vtkSmartPointer<vtkIdTypeArray> unselected = vtkSmartPointer<vtkIdTypeArray>::New();
1803 std::vector<int> idxs(numNodes, 0);
1804
1805 for (int i = 0; i < this->NumberOfSamples; i++)
1806 {
1807 bool found = false;
1808 for (int j = 0; j < numNodes; j++)
1809 {
1810
1811 vtkIdTypeArray* a =
1812 vtkArrayDownCast<vtkIdTypeArray>(selection->GetNode(j)->GetSelectionList());
1813 if (!a || idxs[j] >= a->GetNumberOfTuples())
1814 {
1815 continue;
1816 }
1817
1818 int numRows = a->GetNumberOfTuples();
1819 while (idxs[j] < numRows && a->GetValue(idxs[j]) < i)
1820 {
1821 idxs[j]++;
1822 }
1823
1824 if (idxs[j] < numRows && a->GetValue(idxs[j]) == i)
1825 {
1826 found = true;
1827 break;
1828 }
1829 }
1830
1831 if (!found)
1832 {
1833 unselected->InsertNextValue(i);
1834 }
1835 }
1836
1837 vtkSmartPointer<vtkSelectionNode> totalSelection = vtkSmartPointer<vtkSelectionNode>::New();
1838 totalSelection->SetSelectionList(unselected);
1839
1840 if (unselected->GetNumberOfTuples())
1841 this->InverseSelection->AddNode(totalSelection);
1842}
1843
1844//------------------------------------------------------------------------------
1845// get the value range of an axis

Callers 2

UpdateSelectionActorsMethod · 0.95
SelectRowsMethod · 0.95

Calls 12

GetAnnotationLinkMethod · 0.80
GetSelectionListMethod · 0.80
SetSelectionListMethod · 0.80
NewFunction · 0.50
GetCurrentSelectionMethod · 0.45
RemoveAllNodesMethod · 0.45
GetNumberOfNodesMethod · 0.45
GetNodeMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetValueMethod · 0.45
InsertNextValueMethod · 0.45
AddNodeMethod · 0.45

Tested by

no test coverage detected