本文整理汇总了C++中dxf::LineReader::Value方法的典型用法代码示例。如果您正苦于以下问题:C++ LineReader::Value方法的具体用法?C++ LineReader::Value怎么用?C++ LineReader::Value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dxf::LineReader
的用法示例。
在下文中一共展示了LineReader::Value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InternReadFile
// ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure.
void DXFImporter::InternReadFile( const std::string& pFile,
aiScene* pScene,
IOSystem* pIOHandler)
{
std::shared_ptr<IOStream> file = std::shared_ptr<IOStream>( pIOHandler->Open( pFile) );
// Check whether we can read the file
if( file.get() == NULL) {
throw DeadlyImportError( "Failed to open DXF file " + pFile + "");
}
// check whether this is a binaray DXF file - we can't read binary DXF files :-(
char buff[AI_DXF_BINARY_IDENT_LEN+1] = {0};
file->Read(buff,AI_DXF_BINARY_IDENT_LEN,1);
if (!strncmp(AI_DXF_BINARY_IDENT,buff,AI_DXF_BINARY_IDENT_LEN)) {
throw DeadlyImportError("DXF: Binary files are not supported at the moment");
}
// DXF files can grow very large, so read them via the StreamReader,
// which will choose a suitable strategy.
file->Seek(0,aiOrigin_SET);
StreamReaderLE stream( file );
DXF::LineReader reader (stream);
DXF::FileData output;
// now get all lines of the file and process top-level sections
bool eof = false;
while(!reader.End()) {
// blocks table - these 'build blocks' are later (in ENTITIES)
// referenced an included via INSERT statements.
if (reader.Is(2,"BLOCKS")) {
ParseBlocks(reader,output);
continue;
}
// primary entity table
if (reader.Is(2,"ENTITIES")) {
ParseEntities(reader,output);
continue;
}
// skip unneeded sections entirely to avoid any problems with them
// altogether.
else if (reader.Is(2,"CLASSES") || reader.Is(2,"TABLES")) {
SkipSection(reader);
continue;
}
else if (reader.Is(2,"HEADER")) {
ParseHeader(reader,output);
continue;
}
// comments
else if (reader.Is(999)) {
ASSIMP_LOG_INFO_F("DXF Comment: ", reader.Value());
}
// don't read past the official EOF sign
else if (reader.Is(0,"EOF")) {
eof = true;
break;
}
++reader;
}
if (!eof) {
ASSIMP_LOG_WARN("DXF: EOF reached, but did not encounter DXF EOF marker");
}
ConvertMeshes(pScene,output);
// Now rotate the whole scene by 90 degrees around the x axis to convert from AutoCAD's to Assimp's coordinate system
pScene->mRootNode->mTransformation = aiMatrix4x4(
1.f,0.f,0.f,0.f,
0.f,0.f,1.f,0.f,
0.f,-1.f,0.f,0.f,
0.f,0.f,0.f,1.f) * pScene->mRootNode->mTransformation;
}