------------------------------------------------------------------------------
| 293 | |
| 294 | //------------------------------------------------------------------------------ |
| 295 | int 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 | } |
no test coverage detected