| 47 | }; |
| 48 | |
| 49 | int main(int, char*[]) |
| 50 | { |
| 51 | vtkMutableDirectedGraph* graph = vtkMutableDirectedGraph::New(); |
| 52 | vtkIdType a = graph->AddVertex(); |
| 53 | vtkIdType b = graph->AddChild(a); |
| 54 | vtkIdType c = graph->AddChild(a); |
| 55 | vtkIdType d = graph->AddChild(b); |
| 56 | vtkIdType e = graph->AddChild(c); |
| 57 | vtkIdType f = graph->AddChild(c); |
| 58 | |
| 59 | vtkStringArray* labels = vtkStringArray::New(); |
| 60 | labels->SetName("Label"); |
| 61 | labels->InsertValue(a, "a"); |
| 62 | labels->InsertValue(b, "b"); |
| 63 | labels->InsertValue(c, "c"); |
| 64 | labels->InsertValue(d, "d"); |
| 65 | labels->InsertValue(e, "e"); |
| 66 | labels->InsertValue(f, "f"); |
| 67 | graph->GetVertexData()->AddArray(labels); |
| 68 | |
| 69 | vtkTree* tree = vtkTree::New(); |
| 70 | bool validTree = tree->CheckedShallowCopy(graph); |
| 71 | if (!validTree) |
| 72 | { |
| 73 | std::cout << "ERROR: Invalid tree" << std::endl; |
| 74 | graph->Delete(); |
| 75 | labels->Delete(); |
| 76 | tree->Delete(); |
| 77 | return EXIT_FAILURE; |
| 78 | } |
| 79 | vtkGraphLayoutView* view = vtkGraphLayoutView::New(); |
| 80 | vtkDataRepresentation* rep = view->SetRepresentationFromInput(tree); |
| 81 | vtkViewTheme* theme = vtkViewTheme::CreateMellowTheme(); |
| 82 | view->ApplyViewTheme(theme); |
| 83 | view->SetVertexColorArrayName("VertexDegree"); |
| 84 | view->SetColorVertices(true); |
| 85 | view->SetVertexLabelArrayName("Label"); |
| 86 | view->SetVertexLabelVisibility(true); |
| 87 | |
| 88 | vtkGraphLayoutView* view2 = vtkGraphLayoutView::New(); |
| 89 | vtkDataRepresentation* rep2 = view2->SetRepresentationFromInput(tree); |
| 90 | view2->SetVertexLabelArrayName("Label"); |
| 91 | view2->SetVertexLabelVisibility(true); |
| 92 | |
| 93 | vtkAnnotationLink* link = vtkAnnotationLink::New(); |
| 94 | rep->SetAnnotationLink(link); |
| 95 | rep2->SetAnnotationLink(link); |
| 96 | |
| 97 | ViewUpdater* update = ViewUpdater::New(); |
| 98 | update->AddView(view); |
| 99 | update->AddView(view2); |
| 100 | |
| 101 | view->ResetCamera(); |
| 102 | view2->ResetCamera(); |
| 103 | view->Render(); |
| 104 | view2->Render(); |
| 105 | view->GetInteractor()->Start(); |
| 106 |
nothing calls this directly
no test coverage detected