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

Function PerformAlgorithm

Infovis/Core/Testing/Cxx/TestGraphAlgorithms.cxx:22–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#define VTK_CREATE(type, name) vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
21
22void PerformAlgorithm(vtkRenderer* ren, vtkAlgorithm* alg, double xoffset, double yoffset,
23 const char* vertColorArray, double vertMin, double vertMax, const char* edgeColorArray = nullptr,
24 double edgeMin = 0, double edgeMax = 0)
25{
26 VTK_CREATE(vtkGraphToPolyData, graphToPoly);
27 graphToPoly->SetInputConnection(alg->GetOutputPort());
28
29 VTK_CREATE(vtkGlyphSource2D, glyph);
30 glyph->SetGlyphTypeToVertex();
31 VTK_CREATE(vtkGlyph3D, vertexGlyph);
32 vertexGlyph->SetInputConnection(0, graphToPoly->GetOutputPort());
33 vertexGlyph->SetInputConnection(1, glyph->GetOutputPort());
34 VTK_CREATE(vtkPolyDataMapper, vertexMapper);
35 vertexMapper->SetInputConnection(vertexGlyph->GetOutputPort());
36 vertexMapper->SetScalarModeToUsePointFieldData();
37 if (vertColorArray)
38 {
39 vertexMapper->SelectColorArray(vertColorArray);
40 vertexMapper->SetScalarRange(vertMin, vertMax);
41 }
42 VTK_CREATE(vtkActor, vertexActor);
43 vertexActor->SetMapper(vertexMapper);
44 vertexActor->GetProperty()->SetPointSize(10.0);
45 vertexActor->SetPosition(xoffset, yoffset, 0.001);
46
47 VTK_CREATE(vtkPolyDataMapper, edgeMapper);
48 edgeMapper->SetInputConnection(graphToPoly->GetOutputPort());
49 edgeMapper->SetScalarModeToUseCellFieldData();
50 if (edgeColorArray)
51 {
52 edgeMapper->SelectColorArray(edgeColorArray);
53 edgeMapper->SetScalarRange(edgeMin, edgeMax);
54 }
55 VTK_CREATE(vtkActor, edgeActor);
56 edgeActor->SetMapper(edgeMapper);
57 edgeActor->SetPosition(xoffset, yoffset, 0);
58
59 ren->AddActor(vertexActor);
60 ren->AddActor(edgeActor);
61}
62
63int TestGraphAlgorithms(int argc, char* argv[])
64{

Callers 1

TestGraphAlgorithmsFunction · 0.85

Calls 9

SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
SelectColorArrayMethod · 0.45
SetScalarRangeMethod · 0.45
SetMapperMethod · 0.45
SetPointSizeMethod · 0.45
GetPropertyMethod · 0.45
SetPositionMethod · 0.45
AddActorMethod · 0.45

Tested by

no test coverage detected