20 #include <QApplication>
24 #include <QGraphicsItem>
25 #include <QGraphicsScene>
26 #include <QGraphicsView>
28 #include <QMouseEvent>
30 #include <QPaintEvent>
34 #include <QTextStream>
35 #include <QResizeEvent>
37 #include <QStringList>
38 #include <QWheelEvent>
93 , mRenderer( renderer )
94 , mSyncingExtent( false )
173 : QGraphicsView( parent )
176 , mJobCancelled( false )
177 , mLabelingResults( 0 )
178 , mUseParallelRendering( false )
179 , mDrawRenderingStats( false )
181 , mPreviewEffect( 0 )
183 setObjectName( name );
184 mScene =
new QGraphicsScene();
186 setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
187 setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
202 setMouseTracking(
true );
203 setFocusPolicy( Qt::StrongFocus );
217 this, SLOT(
readProject(
const QDomDocument & ) ) );
228 QSize s = viewport()->size();
231 setSceneRect( 0, 0, s.width(), s.height() );
232 mScene->setSceneRect( QRectF( 0, 0, s.width(), s.height() ) );
242 grabGesture( Qt::PinchGesture );
243 viewport()->setAttribute( Qt::WA_AcceptTouchEvents );
266 QList<QGraphicsItem*> list =
mScene->items();
267 QList<QGraphicsItem*>::iterator it = list.begin();
268 while ( it != list.end() )
270 QGraphicsItem* item = *it;
284 Q_ASSERT(
mJob == 0 );
320 if ( index >= 0 && index < (
int ) layers.size() )
366 QStringList layerSet, layerSetOverview;
369 for ( i = 0; i < layers.size(); i++ )
379 layerSet.push_back( lyr.
layer()->
id() );
384 layerSetOverview.push_back( lyr.
layer()->
id() );
390 bool layerSetChanged = layerSetOld != layerSet;
393 if ( layerSetChanged )
395 QgsDebugMsg(
"Layers changed to: " + layerSet.join(
", " ) );
404 disconnect( currentLayer, SIGNAL( repaintRequested() ),
this, SLOT(
refresh() ) );
419 connect( currentLayer, SIGNAL( repaintRequested() ),
this, SLOT(
refresh() ) );
438 if ( layerSetOvOld != layerSetOverview )
470 overview, SLOT( destinationSrsChanged() ) );
512 QgsDebugMsg(
"refreshing after destination CRS changed" );
596 QgsDebugMsg(
"CANVAS refresh - invalid settings -> nothing to do" );
617 QTimer::singleShot( 1,
this, SLOT(
refreshMap() ) );
635 Q_ASSERT(
mJob == 0 );
644 QStringList layersForGeometryCache;
649 if ( vl->isEditable() )
650 layersForGeometryCache <<
id;
689 if ( settings.value(
"/Map/logCanvasRefreshEvent",
false ).toBool() )
697 int w = img.width(), h = img.height();
698 QFont fnt = p.font();
701 int lh = p.fontMetrics().height() * 2;
702 QRect r( 0, h - lh, w, lh );
703 p.setPen( Qt::NoPen );
704 p.setBrush( QColor( 0, 0, 0, 110 ) );
706 p.setPen( Qt::white );
708 p.drawText( r, msg, QTextOption( Qt::AlignCenter ) );
737 Q_ASSERT(
mJob == 0 );
751 if ( theQPixmap != NULL )
755 painter.begin( theQPixmap );
762 theQPixmap->save( theFileName, theFormat.toLocal8Bit().data() );
775 myHeader +=
"0 \r\n";
777 myHeader +=
"0 \r\n";
785 QFileInfo myInfo = QFileInfo( theFileName );
787 QString myWorldFileName = myInfo.absolutePath() +
"/" + myInfo.completeBaseName() +
"." + theFormat +
"w";
788 QFile myWorldFile( myWorldFileName );
789 if ( !myWorldFile.open( QIODevice::WriteOnly ) )
793 QTextStream myStream( &myWorldFile );
794 myStream << myHeader;
819 QgsDebugMsg(
"Empty extent - keeping old extent with new center!" );
879 extent.
scale( 1.05 );
966 rect.
scale( 1.0, &c );
1013 QPen pen( Qt::gray );
1021 double dx = qAbs(( currentExtent.
xMaximum() - currentExtent.
xMinimum() ) / 4 );
1022 double dy = qAbs(( currentExtent.
yMaximum() - currentExtent.
yMinimum() ) / 4 );
1068 if ( ! e->isAutoRepeat() )
1075 case Qt::Key_PageUp:
1080 case Qt::Key_PageDown:
1103 QgsDebugMsg(
"Ignoring key: " + QString::number( e->key() ) );
1135 QgsDebugMsg(
"Ignoring key release: " + QString::number( e->key() ) );
1154 if ( e->button() == Qt::MidButton )
1181 if ( e->button() == Qt::MidButton )
1194 QgsDebugMsg(
"Right click in map tool zoom or pan, last tool is " +
1223 QGraphicsView::resizeEvent( e );
1226 QSize lastSize = viewport()->size();
1231 mScene->setSceneRect( QRectF( 0, 0, lastSize.width(), lastSize.height() ) );
1249 QGraphicsView::paintEvent( e );
1254 QList<QGraphicsItem*> list =
mScene->items();
1255 QList<QGraphicsItem*>::iterator it = list.begin();
1256 while ( it != list.end() )
1275 QgsDebugMsg(
"Wheel event delta " + QString::number( e->delta() ) );
1282 if ( QgsApplication::keyboardModifiers() )
1292 if ( e->delta() > 0 )
1310 QgsPoint newCenter( mousePos.
x() + (( oldCenter.
x() - mousePos.
x() ) * scaleFactor ),
1311 mousePos.
y() + (( oldCenter.
y() - mousePos.
y() ) * scaleFactor ) );
1315 extent.
scale( scaleFactor, &newCenter );
1355 r.
scale( scaleFactor, ¢er );
1376 QPoint xy = e->pos();
1429 setCursor( Qt::ArrowCursor );
1445 QBrush bgBrush( theColor );
1446 setBackgroundBrush( bgBrush );
1449 palette.setColor( backgroundRole(), theColor );
1450 setPalette( palette );
1454 mScene->setBackgroundBrush( bgBrush );
1459 return mScene->backgroundBrush().color();
1475 QList<QgsMapLayer*> lst;
1480 lst.append( layer );
1525 QgsDebugMsg(
"Setting map units to " + QString::number( static_cast<int>( u ) ) );
1557 QgsDebugMsg(
"QgsMapCanvas connected to " + QString( signal ) );
1599 double dx = qAbs( end.
x() - start.
x() );
1600 double dy = qAbs( end.
y() - start.
y() );
1605 if ( end.
x() < start.
x() )
1608 r.setXMaximum( r.xMaximum() + dx );
1612 r.setXMinimum( r.xMinimum() - dx );
1613 r.setXMaximum( r.xMaximum() - dx );
1616 if ( end.
y() < start.
y() )
1618 r.setYMaximum( r.yMaximum() + dy );
1619 r.setYMinimum( r.yMinimum() + dy );
1624 r.setYMaximum( r.yMaximum() - dy );
1625 r.setYMinimum( r.yMinimum() - dy );
1650 setSceneRect( -pnt.x(), -pnt.y(), viewport()->size().width(), viewport()->size().height() );
1655 Q_UNUSED( mapLayer );
1705 QDomNodeList nodes = doc.elementsByTagName(
"mapcanvas" );
1706 if ( nodes.count() )
1708 QDomNode node = nodes.item( 0 );
1722 QgsDebugMsg(
"Couldn't read mapcanvas information from project" );
1730 QDomNodeList nl = doc.elementsByTagName(
"qgis" );
1733 QgsDebugMsg(
"Unable to find qgis element in project file" );
1736 QDomNode qgisNode = nl.item( 0 );
1738 QDomElement mapcanvasNode = doc.createElement(
"mapcanvas" );
1739 qgisNode.appendChild( mapcanvasNode );
1755 QString settingsString =
"/Projections/" + srcAuthId +
"//" + destAuthId;
1756 QVariant defaultSrcTransform = s.value( settingsString +
"_srcTransform" );
1757 QVariant defaultDestTransform = s.value( settingsString +
"_destTransform" );
1758 if ( defaultSrcTransform.isValid() && defaultDestTransform.isValid() )
1768 if ( !s.value(
"/Projections/showDatumTransformDialog",
false ).toBool() )
1778 if ( dt.size() < 2 )
1786 if ( d.exec() == QDialog::Accepted )
1788 int srcTransform = -1;
1789 int destTransform = -1;
1790 QList<int> t = d.selectedDatumTransform();
1793 srcTransform = t.at( 0 );
1797 destTransform = t.at( 1 );
1801 if ( d.rememberSelection() )
1803 s.setValue( settingsString +
"_srcTransform", srcTransform );
1804 s.setValue( settingsString +
"_destTransform", destTransform );
1817 r.
scale( scaleFactor );
1845 bool QgsMapCanvas::event( QEvent * e )
1848 if ( e->type() == QEvent::Gesture )
1853 done =
mMapTool->gestureEvent( static_cast<QGestureEvent*>( e ) );
1859 done = QGraphicsView::event( e );
void unsetMapTool(QgsMapTool *mapTool)
Unset the current map tool or last non zoom tool.
QgsMapCanvasMap * mMap
owns pixmap with rendered map and controls rendering
void zoomToSelected(QgsVectorLayer *layer=NULL)
Zoom to the extent of the selected features of current (vector) layer.
void setRequestedGeometryCacheForLayers(const QStringList &layerIds)
Set which vector layers should be cached while rendering.
void updateCanvasItemPositions()
called on resize or changed extent to notify canvas items to change their rectangle ...
QgsMapSettings mSettings
encompases all map settings necessary for map rendering
bool mDrawRenderingStats
Whether to add rendering stats to the rendered image.
void setParallelRenderingEnabled(bool enabled)
Set whether the layers are rendered in parallel or sequentially.
const QgsDatumTransformStore & datumTransformStore() const
void setDestinationCrs(const QgsCoordinateReferenceSystem &crs)
sets destination coordinate reference system
QPoint mouseLastXY
Last seen point of the mouse.
virtual QColor canvasColor() const
Read property of QColor bgColor.
A rectangle specified with double values.
Base class for all map layer types.
Job implementation that renders everything sequentially using a custom painter.
const QgsCoordinateReferenceSystem & crsByAuthId(const QString &authid)
Returns the CRS for authid, e.g.
bool isEmpty() const
test if rectangle is empty.
void zoomToNextExtent()
Zoom to the next extent (view)
QGraphicsScene * mScene
graphics scene manages canvas items
void zoomWithCenter(int x, int y, bool zoomIn)
Zooms in/out with a given center.
Q_DECL_DEPRECATED bool isDirty() const
Return the state of the canvas (dirty or not)
void freeze(bool frz=true)
virtual void setCanvasColor(const QColor &_newVal)
Write property of QColor bgColor.
void enableOverviewMode(QgsMapOverviewCanvas *overview)
double scale() const
Return the calculated scale of the map.
double mapUnitsPerPixel() const
Returns the mapUnitsPerPixel (map units per pixel) for the canvas.
int layerCount() const
return number of layers on the map
bool mUseParallelRendering
Whether layers are rendered sequentially or in parallel.
A widget that displays an overview map.
void setXMaximum(double x)
Set the maximum x value.
void clearExtentHistory()
void readXML(QDomNode &theNode)
QgsRectangle fullExtent() const
returns current extent of layer set
QgsMapRenderer * mMapRenderer
all map rendering is done in this class
bool mouseButtonDown
Flag to indicate status of mouse button.
bool mRefreshScheduled
Flag that allows squashing multiple refresh() calls into just one delayed rendering job...
double yMaximum() const
Get the y maximum value (top side of rectangle)
void stopRendering()
stop rendering (if there is any right now)
void zoomByFactor(double scaleFactor)
Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1) zooms in.
void mouseReleaseEvent(QMouseEvent *e)
Overridden mouse release event.
QgsRectangle extent() const
returns current extent
void setExtent(const QgsRectangle &r)
Set the extent of the map canvas.
QString qgsDoubleToString(const double &a)
void addLayerCoordinateTransform(const QString &layerId, const QString &srcAuthId, const QString &destAuthId, int srcDatumTransform=-1, int destDatumTransform=-1)
#define Q_NOWARN_DEPRECATED_PUSH
An abstract class for items that can be placed on the map canvas.
A class that stores visibility and presence in overview flags together with pointer to the layer...
bool hasCrsTransformEnabled()
A simple helper method to find out if on the fly projections are enabled or not.
void setCurrentLayer(QgsMapLayer *layer)
bool previewModeEnabled() const
Returns whether a preview mode is enabled for the map canvas.
QgsRectangle visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
QList< QgsMapLayer * > layers() const
return list of layers within map canvas. Added in v1.5
void moveCanvasContents(bool reset=false)
called when panning is in action, reset indicates end of panning
WheelAction mWheelAction
Mouse wheel action.
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
bool hasCrsTransformEnabled() const
returns true if projections are enabled for this layer set
QgsRectangle layerExtentToOutputExtent(QgsMapLayer *theLayer, QgsRectangle extent) const
transform bounding box from layer's CRS to output CRS
void readProject(const QDomDocument &)
called to read map canvas settings from project
bool panSelectorDown
Flag to indicate the pan selector key is held down by user.
QgsMapOverviewCanvas * mMapOverview
map overview widget - it's controlled by QgsMapCanvas
void refresh()
Repaints the canvas map.
void renderComplete(QPainter *)
Emitted when the canvas has rendered.
void setProjectionsEnabled(bool enabled)
sets whether to use projections for this layer set
~QgsMapCanvas()
Destructor.
const QgsMapToPixel & mapToPixel() const
void keyReleaseEvent(QKeyEvent *e)
Overridden key release event.
QgsMapTool * mapTool()
Returns the currently active tool.
void setLayerSet(const QStringList &layers)
change current layer set
const QgsLabelingResults * labelingResults() const
Get access to the labeling results (may be null)
A non GUI class for rendering a map layer set onto a QPainter.
void setLayers(const QStringList &layers)
Set list of layer IDs for map rendering.
void resizeEvent(QResizeEvent *e)
Overridden resize event.
QgsMapTool * mMapTool
pointer to current map tool
virtual QImage renderedImage()=0
Get a preview/resulting image.
Map canvas is a class for displaying all GIS data types on a canvas.
void zoomLastStatusChanged(bool)
Emitted when zoom last status changed.
A graphics effect which can be applied to a widget to simulate various printing and color blindness m...
void setCache(QgsMapRendererCache *cache)
Assign a cache to be used for reading and storing rendered images of individual layers.
static void logMessage(QString message, QString tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
void setFlag(Flag flag, bool on=true)
Enable or disable a particular flag (other flags are not affected)
void updateScale()
Emits signal scaleChanged to update scale in main window.
void mouseDoubleClickEvent(QMouseEvent *e)
Overridden mouse double click event.
void setDestinationCrs(const QgsCoordinateReferenceSystem &crs)
sets destination coordinate reference system
The QgsMapSettings class contains configuration for rendering of the map.
QgsMapLayer * mCurrentLayer
current layer in legend
void hasCrsTransformEnabledChanged(bool flag)
Emitted when on-the-fly projection has been turned on/off.
void setMapTool(QgsMapTool *mapTool)
Sets the map tool currently being used on the canvas.
void enableAntiAliasing(bool flag)
const QString & name() const
Get the display name of the layer.
void paintEvent(QPaintEvent *e)
Overridden paint event.
void setCrsTransformEnabled(bool enabled)
sets whether to use projections for this layer set
QgsMapRenderer * mRenderer
Perform transforms between map coordinates and device coordinates.
int outputDpi() const
Return DPI used for conversion between real world units (e.g.
Q_DECL_DEPRECATED void showError(QgsMapLayer *mapLayer)
A rectangular graphics item representing the map on the canvas.
Q_DECL_DEPRECATED void clear()
Clear the map canvas.
void mapCanvasRefreshed()
Emitted when canvas finished a refresh request.
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
double scale()
Get the last reported scale of the canvas.
double xMaximum() const
Get the x maximum value (right side of rectangle)
void zoomNextStatusChanged(bool)
Emitted when zoom next status changed.
QgsMapTool * mLastNonZoomMapTool
previous tool if current is for zooming/panning
bool hasCrsTransformEnabled() const
returns true if projections are enabled for this layer set
bool hasValidSettings() const
Check whether the map settings are valid and can be used for rendering.
void clearCache()
Make sure to remove any rendered images from cache (does nothing if cache is not enabled) ...
void mousePressEvent(QMouseEvent *e)
Overridden mouse press event.
void setMapUnits(QGis::UnitType u)
Set units of map's geographical coordinates - used for scale calculation.
virtual void waitForFinished()
Block until the job has finished.
Job implementation that renders all layers in parallel.
const QgsCoordinateReferenceSystem & destinationCrs() const
returns CRS of destination coordinate reference system
void panToSelected(QgsVectorLayer *layer=NULL)
Pan to the selected features of current (vector) layer keeping same extent.
void setLayerSet(QList< QgsMapCanvasLayer > &layers)
const QgsCoordinateReferenceSystem & destinationCrs() const
returns CRS of destination coordinate reference system
void setYMinimum(double y)
Set the minimum y value.
void keyReleased(QKeyEvent *e)
Emit key release event.
Q_DECL_DEPRECATED QPaintDevice & paintDevice()
void mapToolDestroyed()
called when current maptool is destroyed
bool setExtent(const QgsRectangle &extent)
sets extent and checks whether suitable (returns false if not)
Enable anti-aliasin for map rendering.
void setMapUnits(QGis::UnitType u)
void getDatumTransformInfo(const QgsMapLayer *ml, const QString &srcAuthId, const QString &destAuthId)
ask user about datum transformation
Q_DECL_DEPRECATED QPaintDevice & canvasPaintDevice()
Accessor for the canvas paint device.
double mapUnitsPerPixel() const
Return the distance in geographical coordinates that equals to one pixel in the map.
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
void wheelEvent(QWheelEvent *e)
Overridden mouse wheel event.
void destinationCrsChanged()
Emitted when map CRS has changed.
int mapUpdateInterval() const
Find out how often map preview should be updated while it is being rendered (in milliseconds) ...
void updateDatumTransformEntries()
Make sure the datum transform store is properly populated.
QGis::GeometryType geometryType() const
Returns point, line or polygon.
void setRenderFlag(bool theFlag)
Whether to suppress rendering or not.
QGis::UnitType mapUnits() const
Get units of map's geographical coordinates - used for scale calculation.
QGis::UnitType mapUnits() const
Get the current canvas map units.
virtual void start()
Start the rendering job and immediately return.
void setOutputSize(QSize size, int dpi)
void setCachingEnabled(bool enabled)
Set whether to cache images of rendered layers.
void setPreviewMode(QgsPreviewEffect::PreviewMode mode)
Sets a preview mode for the map canvas.
void refresh()
renders overview and updates panning widget
void setMode(PreviewMode mode)
Sets the mode for the preview effect, which controls how the effect modifies a widgets appearance...
void renderStarting()
Emitted when the canvas is about to be rendered.
A class to represent a point geometry.
void saveAsImage(QString theFileName, QPixmap *QPixmap=0, QString="PNG")
Save the convtents of the map canvas to disk as an image.
void keyPressed(QKeyEvent *e)
Emit key press event.
QgsMapRendererQImageJob * mJob
Job that takes care of map rendering in background.
void zoomOut()
Zoom out with fixed factor.
QgsPreviewEffect::PreviewMode previewMode() const
Returns the current preview mode for the map canvas.
Enable drawing of vertex markers for layers in editing mode.
void zoomToPreviousExtent()
Zoom to the previous extent (view)
void xyCoordinates(const QgsPoint &p)
emits current mouse position
void setDestinationCrs(const QgsCoordinateReferenceSystem &crs, bool refreshCoordinateTransformInfo=true, bool transformExtent=true)
sets destination coordinate reference system
bool isDrawing()
Find out whether rendering is in progress.
QgsLabelingResults * mLabelingResults
Labeling results from the recently rendered map.
void setPreviewModeEnabled(bool previewEnabled)
Enables a preview mode for the map canvas.
virtual void start()=0
Start the rendering job and immediately return.
QPoint mouseLastXY()
returns last position of mouse cursor
QgsMapLayer * currentLayer()
returns current layer (set by legend widget)
void setWheelAction(WheelAction action, double factor=2)
set wheel action and zoom factor (should be greater than 1)
void selectionChanged(QgsMapLayer *layer)
Emitted when selection in any layer gets changed.
bool isCachingEnabled() const
Check whether images of rendered layers are curerently being cached.
QgsPoint toMapCoordinates(int x, int y) const
void clear()
invalidate the cache contents
void selectionChangedSlot()
Receives signal about selection change, and pass it on with layer info.
Job implementation that renders everything sequentially in one thread.
#define Q_NOWARN_DEPRECATED_POP
QTimer mMapUpdateTimer
Timer that periodically fires while map rendering is in progress to update the visible map...
double mWheelZoomFactor
Scale factor multiple for default zoom in/out.
bool mFrozen
Flag indicating if the map canvas is frozen.
void setBackgroundColor(const QColor &color)
Set the background color of the map.
QImage contentImage() const
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
Q_DECL_DEPRECATED void useImageToRender(bool theFlag)
Select which Qt class to render with.
void setContent(const QImage &image, const QgsRectangle &rect)
bool isInOverview() const
QgsMapRendererCache * mCache
Optionally use cache with rendered map layers for the current map settings.
void setSelectionColor(const QColor &color)
Set color that is used for drawing of selected vector features.
void setLayerSet(const QStringList &layerSet)
updates layer set for overview
void setOutputSize(const QSize &size)
Set the size of the resulting map image.
void setYMaximum(double y)
Set the maximum y value.
void writeProject(QDomDocument &)
called to write map canvas settings to project
void panAction(QMouseEvent *event)
Called when mouse is moving and pan is activated.
static QgsProject * instance()
access to canonical QgsProject instance
Q_DECL_DEPRECATED QgsMapRenderer * mapRenderer()
void zoomToFullExtent()
Zoom to the full extent of all layers.
QgsPreviewEffect * mPreviewEffect
bool mRenderFlag
determines whether user has requested to suppress rendering
Class for storing a coordinate reference system (CRS)
void setExtent(const QgsRectangle &rect)
Set coordinates of the rectangle which should be rendered.
QgsMapCanvasRendererSync(QgsMapCanvas *canvas, QgsMapRenderer *renderer)
QgsRectangle extent() const
Return geographical coordinates of the rectangle that should be rendered.
void zoomScale(double scale)
Zoom to a specific scale.
UnitType
Map units that qgis supports.
const QgsMapToPixel * getCoordinateTransform()
Get the current coordinate transform.
void scaleChanged(double)
Emitted when the scale of the map changes.
const QgsCoordinateReferenceSystem & crs() const
Returns layer's spatial reference system.
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 enableAntiAliasing(bool theFlag)
used to determine if anti-aliasing is enabled or not
QgsMapLayer * mapLayer(QString theLayerId)
Retrieve a pointer to a loaded layer by id.
void setSelectionColor(const QColor &color)
Set color of selected vector features.
void setMapUpdateInterval(int timeMiliseconds)
Set how often map preview should be updated while it is being rendered (in milliseconds) ...
void layerStateChange()
This slot is connected to the visibility change of one or more layers.
void rendererJobFinished()
called when a renderer job has finished successfully or when it was cancelled
Enable vector simplification and other rendering optimizations.
Class that stores computed placement from labeling engine.
QgsRectangle extent() const
Returns the current zoom exent of the map canvas.
This class is responsible for keeping cache of rendered images of individual layers.
QgsMapCanvas(QWidget *parent=0, const char *name=0)
Constructor.
void setMapUnits(QGis::UnitType mapUnits)
Set map units (needed by project properties dialog)
bool isParallelRenderingEnabled() const
Check whether the layers are rendered in parallel or sequentially.
void connectNotify(const char *signal)
debugging member invoked when a connect() is made to this object
PreviewMode mode() const
Returns the mode used for the preview effect.
Q_DECL_DEPRECATED void setDirty(bool _dirty)
Flag the canvas as dirty and needed a refresh.
static void setSpecialColumn(const QString &name, QVariant value)
Assign a special column.
QPoint rubberStartPoint
Beginning point of a rubber band.
Errors errors() const
List of errors that happened during the rendering job - available when the rendering has been finishe...
Class that does synchronization between QgsMapCanvas and its associated QgsMapRenderer: ...
double width() const
Width of the rectangle.
virtual QgsLabelingResults * takeLabelingResults()=0
Get pointer to internal labeling engine (in order to get access to the results)
void zoomIn()
Zoom in with fixed factor.
virtual bool isEditable() const
Returns true if the provider is in editing mode.
QGis::UnitType mapUnits() const
Represents a vector layer which manages a vector based data sets.
virtual void updatePosition()
called on changed extent or resize event to update position of the item
int selectedFeatureCount()
The number of features that are selected in this layer.
double xMinimum() const
Get the x minimum value (left side of rectangle)
QList< QgsRectangle > mLastExtent
recently used extent
static QgsCRSCache * instance()
QgsPoint center() const
Center point of the rectangle.
void extentsChanged()
Emitted when the extents of the map change.
int renderingTime() const
Find out how log it took to finish the job (in miliseconds)
std::auto_ptr< CanvasProperties > mCanvasProperties
Handle pattern for implementation object.
void mouseMoveEvent(QMouseEvent *e)
Overridden mouse move event.
bool mJobCancelled
Flag determining whether the active job has been cancelled.
QgsMapLayer * layer(int index)
return the map layer at position index in the layer stack
Q_DECL_DEPRECATED void updateMap()
void setXMinimum(double x)
Set the minimum x value.
void keyPressEvent(QKeyEvent *e)
Overridden key press event.
double height() const
Height of the rectangle.
void dragEnterEvent(QDragEnterEvent *e)
Overridden drag enter event.
QgsPoint toMapPoint(double x, double y) const
void setCrsTransformEnabled(bool enabled)
sets whether to use projections for this layer set
void panActionEnd(QPoint releasePoint)
Ends pan action and redraws the canvas.
void mapUnitsChanged()
Emmitted when map units are changed.
QStringList layerSet() const
QgsRectangle fullExtent() const
Returns the combined exent for all layers on the map canvas.
void layersChanged()
Emitted when a new set of layers has been received.
QgsRectangle boundingBoxOfSelected()
Returns the bounding box of the selected features.
void writeXML(QDomNode &theNode, QDomDocument &theDoc)
void mapToolSet(QgsMapTool *tool)
Emit map tool changed event.
void scale(double scaleFactor, const QgsPoint *c=0)
Scale the rectangle around its center point.