------------------------------------------------------------------------------
| 2363 | |
| 2364 | //------------------------------------------------------------------------------ |
| 2365 | vtkIdType vtkReebGraph::Implementation::AddPath( |
| 2366 | int nodeNumber, vtkIdType* nodeOffset, vtkReebLabelTag label) |
| 2367 | { |
| 2368 | vtkIdType i, Lprev, Ret = 0; |
| 2369 | |
| 2370 | this->ResizeMainArcTable(nodeNumber - 1); |
| 2371 | |
| 2372 | if (label) |
| 2373 | ResizeMainLabelTable(nodeNumber - 1); |
| 2374 | |
| 2375 | Lprev = 0; |
| 2376 | for (i = 0; i < (nodeNumber - 1); i++) |
| 2377 | { |
| 2378 | vtkIdType N0 = nodeOffset[i]; |
| 2379 | vtkIdType N1 = nodeOffset[i + 1]; |
| 2380 | |
| 2381 | // create a new arc in the graph |
| 2382 | int A = this->MainArcTable.FreeZone; |
| 2383 | this->MainArcTable.FreeZone = this->GetArc(A)->LabelId0; |
| 2384 | ++(this->MainArcTable.Number); |
| 2385 | memset(this->GetArc(A), 0, sizeof(vtkReebArc)); |
| 2386 | vtkReebArc* arc = this->GetArc(A); |
| 2387 | |
| 2388 | int L = 0; |
| 2389 | |
| 2390 | if (!Ret) |
| 2391 | Ret = A; |
| 2392 | |
| 2393 | if (label) |
| 2394 | { |
| 2395 | vtkReebLabel* temporaryLabel; |
| 2396 | |
| 2397 | // create a new label in the graph |
| 2398 | L = this->MainLabelTable.FreeZone; |
| 2399 | this->MainLabelTable.FreeZone = this->GetLabel(L)->ArcId; |
| 2400 | ++(this->MainLabelTable.Number); |
| 2401 | memset(this->GetLabel(L), 0, sizeof(vtkReebLabel)); |
| 2402 | temporaryLabel = this->GetLabel(L); |
| 2403 | |
| 2404 | temporaryLabel->ArcId = A; |
| 2405 | temporaryLabel->label = label; |
| 2406 | temporaryLabel->VPrev = Lprev; |
| 2407 | } |
| 2408 | |
| 2409 | arc->NodeId0 = N0; |
| 2410 | arc->NodeId1 = N1; |
| 2411 | arc->LabelId0 = arc->LabelId1 = L; |
| 2412 | |
| 2413 | vtkReebGraphAddUpArc(this, N0, A); |
| 2414 | vtkReebGraphAddDownArc(this, N1, A); |
| 2415 | |
| 2416 | if (label) |
| 2417 | { |
| 2418 | if (Lprev) |
| 2419 | this->GetLabel(Lprev)->VNext = L; |
| 2420 | Lprev = L; |
| 2421 | } |
| 2422 | } |
no test coverage detected