Skip to content

Commit 09b603d

Browse files
committedDec 21, 2012
QgsRubberBand constructor fix (it is not possible to call constructor from constructor in C++ (<C++11)
1 parent d1795c0 commit 09b603d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
 

‎src/gui/qgsrubberband.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ QgsRubberBand::QgsRubberBand( QgsMapCanvas* mapCanvas, QGis::GeometryType geomet
4040

4141
QgsRubberBand::QgsRubberBand( QgsMapCanvas* mapCanvas, bool isPolygon )
4242
: QgsMapCanvasItem( mapCanvas )
43+
, mWidth( 1 )
44+
, mTranslationOffsetX( 0.0 )
45+
, mTranslationOffsetY( 0.0 )
4346
{
44-
QgsRubberBand( mapCanvas, isPolygon ? QGis::Polygon : QGis::Line );
47+
reset( isPolygon ? QGis::Polygon : QGis::Line );
48+
setColor( QColor( Qt::lightGray ) );
4549
}
4650

4751
QgsRubberBand::QgsRubberBand(): QgsMapCanvasItem( 0 )
@@ -407,9 +411,9 @@ void QgsRubberBand::paint( QPainter* p )
407411
mPen.setWidth( 1 );
408412
p->setPen( mPen );
409413
QVector<QPointF>::const_iterator ptIt = pts.constBegin();
410-
for( ; ptIt != pts.constEnd(); ++ptIt )
414+
for ( ; ptIt != pts.constEnd(); ++ptIt )
411415
{
412-
p->drawEllipse( (*ptIt).x() - mWidth/2, (*ptIt).y() - mWidth/2, mWidth, mWidth );
416+
p->drawEllipse(( *ptIt ).x() - mWidth / 2, ( *ptIt ).y() - mWidth / 2, mWidth, mWidth );
413417
}
414418
}
415419
break;
@@ -496,7 +500,7 @@ QgsGeometry *QgsRubberBand::asGeometry()
496500
{
497501
QgsGeometry *geom = NULL;
498502

499-
switch( mGeometryType )
503+
switch ( mGeometryType )
500504
{
501505
case QGis::Polygon:
502506
{

0 commit comments

Comments
 (0)
Please sign in to comment.