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.
bool isEmpty() const
test if rectangle is empty.
void setRenderHint(RenderHint hint, bool on)
QgsPoint toMapCoordinates(const QPoint &point) const
transformation from screen coordinates to map coordinates
QPointF toCanvasCoordinates(const QgsPoint &point) const
transformation from map coordinates to screen coordinates
double yMaximum() const
Get the y maximum value (top side of rectangle)
double rotation() const
Get the current map canvas rotation in clockwise degrees.
void setRendererScale(double scale)
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
Q_DECL_DEPRECATED void setPanningOffset(const QPoint &point)
sets current offset, to be called from QgsMapCanvas
QPoint mPanningOffset
offset from normal position due current panning operation, used when converting map coordinates to mo...
QGraphicsScene * scene() const
QgsRectangle rect() const
returns canvas item rectangle in map units
bool antiAliasingEnabled() const
true if antialising is enabled
Map canvas is a class for displaying all GIS data types on a canvas.
void update(const QRectF &rect)
double x() const
Get the x value of the point.
The QgsMapSettings class contains configuration for rendering of the map.
QSizeF mItemSize
cached size of the item (to return in boundingRect())
Perform transforms between map coordinates and device coordinates.
void transformInPlace(double &x, double &y) const
Transform device coordinates to map (world) coordinates.
int outputDpi() const
Return DPI used for conversion between real world units (e.g.
virtual QRectF boundingRect() const override
default implementation for canvas items
void setScaleFactor(double factor)
double scale()
Get the last reported scale of the canvas.
void setPos(const QPointF &pos)
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
QgsPoint toMapCoordinates(int x, int y) const
Contains information about the context of a rendering operation.
QgsMapCanvas * mMapCanvas
pointer to map canvas
const QgsMapToPixel * getCoordinateTransform()
Get the current coordinate transform.
double y() const
Get the y value of the point.
void setRotation(qreal angle)
void setSize(const QSizeF &size)
void setRasterScaleFactor(double factor)
virtual ~QgsMapCanvasItem()
void addItem(QGraphicsItem *item)
double width() const
Width of the rectangle.
virtual void updatePosition()
called on changed extent or resize event to update position of the item
double xMinimum() const
Get the x minimum value (left side of rectangle)
double height() const
Height of the rectangle.
bool setRenderContextVariables(QPainter *p, QgsRenderContext &context) const
Sets render context parameters.