------------------------------------------------------------------------------
| 232 | |
| 233 | //------------------------------------------------------------------------------ |
| 234 | void vtkLineWidget::SetEnabled(int enabling) |
| 235 | { |
| 236 | if (!this->Interactor) |
| 237 | { |
| 238 | vtkErrorMacro(<< "The interactor must be set prior to enabling/disabling widget"); |
| 239 | return; |
| 240 | } |
| 241 | |
| 242 | if (enabling) //----------------------------------------------------------- |
| 243 | { |
| 244 | vtkDebugMacro(<< "Enabling line widget"); |
| 245 | |
| 246 | if (this->Enabled) // already enabled, just return |
| 247 | { |
| 248 | return; |
| 249 | } |
| 250 | |
| 251 | if (!this->CurrentRenderer) |
| 252 | { |
| 253 | this->SetCurrentRenderer(this->Interactor->FindPokedRenderer( |
| 254 | this->Interactor->GetLastEventPosition()[0], this->Interactor->GetLastEventPosition()[1])); |
| 255 | if (this->CurrentRenderer == nullptr) |
| 256 | { |
| 257 | return; |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | this->PointWidget->SetCurrentRenderer(this->CurrentRenderer); |
| 262 | this->PointWidget1->SetCurrentRenderer(this->CurrentRenderer); |
| 263 | this->PointWidget2->SetCurrentRenderer(this->CurrentRenderer); |
| 264 | |
| 265 | this->Enabled = 1; |
| 266 | |
| 267 | // listen for the following events |
| 268 | vtkRenderWindowInteractor* i = this->Interactor; |
| 269 | i->AddObserver(vtkCommand::MouseMoveEvent, this->EventCallbackCommand, this->Priority); |
| 270 | i->AddObserver(vtkCommand::LeftButtonPressEvent, this->EventCallbackCommand, this->Priority); |
| 271 | i->AddObserver(vtkCommand::LeftButtonReleaseEvent, this->EventCallbackCommand, this->Priority); |
| 272 | i->AddObserver(vtkCommand::MiddleButtonPressEvent, this->EventCallbackCommand, this->Priority); |
| 273 | i->AddObserver( |
| 274 | vtkCommand::MiddleButtonReleaseEvent, this->EventCallbackCommand, this->Priority); |
| 275 | i->AddObserver(vtkCommand::RightButtonPressEvent, this->EventCallbackCommand, this->Priority); |
| 276 | i->AddObserver(vtkCommand::RightButtonReleaseEvent, this->EventCallbackCommand, this->Priority); |
| 277 | |
| 278 | // Add the line |
| 279 | this->CurrentRenderer->AddActor(this->LineActor); |
| 280 | this->LineActor->SetProperty(this->LineProperty); |
| 281 | |
| 282 | // turn on the handles |
| 283 | for (int j = 0; j < 2; j++) |
| 284 | { |
| 285 | this->CurrentRenderer->AddActor(this->Handle[j]); |
| 286 | this->Handle[j]->SetProperty(this->HandleProperty); |
| 287 | } |
| 288 | |
| 289 | this->BuildRepresentation(); |
| 290 | this->SizeHandles(); |
| 291 | this->RegisterPickers(); |
nothing calls this directly
no test coverage detected