18 #ifndef QGSMAPCANVAS_H
19 #define QGSMAPCANVAS_H
21 #include "qgsconfig.h"
31 #include <QDomDocument>
32 #include <QGraphicsView>
39 #include <QGestureEvent>
78 : mLayer( layer ), mVisible( visible ), mInOverview( isInOverview ) {}
113 QgsMapCanvas( QWidget * parent = 0,
const char *name = 0 );
118 void setLayerSet( QList<QgsMapCanvasLayer>& layers );
123 void updateOverview();
134 void setCrsTransformEnabled(
bool enabled );
146 void setCachingEnabled(
bool enabled );
150 bool isCachingEnabled()
const;
158 void setParallelRenderingEnabled(
bool enabled );
162 bool isParallelRenderingEnabled()
const;
166 void setMapUpdateInterval(
int timeMiliseconds );
170 int mapUpdateInterval()
const;
184 Q_DECL_DEPRECATED QPaintDevice &canvasPaintDevice();
191 Q_DECL_DEPRECATED
void clear();
194 double mapUnitsPerPixel()
const;
205 void zoomToFullExtent();
208 void zoomToPreviousExtent();
211 void zoomToNextExtent();
214 void clearExtentHistory();
239 virtual void setCanvasColor(
const QColor & _newVal );
241 virtual QColor canvasColor()
const;
244 void setSelectionColor(
const QColor& color );
251 Q_DECL_DEPRECATED
void updateFullExtent() {}
258 int layerCount()
const;
261 QList<QgsMapLayer*> layers()
const;
268 void freeze(
bool frz =
true );
275 Q_DECL_DEPRECATED
void setDirty(
bool _dirty );
279 Q_DECL_DEPRECATED
bool isDirty()
const;
297 void setWheelAction( WheelAction action,
double factor = 2 );
307 void zoomScale(
double scale );
310 void zoomByFactor(
double scaleFactor );
313 void zoomWithCenter(
int x,
int y,
bool zoomIn );
316 void enableAntiAliasing(
bool theFlag );
323 Q_DECL_DEPRECATED
void useImageToRender(
bool theFlag );
328 void panActionEnd( QPoint releasePoint );
331 void panAction( QMouseEvent * event );
334 QPoint mouseLastXY();
340 void setPreviewModeEnabled(
bool previewEnabled );
347 bool previewModeEnabled()
const;
372 void selectionChangedSlot();
375 void saveAsImage( QString theFileName, QPixmap * QPixmap = 0, QString =
"PNG" );
378 void layerStateChange();
381 void setRenderFlag(
bool theFlag );
386 bool hasCrsTransformEnabled();
389 Q_DECL_DEPRECATED
void updateMap();
393 void stopRendering();
396 Q_DECL_DEPRECATED
void showError(
QgsMapLayer * mapLayer );
399 void readProject(
const QDomDocument & );
402 void writeProject( QDomDocument & );
405 void getDatumTransformInfo(
const QgsMapLayer* ml,
const QString& srcAuthId,
const QString& destAuthId );
409 void mapToolDestroyed();
412 void rendererJobFinished();
414 void mapUpdateTimeout();
420 Q_DECL_DEPRECATED
void setProgress(
int,
int );
425 void xyCoordinates(
const QgsPoint &p );
428 void scaleChanged(
double );
431 void extentsChanged();
441 void renderComplete( QPainter * );
449 void mapCanvasRefreshed();
454 void renderStarting();
457 void layersChanged();
460 void keyPressed( QKeyEvent * e );
463 void keyReleased( QKeyEvent * e );
479 void zoomLastStatusChanged(
bool );
483 void zoomNextStatusChanged(
bool );
487 void hasCrsTransformEnabledChanged(
bool flag );
491 void destinationCrsChanged();
495 void mapUnitsChanged();
499 bool event( QEvent * e );
504 void keyPressEvent( QKeyEvent * e );
507 void keyReleaseEvent( QKeyEvent * e );
510 void mouseDoubleClickEvent( QMouseEvent * e );
513 void mouseMoveEvent( QMouseEvent * e );
516 void mousePressEvent( QMouseEvent * e );
519 void mouseReleaseEvent( QMouseEvent * e );
522 void wheelEvent( QWheelEvent * e );
525 void resizeEvent( QResizeEvent * e );
528 void paintEvent( QPaintEvent * e );
531 void dragEnterEvent( QDragEnterEvent * e );
534 void moveCanvasContents(
bool reset =
false );
537 void updateCanvasItemPositions();
548 void connectNotify(
const char * signal );
551 void updateDatumTransformEntries();
QgsMapCanvasMap * mMap
owns pixmap with rendered map and controls rendering
QgsMapSettings mSettings
encompases all map settings necessary for map rendering
bool mDrawRenderingStats
Whether to add rendering stats to the rendered image.
A rectangle specified with double values.
Base class for all map layer types.
void setInOverview(bool isInOverview)
QGraphicsScene * mScene
graphics scene manages canvas items
bool mUseParallelRendering
Whether layers are rendered sequentially or in parallel.
A widget that displays an overview map.
QgsMapRenderer * mMapRenderer
all map rendering is done in this class
bool mRefreshScheduled
Flag that allows squashing multiple refresh() calls into just one delayed rendering job...
A class that stores visibility and presence in overview flags together with pointer to the layer...
WheelAction mWheelAction
Mouse wheel action.
QgsMapOverviewCanvas * mMapOverview
map overview widget - it's controlled by QgsMapCanvas
A non GUI class for rendering a map layer set onto a QPainter.
bool antiAliasingEnabled() const
true if antialising is enabled
QgsMapTool * mMapTool
pointer to current map tool
Map canvas is a class for displaying all GIS data types on a canvas.
void setVisible(bool visible)
A graphics effect which can be applied to a widget to simulate various printing and color blindness m...
bool renderFlag()
State of render suppression flag.
The QgsMapSettings class contains configuration for rendering of the map.
QgsMapLayer * mCurrentLayer
current layer in legend
QgsMapRenderer * mRenderer
Perform transforms between map coordinates and device coordinates.
A rectangular graphics item representing the map on the canvas.
QgsMapTool * mLastNonZoomMapTool
previous tool if current is for zooming/panning
Enable anti-aliasin for map rendering.
A class for highlight features on the map.
const QgsMapLayer * layer() const
bool mInOverview
Flag whether layer is shown in overview.
A class to represent a point geometry.
QgsMapRendererQImageJob * mJob
Job that takes care of map rendering in background.
bool mVisible
Flag whether layer is visible.
QgsLabelingResults * mLabelingResults
Labeling results from the recently rendered map.
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.
bool isInOverview() const
QgsMapRendererCache * mCache
Optionally use cache with rendered map layers for the current map settings.
Intermediate base class adding functionality that allows client to query the rendered image...
QgsPreviewEffect * mPreviewEffect
bool mRenderFlag
determines whether user has requested to suppress rendering
Class for storing a coordinate reference system (CRS)
QgsMapCanvasRendererSync(QgsMapCanvas *canvas, QgsMapRenderer *renderer)
QgsMapCanvasLayer(QgsMapLayer *layer, bool visible=true, bool isInOverview=false)
UnitType
Map units that qgis supports.
Class that stores computed placement from labeling engine.
This class is responsible for keeping cache of rendered images of individual layers.
Class that does synchronization between QgsMapCanvas and its associated QgsMapRenderer: ...
Represents a vector layer which manages a vector based data sets.
QList< QgsRectangle > mLastExtent
recently used extent
std::auto_ptr< CanvasProperties > mCanvasProperties
Handle pattern for implementation object.
bool mJobCancelled
Flag determining whether the active job has been cancelled.