18 #ifndef QGSMAPCANVAS_H
19 #define QGSMAPCANVAS_H
21 #include "qgsconfig.h"
31 #include <QDomDocument>
32 #include <QGraphicsView>
36 #include <QGestureEvent>
73 : mLayer( layer ), mVisible( visible ), mInOverview( isInOverview ) {}
108 QgsMapCanvas( QWidget * parent = 0,
const char *name = 0 );
113 void setLayerSet( QList<QgsMapCanvasLayer>& layers );
117 void updateOverview();
126 QPaintDevice &canvasPaintDevice();
135 double mapUnitsPerPixel()
const;
146 void zoomToFullExtent();
149 void zoomToPreviousExtent();
152 void zoomToNextExtent();
155 void clearExtentHistory();
180 virtual void setCanvasColor(
const QColor & _newVal );
182 virtual QColor canvasColor()
const;
188 void updateFullExtent();
194 int layerCount()
const;
197 QList<QgsMapLayer*> layers()
const;
204 void freeze(
bool frz =
true );
210 void setDirty(
bool _dirty );
213 bool isDirty()
const;
231 void setWheelAction( WheelAction action,
double factor = 2 );
241 void zoomScale(
double scale );
244 void zoomByFactor(
double scaleFactor );
247 void zoomWithCenter(
int x,
int y,
bool zoomIn );
250 void enableAntiAliasing(
bool theFlag );
256 void useImageToRender(
bool theFlag );
261 void panActionEnd( QPoint releasePoint );
264 void panAction( QMouseEvent * event );
267 QPoint mouseLastXY();
275 void selectionChangedSlot();
278 void saveAsImage( QString theFileName, QPixmap * QPixmap = 0, QString =
"PNG" );
281 void layerStateChange();
284 void setRenderFlag(
bool theFlag );
289 bool hasCrsTransformEnabled();
292 void mapUnitsChanged();
301 void readProject(
const QDomDocument & );
304 void writeProject( QDomDocument & );
307 void getDatumTransformInfo(
const QgsMapLayer* ml,
const QString& srcAuthId,
const QString& destAuthId );
311 void mapToolDestroyed();
315 void setProgress(
int,
int );
319 void xyCoordinates(
const QgsPoint &p );
322 void scaleChanged(
double );
325 void extentsChanged();
335 void renderComplete( QPainter * );
339 void mapCanvasRefreshed();
343 void renderStarting();
346 void layersChanged();
349 void keyPressed( QKeyEvent * e );
352 void keyReleased( QKeyEvent * e );
362 void zoomLastStatusChanged(
bool );
366 void zoomNextStatusChanged(
bool );
370 bool event( QEvent * e );
375 void keyPressEvent( QKeyEvent * e );
378 void keyReleaseEvent( QKeyEvent * e );
381 void mouseDoubleClickEvent( QMouseEvent * e );
384 void mouseMoveEvent( QMouseEvent * e );
387 void mousePressEvent( QMouseEvent * e );
390 void mouseReleaseEvent( QMouseEvent * e );
393 void wheelEvent( QWheelEvent * e );
396 void resizeEvent( QResizeEvent * e );
399 void paintEvent( QPaintEvent * e );
402 void dragEnterEvent( QDragEnterEvent * e );
405 void moveCanvasContents(
bool reset =
false );
408 void updateCanvasItemPositions();
419 void connectNotify(
const char * signal );
422 void crsTransformEnabled(
bool );
QgsMapCanvasMap * mMap
owns pixmap with rendered map and controls rendering
A rectangle specified with double values.
Base class for all map layer types.
void setInOverview(bool isInOverview)
QGraphicsScene * mScene
graphics scene manages canvas items
A widget that displays an overview map.
QgsMapRenderer * mMapRenderer
all map rendering is done in this class
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)
bool mAntiAliasing
indicates whether antialiasing will be used for rendering
bool renderFlag()
State of render suppression flag.
QList< QPair< int, int > > mResizeQueue
Resize events that have been ignored because the canvas is busy with rendering may put their sizes in...
QgsMapLayer * mCurrentLayer
current layer in legend
QSize mNewSize
resize canvas size
Perform transforms between map coordinates and device coordinates.
A rectangular graphics item representing the map on the canvas.
bool mBackbufferEnabled
If backbuffering is currently enabled.
QgsMapTool * mLastNonZoomMapTool
previous tool if current is for zooming/panning
bool mDirty
Flag to track the state of the Map canvas.
A class for highlight features on the map.
bool mPainting
currently in paint event
const QgsMapLayer * layer() const
bool mInOverview
Flag whether layer is shown in overview.
A class to represent a point geometry.
bool mVisible
Flag whether layer is visible.
bool mDrawing
Flag indicating a map refresh is in progress.
double mWheelZoomFactor
Scale factor multiple for default zoom in/out.
bool mFrozen
Flag indicating if the map canvas is frozen.
bool isInOverview() const
bool mRenderFlag
determines whether user has requested to suppress rendering
QgsMapCanvasLayer(QgsMapLayer *layer, bool visible=true, bool isInOverview=false)
UnitType
Map units that qgis supports.
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.