------------------------------------------------------------------------------
| 377 | |
| 378 | //------------------------------------------------------------------------------ |
| 379 | vtkDataObject* vtkGraphReader::CreateOutput(vtkDataObject* currentOutput) |
| 380 | { |
| 381 | GraphType graphType; |
| 382 | if (!this->ReadGraphType(this->GetFileName(), graphType)) |
| 383 | { |
| 384 | this->CloseVTKFile(); |
| 385 | return nullptr; |
| 386 | } |
| 387 | this->CloseVTKFile(); |
| 388 | |
| 389 | switch (graphType) |
| 390 | { |
| 391 | case vtkGraphReader::DirectedGraph: |
| 392 | if (currentOutput && currentOutput->IsA("vtkDirectedGraph")) |
| 393 | { |
| 394 | return currentOutput; |
| 395 | } |
| 396 | return vtkDirectedGraph::New(); |
| 397 | |
| 398 | case vtkGraphReader::UndirectedGraph: |
| 399 | if (currentOutput && currentOutput->IsA("vtkUndirectedGraph")) |
| 400 | { |
| 401 | return currentOutput; |
| 402 | } |
| 403 | return vtkUndirectedGraph::New(); |
| 404 | |
| 405 | case vtkGraphReader::Molecule: |
| 406 | if (currentOutput && currentOutput->IsA("vtkMolecule")) |
| 407 | { |
| 408 | return currentOutput; |
| 409 | } |
| 410 | return vtkMolecule::New(); |
| 411 | |
| 412 | case vtkGraphReader::UnknownGraph: |
| 413 | default: |
| 414 | vtkErrorMacro("ReadGraphType returned invalid result."); |
| 415 | return nullptr; |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | //------------------------------------------------------------------------------ |
| 420 | void vtkGraphReader::PrintSelf(ostream& os, vtkIndent indent) |
no test coverage detected