Skip to content

Commit

Permalink
fix #2329
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@12632 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 28, 2009
1 parent 3586895 commit 49448c3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
17 changes: 16 additions & 1 deletion src/core/renderer/qgsgraduatedsymbolrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,22 @@ void QgsGraduatedSymbolRenderer::renderFeature( QgsRenderContext &renderContext,
oldName = theSymbol->pointSymbolName();
theSymbol->setNamedPointSymbol( name );
}
*img = theSymbol->getPointSymbolAsImage( renderContext.scaleFactor(), selected, mSelectionColor, fieldScale,

double scale = renderContext.scaleFactor();

if ( theSymbol->pointSizeUnits() )
{
/* Calc scale (still not nice) */
QgsPoint point;
point = renderContext.mapToPixel().transform( 0, 0 );
double x1 = point.x();
point = renderContext.mapToPixel().transform( 1000, 0 );
double x2 = point.x();

scale *= ( x2 - x1 ) * 0.001;
}

*img = theSymbol->getPointSymbolAsImage( scale, selected, mSelectionColor, fieldScale,
rotation, renderContext.rasterScaleFactor(), opacity );

if ( !oldName.isNull() )
Expand Down
16 changes: 15 additions & 1 deletion src/core/renderer/qgsuniquevaluerenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,21 @@ void QgsUniqueValueRenderer::renderFeature( QgsRenderContext &renderContext, Qgs
symbol->setNamedPointSymbol( name );
}

*img = symbol->getPointSymbolAsImage( renderContext.scaleFactor(), selected, mSelectionColor,
double scale = renderContext.scaleFactor();

if ( symbol->pointSizeUnits() )
{
/* Calc scale (still not nice) */
QgsPoint point;
point = renderContext.mapToPixel().transform( 0, 0 );
double x1 = point.x();
point = renderContext.mapToPixel().transform( 1000, 0 );
double x2 = point.x();

scale *= ( x2 - x1 ) * 0.001;
}

*img = symbol->getPointSymbolAsImage( scale, selected, mSelectionColor,
fieldScale, rotation, renderContext.rasterScaleFactor(),
opacity );
if ( !oldName.isNull() )
Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology/qgsmarkercatalogue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void QgsMarkerCatalogue::hardMarker( QPainter * thepPainter, int imageSize, QStr
// width is necessary.
double r = s / 2; // get half the size of the figure to be rendered (the radius)

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

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

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

// If radius is 0, draw a circle, so it wont disappear.
if ( name == "circle" || r < 1 )
Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology/qgssymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ QImage QgsSymbol::getPointSymbolAsImage( double widthScale, bool selected, QColo
}
else
{
QgsDebugMsg( QString( "marker:%1 mPointSize:%2 mPointSizeUnits:%3 scale:%4 widthScale:%5 rasterScaleFactor:%6 opacity:%7" )
QgsDebugMsgLevel( QString( "marker:%1 mPointSize:%2 mPointSizeUnits:%3 scale:%4 widthScale:%5 rasterScaleFactor:%6 opacity:%7" )
.arg( mPointSymbolName ).arg( mSize ).arg( mSizeInMapUnits ? "true" : "false" )
.arg( scale ).arg( widthScale ).arg( rasterScaleFactor ).arg( opacity ) );
.arg( scale ).arg( widthScale ).arg( rasterScaleFactor ).arg( opacity ), 3 );


preRotateImage = QgsMarkerCatalogue::instance()->imageMarker(
Expand Down

0 comments on commit 49448c3

Please sign in to comment.