Skip to content
Permalink
Browse files
Box style scale bar is filled in for half its length, more like a 'real'
scale bar


git-svn-id: http://svn.osgeo.org/qgis/trunk@4966 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Mar 4, 2006
1 parent f01440e commit b5f18ed5867592fcc9663fae6ef19cc534a2107b
Showing with 18 additions and 3 deletions.
  1. +18 −3 src/plugins/scale_bar/plugin.cpp
@@ -390,6 +390,9 @@ void QgsScaleBarPlugin::renderScaleBar(QPainter * theQPainter)
}
else if (mStyle==tr("Box"))
{
// Want square corners for a box
myBackgroundPen.setJoinStyle( Qt::MiterJoin );
myForegroundPen.setJoinStyle( Qt::MiterJoin );
QPolygon myBoxArray(5);
//draw a buffer first so bar shows up on dark images
theQPainter->setPen( myBackgroundPen );
@@ -403,14 +406,26 @@ void QgsScaleBarPlugin::renderScaleBar(QPainter * theQPainter)
theQPainter->drawPolyline(myBoxArray);
//now draw the bar itself in user selected color
theQPainter->setPen( myForegroundPen );
theQPainter->setBrush( QBrush( mColour, Qt::SolidPattern) );
int midPointX = myScaleBarWidthInt/2 + myOriginX;
myBoxArray.putPoints(0,5,
myOriginX , myOriginY,
(myScaleBarWidthInt + myOriginX), myOriginY,
(myScaleBarWidthInt + myOriginX), (myOriginY+myMajorTickSize),
midPointX, myOriginY,
midPointX, (myOriginY+myMajorTickSize),
myOriginX , (myOriginY+myMajorTickSize),
myOriginX , myOriginY
);
theQPainter->drawPolyline(myBoxArray);
theQPainter->drawPolygon(myBoxArray);

theQPainter->setBrush( Qt::NoBrush );
myBoxArray.putPoints(0,5,
midPointX , myOriginY,
(myScaleBarWidthInt + myOriginX), myOriginY,
(myScaleBarWidthInt + myOriginX), (myOriginY+myMajorTickSize),
midPointX , (myOriginY+myMajorTickSize),
midPointX , myOriginY
);
theQPainter->drawPolygon(myBoxArray);
}

//Do actual drawing of scale bar

0 comments on commit b5f18ed

Please sign in to comment.