27 #include <QPaintEvent> 28 #include <QResizeEvent> 29 #include <QMouseEvent> 36 , mMapCanvas( mapCanvas )
132 if ( e->
button() == Qt::LeftButton )
148 if (( e->
buttons() & Qt::LeftButton ) == Qt::LeftButton )
290 void QgsPanningWidget::setPolygon(
const QPolygon& p )
292 if ( p == mPoly )
return;
296 if ( mPoly.at( 0 ) != mPoly.at( mPoly.size() - 1 ) )
297 mPoly.
append( mPoly.at( 0 ) );
303 void QgsPanningWidget::paintEvent(
QPaintEvent* pe )
310 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.
void setExtent(const QgsRectangle &rect, bool magnified=true)
Set coordinates of the rectangle which should be rendered.
QPointF toQPointF() const
Converts a point to a QPointF.
void append(const T &value)
void setColor(ColorGroup group, ColorRole role, const QColor &color)
void destinationSrsChanged()
QRect boundingRect() const
QgsMapLayer * mapLayer(const QString &theLayerId) const
Retrieve a pointer to a registered layer by layer ID.
QgsMapCanvas * mMapCanvas
main map canvas - used to get/set extent
QgsMapRendererQImageJob * mJob
for rendering overview
QColor backgroundColor() const
Get the background color of the map.
void scale(double scaleFactor, const QgsPoint *c=nullptr)
Scale the rectangle around its center point.
QPolygonF translated(qreal dx, qreal dy) const
void updatePanningWidget(QPoint pos)
called when panning to reflect mouse movement
QgsPoint toMapCoordinates(int x, int y) const
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
void refresh()
Repaints the canvas map.
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.
QgsRectangle visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
Map canvas is a class for displaying all GIS data types on a canvas.
Enable drawing of labels on top of the map.
void setFlag(Flag flag, bool on=true)
Enable or disable a particular flag (other flags are not affected)
QgsPoint transform(const QgsPoint &p) const
Transform the point from map (world) coordinates to device coordinates.
const QRect & rect() const
Perform transforms between map coordinates and device coordinates.
void setOutputSize(QSize size)
Set the size of the resulting map image.
void showEvent(QShowEvent *e) override
Overridden show event.
void addPolygon(const QPolygonF &polygon)
QgsPanningWidget * mPanningWidget
widget for panning map in overview
bool isEmpty() const
test if rectangle is empty.
void setPen(const QColor &color)
QgsMapSettings mSettings
map settings used for rendering of the overview map
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
void setObjectName(const QString &name)
QgsRectangle extent() const
Returns the current zoom exent of the map canvas.
void mouseMoveEvent(QMouseEvent *e) override
Overridden mouse move event.
bool hasValidSettings() const
Check whether the map settings are valid and can be used for rendering.
QgsMapOverviewCanvas(QWidget *parent=nullptr, QgsMapCanvas *mapCanvas=nullptr)
void refresh()
renders overview and updates panning widget
A class to represent a point.
const QgsMapToPixel & mapToPixel() const
void mapRenderingFinished()
const QSize & size() const
virtual void start()=0
Start the rendering job and immediately return.
void hasCrsTransformEnabled(bool flag)
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
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.
QStringList layerSet() const
QPixmap mPixmap
pixmap where the map is stored
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
void drawPath(const QPainterPath &path)
void setLayerSet(const QStringList &layerSet)
updates layer set for overview
QgsRectangle fullExtent() const
returns current extent of layer set
QgsRectangle fullExtent() const
Returns the combined exent for all layers on the map canvas.
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.
void resizeEvent(QResizeEvent *e) override
Overridden resize event.
QPolygonF visiblePolygon() const
Return the visible area as a polygon (may be rotated)
const QPoint & pos() const
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 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.
const QgsCoordinateReferenceSystem & destinationCrs() const
returns CRS of destination coordinate reference system
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