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;
260 void setSelectionColor(
const QColor& color );
267 Q_DECL_DEPRECATED
void updateFullExtent() {}
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();
464 Q_DECL_DEPRECATED
void setProgress(
int,
int );
469 void xyCoordinates(
const QgsPoint &p );
472 void scaleChanged(
double );
475 void extentsChanged();
479 void rotationChanged(
double );
489 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();
547 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;
599 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;
706 void onMapUnitsC2R();
707 void onMapUnitsR2C();
710 void onMapRotationC2R();
712 void onMapRotationR2C();
714 void onCrsTransformC2R();
715 void onCrsTransformR2C();
A rectangle specified with double values.
Base class for all map layer types.
void setInOverview(bool isInOverview)
A widget that displays an overview map.
A class that stores visibility and presence in overview flags together with pointer to the layer...
A non GUI class for rendering a map layer set onto a QPainter.
bool antiAliasingEnabled() const
true if antialising is enabled
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.
QgsMapRenderer * mRenderer
Perform transforms between map coordinates and device coordinates.
A rectangular graphics item representing the map on the canvas.
Enable anti-aliasin for map rendering.
A class for highlight features on the map.
const QgsMapLayer * layer() const
A class to represent a point.
QScopedPointer< CanvasProperties > mCanvasProperties
Handle pattern for implementation object.
bool isInOverview() const
Intermediate base class adding functionality that allows client to query the rendered image...
Class for storing a coordinate reference system (CRS)
This class has all the configuration of snapping and can return answers to snapping queries...
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.