------------------------------------------------------------------------------
| 46 | |
| 47 | //------------------------------------------------------------------------------ |
| 48 | vtkDistanceWidget::vtkDistanceWidget() |
| 49 | { |
| 50 | this->ManagesCursor = 0; |
| 51 | |
| 52 | this->WidgetState = vtkDistanceWidget::Start; |
| 53 | this->CurrentHandle = 0; |
| 54 | |
| 55 | // The widgets for moving the end points. They observe this widget (i.e., |
| 56 | // this widget is the parent to the handles). |
| 57 | this->Point1Widget = vtkHandleWidget::New(); |
| 58 | this->Point1Widget->SetParent(this); |
| 59 | this->Point2Widget = vtkHandleWidget::New(); |
| 60 | this->Point2Widget->SetParent(this); |
| 61 | |
| 62 | // Set up the callbacks on the two handles |
| 63 | this->DistanceWidgetCallback1 = vtkDistanceWidgetCallback::New(); |
| 64 | this->DistanceWidgetCallback1->HandleNumber = 0; |
| 65 | this->DistanceWidgetCallback1->DistanceWidget = this; |
| 66 | this->Point1Widget->AddObserver( |
| 67 | vtkCommand::StartInteractionEvent, this->DistanceWidgetCallback1, this->Priority); |
| 68 | this->Point1Widget->AddObserver( |
| 69 | vtkCommand::InteractionEvent, this->DistanceWidgetCallback1, this->Priority); |
| 70 | this->Point1Widget->AddObserver( |
| 71 | vtkCommand::EndInteractionEvent, this->DistanceWidgetCallback1, this->Priority); |
| 72 | |
| 73 | this->DistanceWidgetCallback2 = vtkDistanceWidgetCallback::New(); |
| 74 | this->DistanceWidgetCallback2->HandleNumber = 1; |
| 75 | this->DistanceWidgetCallback2->DistanceWidget = this; |
| 76 | this->Point2Widget->AddObserver( |
| 77 | vtkCommand::StartInteractionEvent, this->DistanceWidgetCallback2, this->Priority); |
| 78 | this->Point2Widget->AddObserver( |
| 79 | vtkCommand::InteractionEvent, this->DistanceWidgetCallback2, this->Priority); |
| 80 | this->Point2Widget->AddObserver( |
| 81 | vtkCommand::EndInteractionEvent, this->DistanceWidgetCallback2, this->Priority); |
| 82 | |
| 83 | // These are the event callbacks supported by this widget |
| 84 | this->CallbackMapper->SetCallbackMethod(vtkCommand::LeftButtonPressEvent, |
| 85 | vtkWidgetEvent::AddPoint, this, vtkDistanceWidget::AddPointAction); |
| 86 | this->CallbackMapper->SetCallbackMethod( |
| 87 | vtkCommand::MouseMoveEvent, vtkWidgetEvent::Move, this, vtkDistanceWidget::MoveAction); |
| 88 | this->CallbackMapper->SetCallbackMethod(vtkCommand::LeftButtonReleaseEvent, |
| 89 | vtkWidgetEvent::EndSelect, this, vtkDistanceWidget::EndSelectAction); |
| 90 | |
| 91 | { |
| 92 | vtkNew<vtkEventDataDevice3D> ed; |
| 93 | ed->SetDevice(vtkEventDataDevice::Any); |
| 94 | ed->SetInput(vtkEventDataDeviceInput::Any); |
| 95 | ed->SetAction(vtkEventDataAction::Press); |
| 96 | this->CallbackMapper->SetCallbackMethod(vtkCommand::Select3DEvent, ed, |
| 97 | vtkWidgetEvent::AddPoint3D, this, vtkDistanceWidget::AddPointAction3D); |
| 98 | } |
| 99 | |
| 100 | { |
| 101 | vtkNew<vtkEventDataDevice3D> ed; |
| 102 | ed->SetDevice(vtkEventDataDevice::Any); |
| 103 | ed->SetInput(vtkEventDataDeviceInput::Any); |
| 104 | ed->SetAction(vtkEventDataAction::Release); |
| 105 | this->CallbackMapper->SetCallbackMethod(vtkCommand::Select3DEvent, ed, |
nothing calls this directly
no test coverage detected