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

Method BuildPlot

Rendering/Annotation/vtkPieChartActor.cxx:295–358  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

293
294//------------------------------------------------------------------------------
295int vtkPieChartActor::BuildPlot(vtkViewport* viewport)
296{
297 // Initialize
298 vtkDebugMacro(<< "Building pie chart plot");
299
300 // Make sure input is up to date, and that the data is the correct shape to
301 // plot.
302 if (!this->GetInput())
303 {
304 vtkErrorMacro(<< "Nothing to plot!");
305 return 0;
306 }
307
308 if (!this->TitleTextProperty)
309 {
310 vtkErrorMacro(<< "Need title text property to render plot");
311 return 0;
312 }
313 if (!this->LabelTextProperty)
314 {
315 vtkErrorMacro(<< "Need label text property to render plot");
316 return 0;
317 }
318
319 // Viewport change may not require rebuild
320 int positionsHaveChanged = 0;
321 if (viewport->GetMTime() > this->BuildTime ||
322 (viewport->GetVTKWindow() && viewport->GetVTKWindow()->GetMTime() > this->BuildTime))
323 {
324 int* lastPosition = this->PositionCoordinate->GetComputedViewportValue(viewport);
325 int* lastPosition2 = this->Position2Coordinate->GetComputedViewportValue(viewport);
326 if (lastPosition[0] != this->LastPosition[0] || lastPosition[1] != this->LastPosition[1] ||
327 lastPosition2[0] != this->LastPosition2[0] || lastPosition2[1] != this->LastPosition2[1])
328 {
329 this->LastPosition[0] = lastPosition[0];
330 this->LastPosition[1] = lastPosition[1];
331 this->LastPosition2[0] = lastPosition2[0];
332 this->LastPosition2[1] = lastPosition2[1];
333 positionsHaveChanged = 1;
334 }
335 }
336
337 // Check modified time to see whether we have to rebuild.
338 this->ConnectionHolder->GetInputAlgorithm()->Update();
339
340 if (positionsHaveChanged || this->GetMTime() > this->BuildTime ||
341 this->GetInput()->GetMTime() > this->BuildTime ||
342 this->LabelTextProperty->GetMTime() > this->BuildTime ||
343 this->TitleTextProperty->GetMTime() > this->BuildTime)
344 {
345 vtkDebugMacro(<< "Rebuilding plot");
346
347 // Build axes
348 const int* size = viewport->GetSize();
349 if (!this->PlaceAxes(viewport, size))
350 {
351 return 0;
352 }

Callers 2

RenderOverlayMethod · 0.95
RenderOpaqueGeometryMethod · 0.95

Calls 9

GetInputMethod · 0.95
PlaceAxesMethod · 0.95
GetVTKWindowMethod · 0.80
GetMTimeMethod · 0.45
UpdateMethod · 0.45
GetInputAlgorithmMethod · 0.45
GetSizeMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected