2007-01-09 02:39:15 +00:00
|
|
|
|
2007-03-03 11:13:57 +00:00
|
|
|
class QgsMapCanvasItem : QGraphicsItem
|
2007-01-09 02:39:15 +00:00
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsmapcanvasitem.h>
|
|
|
|
%End
|
2013-01-12 23:48:58 +01:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
protected:
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! protected constructor: cannot be constructed directly
|
2012-09-24 02:28:15 +02:00
|
|
|
QgsMapCanvasItem( QgsMapCanvas* mapCanvas /TransferThis/ );
|
2007-01-09 02:39:15 +00:00
|
|
|
|
|
|
|
virtual ~QgsMapCanvasItem();
|
|
|
|
|
|
|
|
//! function to be implemented by derived classes
|
2012-09-24 02:28:15 +02:00
|
|
|
virtual void paint( QPainter * painter ) = 0;
|
|
|
|
|
|
|
|
virtual void paint( QPainter * painter,
|
|
|
|
const QStyleOptionGraphicsItem * option,
|
|
|
|
QWidget * widget = 0 );
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! schedules map canvas for repaint
|
|
|
|
void updateCanvas();
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2015-07-29 11:52:14 +02:00
|
|
|
/** Sets render context parameters
|
2010-04-20 11:51:20 +00:00
|
|
|
@param p painter for rendering
|
|
|
|
@param context out: configured context
|
2014-11-21 01:17:21 +01:00
|
|
|
@return true in case of success */
|
2010-04-20 11:51:20 +00:00
|
|
|
bool setRenderContextVariables( QPainter* p, QgsRenderContext& context ) const;
|
2007-01-09 02:39:15 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! called on changed extent or resize event to update position of the item
|
|
|
|
virtual void updatePosition();
|
|
|
|
|
|
|
|
virtual QRectF boundingRect() const;
|
|
|
|
|
2015-01-03 09:23:14 +01:00
|
|
|
//! returns canvas item rectangle in map units
|
2008-11-09 00:14:12 +00:00
|
|
|
QgsRectangle rect() const;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2015-01-03 09:23:14 +01:00
|
|
|
//! sets canvas item rectangle in map units
|
2015-01-03 01:01:54 +01:00
|
|
|
void setRect( const QgsRectangle& r, bool resetRotation = true );
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! transformation from screen coordinates to map coordinates
|
2016-02-02 19:46:18 +11:00
|
|
|
QgsPoint toMapCoordinates( QPoint point ) const;
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
//! transformation from map coordinates to screen coordinates
|
2015-01-03 09:23:14 +01:00
|
|
|
QPointF toCanvasCoordinates( const QgsPoint& point ) const;
|
2007-01-09 02:39:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|