------------------------------------------------------------------------------
| 95 | |
| 96 | //------------------------------------------------------------------------------ |
| 97 | void vtkCameraPathWidget::SelectAction(vtkAbstractWidget* w) |
| 98 | { |
| 99 | // We are in a static method, cast to ourself |
| 100 | vtkCameraPathWidget* self = vtkCameraPathWidget::SafeDownCast(w); |
| 101 | |
| 102 | // Get the event position |
| 103 | int X = self->Interactor->GetEventPosition()[0]; |
| 104 | int Y = self->Interactor->GetEventPosition()[1]; |
| 105 | |
| 106 | // Okay, make sure that the pick is in the current renderer |
| 107 | if (!self->CurrentRenderer || !self->CurrentRenderer->IsInViewport(X, Y)) |
| 108 | { |
| 109 | self->WidgetState = vtkCameraPathWidget::Start; |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | // Begin the widget interaction which has the side effect of setting the |
| 114 | // interaction state. |
| 115 | double e[2]; |
| 116 | e[0] = static_cast<double>(X); |
| 117 | e[1] = static_cast<double>(Y); |
| 118 | self->WidgetRep->StartWidgetInteraction(e); |
| 119 | int interactionState = self->WidgetRep->GetInteractionState(); |
| 120 | if (interactionState == vtkCameraPathRepresentation::Outside) |
| 121 | { |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | // We are definitely selected |
| 126 | self->WidgetState = vtkCameraPathWidget::Active; |
| 127 | self->GrabFocus(self->EventCallbackCommand); |
| 128 | |
| 129 | if (interactionState == vtkCameraPathRepresentation::OnLine && self->Interactor->GetControlKey()) |
| 130 | { |
| 131 | // Add point. |
| 132 | reinterpret_cast<vtkCameraPathRepresentation*>(self->WidgetRep) |
| 133 | ->SetInteractionState(vtkCameraPathRepresentation::Inserting); |
| 134 | } |
| 135 | else if (interactionState == vtkCameraPathRepresentation::OnHandle && |
| 136 | self->Interactor->GetShiftKey()) |
| 137 | { |
| 138 | // remove point. |
| 139 | reinterpret_cast<vtkCameraPathRepresentation*>(self->WidgetRep) |
| 140 | ->SetInteractionState(vtkCameraPathRepresentation::Erasing); |
| 141 | } |
| 142 | else |
| 143 | { |
| 144 | reinterpret_cast<vtkCameraPathRepresentation*>(self->WidgetRep) |
| 145 | ->SetInteractionState(vtkCameraPathRepresentation::Moving); |
| 146 | } |
| 147 | |
| 148 | // start the interaction |
| 149 | self->EventCallbackCommand->SetAbortFlag(1); |
| 150 | self->StartInteraction(); |
| 151 | self->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr); |
| 152 | self->Render(); |
| 153 | } |
| 154 |
nothing calls this directly
no test coverage detected