------------------------------------------------------------------------------
| 265 | |
| 266 | //------------------------------------------------------------------------------ |
| 267 | int vtkBarChartActor::BuildPlot(vtkViewport* viewport) |
| 268 | { |
| 269 | // Initialize |
| 270 | vtkDebugMacro(<< "Building pie chart plot"); |
| 271 | |
| 272 | // Make sure input is up to date, and that the data is the correct shape to |
| 273 | // plot. |
| 274 | if (!this->Input) |
| 275 | { |
| 276 | vtkErrorMacro(<< "Nothing to plot!"); |
| 277 | return 0; |
| 278 | } |
| 279 | |
| 280 | if (!this->TitleTextProperty) |
| 281 | { |
| 282 | vtkErrorMacro(<< "Need title text property to render plot"); |
| 283 | return 0; |
| 284 | } |
| 285 | if (!this->LabelTextProperty) |
| 286 | { |
| 287 | vtkErrorMacro(<< "Need label text property to render plot"); |
| 288 | return 0; |
| 289 | } |
| 290 | |
| 291 | // Viewport change may not require rebuild |
| 292 | int positionsHaveChanged = 0; |
| 293 | if (viewport->GetMTime() > this->BuildTime || |
| 294 | (viewport->GetVTKWindow() && viewport->GetVTKWindow()->GetMTime() > this->BuildTime)) |
| 295 | { |
| 296 | int* lastPosition = this->PositionCoordinate->GetComputedViewportValue(viewport); |
| 297 | int* lastPosition2 = this->Position2Coordinate->GetComputedViewportValue(viewport); |
| 298 | if (lastPosition[0] != this->LastPosition[0] || lastPosition[1] != this->LastPosition[1] || |
| 299 | lastPosition2[0] != this->LastPosition2[0] || lastPosition2[1] != this->LastPosition2[1]) |
| 300 | { |
| 301 | this->LastPosition[0] = lastPosition[0]; |
| 302 | this->LastPosition[1] = lastPosition[1]; |
| 303 | this->LastPosition2[0] = lastPosition2[0]; |
| 304 | this->LastPosition2[1] = lastPosition2[1]; |
| 305 | positionsHaveChanged = 1; |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | // Check modified time to see whether we have to rebuild. |
| 310 | if (positionsHaveChanged || this->GetMTime() > this->BuildTime || |
| 311 | this->Input->GetMTime() > this->BuildTime || |
| 312 | this->LabelTextProperty->GetMTime() > this->BuildTime || |
| 313 | this->TitleTextProperty->GetMTime() > this->BuildTime) |
| 314 | { |
| 315 | vtkDebugMacro(<< "Rebuilding plot"); |
| 316 | |
| 317 | // Build axes |
| 318 | const int* size = viewport->GetSize(); |
| 319 | if (!this->PlaceAxes(viewport, size)) |
| 320 | { |
| 321 | return 0; |
| 322 | } |
| 323 | |
| 324 | this->BuildTime.Modified(); |
no test coverage detected