| 124 | } |
| 125 | |
| 126 | void vtkExpandSelectedGraph::BFSExpandSelection(vtkIdTypeArray* indexArray, vtkGraph* graph) |
| 127 | { |
| 128 | // For each vertex in the selection get its adjacent vertices |
| 129 | VTK_CREATE(vtkInEdgeIterator, inIt); |
| 130 | VTK_CREATE(vtkOutEdgeIterator, outIt); |
| 131 | |
| 132 | vtkAbstractArray* domainArr = graph->GetVertexData()->GetAbstractArray("domain"); |
| 133 | std::set<vtkIdType> indexSet; |
| 134 | for (int i = 0; i < indexArray->GetNumberOfTuples(); ++i) |
| 135 | { |
| 136 | // First insert myself |
| 137 | indexSet.insert(indexArray->GetValue(i)); |
| 138 | |
| 139 | // Now insert all adjacent vertices |
| 140 | graph->GetInEdges(indexArray->GetValue(i), inIt); |
| 141 | while (inIt->HasNext()) |
| 142 | { |
| 143 | vtkInEdgeType e = inIt->Next(); |
| 144 | if (this->UseDomain && this->Domain && |
| 145 | domainArr->GetVariantValue(e.Source).ToString() != this->Domain) |
| 146 | { |
| 147 | continue; |
| 148 | } |
| 149 | indexSet.insert(e.Source); |
| 150 | } |
| 151 | graph->GetOutEdges(indexArray->GetValue(i), outIt); |
| 152 | while (outIt->HasNext()) |
| 153 | { |
| 154 | vtkOutEdgeType e = outIt->Next(); |
| 155 | if (this->UseDomain && this->Domain && domainArr && |
| 156 | domainArr->GetVariantValue(e.Target).ToString() != this->Domain) |
| 157 | { |
| 158 | continue; |
| 159 | } |
| 160 | indexSet.insert(e.Target); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | // Delete any entries in the current selection list |
| 165 | indexArray->Reset(); |
| 166 | |
| 167 | // Convert the stl set into the selection list |
| 168 | std::set<vtkIdType>::iterator I; |
| 169 | for (I = indexSet.begin(); I != indexSet.end(); ++I) |
| 170 | { |
| 171 | indexArray->InsertNextValue(*I); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | void vtkExpandSelectedGraph::PrintSelf(ostream& os, vtkIndent indent) |
| 176 | { |
no test coverage detected