------------------------------------------------------------------------------
| 1788 | //------------------------------------------------------------------------------ |
| 1789 | // |
| 1790 | void 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 |
no test coverage detected