Skip to content
Permalink
Browse files
Differentiate between field scale and raster scale factor such that f…
…ield scaled point symbols all have the same outline width

git-svn-id: http://svn.osgeo.org/qgis/trunk@8449 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 17, 2008
1 parent d528050 commit 328469a87ca3d263769f9eb72f1c4246f368c642
@@ -140,8 +140,8 @@ void QgsContinuousColorRenderer::renderFeature(QPainter * p, QgsFeature & f, QIm
}
brush.setStyle ( Qt::SolidPattern );

*img = QgsMarkerCatalogue::instance()->imageMarker ( mMinimumSymbol->pointSymbolName(), mMinimumSymbol->pointSize() *widthScale * rasterScaleFactor,
pen, brush);
*img = QgsMarkerCatalogue::instance()->imageMarker ( mMinimumSymbol->pointSymbolName(), \
mMinimumSymbol->pointSize() * widthScale * rasterScaleFactor, pen, brush);
}
else if ( mVectorType == QGis::Line )
{
@@ -130,8 +130,7 @@ void QgsGraduatedSymbolRenderer::renderFeature(QPainter * p, QgsFeature & f, QIm
rotation = attrs[theSymbol->rotationClassificationField()].toDouble();
QgsDebugMsg(QString("Feature has rotation factor %1").arg(rotation));
}
*img = theSymbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor,
rasterScaleFactor * fieldScale, rotation);
*img = theSymbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor, fieldScale, rotation, rasterScaleFactor);
}

// Line, polygon
@@ -112,8 +112,7 @@ void QgsSingleSymbolRenderer::renderFeature(QPainter * p, QgsFeature & f, QImage
QgsDebugMsg(QString("Feature has rotation factor %1").arg(rotation));
}

*img = mSymbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor,
rasterScaleFactor * fieldScale, rotation);
*img = mSymbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor, fieldScale, rotation, rasterScaleFactor);
}


@@ -140,7 +140,7 @@ void QgsUniqueValueRenderer::renderFeature(QPainter* p, QgsFeature& f,QImage* im
QgsDebugMsg(QString("Feature has rotation factor %1").arg(rotation));
}
*img = symbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor,
rasterScaleFactor * fieldScale, rotation);
fieldScale, rotation, rasterScaleFactor);
}
// Line, polygon
else if ( mVectorType != QGis::Point )
@@ -324,31 +324,31 @@ QImage QgsSymbol::getCachedPointSymbolAsImage( double widthScale,
}
}

QImage QgsSymbol::getPointSymbolAsImage( double widthScale,
bool selected, QColor selectionColor, double scale, double rotation )
QImage QgsSymbol::getPointSymbolAsImage( double widthScale, bool selected, QColor selectionColor, double scale, \
double rotation, double rasterScaleFactor)
{
//QgsDebugMsg(QString("Symbol scale = %1, and rotation = %2").arg(scale).arg(rotation));
if ( 1.0 == scale && 0 == rotation )
if ( 1.0 == (scale * rasterScaleFactor) && 0 == rotation )
{
// If scale is 1.0 and rotation 0.0, use cached image.
return getCachedPointSymbolAsImage( widthScale, selected, selectionColor );
}

QImage preRotateImage;
QPen pen = mPen;
double newWidth = mPen.widthF() * widthScale * scale;
double newWidth = mPen.widthF() * widthScale * rasterScaleFactor;
pen.setWidth(newWidth);

if ( selected )
{
pen.setColor ( selectionColor );
QBrush brush = mBrush;
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (int)(mPointSize * scale * widthScale),
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (int)(mPointSize * scale * widthScale * rasterScaleFactor),
pen, mBrush );
}
else
{
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (int)(mPointSize * scale * widthScale),
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (int)(mPointSize * scale * widthScale * rasterScaleFactor),
pen, mBrush );
}

@@ -105,9 +105,10 @@ class CORE_EXPORT QgsSymbol{
*/
virtual QImage getPointSymbolAsImage( double widthScale = 1.,
bool selected = false,
QColor selectionColor = Qt::yellow,
QColor selectionColor = Qt::yellow,
double scale = 1.0,
double rotation = 0.0);
double rotation = 0.0,
double rasterScaleFactor = 1.0);

/**Writes the contents of the symbol to a configuration file
@ return true in case of success*/

0 comments on commit 328469a

Please sign in to comment.