------------------------------------------------------------------------------
| 104 | |
| 105 | //------------------------------------------------------------------------------ |
| 106 | int vtkPDataSetReader::RequestDataObject( |
| 107 | vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 108 | { |
| 109 | |
| 110 | istream* file; |
| 111 | char* block; |
| 112 | char* param; |
| 113 | char* value; |
| 114 | int type; |
| 115 | |
| 116 | // Start reading the meta-data pvtk file. |
| 117 | file = this->OpenFile(this->FileName); |
| 118 | if (file == nullptr) |
| 119 | { |
| 120 | return 0; |
| 121 | } |
| 122 | |
| 123 | type = this->ReadXML(file, &block, ¶m, &value); |
| 124 | if (type == 1 && strcmp(block, "File") == 0) |
| 125 | { |
| 126 | this->ReadPVTKFileInformation(file, request, inputVector, outputVector); |
| 127 | this->VTKFileFlag = 0; |
| 128 | } |
| 129 | else if (type == 4 && strncmp(value, "# vtk DataFile Version", 22) == 0) |
| 130 | { |
| 131 | // This is a vtk file not a PVTK file. |
| 132 | this->ReadVTKFileInformation(request, inputVector, outputVector); |
| 133 | this->VTKFileFlag = 1; |
| 134 | } |
| 135 | else |
| 136 | { |
| 137 | vtkErrorMacro("This does not look like a VTK file: " << this->FileName); |
| 138 | } |
| 139 | |
| 140 | delete file; |
| 141 | file = nullptr; |
| 142 | |
| 143 | vtkInformation* info = outputVector->GetInformationObject(0); |
| 144 | vtkDataSet* output = vtkDataSet::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT())); |
| 145 | |
| 146 | if (output && output->GetDataObjectType() == this->DataType) |
| 147 | { |
| 148 | return 1; |
| 149 | } |
| 150 | |
| 151 | vtkDataSet* newOutput = nullptr; |
| 152 | switch (this->DataType) |
| 153 | { |
| 154 | case VTK_POLY_DATA: |
| 155 | newOutput = vtkPolyData::New(); |
| 156 | break; |
| 157 | case VTK_UNSTRUCTURED_GRID: |
| 158 | newOutput = vtkUnstructuredGrid::New(); |
| 159 | break; |
| 160 | case VTK_STRUCTURED_GRID: |
| 161 | newOutput = vtkStructuredGrid::New(); |
| 162 | break; |
| 163 | case VTK_RECTILINEAR_GRID: |
no test coverage detected