Skip to content

Commit 153e9b4

Browse files
author
mhugent
committedMay 17, 2008
Differentiate between field scale and raster scale factor such that field scaled point symbols all have the same outline width
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8449 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed
 

‎src/core/renderer/qgscontinuouscolorrenderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ void QgsContinuousColorRenderer::renderFeature(QPainter * p, QgsFeature & f, QIm
140140
}
141141
brush.setStyle ( Qt::SolidPattern );
142142

143-
*img = QgsMarkerCatalogue::instance()->imageMarker ( mMinimumSymbol->pointSymbolName(), mMinimumSymbol->pointSize() *widthScale * rasterScaleFactor,
144-
pen, brush);
143+
*img = QgsMarkerCatalogue::instance()->imageMarker ( mMinimumSymbol->pointSymbolName(), \
144+
mMinimumSymbol->pointSize() * widthScale * rasterScaleFactor, pen, brush);
145145
}
146146
else if ( mVectorType == QGis::Line )
147147
{

‎src/core/renderer/qgsgraduatedsymbolrenderer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ void QgsGraduatedSymbolRenderer::renderFeature(QPainter * p, QgsFeature & f, QIm
130130
rotation = attrs[theSymbol->rotationClassificationField()].toDouble();
131131
QgsDebugMsg(QString("Feature has rotation factor %1").arg(rotation));
132132
}
133-
*img = theSymbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor,
134-
rasterScaleFactor * fieldScale, rotation);
133+
*img = theSymbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor, fieldScale, rotation, rasterScaleFactor);
135134
}
136135

137136
// Line, polygon

‎src/core/renderer/qgssinglesymbolrenderer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ void QgsSingleSymbolRenderer::renderFeature(QPainter * p, QgsFeature & f, QImage
112112
QgsDebugMsg(QString("Feature has rotation factor %1").arg(rotation));
113113
}
114114

115-
*img = mSymbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor,
116-
rasterScaleFactor * fieldScale, rotation);
115+
*img = mSymbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor, fieldScale, rotation, rasterScaleFactor);
117116
}
118117

119118

‎src/core/renderer/qgsuniquevaluerenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void QgsUniqueValueRenderer::renderFeature(QPainter* p, QgsFeature& f,QImage* im
140140
QgsDebugMsg(QString("Feature has rotation factor %1").arg(rotation));
141141
}
142142
*img = symbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor,
143-
rasterScaleFactor * fieldScale, rotation);
143+
fieldScale, rotation, rasterScaleFactor);
144144
}
145145
// Line, polygon
146146
else if ( mVectorType != QGis::Point )

‎src/core/symbology/qgssymbol.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,31 +324,31 @@ QImage QgsSymbol::getCachedPointSymbolAsImage( double widthScale,
324324
}
325325
}
326326

327-
QImage QgsSymbol::getPointSymbolAsImage( double widthScale,
328-
bool selected, QColor selectionColor, double scale, double rotation )
327+
QImage QgsSymbol::getPointSymbolAsImage( double widthScale, bool selected, QColor selectionColor, double scale, \
328+
double rotation, double rasterScaleFactor)
329329
{
330330
//QgsDebugMsg(QString("Symbol scale = %1, and rotation = %2").arg(scale).arg(rotation));
331-
if ( 1.0 == scale && 0 == rotation )
331+
if ( 1.0 == (scale * rasterScaleFactor) && 0 == rotation )
332332
{
333333
// If scale is 1.0 and rotation 0.0, use cached image.
334334
return getCachedPointSymbolAsImage( widthScale, selected, selectionColor );
335335
}
336336

337337
QImage preRotateImage;
338338
QPen pen = mPen;
339-
double newWidth = mPen.widthF() * widthScale * scale;
339+
double newWidth = mPen.widthF() * widthScale * rasterScaleFactor;
340340
pen.setWidth(newWidth);
341341

342342
if ( selected )
343343
{
344344
pen.setColor ( selectionColor );
345345
QBrush brush = mBrush;
346-
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (int)(mPointSize * scale * widthScale),
346+
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (int)(mPointSize * scale * widthScale * rasterScaleFactor),
347347
pen, mBrush );
348348
}
349349
else
350350
{
351-
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (int)(mPointSize * scale * widthScale),
351+
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, (int)(mPointSize * scale * widthScale * rasterScaleFactor),
352352
pen, mBrush );
353353
}
354354

‎src/core/symbology/qgssymbol.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ class CORE_EXPORT QgsSymbol{
105105
*/
106106
virtual QImage getPointSymbolAsImage( double widthScale = 1.,
107107
bool selected = false,
108-
QColor selectionColor = Qt::yellow,
108+
QColor selectionColor = Qt::yellow,
109109
double scale = 1.0,
110-
double rotation = 0.0);
110+
double rotation = 0.0,
111+
double rasterScaleFactor = 1.0);
111112

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

0 commit comments

Comments
 (0)
Please sign in to comment.