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();
238 virtual void setCanvasColor(
const QColor & _newVal );
240 virtual QColor canvasColor()
const;
244 void setSelectionColor(
const QColor& color );
257 int layerCount()
const;
260 QList<QgsMapLayer*> layers()
const;
267 void freeze(
bool frz =
true );
274 Q_DECL_DEPRECATED
void setDirty(
bool _dirty );
278 Q_DECL_DEPRECATED
bool isDirty()
const;
296 void setWheelAction( WheelAction action,
double factor = 2 );
305 void zoomScale(
double scale );
309 void zoomByFactor(
double scaleFactor,
const QgsPoint *center = 0 );
312 void zoomWithCenter(
int x,
int y,
bool zoomIn );
315 void enableAntiAliasing(
bool theFlag );
322 Q_DECL_DEPRECATED
void useImageToRender(
bool theFlag );
327 void panActionEnd( QPoint releasePoint );
330 void panAction( QMouseEvent * event );
333 QPoint mouseLastXY();
339 void setPreviewModeEnabled(
bool previewEnabled );
346 bool previewModeEnabled()
const;
371 void selectionChangedSlot();
374 void saveAsImage( QString theFileName, QPixmap * QPixmap = 0, QString =
"PNG" );
377 void layerStateChange();
380 void setRenderFlag(
bool theFlag );
385 bool hasCrsTransformEnabled();
388 Q_DECL_DEPRECATED
void updateMap();
392 void stopRendering();
395 Q_DECL_DEPRECATED
void showError(
QgsMapLayer * mapLayer );
398 void readProject(
const QDomDocument & );
401 void writeProject( QDomDocument & );
404 void getDatumTransformInfo(
const QgsMapLayer* ml,
const QString& srcAuthId,
const QString& destAuthId );
408 void mapToolDestroyed();
411 void rendererJobFinished();
413 void mapUpdateTimeout();
420 Q_DECL_DEPRECATED
void setProgress(
int,
int );
424 void xyCoordinates(
const QgsPoint &p );
427 void scaleChanged(
double );
430 void extentsChanged();
443 void renderComplete( QPainter * );
447 void mapCanvasRefreshed();
451 void renderStarting();
454 void layersChanged();
457 void keyPressed( QKeyEvent * e );
460 void keyReleased( QKeyEvent * e );
475 void zoomLastStatusChanged(
bool );
478 void zoomNextStatusChanged(
bool );
482 void hasCrsTransformEnabledChanged(
bool flag );
486 void destinationCrsChanged();
490 void mapUnitsChanged();
495 bool event( QEvent * e );
499 void keyPressEvent( QKeyEvent * e );
502 void keyReleaseEvent( QKeyEvent * e );
505 void mouseDoubleClickEvent( QMouseEvent * e );
508 void mouseMoveEvent( QMouseEvent * e );
511 void mousePressEvent( QMouseEvent * e );
514 void mouseReleaseEvent( QMouseEvent * e );
517 void wheelEvent( QWheelEvent * e );
520 void resizeEvent( QResizeEvent * e );
523 void paintEvent( QPaintEvent * e );
526 void dragEnterEvent( QDragEnterEvent * e );
529 void moveCanvasContents(
bool reset =
false );
532 void updateCanvasItemPositions();
543 void connectNotify(
const char * signal );
546 void updateDatumTransformEntries();
574 bool mRefreshScheduled;
583 QGraphicsScene* mScene;
592 QList <QgsRectangle> mLastExtent;
593 int mLastExtentIndex;
596 double mWheelZoomFactor;
602 QTimer mMapUpdateTimer;
614 bool mUseParallelRendering;
617 bool mDrawRenderingStats;
622 QTimer *mResizeTimer;