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

Method BuildRepresentation

Rendering/Annotation/vtkLegendScaleActor.cxx:329–431  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

327
328//------------------------------------------------------------------------------
329void vtkLegendScaleActor::BuildRepresentation(vtkViewport* viewport)
330{
331 // Specify the locations of the axes.
332 const int* size = viewport->GetSize();
333
334 this->RightAxis->GetPositionCoordinate()->SetValue(
335 size[0] - this->RightBorderOffset, this->CornerOffsetFactor * this->BottomBorderOffset, 0.0);
336 this->RightAxis->GetPosition2Coordinate()->SetValue(size[0] - this->RightBorderOffset,
337 size[1] - this->CornerOffsetFactor * this->TopBorderOffset, 0.0);
338
339 this->TopAxis->GetPositionCoordinate()->SetValue(
340 size[0] - this->CornerOffsetFactor * this->RightBorderOffset, size[1] - this->TopBorderOffset,
341 0.0);
342 this->TopAxis->GetPosition2Coordinate()->SetValue(
343 this->CornerOffsetFactor * this->LeftBorderOffset, size[1] - this->TopBorderOffset, 0.0);
344
345 this->LeftAxis->GetPositionCoordinate()->SetValue(
346 this->LeftBorderOffset, size[1] - this->CornerOffsetFactor * this->TopBorderOffset, 0.0);
347 this->LeftAxis->GetPosition2Coordinate()->SetValue(
348 this->LeftBorderOffset, this->CornerOffsetFactor * this->BottomBorderOffset, 0.0);
349
350 if (this->LegendVisibility)
351 {
352 this->BottomAxis->GetPositionCoordinate()->SetValue(
353 this->CornerOffsetFactor * this->LeftBorderOffset, 2 * this->BottomBorderOffset, 0.0);
354 this->BottomAxis->GetPosition2Coordinate()->SetValue(
355 size[0] - this->CornerOffsetFactor * this->RightBorderOffset, 2 * this->BottomBorderOffset,
356 0.0);
357 }
358 else
359 {
360 this->BottomAxis->GetPositionCoordinate()->SetValue(
361 this->CornerOffsetFactor * this->LeftBorderOffset, this->BottomBorderOffset, 0.0);
362 this->BottomAxis->GetPosition2Coordinate()->SetValue(
363 size[0] - this->CornerOffsetFactor * this->RightBorderOffset, this->BottomBorderOffset, 0.0);
364 }
365
366 if (this->GridVisibility)
367 {
368 this->GridActor->SetHorizontalLinesLeftPoints(this->LeftAxis->GetTickPositions());
369 this->GridActor->SetHorizontalLinesRightPoints(this->RightAxis->GetTickPositions());
370 this->GridActor->SetVerticalLinesBottomPoints(this->BottomAxis->GetTickPositions());
371 this->GridActor->SetVerticalLinesTopPoints(this->TopAxis->GetTickPositions());
372 }
373
374 this->UpdateAxisRange(this->RightAxis, viewport);
375 this->UpdateAxisRange(this->TopAxis, viewport, true);
376 this->UpdateAxisRange(this->LeftAxis, viewport, true);
377 this->UpdateAxisRange(this->BottomAxis, viewport);
378
379 if (this->LegendVisibility)
380 {
381 // Update the position
382 double x1 = 0.33333 * size[0];
383 double delX = x1 / 4.0;
384
385 this->LegendPoints->SetPoint(0, x1, 10, 0);
386 this->LegendPoints->SetPoint(1, x1 + delX, 10, 0);

Callers 1

RenderOpaqueGeometryMethod · 0.95

Calls 15

UpdateAxisRangeMethod · 0.95
GetComputedWorldValueMethod · 0.80
sqrtFunction · 0.50
format_to_nFunction · 0.50
GetSizeMethod · 0.45
SetValueMethod · 0.45
GetTickPositionsMethod · 0.45
SetPointMethod · 0.45

Tested by

no test coverage detected