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

Method InsertHandleOnLine

Interaction/Widgets/vtkBrokenLineWidget.cxx:1258–1293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1256}
1257
1258void vtkBrokenLineWidget::InsertHandleOnLine(double* pos)
1259{
1260 if (this->NumberOfHandles < 2)
1261 {
1262 return;
1263 }
1264
1265 vtkIdType id = this->LinePicker->GetCellId();
1266 if (id == -1)
1267 {
1268 return;
1269 }
1270
1271 vtkIdType subid = this->LinePicker->GetSubId();
1272 vtkPoints* newpoints = vtkPoints::New(VTK_DOUBLE);
1273 newpoints->SetNumberOfPoints(this->NumberOfHandles + 1);
1274
1275 int istart = subid;
1276 int istop = istart + 1;
1277 int count = 0;
1278 int i;
1279 for (i = 0; i <= istart; ++i)
1280 {
1281 newpoints->SetPoint(count++, this->HandleGeometry[i]->GetCenter());
1282 }
1283
1284 newpoints->SetPoint(count++, pos);
1285
1286 for (i = istop; i < this->NumberOfHandles; ++i)
1287 {
1288 newpoints->SetPoint(count++, this->HandleGeometry[i]->GetCenter());
1289 }
1290
1291 this->InitializeHandles(newpoints);
1292 newpoints->Delete();
1293}
1294
1295void vtkBrokenLineWidget::EraseHandle(const int& index)
1296{

Callers 1

OnRightButtonUpMethod · 0.95

Calls 7

InitializeHandlesMethod · 0.95
DeleteMethod · 0.65
NewFunction · 0.50
GetCellIdMethod · 0.45
SetNumberOfPointsMethod · 0.45
SetPointMethod · 0.45
GetCenterMethod · 0.45

Tested by

no test coverage detected