------------------------------------------------------------------------------
| 35 | |
| 36 | //------------------------------------------------------------------------------ |
| 37 | vtkSmartPointer<vtkResourceStream> vtkOBJReader::Open() |
| 38 | { |
| 39 | if (this->Stream) |
| 40 | { |
| 41 | if (this->Stream->SupportSeek()) |
| 42 | { |
| 43 | this->Stream->Seek(0, vtkResourceStream::SeekDirection::Begin); |
| 44 | } |
| 45 | |
| 46 | return this->Stream; |
| 47 | } |
| 48 | |
| 49 | auto fileStream = vtkSmartPointer<vtkFileResourceStream>::New(); |
| 50 | if (!this->FileName || !fileStream->Open(this->FileName)) |
| 51 | { |
| 52 | vtkErrorMacro(<< "Failed to open file: " |
| 53 | << (this->FileName ? this->FileName : "No file name set")); |
| 54 | return nullptr; |
| 55 | } |
| 56 | |
| 57 | return fileStream; |
| 58 | } |
| 59 | |
| 60 | /*---------------------------------------------------------------------------*\ |
| 61 |
no test coverage detected