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

Method InsertPolyData

Rendering/Core/vtkCompositePolyDataMapper.cxx:454–494  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

452
453//------------------------------------------------------------------------------
454vtkCompositePolyDataMapper::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//------------------------------------------------------------------------------
497void vtkCompositePolyDataMapper::BuildRenderValues(

Callers 1

BuildRenderValuesMethod · 0.95

Calls 11

GenerateHashMethod · 0.95
CreateADelegatorMethod · 0.95
maxFunction · 0.50
GetPointsMethod · 0.45
GetNumberOfPointsMethod · 0.45
emplaceMethod · 0.45
atMethod · 0.45
TakeReferenceMethod · 0.45
SetParentMethod · 0.45
ShallowCopyMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected