From 08abf92922b6c04ba27aaddcea9c2d2a1648a392 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Fri, 9 Nov 2018 12:28:00 +1000 Subject: [PATCH] Explicitly disable debug messages in dwg import Even preventing their output isn't enough here. There's just SO many debug msgs throughout this class, that creating and parsing the debug messages strings (which is done even if the message level is higher than is output) is enough to grind the import to a halt on debug enabled builds. --- external/libdxfrw/drw_entities.cpp | 557 ++++++++++++++++++++++++++++- 1 file changed, 555 insertions(+), 2 deletions(-) diff --git a/external/libdxfrw/drw_entities.cpp b/external/libdxfrw/drw_entities.cpp index ccd1dbcea9e..83d3dfb94bc 100644 --- a/external/libdxfrw/drw_entities.cpp +++ b/external/libdxfrw/drw_entities.cpp @@ -21,6 +21,9 @@ #include "qgslogger.h" #include +// uncomment to get detailed debug output on DWG read. Caution: this option makes DWG import super-slow! +// #define DWGDEBUG 1 + #define RESERVE( vector, size ) try { \ vector.reserve(size); \ } catch(const std::exception &e) { \ @@ -220,72 +223,99 @@ bool DRW_Entity::parseDxfGroups( int code, dxfReader *reader ) bool DRW_Entity::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *strBuf, duint32 bs ) { objSize = 0; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing entity *********************************************" ), 4 ); +#endif oType = buf->getObjType( version ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Object type: %1, 0x%2" ).arg( oType ).arg( oType, 0, 16 ), 4 ); - +#endif if ( version > DRW::AC1014 && version < DRW::AC1024 ) //2000 & 2004 { objSize = buf->getRawLong32(); //RL 32bits object size in bits +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " Object size: %1" ).arg( objSize ), 4 ); +#endif } if ( version > DRW::AC1021 ) //2010+ { duint32 ms = buf->size(); objSize = ms * 8 - bs; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " Object size: %1" ).arg( objSize ), 4 ); +#endif } if ( strBuf && version > DRW::AC1018 ) //2007+ { strBuf->moveBitPos( objSize - 1 ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "strBuf strbit pos 2007:%1 strBuf bpos 2007:%2" ) .arg( strBuf->getPosition() ).arg( strBuf->getBitPos() ), 4 ); +#endif if ( strBuf->getBit() == 1 ) { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "string bit is 1" ), 4 ); +#endif strBuf->moveBitPos( -17 ); duint16 strDataSize = strBuf->getRawShort16(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "strDataSize: %1" ).arg( strDataSize ), 4 ); +#endif if ( ( strDataSize & 0x8000 ) == 0x8000 ) { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "string 0x8000 bit is set" ), 4 ); +#endif strBuf->moveBitPos( -33 );//RLZ pending to verify duint16 hiSize = strBuf->getRawShort16(); strDataSize = ( ( strDataSize & 0x7fff ) | ( hiSize << 15 ) ); } strBuf->moveBitPos( -strDataSize - 16 ); //-14 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "strBuf start strDataSize pos 2007:%1 strBuf bpos 2007:%2" ) .arg( strBuf->getPosition() ).arg( strBuf->getBitPos() ), 4 ); +#endif } else { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "string bit is 0" ), 4 ); +#endif } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "strBuf start pos 2007:%1 strBuf bpos 2007:%2" ) .arg( strBuf->getPosition() ).arg( strBuf->getBitPos() ), 4 ); +#endif } dwgHandle ho = buf->getHandle(); handle = ho.ref; dint16 extDataSize = buf->getBitShort(); //BS +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Entity Handle: %1.%2 0x%3; ext data size:%4" ).arg( ho.code ).arg( ho.size ).arg( ho.ref, 0, 16 ).arg( extDataSize ), 4 ); +#endif while ( extDataSize > 0 && buf->isGood() ) { /* RLZ: TODO */ dwgHandle ah = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " App Handle: %1.%2 0x%3" ).arg( ah.code ).arg( ah.size ).arg( ah.ref, 0, 16 ), 4 ); +#endif duint8 *tmpExtData = new duint8[extDataSize]; buf->getBytes( tmpExtData, extDataSize ); dwgBuffer tmpExtDataBuf( tmpExtData, extDataSize, buf->decoder ); duint8 dxfCode = tmpExtDataBuf.getRawChar8(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " dxfCode: %1" ).arg( dxfCode ), 4 ); +#endif switch ( dxfCode ) { @@ -302,7 +332,9 @@ bool DRW_Entity::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *strB l << QStringLiteral( "0x%1" ).arg( dxfChar, 0, 16 ); } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "strLength:%1; str codepage:%2; %3" ).arg( strLength ).arg( cp ).arg( l.join( ' ' ) ), 4 ); +#endif Q_UNUSED( l ); break; } @@ -312,26 +344,36 @@ bool DRW_Entity::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *strB } delete[]tmpExtData; extDataSize = buf->getBitShort(); //BS +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " ext data size: %1" ).arg( extDataSize ), 4 ); +#endif } //end parsing extData (EED) duint8 graphFlag = buf->getBit(); //B +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "graphFlag:%1" ).arg( graphFlag ), 4 ); +#endif if ( graphFlag ) { duint32 graphDataSize = buf->getRawLong32(); //RL 32bits +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "graphData in bytes: %1" ).arg( graphDataSize ), 4 ); +#endif // RLZ: TODO //skip graphData bytes duint8 *tmpGraphData = new duint8[graphDataSize]; buf->getBytes( tmpGraphData, graphDataSize ); dwgBuffer tmpGraphDataBuf( tmpGraphData, graphDataSize, buf->decoder ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "graph data remaining bytes:%1" ).arg( tmpGraphDataBuf.numRemainingBytes() ), 4 ); +#endif delete[]tmpGraphData; } if ( version < DRW::AC1015 ) //14- { objSize = buf->getRawLong32(); //RL 32bits object size in bits +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " Object size in bits: %1" ).arg( objSize ), 4 ); +#endif } duint8 entmode = buf->get2Bits(); //BB @@ -343,7 +385,9 @@ bool DRW_Entity::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *strB space = static_cast< DRW::Space >( entmode ); //RLZ verify cast values numReactors = buf->getBitShort(); //BS +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "entmode:%1, numReactors: %2" ).arg( entmode ).arg( numReactors ), 4 ); +#endif if ( version < DRW::AC1015 ) //14- { @@ -357,28 +401,38 @@ bool DRW_Entity::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *strB lineType = ""; ltFlags = 3; } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " lineType:%1 ltFlags:%2" ).arg( lineType.c_str() ).arg( ltFlags ), 4 ); +#endif } if ( version > DRW::AC1015 ) //2004+ { xDictFlag = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " xDictFlag: %1" ).arg( xDictFlag ), 4 ); +#endif } if ( version > DRW::AC1024 || version < DRW::AC1018 ) { haveNextLinks = buf->getBit(); //aka nolinks //B +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "haveNextLinks (0 yes, 1 prev next): %1" ).arg( haveNextLinks ), 4 ); +#endif } else { haveNextLinks = 1; //aka nolinks //B +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "haveNextLinks (forced): %1" ).arg( haveNextLinks ), 4 ); +#endif } //ENC color color = buf->getEnColor( version, color24, transparency ); //BS or CMC //OK for R14 or negate ltypeScale = buf->getBitDouble(); //BD +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " entity color:%1 ltScale:%2" ).arg( color ).arg( ltypeScale ), 4 ); +#endif if ( version > DRW::AC1014 ) //2000+ { @@ -398,11 +452,15 @@ bool DRW_Entity::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *strB { ltFlags = plotFlags; lineType = plotStyleName; //RLZ: howto solve? if needed plotStyleName; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "ltFlags:%1 lineType:%2" ).arg( lineType.c_str() ).arg( ltFlags ), 4 ); +#endif } else { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "plotFlags:%1" ).arg( plotFlags ), 4 ); +#endif } } } @@ -410,23 +468,31 @@ bool DRW_Entity::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *strB { materialFlag = buf->get2Bits(); //BB shadowFlag = buf->getRawChar8(); //RC +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " materialFlag:%1 shadowFlag:%2" ).arg( materialFlag ).arg( shadowFlag ), 4 ); +#endif } if ( version > DRW::AC1021 ) //2010+ { duint8 visualFlags = buf->get2Bits(); //full & face visual style duint8 unk = buf->getBit(); //edge visual style +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " shadowFlag 2:%1 unknown bit:%2" ).arg( visualFlags ).arg( unk ), 4 ); +#endif Q_UNUSED( visualFlags ); Q_UNUSED( unk ); } dint16 invisibleFlag = buf->getBitShort(); //BS +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " invisibleFlag:%1" ).arg( invisibleFlag ), 4 ); +#endif Q_UNUSED( invisibleFlag ); if ( version > DRW::AC1014 ) //2000+ { lWeight = DRW_LW_Conv::dwgInt2lineWidth( buf->getRawChar8() ); //RC +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " lwFlag (lWeight):%1" ).arg( lWeight ), 4 ); +#endif Q_UNUSED( lWeight ); } #if 0 @@ -434,7 +500,9 @@ bool DRW_Entity::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *strB if ( version > DRW::AC1018 ) //2007+ { duint8 unk = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "unknown bit: %1" ).arg( unk ), 4 ); +#endif } #endif return buf->isGood(); @@ -451,51 +519,67 @@ bool DRW_Entity::parseDwgEntHandle( DRW::Version version, dwgBuffer *buf ) if ( ownerHandle ) //entity are in block or in a polyline { dwgHandle ownerH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "owner (parent) Handle:%1.%2 0x%3 Remaining bytes:%4" ) .arg( ownerH.code ).arg( ownerH.size ).arg( ownerH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif parentHandle = ownerH.ref; } else { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "NO Block (parent) Handle" ), 4 ); +#endif } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif for ( int i = 0; i < numReactors; ++i ) { dwgHandle reactorsH = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "reactorsH control Handle:%1.%2 0x%3" ) .arg( reactorsH.code ).arg( reactorsH.size ).arg( reactorsH.ref, 0, 16 ), 4 ); +#endif } if ( xDictFlag != 1 ) //linetype in 2004 seems not have XDicObjH or NULL handle { dwgHandle XDicObjH = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "XDicObj control Handle:%1.%2 0x%3" ) .arg( XDicObjH.code ).arg( XDicObjH.size ).arg( XDicObjH.ref, 0, 16 ), 4 ); +#endif } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif if ( version < DRW::AC1015 ) //R14- { //layer handle layerH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " layer Handle:%1.%2 0x%3, remaining bytes %4" ) .arg( layerH.code ).arg( layerH.size ).arg( layerH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif //lineType handle if ( ltFlags == 3 ) { lTypeH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " linetype Handle:%1.%2 0x%3, remaining bytes %4" ) .arg( lTypeH.code ).arg( lTypeH.size ).arg( lTypeH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif } } if ( version < DRW::AC1018 ) //2000+ @@ -503,14 +587,18 @@ bool DRW_Entity::parseDwgEntHandle( DRW::Version version, dwgBuffer *buf ) if ( haveNextLinks == 0 ) { dwgHandle nextLinkH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " prev nextLinkers Handle:%1.%2 0x%3, remaining bytes %4" ) .arg( nextLinkH.code ).arg( nextLinkH.size ).arg( nextLinkH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif prevEntLink = nextLinkH.ref; nextLinkH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " next nextLinkers Handle:%1.%2 0x%3, remaining bytes %4" ) .arg( nextLinkH.code ).arg( nextLinkH.size ).arg( nextLinkH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif nextEntLink = nextLinkH.ref; } else @@ -527,16 +615,20 @@ bool DRW_Entity::parseDwgEntHandle( DRW::Version version, dwgBuffer *buf ) { //layer handle layerH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " layer Handle:%1.%2 0x%3, remaining bytes %4" ) .arg( layerH.code ).arg( layerH.size ).arg( layerH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif //lineType handle if ( ltFlags == 3 ) { lTypeH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " linetype Handle:%1.%2 0x%3, remaining bytes %4" ) .arg( lTypeH.code ).arg( lTypeH.size ).arg( lTypeH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif } } if ( version > DRW::AC1014 ) //2000+ @@ -546,27 +638,35 @@ bool DRW_Entity::parseDwgEntHandle( DRW::Version version, dwgBuffer *buf ) if ( materialFlag == 3 ) { dwgHandle materialH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " material handle:%1.%2 0x%3, remaining bytes %4" ) .arg( materialH.code ).arg( materialH.size ).arg( materialH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif } if ( shadowFlag == 3 ) { dwgHandle shadowH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " shadow handle:%1.%2 0x%3, remaining bytes %4" ) .arg( shadowH.code ).arg( shadowH.size ).arg( shadowH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif } } if ( plotFlags == 3 ) { dwgHandle plotStyleH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " plot style handle:%1.%2 0x%3, remaining bytes %4" ) .arg( plotStyleH.code ).arg( plotStyleH.size ).arg( plotStyleH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif } } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "remaining bytes:%1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif return buf->isGood(); } @@ -609,7 +709,9 @@ bool DRW_Point::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing point *********************************************" ), 4 ); +#endif basePoint.x = buf->getBitDouble(); basePoint.y = buf->getBitDouble(); @@ -618,12 +720,14 @@ bool DRW_Point::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) extPoint = buf->getExtrusion( version > DRW::AC1014 ); double x_axis = buf->getBitDouble();//BD +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "point:%1 thickness:%2, extrusion:%3, x_axis:%4" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ) ) .arg( thickness ) .arg( QStringLiteral( "%1,%2,%3" ).arg( extPoint.x ).arg( extPoint.y ).arg( extPoint.z ) ) .arg( x_axis ), 4 ); +#endif Q_UNUSED( x_axis ); ret = DRW_Entity::parseDwgEntHandle( version, buf ); @@ -660,7 +764,9 @@ bool DRW_Line::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing line *********************************************" ), 4 ); +#endif if ( version < DRW::AC1015 ) //14- { @@ -687,12 +793,14 @@ bool DRW_Line::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) thickness = buf->getThickness( version > DRW::AC1014 );//BD extPoint = buf->getExtrusion( version > DRW::AC1014 ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "startpoint:%1 endpoint:%2 thickness:%3 extrusion:%4" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ), QStringLiteral( "%1,%2,%3" ).arg( secPoint.x ).arg( secPoint.y ).arg( secPoint.z ) ) .arg( thickness ) .arg( QStringLiteral( "%1,%2,%3" ).arg( extPoint.x ).arg( extPoint.y ).arg( extPoint.z ) ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); if ( !ret ) @@ -709,7 +817,9 @@ bool DRW_Ray::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing ray/xline *********************************************" ), 4 ); +#endif basePoint.x = buf->getBitDouble(); basePoint.y = buf->getBitDouble(); @@ -718,10 +828,12 @@ bool DRW_Ray::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) secPoint.y = buf->getBitDouble(); secPoint.z = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "startpoint:%1 vector:%2" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ), QStringLiteral( "%1,%2,%3" ).arg( secPoint.x ).arg( secPoint.y ).arg( secPoint.z ) ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); if ( !ret ) @@ -762,7 +874,9 @@ bool DRW_Circle::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing circle *********************************************" ), 4 ); +#endif basePoint.x = buf->getBitDouble(); basePoint.y = buf->getBitDouble(); @@ -771,11 +885,13 @@ bool DRW_Circle::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) thickness = buf->getThickness( version > DRW::AC1014 ); extPoint = buf->getExtrusion( version > DRW::AC1014 ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "center:%1 radius:%2 thickness:%3 extrusion:%4" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ) ) .arg( mRadius ).arg( thickness ) .arg( QStringLiteral( "%1,%2,%3" ).arg( extPoint.x ).arg( extPoint.y ).arg( extPoint.z ) ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); if ( !ret ) @@ -831,7 +947,9 @@ bool DRW_Arc::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing circle arc *********************************************" ), 4 ); +#endif basePoint.x = buf->getBitDouble(); basePoint.y = buf->getBitDouble(); @@ -842,12 +960,14 @@ bool DRW_Arc::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) staangle = buf->getBitDouble(); endangle = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "center:%1,%2,%3 radius:%4 thickness:%5 extrusion:%6,%7,%8 staangle:%9 endangle:%10" ) .arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ) .arg( mRadius ).arg( thickness ) .arg( extPoint.x ).arg( extPoint.y ).arg( extPoint.z ) .arg( staangle ).arg( endangle ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); if ( !ret ) @@ -926,7 +1046,9 @@ bool DRW_Ellipse::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing ellipse *********************************************" ), 4 ); +#endif basePoint = buf->get3BitDouble(); secPoint = buf->get3BitDouble(); @@ -935,12 +1057,14 @@ bool DRW_Ellipse::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) staparam = buf->getBitDouble();//BD endparam = buf->getBitDouble();//BD +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "center:%1 axis:%2 extrusion:%3 ratio:%4 staparam:%5 endparam:%6" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ), QStringLiteral( "%1,%2,%3" ).arg( secPoint.x ).arg( secPoint.y ).arg( secPoint.z ), QStringLiteral( "%1,%2,%3" ).arg( extPoint.x ).arg( extPoint.y ).arg( extPoint.z ) ) .arg( ratio ).arg( staparam ).arg( endparam ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); if ( !ret ) @@ -1035,7 +1159,9 @@ bool DRW_Trace::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing Trace *********************************************" ), 4 ); +#endif thickness = buf->getThickness( version > DRW::AC1014 ); basePoint.z = buf->getBitDouble(); @@ -1052,6 +1178,7 @@ bool DRW_Trace::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) fourthPoint.z = basePoint.z; extPoint = buf->getExtrusion( version > DRW::AC1014 ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "base:%1 sec:%2 third:%3 fourth:%4 extrusion:%5 thickness:%6" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ), QStringLiteral( "%1,%2,%3" ).arg( secPoint.x ).arg( secPoint.y ).arg( secPoint.z ), @@ -1060,6 +1187,7 @@ bool DRW_Trace::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) QStringLiteral( "%1,%2,%3" ).arg( extPoint.x ).arg( extPoint.y ).arg( extPoint.z ) ) .arg( thickness ), 4 ); +#endif /* Common Entity Handle Data */ ret = DRW_Entity::parseDwgEntHandle( version, buf ); @@ -1078,7 +1206,9 @@ void DRW_Solid::parseCode( int code, dxfReader *reader ) bool DRW_Solid::parseDwg( DRW::Version v, dwgBuffer *buf, duint32 bs ) { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing Solid *********************************************" ), 4 ); +#endif return DRW_Trace::parseDwg( v, buf, bs ); } @@ -1102,7 +1232,9 @@ bool DRW_3Dface::parseDwg( DRW::Version v, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing 3Dface *********************************************" ), 4 ); +#endif if ( v < DRW::AC1015 ) // R13 & R14 { @@ -1141,6 +1273,7 @@ bool DRW_3Dface::parseDwg( DRW::Version v, dwgBuffer *buf, duint32 bs ) drw_assert( invisibleflag >= NoEdge ); drw_assert( invisibleflag <= AllEdges ); //#spellok +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "base:%1 sec:%2 third:%3 fourth:%4 invisibleFlag:%5" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ), QStringLiteral( "%1,%2,%3" ).arg( secPoint.x ).arg( secPoint.y ).arg( secPoint.z ), @@ -1148,6 +1281,7 @@ bool DRW_3Dface::parseDwg( DRW::Version v, dwgBuffer *buf, duint32 bs ) QStringLiteral( "%1,%2,%3" ).arg( fourthPoint.x ).arg( fourthPoint.y ).arg( fourthPoint.z ) ) .arg( invisibleflag ), 4 ); +#endif // Common Entity Handle Data ret = DRW_Entity::parseDwgEntHandle( v, buf ); @@ -1185,18 +1319,26 @@ bool DRW_Block::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) return ret; if ( !isEnd ) { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing block *********************************************" ), 4 ); +#endif name = sBuf->getVariableText( version, false ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Block name: %1" ).arg( name.c_str() ), 4 ); +#endif } else { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing end block *********************************************" ), 4 ); +#endif } if ( version > DRW::AC1018 ) //2007+ { duint8 unk = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "unknown bit: %1" ).arg( unk ), 4 ); +#endif Q_UNUSED( unk ); } // X handleAssoc; //X @@ -1251,15 +1393,19 @@ bool DRW_Insert::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "************************** parsing insert/minsert *****************************************" ), 4 ); +#endif basePoint.x = buf->getBitDouble(); basePoint.y = buf->getBitDouble(); basePoint.z = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "insertion point:%1" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ) ), 4 ); +#endif if ( version < DRW::AC1015 ) //14- { @@ -1295,21 +1441,27 @@ bool DRW_Insert::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) angle = buf->getBitDouble(); extPoint = buf->getExtrusion( false ); //3BD R14 style +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "scale:%1, angle:%2 extrusion:%3" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( xscale ).arg( yscale ).arg( zscale ) ) .arg( angle ) .arg( QStringLiteral( "%1,%2,%3" ).arg( extPoint.x ).arg( extPoint.y ).arg( extPoint.z ) ), 4 ); +#endif bool hasAttrib = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " has Attrib:%1" ).arg( hasAttrib ), 4 ); +#endif if ( hasAttrib && version > DRW::AC1015 ) //2004+ { objCount = buf->getBitLong(); Q_UNUSED( objCount ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "objCount:%1" ).arg( objCount ), 4 ); +#endif } if ( oType == 8 ) //entity are minsert { @@ -1319,15 +1471,19 @@ bool DRW_Insert::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) rowspace = buf->getBitDouble(); } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); blockRecH = buf->getHandle(); /* H 2 BLOCK HEADER (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " BLOCK HEADER Handle: %1.%2 0x%3, remaining bytes %4" ) .arg( blockRecH.code ).arg( blockRecH.size ).arg( blockRecH.ref, 0, 16 ) .arg( buf->numRemainingBytes() ), 4 ); +#endif // attribs follows if ( hasAttrib ) @@ -1336,34 +1492,45 @@ bool DRW_Insert::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) { dwgHandle attH = buf->getHandle(); /* H 2 BLOCK HEADER (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " first attrib handle: %1.%2 0x%3" ) .arg( attH.code ).arg( attH.size ).arg( attH.ref, 0, 16 ), 4 ); +#endif attH = buf->getHandle(); /* H 2 BLOCK HEADER (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " second attrib handle: %1.%2 0x%3" ) .arg( attH.code ).arg( attH.size ).arg( attH.ref, 0, 16 ), 4 ); +#endif + } else { for ( duint8 i = 0; i < objCount; ++i ) { dwgHandle attH = buf->getHandle(); /* H 2 BLOCK HEADER (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " attrib handle #%1: %2.%3 0x%4" ) .arg( i ).arg( attH.code ).arg( attH.size ).arg( attH.ref, 0, 16 ), 4 ); +#endif } } seqendH = buf->getHandle(); /* H 2 BLOCK HEADER (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " seqend handle: %1.%2 0x%3" ) .arg( seqendH.code ).arg( seqendH.size ).arg( seqendH.ref, 0, 16 ), 4 ); +#endif } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " Remaining bytes:%1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif if ( !ret ) return ret; @@ -1454,10 +1621,14 @@ bool DRW_LWPolyline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing LWPolyline *******************************************" ), 4 ); +#endif flags = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "flags value:0x%1" ).arg( flags, 0, 16 ), 4 ); +#endif if ( flags & 4 ) width = buf->getBitDouble(); @@ -1484,16 +1655,20 @@ bool DRW_LWPolyline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs if ( flags & 32 ) widthsnum = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "vertex num:%1, bulges num:%2, vertexIdCount:%3, widths num:%4" ) .arg( vertexnum ).arg( bulgesnum ).arg( vertexIdCount ).arg( widthsnum ), 4 ); +#endif //clear all bit except 128 = plinegen and set 1 to open/close //RLZ:verify plinegen & open //dxf: plinegen 128 & open 1 flags = ( flags & 512 ) ? ( flags | 1 ) : ( flags | 0 ); flags &= 129; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "end flags value:0x%1" ).arg( flags, 0, 16 ), 4 ); +#endif if ( vertexnum > 0 ) //verify if is lwpol without vertex (empty) { @@ -1553,17 +1728,22 @@ bool DRW_LWPolyline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs } } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Vertex list: " ), 5 ); +#endif + for ( std::vector::iterator it = vertlist.begin() ; it != vertlist.end(); ++it ) { DRW_Vertex2D *pv = *it; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "x:%1 y:%2 bulge:%3 stawidth:%4 endwidth:%5" ) .arg( pv->x ).arg( pv->y ) .arg( pv->bulge ) .arg( pv->stawidth ) .arg( pv->endwidth ), 5 ); +#endif Q_UNUSED( pv ); } @@ -1627,7 +1807,9 @@ bool DRW_Text::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing text *********************************************" ), 4 ); +#endif // DataFlags RC Used to determine presence of subsequent data, set to 0xFF for R14- duint8 data_flags = 0x00; @@ -1635,7 +1817,9 @@ bool DRW_Text::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) { data_flags = buf->getRawChar8(); /* DataFlags RC Used to determine presence of subsequent data */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "data_flags:%1" ).arg( data_flags, 0, 16 ), 4 ); +#endif if ( !( data_flags & 0x01 ) ) /* Elevation RD --- present if !(DataFlags & 0x01) */ { @@ -1649,9 +1833,11 @@ bool DRW_Text::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) basePoint.x = buf->getRawDouble(); /* Insertion pt 2RD 10 */ basePoint.y = buf->getRawDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Insert point:%1" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ) ), 4 ); +#endif if ( version > DRW::AC1014 ) //2000+ { @@ -1674,10 +1860,12 @@ bool DRW_Text::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) extPoint = buf->getExtrusion( version > DRW::AC1014 ); thickness = buf->getThickness( version > DRW::AC1014 ); /* Thickness BD 39 */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "alignment:%1 extrusion:%2" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( secPoint.x ).arg( secPoint.y ).arg( secPoint.z ), QStringLiteral( "%1,%2,%3" ).arg( extPoint.x ).arg( extPoint.y ).arg( extPoint.z ) ), 4 ); +#endif if ( version > DRW::AC1014 ) //2000+ { @@ -1703,29 +1891,39 @@ bool DRW_Text::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) widthscale = buf->getBitDouble(); /* Width factor BD 41 */ } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "thickness:%1, Oblique angle:%2, Width:%3, rotation:%4, height:%5" ) .arg( thickness ).arg( oblique ).arg( widthscale ).arg( angle ).arg( height ), 4 ); +#endif text = sBuf->getVariableText( version, false ); /* Text value TV 1 */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "text string:%1" ).arg( text.c_str() ), 4 ); +#endif //textgen, alignH, alignV always present in R14-, data_flags set in initialization if ( !( data_flags & 0x20 ) ) /* Generation BS 71 present if !(DataFlags & 0x20) */ { textgen = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "textgen:%1" ).arg( textgen ), 4 ); +#endif } if ( !( data_flags & 0x40 ) ) /* Horiz align. BS 72 present if !(DataFlags & 0x40) */ { alignH = static_cast< HAlign >( buf->getBitShort() ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "alignH:%1" ).arg( alignH ), 4 ); +#endif } if ( !( data_flags & 0x80 ) ) /* Vert align. BS 73 present if !(DataFlags & 0x80) */ { alignV = static_cast< VAlign >( buf->getBitShort() ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "alignV:%1" ).arg( alignV ), 4 ); +#endif } /* Common Entity Handle Data */ @@ -1735,9 +1933,11 @@ bool DRW_Text::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) styleH = buf->getHandle(); /* H 7 STYLE (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "text style Handle:%1.%2 0x%3" ) .arg( styleH.code ).arg( styleH.size ).arg( styleH.ref, 0, 16 ), 4 ); +#endif /* CRC X --- */ return buf->isGood(); @@ -1779,13 +1979,17 @@ bool DRW_MText::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing mtext *********************************************" ), 4 ); +#endif basePoint = buf->get3BitDouble(); /* Insertion pt 3BD 10 - First picked point. */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "insertion:%1" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ) ), 4 ); +#endif extPoint = buf->get3BitDouble(); /* Extrusion 3BD 210 Undocumented; */ secPoint = buf->get3BitDouble(); /* X-axis dir 3BD 11 */ @@ -1848,9 +2052,11 @@ bool DRW_MText::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) styleH = buf->getHandle(); /* H 7 STYLE (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "text style Handle:%1.%2 0x%3" ) .arg( styleH.code ).arg( styleH.size ).arg( styleH.ref, 0, 16 ), 4 ); +#endif /* CRC X --- */ return buf->isGood(); @@ -1907,13 +2113,17 @@ bool DRW_Polyline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing polyline *********************************************" ), 4 ); +#endif dint32 ooCount = 0; if ( oType == 0x0F ) //pline 2D { flags = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "flags value:0x%1" ).arg( flags, 0, 16 ), 4 ); +#endif curvetype = buf->getBitShort(); defstawidth = buf->getBitDouble(); defendwidth = buf->getBitDouble(); @@ -1924,7 +2134,9 @@ bool DRW_Polyline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) else if ( oType == 0x10 ) //pline 3D { duint8 tmpFlag = buf->getRawChar8(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "flags 1 value:0x%1" ).arg( tmpFlag, 0, 16 ), 4 ); +#endif if ( tmpFlag & 1 ) curvetype = 5; else if ( tmpFlag & 2 ) @@ -1938,16 +2150,20 @@ bool DRW_Polyline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( tmpFlag & 1 ) flags |= 1; flags |= 8; //indicate 3DPOL +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "flags 2 value:0x%1" ).arg( tmpFlag, 0, 16 ), 4 ); +#endif } else if ( oType == 0x1D ) //PFACE { flags = 64; vertexcount = buf->getBitShort(); facecount = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "vertex count:%1 face count:%2 flags value:0x%3" ) .arg( vertexcount ).arg( facecount ).arg( flags, 0, 16 ), 4 ); +#endif } if ( version > DRW::AC1015 ) //2004+ { @@ -1962,17 +2178,21 @@ bool DRW_Polyline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) { dwgHandle objectH = buf->getOffsetHandle( handle ); firstEH = objectH.ref; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "first vertex handle:%1.%2 0x%3" ) .arg( objectH.code ).arg( objectH.size ).arg( objectH.ref, 0, 16 ), 4 ); +#endif objectH = buf->getOffsetHandle( handle ); lastEH = objectH.ref; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "last vertex:%1, remaining bytes %2" ) .arg( QStringLiteral( "%1.%2 0x%3" ).arg( objectH.code ).arg( objectH.size ).arg( objectH.ref, 0, 16 ) ) .arg( buf->numRemainingBytes() ), 4 ); +#endif } else { @@ -1981,18 +2201,22 @@ bool DRW_Polyline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) dwgHandle objectH = buf->getOffsetHandle( handle ); handleList.push_back( objectH.ref ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "vertex handle:%1, remaining bytes %2" ) .arg( QStringLiteral( "%1.%2 0x%3" ).arg( objectH.code ).arg( objectH.size ).arg( objectH.ref, 0, 16 ) ) .arg( buf->numRemainingBytes() ), 4 ); +#endif } } seqEndH = buf->getOffsetHandle( handle ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "SEQEND handle:%1 remaining bytes %2" ) .arg( QStringLiteral( "%1.%2 0x%3" ).arg( seqEndH.code ).arg( seqEndH.size ).arg( seqEndH.ref, 0, 16 ) ) .arg( buf->numRemainingBytes() ), 4 ); +#endif // RS crc; //RS */ @@ -2050,7 +2274,9 @@ bool DRW_Vertex::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs, dou if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing pline Vertex *********************************************" ), 4 ); +#endif if ( oType == 0x0A ) //pline 2D, needed example { @@ -2058,10 +2284,12 @@ bool DRW_Vertex::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs, dou basePoint = buf->get3BitDouble(); basePoint.z = el; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " flags value:0x%1 basePoint:%2" ) .arg( flags, 0, 16 ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ) ), 4 ); +#endif stawidth = buf->getBitDouble(); if ( stawidth < 0 ) @@ -2072,7 +2300,9 @@ bool DRW_Vertex::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs, dou if ( version > DRW::AC1021 ) //2010+ { dint32 id = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " Vertex ID:%1" ).arg( id ), 4 ); +#endif Q_UNUSED( id ); } tgdir = buf->getBitDouble(); @@ -2082,10 +2312,12 @@ bool DRW_Vertex::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs, dou flags = buf->getRawChar8(); //RLZ: EC unknown type basePoint = buf->get3BitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " flags value:0x%1 basePoint:%2" ) .arg( flags, 0, 16 ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ) ), 4 ); +#endif } else if ( oType == 0x0E ) //PFACE FACE { @@ -2242,7 +2474,9 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing hatch *********************************************" ), 4 ); +#endif //Gradient data, RLZ: is OK or if grad > 0 continue read ? if ( version > DRW::AC1015 ) //2004+ @@ -2255,6 +2489,7 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) double gradTint = buf->getBitDouble(); dint32 numCol = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "is Gradient:%1 reserved:%2 Gradient angle:%3 Gradient shift:%4 single color Grad:%5 Gradient tint:%6, num colors:%7" ) .arg( isGradient ) .arg( res ) @@ -2264,6 +2499,7 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) .arg( gradTint ) .arg( numCol ), 4 ); +#endif Q_UNUSED( isGradient ); Q_UNUSED( res ); Q_UNUSED( gradAngle ); @@ -2278,18 +2514,22 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) dint32 rgbCol = buf->getBitLong(); duint8 ignCol = buf->getRawChar8(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "unkDouble:%1 unkShort:%2 rgbcolor:%3 ignoredcolor:%4" ) .arg( unkDouble ).arg( unkShort ) .arg( rgbCol ) .arg( ignCol ), 4 ); +#endif Q_UNUSED( unkDouble ); Q_UNUSED( unkShort ); Q_UNUSED( rgbCol ); Q_UNUSED( ignCol ); } UTF8STRING gradName = sBuf->getVariableText( version, false ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "gradient name:%1" ).arg( gradName.c_str() ), 4 ); +#endif Q_UNUSED( gradName ); } basePoint.z = buf->getBitDouble(); @@ -2299,6 +2539,7 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) associative = buf->getBit(); loopsnum = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "base point:%1, extrusion:%2, pattern:%3, solid:%4 associative:%5 loops:%6" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ), QStringLiteral( "%1,%2,%3" ).arg( extPoint.x ).arg( extPoint.y ).arg( extPoint.z ), @@ -2307,23 +2548,30 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) .arg( associative ) .arg( loopsnum ), 4 ); +#endif //read loops for ( std::vector::size_type i = 0 ; i < loopsnum && buf->isGood(); ++i ) { loop = new DRW_HatchLoop( buf->getBitLong() ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " type: %1" ).arg( loop->type ), 4 ); +#endif hasPixelSize |= ( loop->type & 4 ) != 0; if ( !( loop->type & 2 ) ) //Not polyline { dint32 numPathSeg = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "segs: %1" ).arg( numPathSeg ), 4 ); +#endif for ( dint32 j = 0; j < numPathSeg; ++j ) { duint8 typePath = buf->getRawChar8(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " typepath: %1" ).arg( typePath ), 4 ); +#endif if ( typePath == 1 ) //line { addLine(); @@ -2359,17 +2607,22 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) spline->nknots = buf->getBitLong(); spline->ncontrol = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " degree:%1 flags:0x%2 nknots:%3 ncontrol:%4" ) .arg( spline->degree ).arg( spline->flags, 0, 16 ) .arg( spline->nknots ).arg( spline->ncontrol ), 4 ); +#endif + RESERVE( spline->knotslist, spline->nknots ); for ( dint32 j = 0; j < spline->nknots; ++j ) { spline->knotslist.push_back( buf->getBitDouble() ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " knot %1: %2" ).arg( j ) .arg( spline->knotslist.back() ), 4 ); +#endif } RESERVE( spline->controllist, spline->ncontrol ); for ( dint32 j = 0; j < spline->ncontrol && buf->isGood(); ++j ) @@ -2379,25 +2632,31 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( isRational ) crd->z = buf->getBitDouble(); //RLZ: investigate how store weight spline->controllist.push_back( crd ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " control %1: %2" ) .arg( j ) .arg( QStringLiteral( "%1,%2,%3" ).arg( crd->x ).arg( crd->y ).arg( crd->z ) ), 4 ); +#endif } if ( version > DRW::AC1021 ) //2010+ { spline->nfit = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " nfit:%1" ).arg( spline->nfit ), 4 ); +#endif RESERVE( spline->fitlist, spline->nfit ); for ( dint32 j = 0; j < spline->nfit && buf->isGood(); ++j ) { DRW_Coord *crd = new DRW_Coord( buf->get2RawDouble() ); spline->fitlist.push_back( crd ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " fit %1: %2" ) .arg( j ) .arg( QStringLiteral( "%1,%2,%3" ).arg( crd->x ).arg( crd->y ).arg( crd->z ) ), 4 ); +#endif } spline->tgStart = buf->get2RawDouble(); spline->tgEnd = buf->get2RawDouble(); @@ -2412,9 +2671,11 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) pline->flags = buf->getBit();//closed bit dint32 numVert = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "hasBulge:%1 flags:%2 verts:%3" ) .arg( hasBulges ).arg( pline->flags, 0, 16 ).arg( numVert ), 4 ); +#endif for ( dint32 j = 0; j < numVert && buf->isGood(); ++j ) { @@ -2431,13 +2692,17 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) looplist.push_back( loop ); totalBoundItems += buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " totalBoundItems:%1" ).arg( totalBoundItems ), 4 ); +#endif } //end read loops hstyle = buf->getBitShort(); hpattern = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "hatch style:%1 pattern type:%2" ).arg( hstyle ).arg( hpattern ), 4 ); +#endif if ( !solid ) { angle = buf->getBitDouble(); @@ -2445,10 +2710,12 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) doubleflag = buf->getBit(); deflines = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "angle:%1 scale:%2 double:%3 deflines:%4" ) .arg( angle ).arg( scale ) .arg( doubleflag ).arg( deflines ), 4 ); +#endif Q_UNUSED( angle ); Q_UNUSED( scale ); @@ -2462,11 +2729,13 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) offL.y = buf->getBitDouble(); duint16 numDashL = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "def line: a=%1 pt=%2 off=%3" ) .arg( angleL ) .arg( QStringLiteral( "%1,%2" ).arg( ptL.x ).arg( ptL.y ), QStringLiteral( "%1,%2" ).arg( offL.x ).arg( offL.y ) ), 4 ); +#endif Q_UNUSED( angleL ); Q_UNUSED( ptL ); Q_UNUSED( offL ); @@ -2474,7 +2743,9 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) for ( duint16 j = 0 ; j < numDashL; ++j ) { double lengthL = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " %1: %2" ).arg( j ).arg( lengthL ), 4 ); +#endif Q_UNUSED( lengthL ); } }//end deflines @@ -2483,33 +2754,45 @@ bool DRW_Hatch::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( hasPixelSize ) { ddouble64 pixsize = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "pixel size:%1" ).arg( pixsize ), 4 ); +#endif Q_UNUSED( pixsize ); } dint32 numSeedPoints = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "num Seed Points %1" ).arg( numSeedPoints ), 4 ); +#endif //read Seed Points DRW_Coord seedPt; for ( dint32 i = 0 ; i < numSeedPoints && buf->isGood(); ++i ) { seedPt.x = buf->getRawDouble(); seedPt.y = buf->getRawDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " %1: %2,%3" ).arg( i ).arg( seedPt.x ).arg( seedPt.y ), 4 ); +#endif } ret = DRW_Entity::parseDwgEntHandle( version, buf ); if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes:%1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif for ( duint32 i = 0 ; i < totalBoundItems && buf->isGood(); ++i ) { dwgHandle biH = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Boundary Items Handle:%1.%2 0x%3" ).arg( biH.code ).arg( biH.size ).arg( biH.ref, 0, 16 ), 4 ); +#endif } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes:%1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif // RS crc; //RS */ @@ -2618,13 +2901,17 @@ bool DRW_Spline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing spline *********************************************" ), 4 ); +#endif duint8 weight = 0; // RLZ ??? flags, weight, code 70, bit 4 (16) dint32 scenario = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "scenario: %1" ).arg( scenario ), 4 ); +#endif if ( version > DRW::AC1024 ) { @@ -2633,13 +2920,19 @@ bool DRW_Spline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) scenario = 2; dint32 knotParam = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "2013 splFlag1:%1, 2013 knotParam:%2" ).arg( splFlag1 ).arg( knotParam ), 4 ); +#endif Q_UNUSED( knotParam ); - // QgsDebugMsgLevel( QStringLiteral( "unk bit:%1").arg( buf->getBit()), 4 ); +#ifdef DWGDEBUG + QgsDebugMsgLevel( QStringLiteral( "unk bit:%1" ).arg( buf->getBit() ), 4 ); +#endif } degree = buf->getBitLong(); //RLZ: code 71, verify with dxf +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " degree:%1" ).arg( degree ), 4 ); +#endif if ( scenario == 2 ) { @@ -2649,12 +2942,14 @@ bool DRW_Spline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) tgEnd = buf->get3BitDouble(); nfit = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "flags: 0x%1, tolfit:%2, tangent start:%3 end:%4 nfit:%5" ) .arg( flags, 0, 16 ).arg( tolfit ) .arg( QStringLiteral( "%1,%2,%3" ).arg( tgStart.x ).arg( tgStart.y ).arg( tgStart.z ), QStringLiteral( "%1,%2,%3" ).arg( tgEnd.x ).arg( tgEnd.y ).arg( tgEnd.z ) ) .arg( nfit ), 4 ); +#endif } else if ( scenario == 1 ) { @@ -2668,13 +2963,17 @@ bool DRW_Spline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) ncontrol = buf->getBitLong(); weight = buf->getBit(); // RLZ ??? flags, weight, code 70, bit 4 (16) +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "flags:0x%1, knot tolerance:%2, control point tolerance:%3, num knots:%4, num control pt:%5, weight:%6" ) .arg( flags, 0, 16 ).arg( tolknot ).arg( tolcontrol ).arg( nknots ).arg( ncontrol ).arg( weight ), 4 ); +#endif } else { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "spline, unknown scenario %1" ).arg( scenario ), 4 ); +#endif return false; //RLZ: from doc only 1 or 2 are OK ? } @@ -2683,9 +2982,11 @@ bool DRW_Spline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) { double d = buf->getBitDouble(); knotslist.push_back( d ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "knot %1: %2 rem=%3" ) .arg( i ).arg( d, 0, 'g', 17 ).arg( buf->numRemainingBytes() ), 4 ); +#endif } RESERVE( controllist, ncontrol ); @@ -2693,15 +2994,19 @@ bool DRW_Spline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) { DRW_Coord *crd = new DRW_Coord( buf->get3BitDouble() ); controllist.push_back( crd ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "cp %1: %2,%3,%4 rem:%5" ) .arg( i ).arg( crd->x, 0, 'g', 17 ).arg( crd->y, 0, 'g', 17 ).arg( crd->z, 0, 'g', 17 ).arg( buf->numRemainingBytes() ), 4 ); +#endif if ( weight ) { double w = buf->getBitDouble(); //RLZ Warning: D (BD or RD) +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "weight %1: %2 rem:%3" ) .arg( i ).arg( w, 0, 'g', 17 ).arg( buf->numRemainingBytes() ), 4 ); +#endif Q_UNUSED( w ); } } @@ -2711,9 +3016,11 @@ bool DRW_Spline::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) { DRW_Coord *crd = new DRW_Coord( buf->get3BitDouble() ); fitlist.push_back( crd ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "fp %1: %2,%3,%4 rem:%5" ) .arg( i ).arg( crd->x, 0, 'g', 17 ).arg( crd->y, 0, 'g', 17 ).arg( crd->z, 0, 'g', 17 ).arg( buf->numRemainingBytes() ), 4 ); +#endif } /* Common Entity Handle Data */ @@ -2777,7 +3084,9 @@ bool DRW_Image::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing image *********************************************" ), 4 ); +#endif dint32 classVersion = buf->getBitLong(); basePoint = buf->get3BitDouble(); @@ -2786,6 +3095,7 @@ bool DRW_Image::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) sizeu = buf->getRawDouble(); sizev = buf->getRawDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "class version:%1, base point:%2, U:%3, V:%4, size U:%5, V:%6" ) .arg( classVersion ) .arg( QStringLiteral( "%1,%2,%3" ).arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ), @@ -2793,6 +3103,7 @@ bool DRW_Image::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) QStringLiteral( "%1,%2,%3" ).arg( vVector.x ).arg( vVector.y ).arg( vVector.z ) ) .arg( sizeu ).arg( sizev ), 4 ); +#endif Q_UNUSED( classVersion ); duint16 displayProps = buf->getBitShort(); @@ -2823,18 +3134,26 @@ bool DRW_Image::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif dwgHandle biH = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "ImageDef handle:%1.%2 0x%3" ).arg( biH.code ).arg( biH.size ).arg( biH.ref, 0, 16 ), 4 ); +#endif ref = biH.ref; biH = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "ImageDefReactor handle:%1.%2 0x%3" ).arg( biH.code ).arg( biH.size ).arg( biH.ref, 0, 16 ), 4 ); +#endif +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif // RS crc; //RS */ @@ -2952,17 +3271,23 @@ void DRW_Dimension::parseCode( int code, dxfReader *reader ) bool DRW_Dimension::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *sBuf ) { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing dimension *********************************************" ), 4 ); +#endif if ( version > DRW::AC1021 ) //2010+ { duint8 dimVersion = buf->getRawChar8(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "dimVersion:%1" ).arg( dimVersion ), 4 ); +#endif Q_UNUSED( dimVersion ); } extPoint = buf->getExtrusion( version > DRW::AC1014 ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "extrusion:%1,%2,%3" ).arg( extPoint.x ).arg( extPoint.y ).arg( extPoint.z ), 4 ); +#endif if ( version > DRW::AC1014 ) //2000+ { @@ -2972,7 +3297,9 @@ bool DRW_Dimension::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *s int bit3 = buf->getBit(); int bit4 = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Five unknown bits: %1%2%3%4%5" ).arg( bit0 ).arg( bit1 ).arg( bit2 ).arg( bit3 ).arg( bit4 ), 4 ); +#endif Q_UNUSED( bit0 ); Q_UNUSED( bit1 ); Q_UNUSED( bit2 ); @@ -2983,29 +3310,39 @@ bool DRW_Dimension::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *s textPoint.y = buf->getRawDouble(); textPoint.z = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "textPoint:%1,%2,%3" ).arg( textPoint.x ).arg( textPoint.y ).arg( textPoint.z ), 4 ); +#endif type = buf->getRawChar8(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "type (70) read: %1" ).arg( type ), 4 ); +#endif type = ( type & 1 ) ? type & 0x7F : type | 0x80; //set bit 7 type = ( type & 2 ) ? type | 0x20 : type & 0xDF; //set bit 5 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "type (70) set: %1" ).arg( type ), 4 ); +#endif //clear last 3 bits to set integer dim type type &= 0xF8; text = sBuf->getVariableText( version, false ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "forced dim text:%1" ).arg( text.c_str() ), 4 ); +#endif rot = buf->getBitDouble(); hdir = buf->getBitDouble(); DRW_Coord inspoint = buf->get3BitDouble(); double insRot_code54 = buf->getBitDouble(); //RLZ: unknown, investigate +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "insPoint:%1 insRot_code54:%4" ) .arg( QStringLiteral( "%1,%2,%3" ).arg( inspoint.x ).arg( inspoint.y ).arg( inspoint.z ) ) .arg( insRot_code54 ), 4 ); +#endif Q_UNUSED( inspoint ); Q_UNUSED( insRot_code54 ); @@ -3016,7 +3353,9 @@ bool DRW_Dimension::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *s linefactor = buf->getBitDouble(); double actMeas = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " actMeas_code42: %1" ).arg( actMeas ), 4 ); +#endif Q_UNUSED( actMeas ); if ( version > DRW::AC1018 ) //2007+ @@ -3025,9 +3364,11 @@ bool DRW_Dimension::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *s bool flip1 = buf->getBit(); bool flip2 = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "2007, unk, flip1, flip2: %1, %2, %3" ) .arg( unk ).arg( flip1 ).arg( flip2 ), 4 ); +#endif Q_UNUSED( unk ); Q_UNUSED( flip1 ); Q_UNUSED( flip2 ); @@ -3036,7 +3377,9 @@ bool DRW_Dimension::parseDwg( DRW::Version version, dwgBuffer *buf, dwgBuffer *s clonePoint.x = buf->getRawDouble(); clonePoint.y = buf->getRawDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "clonePoint:%1,%2,%3" ).arg( clonePoint.x ).arg( clonePoint.y ).arg( clonePoint.z ), 4 ); +#endif return buf->isGood(); } @@ -3057,26 +3400,36 @@ bool DRW_DimAligned::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs return ret; if ( oType == 0x15 ) { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing dim linear *********************************************" ), 4 ); +#endif } else { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing dim aligned *********************************************" ), 4 ); +#endif } DRW_Coord pt = buf->get3BitDouble(); setPt3( pt ); //def1 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "def1: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setPt4( pt ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "def2: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setDefPoint( pt ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "defPoint: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif setOb52( buf->getBitDouble() ); if ( oType == 0x15 ) @@ -3084,11 +3437,15 @@ bool DRW_DimAligned::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs else type |= 1; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "type (70) final: %1" ).arg( type ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif if ( !ret ) return ret; @@ -3096,11 +3453,13 @@ bool DRW_DimAligned::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs dimStyleH = buf->getHandle(); blockH = buf->getHandle(); /* H 7 STYLE (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "dim style Handle:%1, anon block handle:%2, remaining bytes %3" ) .arg( QStringLiteral( "%1.%2 0x%3" ).arg( dimStyleH.code ).arg( dimStyleH.size ).arg( dimStyleH.ref, 0, 16 ), QStringLiteral( "%1.%2 0x%3" ).arg( blockH.code ).arg( blockH.size ).arg( blockH.ref, 0, 16 ) ) .arg( buf->numRemainingBytes() ), 4 ); +#endif // RS crc; //RS */ @@ -3122,27 +3481,39 @@ bool DRW_DimRadial::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing dim radial *********************************************" ), 4 ); +#endif DRW_Coord pt = buf->get3BitDouble(); setDefPoint( pt ); //code 10 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "defPoint: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setPt5( pt ); //center pt code 15 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "center point: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif setRa40( buf->getBitDouble() ); //leader length code 40 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "leader length: %1" ).arg( getRa40() ), 4 ); +#endif type |= 4; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "type (70) final: %1" ).arg( type ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif if ( !ret ) return ret; @@ -3150,11 +3521,13 @@ bool DRW_DimRadial::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) dimStyleH = buf->getHandle(); blockH = buf->getHandle(); /* H 7 STYLE (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "dim style Handle:%1, anon block handle:%2, remaining bytes %3" ) .arg( QStringLiteral( "%1.%2 0x%3" ).arg( dimStyleH.code ).arg( dimStyleH.size ).arg( dimStyleH.ref, 0, 16 ), QStringLiteral( "%1.%2 0x%3" ).arg( blockH.code ).arg( blockH.size ).arg( blockH.ref, 0, 16 ) ) .arg( buf->numRemainingBytes() ), 4 ); +#endif // RS crc; //RS */ return buf->isGood(); @@ -3175,37 +3548,51 @@ bool DRW_DimDiametric::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 b if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing dim diametric *********************************************" ), 4 ); +#endif DRW_Coord pt = buf->get3BitDouble(); setPt5( pt ); //center pt code 15 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "center point: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setDefPoint( pt ); //code 10 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "defPoint: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif setRa40( buf->getBitDouble() ); //leader length code 40 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "leader length: %1" ).arg( getRa40() ), 4 ); +#endif type |= 3; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "type (70) final: %1" ).arg( type ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif if ( !ret ) return ret; dimStyleH = buf->getHandle(); blockH = buf->getHandle(); /* H 7 STYLE (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "dim style Handle:%1, anon block handle:%2, remaining bytes %3" ) .arg( QStringLiteral( "%1.%2 0x%3" ).arg( dimStyleH.code ).arg( dimStyleH.size ).arg( dimStyleH.ref, 0, 16 ), QStringLiteral( "%1.%2 0x%3" ).arg( blockH.code ).arg( blockH.size ).arg( blockH.ref, 0, 16 ) ) .arg( buf->numRemainingBytes() ), 4 ); +#endif // RS crc; //RS */ return buf->isGood(); @@ -3226,42 +3613,58 @@ bool DRW_DimAngular::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing dim angular *********************************************" ), 4 ); +#endif DRW_Coord pt; pt.x = buf->getRawDouble(); pt.y = buf->getRawDouble(); setPt6( pt ); //code 16 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "arc point: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setPt3( pt ); //def1 code 13 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "def1: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setPt4( pt ); //def2 code 14 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "def2: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setPt5( pt ); //center pt code 15 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "center point: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setDefPoint( pt ); //code 10 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "defPoint: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif type |= 0x02; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "type (70) final: %1" ).arg( type ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif if ( !ret ) return ret; @@ -3269,11 +3672,13 @@ bool DRW_DimAngular::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs dimStyleH = buf->getHandle(); blockH = buf->getHandle(); /* H 7 STYLE (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "dim style Handle:%1, anon block handle:%2, remaining bytes %3" ) .arg( QStringLiteral( "%1.%2 0x%3" ).arg( dimStyleH.code ).arg( dimStyleH.size ).arg( dimStyleH.ref, 0, 16 ), QStringLiteral( "%1.%2 0x%3" ).arg( blockH.code ).arg( blockH.size ).arg( blockH.ref, 0, 16 ) ) .arg( buf->numRemainingBytes() ), 4 ); +#endif // RS crc; //RS */ return buf->isGood(); @@ -3294,34 +3699,48 @@ bool DRW_DimAngular3p::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 b if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing dim angular3p *********************************************" ), 4 ); +#endif DRW_Coord pt = buf->get3BitDouble(); setDefPoint( pt ); //code 10 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "defPoint: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setPt3( pt ); //def1 code 13 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "def1: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setPt4( pt ); //def2 code 14 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "def2: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setPt5( pt ); //center pt code 15 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "center point: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif type |= 0x05; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "type (70) final: %1" ).arg( type ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif if ( !ret ) return ret; @@ -3329,11 +3748,13 @@ bool DRW_DimAngular3p::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 b dimStyleH = buf->getHandle(); blockH = buf->getHandle(); /* H 7 STYLE (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "dim style Handle:%1, anon block handle:%2, remaining bytes %3" ) .arg( QStringLiteral( "%1.%2 0x%3" ).arg( dimStyleH.code ).arg( dimStyleH.size ).arg( dimStyleH.ref, 0, 16 ), QStringLiteral( "%1.%2 0x%3" ).arg( blockH.code ).arg( blockH.size ).arg( blockH.ref, 0, 16 ) ) .arg( buf->numRemainingBytes() ), 4 ); +#endif // RS crc; //RS */ return buf->isGood(); @@ -3354,38 +3775,54 @@ bool DRW_DimOrdinate::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing dim ordinate *********************************************" ), 4 ); +#endif DRW_Coord pt = buf->get3BitDouble(); setDefPoint( pt ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "defPoint: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setPt3( pt ); //def1 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "def1: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif pt = buf->get3BitDouble(); setPt4( pt ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "def2: %1,%2,%3" ).arg( pt.x ).arg( pt.y ).arg( pt.z ), 4 ); +#endif duint8 type2 = buf->getRawChar8();//RLZ: correct this +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "type2 (70) read: %1" ).arg( type2 ), 4 ); +#endif type = ( type2 & 1 ) ? type | 0x80 : type & 0xBF; //set bit 6 +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "type (70) set: %1" ).arg( type ), 4 ); +#endif type |= 6; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "type (70) final: %1" ).arg( type ), 4 ); +#endif ret = DRW_Entity::parseDwgEntHandle( version, buf ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif if ( !ret ) return ret; @@ -3393,11 +3830,13 @@ bool DRW_DimOrdinate::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs dimStyleH = buf->getHandle(); blockH = buf->getHandle(); /* H 7 STYLE (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "dim style Handle:%1, anon block handle:%2, remaining bytes %3" ) .arg( QStringLiteral( "%1.%2 0x%3" ).arg( dimStyleH.code ).arg( dimStyleH.size ).arg( dimStyleH.ref, 0, 16 ), QStringLiteral( "%1.%2 0x%3" ).arg( blockH.code ).arg( blockH.size ).arg( blockH.ref, 0, 16 ) ) .arg( buf->numRemainingBytes() ), 4 ); +#endif // RS crc; //RS */ return buf->isGood(); @@ -3509,16 +3948,20 @@ bool DRW_Leader::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing leader *********************************************" ), 4 ); +#endif int bit0 = buf->getBit(); int annot = buf->getBitShort(); int pathtype = buf->getBitShort(); dint32 nPt = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "unknown:%1 annottype:%2 pathtype:%3 numpts:%4" ) .arg( bit0 ).arg( annot ).arg( pathtype ).arg( nPt ), 4 ); +#endif Q_UNUSED( bit0 ); Q_UNUSED( annot ) Q_UNUSED( pathtype ) @@ -3528,15 +3971,21 @@ bool DRW_Leader::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) { DRW_Coord *vertex = new DRW_Coord( buf->get3BitDouble() ); vertexlist.push_back( vertex ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " vertex %1: %2,%3,%4" ).arg( i ).arg( vertex->x ).arg( vertex->y ).arg( vertex->z ), 4 ); +#endif } DRW_Coord Endptproj = buf->get3BitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " endptproj: %1,%2,%3" ).arg( Endptproj.x ).arg( Endptproj.y ).arg( Endptproj.z ), 4 ); +#endif Q_UNUSED( Endptproj ); extrusionPoint = buf->getExtrusion( version > DRW::AC1014 ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " extrusion: %1,%2,%3" ).arg( extrusionPoint.x ).arg( extrusionPoint.y ).arg( extrusionPoint.z ), 4 ); +#endif if ( version > DRW::AC1014 ) //2000+ { @@ -3546,7 +3995,9 @@ bool DRW_Leader::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) int bit3 = buf->getBit(); int bit4 = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Five unknown bits: %1%2%3%4%5" ).arg( bit0 ).arg( bit1 ).arg( bit2 ).arg( bit3 ).arg( bit4 ), 4 ); +#endif Q_UNUSED( bit0 ); Q_UNUSED( bit1 ); Q_UNUSED( bit2 ); @@ -3556,19 +4007,27 @@ bool DRW_Leader::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) horizdir = buf->get3BitDouble(); offsetblock = buf->get3BitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " horizdir: %1,%2,%3" ).arg( horizdir.x ).arg( horizdir.y ).arg( horizdir.z ), 4 ); +#endif +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " offsetblock: %1,%2,%3" ).arg( offsetblock.x ).arg( offsetblock.y ).arg( offsetblock.z ), 4 ); +#endif if ( version > DRW::AC1012 ) //R14+ { DRW_Coord unk = buf->get3BitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( " unknown: %1,%2,%3" ).arg( unk.x ).arg( unk.y ).arg( unk.z ), 4 ); +#endif Q_UNUSED( unk ); } if ( version < DRW::AC1015 ) //R14 - { double dimgap = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "dimgap %1" ).arg( dimgap ), 4 ); +#endif Q_UNUSED( dimgap ); } if ( version < DRW::AC1024 ) //2010- @@ -3576,12 +4035,16 @@ bool DRW_Leader::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) textheight = buf->getBitDouble(); textwidth = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "textheight:%1 textwidth:%2" ).arg( textheight ).arg( textwidth ), 4 ); +#endif } hookline = buf->getBit(); arrow = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "hookline:%1 arrow flag:%2" ).arg( hookline ).arg( arrow ), 4 ); +#endif if ( version < DRW::AC1015 ) //R14 - { @@ -3594,9 +4057,11 @@ bool DRW_Leader::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) int unk3 = buf->getBit(); int unk4 = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Arrow head type:%1 dimasz:%2 unk0:%3 unk1:%4 unk2:%5 byblockcol:%6 unk3:%7 unk3:%9" ) .arg( headtype ).arg( dimasz ).arg( unk0 ).arg( unk1 ).arg( unk2 ).arg( byblockcol ).arg( unk3 ).arg( unk4 ), 4 ); +#endif Q_UNUSED( headtype ); Q_UNUSED( dimasz ); Q_UNUSED( unk0 ); @@ -3611,7 +4076,9 @@ bool DRW_Leader::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) int unk0 = buf->getBitShort(); int unk1 = buf->getBit(); int unk2 = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "unk0:%1 unk1:%2 unk2:%3" ).arg( unk0 ).arg( unk1 ).arg( unk2 ), 4 ); +#endif Q_UNUSED( unk0 ); Q_UNUSED( unk1 ); Q_UNUSED( unk2 ); @@ -3621,17 +4088,21 @@ bool DRW_Leader::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif AnnotH = buf->getHandle(); annotHandle = AnnotH.ref; dimStyleH = buf->getHandle(); /* H 7 STYLE (hard pointer) */ +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "annot block Handle:%1, dim style handle:%2, remaining bytes %3" ) .arg( QStringLiteral( "%1.%2 0x%3" ).arg( AnnotH.code ).arg( AnnotH.size ).arg( AnnotH.ref, 0, 16 ), QStringLiteral( "%1.%2 0x%3" ).arg( dimStyleH.code ).arg( dimStyleH.size ).arg( dimStyleH.ref, 0, 16 ) ) .arg( buf->numRemainingBytes() ), 4 ); +#endif // RS crc; //RS */ @@ -3680,7 +4151,9 @@ bool DRW_Viewport::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( !ret ) return ret; +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "***************************** parsing viewport *****************************************" ), 4 ); +#endif basePoint.x = buf->getBitDouble(); basePoint.y = buf->getBitDouble(); @@ -3688,10 +4161,12 @@ bool DRW_Viewport::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) pswidth = buf->getBitDouble(); psheight = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "center: %1,%2,%3 width:%4 height:%5" ) .arg( basePoint.x ).arg( basePoint.y ).arg( basePoint.z ) .arg( pswidth ).arg( psheight ), 4 ); +#endif //RLZ TODO: complete in dxf if ( version > DRW::AC1014 ) //2000+ @@ -3700,13 +4175,17 @@ bool DRW_Viewport::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) viewTarget.y = buf->getBitDouble(); viewTarget.z = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "viewTarget: %1,%2,%3" ).arg( viewTarget.x ).arg( viewTarget.y ).arg( viewTarget.z ), 4 ); +#endif viewDir.x = buf->getBitDouble(); viewDir.y = buf->getBitDouble(); viewDir.z = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "viewDir: %1,%2,%3" ).arg( viewDir.x ).arg( viewDir.y ).arg( viewDir.z ), 4 ); +#endif twistAngle = buf->getBitDouble(); viewHeight = buf->getBitDouble(); @@ -3715,31 +4194,41 @@ bool DRW_Viewport::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) backClip = buf->getBitDouble(); snapAngle = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "View twist Angle:%1 Height:%2 LensLength:%3 front Clip Z:%4 back Clip Z:%5 snap Angle:%6" ) .arg( twistAngle ).arg( viewHeight ).arg( viewLength ).arg( frontClip ).arg( backClip ).arg( snapAngle ), 4 ); +#endif centerPX = buf->getRawDouble(); centerPY = buf->getRawDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "viewCenter: %1,%2" ).arg( centerPX ).arg( centerPY ), 4 ); +#endif snapPX = buf->getRawDouble(); snapPY = buf->getRawDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "snapBase: %1,%2" ).arg( snapPX ).arg( snapPY ), 4 ); +#endif snapSpPX = buf->getRawDouble(); snapSpPY = buf->getRawDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "snapSpacing: %1,%2" ).arg( snapSpPX ).arg( snapSpPY ), 4 ); +#endif //RLZ: need to complete double gridX = buf->getRawDouble(); double gridY = buf->getRawDouble(); int czoom = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "gridSpacing: %1,%2 Circle zoom?: %3" ).arg( gridX ).arg( gridY ).arg( czoom ), 4 ); +#endif Q_UNUSED( gridX ); Q_UNUSED( gridY ); Q_UNUSED( czoom ); @@ -3747,35 +4236,51 @@ bool DRW_Viewport::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) if ( version > DRW::AC1018 ) //2007+ { int gridmajor = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Grid major?: %1" ).arg( gridmajor ), 4 ); +#endif Q_UNUSED( gridmajor ); } if ( version > DRW::AC1014 ) //2000+ { frozenLyCount = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Frozen Layer count?: %1" ).arg( frozenLyCount ), 4 ); +#endif int t = buf->getBitLong(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Status Flags?: %1" ).arg( t ), 4 ); +#endif Q_UNUSED( t ); //RLZ: Warning needed separate string bufer std::string txt = sBuf->getVariableText( version, false ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Style sheet?: %1" ).arg( txt.c_str() ), 4 ); +#endif Q_UNUSED( txt ); t = buf->getRawChar8(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Render mode?: %1" ).arg( t ), 4 ); +#endif t = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "UCS OMore...: %1" ).arg( t ), 4 ); +#endif t = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "UCS VMore...: %1" ).arg( t ), 4 ); +#endif double x, y, z; x = buf->getBitDouble(); y = buf->getBitDouble(); z = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "UCS OMode: %1,%2,%3" ).arg( x ).arg( y ).arg( z ), 4 ); +#endif Q_UNUSED( x ); Q_UNUSED( y ); Q_UNUSED( z ); @@ -3783,90 +4288,138 @@ bool DRW_Viewport::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs ) x = buf->getBitDouble(); y = buf->getBitDouble(); z = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "UCS XAMode: %1,%2,%3" ).arg( x ).arg( y ).arg( z ), 4 ); +#endif x = buf->getBitDouble(); y = buf->getBitDouble(); z = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "UCS YMode: %1,%2,%3" ).arg( x ).arg( y ).arg( z ), 4 ); +#endif x = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "UCS EMore: %1" ).arg( x ), 4 ); +#endif t = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "UCS OVMore: %1" ).arg( t ), 4 ); +#endif } if ( version > DRW::AC1015 ) //2004+ { int t = buf->getBitShort(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "ShadePlot Mode...: %1" ).arg( t ), 4 ); +#endif Q_UNUSED( t ); } if ( version > DRW::AC1018 ) //2007+ { int t; t = buf->getBit(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Use def Light...: %1" ).arg( t ), 4 ); +#endif Q_UNUSED( t ); t = buf->getRawChar8(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Def light tipe?: %1" ).arg( t ), 4 ); +#endif double d = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Brightness: %1" ).arg( d ), 4 ); +#endif Q_UNUSED( d ); d = buf->getBitDouble(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Contrast: %1" ).arg( d ), 4 ); +#endif t = buf->getEnColor( version, color24, transparency ); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Ambient (Cmc or Enc?), Enc: 0x%1" ).arg( buf->getEnColor( version, color24, transparency ), 0, 16 ), 4 ); +#endif } ret = DRW_Entity::parseDwgEntHandle( version, buf ); dwgHandle someHdl; if ( version < DRW::AC1015 ) //R13 & R14 only { +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif someHdl = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "viewport ent handle: %1.%2 0x%3" ).arg( someHdl.code ).arg( someHdl.size ).arg( someHdl.ref, 0, 16 ), 4 ); +#endif } if ( version > DRW::AC1014 ) //2000+ { for ( duint8 i = 0; i < frozenLyCount; ++i ) { someHdl = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "frozen layer handle %1: %2.%3 0x%4" ).arg( i ).arg( someHdl.code ).arg( someHdl.size ).arg( someHdl.ref, 0, 16 ), 4 ); +#endif } someHdl = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "clip boundary handle: %1.%2 0x%3" ).arg( someHdl.code ).arg( someHdl.size ).arg( someHdl.ref, 0, 16 ), 4 ); +#endif if ( version == DRW::AC1015 ) //2000 only { someHdl = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "viewport ent handle: %1.%2 0x%3" ).arg( someHdl.code ).arg( someHdl.size ).arg( someHdl.ref, 0, 16 ), 4 ); +#endif } someHdl = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "named ucs handle: %1.%2 0x%3" ).arg( someHdl.code ).arg( someHdl.size ).arg( someHdl.ref, 0, 16 ), 4 ); +#endif +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif someHdl = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "base ucs handle: %1.%2 0x%3" ).arg( someHdl.code ).arg( someHdl.size ).arg( someHdl.ref, 0, 16 ), 4 ); +#endif } if ( version > DRW::AC1018 ) //2007+ { someHdl = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "background handle: %1.%2 0x%3" ).arg( someHdl.code ).arg( someHdl.size ).arg( someHdl.ref, 0, 16 ), 4 ); +#endif someHdl = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "visual style handle: %1.%2 0x%3" ).arg( someHdl.code ).arg( someHdl.size ).arg( someHdl.ref, 0, 16 ), 4 ); +#endif someHdl = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "shadeplot id handle: %1.%2 0x%3" ).arg( someHdl.code ).arg( someHdl.size ).arg( someHdl.ref, 0, 16 ), 4 ); +#endif +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif someHdl = buf->getHandle(); +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "SUN handle: %1.%2 0x%3" ).arg( someHdl.code ).arg( someHdl.size ).arg( someHdl.ref, 0, 16 ), 4 ); +#endif } +#ifdef DWGDEBUG QgsDebugMsgLevel( QStringLiteral( "Remaining bytes: %1" ).arg( buf->numRemainingBytes() ), 4 ); +#endif if ( !ret ) return ret;