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

Method UpdateGeometry

Charts/Core/vtkChartParallelCoordinates.cxx:464–514  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

462
463//------------------------------------------------------------------------------
464void vtkChartParallelCoordinates::UpdateGeometry(vtkContext2D* painter)
465{
466 vtkVector2i geometry(this->GetScene()->GetSceneWidth(), this->GetScene()->GetSceneHeight());
467
468 if (geometry.GetX() != this->Geometry[0] || geometry.GetY() != this->Geometry[1] ||
469 !this->GeometryValid)
470 {
471 // Take up the entire window right now, this could be made configurable
472 this->SetGeometry(geometry.GetData());
473
474 vtkVector2i tileScale = this->Scene->GetLogicalTileScale();
475 // if chart legend in not inlined, then we need to reserve space for it at the top right corner
476 if (this->Legend->GetVisible() && !this->Legend->GetInline())
477 {
478 this->Legend->Update();
479 constexpr int padding = 10;
480 const vtkRectf rect = this->Legend->GetBoundingRect(painter);
481 this->SetBorders(60 * tileScale.GetX(), 50 * tileScale.GetY(),
482 (60 + static_cast<int>(rect.GetWidth()) + padding) * tileScale.GetX(),
483 20 * tileScale.GetY());
484 }
485 else
486 {
487 this->SetBorders(
488 60 * tileScale.GetX(), 50 * tileScale.GetY(), 60 * tileScale.GetX(), 20 * tileScale.GetY());
489 }
490
491 // Iterate through the axes and set them up to span the chart area.
492 int xStep =
493 (this->Point2[0] - this->Point1[0]) / (static_cast<int>(this->Storage->Axes.size()) - 1);
494 int x = this->Point1[0];
495
496 for (size_t i = 0; i < this->Storage->Axes.size(); ++i)
497 {
498 vtkAxis* axis = this->Storage->Axes[i];
499 axis->SetPoint1(x, this->Point1[1]);
500 axis->SetPoint2(x, this->Point2[1]);
501 if (axis->GetBehavior() == 0)
502 {
503 axis->AutoScale();
504 }
505 axis->Update();
506 x += xStep;
507 }
508
509 this->GeometryValid = true;
510 // Cause the plot transform to be recalculated if necessary
511 this->CalculatePlotTransform();
512 this->Storage->Plot->Update();
513 }
514}
515
516//------------------------------------------------------------------------------
517void vtkChartParallelCoordinates::CalculatePlotTransform()

Callers 1

PaintMethod · 0.95

Calls 15

GetSceneWidthMethod · 0.80
GetSceneHeightMethod · 0.80
GetLogicalTileScaleMethod · 0.80
GetVisibleMethod · 0.80
GetSceneMethod · 0.45
GetXMethod · 0.45
SetGeometryMethod · 0.45
GetDataMethod · 0.45
UpdateMethod · 0.45
GetBoundingRectMethod · 0.45
SetBordersMethod · 0.45

Tested by

no test coverage detected