| 29 | |
| 30 | template <typename Algorithm> |
| 31 | void RenderGraph(vtkRenderer* ren, Algorithm* alg, double xoffset, double yoffset, |
| 32 | const char* vertColorArray, double vertMin, double vertMax, const char* edgeColorArray, |
| 33 | double edgeMin, double edgeMax) |
| 34 | { |
| 35 | VTK_CREATE(vtkGraphToPolyData, graphToPoly); |
| 36 | graphToPoly->SetInputConnection(alg->GetOutputPort()); |
| 37 | |
| 38 | VTK_CREATE(vtkGlyphSource2D, glyph); |
| 39 | glyph->SetGlyphTypeToVertex(); |
| 40 | VTK_CREATE(vtkGlyph3D, vertexGlyph); |
| 41 | vertexGlyph->SetInputConnection(0, graphToPoly->GetOutputPort()); |
| 42 | vertexGlyph->SetInputConnection(1, glyph->GetOutputPort()); |
| 43 | VTK_CREATE(vtkPolyDataMapper, vertexMapper); |
| 44 | vertexMapper->SetInputConnection(vertexGlyph->GetOutputPort()); |
| 45 | vertexMapper->SetScalarModeToUsePointFieldData(); |
| 46 | if (vertColorArray) |
| 47 | { |
| 48 | vertexMapper->SelectColorArray(vertColorArray); |
| 49 | vertexMapper->SetScalarRange(vertMin, vertMax); |
| 50 | } |
| 51 | VTK_CREATE(vtkActor, vertexActor); |
| 52 | vertexActor->SetMapper(vertexMapper); |
| 53 | vertexActor->GetProperty()->SetPointSize(10.0); |
| 54 | vertexActor->SetPosition(xoffset, yoffset, 0.001); |
| 55 | |
| 56 | VTK_CREATE(vtkPolyDataMapper, edgeMapper); |
| 57 | edgeMapper->SetInputConnection(graphToPoly->GetOutputPort()); |
| 58 | edgeMapper->SetScalarModeToUseCellFieldData(); |
| 59 | if (edgeColorArray) |
| 60 | { |
| 61 | edgeMapper->SelectColorArray(edgeColorArray); |
| 62 | edgeMapper->SetScalarRange(edgeMin, edgeMax); |
| 63 | } |
| 64 | VTK_CREATE(vtkActor, edgeActor); |
| 65 | edgeActor->SetMapper(edgeMapper); |
| 66 | edgeActor->SetPosition(xoffset, yoffset, 0); |
| 67 | |
| 68 | ren->AddActor(vertexActor); |
| 69 | ren->AddActor(edgeActor); |
| 70 | } |
| 71 | |
| 72 | int TestBoostAlgorithms(int argc, char* argv[]) |
| 73 | { |
no test coverage detected