QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Slots | Signals | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
QgsComposerMap Class Reference

Object representing map window. More...

#include <qgscomposermap.h>

Inheritance diagram for QgsComposerMap:
Inheritance graph
[legend]
Collaboration diagram for QgsComposerMap:
Collaboration graph
[legend]

Public Types

enum  PreviewMode { Cache = 0, Render, Rectangle }
 Preview style. More...
 
enum  GridStyle { Solid = 0, Cross, Markers }
 
enum  GridAnnotationPosition { InsideMapFrame = 0, OutsideMapFrame, Disabled }
 
enum  GridAnnotationDirection { Horizontal = 0, Vertical, HorizontalAndVertical, BoundaryDirection }
 
enum  GridAnnotationFormat { Decimal = 0, DegreeMinute, DegreeMinuteSecond }
 
enum  GridFrameStyle { NoGridFrame = 0, Zebra }
 
enum  Border { Left, Right, Bottom, Top }
 Enum for different frame borders. More...
 
enum  AnnotationCoordinate { Longitude = 0, Latitude }
 
enum  AtlasScalingMode { Fixed, Predefined, Auto }
 Scaling modes used for the serial rendering (atlas) More...
 
- Public Types inherited from QgsComposerItem
enum  ItemType {
  ComposerItem = UserType + 100, ComposerArrow, ComposerItemGroup, ComposerLabel,
  ComposerLegend, ComposerMap, ComposerPaper, ComposerPicture,
  ComposerScaleBar, ComposerShape, ComposerTable, ComposerAttributeTable,
  ComposerTextTable, ComposerFrame
}
 
enum  MouseMoveAction {
  MoveItem, ResizeUp, ResizeDown, ResizeLeft,
  ResizeRight, ResizeLeftUp, ResizeRightUp, ResizeLeftDown,
  ResizeRightDown, NoAction
}
 Describes the action (move or resize in different directon) to be done during mouse move. More...
 
enum  ItemPositionMode {
  UpperLeft, UpperMiddle, UpperRight, MiddleLeft,
  Middle, MiddleRight, LowerLeft, LowerMiddle,
  LowerRight
}
 
- Public Types inherited from QgsComposerObject
enum  DataDefinedProperty {
  NoProperty = 0, AllProperties, TestProperty, PresetPaperSize,
  PaperWidth, PaperHeight, NumPages, PaperOrientation,
  PageNumber, PositionX, PositionY, ItemWidth,
  ItemHeight, ItemRotation, Transparency, BlendMode,
  MapRotation, MapScale, MapXMin, MapYMin,
  MapXMax, MapYMax, PictureSource, SourceUrl
}
 Data defined properties for different item types. More...
 
enum  PropertyValueType { EvaluatedValue = 0, OriginalValue }
 Specifies whether the value returned by a function should be the original, user set value, or the current evaluated value for the property. More...
 

Public Slots

void updateCachedImage ()
 Called if map canvas has changed. More...
 
void renderModeUpdateCachedImage ()
 Call updateCachedImage if item is in render mode. More...
 
void overviewExtentChanged ()
 
virtual void refreshDataDefinedProperty (const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties)
 
- Public Slots inherited from QgsComposerItem
virtual void setItemRotation (const double r, const bool adjustPosition=false)
 Sets the item rotation. More...
 
void repaint ()
 
virtual void refreshDataDefinedProperty (const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties)
 Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value. More...
 
- Public Slots inherited from QgsComposerObject
virtual void repaint ()
 Triggers a redraw for the item. More...
 
virtual void refreshDataDefinedProperty (const DataDefinedProperty property=AllProperties)
 Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value. More...
 

Signals

void extentChanged ()
 
void mapRotationChanged (double newRotation)
 Is emitted on rotation change to notify north arrow pictures. More...
 
void preparedForAtlas ()
 Is emitted when the map has been prepared for atlas rendering, just before actual rendering. More...
 
- Signals inherited from QgsComposerItem
void itemRotationChanged (double newRotation)
 Is emitted on item rotation change. More...
 
void sizeChanged ()
 Emitted if the rectangle changes. More...
 
void frameChanged ()
 Emitted if the item's frame style changes. More...
 
- Signals inherited from QgsComposerObject
void itemChanged ()
 Emitted when the item changes. More...
 

Public Member Functions

 QgsComposerMap (QgsComposition *composition, int x, int y, int width, int height)
 Constructor. More...
 
 QgsComposerMap (QgsComposition *composition)
 Constructor. More...
 
virtual ~QgsComposerMap ()
 
virtual int type () const
 return correct graphics item type. More...
 
void draw (QPainter *painter, const QgsRectangle &extent, const QSizeF &size, double dpi, double *forceWidthScale=0)
 Draw to paint device. More...
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget)
 Reimplementation of QCanvasItem::paint - draw on canvas. More...
 
void cache ()
 Create cache image. More...
 
int id () const
 Get identification number. More...
 
bool isDrawing () const
 True if a draw is already in progress. More...
 
void resize (double dx, double dy)
 resizes an item in x- and y direction (canvas coordinates) More...
 
void moveContent (double dx, double dy)
 Move content of map. More...
 
void zoomContent (int delta, double x, double y)
 Zoom content of map. More...
 
void setSceneRect (const QRectF &rectangle)
 Sets new scene rectangle bounds and recalculates hight and extent. More...
 
double scale () const
 Scale. More...
 
void setNewScale (double scaleDenominator, bool forceUpdate=true)
 Sets new scale and changes only mExtent. More...
 
void setNewExtent (const QgsRectangle &extent)
 Sets new Extent and changes width, height (and implicitely also scale) More...
 
void setNewAtlasFeatureExtent (const QgsRectangle &extent)
 Sets new Extent for the current atlas preview and changes width, height (and implicitely also scale). More...
 
void toggleAtlasPreview ()
 Called when atlas preview is toggled, to force map item to update its extent and redraw. More...
 
QgsRectanglecurrentMapExtent ()
 Returns a pointer to the current map extent, which is either the original user specified extent or the temporary atlas-driven feature extent depending on the current atlas state of the composition. More...
 
const QgsRectanglecurrentMapExtent () const
 
PreviewMode previewMode () const
 
void setPreviewMode (PreviewMode m)
 
bool keepLayerSet () const
 Getter for flag that determines if the stored layer set should be used or the current layer set of the qgis mapcanvas. More...
 
void setKeepLayerSet (bool enabled)
 Setter for flag that determines if the stored layer set should be used or the current layer set of the qgis mapcanvas. More...
 
QStringList layerSet () const
 Getter for stored layer set that is used if mKeepLayerSet is true. More...
 
void setLayerSet (const QStringList &layerSet)
 Setter for stored layer set that is used if mKeepLayerSet is true. More...
 
void storeCurrentLayerSet ()
 Stores the current layer set of the qgis mapcanvas in mLayerSet. More...
 
void setCacheUpdated (bool u=false)
 
QgsRectangle extent () const
 
Q_DECL_DEPRECATED const
QgsMapRenderer
mapRenderer () const
 
void setOffset (double xOffset, double yOffset)
 Sets offset values to shift image (useful for live updates when moving item content) More...
 
bool containsWMSLayer () const
 True if composer map renders a WMS layer. More...
 
bool containsAdvancedEffects () const
 True if composer map contains layers with blend modes or flattened layers for vectors. More...
 
bool writeXML (QDomElement &elem, QDomDocument &doc) const
 stores state in Dom node More...
 
bool readXML (const QDomElement &itemElem, const QDomDocument &doc)
 sets state from Dom document More...
 
void setGridEnabled (bool enabled)
 Enables a coordinate grid that is shown on top of this composermap. More...
 
bool gridEnabled () const
 
void setGridStyle (GridStyle style)
 Sets coordinate grid style to solid or cross. More...
 
GridStyle gridStyle () const
 
void setGridIntervalX (double interval)
 Sets coordinate interval in x-direction for composergrid. More...
 
double gridIntervalX () const
 
void setGridIntervalY (double interval)
 Sets coordinate interval in y-direction for composergrid. More...
 
double gridIntervalY () const
 
void setGridOffsetX (double offset)
 Sets x-coordinate offset for composer grid. More...
 
double gridOffsetX () const
 
void setGridOffsetY (double offset)
 Sets y-coordinate offset for composer grid. More...
 
double gridOffsetY () const
 
void setGridPen (const QPen &p)
 Sets the pen to draw composer grid. More...
 
QPen gridPen () const
 
void setGridPenWidth (double w)
 Sets with of grid pen. More...
 
void setGridPenColor (const QColor &c)
 Sets the color of the grid pen. More...
 
void setGridAnnotationFont (const QFont &f)
 Sets font for grid annotations. More...
 
QFont gridAnnotationFont () const
 
void setAnnotationFontColor (const QColor &c)
 Sets font color for grid annotations. More...
 
QColor annotationFontColor () const
 Get font color for grid annotations. More...
 
void setGridAnnotationPrecision (int p)
 Sets coordinate precision for grid annotations. More...
 
int gridAnnotationPrecision () const
 
void setShowGridAnnotation (bool show)
 Sets flag if grid annotation should be shown. More...
 
bool showGridAnnotation () const
 
void setGridAnnotationPosition (GridAnnotationPosition p, QgsComposerMap::Border border)
 
GridAnnotationPosition gridAnnotationPosition (QgsComposerMap::Border border) const
 
void setAnnotationFrameDistance (double d)
 Sets distance between map frame and annotations. More...
 
double annotationFrameDistance () const
 
void setGridAnnotationDirection (GridAnnotationDirection d, QgsComposerMap::Border border)
 
GridAnnotationDirection gridAnnotationDirection (QgsComposerMap::Border border) const
 
void setGridAnnotationFormat (GridAnnotationFormat f)
 
GridAnnotationFormat gridAnnotationFormat () const
 
void setGridFrameStyle (GridFrameStyle style)
 Set grid frame style (NoGridFrame or Zebra) More...
 
GridFrameStyle gridFrameStyle () const
 
void setGridFrameWidth (double w)
 Set grid frame width. More...
 
double gridFrameWidth () const
 
void setGridFramePenSize (double w)
 Set grid frame pen thickness. More...
 
double gridFramePenSize () const
 
void setGridFramePenColor (const QColor &c)
 Sets pen color for grid frame. More...
 
QColor gridFramePenColor () const
 Get pen color for grid frame. More...
 
void setGridFrameFillColor1 (const QColor &c)
 Sets first fill color for grid zebra frame. More...
 
QColor gridFrameFillColor1 () const
 Get first fill color for grid zebra frame. More...
 
void setGridFrameFillColor2 (const QColor &c)
 Sets second fill color for grid zebra frame. More...
 
QColor gridFrameFillColor2 () const
 Get second fill color for grid zebra frame. More...
 
void setCrossLength (double l)
 Sets length of the cros segments (if grid style is cross) More...
 
double crossLength ()
 
QRectF boundingRect () const
 In case of annotations, the bounding rectangle can be larger than the map item rectangle. More...
 
void updateBoundingRect ()
 Updates the bounding rect of this item. More...
 
virtual void setFrameOutlineWidth (const double outlineWidth)
 Sets frame outline width. More...
 
Q_DECL_DEPRECATED void setRotation (double r)
 Sets rotation for the map - this does not affect the composer item shape, only the way the map is drawn within the item. More...
 
Q_DECL_DEPRECATED double rotation () const
 Returns the rotation used for drawing the map within the composer item. More...
 
void setMapRotation (double r)
 Sets rotation for the map - this does not affect the composer item shape, only the way the map is drawn within the item. More...
 
double mapRotation (QgsComposerObject::PropertyValueType valueType=QgsComposerObject::EvaluatedValue) const
 Returns the rotation used for drawing the map within the composer item. More...
 
void updateItem ()
 Updates item, with the possibility to do custom update for subclasses. More...
 
void setMapCanvas (QGraphicsView *canvas)
 Sets canvas pointer (necessary to query and draw map canvas items) More...
 
void setDrawCanvasItems (bool b)
 
bool drawCanvasItems () const
 
double mapUnitsToMM () const
 Returns the conversion factor map units -> mm. More...
 
void setOverviewFrameMap (int mapId)
 Sets overview frame map. More...
 
int overviewFrameMapId () const
 Returns id of overview frame (or -1 if no overfiew frame) More...
 
void setOverviewFrameMapSymbol (QgsFillSymbolV2 *symbol)
 
QgsFillSymbolV2overviewFrameMapSymbol ()
 
QPainter::CompositionMode overviewBlendMode () const
 Returns the overview's blending mode. More...
 
void setOverviewBlendMode (QPainter::CompositionMode blendMode)
 Sets the overview's blending mode. More...
 
bool overviewInverted () const
 Returns true if the overview frame is inverted. More...
 
void setOverviewInverted (bool inverted)
 Sets the overview's inversion mode. More...
 
bool overviewCentered () const
 Returns true if the extent is forced to center on the overview. More...
 
void setOverviewCentered (bool centered)
 Set the overview's centering mode. More...
 
void setGridLineSymbol (QgsLineSymbolV2 *symbol)
 
QgsLineSymbolV2gridLineSymbol ()
 
QPainter::CompositionMode gridBlendMode () const
 Returns the grid's blending mode. More...
 
void setGridBlendMode (QPainter::CompositionMode blendMode)
 Sets the grid's blending mode. More...
 
void assignFreeId ()
 Sets mId to a number not yet used in the composition. More...
 
Q_DECL_DEPRECATED bool imageSizeConsideringRotation (double &width, double &height) const
 Calculates width and hight of the picture (in mm) such that it fits into the item frame with the given rotation. More...
 
Q_DECL_DEPRECATED bool cornerPointOnRotatedAndScaledRect (double &x, double &y, double width, double height) const
 Calculates corner point after rotation and scaling. More...
 
Q_DECL_DEPRECATED void sizeChangedByRotation (double &width, double &height)
 Calculates width / height of the bounding box of a rotated rectangle. More...
 
bool atlasDriven () const
 Returns whether the map extent is set to follow the current atlas feature. More...
 
void setAtlasDriven (bool enabled)
 Sets whether the map extent will follow the current atlas feature. More...
 
Q_DECL_DEPRECATED bool atlasFixedScale () const
 Returns true if the map uses a fixed scale when in atlas mode. More...
 
Q_DECL_DEPRECATED void setAtlasFixedScale (bool fixed)
 Set to true if the map should use a fixed scale when in atlas mode. More...
 
AtlasScalingMode atlasScalingMode () const
 Returns the current atlas scaling mode. More...
 
void setAtlasScalingMode (AtlasScalingMode mode)
 Sets the current atlas scaling mode. More...
 
double atlasMargin () const
 Returns the margin size (percentage) used when the map is in atlas mode. More...
 
void setAtlasMargin (double margin)
 Sets the margin size (percentage) used when the map is in atlas mode. More...
 
void setUpdatesEnabled (bool enabled)
 Sets whether updates to the composer map are enabled. More...
 
bool updatesEnabled () const
 Returns whether updates to the composer map are enabled. More...
 
int numberExportLayers () const
 Get the number of layers that this item requires for exporting as layers. More...
 
QPolygonF visibleExtentPolygon () const
 Returns a polygon representing the current visible map extent, considering map extents and rotation. More...
 
virtual QString displayName () const
 Get item display name. More...
 
void addGrid (QgsComposerMapGrid *grid)
 Adds new map grid (takes ownership) More...
 
void removeGrid (const QString &name)
 
void moveGridUp (const QString &name)
 
void moveGridDown (const QString &name)
 
const QgsComposerMapGridconstMapGrid (const QString &id) const
 
QgsComposerMapGridmapGrid (const QString &id) const
 
QList< const QgsComposerMapGrid * > mapGrids () const
 
int gridCount () const
 
void addOverview (QgsComposerMapOverview *overview)
 Adds new map overview (takes ownership) More...
 
void removeOverview (const QString &name)
 
void moveOverviewUp (const QString &name)
 
void moveOverviewDown (const QString &name)
 
const QgsComposerMapOverviewconstMapOverview (const QString &id) const
 
QgsComposerMapOverviewmapOverview (const QString &id) const
 
QList< QgsComposerMapOverview * > mapOverviews () const
 
int overviewCount () const
 
QPolygonF transformedMapPolygon () const
 Returns extent that considers rotation and shift with mOffsetX / mOffsetY. More...
 
QPointF mapToItemCoords (const QPointF &mapCoords) const
 Transforms map coordinates to item coordinates (considering rotation and move offset) More...
 
void connectMapOverviewSignals ()
 
- Public Member Functions inherited from QgsComposerItem
 QgsComposerItem (QgsComposition *composition, bool manageZValue=true)
 Constructor. More...
 
 QgsComposerItem (qreal x, qreal y, qreal width, qreal height, QgsComposition *composition, bool manageZValue=true)
 Constructor with box position and composer object. More...
 
virtual ~QgsComposerItem ()
 
virtual void setSelected (bool s)
 Set selected, selected item should be highlighted. More...
 
virtual bool selected () const
 Is selected. More...
 
void move (double dx, double dy)
 Moves item in canvas coordinates. More...
 
int page () const
 Gets the page the item is currently on. More...
 
QPointF pagePos () const
 Returns the item's position relative to its current page. More...
 
void updatePagePos (double newPageWidth, double newPageHeight)
 Moves the item so that it retains its relative position on the page when the paper size changes. More...
 
void setItemPosition (double x, double y, ItemPositionMode itemPoint=UpperLeft, int page=-1)
 Moves the item to a new position (in canvas coordinates) More...
 
void setItemPosition (double x, double y, double width, double height, ItemPositionMode itemPoint=UpperLeft, bool posIncludesFrame=false, int page=-1)
 Sets item position and width / height in one go. More...
 
ItemPositionMode lastUsedPositionMode ()
 Returns item's last used position mode. More...
 
bool _writeXML (QDomElement &itemElem, QDomDocument &doc) const
 Writes parameter that are not subclass specific in document. More...
 
bool _readXML (const QDomElement &itemElem, const QDomDocument &doc)
 Reads parameter that are not subclass specific in document. More...
 
bool hasFrame () const
 Whether this item has a frame or not. More...
 
void setFrameEnabled (const bool drawFrame)
 Set whether this item has a frame drawn around it or not. More...
 
double frameOutlineWidth () const
 Returns the frame's outline width. More...
 
Qt::PenJoinStyle frameJoinStyle () const
 Returns the join style used for drawing the item's frame. More...
 
void setFrameJoinStyle (const Qt::PenJoinStyle style)
 Sets join style used when drawing the item's frame. More...
 
virtual double estimatedFrameBleed () const
 Returns the estimated amount the item's frame bleeds outside the item's actual rectangle. More...
 
virtual QRectF rectWithFrame () const
 Returns the item's rectangular bounds, including any bleed caused by the item's frame. More...
 
bool hasBackground () const
 Whether this item has a Background or not. More...
 
void setBackgroundEnabled (const bool drawBackground)
 Set whether this item has a Background drawn around it or not. More...
 
QColor backgroundColor () const
 Gets the background color for this item. More...
 
void setBackgroundColor (const QColor &backgroundColor)
 Sets the background color for this item. More...
 
QPainter::CompositionMode blendMode () const
 Returns the item's composition blending mode. More...
 
void setBlendMode (const QPainter::CompositionMode blendMode)
 Sets the item's composition blending mode. More...
 
int transparency () const
 Returns the item's transparency. More...
 
void setTransparency (const int transparency)
 Sets the item's transparency. More...
 
bool effectsEnabled () const
 Returns whether effects (eg blend modes) are enabled for the item. More...
 
void setEffectsEnabled (const bool effectsEnabled)
 Sets whether effects (eg blend modes) are enabled for the item. More...
 
virtual void addItem (QgsComposerItem *item)
 Composite operations for item groups do nothing per default. More...
 
virtual void removeItems ()
 
virtual void beginItemCommand (const QString &text)
 
void beginCommand (const QString &commandText, QgsComposerMergeCommand::Context c=QgsComposerMergeCommand::Unknown)
 Starts new composer undo command. More...
 
virtual void endItemCommand ()
 
void endCommand ()
 Finish current command and push it onto the undo stack. More...
 
void cancelCommand ()
 
Q_DECL_DEPRECATED void drawText (QPainter *p, double x, double y, const QString &text, const QFont &font, const QColor &c=QColor()) const
 Draws Text. More...
 
Q_DECL_DEPRECATED void drawText (QPainter *p, const QRectF &rect, const QString &text, const QFont &font, Qt::AlignmentFlag halignment=Qt::AlignLeft, Qt::AlignmentFlag valignment=Qt::AlignTop, int flags=Qt::TextWordWrap) const
 Like the above, but with a rectangle for multiline text. More...
 
Q_DECL_DEPRECATED double textWidthMillimeters (const QFont &font, const QString &text) const
 Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. More...
 
Q_DECL_DEPRECATED double fontHeightCharacterMM (const QFont &font, const QChar &c) const
 Returns the font height of a character in millimeters. More...
 
Q_DECL_DEPRECATED double fontAscentMillimeters (const QFont &font) const
 Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. More...
 
Q_DECL_DEPRECATED double fontDescentMillimeters (const QFont &font) const
 Returns the font descent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. More...
 
Q_DECL_DEPRECATED double fontHeightMillimeters (const QFont &font) const
 Returns the font height in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. More...
 
Q_DECL_DEPRECATED double pixelFontSize (double pointSize) const
 Calculates font size in mm from a font point size. More...
 
Q_DECL_DEPRECATED QFont scaledFontPixelSize (const QFont &font) const
 Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE. More...
 
void setPositionLock (const bool lock)
 Locks / unlocks the item position for mouse drags. More...
 
bool positionLock () const
 Returns whether position lock for mouse drags is enabled returns true if item is locked for mouse movement and resizing. More...
 
double itemRotation (const QgsComposerObject::PropertyValueType valueType=QgsComposerObject::EvaluatedValue) const
 Returns the current rotation for the composer item. More...
 
Q_DECL_DEPRECATED double rotation () const
 Returns the rotation for the composer item. More...
 
QString id () const
 Get item's id (which is not necessarly unique) More...
 
virtual void setId (const QString &id)
 Set item's id (which is not necessarly unique) More...
 
QString uuid () const
 Get item identification name. More...
 
virtual void setVisibility (const bool visible)
 Sets visibility for item. More...
 
bool isGroupMember () const
 Returns whether this item is part of a group. More...
 
void setIsGroupMember (const bool isGroupMember)
 Sets whether this item is part of a group. More...
 
virtual void setCurrentExportLayer (const int layerIdx=-1)
 Sets the current layer to draw for exporting. More...
 
- Public Member Functions inherited from QgsComposerObject
 QgsComposerObject (QgsComposition *composition)
 Constructor. More...
 
virtual ~QgsComposerObject ()
 
const QgsCompositioncomposition () const
 Returns the composition the item is attached to. More...
 
QgsCompositioncomposition ()
 
QgsDataDefineddataDefinedProperty (const DataDefinedProperty property) const
 Returns a reference to the data defined settings for one of the item's data defined properties. More...
 
void setDataDefinedProperty (const DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field)
 Sets parameters for a data defined property for the item. More...
 

Private Types

enum  PartType {
  Background, Layer, Grid, OverviewMapExtent,
  Frame, SelectionBoxes
}
 

Private Member Functions

void connectUpdateSlot ()
 Establishes signal/slot connection for update in case of layer change. More...
 
void syncLayerSet ()
 Removes layer ids from mLayerSet that are no longer present in the qgis main map. More...
 
QgsComposerMapGridfirstMapGrid ()
 Returns first map grid or creates an empty one if none. More...
 
const QgsComposerMapGridconstFirstMapGrid () const
 
void removeGrids ()
 
void drawGrids (QPainter *p)
 
QgsComposerMapOverviewfirstMapOverview ()
 Returns first map overview or creates an empty one if none. More...
 
const QgsComposerMapOverviewconstFirstMapOverview () const
 
void removeOverviews ()
 
void drawOverviews (QPainter *p)
 
void adjustExtentToItemShape (double itemWidth, double itemHeight, QgsRectangle &extent) const
 Adjusts an extent rectangle to match the provided item width and height, so that extent center of extent remains the same. More...
 
void init ()
 
QStringList layersToRender () const
 Returns a list of the layers to render for this map item. More...
 
QgsRectangle transformedExtent () const
 Returns extent that considers mOffsetX / mOffsetY (during content move) More...
 
void mapPolygon (const QgsRectangle &extent, QPolygonF &poly) const
 mapPolygon variant using a given extent More...
 
void requestedExtent (QgsRectangle &extent)
 Calculates the extent to request and the yShift of the top-left point in case of rotation. More...
 
void transformShift (double &xShift, double &yShift) const
 Scales a composer map shift (in MM) and rotates it by mRotation. More...
 
Border borderForLineCoord (const QPointF &p) const
 Returns the item border of a point (in item coordinates) More...
 
void drawCanvasItems (QPainter *painter, const QStyleOptionGraphicsItem *itemStyle)
 
void drawCanvasItem (QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *itemStyle)
 
QPointF composerMapPosForItem (const QGraphicsItem *item) const
 
bool shouldDrawPart (PartType part) const
 Test if a part of the copmosermap needs to be drawn, considering mCurrentExportLayer. More...
 
void refreshMapExtents ()
 Refresh the map's extents, considering data defined extent, scale and rotation. More...
 

Private Attributes

int mId
 Unique identifier. More...
 
QgsRectangle mExtent
 
QgsRectangle mAtlasFeatureExtent
 
QImage mCacheImage
 
bool mCacheUpdated
 
PreviewMode mPreviewMode
 Preview style. More...
 
int mNumCachedLayers
 Number of layers when cache was created. More...
 
bool mDrawing
 set to true if in state of drawing. More...
 
double mXOffset
 Offset in x direction for showing map cache image. More...
 
double mYOffset
 Offset in y direction for showing map cache image. More...
 
double mMapRotation
 Map rotation. More...
 
double mEvaluatedMapRotation
 Temporary evaluated map rotation. More...
 
bool mKeepLayerSet
 Flag if layers to be displayed should be read from qgis canvas (true) or from stored list in mLayerSet (false) More...
 
QStringList mLayerSet
 Stored layer list (used if layer live-link mKeepLayerSet is disabled) More...
 
bool mUpdatesEnabled
 Whether updates to the map are enabled. More...
 
QRectF mCurrentRectangle
 Current bounding rectangle. More...
 
QGraphicsView * mMapCanvas
 
bool mDrawCanvasItems
 True if annotation items, rubber band, etc. More...
 
QList< QgsComposerMapGrid * > mGrids
 
QList< QgsComposerMapOverview * > mOverviews
 
bool mAtlasDriven
 True if map is being controlled by an atlas. More...
 
AtlasScalingMode mAtlasScalingMode
 Current atlas scaling mode. More...
 
double mAtlasMargin
 Margin size for atlas driven extents (percentage of feature size) - when in auto scaling mode. More...
 

Friends

class QgsComposerMapOverview
 

Additional Inherited Members

- Protected Member Functions inherited from QgsComposerItem
virtual void drawSelectionBoxes (QPainter *p)
 Draw selection boxes around item. More...
 
virtual void drawFrame (QPainter *p)
 Draw black frame around item. More...
 
virtual void drawBackground (QPainter *p)
 Draw background. More...
 
Q_DECL_DEPRECATED void drawArrowHead (QPainter *p, double x, double y, double angle, double arrowHeadWidth) const
 Draws arrowhead. More...
 
Q_DECL_DEPRECATED double angle (const QPointF &p1, const QPointF &p2) const
 Returns angle of the line from p1 to p2 (clockwise, starting at N) More...
 
double rectHandlerBorderTolerance () const
 Returns the current (zoom level dependent) tolerance to decide if mouse position is close enough to the item border for resizing. More...
 
double lockSymbolSize () const
 Returns the size of the lock symbol depending on the composer zoom level and the item size. More...
 
double horizontalViewScaleFactor () const
 Returns the zoom factor of the graphics view. More...
 
Q_DECL_DEPRECATED bool imageSizeConsideringRotation (double &width, double &height, double rotation) const
 Calculates width and hight of the picture (in mm) such that it fits into the item frame with the given rotation. More...
 
Q_DECL_DEPRECATED bool imageSizeConsideringRotation (double &width, double &height) const
 Calculates width and hight of the picture (in mm) such that it fits into the item frame with the given rotation. More...
 
Q_DECL_DEPRECATED QRectF largestRotatedRectWithinBounds (QRectF originalRect, QRectF boundsRect, double rotation) const
 Calculates the largest scaled version of originalRect which fits within boundsRect, when it is rotated by a specified amount. More...
 
Q_DECL_DEPRECATED bool cornerPointOnRotatedAndScaledRect (double &x, double &y, double width, double height, double rotation) const
 Calculates corner point after rotation and scaling. More...
 
Q_DECL_DEPRECATED bool cornerPointOnRotatedAndScaledRect (double &x, double &y, double width, double height) const
 Calculates corner point after rotation and scaling. More...
 
Q_DECL_DEPRECATED void sizeChangedByRotation (double &width, double &height, double rotation)
 Calculates width / height of the bounding box of a rotated rectangle. More...
 
Q_DECL_DEPRECATED void sizeChangedByRotation (double &width, double &height)
 Calculates width / height of the bounding box of a rotated rectangle. More...
 
Q_DECL_DEPRECATED void rotate (double angle, double &x, double &y) const
 Rotates a point / vector. More...
 
QGraphicsLineItem * hAlignSnapItem ()
 Return horizontal align snap item. More...
 
void deleteHAlignSnapItem ()
 
QGraphicsLineItem * vAlignSnapItem ()
 Return vertical align snap item. More...
 
void deleteVAlignSnapItem ()
 
void deleteAlignItems ()
 
QRectF evalItemRect (const QRectF &newRect)
 Update an item rect to consider data defined position and size of item. More...
 
- Protected Member Functions inherited from QgsComposerObject
bool dataDefinedEvaluate (const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue)
 Evaluate a data defined property and return the calculated value. More...
 
- Protected Attributes inherited from QgsComposerItem
QgsComposerItem::MouseMoveAction mCurrentMouseMoveAction
 
QPointF mMouseMoveStartPos
 Start point of the last mouse move action (in scene coordinates) More...
 
QPointF mLastMouseEventPos
 Position of the last mouse move event (in scene coordinates) More...
 
QGraphicsRectItem * mBoundingResizeRectangle
 Rectangle used during move and resize actions. More...
 
QGraphicsLineItem * mHAlignSnapItem
 
QGraphicsLineItem * mVAlignSnapItem
 
bool mFrame
 True if item fram needs to be painted. More...
 
bool mBackground
 True if item background needs to be painted. More...
 
QColor mBackgroundColor
 Background color. More...
 
Qt::PenJoinStyle mFrameJoinStyle
 Frame join style. More...
 
bool mItemPositionLocked
 True if item position and size cannot be changed with mouse move. More...
 
double mLastValidViewScaleFactor
 Backup to restore item appearance if no view scale factor is available. More...
 
double mItemRotation
 Item rotation in degrees, clockwise. More...
 
double mEvaluatedItemRotation
 Temporary evaluated item rotation in degrees, clockwise. More...
 
QPainter::CompositionMode mBlendMode
 Composition blend mode for item. More...
 
bool mEffectsEnabled
 
QgsComposerEffectmEffect
 
int mTransparency
 Item transparency. More...
 
ItemPositionMode mLastUsedPositionMode
 The item's position mode. More...
 
bool mIsGroupMember
 Whether or not this item is part of a group. More...
 
int mCurrentExportLayer
 The layer that needs to be exported. More...
 
- Protected Attributes inherited from QgsComposerObject
QgsCompositionmComposition
 
QMap
< QgsComposerObject::DataDefinedProperty,
QString > 
mDataDefinedNames
 Map of data defined properties for the item to string name to use when exporting item to xml. More...
 

Detailed Description

Object representing map window.

Definition at line 44 of file qgscomposermap.h.

Member Enumeration Documentation

Enumerator
Longitude 
Latitude 

Definition at line 110 of file qgscomposermap.h.

Scaling modes used for the serial rendering (atlas)

Enumerator
Fixed 
Predefined 
Auto 

Definition at line 118 of file qgscomposermap.h.

Enum for different frame borders.

Enumerator
Left 
Right 
Bottom 
Top 

Definition at line 102 of file qgscomposermap.h.

Enumerator
Horizontal 
Vertical 
HorizontalAndVertical 
BoundaryDirection 

Definition at line 80 of file qgscomposermap.h.

Enumerator
Decimal 
DegreeMinute 
DegreeMinuteSecond 

Definition at line 88 of file qgscomposermap.h.

Enumerator
InsideMapFrame 
OutsideMapFrame 
Disabled 

Definition at line 73 of file qgscomposermap.h.

Enumerator
NoGridFrame 
Zebra 

Definition at line 95 of file qgscomposermap.h.

Enumerator
Solid 
Cross 
Markers 

Definition at line 66 of file qgscomposermap.h.

Enumerator
Background 
Layer 
Grid 
OverviewMapExtent 
Frame 
SelectionBoxes 

Definition at line 717 of file qgscomposermap.h.

Preview style.

Enumerator
Cache 
Render 
Rectangle 

Definition at line 59 of file qgscomposermap.h.

Constructor & Destructor Documentation

QgsComposerMap::QgsComposerMap ( QgsComposition composition,
int  x,
int  y,
int  width,
int  height 
)
QgsComposerMap::QgsComposerMap ( QgsComposition composition)
QgsComposerMap::~QgsComposerMap ( )
virtual

Definition at line 150 of file qgscomposermap.cpp.

References removeGrids(), and removeOverviews().

Member Function Documentation

void QgsComposerMap::addGrid ( QgsComposerMapGrid grid)

Adds new map grid (takes ownership)

Definition at line 1926 of file qgscomposermap.cpp.

References mGrids, and updateBoundingRect().

void QgsComposerMap::addOverview ( QgsComposerMapOverview overview)

Adds new map overview (takes ownership)

Definition at line 2016 of file qgscomposermap.cpp.

References mOverviews.

void QgsComposerMap::adjustExtentToItemShape ( double  itemWidth,
double  itemHeight,
QgsRectangle extent 
) const
private

Adjusts an extent rectangle to match the provided item width and height, so that extent center of extent remains the same.

Definition at line 127 of file qgscomposermap.cpp.

References QgsRectangle::height(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), QgsRectangle::width(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().

QColor QgsComposerMap::annotationFontColor ( ) const

Get font color for grid annotations.

Note
: this function was added in version 2.0

Definition at line 1554 of file qgscomposermap.cpp.

References constFirstMapGrid(), and QgsComposerMapGrid::gridAnnotationFontColor().

double QgsComposerMap::annotationFrameDistance ( ) const
void QgsComposerMap::assignFreeId ( )

Sets mId to a number not yet used in the composition.

mId is kept if it is not in use. Usually, this function is called before adding the composer map to the composition

Definition at line 2409 of file qgscomposermap.cpp.

References QgsComposition::composerMapItems(), QgsComposition::getComposerMapById(), QgsComposerObject::mComposition, and mId.

Referenced by QgsComposition::addItemsFromXML(), and QgsComposerMap().

bool QgsComposerMap::atlasDriven ( ) const
inline

Returns whether the map extent is set to follow the current atlas feature.

Returns
true if map will follow the current atlas feature.
See also
setAtlasDriven
atlasScalingMode

Definition at line 466 of file qgscomposermap.h.

Referenced by QgsAtlasComposition::composerMap(), QgsAtlasComposition::prepareForFeature(), QgsAtlasComposition::prepareMap(), QgsComposition::setAtlasMode(), and QgsAtlasComposition::updateAtlasMaps().

bool QgsComposerMap::atlasFixedScale ( ) const

Returns true if the map uses a fixed scale when in atlas mode.

Deprecated:
since 2.4 Use atlasScalingMode() instead

Definition at line 2471 of file qgscomposermap.cpp.

References Fixed, and mAtlasScalingMode.

Referenced by QgsAtlasComposition::fixedScale().

double QgsComposerMap::atlasMargin ( ) const
inline

Returns the margin size (percentage) used when the map is in atlas mode.

Returns
margin size in percentage to leave around the atlas feature's extent
Note
this is only used if atlasScalingMode() is Auto.
See also
atlasScalingMode
setAtlasMargin

Definition at line 511 of file qgscomposermap.h.

Referenced by QgsAtlasComposition::margin(), and QgsAtlasComposition::prepareMap().

AtlasScalingMode QgsComposerMap::atlasScalingMode ( ) const
inline

Returns the current atlas scaling mode.

This controls how the map's extents are calculated for the current atlas feature when an atlas composition is enabled.

Returns
the current scaling mode
Note
this parameter is only used if atlasDriven() is true
See also
setAtlasScalingMode
atlasDriven

Definition at line 493 of file qgscomposermap.h.

Referenced by QgsAtlasComposition::prepareMap().

QgsComposerMap::Border QgsComposerMap::borderForLineCoord ( const QPointF &  p) const
private

Returns the item border of a point (in item coordinates)

Definition at line 2280 of file qgscomposermap.cpp.

References Bottom, Left, Right, and Top.

QRectF QgsComposerMap::boundingRect ( ) const

In case of annotations, the bounding rectangle can be larger than the map item rectangle.

Note
this function was added in version 1.4

Definition at line 1809 of file qgscomposermap.cpp.

References mCurrentRectangle.

void QgsComposerMap::cache ( void  )
QPointF QgsComposerMap::composerMapPosForItem ( const QGraphicsItem *  item) const
private
void QgsComposerMap::connectMapOverviewSignals ( )

Definition at line 2105 of file qgscomposermap.cpp.

References mOverviews.

void QgsComposerMap::connectUpdateSlot ( )
private

Establishes signal/slot connection for update in case of layer change.

Definition at line 1068 of file qgscomposermap.cpp.

References QgsMapLayerRegistry::instance(), and updateCachedImage().

Referenced by init().

const QgsComposerMapGrid * QgsComposerMap::constFirstMapGrid ( ) const
private
const QgsComposerMapOverview * QgsComposerMap::constFirstMapOverview ( ) const
private
const QgsComposerMapGrid * QgsComposerMap::constMapGrid ( const QString &  id) const

Definition at line 1977 of file qgscomposermap.cpp.

References id(), and mGrids.

const QgsComposerMapOverview * QgsComposerMap::constMapOverview ( const QString &  id) const

Definition at line 2066 of file qgscomposermap.cpp.

References id(), and mOverviews.

bool QgsComposerMap::containsAdvancedEffects ( ) const
bool QgsComposerMap::containsWMSLayer ( ) const
bool QgsComposerMap::cornerPointOnRotatedAndScaledRect ( double &  x,
double &  y,
double  width,
double  height 
) const

Calculates corner point after rotation and scaling.

Deprecated:
Use QgsComposerItem::cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height, double rotation ) instead

Definition at line 2443 of file qgscomposermap.cpp.

References QgsComposerItem::cornerPointOnRotatedAndScaledRect(), mEvaluatedMapRotation, Q_NOWARN_DEPRECATED_POP, and Q_NOWARN_DEPRECATED_PUSH.

double QgsComposerMap::crossLength ( )

Definition at line 1710 of file qgscomposermap.cpp.

References constFirstMapGrid(), and QgsComposerMapGrid::crossLength().

QgsRectangle * QgsComposerMap::currentMapExtent ( )
const QgsRectangle * QgsComposerMap::currentMapExtent ( ) const
QString QgsComposerMap::displayName ( ) const
virtual

Get item display name.

This is the item's id if set, and if not, a user-friendly string identifying item type.

Returns
display name for item
See also
id
setId
Note
added in version 2.5

Reimplemented from QgsComposerItem.

Definition at line 1916 of file qgscomposermap.cpp.

References QgsComposerItem::id(), mId, and tr.

void QgsComposerMap::draw ( QPainter *  painter,
const QgsRectangle extent,
const QSizeF &  size,
double  dpi,
double *  forceWidthScale = 0 
)
void QgsComposerMap::drawCanvasItem ( QGraphicsItem *  item,
QPainter *  painter,
const QStyleOptionGraphicsItem *  itemStyle 
)
private

Definition at line 2326 of file qgscomposermap.cpp.

References composerMapPosForItem(), and mMapCanvas.

Referenced by drawCanvasItems().

bool QgsComposerMap::drawCanvasItems ( ) const
inline

Definition at line 403 of file qgscomposermap.h.

Referenced by paint().

void QgsComposerMap::drawCanvasItems ( QPainter *  painter,
const QStyleOptionGraphicsItem *  itemStyle 
)
private

Definition at line 2300 of file qgscomposermap.cpp.

References drawCanvasItem(), mDrawCanvasItems, and mMapCanvas.

void QgsComposerMap::drawGrids ( QPainter *  p)
private

Definition at line 1722 of file qgscomposermap.cpp.

References mGrids.

Referenced by paint().

void QgsComposerMap::drawOverviews ( QPainter *  p)
private

Definition at line 1752 of file qgscomposermap.cpp.

References mOverviews.

Referenced by paint().

QgsRectangle QgsComposerMap::extent ( ) const
inline
void QgsComposerMap::extentChanged ( )
signal
QgsComposerMapGrid * QgsComposerMap::firstMapGrid ( )
private
QgsComposerMapOverview * QgsComposerMap::firstMapOverview ( )
private

Returns first map overview or creates an empty one if none.

Definition at line 1731 of file qgscomposermap.cpp.

References mOverviews, QgsComposerMapOverview, and tr.

Referenced by constFirstMapOverview(), overviewFrameMapSymbol(), setOverviewBlendMode(), setOverviewCentered(), setOverviewFrameMap(), setOverviewFrameMapSymbol(), and setOverviewInverted().

QgsComposerMap::GridAnnotationDirection QgsComposerMap::gridAnnotationDirection ( QgsComposerMap::Border  border) const
QFont QgsComposerMap::gridAnnotationFont ( ) const
QgsComposerMap::GridAnnotationFormat QgsComposerMap::gridAnnotationFormat ( ) const
QgsComposerMap::GridAnnotationPosition QgsComposerMap::gridAnnotationPosition ( QgsComposerMap::Border  border) const
int QgsComposerMap::gridAnnotationPrecision ( ) const
QPainter::CompositionMode QgsComposerMap::gridBlendMode ( ) const

Returns the grid's blending mode.

Definition at line 1803 of file qgscomposermap.cpp.

References QgsComposerMapGrid::blendMode(), and constFirstMapGrid().

int QgsComposerMap::gridCount ( ) const
inline

Definition at line 554 of file qgscomposermap.h.

Referenced by readXML().

bool QgsComposerMap::gridEnabled ( ) const

Definition at line 2241 of file qgscomposermap.cpp.

References constFirstMapGrid(), and QgsComposerMapGrid::gridEnabled().

QColor QgsComposerMap::gridFrameFillColor1 ( ) const

Get first fill color for grid zebra frame.

Note
: this function was added in version 2.1

Definition at line 1686 of file qgscomposermap.cpp.

References constFirstMapGrid(), and QgsComposerMapGrid::gridFrameFillColor1().

QColor QgsComposerMap::gridFrameFillColor2 ( ) const

Get second fill color for grid zebra frame.

Note
: this function was added in version 2.1

Definition at line 1698 of file qgscomposermap.cpp.

References constFirstMapGrid(), and QgsComposerMapGrid::gridFrameFillColor2().

QColor QgsComposerMap::gridFramePenColor ( ) const

Get pen color for grid frame.

Note
: this function was added in version 2.1

Definition at line 1674 of file qgscomposermap.cpp.

References constFirstMapGrid(), and QgsComposerMapGrid::gridFramePenColor().

double QgsComposerMap::gridFramePenSize ( ) const
QgsComposerMap::GridFrameStyle QgsComposerMap::gridFrameStyle ( ) const
double QgsComposerMap::gridFrameWidth ( ) const
double QgsComposerMap::gridIntervalX ( ) const
double QgsComposerMap::gridIntervalY ( ) const
QgsLineSymbolV2 * QgsComposerMap::gridLineSymbol ( )

Definition at line 2229 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::gridLineSymbol().

double QgsComposerMap::gridOffsetX ( ) const

Definition at line 1494 of file qgscomposermap.cpp.

References constFirstMapGrid(), and QgsComposerMapGrid::gridOffsetX().

double QgsComposerMap::gridOffsetY ( ) const

Definition at line 1506 of file qgscomposermap.cpp.

References constFirstMapGrid(), and QgsComposerMapGrid::gridOffsetY().

QPen QgsComposerMap::gridPen ( ) const

Definition at line 1530 of file qgscomposermap.cpp.

References constFirstMapGrid(), and QgsComposerMapGrid::gridPen().

QgsComposerMap::GridStyle QgsComposerMap::gridStyle ( ) const

Definition at line 1458 of file qgscomposermap.cpp.

References constFirstMapGrid(), and QgsComposerMapGrid::gridStyle().

int QgsComposerMap::id ( ) const
inline
bool QgsComposerMap::imageSizeConsideringRotation ( double &  width,
double &  height 
) const

Calculates width and hight of the picture (in mm) such that it fits into the item frame with the given rotation.

Deprecated:
Use bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& height, double rotation ) instead

Definition at line 2435 of file qgscomposermap.cpp.

References QgsComposerItem::imageSizeConsideringRotation(), mEvaluatedMapRotation, Q_NOWARN_DEPRECATED_POP, and Q_NOWARN_DEPRECATED_PUSH.

void QgsComposerMap::init ( )
private
bool QgsComposerMap::isDrawing ( ) const
inline

True if a draw is already in progress.

Definition at line 150 of file qgscomposermap.h.

Referenced by QgsComposerAttributeTable::paint(), and QgsComposition::removeComposerItem().

bool QgsComposerMap::keepLayerSet ( ) const
inline

Getter for flag that determines if the stored layer set should be used or the current layer set of the qgis mapcanvas.

Note
this function was added in version 1.2

Definition at line 200 of file qgscomposermap.h.

QStringList QgsComposerMap::layerSet ( ) const
inline

Getter for stored layer set that is used if mKeepLayerSet is true.

Note
this function was added in version 1.2

Definition at line 207 of file qgscomposermap.h.

Referenced by readXML().

QStringList QgsComposerMap::layersToRender ( ) const
private
QgsComposerMapGrid * QgsComposerMap::mapGrid ( const QString &  id) const

Definition at line 1991 of file qgscomposermap.cpp.

References id(), and mGrids.

Referenced by moveGridDown(), moveGridUp(), and readXML().

QList< const QgsComposerMapGrid * > QgsComposerMap::mapGrids ( ) const

Definition at line 2005 of file qgscomposermap.cpp.

References mGrids.

QgsComposerMapOverview * QgsComposerMap::mapOverview ( const QString &  id) const

Definition at line 2080 of file qgscomposermap.cpp.

References id(), and mOverviews.

Referenced by moveOverviewDown(), moveOverviewUp(), and readXML().

QList< QgsComposerMapOverview * > QgsComposerMap::mapOverviews ( ) const

Definition at line 2094 of file qgscomposermap.cpp.

References mOverviews.

Referenced by QgsComposition::addItemsFromXML().

void QgsComposerMap::mapPolygon ( const QgsRectangle extent,
QPolygonF &  poly 
) const
private
const QgsMapRenderer * QgsComposerMap::mapRenderer ( ) const
Deprecated:
since 2.4 - use mapSettings() - may return 0 if not initialized with QgsMapRenderer

Definition at line 513 of file qgscomposermap.cpp.

References QgsComposition::mapRenderer(), QgsComposerObject::mComposition, Q_NOWARN_DEPRECATED_POP, and Q_NOWARN_DEPRECATED_PUSH.

double QgsComposerMap::mapRotation ( QgsComposerObject::PropertyValueType  valueType = QgsComposerObject::EvaluatedValue) const

Returns the rotation used for drawing the map within the composer item.

Returns
rotation for map
Parameters
valueTypecontrols whether the returned value is the user specified rotation, or the current evaluated rotation (which may be affected by data driven rotation settings).

Definition at line 856 of file qgscomposermap.cpp.

References QgsComposerObject::EvaluatedValue, mEvaluatedMapRotation, and mMapRotation.

Referenced by QgsComposition::computeWorldFileParameters(), refreshMapExtents(), QgsComposerPicture::setRotationMap(), QgsComposerMapGrid::xGridLines(), and QgsComposerMapGrid::yGridLines().

void QgsComposerMap::mapRotationChanged ( double  newRotation)
signal

Is emitted on rotation change to notify north arrow pictures.

Referenced by refreshMapExtents(), and setMapRotation().

QPointF QgsComposerMap::mapToItemCoords ( const QPointF &  mapCoords) const
double QgsComposerMap::mapUnitsToMM ( ) const

Returns the conversion factor map units -> mm.

Definition at line 2133 of file qgscomposermap.cpp.

References currentMapExtent(), and QgsRectangle::width().

Referenced by cache(), QgsComposerLegend::paint(), paint(), and transformShift().

void QgsComposerMap::moveContent ( double  dx,
double  dy 
)
virtual

Move content of map.

Parameters
dxmove in x-direction (item and canvas coordinates)
dymove in y-direction (item and canvas coordinates)

Reimplemented from QgsComposerItem.

Definition at line 568 of file qgscomposermap.cpp.

References cache(), currentMapExtent(), extentChanged(), QgsComposerObject::itemChanged(), mDrawing, refreshMapExtents(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), and transformShift().

void QgsComposerMap::moveGridDown ( const QString &  name)

Definition at line 1960 of file qgscomposermap.cpp.

References index, mapGrid(), and mGrids.

void QgsComposerMap::moveGridUp ( const QString &  name)

Definition at line 1943 of file qgscomposermap.cpp.

References index, mapGrid(), and mGrids.

void QgsComposerMap::moveOverviewDown ( const QString &  name)

Definition at line 2049 of file qgscomposermap.cpp.

References index, mapOverview(), and mOverviews.

void QgsComposerMap::moveOverviewUp ( const QString &  name)

Definition at line 2032 of file qgscomposermap.cpp.

References index, mapOverview(), and mOverviews.

int QgsComposerMap::numberExportLayers ( ) const
virtual

Get the number of layers that this item requires for exporting as layers.

Returns
0 if this item is to be placed on the same layer as the previous item, 1 if it should be placed on its own layer, and >1 if it requires multiple export layers
Note
this method was added in version 2.4

Reimplemented from QgsComposerItem.

Definition at line 433 of file qgscomposermap.cpp.

References QgsComposerItem::hasBackground(), QgsComposerItem::hasFrame(), and layersToRender().

Referenced by shouldDrawPart().

QPainter::CompositionMode QgsComposerMap::overviewBlendMode ( ) const

Returns the overview's blending mode.

Definition at line 2186 of file qgscomposermap.cpp.

References QgsComposerMapOverview::blendMode(), and constFirstMapOverview().

bool QgsComposerMap::overviewCentered ( ) const

Returns true if the extent is forced to center on the overview.

Definition at line 2210 of file qgscomposermap.cpp.

References QgsComposerMapOverview::centered(), and constFirstMapOverview().

int QgsComposerMap::overviewCount ( ) const
inline

Definition at line 564 of file qgscomposermap.h.

Referenced by readXML().

void QgsComposerMap::overviewExtentChanged ( )
inlineslot
int QgsComposerMap::overviewFrameMapId ( ) const

Returns id of overview frame (or -1 if no overfiew frame)

Note
: this function was added in version 1.9

Definition at line 2149 of file qgscomposermap.cpp.

References constFirstMapOverview(), and QgsComposerMapOverview::frameMapId().

QgsFillSymbolV2 * QgsComposerMap::overviewFrameMapSymbol ( )
bool QgsComposerMap::overviewInverted ( ) const

Returns true if the overview frame is inverted.

Definition at line 2198 of file qgscomposermap.cpp.

References constFirstMapOverview(), and QgsComposerMapOverview::inverted().

void QgsComposerMap::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  itemStyle,
QWidget *  pWidget 
)
void QgsComposerMap::preparedForAtlas ( )
signal

Is emitted when the map has been prepared for atlas rendering, just before actual rendering.

Referenced by setNewAtlasFeatureExtent().

PreviewMode QgsComposerMap::previewMode ( ) const
inline
bool QgsComposerMap::readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc 
)
virtual

sets state from Dom document

Parameters
itemElemis Dom node corresponding to 'ComposerMap' tag
docis Dom document

Reimplemented from QgsComposerObject.

Definition at line 1173 of file qgscomposermap.cpp.

References QgsComposerItem::_readXML(), Auto, Bottom, Cache, QgsLineSymbolV2::createSimple(), QgsSymbolLayerV2Utils::decodeColor(), Fixed, QgsMapRenderer::getCompositionMode(), gridCount(), QgsComposerObject::itemChanged(), layerSet(), Left, QgsSymbolLayerV2Utils::loadSymbol(), mapGrid(), mapOverview(), mAtlasDriven, mAtlasMargin, mAtlasScalingMode, mCacheUpdated, mDrawCanvasItems, mDrawing, mGrids, mId, mKeepLayerSet, mLayerSet, mMapRotation, mNumCachedLayers, mOverviews, mPreviewMode, overviewCount(), previewMode(), QgsComposerMapOverview, QgsComposerMapOverview::readXML(), QgsComposerMapGrid::readXML(), Rectangle, removeGrids(), removeOverviews(), Render, Right, QgsComposerMapGrid::setAnnotationFrameDistance(), QgsComposerMapOverview::setBlendMode(), QgsComposerMapGrid::setBlendMode(), QgsComposerMapOverview::setCentered(), QgsSymbolV2::setColor(), QgsComposerMapGrid::setCrossLength(), QgsComposerMapOverview::setFrameMap(), QgsComposerMapOverview::setFrameSymbol(), QgsComposerMapGrid::setGridAnnotationDirection(), QgsComposerMapGrid::setGridAnnotationFont(), QgsComposerMapGrid::setGridAnnotationFontColor(), QgsComposerMapGrid::setGridAnnotationFormat(), QgsComposerMapGrid::setGridAnnotationPosition(), QgsComposerMapGrid::setGridAnnotationPrecision(), QgsComposerMapGrid::setGridEnabled(), QgsComposerMapGrid::setGridFrameFillColor1(), QgsComposerMapGrid::setGridFrameFillColor2(), QgsComposerMapGrid::setGridFramePenColor(), QgsComposerMapGrid::setGridFramePenSize(), QgsComposerMapGrid::setGridFrameStyle(), QgsComposerMapGrid::setGridFrameWidth(), QgsComposerMapGrid::setGridIntervalX(), QgsComposerMapGrid::setGridIntervalY(), QgsComposerMapGrid::setGridLineSymbol(), QgsComposerMapGrid::setGridOffsetX(), QgsComposerMapGrid::setGridOffsetY(), QgsComposerMapGrid::setGridStyle(), QgsComposerMapOverview::setInverted(), setNewExtent(), QgsComposerMapGrid::setShowGridAnnotation(), QgsLineSymbolV2::setWidth(), Top, tr, and updateBoundingRect().

Referenced by QgsComposition::addItemsFromXML().

void QgsComposerMap::refreshDataDefinedProperty ( const QgsComposerObject::DataDefinedProperty  property = QgsComposerObject::AllProperties)
virtualslot
void QgsComposerMap::refreshMapExtents ( )
private
void QgsComposerMap::removeGrid ( const QString &  name)

Definition at line 1932 of file qgscomposermap.cpp.

References mGrids.

void QgsComposerMap::removeGrids ( )
private

Definition at line 1716 of file qgscomposermap.cpp.

References mGrids.

Referenced by readXML(), and ~QgsComposerMap().

void QgsComposerMap::removeOverview ( const QString &  name)

Definition at line 2021 of file qgscomposermap.cpp.

References mOverviews.

void QgsComposerMap::removeOverviews ( )
private

Definition at line 1746 of file qgscomposermap.cpp.

References mOverviews.

Referenced by readXML(), and ~QgsComposerMap().

void QgsComposerMap::renderModeUpdateCachedImage ( )
slot

Call updateCachedImage if item is in render mode.

Definition at line 500 of file qgscomposermap.cpp.

References mPreviewMode, Render, and updateCachedImage().

void QgsComposerMap::requestedExtent ( QgsRectangle extent)
private

Calculates the extent to request and the yShift of the top-left point in case of rotation.

Definition at line 2114 of file qgscomposermap.cpp.

References currentMapExtent(), mapPolygon(), mEvaluatedMapRotation, QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), and QgsRectangle::setYMinimum().

Referenced by cache(), and paint().

void QgsComposerMap::resize ( double  dx,
double  dy 
)

resizes an item in x- and y direction (canvas coordinates)

Definition at line 559 of file qgscomposermap.cpp.

References setSceneRect(), and updateItem().

Q_DECL_DEPRECATED double QgsComposerMap::rotation ( ) const
inline

Returns the rotation used for drawing the map within the composer item.

Deprecated:
Use mapRotation() instead

Definition at line 382 of file qgscomposermap.h.

double QgsComposerMap::scale ( ) const
void QgsComposerMap::setAnnotationFontColor ( const QColor &  c)

Sets font color for grid annotations.

Note
this function was added in version 2.0

Definition at line 1548 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridAnnotationFontColor().

void QgsComposerMap::setAnnotationFrameDistance ( double  d)

Sets distance between map frame and annotations.

Note
this function was added in version 1.4

Definition at line 1596 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setAnnotationFrameDistance().

void QgsComposerMap::setAtlasDriven ( bool  enabled)

Sets whether the map extent will follow the current atlas feature.

Parameters
enabledset to true if the map extents should be set by the current atlas feature.
See also
atlasDriven
setAtlasScalingMode

Definition at line 2459 of file qgscomposermap.cpp.

References mAtlasDriven, and refreshMapExtents().

Referenced by QgsAtlasComposition::readXMLMapSettings(), and QgsAtlasComposition::setComposerMap().

void QgsComposerMap::setAtlasFixedScale ( bool  fixed)

Set to true if the map should use a fixed scale when in atlas mode.

Deprecated:
since 2.4 Use setAtlasScalingMode() instead

Definition at line 2476 of file qgscomposermap.cpp.

References Auto, Fixed, and mAtlasScalingMode.

void QgsComposerMap::setAtlasMargin ( double  margin)
inline

Sets the margin size (percentage) used when the map is in atlas mode.

Parameters
marginsize in percentage to leave around the atlas feature's extent
Note
this is only used if atlasScalingMode() is Auto.
See also
atlasScalingMode
atlasMargin

Definition at line 519 of file qgscomposermap.h.

Referenced by QgsAtlasComposition::readXMLMapSettings(), and QgsAtlasComposition::setMargin().

void QgsComposerMap::setAtlasScalingMode ( AtlasScalingMode  mode)
inline

Sets the current atlas scaling mode.

This controls how the map's extents are calculated for the current atlas feature when an atlas composition is enabled.

Parameters
modeatlas scaling mode to set
Note
this parameter is only used if atlasDriven() is true
See also
atlasScalingMode
atlasDriven

Definition at line 503 of file qgscomposermap.h.

Referenced by QgsAtlasComposition::readXMLMapSettings(), and QgsAtlasComposition::setFixedScale().

void QgsComposerMap::setCacheUpdated ( bool  u = false)

Definition at line 508 of file qgscomposermap.cpp.

References mCacheUpdated.

void QgsComposerMap::setCrossLength ( double  l)

Sets length of the cros segments (if grid style is cross)

Note
this function was added in version 1.4

Definition at line 1704 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setCrossLength().

void QgsComposerMap::setDrawCanvasItems ( bool  b)
inline

Definition at line 402 of file qgscomposermap.h.

void QgsComposerMap::setFrameOutlineWidth ( const double  outlineWidth)
virtual

Sets frame outline width.

Parameters
outlineWidthnew width for outline frame
Returns
nothing
Note
introduced in 2.2
See also
frameOutlineWidth
setFrameEnabled
setFrameJoinStyle

Reimplemented from QgsComposerItem.

Definition at line 1838 of file qgscomposermap.cpp.

References QgsComposerItem::setFrameOutlineWidth(), and updateBoundingRect().

void QgsComposerMap::setGridAnnotationDirection ( GridAnnotationDirection  d,
QgsComposerMap::Border  border 
)
void QgsComposerMap::setGridAnnotationFont ( const QFont &  f)

Sets font for grid annotations.

Note
this function was added in version 1.4

Definition at line 1536 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridAnnotationFont().

void QgsComposerMap::setGridAnnotationFormat ( QgsComposerMap::GridAnnotationFormat  f)
void QgsComposerMap::setGridAnnotationPosition ( QgsComposerMap::GridAnnotationPosition  p,
QgsComposerMap::Border  border 
)
void QgsComposerMap::setGridAnnotationPrecision ( int  p)

Sets coordinate precision for grid annotations.

Note
this function was added in version 1.4

Definition at line 1560 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridAnnotationPrecision().

void QgsComposerMap::setGridBlendMode ( QPainter::CompositionMode  blendMode)

Sets the grid's blending mode.

Definition at line 1797 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setBlendMode().

void QgsComposerMap::setGridEnabled ( bool  enabled)

Enables a coordinate grid that is shown on top of this composermap.

Note
this function was added in version 1.4

Definition at line 2235 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridEnabled().

void QgsComposerMap::setGridFrameFillColor1 ( const QColor &  c)

Sets first fill color for grid zebra frame.

Note
: this function was added in version 2.1

Definition at line 1680 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridFrameFillColor1().

void QgsComposerMap::setGridFrameFillColor2 ( const QColor &  c)

Sets second fill color for grid zebra frame.

Note
: this function was added in version 2.1

Definition at line 1692 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridFrameFillColor2().

void QgsComposerMap::setGridFramePenColor ( const QColor &  c)

Sets pen color for grid frame.

Note
: this function was added in version 2.1

Definition at line 1668 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridFramePenColor().

void QgsComposerMap::setGridFramePenSize ( double  w)

Set grid frame pen thickness.

Note
: this function was added in version 2.1

Definition at line 1656 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridFramePenSize().

void QgsComposerMap::setGridFrameStyle ( GridFrameStyle  style)

Set grid frame style (NoGridFrame or Zebra)

Note
: this function was added in version 1.9

Definition at line 1632 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridFrameStyle().

void QgsComposerMap::setGridFrameWidth ( double  w)

Set grid frame width.

Note
: this function was added in version 1.9

Definition at line 1644 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridFrameWidth().

void QgsComposerMap::setGridIntervalX ( double  interval)

Sets coordinate interval in x-direction for composergrid.

Note
this function was added in version 1.4

Definition at line 1464 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridIntervalX().

void QgsComposerMap::setGridIntervalY ( double  interval)

Sets coordinate interval in y-direction for composergrid.

Note
this function was added in version 1.4

Definition at line 1476 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridIntervalY().

void QgsComposerMap::setGridLineSymbol ( QgsLineSymbolV2 symbol)

Definition at line 2223 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridLineSymbol().

void QgsComposerMap::setGridOffsetX ( double  offset)

Sets x-coordinate offset for composer grid.

Note
this function was added in version 1.4

Definition at line 1488 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridOffsetX().

void QgsComposerMap::setGridOffsetY ( double  offset)

Sets y-coordinate offset for composer grid.

Note
this function was added in version 1.4

Definition at line 1500 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridOffsetY().

void QgsComposerMap::setGridPen ( const QPen &  p)

Sets the pen to draw composer grid.

Note
this function was added in version 1.4

Definition at line 1524 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridPen().

void QgsComposerMap::setGridPenColor ( const QColor &  c)

Sets the color of the grid pen.

Note
this function was added in version 1.4

Definition at line 1518 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridPenColor().

void QgsComposerMap::setGridPenWidth ( double  w)

Sets with of grid pen.

Note
this function was added in version 1.4

Definition at line 1512 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridPenWidth().

void QgsComposerMap::setGridStyle ( GridStyle  style)

Sets coordinate grid style to solid or cross.

Note
this function was added in version 1.4

Definition at line 1452 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setGridStyle().

void QgsComposerMap::setKeepLayerSet ( bool  enabled)
inline

Setter for flag that determines if the stored layer set should be used or the current layer set of the qgis mapcanvas.

Note
this function was added in version 1.2

Definition at line 203 of file qgscomposermap.h.

void QgsComposerMap::setLayerSet ( const QStringList &  layerSet)
inline

Setter for stored layer set that is used if mKeepLayerSet is true.

Note
this function was added in version 1.2

Definition at line 210 of file qgscomposermap.h.

void QgsComposerMap::setMapCanvas ( QGraphicsView *  canvas)
inline

Sets canvas pointer (necessary to query and draw map canvas items)

Definition at line 400 of file qgscomposermap.h.

void QgsComposerMap::setMapRotation ( double  r)

Sets rotation for the map - this does not affect the composer item shape, only the way the map is drawn within the item.

Note
this function was added in version 2.1

Definition at line 847 of file qgscomposermap.cpp.

References QgsComposerObject::itemChanged(), mapRotationChanged(), mEvaluatedMapRotation, and mMapRotation.

Referenced by setRotation().

void QgsComposerMap::setNewAtlasFeatureExtent ( const QgsRectangle extent)

Sets new Extent for the current atlas preview and changes width, height (and implicitely also scale).

Atlas preview extents are only temporary, and are regenerated whenever the atlas feature changes

Definition at line 713 of file qgscomposermap.cpp.

References extent(), extentChanged(), QgsRectangle::height(), QgsComposerObject::itemChanged(), mAtlasFeatureExtent, mCacheUpdated, preparedForAtlas(), refreshMapExtents(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), updateItem(), QgsRectangle::width(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().

Referenced by QgsAtlasComposition::prepareMap().

void QgsComposerMap::setNewExtent ( const QgsRectangle extent)

Sets new Extent and changes width, height (and implicitely also scale)

Definition at line 693 of file qgscomposermap.cpp.

References currentMapExtent(), extent(), QgsRectangle::height(), refreshMapExtents(), setSceneRect(), updateItem(), and QgsRectangle::width().

Referenced by readXML().

void QgsComposerMap::setNewScale ( double  scaleDenominator,
bool  forceUpdate = true 
)
void QgsComposerMap::setOffset ( double  xOffset,
double  yOffset 
)

Sets offset values to shift image (useful for live updates when moving item content)

Definition at line 835 of file qgscomposermap.cpp.

References mXOffset, and mYOffset.

Referenced by QgsComposerView::mouseMoveEvent(), and QgsComposerView::mouseReleaseEvent().

void QgsComposerMap::setOverviewBlendMode ( QPainter::CompositionMode  blendMode)

Sets the overview's blending mode.

Definition at line 2192 of file qgscomposermap.cpp.

References firstMapOverview(), and QgsComposerMapOverview::setBlendMode().

void QgsComposerMap::setOverviewCentered ( bool  centered)

Set the overview's centering mode.

Definition at line 2216 of file qgscomposermap.cpp.

References firstMapOverview(), and QgsComposerMapOverview::setCentered().

void QgsComposerMap::setOverviewFrameMap ( int  mapId)

Sets overview frame map.

-1 disables the overview frame

Note
: this function was added in version 1.9

Definition at line 2143 of file qgscomposermap.cpp.

References firstMapOverview(), and QgsComposerMapOverview::setFrameMap().

void QgsComposerMap::setOverviewFrameMapSymbol ( QgsFillSymbolV2 symbol)
void QgsComposerMap::setOverviewInverted ( bool  inverted)

Sets the overview's inversion mode.

Definition at line 2204 of file qgscomposermap.cpp.

References firstMapOverview(), and QgsComposerMapOverview::setInverted().

void QgsComposerMap::setPreviewMode ( PreviewMode  m)
void QgsComposerMap::setRotation ( double  r)
virtual

Sets rotation for the map - this does not affect the composer item shape, only the way the map is drawn within the item.

Deprecated:
Use setMapRotation( double rotation ) instead

Reimplemented from QgsComposerItem.

Definition at line 841 of file qgscomposermap.cpp.

References setMapRotation().

void QgsComposerMap::setSceneRect ( const QRectF &  rectangle)
virtual
void QgsComposerMap::setShowGridAnnotation ( bool  show)

Sets flag if grid annotation should be shown.

Note
this function was added in version 1.4

Definition at line 1572 of file qgscomposermap.cpp.

References firstMapGrid(), and QgsComposerMapGrid::setShowGridAnnotation().

void QgsComposerMap::setUpdatesEnabled ( bool  enabled)
inline

Sets whether updates to the composer map are enabled.

Definition at line 522 of file qgscomposermap.h.

Referenced by QgsComposition::addItemsFromXML().

bool QgsComposerMap::shouldDrawPart ( PartType  part) const
private

Test if a part of the copmosermap needs to be drawn, considering mCurrentExportLayer.

Definition at line 445 of file qgscomposermap.cpp.

References Background, Frame, Grid, QgsComposerItem::hasBackground(), QgsComposerItem::hasFrame(), QgsComposerItem::mCurrentExportLayer, numberExportLayers(), OverviewMapExtent, and SelectionBoxes.

Referenced by paint().

bool QgsComposerMap::showGridAnnotation ( ) const
void QgsComposerMap::sizeChangedByRotation ( double &  width,
double &  height 
)
void QgsComposerMap::storeCurrentLayerSet ( )

Stores the current layer set of the qgis mapcanvas in mLayerSet.

Definition at line 1405 of file qgscomposermap.cpp.

References QgsMapSettings::layers(), QgsComposition::mapSettings(), QgsComposerObject::mComposition, and mLayerSet.

void QgsComposerMap::syncLayerSet ( )
private

Removes layer ids from mLayerSet that are no longer present in the qgis main map.

Definition at line 1410 of file qgscomposermap.cpp.

References QgsMapLayerRegistry::instance(), QgsMapSettings::layers(), QgsMapLayerRegistry::mapLayers(), QgsComposition::mapSettings(), QgsComposerObject::mComposition, mKeepLayerSet, and mLayerSet.

Referenced by updateCachedImage().

void QgsComposerMap::toggleAtlasPreview ( )

Called when atlas preview is toggled, to force map item to update its extent and redraw.

Definition at line 754 of file qgscomposermap.cpp.

References extentChanged(), QgsComposerObject::itemChanged(), mCacheUpdated, and updateItem().

Referenced by QgsComposition::setAtlasMode().

QgsRectangle QgsComposerMap::transformedExtent ( ) const
private

Returns extent that considers mOffsetX / mOffsetY (during content move)

Definition at line 1844 of file qgscomposermap.cpp.

References currentMapExtent(), mXOffset, mYOffset, and transformShift().

Referenced by mapToItemCoords().

QPolygonF QgsComposerMap::transformedMapPolygon ( ) const

Returns extent that considers rotation and shift with mOffsetX / mOffsetY.

Definition at line 1852 of file qgscomposermap.cpp.

References mXOffset, mYOffset, transformShift(), and visibleExtentPolygon().

Referenced by QgsComposerMapGrid::crsGridParams(), mapToItemCoords(), QgsComposerMapGrid::xGridLines(), and QgsComposerMapGrid::yGridLines().

void QgsComposerMap::transformShift ( double &  xShift,
double &  yShift 
) const
private

Scales a composer map shift (in MM) and rotates it by mRotation.

Parameters
xShiftin: shift in x direction (in item units), out: xShift in map units
yShiftin: shift in y direction (in item units), out: yShift in map units

Definition at line 2247 of file qgscomposermap.cpp.

References mapUnitsToMM(), mEvaluatedMapRotation, and QgsComposerUtils::rotate().

Referenced by moveContent(), transformedExtent(), and transformedMapPolygon().

virtual int QgsComposerMap::type ( ) const
inlinevirtual

return correct graphics item type.

Added in v1.7

Reimplemented from QgsComposerItem.

Definition at line 56 of file qgscomposermap.h.

References QgsComposerItem::ComposerMap.

void QgsComposerMap::updateBoundingRect ( )

Updates the bounding rect of this item.

Call this function before doing any changes related to annotation out of the map rectangle

Note
this function was added in version 1.4

Definition at line 1814 of file qgscomposermap.cpp.

References mCurrentRectangle, QgsComposerItem::mFrame, and mGrids.

Referenced by addGrid(), readXML(), setFrameOutlineWidth(), QgsComposerMapGrid::setGridAnnotationDirection(), QgsComposerMapGrid::setGridAnnotationPosition(), and setSceneRect().

void QgsComposerMap::updateCachedImage ( void  )
slot

Called if map canvas has changed.

Definition at line 492 of file qgscomposermap.cpp.

References cache(), mCacheUpdated, and syncLayerSet().

Referenced by connectUpdateSlot(), renderModeUpdateCachedImage(), and QgsComposerView::wheelZoom().

void QgsComposerMap::updateItem ( )
virtual

Updates item, with the possibility to do custom update for subclasses.

Reimplemented from QgsComposerItem.

Definition at line 975 of file qgscomposermap.cpp.

References cache(), mCacheUpdated, mPreviewMode, mUpdatesEnabled, Rectangle, and QgsComposerItem::updateItem().

Referenced by resize(), setNewAtlasFeatureExtent(), setNewExtent(), and toggleAtlasPreview().

bool QgsComposerMap::updatesEnabled ( ) const
inline

Returns whether updates to the composer map are enabled.

Definition at line 525 of file qgscomposermap.h.

QPolygonF QgsComposerMap::visibleExtentPolygon ( ) const

Returns a polygon representing the current visible map extent, considering map extents and rotation.

If the map rotation is 0, the result is the same as currentMapExtent

Returns
polygon with the four corner points representing the visible map extent. The points are clockwise, starting at the top-left point
See also
currentMapExtent

Definition at line 1909 of file qgscomposermap.cpp.

References currentMapExtent(), and mapPolygon().

Referenced by QgsComposerMapOverview::drawOverview(), and transformedMapPolygon().

bool QgsComposerMap::writeXML ( QDomElement &  elem,
QDomDocument &  doc 
) const
virtual
void QgsComposerMap::zoomContent ( int  delta,
double  x,
double  y 
)
virtual

Friends And Related Function Documentation

friend class QgsComposerMapOverview
friend

Definition at line 735 of file qgscomposermap.h.

Referenced by firstMapOverview(), and readXML().

Member Data Documentation

bool QgsComposerMap::mAtlasDriven
private

True if map is being controlled by an atlas.

Definition at line 686 of file qgscomposermap.h.

Referenced by currentMapExtent(), readXML(), setAtlasDriven(), setNewScale(), writeXML(), and zoomContent().

QgsRectangle QgsComposerMap::mAtlasFeatureExtent
private

Definition at line 608 of file qgscomposermap.h.

Referenced by currentMapExtent(), and setNewAtlasFeatureExtent().

double QgsComposerMap::mAtlasMargin
private

Margin size for atlas driven extents (percentage of feature size) - when in auto scaling mode.

Definition at line 690 of file qgscomposermap.h.

Referenced by readXML(), and writeXML().

AtlasScalingMode QgsComposerMap::mAtlasScalingMode
private

Current atlas scaling mode.

Definition at line 688 of file qgscomposermap.h.

Referenced by atlasFixedScale(), readXML(), setAtlasFixedScale(), setNewScale(), writeXML(), and zoomContent().

QImage QgsComposerMap::mCacheImage
private

Definition at line 611 of file qgscomposermap.h.

Referenced by cache(), and paint().

bool QgsComposerMap::mCacheUpdated
private
QRectF QgsComposerMap::mCurrentRectangle
private

Current bounding rectangle.

This is used to check if notification to the graphics scene is necessary

Definition at line 673 of file qgscomposermap.h.

Referenced by boundingRect(), QgsComposerMap(), and updateBoundingRect().

bool QgsComposerMap::mDrawCanvasItems
private

True if annotation items, rubber band, etc.

from the main canvas should be displayed

Definition at line 676 of file qgscomposermap.h.

Referenced by drawCanvasItems(), readXML(), and writeXML().

bool QgsComposerMap::mDrawing
private

set to true if in state of drawing.

Concurrent requests to draw method are returned if set to true

Definition at line 623 of file qgscomposermap.h.

Referenced by cache(), moveContent(), paint(), QgsComposerMap(), readXML(), and zoomContent().

double QgsComposerMap::mEvaluatedMapRotation
private

Temporary evaluated map rotation.

Data defined rotation may mean this value differs from mMapRotation

Definition at line 634 of file qgscomposermap.h.

Referenced by cornerPointOnRotatedAndScaledRect(), imageSizeConsideringRotation(), mapPolygon(), mapRotation(), mapToItemCoords(), paint(), refreshMapExtents(), requestedExtent(), setMapRotation(), sizeChangedByRotation(), and transformShift().

QgsRectangle QgsComposerMap::mExtent
private
QList< QgsComposerMapGrid* > QgsComposerMap::mGrids
private
int QgsComposerMap::mId
private

Unique identifier.

Definition at line 598 of file qgscomposermap.h.

Referenced by assignFreeId(), displayName(), init(), QgsComposerMap(), readXML(), and writeXML().

bool QgsComposerMap::mKeepLayerSet
private

Flag if layers to be displayed should be read from qgis canvas (true) or from stored list in mLayerSet (false)

Definition at line 637 of file qgscomposermap.h.

Referenced by layersToRender(), readXML(), syncLayerSet(), and writeXML().

QStringList QgsComposerMap::mLayerSet
private

Stored layer list (used if layer live-link mKeepLayerSet is disabled)

Definition at line 640 of file qgscomposermap.h.

Referenced by layersToRender(), readXML(), storeCurrentLayerSet(), syncLayerSet(), and writeXML().

QGraphicsView* QgsComposerMap::mMapCanvas
private

Definition at line 674 of file qgscomposermap.h.

Referenced by composerMapPosForItem(), drawCanvasItem(), and drawCanvasItems().

double QgsComposerMap::mMapRotation
private

Map rotation.

Definition at line 631 of file qgscomposermap.h.

Referenced by mapRotation(), readXML(), refreshMapExtents(), setMapRotation(), and writeXML().

int QgsComposerMap::mNumCachedLayers
private

Number of layers when cache was created.

Definition at line 620 of file qgscomposermap.h.

Referenced by readXML().

QList< QgsComposerMapOverview* > QgsComposerMap::mOverviews
private
PreviewMode QgsComposerMap::mPreviewMode
private
bool QgsComposerMap::mUpdatesEnabled
private

Whether updates to the map are enabled.

Definition at line 643 of file qgscomposermap.h.

Referenced by updateItem().

double QgsComposerMap::mXOffset
private

Offset in x direction for showing map cache image.

Definition at line 626 of file qgscomposermap.h.

Referenced by QgsComposerMapOverview::drawOverview(), paint(), QgsComposerMap(), setOffset(), transformedExtent(), and transformedMapPolygon().

double QgsComposerMap::mYOffset
private

Offset in y direction for showing map cache image.

Definition at line 628 of file qgscomposermap.h.

Referenced by QgsComposerMapOverview::drawOverview(), paint(), QgsComposerMap(), setOffset(), transformedExtent(), and transformedMapPolygon().


The documentation for this class was generated from the following files: