------------------------------------------------------------------------------ Write the point data (e.g., scalars, vectors, ...) of a vtk dataset. Returns 0 if error.
| 399 | // Write the point data (e.g., scalars, vectors, ...) of a vtk dataset. |
| 400 | // Returns 0 if error. |
| 401 | int vtkDataWriter::WritePointData(ostream* fp, vtkDataSet* ds) |
| 402 | { |
| 403 | vtkIdType numPts; |
| 404 | vtkDataArray* scalars; |
| 405 | vtkDataArray* vectors; |
| 406 | vtkDataArray* normals; |
| 407 | vtkDataArray* tcoords; |
| 408 | vtkDataArray* tensors; |
| 409 | vtkDataArray* globalIds; |
| 410 | vtkAbstractArray* pedigreeIds; |
| 411 | vtkDataArray* edgeFlags; |
| 412 | vtkFieldData* field; |
| 413 | vtkPointData* pd = ds->GetPointData(); |
| 414 | |
| 415 | vtkDebugMacro(<< "Writing point data..."); |
| 416 | |
| 417 | numPts = ds->GetNumberOfPoints(); |
| 418 | if (numPts <= 0) |
| 419 | { |
| 420 | vtkDebugMacro(<< "No point data to write!"); |
| 421 | return 1; |
| 422 | } |
| 423 | |
| 424 | scalars = pd->GetScalars(); |
| 425 | if (scalars && scalars->GetNumberOfTuples() <= 0) |
| 426 | scalars = nullptr; |
| 427 | |
| 428 | vectors = pd->GetVectors(); |
| 429 | if (vectors && vectors->GetNumberOfTuples() <= 0) |
| 430 | vectors = nullptr; |
| 431 | |
| 432 | normals = pd->GetNormals(); |
| 433 | if (normals && normals->GetNumberOfTuples() <= 0) |
| 434 | normals = nullptr; |
| 435 | |
| 436 | tcoords = pd->GetTCoords(); |
| 437 | if (tcoords && tcoords->GetNumberOfTuples() <= 0) |
| 438 | tcoords = nullptr; |
| 439 | |
| 440 | tensors = pd->GetTensors(); |
| 441 | if (tensors && tensors->GetNumberOfTuples() <= 0) |
| 442 | tensors = nullptr; |
| 443 | |
| 444 | globalIds = pd->GetGlobalIds(); |
| 445 | if (globalIds && globalIds->GetNumberOfTuples() <= 0) |
| 446 | globalIds = nullptr; |
| 447 | |
| 448 | pedigreeIds = pd->GetPedigreeIds(); |
| 449 | if (pedigreeIds && pedigreeIds->GetNumberOfTuples() <= 0) |
| 450 | pedigreeIds = nullptr; |
| 451 | |
| 452 | edgeFlags = pd->GetAttribute(vtkDataSetAttributes::EDGEFLAG); |
| 453 | if (edgeFlags && edgeFlags->GetNumberOfTuples() <= 0) |
| 454 | edgeFlags = nullptr; |
| 455 | |
| 456 | field = pd; |
| 457 | if (field && field->GetNumberOfTuples() <= 0) |
| 458 | field = nullptr; |
no test coverage detected