27 #include <QPaintEvent> 28 #include <QResizeEvent> 29 #include <QMouseEvent> 36 , mMapCanvas( mapCanvas )
126 if ( e->
button() == Qt::LeftButton )
142 if (( e->
buttons() & Qt::LeftButton ) == Qt::LeftButton )
281 void QgsPanningWidget::setPolygon(
const QPolygon& p )
283 if ( p == mPoly )
return;
289 void QgsPanningWidget::paintEvent(
QPaintEvent* pe )
296 QPolygonF t = mPoly.
translated( -mPoly.boundingRect().left(), -mPoly.boundingRect().top() );
QPoint mPanningCursorOffset
position of cursor inside panning widget
void layerRepaintRequested()
void setDestinationCrs(const QgsCoordinateReferenceSystem &crs)
sets destination coordinate reference system
A rectangle specified with double values.
Base class for all map layer types.
bool isEmpty() const
test if rectangle is empty.
void setColor(ColorGroup group, ColorRole role, const QColor &color)
QgsRectangle fullExtent() const
returns current extent of layer set
void destinationSrsChanged()
QRect boundingRect() const
QgsMapCanvas * mMapCanvas
main map canvas - used to get/set extent
QgsMapRendererQImageJob * mJob
for rendering overview
QgsPoint transform(const QgsPoint &p) const
Transform the point from map (world) coordinates to device coordinates.
void scale(double scaleFactor, const QgsPoint *c=nullptr)
Scale the rectangle around its center point.
QPolygonF translated(qreal dx, qreal dy) const
QgsRectangle visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
void updatePanningWidget(QPoint pos)
called when panning to reflect mouse movement
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
void refresh()
Repaints the canvas map.
const QgsMapToPixel & mapToPixel() const
QString join(const QString &separator) const
void setBackgroundColor(const QColor &color)
changes background color
void setLayers(const QStringList &layers)
Set list of layer IDs for map rendering.
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
virtual QImage renderedImage()=0
Get a preview/resulting image.
Map canvas is a class for displaying all GIS data types on a canvas.
Enable drawing of labels on top of the map.
QgsMapLayer * mapLayer(const QString &theLayerId)
Retrieve a pointer to a loaded layer by id.
void setFlag(Flag flag, bool on=true)
Enable or disable a particular flag (other flags are not affected)
const QRect & rect() const
Perform transforms between map coordinates and device coordinates.
void setOutputSize(QSize size)
Set the size of the resulting map image.
QgsPanningWidget * mPanningWidget
widget for panning map in overview
bool hasValidSettings() const
Check whether the map settings are valid and can be used for rendering.
void setPen(const QColor &color)
QgsMapSettings mSettings
map settings used for rendering of the overview map
const QgsCoordinateReferenceSystem & destinationCrs() const
returns CRS of destination coordinate reference system
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
void setObjectName(const QString &name)
void mouseMoveEvent(QMouseEvent *e) override
Overridden mouse move event.
QgsMapOverviewCanvas(QWidget *parent=nullptr, QgsMapCanvas *mapCanvas=nullptr)
void refresh()
renders overview and updates panning widget
A class to represent a point.
void mapRenderingFinished()
const QSize & size() const
QColor backgroundColor() const
Get the background color of the map.
virtual void start()=0
Start the rendering job and immediately return.
void hasCrsTransformEnabled(bool flag)
QgsPoint toMapCoordinates(int x, int y) const
Job implementation that renders everything sequentially in one thread.
void setBackgroundColor(const QColor &color)
Set the background color of the map.
void paintEvent(QPaintEvent *pe) override
Overridden paint event.
QPixmap mPixmap
pixmap where the map is stored
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
void setLayerSet(const QStringList &layerSet)
updates layer set for overview
void drawConvexPolygon(const QPointF *points, int pointCount)
void setExtent(const QgsRectangle &rect)
Set coordinates of the rectangle which should be rendered.
void push_back(const T &value)
void setCenter(const QgsPoint ¢er)
Set the center of the map canvas, in geographical coordinates.
virtual void cancel()=0
Stop the rendering job - does not return until the job has terminated.
QStringList layers() const
Get list of layer IDs for map rendering The layers are stored in the reverse order of how they are re...
void resizeEvent(QResizeEvent *e) override
Overridden resize event.
QgsRectangle extent() const
Returns the current zoom exent of the map canvas.
QPolygonF visiblePolygon() const
Return the visible area as a polygon (may be rotated)
const QPoint & pos() const
void mousePressEvent(QMouseEvent *e) override
Overridden mouse press event.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool begin(QPaintDevice *device)
void mouseReleaseEvent(QMouseEvent *e) override
Overridden mouse release event.
void drawExtentRect()
used for overview canvas to reflect changed extent in main map canvas
void setCrsTransformEnabled(bool enabled)
sets whether to use projections for this layer set
QStringList layerSet() const
QgsRectangle fullExtent() const
Returns the combined exent for all layers on the map canvas.
QPointF toQPointF() const
Converts a point to a QPointF.