Merge pull request #1884 from assimp/isue_1621

closes https://github.com/assimp/assimp/issues/1621: add file check f…
pull/1883/head^2
Kim Kulling 2018-04-12 00:29:15 +02:00 committed by GitHub
commit 9fd6744f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 209 additions and 4 deletions

View File

@ -119,9 +119,18 @@ DXFImporter::~DXFImporter()
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
bool DXFImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const
{
return SimpleExtensionCheck(pFile,"dxf");
bool DXFImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const {
const std::string& extension = GetExtension( pFile );
if ( extension == "dxf" ) {
return true;
}
if ( extension.empty() || checkSig ) {
static const char *pTokens[] = { "SECTION", "HEADER", "ENDSEC", "BLOCKS" };
return BaseImporter::SearchFileHeaderForToken(pIOHandler, pFile, pTokens, 4 );
}
return false;
}
// ------------------------------------------------------------------------------------------------

View File

@ -173,7 +173,6 @@ cmake CMakeLists.txt
A project-file of your default make-system ( like gnu-make on linux or Visual-Studio on Windows ) will be generated.
Run the build and you are done. You can find the libs at assimp/lib and the dll's / so's at bin.
@section assimp_dll Windows DLL Build
The Assimp-package can be built as DLL. You just need to run the default cmake run.

View File

@ -0,0 +1,190 @@
999
VISION3D DXF
0
SECTION
2
HEADER
9
$ACADVER
1
AC1006
9
$INSBASE
10
0.0
20
0.0
30
0.0
9
$EXTMIN
10
0.0
20
0.0
9
$EXTMAX
10
1000.0
20
1000.0
9
$LINMIN
10
0.0
20
0.0
9
$LINMAX
10
1000.0
20
1000.0
0
ENDSEC
0
SECTION
2
TABLES
0
TABLE
2
LTYPE
70
1
0
LTYPE
2
CONTINUOUS
70
64
3
Solid line
72
65
73
0
40
0.000000
0
ENDTAB
0
TABLE
2
LAYER
70
6
0
LAYER
2
1
70
64
62
7
6
CONTINUOUS
0
ENDTAB
0
TABLE
2
STYLE
70
0
0
ENDTAB
0
ENDSEC
0
SECTION
2
BLOCKS
0
ENDSEC
0
SECTION
2
ENTITIES
0
3DFACE
8
1
62
1
10
-0.5
20
-0.5
30
-0.5
11
-0.5
21
0.5
31
-0.5
12
0.5
22
0.5
32
-0.5
13
0.5
23
-0.5
33
-0.5
0
3DFACE
8
1
62
1
10
-0.5
20
-0.5
30
-0.5
11
0.5
21
-0.5
31
-0.5
12
0
22
-0.5
32
0.5
13
0
23
-0.5
33
0.5
0
LINE
8
1
62
1
10
0
20
-0.5
30
0.5
11
0
21
0.5
31
-0.5
0
ENDSEC
0
EOF

View File

@ -62,3 +62,10 @@ public:
TEST_F( utDXFImporterExporter, importDXFFromFileTest ) {
EXPECT_TRUE( importerTest() );
}
TEST_F( utDXFImporterExporter, importerWithoutExtensionTest ) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/DXF/lineTest", aiProcess_ValidateDataStructure );
EXPECT_NE( nullptr, scene );
}