Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix #1751
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10987 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 27, 2009
1 parent e7ca3ff commit 70646ab
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
36 changes: 24 additions & 12 deletions src/core/symbology/qgsmarkercatalogue.cpp
Expand Up @@ -145,6 +145,14 @@ QImage QgsMarkerCatalogue::imageMarker( QString fullName, double size, QPen pen,
//
// 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:" )
{
Expand All @@ -157,11 +165,7 @@ QImage QgsMarkerCatalogue::imageMarker( QString fullName, double size, QPen pen,
#endif
return myImage;
}
else if ( fullName.left( 4 ) == "svg:" )
{
svgMarker( &myPainter, fullName.mid( 4 ), size );
return myImage;
}

return QImage(); // empty
}

Expand Down Expand Up @@ -192,25 +196,33 @@ QPicture QgsMarkerCatalogue::pictureMarker( QString fullName, double size, QPen
//
// 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 )
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology/qgsmarkercatalogue.h
Expand Up @@ -52,7 +52,7 @@ class CORE_EXPORT QgsMarkerCatalogue

/** 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*/
Expand Down

0 comments on commit 70646ab

Please sign in to comment.