4 changes: 2 additions & 2 deletions python/core/symbology-ng/qgscategorizedsymbolrendererv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class QgsRendererCategoryV2
void setLabel( const QString &label );

// debugging
QString dump();
QString dump() const;

void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;
};
Expand All @@ -49,7 +49,7 @@ class QgsCategorizedSymbolRendererV2 : QgsFeatureRendererV2

virtual QList<QString> usedAttributes();

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone() /Factory/;

Expand Down
5 changes: 3 additions & 2 deletions python/core/symbology-ng/qgsgraduatedsymbolrendererv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class QgsRendererRangeV2
void setUpperValue( double upperValue );

// debugging
QString dump();
QString dump() const;

void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;
};
Expand All @@ -48,7 +48,7 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2

virtual QList<QString> usedAttributes();

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone() /Factory/;

Expand Down Expand Up @@ -112,6 +112,7 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2

//! return a list of item text / symbol
//! @note: this method was added in version 1.5
//! @note not available in python bindings
// virtual QgsLegendSymbolList legendSymbolItems();

QgsSymbolV2* sourceSymbol();
Expand Down
5 changes: 3 additions & 2 deletions python/core/symbology-ng/qgsrendererv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ class QgsFeatureRendererV2
virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );

//! for debugging
virtual QString dump();
virtual QString dump() const;

enum Capabilities
{
SymbolLevels = 1, // rendering with symbol levels (i.e. implements symbols(), symbolForFeature())
RotationField = 2, // rotate symbols by attribute value
MoreSymbolsPerFeature = 4 // may use more than one symbol to render a feature: symbolsForFeature() will return them
Filter = 8, // features may be filtered, i.e. some features may not be rendered (categorized, rule based ...)
ScaleDependent = 16 // dependends on scale if feature will be rendered (rule based )
ScaleDependent = 16 // depends on scale if feature will be rendered (rule based )
};

//! returns bitwise OR-ed capabilities of the renderer
Expand Down Expand Up @@ -123,6 +123,7 @@ class QgsFeatureRendererV2

//! return a list of item text / symbol
//! @note: this method was added in version 1.5
//! @note: not available in python bindings
// virtual QgsLegendSymbolList legendSymbolItems();

//! set type and size of editing vertex markers for subsequent rendering
Expand Down
2 changes: 1 addition & 1 deletion python/core/symbology-ng/qgssinglesymbolrendererv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class QgsSingleSymbolRendererV2 : QgsFeatureRendererV2
//! @note added in 2.0
QgsSymbolV2::ScaleMethod scaleMethod() const;

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone() /Factory/;

Expand Down
2 changes: 1 addition & 1 deletion python/core/symbology-ng/qgssymbolv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class QgsSymbolV2

QImage bigSymbolPreviewImage();

QString dump();
QString dump() const;

virtual QgsSymbolV2* clone() const = 0 /Factory/;

Expand Down
96 changes: 53 additions & 43 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,37 @@ void qgisCrash( int signal )
{
qFatal( "QGIS died on signal %d", signal );
}

void dumpBacktrace()
{
if ( access( "/usr/bin/c++filt", X_OK ) )
{
( void ) write( STDERR_FILENO, "Stacktrace (c++filt NOT FOUND):\n", 32 );
}
else
{
int fd[2];

if ( pipe( fd ) == 0 && fork() == 0 )
{
close( STDIN_FILENO );
close( fd[1] );
dup( fd[0] );
execl( "/usr/bin/c++filt", "c++filt", ( char * ) 0 );
exit( 1 );
}

( void ) write( STDERR_FILENO, "Stacktrace (piped through c++filt):\n", 36 );

close( STDERR_FILENO );
close( fd[0] );
dup( fd[1] );
}

void *buffer[256];
int nptrs = backtrace( buffer, sizeof( buffer ) / sizeof( *buffer ) );
backtrace_symbols_fd( buffer, nptrs, STDERR_FILENO );
}
#endif

/*
Expand All @@ -218,6 +249,10 @@ void myMessageOutput( QtMsgType type, const char *msg )
{
case QtDebugMsg:
fprintf( stderr, "Debug: %s\n", msg );
#if (defined(linux) && !defined(ANDROID)) || defined(__FreeBSD__)
if ( strncmp( msg, "Backtrace", 9 ) == 0 )
dumpBacktrace();
#endif
break;
case QtCriticalMsg:
fprintf( stderr, "Critical: %s\n", msg );
Expand All @@ -228,14 +263,12 @@ void myMessageOutput( QtMsgType type, const char *msg )
#ifdef QGISDEBUG
if ( 0 == strncmp( msg, "Object::", 8 )
|| 0 == strncmp( msg, "QWidget::", 9 )
|| 0 == strncmp( msg, "QPainter::", 10 ) )
|| 0 == strncmp( msg, "QPainter::", 10 )
)
{
#if 0
#if (defined(linux) && !defined(ANDROID)) || defined(__FreeBSD__)
fprintf( stderr, "Stacktrace (run through c++filt):\n" );
void *buffer[256];
int nptrs = backtrace( buffer, sizeof( buffer ) / sizeof( *buffer ) );
backtrace_symbols_fd( buffer, nptrs, STDERR_FILENO );
dumpBacktrace();
#endif
#endif
QgsMessageLog::logMessage( msg, "Qt" );
Expand All @@ -254,33 +287,7 @@ void myMessageOutput( QtMsgType type, const char *msg )
{
fprintf( stderr, "Fatal: %s\n", msg );
#if (defined(linux) && !defined(ANDROID)) || defined(__FreeBSD__)
if ( access( "/usr/bin/c++filt", X_OK ) )
{
( void ) write( STDERR_FILENO, "Stacktrace (c++filt NOT FOUND):\n", 32 );
}
else
{
int fd[2];

if ( pipe( fd ) == 0 && fork() == 0 )
{
close( STDIN_FILENO );
close( fd[1] );
dup( fd[0] );
execl( "/usr/bin/c++filt", "c++filt", ( char * ) 0 );
exit( 1 );
}

( void ) write( STDERR_FILENO, "Stacktrace (piped through c++filt):\n", 36 );

close( STDERR_FILENO );
close( fd[0] );
dup( fd[1] );
}

void *buffer[256];
int nptrs = backtrace( buffer, sizeof( buffer ) / sizeof( *buffer ) );
backtrace_symbols_fd( buffer, nptrs, STDERR_FILENO );
dumpBacktrace();
#endif
abort(); // deliberately core dump
}
Expand Down Expand Up @@ -852,17 +859,20 @@ int main( int argc, char *argv[] )
QCoreApplication::addLibraryPath( QTPLUGINSDIR );
}
//next two lines should not be needed, testing only
//QCoreApplication::addLibraryPath( myPath + "/imageformats" );
//QCoreApplication::addLibraryPath( myPath + "/sqldrivers" );
//foreach (myPath, myApp.libraryPaths())
//{
//qDebug("Path:" + myPath.toLocal8Bit());
//}
//qDebug( "Added %s to plugin search path", qPrintable( myPath ) );
//QList<QByteArray> myFormats = QImageReader::supportedImageFormats();
//for ( int x = 0; x < myFormats.count(); ++x ) {
// qDebug("Format: " + myFormats[x]);
//}
#if 0
QCoreApplication::addLibraryPath( myPath + "/imageformats" );
QCoreApplication::addLibraryPath( myPath + "/sqldrivers" );
foreach ( myPath, myApp.libraryPaths() )
{
qDebug( "Path:" + myPath.toLocal8Bit() );
}
qDebug( "Added %s to plugin search path", qPrintable( myPath ) );
QList<QByteArray> myFormats = QImageReader::supportedImageFormats();
for ( int x = 0; x < myFormats.count(); ++x )
{
qDebug( "Format: " + myFormats[x] );
}
#endif
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void QgsRendererCategoryV2::setLabel( const QString &label )
mLabel = label;
}

QString QgsRendererCategoryV2::dump()
QString QgsRendererCategoryV2::dump() const
{
return QString( "%1::%2::%3\n" ).arg( mValue.toString() ).arg( mLabel ).arg( mSymbol->dump() );
}
Expand Down Expand Up @@ -425,7 +425,7 @@ QList<QString> QgsCategorizedSymbolRendererV2::usedAttributes()
return attributes.toList();
}

QString QgsCategorizedSymbolRendererV2::dump()
QString QgsCategorizedSymbolRendererV2::dump() const
{
QString s = QString( "CATEGORIZED: idx %1\n" ).arg( mAttrName );
for ( int i = 0; i < mCategories.count(); i++ )
Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgscategorizedsymbolrendererv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CORE_EXPORT QgsRendererCategoryV2
void setLabel( const QString &label );

// debugging
QString dump();
QString dump() const;

void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;

Expand Down Expand Up @@ -76,7 +76,7 @@ class CORE_EXPORT QgsCategorizedSymbolRendererV2 : public QgsFeatureRendererV2

virtual QList<QString> usedAttributes();

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone();

Expand Down
12 changes: 12 additions & 0 deletions src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,18 @@ bool QgsCentroidFillSymbolLayerV2::setSubSymbol( QgsSymbolV2* symbol )
return true;
}

QSet<QString> QgsCentroidFillSymbolLayerV2::usedAttributes() const
{
QSet<QString> attributes;

attributes.unite( QgsSymbolLayerV2::usedAttributes() );

if ( mMarker )
attributes.unite( mMarker->usedAttributes() );

return attributes;
}

QgsSymbolV2::OutputUnit QgsCentroidFillSymbolLayerV2::outputUnit() const
{
if ( mMarker )
Expand Down
2 changes: 2 additions & 0 deletions src/core/symbology-ng/qgsfillsymbollayerv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ class CORE_EXPORT QgsCentroidFillSymbolLayerV2 : public QgsFillSymbolLayerV2
void setOutputUnit( QgsSymbolV2::OutputUnit unit ) { Q_UNUSED( unit ); }
QgsSymbolV2::OutputUnit outputUnit() const;

virtual QSet<QString> usedAttributes() const;

protected:
QgsMarkerSymbolV2* mMarker;
};
Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void QgsRendererRangeV2::setLowerValue( double lowerValue )
mLowerValue = lowerValue;
}

QString QgsRendererRangeV2::dump()
QString QgsRendererRangeV2::dump() const
{
return QString( "%1 - %2::%3::%4\n" ).arg( mLowerValue ).arg( mUpperValue ).arg( mLabel ).arg( mSymbol->dump() );
}
Expand Down Expand Up @@ -336,7 +336,7 @@ bool QgsGraduatedSymbolRendererV2::updateRangeLowerValue( int rangeIndex, double
return true;
}

QString QgsGraduatedSymbolRendererV2::dump()
QString QgsGraduatedSymbolRendererV2::dump() const
{
QString s = QString( "GRADUATED: attr %1\n" ).arg( mAttrName );
for ( int i = 0; i < mRanges.count(); i++ )
Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgsgraduatedsymbolrendererv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CORE_EXPORT QgsRendererRangeV2
void setUpperValue( double upperValue );

// debugging
QString dump();
QString dump() const;

void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;

Expand Down Expand Up @@ -71,7 +71,7 @@ class CORE_EXPORT QgsGraduatedSymbolRendererV2 : public QgsFeatureRendererV2

virtual QList<QString> usedAttributes();

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone();

Expand Down
Loading