------------------------------------------------------------------------------
| 452 | |
| 453 | //------------------------------------------------------------------------------ |
| 454 | vtkCompositePolyDataMapper::MapperHashType vtkCompositePolyDataMapper::InsertPolyData( |
| 455 | vtkPolyData* polydata, const unsigned int& flatIndex) |
| 456 | { |
| 457 | if (polydata == nullptr) |
| 458 | { |
| 459 | vtkDebugMacro(<< "DataObject at flatIndex=" << flatIndex |
| 460 | << " is not a vtkPolyData or a vtkPolyData derived instance!"); |
| 461 | return std::numeric_limits<MapperHashType>::max(); |
| 462 | } |
| 463 | if (polydata->GetPoints() == nullptr || !polydata->GetNumberOfPoints()) |
| 464 | { |
| 465 | vtkDebugMacro(<< "vtkPolyData at flatIndex=" << flatIndex |
| 466 | << " does not have points. It will not be rendered."); |
| 467 | return std::numeric_limits<MapperHashType>::max(); |
| 468 | } |
| 469 | auto& internals = (*this->Internals); |
| 470 | const auto hash = this->GenerateHash(polydata); |
| 471 | // Find a mapper. If it doesn't exist, a new one is created. |
| 472 | internals.BatchedDelegators.emplace(hash, nullptr); |
| 473 | auto& delegator = internals.BatchedDelegators.at(hash); |
| 474 | if (delegator == nullptr) |
| 475 | { |
| 476 | delegator.TakeReference(this->CreateADelegator()); |
| 477 | delegator->SetParent(this); |
| 478 | } |
| 479 | delegator->ShallowCopy(this); |
| 480 | delegator->Mark(); |
| 481 | |
| 482 | auto createBatchElement = |
| 483 | [](vtkPolyData* _polydata, |
| 484 | unsigned int _flatIndex) -> vtkCompositePolyDataMapperDelegator::BatchElement |
| 485 | { |
| 486 | vtkCompositePolyDataMapperDelegator::BatchElement element; |
| 487 | element.PolyData = _polydata; |
| 488 | element.FlatIndex = _flatIndex; |
| 489 | return element; |
| 490 | }; |
| 491 | |
| 492 | delegator->Insert(createBatchElement(polydata, flatIndex)); |
| 493 | return hash; |
| 494 | } |
| 495 | |
| 496 | //------------------------------------------------------------------------------ |
| 497 | void vtkCompositePolyDataMapper::BuildRenderValues( |
no test coverage detected