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

Method vtkSphereWidget

Interaction/Widgets/vtkSphereWidget.cxx:27–87  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

25
26//------------------------------------------------------------------------------
27vtkSphereWidget::vtkSphereWidget()
28{
29 this->State = vtkSphereWidget::Start;
30 this->EventCallbackCommand->SetCallback(vtkSphereWidget::ProcessEvents);
31
32 this->Representation = VTK_SPHERE_WIREFRAME;
33
34 // Build the representation of the widget
35 // Represent the sphere
36 this->SphereSource = vtkSphereSource::New();
37 this->SphereSource->SetThetaResolution(16);
38 this->SphereSource->SetPhiResolution(8);
39 this->SphereSource->LatLongTessellationOn();
40 this->SphereMapper = vtkPolyDataMapper::New();
41 this->SphereMapper->SetInputConnection(this->SphereSource->GetOutputPort());
42 this->SphereActor = vtkActor::New();
43 this->SphereActor->SetMapper(this->SphereMapper);
44
45 // controls
46 this->Translation = 1;
47 this->Scale = 1;
48
49 // handles
50 this->HandleVisibility = 0;
51 this->HandleDirection[0] = 1.0;
52 this->HandleDirection[1] = 0.0;
53 this->HandleDirection[2] = 0.0;
54 this->HandleSource = vtkSphereSource::New();
55 this->HandleSource->SetThetaResolution(16);
56 this->HandleSource->SetPhiResolution(8);
57 this->HandleMapper = vtkPolyDataMapper::New();
58 this->HandleMapper->SetInputConnection(this->HandleSource->GetOutputPort());
59 this->HandleActor = vtkActor::New();
60 this->HandleActor->SetMapper(this->HandleMapper);
61
62 // Define the point coordinates
63 double bounds[6];
64 bounds[0] = -0.5;
65 bounds[1] = 0.5;
66 bounds[2] = -0.5;
67 bounds[3] = 0.5;
68 bounds[4] = -0.5;
69 bounds[5] = 0.5;
70
71 // Initial creation of the widget, serves to initialize it
72 this->PlaceWidget(bounds);
73
74 // Manage the picking stuff
75 this->Picker = vtkCellPicker::New();
76 this->Picker->SetTolerance(0.005); // need some fluff
77 this->Picker->AddPickList(this->SphereActor);
78 this->Picker->AddPickList(this->HandleActor);
79 this->Picker->PickFromListOn();
80
81 // Set up the initial properties
82 this->SphereProperty = nullptr;
83 this->SelectedSphereProperty = nullptr;
84 this->HandleProperty = nullptr;

Callers

nothing calls this directly

Calls 10

PlaceWidgetMethod · 0.95
SetThetaResolutionMethod · 0.80
SetPhiResolutionMethod · 0.80
NewFunction · 0.50
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
SetMapperMethod · 0.45
SetToleranceMethod · 0.45
AddPickListMethod · 0.45

Tested by

no test coverage detected