------------------------------------------------------------------------------
| 322 | |
| 323 | //------------------------------------------------------------------------------ |
| 324 | int vtkSpiderPlotActor::BuildPlot(vtkViewport* viewport) |
| 325 | { |
| 326 | // Initialize |
| 327 | vtkDebugMacro(<< "Building spider plot"); |
| 328 | |
| 329 | // Make sure input is up to date, and that the data is the correct shape to |
| 330 | // plot. |
| 331 | if (!this->GetInput()) |
| 332 | { |
| 333 | vtkErrorMacro(<< "Nothing to plot!"); |
| 334 | return 0; |
| 335 | } |
| 336 | |
| 337 | if (!this->TitleTextProperty) |
| 338 | { |
| 339 | vtkErrorMacro(<< "Need title text property to render plot"); |
| 340 | return 0; |
| 341 | } |
| 342 | if (!this->LabelTextProperty) |
| 343 | { |
| 344 | vtkErrorMacro(<< "Need label text property to render plot"); |
| 345 | return 0; |
| 346 | } |
| 347 | |
| 348 | // Viewport change may not require rebuild |
| 349 | int positionsHaveChanged = 0; |
| 350 | if (viewport->GetMTime() > this->BuildTime || |
| 351 | (viewport->GetVTKWindow() && viewport->GetVTKWindow()->GetMTime() > this->BuildTime)) |
| 352 | { |
| 353 | int* lastPosition = this->PositionCoordinate->GetComputedViewportValue(viewport); |
| 354 | int* lastPosition2 = this->Position2Coordinate->GetComputedViewportValue(viewport); |
| 355 | if (lastPosition[0] != this->LastPosition[0] || lastPosition[1] != this->LastPosition[1] || |
| 356 | lastPosition2[0] != this->LastPosition2[0] || lastPosition2[1] != this->LastPosition2[1]) |
| 357 | { |
| 358 | this->LastPosition[0] = lastPosition[0]; |
| 359 | this->LastPosition[1] = lastPosition[1]; |
| 360 | this->LastPosition2[0] = lastPosition2[0]; |
| 361 | this->LastPosition2[1] = lastPosition2[1]; |
| 362 | positionsHaveChanged = 1; |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | // Check modified time to see whether we have to rebuild. |
| 367 | this->ConnectionHolder->GetInputAlgorithm()->Update(); |
| 368 | |
| 369 | if (positionsHaveChanged || this->GetMTime() > this->BuildTime || |
| 370 | this->GetInput()->GetMTime() > this->BuildTime || |
| 371 | this->LabelTextProperty->GetMTime() > this->BuildTime || |
| 372 | this->TitleTextProperty->GetMTime() > this->BuildTime) |
| 373 | { |
| 374 | vtkDebugMacro(<< "Rebuilding plot"); |
| 375 | |
| 376 | // Build axes |
| 377 | const int* size = viewport->GetSize(); |
| 378 | if (!this->PlaceAxes(viewport, size)) |
| 379 | { |
| 380 | return 0; |
| 381 | } |
no test coverage detected