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

Method BuildLabel

Rendering/Core/vtkLabeledContourMapper.cxx:1379–1419  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1377
1378//------------------------------------------------------------------------------
1379bool vtkLabeledContourMapper::Private::BuildLabel(
1380 vtkTextActor3D* actor, const LabelMetric& metric, const LabelInfo& info)
1381
1382{
1383 assert(metric.Valid);
1384 actor->SetInput(metric.Text.c_str());
1385 actor->SetTextProperty(metric.TProp);
1386 actor->SetPosition(const_cast<double*>(info.Position.GetData()));
1387
1388 vtkNew<vtkTransform> xform;
1389 xform->PostMultiply();
1390
1391 xform->Translate((-info.Position).GetData());
1392
1393 xform->Scale(info.ScaleDisplayToActor, info.ScaleDisplayToActor, info.ScaleDisplayToActor);
1394
1395 vtkVector3d forward = info.UpA.Cross(info.RightA);
1396 double rot[16];
1397 rot[4 * 0 + 0] = info.RightA[0];
1398 rot[4 * 1 + 0] = info.RightA[1];
1399 rot[4 * 2 + 0] = info.RightA[2];
1400 rot[4 * 3 + 0] = 0;
1401 rot[4 * 0 + 1] = info.UpA[0];
1402 rot[4 * 1 + 1] = info.UpA[1];
1403 rot[4 * 2 + 1] = info.UpA[2];
1404 rot[4 * 3 + 1] = 0;
1405 rot[4 * 0 + 2] = forward[0];
1406 rot[4 * 1 + 2] = forward[1];
1407 rot[4 * 2 + 2] = forward[2];
1408 rot[4 * 3 + 2] = 0;
1409 rot[4 * 0 + 3] = 0;
1410 rot[4 * 1 + 3] = 0;
1411 rot[4 * 2 + 3] = 0;
1412 rot[4 * 3 + 3] = 1;
1413 xform->Concatenate(rot);
1414
1415 xform->Translate(info.Position.GetData());
1416 actor->SetUserTransform(xform);
1417
1418 return true;
1419}
1420
1421//------------------------------------------------------------------------------
1422void vtkLabeledContourMapper::Private::ComputeLabelInfo(LabelInfo& info, const LabelMetric& metrics)

Callers 1

CreateLabelsMethod · 0.45

Calls 11

assertFunction · 0.50
SetInputMethod · 0.45
c_strMethod · 0.45
SetTextPropertyMethod · 0.45
SetPositionMethod · 0.45
GetDataMethod · 0.45
TranslateMethod · 0.45
ScaleMethod · 0.45
CrossMethod · 0.45
ConcatenateMethod · 0.45
SetUserTransformMethod · 0.45

Tested by

no test coverage detected