1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0028680: Data Exchange - allow reading of multi-domain STL files

Method RWStl::Read() is improved to support reading multi-domain STL files.

Test added: bugs stlvrml bug28680
This commit is contained in:
abv
2017-07-30 21:29:17 +03:00
committed by bugmaster
parent 4178b3531b
commit 1d949423b7
3 changed files with 33 additions and 10 deletions

View File

@@ -132,18 +132,31 @@ Standard_Boolean RWStl_Reader::Read (const char* theFile,
}
Standard_IStream aStream (&aBuf);
if (IsAscii (aStream))
// get length of file to feed progress indicator in Ascii mode
aStream.seekg (0, aStream.end);
std::streampos theEnd = aStream.tellg();
aStream.seekg (0, aStream.beg);
while (!aStream.eof() && !aStream.bad())
{
// get length of file to feed progress indicator
aStream.seekg (0, aStream.end);
std::streampos theEnd = aStream.tellg();
aStream.seekg (0, aStream.beg);
return ReadAscii (aStream, theEnd, theProgress);
}
else
{
return ReadBinary (aStream, theProgress);
if (IsAscii (aStream))
{
if (!ReadAscii (aStream, theEnd, theProgress))
{
break;
}
}
else
{
if (!ReadBinary (aStream, theProgress))
{
break;
}
}
aStream >> std::ws; // skip any white spaces
}
return !aStream.bad();
}
//==============================================================================