Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve OGR CAD driver #172

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 11 additions & 24 deletions gdal/ogr/ogrsf_frmts/cad/libopencad/cadtables.cpp
Expand Up @@ -127,35 +127,22 @@ int CADTables::ReadLayersTable( CADFile * const pCADFile, long dLayerControlHand
unique_ptr<CADEntityObject> spEntityObj( static_cast<CADEntityObject *>(
pCADFile->GetObject( dCurrentEntHandle, true )) );

if( dCurrentEntHandle == dLastEntHandle )
if( spEntityObj == nullptr )
{
if( nullptr != spEntityObj )
FillLayer( spEntityObj.get() );
else
{
#ifdef _DEBUG
assert( 0 );
#endif //_DEBUG
}
DebugMsg( "Entity object is null\n" );
break;
}

/* This check may look excessive, but if something goes wrong way -
* some part of geometries will be parsed. */
if( spEntityObj != nullptr )
} else if ( dCurrentEntHandle == dLastEntHandle )
{
FillLayer( spEntityObj.get() );

if( spEntityObj->stCed.bNoLinks )
++dCurrentEntHandle;
else
dCurrentEntHandle = spEntityObj->stChed.hNextEntity.getAsLong( spEntityObj->stCed.hObjectHandle );
} else
{
#ifdef _DEBUG
assert( 0 );
#endif //_DEBUG
break;
}

FillLayer( spEntityObj.get() );

if( spEntityObj->stCed.bNoLinks )
++dCurrentEntHandle;
else
dCurrentEntHandle = spEntityObj->stChed.hNextEntity.getAsLong( spEntityObj->stCed.hObjectHandle );
}

DebugMsg( "Readed aLayers using LayerControl object count: %d\n",
Expand Down