------------------------------------------------------------------------------
| 235 | |
| 236 | //------------------------------------------------------------------------------ |
| 237 | int vtkXMLCompositeDataWriter::WriteNonCompositeData( |
| 238 | vtkDataObject* dObj, vtkXMLDataElement* datasetXML, int& writerIdx, const char* fileName) |
| 239 | { |
| 240 | // Write a leaf dataset. |
| 241 | int myWriterIndex = writerIdx; |
| 242 | writerIdx++; |
| 243 | |
| 244 | // Locate the actual data writer for this dataset. |
| 245 | vtkXMLWriter* writer = this->GetWriter(myWriterIndex); |
| 246 | if (!writer) |
| 247 | { |
| 248 | return 1; |
| 249 | } |
| 250 | |
| 251 | vtkDataSet* curDS = vtkDataSet::SafeDownCast(dObj); |
| 252 | vtkTable* curTable = vtkTable::SafeDownCast(dObj); |
| 253 | vtkHyperTreeGrid* curHTG = vtkHyperTreeGrid::SafeDownCast(dObj); |
| 254 | if (!curDS && !curTable && !curHTG) |
| 255 | { |
| 256 | if (dObj) |
| 257 | { |
| 258 | vtkWarningMacro("This writer cannot handle sub-datasets of type: " |
| 259 | << dObj->GetClassName() << " Dataset will be skipped."); |
| 260 | } |
| 261 | return 0; |
| 262 | } |
| 263 | |
| 264 | if (datasetXML) |
| 265 | { |
| 266 | // Create the entry for the collection file. |
| 267 | datasetXML->SetAttribute("file", fileName); |
| 268 | } |
| 269 | |
| 270 | // FIXME |
| 271 | // Ken's note, I do not think you can fix this, the |
| 272 | // setprogress range has to be done in the loop that calls |
| 273 | // this function. |
| 274 | // this->SetProgressRange(progressRange, myWriterIndex, |
| 275 | // GetNumberOfInputConnections(0)+writeCollection); |
| 276 | |
| 277 | std::string full = this->Internal->FilePath; |
| 278 | full += fileName; |
| 279 | |
| 280 | writer->SetFileName(full.c_str()); |
| 281 | |
| 282 | // Write the data. |
| 283 | writer->AddObserver(vtkCommand::ProgressEvent, this->InternalProgressObserver); |
| 284 | writer->Write(); |
| 285 | writer->RemoveObserver(this->InternalProgressObserver); |
| 286 | |
| 287 | if (writer->GetErrorCode() == vtkErrorCode::OutOfDiskSpaceError) |
| 288 | { |
| 289 | this->SetErrorCode(vtkErrorCode::OutOfDiskSpaceError); |
| 290 | vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName); |
| 291 | return 0; |
| 292 | } |
| 293 | return 1; |
| 294 | } |
no test coverage detected