[QGIS Commit] r10987 - trunk/qgis/src/core/symbology
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Jun 27 18:05:53 EDT 2009
Author: jef
Date: 2009-06-27 18:05:53 -0400 (Sat, 27 Jun 2009)
New Revision: 10987
Modified:
trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp
trunk/qgis/src/core/symbology/qgsmarkercatalogue.h
Log:
fix #1751
Modified: trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp
===================================================================
--- trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp 2009-06-27 21:35:41 UTC (rev 10986)
+++ trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp 2009-06-27 22:05:53 UTC (rev 10987)
@@ -145,7 +145,15 @@
//
// Now pass the paintdevice along to have the marker rendered on it
//
+ if ( fullName.left( 4 ) == "svg:" )
+ {
+ if ( svgMarker( &myPainter, fullName.mid( 4 ), size ) )
+ return myImage;
+ QgsDebugMsg( QString( "%1 not found - replacing with hard:circle" ).arg( fullName ) );
+ fullName = "hard:circle";
+ }
+
if ( fullName.left( 5 ) == "hard:" )
{
hardMarker( &myPainter, imageSize, fullName.mid( 5 ), size, pen, brush, qtBug );
@@ -157,11 +165,7 @@
#endif
return myImage;
}
- else if ( fullName.left( 4 ) == "svg:" )
- {
- svgMarker( &myPainter, fullName.mid( 4 ), size );
- return myImage;
- }
+
return QImage(); // empty
}
@@ -192,25 +196,33 @@
//
// Now pass the paintdevice along to have the marker rndered on it
//
+ if ( fullName.left( 4 ) == "svg:" )
+ {
+ if ( svgMarker( &myPainter, fullName.mid( 4 ), size ) )
+ return myPicture;
+ QgsDebugMsg( QString( "%1 not found - replacing with hard:circle" ).arg( fullName ) );
+ fullName = "hard:circle";
+ }
+
if ( fullName.left( 5 ) == "hard:" )
{
hardMarker( &myPainter, ( int ) size, fullName.mid( 5 ), size, pen, brush, qtBug );
return myPicture;
}
- else if ( fullName.left( 4 ) == "svg:" )
- {
- svgMarker( &myPainter, fullName.mid( 4 ), size );
- return myPicture;
- }
+
return QPicture(); // empty
}
-void QgsMarkerCatalogue::svgMarker( QPainter * thepPainter, QString fileName, double scaleFactor )
+bool QgsMarkerCatalogue::svgMarker( QPainter * thepPainter, QString fileName, double scaleFactor )
{
QSvgRenderer mySVG;
- mySVG.load( fileName );
+ if ( !mySVG.load( fileName ) )
+ return false;
+
mySVG.render( thepPainter );
+
+ return true;
}
void QgsMarkerCatalogue::hardMarker( QPainter * thepPainter, int imageSize, QString name, double s, QPen pen, QBrush brush, bool qtBug )
Modified: trunk/qgis/src/core/symbology/qgsmarkercatalogue.h
===================================================================
--- trunk/qgis/src/core/symbology/qgsmarkercatalogue.h 2009-06-27 21:35:41 UTC (rev 10986)
+++ trunk/qgis/src/core/symbology/qgsmarkercatalogue.h 2009-06-27 22:05:53 UTC (rev 10987)
@@ -52,7 +52,7 @@
/** Returns a pixmap given a file name of a svg marker
* NOTE: this method needs to be public static for QgsMarkerDialog::visualizeMarkers */
- static void svgMarker( QPainter * thepPainter, QString name, double size );
+ static bool svgMarker( QPainter * thepPainter, QString name, double size );
private:
/**Constructor*/
More information about the QGIS-commit
mailing list