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

Method SetLineCount

Interaction/Widgets/vtkMultiLineWidget.cxx:35–73  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

33
34//------------------------------------------------------------------------------
35void vtkMultiLineWidget::SetLineCount(int newLineCount)
36{
37 if (newLineCount < 0)
38 {
39 vtkWarningMacro(<< newLineCount << " is an invalid line count.");
40 return;
41 }
42
43 if (newLineCount == this->LineCount)
44 {
45 return;
46 }
47
48 vtkMultiLineRepresentation* multiLineRepresentation = this->GetMultiLineRepresentation();
49 if (multiLineRepresentation != nullptr)
50 {
51 multiLineRepresentation->SetLineCount(newLineCount);
52 }
53
54 this->LineWidgetVector.resize(newLineCount);
55
56 // If we have more lines than before, we set the new representation for these lines
57 for (int i = this->LineCount; i < newLineCount; i++)
58 {
59 auto lineWidget = vtkSmartPointer<vtkLineWidget2>::New();
60 lineWidget->SetInteractor(this->Interactor);
61 if (multiLineRepresentation != nullptr)
62 {
63 lineWidget->SetRepresentation(multiLineRepresentation->GetLineRepresentation(i));
64 lineWidget->GetRepresentation()->SetRenderer(this->CurrentRenderer);
65 }
66 lineWidget->SetEnabled(this->Enabled);
67 lineWidget->SetParent(this); // the line now watches events of this widget
68
69 this->LineWidgetVector[i] = lineWidget;
70 }
71 this->LineCount = newLineCount;
72 this->Modified();
73}
74
75//------------------------------------------------------------------------------
76void vtkMultiLineWidget::SetInteractor(vtkRenderWindowInteractor* interactor)

Callers 2

vtkMultiLineWidgetMethod · 0.95
SetRepresentationMethod · 0.45

Calls 11

GetLineRepresentationMethod · 0.80
GetRepresentationMethod · 0.80
NewFunction · 0.50
resizeMethod · 0.45
SetInteractorMethod · 0.45
SetRepresentationMethod · 0.45
SetRendererMethod · 0.45
SetEnabledMethod · 0.45
SetParentMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected