22 #include <QGraphicsScene> 31 , mMapCanvas( mapCanvas )
32 , mRectRotation( 0.0 )
33 , mPanningOffset( 0, 0 )
36 Q_ASSERT( mapCanvas && mapCanvas->
scene() );
66 qreal
x = point.
x(),
y = point.
y();
void setForceVectorOutput(bool force)
A rectangle specified with double values.
QgsRectangle rect() const
returns canvas item rectangle in map units
void setRenderHint(RenderHint hint, bool on)
QgsPoint toMapCoordinates(QPoint point) const
transformation from screen coordinates to map coordinates
double rotation() const
Get the current map canvas rotation in clockwise degrees.
void setRendererScale(double scale)
QgsPoint toMapCoordinates(int x, int y) const
QPoint mPanningOffset
offset from normal position due current panning operation, used when converting map coordinates to mo...
QGraphicsScene * scene() const
Map canvas is a class for displaying all GIS data types on a canvas.
void update(const QRectF &rect)
double y() const
Get the y value of the point.
The QgsMapSettings class contains configuration for rendering of the map.
Q_DECL_DEPRECATED void setPanningOffset(QPoint point)
sets current offset, to be called from QgsMapCanvas
QPointF toCanvasCoordinates(const QgsPoint &point) const
transformation from map coordinates to screen coordinates
void transformInPlace(double &x, double &y) const
Transform device coordinates to map coordinates.
QSizeF mItemSize
cached size of the item (to return in boundingRect())
Perform transforms between map coordinates and device coordinates.
virtual QRectF boundingRect() const override
default implementation for canvas items
void setScaleFactor(double factor)
double scale()
Get the last reported scale of the canvas.
bool isEmpty() const
test if rectangle is empty.
void setPos(const QPointF &pos)
double width() const
Width of the rectangle.
void setRect(const QgsRectangle &r, bool resetRotation=true)
sets canvas item rectangle in map units
QgsRectangle mRect
cached canvas item rectangle in map coordinates encodes position (xmin,ymax) and size (width/height) ...
void setPainter(QPainter *p)
double mapUnitsPerPixel() const
Return current map units per pixel.
A class to represent a point.
void prepareGeometryChange()
QgsMapCanvasItem(QgsMapCanvas *mapCanvas)
protected constructor: cannot be constructed directly
void setTopLeft(const QPointF &position)
void updateCanvas()
schedules map canvas for repaint
virtual void paint(QPainter *painter)=0
function to be implemented by derived classes
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
double outputDpi() const
Return DPI used for conversion between real world units (e.g.
Contains information about the context of a rendering operation.
bool antiAliasingEnabled() const
true if antialising is enabled
QgsMapCanvas * mMapCanvas
pointer to map canvas
double xMinimum() const
Get the x minimum value (left side of rectangle)
const QgsMapToPixel * getCoordinateTransform()
Get the current coordinate transform.
void setRotation(qreal angle)
double yMaximum() const
Get the y maximum value (top side of rectangle)
void setSize(const QSizeF &size)
void setRasterScaleFactor(double factor)
virtual ~QgsMapCanvasItem()
void addItem(QGraphicsItem *item)
virtual void updatePosition()
called on changed extent or resize event to update position of the item
double x() const
Get the x value of the point.
double height() const
Height of the rectangle.
bool setRenderContextVariables(QPainter *p, QgsRenderContext &context) const
Sets render context parameters.