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

Method ExpandSubTree

Views/Infovis/vtkDendrogramItem.cxx:985–1016  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

983
984//------------------------------------------------------------------------------
985void vtkDendrogramItem::ExpandSubTree(vtkIdType vertex)
986{
987 // mark this vertex as "not pruned"
988 vtkUnsignedIntArray* vertexIsPruned =
989 vtkArrayDownCast<vtkUnsignedIntArray>(this->Tree->GetVertexData()->GetArray("VertexIsPruned"));
990 vtkIdType vertexOriginalId = this->GetOriginalId(vertex);
991 vertexIsPruned->SetValue(vertexOriginalId, 0);
992
993 // momentarily revert PrunedTree to the full (unpruned) Tree.
994 this->PrunedTree->DeepCopy(this->Tree);
995
996 // re-prune as necessary. this->Tree has the list of originalIds that
997 // need to be re-pruned.
998 for (vtkIdType originalId = 0; originalId < vertexIsPruned->GetNumberOfTuples(); ++originalId)
999 {
1000 if (vertexIsPruned->GetValue(originalId) > 0)
1001 {
1002 // Find PrunedTree's vertex that corresponds to this originalId.
1003 // Use this to re-collapse the subtrees that were not just expanded.
1004 vtkIdTypeArray* originalIdArray =
1005 vtkArrayDownCast<vtkIdTypeArray>(this->PrunedTree->GetVertexData()->GetArray("OriginalId"));
1006 for (vtkIdType prunedId = 0; prunedId < originalIdArray->GetNumberOfTuples(); ++prunedId)
1007 {
1008 if (originalIdArray->GetValue(prunedId) == originalId)
1009 {
1010 this->CollapseSubTree(prunedId);
1011 break;
1012 }
1013 }
1014 }
1015 }
1016}
1017
1018//------------------------------------------------------------------------------
1019vtkIdType vtkDendrogramItem::GetOriginalId(vtkIdType vertex)

Callers 1

MouseDoubleClickEventMethod · 0.95

Calls 8

GetOriginalIdMethod · 0.95
CollapseSubTreeMethod · 0.95
GetVertexDataMethod · 0.80
GetArrayMethod · 0.45
SetValueMethod · 0.45
DeepCopyMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected