40 if (
mMapCanvas->property(
"retro" ).toBool() )
41 mImage = mImage.scaled( mImage.width() / 3, mImage.height() / 3 )
42 .convertToFormat( QImage::Format_Indexed8, Qt::OrderedDither | Qt::OrderedAlphaDither );
50 if ( mImage.size() != QSize( w, h ) )
52 QgsDebugMsg( QString(
"map paint DIFFERENT SIZE: img %1,%2 item %3,%4" ).arg( mImage.width() ).arg( mImage.height() ).arg( w ).arg( h ) );
57 painter->drawImage( QRect( 0, 0, w, h ), mImage );
62 QPointF c = br.center();
63 double rad =
std::max( br.width(), br.height() ) / 10;
64 painter->drawRoundedRect( br, rad, rad );
65 painter->drawLine( QLineF( 0, 0, br.width(), br.height() ) );
66 painter->drawLine( QLineF( br.width(), 0, 0, br.height() ) );
68 double nw = br.width() * 0.5;
double nh = br.height() * 0.5;
69 br = QRectF( c - QPointF( nw / 2, nh / 2 ), QSize( nw, nh ) );
70 painter->drawRoundedRect( br, rad, rad );
72 nw = br.width() * 0.5; nh = br.height() * 0.5;
73 br = QRectF( c - QPointF( nw / 2, nh / 2 ), QSize( nw, nh ) );
74 painter->drawRoundedRect( br, rad, rad );
A rectangle specified with double values.
An abstract class for items that can be placed on the map canvas.
QgsRectangle rect() const
returns canvas item rectangle in map units
Map canvas is a class for displaying all GIS data types on a canvas.
virtual QRectF boundingRect() const override
default implementation for canvas items
Q_DECL_DEPRECATED QPaintDevice & paintDevice()
void setRect(const QgsRectangle &r, bool resetRotation=true)
sets canvas item rectangle in map units
virtual void paint(QPainter *painter) override
function to be implemented by derived classes
void setContent(const QImage &image, const QgsRectangle &rect)
QgsMapCanvas * mMapCanvas
pointer to map canvas
QgsMapCanvasMap(QgsMapCanvas *canvas)
constructor