| 22 | vtkStandardNewMacro(vtkDataSetWriter); |
| 23 | |
| 24 | void vtkDataSetWriter::WriteData() |
| 25 | { |
| 26 | int type; |
| 27 | vtkDataWriter* writer; |
| 28 | vtkAlgorithmOutput* input = this->GetInputConnection(0, 0); |
| 29 | |
| 30 | vtkDebugMacro(<< "Writing vtk dataset..."); |
| 31 | |
| 32 | type = this->GetInput()->GetDataObjectType(); |
| 33 | if (type == VTK_POLY_DATA) |
| 34 | { |
| 35 | vtkPolyDataWriter* pwriter = vtkPolyDataWriter::New(); |
| 36 | pwriter->SetInputConnection(input); |
| 37 | writer = pwriter; |
| 38 | } |
| 39 | |
| 40 | else if (type == VTK_STRUCTURED_POINTS || type == VTK_IMAGE_DATA || type == VTK_UNIFORM_GRID) |
| 41 | { |
| 42 | vtkStructuredPointsWriter* spwriter = vtkStructuredPointsWriter::New(); |
| 43 | spwriter->SetInputConnection(input); |
| 44 | writer = spwriter; |
| 45 | } |
| 46 | |
| 47 | else if (type == VTK_STRUCTURED_GRID) |
| 48 | { |
| 49 | vtkStructuredGridWriter* sgwriter = vtkStructuredGridWriter::New(); |
| 50 | sgwriter->SetInputConnection(input); |
| 51 | writer = sgwriter; |
| 52 | } |
| 53 | |
| 54 | else if (type == VTK_UNSTRUCTURED_GRID) |
| 55 | { |
| 56 | vtkUnstructuredGridWriter* ugwriter = vtkUnstructuredGridWriter::New(); |
| 57 | ugwriter->SetInputConnection(input); |
| 58 | writer = ugwriter; |
| 59 | } |
| 60 | |
| 61 | else if (type == VTK_RECTILINEAR_GRID) |
| 62 | { |
| 63 | vtkRectilinearGridWriter* rgwriter = vtkRectilinearGridWriter::New(); |
| 64 | rgwriter->SetInputConnection(input); |
| 65 | writer = rgwriter; |
| 66 | } |
| 67 | |
| 68 | else |
| 69 | { |
| 70 | vtkErrorMacro(<< "Cannot write dataset type: " << type); |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | writer->SetFileName(this->FileName); |
| 75 | writer->SetScalarsName(this->ScalarsName); |
| 76 | writer->SetVectorsName(this->VectorsName); |
| 77 | writer->SetNormalsName(this->NormalsName); |
| 78 | writer->SetTensorsName(this->TensorsName); |
| 79 | writer->SetTCoordsName(this->TCoordsName); |
| 80 | writer->SetHeader(this->Header); |
| 81 | writer->SetLookupTableName(this->LookupTableName); |
nothing calls this directly
no test coverage detected