| 1332 | } |
| 1333 | |
| 1334 | void vtkSplineWidget::InsertHandleOnLine(double* pos) |
| 1335 | { |
| 1336 | if (this->NumberOfHandles < 2) |
| 1337 | { |
| 1338 | return; |
| 1339 | } |
| 1340 | |
| 1341 | vtkIdType id = this->LinePicker->GetCellId(); |
| 1342 | if (id == -1) |
| 1343 | { |
| 1344 | return; |
| 1345 | } |
| 1346 | |
| 1347 | vtkIdType subid = this->LinePicker->GetSubId(); |
| 1348 | |
| 1349 | vtkPoints* newpoints = vtkPoints::New(VTK_DOUBLE); |
| 1350 | newpoints->SetNumberOfPoints(this->NumberOfHandles + 1); |
| 1351 | |
| 1352 | int istart = vtkMath::Floor( |
| 1353 | subid * (this->NumberOfHandles + this->Closed - 1.0) / static_cast<double>(this->Resolution)); |
| 1354 | int istop = istart + 1; |
| 1355 | int count = 0; |
| 1356 | int i; |
| 1357 | for (i = 0; i <= istart; ++i) |
| 1358 | { |
| 1359 | newpoints->SetPoint(count++, this->HandleGeometry[i]->GetCenter()); |
| 1360 | } |
| 1361 | |
| 1362 | newpoints->SetPoint(count++, pos); |
| 1363 | |
| 1364 | for (i = istop; i < this->NumberOfHandles; ++i) |
| 1365 | { |
| 1366 | newpoints->SetPoint(count++, this->HandleGeometry[i]->GetCenter()); |
| 1367 | } |
| 1368 | |
| 1369 | this->InitializeHandles(newpoints); |
| 1370 | newpoints->Delete(); |
| 1371 | } |
| 1372 | |
| 1373 | void vtkSplineWidget::EraseHandle(const int& index) |
| 1374 | { |
no test coverage detected