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

Method SelectAction3D

Interaction/Widgets/vtkBoxWidget2.cxx:225–286  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

223
224//------------------------------------------------------------------------------
225void vtkBoxWidget2::SelectAction3D(vtkAbstractWidget* w)
226{
227 vtkBoxWidget2* self = reinterpret_cast<vtkBoxWidget2*>(w);
228
229 // We want to compute an orthogonal vector to the plane that has been selected
230 int interactionState = self->WidgetRep->ComputeComplexInteractionState(
231 self->Interactor, self, vtkWidgetEvent::Select3D, self->CallData);
232
233 if (interactionState == vtkBoxRepresentation::Outside)
234 {
235 return;
236 }
237
238 // Test for states that involve face or handle picking here so
239 // selection highlighting doesn't happen if that interaction is disabled.
240 // Non-handle-grabbing transformations are tested in the "Action" methods.
241
242 // Rotation
243 if (interactionState == vtkBoxRepresentation::Rotating && self->RotationEnabled == 0)
244 {
245 return;
246 }
247 // Face Movement
248 if ((interactionState == vtkBoxRepresentation::MoveF0 ||
249 interactionState == vtkBoxRepresentation::MoveF1 ||
250 interactionState == vtkBoxRepresentation::MoveF2 ||
251 interactionState == vtkBoxRepresentation::MoveF3 ||
252 interactionState == vtkBoxRepresentation::MoveF4 ||
253 interactionState == vtkBoxRepresentation::MoveF5) &&
254 self->MoveFacesEnabled == 0)
255 {
256 return;
257 }
258 // Translation
259 if (interactionState == vtkBoxRepresentation::Translating && self->TranslationEnabled == 0)
260 {
261 return;
262 }
263
264 // watch for motion events from this device
265 vtkEventData* edata = static_cast<vtkEventData*>(self->CallData);
266 vtkEventDataDevice3D* edd = edata->GetAsEventDataDevice3D();
267 if (!edd)
268 {
269 return;
270 }
271 self->LastDevice = static_cast<int>(edd->GetDevice());
272
273 // We are definitely selected
274 if (!self->Parent)
275 {
276 self->GrabFocus(self->EventCallbackCommand);
277 }
278
279 self->WidgetState = vtkBoxWidget2::Active;
280 self->WidgetRep->StartComplexInteraction(
281 self->Interactor, self, vtkWidgetEvent::Select3D, self->CallData);
282

Callers

nothing calls this directly

Calls 7

InvokeEventMethod · 0.80
GetDeviceMethod · 0.45
GrabFocusMethod · 0.45
StartInteractionMethod · 0.45

Tested by

no test coverage detected