Skip to content

Commit 49448c3

Browse files
author
jef
committed
fix #2329
git-svn-id: http://svn.osgeo.org/qgis/trunk@12632 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 3586895 commit 49448c3

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

src/core/renderer/qgsgraduatedsymbolrenderer.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,22 @@ void QgsGraduatedSymbolRenderer::renderFeature( QgsRenderContext &renderContext,
165165
oldName = theSymbol->pointSymbolName();
166166
theSymbol->setNamedPointSymbol( name );
167167
}
168-
*img = theSymbol->getPointSymbolAsImage( renderContext.scaleFactor(), selected, mSelectionColor, fieldScale,
168+
169+
double scale = renderContext.scaleFactor();
170+
171+
if ( theSymbol->pointSizeUnits() )
172+
{
173+
/* Calc scale (still not nice) */
174+
QgsPoint point;
175+
point = renderContext.mapToPixel().transform( 0, 0 );
176+
double x1 = point.x();
177+
point = renderContext.mapToPixel().transform( 1000, 0 );
178+
double x2 = point.x();
179+
180+
scale *= ( x2 - x1 ) * 0.001;
181+
}
182+
183+
*img = theSymbol->getPointSymbolAsImage( scale, selected, mSelectionColor, fieldScale,
169184
rotation, renderContext.rasterScaleFactor(), opacity );
170185

171186
if ( !oldName.isNull() )

src/core/renderer/qgsuniquevaluerenderer.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,21 @@ void QgsUniqueValueRenderer::renderFeature( QgsRenderContext &renderContext, Qgs
141141
symbol->setNamedPointSymbol( name );
142142
}
143143

144-
*img = symbol->getPointSymbolAsImage( renderContext.scaleFactor(), selected, mSelectionColor,
144+
double scale = renderContext.scaleFactor();
145+
146+
if ( symbol->pointSizeUnits() )
147+
{
148+
/* Calc scale (still not nice) */
149+
QgsPoint point;
150+
point = renderContext.mapToPixel().transform( 0, 0 );
151+
double x1 = point.x();
152+
point = renderContext.mapToPixel().transform( 1000, 0 );
153+
double x2 = point.x();
154+
155+
scale *= ( x2 - x1 ) * 0.001;
156+
}
157+
158+
*img = symbol->getPointSymbolAsImage( scale, selected, mSelectionColor,
145159
fieldScale, rotation, renderContext.rasterScaleFactor(),
146160
opacity );
147161
if ( !oldName.isNull() )

src/core/symbology/qgsmarkercatalogue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void QgsMarkerCatalogue::hardMarker( QPainter * thepPainter, int imageSize, QStr
300300
// width is necessary.
301301
double r = s / 2; // get half the size of the figure to be rendered (the radius)
302302

303-
QgsDebugMsg( QString( "Hard marker size %1" ).arg( s ) );
303+
QgsDebugMsgLevel( QString( "Hard marker size %1" ).arg( s ), 3 );
304304

305305
// Find out center coordinates of the QImage to draw on.
306306
double x_c = ( double )( imageSize / 2 ) + 0.5; // add 1/2 pixel for proper rounding when the figure's coordinates are added
@@ -309,7 +309,7 @@ void QgsMarkerCatalogue::hardMarker( QPainter * thepPainter, int imageSize, QStr
309309
thepPainter->setPen( pen );
310310
thepPainter->setBrush( brush );
311311

312-
QgsDebugMsg( QString( "Hard marker radius %1" ).arg( r ) );
312+
QgsDebugMsgLevel( QString( "Hard marker radius %1" ).arg( r ), 3 );
313313

314314
// If radius is 0, draw a circle, so it wont disappear.
315315
if ( name == "circle" || r < 1 )

src/core/symbology/qgssymbol.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ QImage QgsSymbol::getPointSymbolAsImage( double widthScale, bool selected, QColo
411411
}
412412
else
413413
{
414-
QgsDebugMsg( QString( "marker:%1 mPointSize:%2 mPointSizeUnits:%3 scale:%4 widthScale:%5 rasterScaleFactor:%6 opacity:%7" )
414+
QgsDebugMsgLevel( QString( "marker:%1 mPointSize:%2 mPointSizeUnits:%3 scale:%4 widthScale:%5 rasterScaleFactor:%6 opacity:%7" )
415415
.arg( mPointSymbolName ).arg( mSize ).arg( mSizeInMapUnits ? "true" : "false" )
416-
.arg( scale ).arg( widthScale ).arg( rasterScaleFactor ).arg( opacity ) );
416+
.arg( scale ).arg( widthScale ).arg( rasterScaleFactor ).arg( opacity ), 3 );
417417

418418

419419
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker(

0 commit comments

Comments
 (0)