------------------------------------------------------------------------------
| 33 | |
| 34 | //------------------------------------------------------------------------------ |
| 35 | void 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 | //------------------------------------------------------------------------------ |
| 76 | void vtkMultiLineWidget::SetInteractor(vtkRenderWindowInteractor* interactor) |
no test coverage detected