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

Method ComplexInteraction

Rendering/VR/vtkVRMenuRepresentation.cxx:126–173  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

124
125//------------------------------------------------------------------------------
126void vtkVRMenuRepresentation::ComplexInteraction(
127 vtkRenderWindowInteractor*, vtkAbstractWidget*, unsigned long event, void* calldata)
128{
129 switch (event)
130 {
131 case vtkWidgetEvent::Select3D:
132 {
133 this->VisibilityOff();
134 long count = 0;
135 for (auto& menu : this->Menus)
136 {
137 if (count == std::lround(this->CurrentOption))
138 {
139 menu->Command->Execute(this, vtkWidgetEvent::Select3D,
140 static_cast<void*>(const_cast<char*>(menu->Name.c_str())));
141 }
142 count++;
143 }
144 }
145 break;
146
147 case vtkWidgetEvent::Move3D:
148 {
149 vtkEventData* edata = static_cast<vtkEventData*>(calldata);
150 vtkEventDataDevice3D* ed = edata->GetAsEventDataDevice3D();
151 if (!ed)
152 {
153 return;
154 }
155 const double* dir = ed->GetWorldDirection();
156 // adjust CurrentOption based on controller orientation
157 vtkVRRenderWindow* renWin =
158 static_cast<vtkVRRenderWindow*>(this->Renderer->GetRenderWindow());
159 double* vup = renWin->GetPhysicalViewUp();
160 double dot = vtkMath::Dot(dir, vup);
161 this->CurrentOption -= dot * 0.12;
162 if (this->CurrentOption < 0)
163 {
164 this->CurrentOption = 0.0;
165 }
166 else if (this->CurrentOption > this->Menus.size() - 1)
167 {
168 this->CurrentOption = this->Menus.size() - 1;
169 }
170 this->BuildRepresentation();
171 }
172 }
173}
174
175//------------------------------------------------------------------------------
176void vtkVRMenuRepresentation::ReleaseGraphicsResources(vtkWindow* w)

Callers 3

SelectMenuActionMethod · 0.45
MoveActionMethod · 0.45
MoveAction3DMethod · 0.45

Calls 8

BuildRepresentationMethod · 0.95
GetPhysicalViewUpMethod · 0.80
DotFunction · 0.50
ExecuteMethod · 0.45
c_strMethod · 0.45
GetRenderWindowMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected