18 #ifndef QGSMAPCANVAS_H
19 #define QGSMAPCANVAS_H
21 #include "qgsconfig.h"
31 #include <QDomDocument>
32 #include <QGraphicsView>
39 #include <QGestureEvent>
79 : mLayer( layer ), mVisible( visible ), mInOverview( isInOverview ) {}
114 QgsMapCanvas( QWidget * parent = 0,
const char *name = 0 );
119 void setLayerSet( QList<QgsMapCanvasLayer>& layers );
124 void updateOverview();
135 void setCrsTransformEnabled(
bool enabled );
147 void setCachingEnabled(
bool enabled );
151 bool isCachingEnabled()
const;
159 void setParallelRenderingEnabled(
bool enabled );
163 bool isParallelRenderingEnabled()
const;
167 void setMapUpdateInterval(
int timeMiliseconds );
171 int mapUpdateInterval()
const;
185 Q_DECL_DEPRECATED QPaintDevice &canvasPaintDevice();
192 Q_DECL_DEPRECATED
void clear();
195 double mapUnitsPerPixel()
const;
207 double rotation()
const;
211 void setRotation(
double degrees );
215 void setCenter(
const QgsPoint& center );
222 void zoomToFullExtent();
225 void zoomToPreviousExtent();
228 void zoomToNextExtent();
231 void clearExtentHistory();
255 virtual void setCanvasColor(
const QColor & _newVal );
257 virtual QColor canvasColor()
const;
261 void setSelectionColor(
const QColor& color );
274 int layerCount()
const;
277 QList<QgsMapLayer*> layers()
const;
284 void freeze(
bool frz =
true );
291 Q_DECL_DEPRECATED
void setDirty(
bool _dirty );
295 Q_DECL_DEPRECATED
bool isDirty()
const;
313 void setWheelAction( WheelAction action,
double factor = 2 );
322 void zoomScale(
double scale );
326 void zoomByFactor(
double scaleFactor,
const QgsPoint *center = 0 );
329 void zoomWithCenter(
int x,
int y,
bool zoomIn );
332 void enableAntiAliasing(
bool theFlag );
339 Q_DECL_DEPRECATED
void useImageToRender(
bool theFlag );
344 void panActionEnd( QPoint releasePoint );
347 void panAction( QMouseEvent * event );
350 QPoint mouseLastXY();
356 void setPreviewModeEnabled(
bool previewEnabled );
363 bool previewModeEnabled()
const;
405 void selectionChangedSlot();
408 void saveAsImage( QString theFileName, QPixmap * QPixmap = 0, QString =
"PNG" );
411 void layerStateChange();
414 void layerCrsChange();
417 void setRenderFlag(
bool theFlag );
422 bool hasCrsTransformEnabled();
425 Q_DECL_DEPRECATED
void updateMap();
429 void stopRendering();
432 Q_DECL_DEPRECATED
void showError(
QgsMapLayer * mapLayer );
435 void readProject(
const QDomDocument & );
438 void writeProject( QDomDocument & );
441 void getDatumTransformInfo(
const QgsMapLayer* ml,
const QString& srcAuthId,
const QString& destAuthId );
445 static bool rotationEnabled();
449 static void enableRotation(
bool enabled );
453 void mapToolDestroyed();
456 void rendererJobFinished();
458 void mapUpdateTimeout();
465 Q_DECL_DEPRECATED
void setProgress(
int,
int );
469 void xyCoordinates(
const QgsPoint &p );
472 void scaleChanged(
double );
475 void extentsChanged();
479 void rotationChanged(
double );
492 void renderComplete( QPainter * );
496 void mapCanvasRefreshed();
500 void renderStarting();
503 void layersChanged();
506 void keyPressed( QKeyEvent * e );
509 void keyReleased( QKeyEvent * e );
524 void zoomLastStatusChanged(
bool );
527 void zoomNextStatusChanged(
bool );
531 void hasCrsTransformEnabledChanged(
bool flag );
535 void destinationCrsChanged();
539 void mapUnitsChanged();
548 bool event( QEvent * e )
override;
552 void keyPressEvent( QKeyEvent * e )
override;
555 void keyReleaseEvent( QKeyEvent * e )
override;
558 void mouseDoubleClickEvent( QMouseEvent * e )
override;
561 void mouseMoveEvent( QMouseEvent * e )
override;
564 void mousePressEvent( QMouseEvent * e )
override;
567 void mouseReleaseEvent( QMouseEvent * e )
override;
570 void wheelEvent( QWheelEvent * e )
override;
573 void resizeEvent( QResizeEvent * e )
override;
576 void paintEvent( QPaintEvent * e )
override;
579 void dragEnterEvent( QDragEnterEvent * e )
override;
582 void moveCanvasContents(
bool reset =
false );
585 void updateCanvasItemPositions();
597 void connectNotify(
const char * signal )
override;
600 void updateDatumTransformEntries();
628 bool mRefreshScheduled;
637 QGraphicsScene* mScene;
646 QList <QgsRectangle> mLastExtent;
647 int mLastExtentIndex;
650 double mWheelZoomFactor;
656 QTimer mMapUpdateTimer;
668 bool mUseParallelRendering;
671 bool mDrawRenderingStats;
676 QTimer *mResizeTimer;