| 25 | } |
| 26 | |
| 27 | void vtkSimplePointsWriter::WriteData() |
| 28 | { |
| 29 | vtkPointSet* input = vtkPointSet::SafeDownCast(this->GetInput()); |
| 30 | vtkIdType numberOfPoints = 0; |
| 31 | |
| 32 | if (input) |
| 33 | { |
| 34 | numberOfPoints = input->GetNumberOfPoints(); |
| 35 | } |
| 36 | |
| 37 | // OpenVTKFile() will report any errors that happen |
| 38 | ostream* outfilep = this->OpenVTKFile(); |
| 39 | if (!outfilep) |
| 40 | { |
| 41 | return; |
| 42 | } |
| 43 | |
| 44 | ostream& outfile = *outfilep; |
| 45 | |
| 46 | for (vtkIdType i = 0; i < numberOfPoints; i++) |
| 47 | { |
| 48 | double p[3]; |
| 49 | input->GetPoint(i, p); |
| 50 | outfile << std::setprecision(this->DecimalPrecision) << p[0] << " " << p[1] << " " << p[2] |
| 51 | << std::endl; |
| 52 | } |
| 53 | |
| 54 | // Close the file |
| 55 | this->CloseVTKFile(outfilep); |
| 56 | |
| 57 | // Delete the file if an error occurred |
| 58 | if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError) |
| 59 | { |
| 60 | vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName); |
| 61 | unlink(this->FileName); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | void vtkSimplePointsWriter::PrintSelf(ostream& os, vtkIndent indent) |
| 66 | { |
nothing calls this directly
no test coverage detected