Skip to content
Permalink
Browse files

sizePainterUnits: Calculate based on specified size instead of size i…

…n QgsDiagramSettings
  • Loading branch information
m-kuhn committed Sep 3, 2012
1 parent 9c4d67c commit aa31c8c6ba11325d3a47abb0f477d3bcf1131e8f
Showing with 4 additions and 5 deletions.
  1. +2 −3 src/core/diagram/qgsdiagram.cpp
  2. +2 −2 src/core/diagram/qgsdiagram.h
@@ -33,14 +33,13 @@ void QgsDiagram::setPenWidth( QPen& pen, const QgsDiagramSettings& s, const QgsR

QSizeF QgsDiagram::sizePainterUnits( const QSizeF& size, const QgsDiagramSettings& s, const QgsRenderContext& c )
{
Q_UNUSED( size );
if ( s.sizeType == QgsDiagramSettings::MM )
{
return QSizeF( s.size.width() * c.scaleFactor() * c.rasterScaleFactor(), s.size.height() * c.scaleFactor() * c.rasterScaleFactor());
return QSizeF( size.width() * c.scaleFactor() * c.rasterScaleFactor(), size.height() * c.scaleFactor() * c.rasterScaleFactor());
}
else
{
return QSizeF( s.size.width() / c.mapToPixel().mapUnitsPerPixel(), s.size.height() / c.mapToPixel().mapUnitsPerPixel() );
return QSizeF( size.width() / c.mapToPixel().mapUnitsPerPixel(), size.height() / c.mapToPixel().mapUnitsPerPixel() );
}
}

@@ -50,8 +50,8 @@ class CORE_EXPORT QgsDiagram
void setPenWidth( QPen& pen, const QgsDiagramSettings& s, const QgsRenderContext& c );

/** Calculates a size to match the current settings and rendering context
* @param size Unused
* @param s The settings that specify the diagram size
* @param size The size to convert
* @param s The settings that specify the size type
* @param c The rendering specifying the proper scale units for pixel conversion
*
* @return The converted size for rendering

0 comments on commit aa31c8c

Please sign in to comment.
You can’t perform that action at this time.