mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
dwg import: less noisy debugging
This commit is contained in:
parent
1a96982d3e
commit
6090a932c2
22
external/libdxfrw/drw_entities.cpp
vendored
22
external/libdxfrw/drw_entities.cpp
vendored
@ -13,15 +13,6 @@
|
||||
// uncomment to get detailed debug output on DWG read. Caution: this option makes DWG import super-slow!
|
||||
// #define DWGDEBUG 1
|
||||
|
||||
#ifndef DWGDEBUG
|
||||
#ifdef QGSLOGGER_H
|
||||
#error qgislogger.h already included
|
||||
#endif
|
||||
#undef QGISDEBUG
|
||||
#endif // !DWGDEBUG
|
||||
|
||||
#include "qgslogger.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include "drw_entities.h"
|
||||
@ -31,6 +22,17 @@
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
#include "qgslogger.h"
|
||||
|
||||
#ifndef DWGDEBUG
|
||||
#undef QgsDebugCall
|
||||
#undef QgsDebugMsg
|
||||
#undef QgsDebugMsgLevel
|
||||
#define QgsDebugCall
|
||||
#define QgsDebugMsg(str)
|
||||
#define QgsDebugMsgLevel(str, level)
|
||||
#endif
|
||||
|
||||
#define RESERVE( vector, size ) try { \
|
||||
vector.reserve(size); \
|
||||
} catch(const std::exception &e) { \
|
||||
@ -1305,7 +1307,7 @@ bool DRW_Insert::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs )
|
||||
angle = buf->getBitDouble();
|
||||
extPoint = buf->getExtrusion( false ); //3BD R14 style
|
||||
|
||||
QgsDebugMsgLevel( QStringLiteral( "scale:%1, angle:%2 extrusion:%3" )
|
||||
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
|
||||
|
15
external/libdxfrw/drw_header.cpp
vendored
15
external/libdxfrw/drw_header.cpp
vendored
@ -10,17 +10,30 @@
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>. **
|
||||
******************************************************************************/
|
||||
|
||||
// uncomment to get detailed debug output on DWG read. Caution: this option makes DWG import super-slow!
|
||||
// #define DWGDEBUG 1
|
||||
|
||||
#include "drw_header.h"
|
||||
#include "intern/dxfreader.h"
|
||||
#include "intern/dxfwriter.h"
|
||||
#include "intern/drw_dbg.h"
|
||||
#include "intern/dwgbuffer.h"
|
||||
|
||||
#include "qgslogger.h"
|
||||
#include <QStringList>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "qgslogger.h"
|
||||
|
||||
#ifndef DWGDEBUG
|
||||
#undef QgsDebugCall
|
||||
#undef QgsDebugMsg
|
||||
#undef QgsDebugMsgLevel
|
||||
#define QgsDebugCall
|
||||
#define QgsDebugMsg(str)
|
||||
#define QgsDebugMsgLevel(str, level)
|
||||
#endif
|
||||
|
||||
DRW_Header::DRW_Header()
|
||||
: curr( nullptr )
|
||||
, version( DRW::AC1021 )
|
||||
|
16
external/libdxfrw/drw_objects.cpp
vendored
16
external/libdxfrw/drw_objects.cpp
vendored
@ -10,6 +10,9 @@
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>. **
|
||||
******************************************************************************/
|
||||
|
||||
// uncomment to get detailed debug output on DWG read. Caution: this option makes DWG import super-slow!
|
||||
// #define DWGDEBUG 1
|
||||
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
|
||||
@ -20,10 +23,19 @@
|
||||
#include "intern/drw_dbg.h"
|
||||
#include "intern/dwgutil.h"
|
||||
|
||||
#undef QGISDEBUG
|
||||
#include "qgslogger.h"
|
||||
#include <QStringList>
|
||||
|
||||
#include "qgslogger.h"
|
||||
|
||||
#ifndef DWGDEBUG
|
||||
#undef QgsDebugCall
|
||||
#undef QgsDebugMsg
|
||||
#undef QgsDebugMsgLevel
|
||||
#define QgsDebugCall
|
||||
#define QgsDebugMsg(str)
|
||||
#define QgsDebugMsgLevel(str, level)
|
||||
#endif
|
||||
|
||||
#define RESERVE( vector, size ) try { \
|
||||
vector.reserve(size); \
|
||||
} catch(const std::exception &e) { \
|
||||
|
3
external/libdxfrw/intern/drw_textcodec.cpp
vendored
3
external/libdxfrw/intern/drw_textcodec.cpp
vendored
@ -296,7 +296,8 @@ std::string DRW_Converter::encodeNum( int c )
|
||||
return std::string( ( char * )ret );
|
||||
}
|
||||
|
||||
/** 's' is a string with at least 4 bytes length
|
||||
/**
|
||||
* 's' is a string with at least 4 bytes length
|
||||
** returned 'b' is byte length of encoded char: 2,3 or 4
|
||||
**/
|
||||
int DRW_Converter::decodeNum( std::string s, int *b )
|
||||
|
29
external/libdxfrw/intern/dwgbuffer.cpp
vendored
29
external/libdxfrw/intern/dwgbuffer.cpp
vendored
@ -10,34 +10,23 @@
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>. **
|
||||
******************************************************************************/
|
||||
|
||||
// uncomment to get detailed debug output on DWG read. Caution: this option makes DWG import super-slow!
|
||||
// #define DWGDEBUG 1
|
||||
|
||||
#include "dwgbuffer.h"
|
||||
#include "../libdwgr.h"
|
||||
#include "drw_textcodec.h"
|
||||
#include "drw_dbg.h"
|
||||
|
||||
#undef QGISDEBUG
|
||||
#include "qgslogger.h"
|
||||
|
||||
#if 0
|
||||
//#include <bitset>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include "dwgreader.h"
|
||||
#include "dxfwriter.h"
|
||||
|
||||
#define FIRSTHANDLE 48
|
||||
|
||||
enum sections
|
||||
{
|
||||
secUnknown,
|
||||
secHeader,
|
||||
secTables,
|
||||
secBlocks,
|
||||
secEntities,
|
||||
secObjects
|
||||
};
|
||||
#ifndef DWGDEBUG
|
||||
#undef QgsDebugCall
|
||||
#undef QgsDebugMsg
|
||||
#undef QgsDebugMsgLevel
|
||||
#define QgsDebugCall
|
||||
#define QgsDebugMsg(str)
|
||||
#define QgsDebugMsgLevel(str, level)
|
||||
#endif
|
||||
|
||||
static unsigned int crctable[256] =
|
||||
|
15
external/libdxfrw/intern/dwgreader.cpp
vendored
15
external/libdxfrw/intern/dwgreader.cpp
vendored
@ -10,6 +10,9 @@
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>. **
|
||||
******************************************************************************/
|
||||
|
||||
// uncomment to get detailed debug output on DWG read. Caution: this option makes DWG import super-slow!
|
||||
// #define DWGDEBUG 1
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
@ -19,12 +22,20 @@
|
||||
#include "dwgreader.h"
|
||||
#include "drw_textcodec.h"
|
||||
|
||||
#undef QGISDEBUG
|
||||
#include "qgslogger.h"
|
||||
#include "qgsmessagelog.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
#ifndef DWGDEBUG
|
||||
#undef QgsDebugCall
|
||||
#undef QgsDebugMsg
|
||||
#undef QgsDebugMsgLevel
|
||||
#define QgsDebugCall
|
||||
#define QgsDebugMsg(str)
|
||||
#define QgsDebugMsgLevel(str, level)
|
||||
#endif
|
||||
|
||||
|
||||
dwgReader::~dwgReader()
|
||||
{
|
||||
@ -221,7 +232,7 @@ bool dwgReader::readDwgHandles( dwgBuffer *dbuf, duint32 offset, duint32 size )
|
||||
*/
|
||||
bool dwgReader::readDwgTables( DRW_Header &hdr, dwgBuffer *dbuf )
|
||||
{
|
||||
QgsDebugMsg( "Entering." );
|
||||
QgsDebugMsgLevel( "Entering.", 4 );
|
||||
|
||||
bool ret = true;
|
||||
bool ret2 = true;
|
||||
|
11
external/libdxfrw/intern/dxfreader.cpp
vendored
11
external/libdxfrw/intern/dxfreader.cpp
vendored
@ -10,6 +10,9 @@
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>. **
|
||||
******************************************************************************/
|
||||
|
||||
// uncomment to get detailed debug output on DWG read. Caution: this option makes DWG import super-slow!
|
||||
// #define DWGDEBUG 1
|
||||
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
@ -20,6 +23,14 @@
|
||||
|
||||
#include "qgslogger.h"
|
||||
|
||||
#ifndef DWGDEBUG
|
||||
#undef QgsDebugCall
|
||||
#undef QgsDebugMsg
|
||||
#undef QgsDebugMsgLevel
|
||||
#define QgsDebugCall
|
||||
#define QgsDebugMsg(str)
|
||||
#define QgsDebugMsgLevel(str, level)
|
||||
#endif
|
||||
|
||||
bool dxfReader::readRec( int *codeData )
|
||||
{
|
||||
|
13
external/libdxfrw/libdxfrw.cpp
vendored
13
external/libdxfrw/libdxfrw.cpp
vendored
@ -10,8 +10,11 @@
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>. **
|
||||
******************************************************************************/
|
||||
|
||||
// uncomment to get detailed debug output on DWG read. Caution: this option makes DWG import super-slow!
|
||||
// #define DWGDEBUG 1
|
||||
|
||||
#include "libdxfrw.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
@ -24,6 +27,15 @@
|
||||
|
||||
#include "qgslogger.h"
|
||||
|
||||
#ifndef DWGDEBUG
|
||||
#undef QgsDebugCall
|
||||
#undef QgsDebugMsg
|
||||
#undef QgsDebugMsgLevel
|
||||
#define QgsDebugCall
|
||||
#define QgsDebugMsg(str)
|
||||
#define QgsDebugMsgLevel(str, level)
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201500
|
||||
#define FALLTHROUGH [[fallthrough]];
|
||||
#elif defined(__clang__)
|
||||
@ -2314,7 +2326,6 @@ bool dxfRW::processTables()
|
||||
bool dxfRW::processLType()
|
||||
{
|
||||
QgsDebugMsg( "Entering." );
|
||||
|
||||
int code;
|
||||
std::string sectionstr;
|
||||
bool reading = false;
|
||||
|
@ -262,7 +262,7 @@ Multiply x and y by the given value
|
||||
sipRes = qHash( *sipCpp );
|
||||
%End
|
||||
|
||||
}; // class QgsPoint
|
||||
}; // class QgsPointXY
|
||||
|
||||
|
||||
|
||||
|
@ -135,7 +135,6 @@ OGRLayerH QgsDwgImporter::query( const QString &sql )
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void QgsDwgImporter::startTransaction()
|
||||
{
|
||||
Q_ASSERT( mDs );
|
||||
@ -825,11 +824,13 @@ void QgsDwgImporter::addLType( const DRW_LType &data )
|
||||
|
||||
QString QgsDwgImporter::colorString( int color, int color24, int transparency, const std::string &layer ) const
|
||||
{
|
||||
#if 0
|
||||
QgsDebugMsgLevel( QStringLiteral( "colorString(color=%1, color24=0x%2, transparency=0x%3 layer=%4" )
|
||||
.arg( color )
|
||||
.arg( color24, 0, 16 )
|
||||
.arg( transparency, 0, 16 )
|
||||
.arg( layer.c_str() ), 5 );
|
||||
#endif
|
||||
if ( color24 == -1 )
|
||||
{
|
||||
if ( color == 0 )
|
||||
@ -1276,7 +1277,6 @@ void QgsDwgImporter::addXline( const DRW_Xline &data )
|
||||
|
||||
bool QgsDwgImporter::circularStringFromArc( const DRW_Arc &data, QgsCircularString &c )
|
||||
{
|
||||
|
||||
double half = ( data.staangle + data.endangle ) / 2.0;
|
||||
if ( data.staangle > data.endangle )
|
||||
half += M_PI;
|
||||
@ -1285,9 +1285,6 @@ bool QgsDwgImporter::circularStringFromArc( const DRW_Arc &data, QgsCircularStri
|
||||
double a1 = data.isccw ? half : -half;
|
||||
double a2 = data.isccw ? data.endangle : -data.endangle;
|
||||
|
||||
QgsDebugMsgLevel( QStringLiteral( "arc handle=0x%1 radius=%2 staangle=%3 endangle=%4 isccw=%5 half=%6" )
|
||||
.arg( data.handle, 0, 16 ).arg( data.mRadius ).arg( data.staangle ).arg( data.endangle ).arg( data.isccw ).arg( half ), 5 );
|
||||
|
||||
c.setPoints( QgsPointSequence()
|
||||
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + std::cos( a0 ) * data.mRadius, data.basePoint.y + std::sin( a0 ) * data.mRadius )
|
||||
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + std::cos( a1 ) * data.mRadius, data.basePoint.y + std::sin( a1 ) * data.mRadius )
|
||||
@ -1395,14 +1392,12 @@ bool QgsDwgImporter::curveFromLWPolyline( const DRW_LWPolyline &data, QgsCompoun
|
||||
{
|
||||
QgsCircularString *c = new QgsCircularString();
|
||||
c->setPoints( s );
|
||||
QgsDebugMsg( QStringLiteral( "add circular string:%1" ).arg( c->asWkt() ) );
|
||||
cc.addCurve( c );
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsLineString *c = new QgsLineString();
|
||||
c->setPoints( s );
|
||||
QgsDebugMsg( QStringLiteral( "add line string:%1" ).arg( c->asWkt() ) );
|
||||
cc.addCurve( c );
|
||||
}
|
||||
|
||||
@ -1459,6 +1454,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
|
||||
double endWidth = data.vertlist[i0]->endwidth == 0.0 ? data.width : data.vertlist[i0]->endwidth;
|
||||
bool hasBulge( data.vertlist[i0]->bulge != 0.0 );
|
||||
|
||||
#if 0
|
||||
QgsDebugMsgLevel( QStringLiteral( "i:%1,%2/%3 width=%4 staWidth=%5 endWidth=%6 hadBulge=%7 hasBulge=%8 l=%9 <=> %10" )
|
||||
.arg( i0 ).arg( i1 ).arg( n )
|
||||
.arg( width ).arg( staWidth ).arg( endWidth )
|
||||
@ -1466,6 +1462,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
|
||||
.arg( p0.asWkt() )
|
||||
.arg( p1.asWkt() ), 5
|
||||
);
|
||||
#endif
|
||||
|
||||
if ( !s.empty() && ( width != staWidth || width != endWidth || hadBulge != hasBulge ) )
|
||||
{
|
||||
@ -1473,14 +1470,12 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
|
||||
{
|
||||
QgsCircularString *c = new QgsCircularString();
|
||||
c->setPoints( s );
|
||||
// QgsDebugMsg( QStringLiteral( "add circular string:%1" ).arg( c->asWkt() ) );
|
||||
cc.addCurve( c );
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsLineString *c = new QgsLineString();
|
||||
c->setPoints( s );
|
||||
// QgsDebugMsg( QStringLiteral( "add line string:%1" ).arg( c->asWkt() ) );
|
||||
cc.addCurve( c );
|
||||
}
|
||||
|
||||
@ -1589,14 +1584,12 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
|
||||
{
|
||||
QgsCircularString *c = new QgsCircularString();
|
||||
c->setPoints( s );
|
||||
// QgsDebugMsg( QStringLiteral( "add circular string:%1" ).arg( c->asWkt() ) );
|
||||
cc.addCurve( c );
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsLineString *c = new QgsLineString();
|
||||
c->setPoints( s );
|
||||
// QgsDebugMsg( QStringLiteral( "add line string:%1" ).arg( c->asWkt() ) );
|
||||
cc.addCurve( c );
|
||||
}
|
||||
}
|
||||
@ -1792,14 +1785,12 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
|
||||
{
|
||||
QgsCircularString *c = new QgsCircularString();
|
||||
c->setPoints( s );
|
||||
// QgsDebugMsg( QStringLiteral( "add circular string:%1" ).arg( c->asWkt() ) );
|
||||
cc.addCurve( c );
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsLineString *c = new QgsLineString();
|
||||
c->setPoints( s );
|
||||
// QgsDebugMsg( QStringLiteral( "add line string:%1" ).arg( c->asWkt() ) );
|
||||
cc.addCurve( c );
|
||||
}
|
||||
}
|
||||
@ -2384,6 +2375,15 @@ void QgsDwgImporter::addHatch( const DRW_Hatch *pdata )
|
||||
{
|
||||
QgsDebugMsg( QStringLiteral( "unknown obj %1.%2: %3" ).arg( i ).arg( j ).arg( typeid( *entity ).name() ) );
|
||||
}
|
||||
|
||||
#if 0
|
||||
QgsDebugMsg( QStringLiteral( "curve %1.%2\n start %3\n end %4\n compare %5" )
|
||||
.arg( i ).arg( j )
|
||||
.arg( cc->startPoint().asWkt() )
|
||||
.arg( cc->endPoint().asWkt() )
|
||||
.arg( cc->startPoint() == cc->endPoint() )
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( i == 0 )
|
||||
|
@ -340,7 +340,7 @@ class CORE_EXPORT QgsPointXY
|
||||
|
||||
friend uint qHash( const QgsPointXY &pnt );
|
||||
|
||||
}; // class QgsPoint
|
||||
}; // class QgsPointXY
|
||||
|
||||
Q_DECLARE_METATYPE( QgsPointXY )
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user