------------------------------------------------------------------------------
| 238 | |
| 239 | //------------------------------------------------------------------------------ |
| 240 | int vtkXMLTableWriter::WriteHeader() |
| 241 | { |
| 242 | vtkIndent indent = vtkIndent().GetNextIndent(); |
| 243 | |
| 244 | ostream& os = *(this->Stream); |
| 245 | |
| 246 | if (!this->WritePrimaryElement(os, indent)) |
| 247 | { |
| 248 | return 0; |
| 249 | } |
| 250 | |
| 251 | this->WriteFieldData(indent.GetNextIndent()); |
| 252 | |
| 253 | if (this->DataMode == vtkXMLWriter::Appended) |
| 254 | { |
| 255 | vtkIndent nextIndent = indent.GetNextIndent(); |
| 256 | |
| 257 | this->AllocatePositionArrays(); |
| 258 | |
| 259 | if ((this->WritePiece < 0) || (this->WritePiece >= this->NumberOfPieces)) |
| 260 | { |
| 261 | // Loop over each piece and write its structure. |
| 262 | for (int currentPieceIndex = 0; currentPieceIndex < this->NumberOfPieces; ++currentPieceIndex) |
| 263 | { |
| 264 | // Open the piece's element. |
| 265 | os << nextIndent << "<Piece"; |
| 266 | this->WriteAppendedPieceAttributes(currentPieceIndex); |
| 267 | if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError) |
| 268 | { |
| 269 | this->DeletePositionArrays(); |
| 270 | return 0; |
| 271 | } |
| 272 | os << ">\n"; |
| 273 | |
| 274 | this->WriteAppendedPiece(currentPieceIndex, nextIndent.GetNextIndent()); |
| 275 | if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError) |
| 276 | { |
| 277 | this->DeletePositionArrays(); |
| 278 | return 0; |
| 279 | } |
| 280 | |
| 281 | // Close the piece's element. |
| 282 | os << nextIndent << "</Piece>\n"; |
| 283 | } |
| 284 | } |
| 285 | else |
| 286 | { |
| 287 | // Write just the requested piece. |
| 288 | // Open the piece's element. |
| 289 | os << nextIndent << "<Piece"; |
| 290 | this->WriteAppendedPieceAttributes(this->WritePiece); |
| 291 | if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError) |
| 292 | { |
| 293 | this->DeletePositionArrays(); |
| 294 | return 0; |
| 295 | } |
| 296 | os << ">\n"; |
| 297 |
no test coverage detected