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

Method ComputeLabelWidth

Views/Infovis/vtkDendrogramItem.cxx:1376–1406  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1374
1375//------------------------------------------------------------------------------
1376void vtkDendrogramItem::ComputeLabelWidth(vtkContext2D* painter)
1377{
1378 this->LabelWidth = 0.0;
1379 if (!this->DrawLabels)
1380 {
1381 return;
1382 }
1383 int fontSize = painter->ComputeFontSizeForBoundedString("Igq", VTK_FLOAT_MAX, this->LeafSpacing);
1384 if (fontSize < 8)
1385 {
1386 return;
1387 }
1388
1389 // temporarily set text to default orientation
1390 double orientation = painter->GetTextProp()->GetOrientation();
1391 painter->GetTextProp()->SetOrientation(0.0);
1392
1393 // get array of node names from the tree
1394 vtkStringArray* vertexNames = vtkArrayDownCast<vtkStringArray>(
1395 this->LayoutTree->GetVertexData()->GetAbstractArray(this->VertexNameArrayName.c_str()));
1396
1397 float bounds[4];
1398 for (vtkIdType i = 0; i < vertexNames->GetNumberOfTuples(); ++i)
1399 {
1400 painter->ComputeStringBounds(vertexNames->GetValue(i), bounds);
1401 this->LabelWidth = std::max(bounds[2], this->LabelWidth);
1402 }
1403
1404 // restore orientation
1405 painter->GetTextProp()->SetOrientation(orientation);
1406}
1407
1408//------------------------------------------------------------------------------
1409bool vtkDendrogramItem::GetPositionOfVertex(const std::string& vertexName, double position[2])

Callers 1

PrepareToPaintMethod · 0.95

Calls 11

GetTextPropMethod · 0.80
GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
maxFunction · 0.50
GetOrientationMethod · 0.45
SetOrientationMethod · 0.45
c_strMethod · 0.45
GetNumberOfTuplesMethod · 0.45
ComputeStringBoundsMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected