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;
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! paint function called by map canvas
|
2012-09-24 02:28:15 +02:00
|
|
|
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
|
|
|
|
2010-04-20 11:51:20 +00:00
|
|
|
/**Sets render context parameters
|
|
|
|
@param p painter for rendering
|
|
|
|
@param context out: configured context
|
|
|
|
@return true in case of success
|
|
|
|
@note added in version 1.5*/
|
|
|
|
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();
|
|
|
|
|
|
|
|
//! default implementation for canvas items
|
|
|
|
virtual QRectF boundingRect() const;
|
|
|
|
|
|
|
|
//! sets current offset, to be called from QgsMapCanvas
|
2012-09-24 02:28:15 +02:00
|
|
|
void setPanningOffset( const QPoint& point );
|
2007-01-09 02:39:15 +00:00
|
|
|
|
|
|
|
//! returns canvas item rectangle
|
2008-11-09 00:14:12 +00:00
|
|
|
QgsRectangle rect() const;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! sets canvas item rectangle
|
2012-09-24 02:28:15 +02:00
|
|
|
void setRect( const QgsRectangle& r );
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
//! transformation from screen coordinates to map coordinates
|
2012-09-24 02:28:15 +02:00
|
|
|
QgsPoint toMapCoordinates( const QPoint& point );
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
//! transformation from map coordinates to screen coordinates
|
|
|
|
QPointF toCanvasCoordinates( const QgsPoint& point );
|
2007-01-09 02:39:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|