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

Method SetEnabled

Interaction/Widgets/vtkLineWidget.cxx:234–331  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

232
233//------------------------------------------------------------------------------
234void 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();

Callers

nothing calls this directly

Calls 13

BuildRepresentationMethod · 0.95
SizeHandlesMethod · 0.95
RegisterPickersMethod · 0.95
InvokeEventMethod · 0.80
RemoveActorMethod · 0.80
RenderMethod · 0.65
SetCurrentRendererMethod · 0.45
FindPokedRendererMethod · 0.45
AddObserverMethod · 0.45
AddActorMethod · 0.45
SetPropertyMethod · 0.45
RemoveObserverMethod · 0.45

Tested by

no test coverage detected