------------------------------------------------------------------------------
| 409 | #define VTK_RING_PTS 64 |
| 410 | //------------------------------------------------------------------------------ |
| 411 | int vtkSpiderPlotActor::PlaceAxes(vtkViewport* viewport, const int* vtkNotUsed(size)) |
| 412 | { |
| 413 | vtkIdType i, j, k; |
| 414 | vtkDataObject* input = this->GetInput(); |
| 415 | vtkFieldData* field = input->GetFieldData(); |
| 416 | double v = 0.0; |
| 417 | |
| 418 | this->Initialize(); |
| 419 | |
| 420 | if (!field) |
| 421 | { |
| 422 | return 0; |
| 423 | } |
| 424 | |
| 425 | // Determine the shape of the field |
| 426 | int numComponents = field->GetNumberOfComponents(); // number of components |
| 427 | // Note: numComponents also includes the non-numeric arrays. |
| 428 | |
| 429 | int numColumns = 0; // number of "columns" -- includes only numeric arrays. |
| 430 | vtkIdType numRows = VTK_ID_MAX; // figure out number of rows |
| 431 | vtkIdType numTuples; |
| 432 | vtkDataArray* array; |
| 433 | for (i = 0; i < field->GetNumberOfArrays(); i++) |
| 434 | { |
| 435 | array = field->GetArray(i); |
| 436 | if (!array) |
| 437 | { |
| 438 | // skip over non-numeric arrays. |
| 439 | continue; |
| 440 | } |
| 441 | numColumns += array->GetNumberOfComponents(); |
| 442 | numTuples = array->GetNumberOfTuples(); |
| 443 | numRows = std::min(numTuples, numRows); |
| 444 | } |
| 445 | |
| 446 | // Determine the number of independent variables |
| 447 | if (this->IndependentVariables == VTK_IV_COLUMN) |
| 448 | { |
| 449 | this->N = numColumns; |
| 450 | } |
| 451 | else // row |
| 452 | { |
| 453 | this->N = numRows; |
| 454 | } |
| 455 | |
| 456 | if (this->N <= 0 || this->N >= VTK_ID_MAX) |
| 457 | { |
| 458 | this->N = 0; |
| 459 | vtkErrorMacro(<< "No field data to plot"); |
| 460 | return 0; |
| 461 | } |
| 462 | |
| 463 | // We need to loop over the field to determine the range of |
| 464 | // each independent variable. |
| 465 | this->Mins = new double[this->N]; |
| 466 | this->Maxs = new double[this->N]; |
| 467 | for (i = 0; i < this->N; i++) |
| 468 | { |
no test coverage detected