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

Method LabelTree

Rendering/Label/vtkLabeledTreeMapDataMapper.cxx:479–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479void vtkLabeledTreeMapDataMapper::LabelTree(vtkTree* tree, vtkFloatArray* boxInfo,
480 vtkDataArray* numericData, vtkStringArray* stringData, int activeComp, int numComps)
481{
482
483 float blimits[4], blimitsDC[4], textPosWC[3];
484 char string[1024];
485 int results;
486 vtkTextProperty* tprop = nullptr;
487 vtkIdType vertex, level, root = tree->GetRoot();
488 if (root < 0)
489 {
490 vtkErrorMacro(<< "Input Tree does not have a root.");
491 return;
492 }
493
494 this->NumberOfLabels = 0;
495 vtkTreeDFSIterator* dfs = vtkTreeDFSIterator::New();
496 dfs->SetTree(tree);
497 while (dfs->HasNext())
498 {
499 // Are we suppose to display this vertex?
500 vertex = dfs->Next();
501 level = tree->GetLevel(vertex);
502
503 if (level >= this->StartLevel && (this->EndLevel == -1 || level <= this->EndLevel))
504 {
505 boxInfo->GetTypedTuple(vertex, blimits); // Get the extents of the vertex
506 if (this->ConvertToDC(blimits, blimitsDC))
507 {
508 continue;
509 }
510
511 this->GetVertexLabel(
512 vertex, numericData, stringData, activeComp, numComps, string, sizeof(string));
513 results = this->AnalyseLabel(string, level, blimitsDC, textPosWC, &tprop);
514 if (results == 1)
515 {
516 // Label doesn't fit in its box - don't both processing children
517 continue;
518 }
519 }
520 else
521 {
522 // results == 2 from AnalyseLabel means that the label can't be
523 // displayed due to reasons other than size - well in this
524 // case we can't display due to the level limit we
525 // also have to deactivate the mask for this level
526 this->LabelMasks[level][0] = -1.0;
527 results = 2;
528 }
529
530 if (!results)
531 {
532 if (!this->TextMappers[this->NumberOfLabels])
533 {
534 this->TextMappers[this->NumberOfLabels] = vtkTextMapper::New();
535 }
536 this->TextMappers[this->NumberOfLabels]->SetInput(string);

Callers 1

RenderOpaqueGeometryMethod · 0.95

Calls 14

ConvertToDCMethod · 0.95
AnalyseLabelMethod · 0.95
DeleteMethod · 0.65
NewFunction · 0.50
GetRootMethod · 0.45
SetTreeMethod · 0.45
HasNextMethod · 0.45
NextMethod · 0.45
GetLevelMethod · 0.45
GetTypedTupleMethod · 0.45
SetInputMethod · 0.45
SetTextPropertyMethod · 0.45

Tested by

no test coverage detected