------------------------------------------------------------------------------
| 325 | |
| 326 | //------------------------------------------------------------------------------ |
| 327 | int vtkParallelCoordinatesActor::PlaceAxes(vtkViewport* viewport, const int* vtkNotUsed(size)) |
| 328 | { |
| 329 | vtkIdType i, j, k, ptId; |
| 330 | vtkDataObject* input = this->GetInput(); |
| 331 | vtkFieldData* field = input->GetFieldData(); |
| 332 | double v = 0.0; |
| 333 | |
| 334 | this->Initialize(); |
| 335 | |
| 336 | if (!field) |
| 337 | { |
| 338 | return 0; |
| 339 | } |
| 340 | |
| 341 | // Determine the shape of the field |
| 342 | int numComponents = |
| 343 | field->GetNumberOfComponents(); // number of components |
| 344 | // Note: numComponents also includes the non-numeric arrays. |
| 345 | |
| 346 | int numColumns = 0; // number of "columns" -- includes only numeric arrays. |
| 347 | vtkIdType numRows = VTK_ID_MAX; // figure out number of rows |
| 348 | vtkIdType numTuples; |
| 349 | vtkDataArray* array; |
| 350 | for (i = 0; i < field->GetNumberOfArrays(); i++) |
| 351 | { |
| 352 | array = field->GetArray(i); |
| 353 | if (!array) |
| 354 | { |
| 355 | // skip over non-numeric arrays. |
| 356 | continue; |
| 357 | } |
| 358 | numColumns += array->GetNumberOfComponents(); |
| 359 | numTuples = array->GetNumberOfTuples(); |
| 360 | numRows = std::min(numTuples, numRows); |
| 361 | } |
| 362 | |
| 363 | // Determine the number of independent variables |
| 364 | if (this->IndependentVariables == VTK_IV_COLUMN) |
| 365 | { |
| 366 | this->N = numColumns; |
| 367 | } |
| 368 | else // row |
| 369 | { |
| 370 | this->N = numRows; |
| 371 | } |
| 372 | |
| 373 | if (this->N <= 0 || this->N >= VTK_ID_MAX) |
| 374 | { |
| 375 | this->N = 0; |
| 376 | vtkErrorMacro(<< "No field data to plot"); |
| 377 | return 0; |
| 378 | } |
| 379 | |
| 380 | // We need to loop over the field to determine the range of |
| 381 | // each independent variable. |
| 382 | this->Mins = new double[this->N]; |
| 383 | this->Maxs = new double[this->N]; |
| 384 | for (i = 0; i < this->N; i++) |
no test coverage detected