@@ -145,6 +145,14 @@ QImage QgsMarkerCatalogue::imageMarker( QString fullName, double size, QPen pen,
145145 //
146146 // Now pass the paintdevice along to have the marker rendered on it
147147 //
148+ if ( fullName.left ( 4 ) == " svg:" )
149+ {
150+ if ( svgMarker ( &myPainter, fullName.mid ( 4 ), size ) )
151+ return myImage;
152+
153+ QgsDebugMsg ( QString ( " %1 not found - replacing with hard:circle" ).arg ( fullName ) );
154+ fullName = " hard:circle" ;
155+ }
148156
149157 if ( fullName.left ( 5 ) == " hard:" )
150158 {
@@ -157,11 +165,7 @@ QImage QgsMarkerCatalogue::imageMarker( QString fullName, double size, QPen pen,
157165#endif
158166 return myImage;
159167 }
160- else if ( fullName.left ( 4 ) == " svg:" )
161- {
162- svgMarker ( &myPainter, fullName.mid ( 4 ), size );
163- return myImage;
164- }
168+
165169 return QImage (); // empty
166170}
167171
@@ -192,25 +196,33 @@ QPicture QgsMarkerCatalogue::pictureMarker( QString fullName, double size, QPen
192196 //
193197 // Now pass the paintdevice along to have the marker rndered on it
194198 //
199+ if ( fullName.left ( 4 ) == " svg:" )
200+ {
201+ if ( svgMarker ( &myPainter, fullName.mid ( 4 ), size ) )
202+ return myPicture;
203+
204+ QgsDebugMsg ( QString ( " %1 not found - replacing with hard:circle" ).arg ( fullName ) );
205+ fullName = " hard:circle" ;
206+ }
195207
196208 if ( fullName.left ( 5 ) == " hard:" )
197209 {
198210 hardMarker ( &myPainter, ( int ) size, fullName.mid ( 5 ), size, pen, brush, qtBug );
199211 return myPicture;
200212 }
201- else if ( fullName.left ( 4 ) == " svg:" )
202- {
203- svgMarker ( &myPainter, fullName.mid ( 4 ), size );
204- return myPicture;
205- }
213+
206214 return QPicture (); // empty
207215}
208216
209- void QgsMarkerCatalogue::svgMarker ( QPainter * thepPainter, QString fileName, double scaleFactor )
217+ bool QgsMarkerCatalogue::svgMarker ( QPainter * thepPainter, QString fileName, double scaleFactor )
210218{
211219 QSvgRenderer mySVG;
212- mySVG.load ( fileName );
220+ if ( !mySVG.load ( fileName ) )
221+ return false ;
222+
213223 mySVG.render ( thepPainter );
224+
225+ return true ;
214226}
215227
216228void QgsMarkerCatalogue::hardMarker ( QPainter * thepPainter, int imageSize, QString name, double s, QPen pen, QBrush brush, bool qtBug )
0 commit comments