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

Method initializeVTK

Examples/GUI/QML/QtQuickBoxWidget/main.cpp:50–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 };
49
50 vtkUserData initializeVTK(vtkRenderWindow* renderWindow) override
51 {
52 // Create our vtk user data
53 vtkNew<Data> vtk;
54
55 // Create a cone pipeline and add it to the view
56 vtkNew<vtkConeSource> cone;
57 cone->SetHeight(3.0);
58 cone->SetRadius(1.0);
59 cone->SetResolution(10);
60
61 vtkNew<vtkPolyDataMapper> mapper;
62 mapper->SetInputConnection(cone->GetOutputPort());
63
64 vtkNew<vtkNamedColors> colors;
65 vtkNew<vtkActor> actor;
66 actor->SetMapper(mapper);
67 actor->GetProperty()->SetColor(colors->GetColor3d("Bisque").GetData());
68
69 vtkNew<vtkRenderer> renderer;
70 renderer->AddActor(actor);
71 renderer->ResetCamera();
72 renderer->SetBackground(colors->GetColor3d("LightBlue").GetData());
73
74 renderWindow->AddRenderer(renderer);
75 renderWindow->SetMultiSamples(16);
76
77 vtk->boxWidget->SetInteractor(renderWindow->GetInteractor());
78 vtk->boxWidget->SetPlaceFactor(1.25);
79 vtk->boxWidget->GetOutlineProperty()->SetColor(colors->GetColor3d("Gold").GetData());
80 vtk->boxWidget->SetProp3D(actor);
81 vtk->boxWidget->PlaceWidget();
82 vtk->boxWidget->On();
83
84 vtkNew<Callback> callback;
85 vtk->boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);
86
87 return vtk;
88 }
89};
90vtkStandardNewMacro(MyVtkItem::Data);
91vtkStandardNewMacro(MyVtkItem::Callback);

Callers

nothing calls this directly

Calls 15

GetColor3dMethod · 0.80
SetMultiSamplesMethod · 0.80
SetHeightMethod · 0.45
SetRadiusMethod · 0.45
SetResolutionMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
SetMapperMethod · 0.45
SetColorMethod · 0.45
GetPropertyMethod · 0.45
GetDataMethod · 0.45
AddActorMethod · 0.45

Tested by

no test coverage detected