Skip to content
Permalink
Browse files

Show only annotation items in composermap, no rubberbands etc. Fixes …

…ticket #3774
  • Loading branch information
Marco Hugentobler
Marco Hugentobler committed May 21, 2011
1 parent 694c356 commit b02d06ba73054ad5c85790d3508fd3555b5b28ea
@@ -1481,7 +1481,7 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph
{
currentItem = itemList.at( i );
//don't draw mapcanvasmap (has z value -10)
if ( !currentItem || currentItem->zValue() == -10 )
if ( !currentItem || currentItem->data( 0 ).toString() != "AnnotationItem" )
{
continue;
}
@@ -1495,7 +1495,7 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph
{
currentItem = itemList.at( i );
//don't draw mapcanvasmap (has z value -10)
if ( !currentItem || currentItem->zValue() == -10 )
if ( !currentItem || currentItem->data( 0 ) != "AnnotationItem" )
{
continue;
}
@@ -1564,9 +1564,9 @@ void QgsComposerMap::drawCanvasItem( QGraphicsItem* item, QPainter* painter, con
painter->scale( scaleFactor, scaleFactor );

//a little trick to let the item know that the paint request comes from the composer
item->setData( 0, "composer" );
item->setData( 1, "composer" );
item->paint( painter, itemStyle, 0 );
item->setData( 0, "" );
item->setData( 1, "" );
painter->restore();
}

@@ -30,6 +30,7 @@ QgsAnnotationItem::QgsAnnotationItem( QgsMapCanvas* mapCanvas ): QgsMapCanvasIte
mFrameBorderWidth = 1.0;
mFrameColor = QColor( 0, 0, 0 );
mFrameBackgroundColor = QColor( 255, 255, 255 );
setData( 0, "AnnotationItem" );
}

QgsAnnotationItem::~QgsAnnotationItem()
@@ -232,7 +233,7 @@ void QgsAnnotationItem::drawSelectionBoxes( QPainter* p )
}

//no selection boxes for composer mode
if ( data( 0 ).toString() == "composer" )
if ( data( 1 ).toString() == "composer" )
{
return;
}
@@ -126,7 +126,7 @@ bool QgsMapCanvasItem::setRenderContextVariables( QPainter* p, QgsRenderContext&
double rasterScaleFactor = 1.0;

//little trick to find out if painting origines from composer or main map canvas
if ( data( 0 ).toString() == "composer" )
if ( data( 1 ).toString() == "composer" )
{
rasterScaleFactor = painterDpi / 25.4;
scaleFactor = dpi / 25.4;
@@ -92,7 +92,7 @@ void QgsGCPCanvasItem::paint( QPainter* p )
p->drawText( textBounds, Qt::AlignLeft, msg );
}

if ( data( 0 ) != "composer" ) //draw residuals only on screen
if ( data( 1 ) != "composer" ) //draw residuals only on screen
{
drawResidualArrow( p, context );
}

0 comments on commit b02d06b

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