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

Object representing map window. More...

#include <qgscomposermap.h>

Inheritance diagram for QgsComposerMap:
Inheritance graph
[legend]

Public Types

enum  AtlasScalingMode { Fixed, Predefined, Auto }
 Scaling modes used for the serial rendering (atlas) More...
enum  Border { Left, Right, Bottom, Top }
 Enum for different frame borders. More...
enum  GridAnnotationDirection { Horizontal = 0, Vertical, HorizontalAndVertical, BoundaryDirection }
enum  GridAnnotationFormat {
  Decimal = 0, DegreeMinute, DegreeMinuteSecond, DecimalWithSuffix,
  DegreeMinuteNoSuffix, DegreeMinutePadded, DegreeMinuteSecondNoSuffix, DegreeMinuteSecondPadded
}
enum  GridAnnotationPosition { InsideMapFrame = 0, OutsideMapFrame, Disabled }
enum  GridFrameStyle {
  NoGridFrame = 0, Zebra, InteriorTicks, ExteriorTicks,
  InteriorExteriorTicks, LineBorder
}
enum  GridStyle { Solid = 0, Cross, Markers, FrameAnnotationsOnly }
enum  PreviewMode { Cache = 0, Render, Rectangle }
 Preview style. More...
- Public Types inherited from QgsComposerItem
enum  ItemPositionMode {
  UpperLeft, UpperMiddle, UpperRight, MiddleLeft,
  Middle, MiddleRight, LowerLeft, LowerMiddle,
  LowerRight
}
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  ZoomMode { Zoom = 0, ZoomRecenter, ZoomToPoint, NoZoom }
 Modes for zooming item content. More...
- Public Types inherited from QgsComposerObject
enum  DataDefinedProperty {
  NoProperty = 0, AllProperties, TestProperty, PresetPaperSize,
  PaperWidth, PaperHeight, NumPages, PaperOrientation,
  PageNumber, PositionX, PositionY, ItemWidth,
  ItemHeight, ItemRotation, Transparency, BlendMode,
  ExcludeFromExports, MapRotation, MapScale, MapXMin,
  MapYMin, MapXMax, MapYMax, MapAtlasMargin,
  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 overviewExtentChanged ()
virtual void refreshDataDefinedProperty (const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties) override
void renderModeUpdateCachedImage ()
 Call updateCachedImage if item is in render mode.
void updateBoundingRect ()
 Updates the bounding rect of this item.
void updateCachedImage ()
 Called if map canvas has changed.
- Public Slots inherited from QgsComposerItem
virtual void refreshDataDefinedProperty (const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties) override
 Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value.
void repaint () override
virtual void setItemRotation (const double r, const bool adjustPosition=false)
 Sets the item rotation.
- Public Slots inherited from QgsComposerObject
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.
virtual void repaint ()
 Triggers a redraw for the item.

Signals

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

Public Member Functions

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

Friends

class QgsComposerMapOverview

Additional Inherited Members

- Protected Member Functions inherited from QgsComposerItem
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)
Q_DECL_DEPRECATED bool cornerPointOnRotatedAndScaledRect (double &x, double &y, double width, double height, double rotation) const
 Calculates corner point after rotation and scaling.
void deleteAlignItems ()
void deleteHAlignSnapItem ()
void deleteVAlignSnapItem ()
Q_DECL_DEPRECATED void drawArrowHead (QPainter *p, double x, double y, double angle, double arrowHeadWidth) const
 Draws arrowhead.
virtual void drawBackground (QPainter *p)
 Draw background.
virtual void drawFrame (QPainter *p)
 Draw black frame around item.
virtual void drawSelectionBoxes (QPainter *p)
 Draws additional graphics on selected items.
QRectF evalItemRect (const QRectF &newRect, const bool resizeOnly=false)
 Evaluates an item's bounding rect to consider data defined position and size of item and reference point.
QGraphicsLineItem * hAlignSnapItem ()
 Return horizontal align snap item.
double horizontalViewScaleFactor () const
 Returns the zoom factor of the graphics view.
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.
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.
Q_DECL_DEPRECATED double lockSymbolSize () const
 Returns the size of the lock symbol depending on the composer zoom level and the item size.
double rectHandlerBorderTolerance () const
 Returns the current (zoom level dependent) tolerance to decide if mouse position is close enough to the item border for resizing.
Q_DECL_DEPRECATED void rotate (double angle, double &x, double &y) const
 Rotates a point / vector.
bool shouldDrawItem () const
 Returns whether the item should be drawn in the current context.
Q_DECL_DEPRECATED void sizeChangedByRotation (double &width, double &height, double rotation)
 Calculates width / height of the bounding box of a rotated rectangle.
QGraphicsLineItem * vAlignSnapItem ()
 Return vertical align snap item.
- Protected Attributes inherited from QgsComposerItem
bool mBackground
 True if item background needs to be painted.
QColor mBackgroundColor
 Background color.
QPainter::CompositionMode mBlendMode
 Composition blend mode for item.
QGraphicsRectItem * mBoundingResizeRectangle
 Rectangle used during move and resize actions.
int mCurrentExportLayer
 The layer that needs to be exported.
QgsComposerItem::MouseMoveAction mCurrentMouseMoveAction
QgsComposerEffectmEffect
bool mEffectsEnabled
bool mEvaluatedExcludeFromExports
 Temporary evaluated item exclusion.
double mEvaluatedItemRotation
 Temporary evaluated item rotation in degrees, clockwise.
bool mExcludeFromExports
 Whether item should be excluded in exports.
bool mFrame
 True if item fram needs to be painted.
Qt::PenJoinStyle mFrameJoinStyle
 Frame join style.
QGraphicsLineItem * mHAlignSnapItem
bool mIsGroupMember
 Whether or not this item is part of a group.
bool mItemPositionLocked
 True if item position and size cannot be changed with mouse move.
double mItemRotation
 Item rotation in degrees, clockwise.
QPointF mLastMouseEventPos
 Position of the last mouse move event (in scene coordinates)
ItemPositionMode mLastUsedPositionMode
 The item's position mode.
double mLastValidViewScaleFactor
 Backup to restore item appearance if no view scale factor is available.
QPointF mMouseMoveStartPos
 Start point of the last mouse move action (in scene coordinates)
bool mRemovedFromComposition
 True if item has been removed from the composition.
int mTransparency
 Item transparency.
QGraphicsLineItem * mVAlignSnapItem

Detailed Description

Object representing map window.

Definition at line 47 of file qgscomposermap.h.

Member Enumeration Documentation

Scaling modes used for the serial rendering (atlas)

Enumerator:
Fixed 
Predefined 
Auto 

Definition at line 127 of file qgscomposermap.h.

Enum for different frame borders.

Enumerator:
Left 
Right 
Bottom 
Top 

Definition at line 117 of file qgscomposermap.h.

Enumerator:
Horizontal 
Vertical 
HorizontalAndVertical 
BoundaryDirection 

Definition at line 86 of file qgscomposermap.h.

Enumerator:
Decimal 
DegreeMinute 
DegreeMinuteSecond 
DecimalWithSuffix 
DegreeMinuteNoSuffix 
DegreeMinutePadded 
DegreeMinuteSecondNoSuffix 
DegreeMinuteSecondPadded 

Definition at line 94 of file qgscomposermap.h.

Enumerator:
InsideMapFrame 
OutsideMapFrame 
Disabled 

Definition at line 79 of file qgscomposermap.h.

Enumerator:
NoGridFrame 
Zebra 
InteriorTicks 
ExteriorTicks 
InteriorExteriorTicks 
LineBorder 

Definition at line 106 of file qgscomposermap.h.

Enumerator:
Solid 
Cross 
Markers 
FrameAnnotationsOnly 

Definition at line 71 of file qgscomposermap.h.

Preview style.

Enumerator:
Cache 
Render 
Rectangle 

Definition at line 62 of file qgscomposermap.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 47 of file qgscomposermap.cpp.

QgsComposerMap::QgsComposerMap ( QgsComposition composition)

Constructor.

Settings are read from project.

Definition at line 92 of file qgscomposermap.cpp.

QgsComposerMap::~QgsComposerMap ( )
virtual

Definition at line 164 of file qgscomposermap.cpp.

Member Function Documentation

QColor QgsComposerMap::annotationFontColor ( ) const

Get font color for grid annotations.

Deprecated:
use grid()->annotationFontColor() or grids() instead

Definition at line 1700 of file qgscomposermap.cpp.

double QgsComposerMap::annotationFrameDistance ( ) const
Deprecated:
use grid()->annotationFrameDistance() or grids() instead

Definition at line 1755 of file qgscomposermap.cpp.

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 2295 of file qgscomposermap.cpp.

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 694 of file qgscomposermap.h.

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 2358 of file qgscomposermap.cpp.

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

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

Parameters
valueTypecontrols whether the returned value is the user specified atlas margin, or the current evaluated atlas margin (which may be affected by data driven atlas margin settings).
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 2369 of file qgscomposermap.cpp.

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 721 of file qgscomposermap.h.

QRectF QgsComposerMap::boundingRect ( ) const
override

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

Definition at line 1913 of file qgscomposermap.cpp.

void QgsComposerMap::cache ( void  )

Create cache image.

Definition at line 245 of file qgscomposermap.cpp.

void QgsComposerMap::connectMapOverviewSignals ( )

Definition at line 2201 of file qgscomposermap.cpp.

bool QgsComposerMap::containsAdvancedEffects ( ) const

True if composer map contains layers with blend modes or flattened layers for vectors.

Definition at line 1102 of file qgscomposermap.cpp.

bool QgsComposerMap::containsWMSLayer ( ) const

True if composer map renders a WMS layer.

Definition at line 1073 of file qgscomposermap.cpp.

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

Reimplemented from QgsComposerItem.

Definition at line 2330 of file qgscomposermap.cpp.

double QgsComposerMap::crossLength ( )
Deprecated:
use grid()->crossLength() or grids() instead

Definition at line 1880 of file qgscomposermap.cpp.

QgsRectangle * QgsComposerMap::currentMapExtent ( )

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.

Both a const and non-const version are included.

Returns
pointer to current map extent
See Also
visibleExtentPolygon

Definition at line 799 of file qgscomposermap.cpp.

const QgsRectangle * QgsComposerMap::currentMapExtent ( ) const

Definition at line 815 of file qgscomposermap.cpp.

QString QgsComposerMap::displayName ( ) const
overridevirtual

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 2020 of file qgscomposermap.cpp.

void QgsComposerMap::draw ( QPainter *  painter,
const QgsRectangle extent,
const QSizeF &  size,
double  dpi,
double *  forceWidthScale = 0 
)

Draw to paint device.

Parameters
painterpainter
extentmap extent
sizesize in scene coordinates
dpiscene dpi
forceWidthScaleforce wysiwyg line widths / marker sizes

Definition at line 172 of file qgscomposermap.cpp.

bool QgsComposerMap::drawCanvasItems ( ) const
inline

Definition at line 614 of file qgscomposermap.h.

QgsRectangle QgsComposerMap::extent ( ) const
inline

Definition at line 265 of file qgscomposermap.h.

void QgsComposerMap::extentChanged ( )
signal
QgsComposerMapGrid * QgsComposerMap::grid ( )

Returns the map item's first grid.

This is a convenience function.

Returns
pointer to first grid for map item
See Also
grids()
Note
introduced in QGIS 2.5

Definition at line 1569 of file qgscomposermap.cpp.

QgsComposerMap::GridAnnotationDirection QgsComposerMap::gridAnnotationDirection ( QgsComposerMap::Border  border) const
Deprecated:
use grid()->annotationDirection() or grids() instead

Definition at line 1784 of file qgscomposermap.cpp.

QFont QgsComposerMap::gridAnnotationFont ( ) const
Deprecated:
use grid()->annotationFont() or grids() instead

Definition at line 1688 of file qgscomposermap.cpp.

QgsComposerMap::GridAnnotationFormat QgsComposerMap::gridAnnotationFormat ( ) const
Deprecated:
use grid()->annotationFormat() or grids() instead

Definition at line 1796 of file qgscomposermap.cpp.

QgsComposerMap::GridAnnotationPosition QgsComposerMap::gridAnnotationPosition ( QgsComposerMap::Border  border) const
Deprecated:
use grid()->annotationPosition() or grids() instead

Definition at line 1743 of file qgscomposermap.cpp.

int QgsComposerMap::gridAnnotationPrecision ( ) const
Deprecated:
use grid()->annotationPrecision() or grids() instead

Definition at line 1712 of file qgscomposermap.cpp.

QPainter::CompositionMode QgsComposerMap::gridBlendMode ( ) const

Returns the grid's blending mode.

Deprecated:
use grid()->blendMode() or grids() instead

Definition at line 1907 of file qgscomposermap.cpp.

bool QgsComposerMap::gridEnabled ( ) const
Deprecated:
use grid()->enabled() or grids() instead

Definition at line 2162 of file qgscomposermap.cpp.

QColor QgsComposerMap::gridFrameFillColor1 ( ) const

Get first fill color for grid zebra frame.

Note
: this function was added in version 2.1
Deprecated:
use grid()->frameFillColor1() or grids() instead

Definition at line 1856 of file qgscomposermap.cpp.

QColor QgsComposerMap::gridFrameFillColor2 ( ) const

Get second fill color for grid zebra frame.

Note
: this function was added in version 2.1
Deprecated:
use grid()->frameFillColor2() or grids() instead

Definition at line 1868 of file qgscomposermap.cpp.

QColor QgsComposerMap::gridFramePenColor ( ) const

Get pen color for grid frame.

Note
: this function was added in version 2.1
Deprecated:
use grid()->framePenColor() or grids() instead

Definition at line 1844 of file qgscomposermap.cpp.

double QgsComposerMap::gridFramePenSize ( ) const
Deprecated:
use grid()->framePenSize() or grids() instead

Definition at line 1832 of file qgscomposermap.cpp.

QgsComposerMap::GridFrameStyle QgsComposerMap::gridFrameStyle ( ) const
Deprecated:
use grid()->frameStyle() or grids() instead

Definition at line 1808 of file qgscomposermap.cpp.

double QgsComposerMap::gridFrameWidth ( ) const
Deprecated:
use grid()->frameWidth() or grids() instead

Definition at line 1820 of file qgscomposermap.cpp.

double QgsComposerMap::gridIntervalX ( ) const
Deprecated:
use grid()->intervalX() or grids() instead

Definition at line 1602 of file qgscomposermap.cpp.

double QgsComposerMap::gridIntervalY ( ) const
Deprecated:
use grid()->intervalY() or grids() instead

Definition at line 1614 of file qgscomposermap.cpp.

QgsLineSymbolV2 * QgsComposerMap::gridLineSymbol ( )
Deprecated:
use grid()->lineSymbol() or grids() instead

Definition at line 2150 of file qgscomposermap.cpp.

double QgsComposerMap::gridOffsetX ( ) const
Deprecated:
use grid()->offsetX() or grids() instead

Definition at line 1626 of file qgscomposermap.cpp.

double QgsComposerMap::gridOffsetY ( ) const
Deprecated:
use grid()->offsetY() or grids() instead

Definition at line 1638 of file qgscomposermap.cpp.

QPen QgsComposerMap::gridPen ( ) const
Deprecated:
use grid()->pen() or grids() instead

Definition at line 1663 of file qgscomposermap.cpp.

QgsComposerMapGridStack* QgsComposerMap::grids ( )
inline

Returns the map item's grid stack, which is used to control how grids are drawn over the map's contents.

Returns
pointer to grid stack
See Also
grid()
Note
introduced in QGIS 2.5

Definition at line 554 of file qgscomposermap.h.

QgsComposerMap::GridStyle QgsComposerMap::gridStyle ( ) const
Deprecated:
use grid()->style() or grids() instead

Definition at line 1590 of file qgscomposermap.cpp.

int QgsComposerMap::id ( ) const
inline

Get identification number.

Reimplemented from QgsComposerItem.

Definition at line 160 of file qgscomposermap.h.

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

Reimplemented from QgsComposerItem.

Definition at line 2322 of file qgscomposermap.cpp.

bool QgsComposerMap::isDrawing ( ) const
inline

True if a draw is already in progress.

Definition at line 163 of file qgscomposermap.h.

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.

Definition at line 239 of file qgscomposermap.h.

bool QgsComposerMap::keepLayerStyles ( ) const
inline

Getter for flag that determines if current styles of layers should be overridden by previously stored styles.

Note
added in 2.8

Definition at line 251 of file qgscomposermap.h.

QStringList QgsComposerMap::layerSet ( ) const
inline

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

Definition at line 244 of file qgscomposermap.h.

QMap<QString, QString> QgsComposerMap::layerStyleOverrides ( ) const
inline

Getter for stored overrides of styles for layers.

Note
added in 2.8

Definition at line 256 of file qgscomposermap.h.

const QgsMapRenderer * QgsComposerMap::mapRenderer ( ) const
Deprecated:
since 2.4 - use mapSettings() - may return 0 if not initialized with QgsMapRenderer

Definition at line 510 of file qgscomposermap.cpp.

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 892 of file qgscomposermap.cpp.

void QgsComposerMap::mapRotationChanged ( double  newRotation)
signal

Is emitted on rotation change to notify north arrow pictures.

QgsMapSettings QgsComposerMap::mapSettings ( const QgsRectangle extent,
const QSizeF &  size,
int  dpi 
) const

Return map settings that would be used for drawing of the map.

Note
added in 2.6

Definition at line 194 of file qgscomposermap.cpp.

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

Transforms map coordinates to item coordinates (considering rotation and move offset)

Definition at line 2180 of file qgscomposermap.cpp.

double QgsComposerMap::mapUnitsToMM ( ) const

Returns the conversion factor map units -> mm.

Definition at line 2049 of file qgscomposermap.cpp.

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

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 565 of file qgscomposermap.cpp.

int QgsComposerMap::numberExportLayers ( ) const
overridevirtual

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 430 of file qgscomposermap.cpp.

QgsComposerMapOverview * QgsComposerMap::overview ( )

Returns the map item's first overview.

This is a convenience function.

Returns
pointer to first overview for map item
See Also
overviews()
Note
introduced in QGIS 2.5

Definition at line 1886 of file qgscomposermap.cpp.

QPainter::CompositionMode QgsComposerMap::overviewBlendMode ( ) const

Returns the overview's blending mode.

Deprecated:
use overview()->blendMode() or overviews() instead

Definition at line 2107 of file qgscomposermap.cpp.

bool QgsComposerMap::overviewCentered ( ) const

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

Deprecated:
use overview()->centered() or overviews() instead

Definition at line 2131 of file qgscomposermap.cpp.

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

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

Deprecated:
use overview()->frameMapId() or overviews() instead

Definition at line 2065 of file qgscomposermap.cpp.

QgsFillSymbolV2 * QgsComposerMap::overviewFrameMapSymbol ( )
Deprecated:
use overview()->frameSymbol() or overviews() instead

Definition at line 2101 of file qgscomposermap.cpp.

bool QgsComposerMap::overviewInverted ( ) const

Returns true if the overview frame is inverted.

Deprecated:
use overview()->inverted() or overviews() instead

Definition at line 2119 of file qgscomposermap.cpp.

QgsComposerMapOverviewStack* QgsComposerMap::overviews ( )
inline

Returns the map item's overview stack, which is used to control how overviews are drawn over the map's contents.

Returns
pointer to overview stack
See Also
overview()
Note
introduced in QGIS 2.5

Definition at line 569 of file qgscomposermap.h.

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

Reimplementation of QCanvasItem::paint - draw on canvas.

Definition at line 315 of file qgscomposermap.cpp.

void QgsComposerMap::preparedForAtlas ( )
signal

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

PreviewMode QgsComposerMap::previewMode ( ) const
inline

Definition at line 235 of file qgscomposermap.h.

bool QgsComposerMap::readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc 
)
overridevirtual

sets state from Dom document

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

Reimplemented from QgsComposerObject.

Definition at line 1279 of file qgscomposermap.cpp.

void QgsComposerMap::refreshDataDefinedProperty ( const QgsComposerObject::DataDefinedProperty  property = QgsComposerObject::AllProperties)
overridevirtualslot

Definition at line 2071 of file qgscomposermap.cpp.

void QgsComposerMap::renderModeUpdateCachedImage ( )
slot

Call updateCachedImage if item is in render mode.

Definition at line 497 of file qgscomposermap.cpp.

void QgsComposerMap::requestedExtent ( QgsRectangle extent) const

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

Note
added in 2.6

Definition at line 2030 of file qgscomposermap.cpp.

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

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

Definition at line 556 of file qgscomposermap.cpp.

Q_DECL_DEPRECATED double QgsComposerMap::rotation ( ) const
inline

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

Deprecated:
Use mapRotation() instead

Reimplemented from QgsComposerItem.

Definition at line 593 of file qgscomposermap.h.

double QgsComposerMap::scale ( ) const

Scale.

Definition at line 548 of file qgscomposermap.cpp.

void QgsComposerMap::setAnnotationFontColor ( const QColor &  c)

Sets font color for grid annotations.

Deprecated:
use grid()->setAnnotationFontColor() or grids() instead

Definition at line 1694 of file qgscomposermap.cpp.

void QgsComposerMap::setAnnotationFrameDistance ( double  d)

Sets distance between map frame and annotations.

Deprecated:
use grid()->setAnnotationFrameDistance() or grids() instead

Definition at line 1749 of file qgscomposermap.cpp.

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 2346 of file qgscomposermap.cpp.

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 2363 of file qgscomposermap.cpp.

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 750 of file qgscomposermap.h.

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 731 of file qgscomposermap.h.

void QgsComposerMap::setCacheUpdated ( bool  u = false)

Definition at line 505 of file qgscomposermap.cpp.

void QgsComposerMap::setCrossLength ( double  l)

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

Deprecated:
use grid()->setCrossLength() or grids() instead

Definition at line 1874 of file qgscomposermap.cpp.

void QgsComposerMap::setDrawCanvasItems ( bool  b)
inline

Definition at line 613 of file qgscomposermap.h.

void QgsComposerMap::setFrameOutlineWidth ( const double  outlineWidth)
overridevirtual

Sets frame outline width.

Parameters
outlineWidthnew width for outline frame
Note
introduced in 2.2
See Also
frameOutlineWidth
setFrameEnabled
setFrameJoinStyle
setFrameOutlineColor

Reimplemented from QgsComposerItem.

Definition at line 1937 of file qgscomposermap.cpp.

void QgsComposerMap::setGridAnnotationDirection ( GridAnnotationDirection  d,
QgsComposerMap::Border  border 
)
Deprecated:
use grid()->setAnnotationDirection() or grids() instead

Definition at line 1761 of file qgscomposermap.cpp.

void QgsComposerMap::setGridAnnotationFont ( const QFont &  f)

Sets font for grid annotations.

Deprecated:
use grid()->setAnnotationFont() or grids() instead

Definition at line 1682 of file qgscomposermap.cpp.

void QgsComposerMap::setGridAnnotationFormat ( QgsComposerMap::GridAnnotationFormat  f)
Deprecated:
use grid()->setAnnotationFormat() or grids() instead

Definition at line 1790 of file qgscomposermap.cpp.

void QgsComposerMap::setGridAnnotationPosition ( QgsComposerMap::GridAnnotationPosition  p,
QgsComposerMap::Border  border 
)
Deprecated:
use grid()->setAnnotationPosition() or grids() instead

Definition at line 1730 of file qgscomposermap.cpp.

void QgsComposerMap::setGridAnnotationPrecision ( int  p)

Sets coordinate precision for grid annotations.

Deprecated:
use grid()->setAnnotationPrecision or grids() instead

Definition at line 1706 of file qgscomposermap.cpp.

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

Sets the grid's blending mode.

Deprecated:
use grid()->setBlendMode() or grids() instead

Definition at line 1901 of file qgscomposermap.cpp.

void QgsComposerMap::setGridEnabled ( bool  enabled)

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

Deprecated:
use grid()->setEnabled() or grids() instead

Definition at line 2156 of file qgscomposermap.cpp.

void QgsComposerMap::setGridFrameFillColor1 ( const QColor &  c)

Sets first fill color for grid zebra frame.

Note
: this function was added in version 2.1
Deprecated:
use grid()->setFrameFillColor1() or grids() instead

Definition at line 1850 of file qgscomposermap.cpp.

void QgsComposerMap::setGridFrameFillColor2 ( const QColor &  c)

Sets second fill color for grid zebra frame.

Note
: this function was added in version 2.1
Deprecated:
use grid()->setFrameFillColor2() or grids() instead

Definition at line 1862 of file qgscomposermap.cpp.

void QgsComposerMap::setGridFramePenColor ( const QColor &  c)

Sets pen color for grid frame.

Note
: this function was added in version 2.1
Deprecated:
use grid()->setFramePenColor() or grids() instead

Definition at line 1838 of file qgscomposermap.cpp.

void QgsComposerMap::setGridFramePenSize ( double  w)

Set grid frame pen thickness.

Note
: this function was added in version 2.1
Deprecated:
use grid()->setFramePenSize() or grids() instead

Definition at line 1826 of file qgscomposermap.cpp.

void QgsComposerMap::setGridFrameStyle ( GridFrameStyle  style)

Set grid frame style (NoGridFrame or Zebra)

Deprecated:
use grid()->setFrameStyle() or grids() instead

Definition at line 1802 of file qgscomposermap.cpp.

void QgsComposerMap::setGridFrameWidth ( double  w)

Set grid frame width.

Deprecated:
use grid()->setFrameWidth() or grids() instead

Definition at line 1814 of file qgscomposermap.cpp.

void QgsComposerMap::setGridIntervalX ( double  interval)

Sets coordinate interval in x-direction for composergrid.

Deprecated:
use grid()->setIntervalX() or grids() instead

Definition at line 1596 of file qgscomposermap.cpp.

void QgsComposerMap::setGridIntervalY ( double  interval)

Sets coordinate interval in y-direction for composergrid.

Deprecated:
use grid()->setIntervalY() or grids() instead

Definition at line 1608 of file qgscomposermap.cpp.

void QgsComposerMap::setGridLineSymbol ( QgsLineSymbolV2 symbol)
Deprecated:
use grid()->setLineSymbol() or grids() instead

Definition at line 2144 of file qgscomposermap.cpp.

void QgsComposerMap::setGridOffsetX ( double  offset)

Sets x-coordinate offset for composer grid.

Deprecated:
use grid()->setOffsetX() or grids() instead

Definition at line 1620 of file qgscomposermap.cpp.

void QgsComposerMap::setGridOffsetY ( double  offset)

Sets y-coordinate offset for composer grid.

Deprecated:
use grid()->setOffsetY() or grids() instead

Definition at line 1632 of file qgscomposermap.cpp.

void QgsComposerMap::setGridPen ( const QPen &  p)

Sets the pen to draw composer grid.

Deprecated:
use grid()->setPenWidth(), grid()->setPenColor() or grids() instead

Definition at line 1656 of file qgscomposermap.cpp.

void QgsComposerMap::setGridPenColor ( const QColor &  c)

Sets the color of the grid pen.

Deprecated:
use grid()->setPenColor() or grids() instead

Definition at line 1650 of file qgscomposermap.cpp.

void QgsComposerMap::setGridPenWidth ( double  w)

Sets width of grid pen.

Deprecated:
use grid()->setPenWidth() or grids() instead

Definition at line 1644 of file qgscomposermap.cpp.

void QgsComposerMap::setGridStyle ( GridStyle  style)

Sets coordinate grid style to solid or cross.

Deprecated:
use grid()->setStyle() or grids() instead

Definition at line 1584 of file qgscomposermap.cpp.

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.

Definition at line 241 of file qgscomposermap.h.

void QgsComposerMap::setKeepLayerStyles ( bool  enabled)
inline

Setter for flag that determines if current styles of layers should be overridden by previously stored styles.

Note
added in 2.8

Definition at line 253 of file qgscomposermap.h.

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

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

Definition at line 246 of file qgscomposermap.h.

void QgsComposerMap::setLayerStyleOverrides ( const QMap< QString, QString > &  overrides)
inline

Setter for stored overrides of styles for layers.

Note
added in 2.8

Definition at line 258 of file qgscomposermap.h.

void QgsComposerMap::setMapCanvas ( QGraphicsView *  canvas)
inline

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

Definition at line 611 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 883 of file qgscomposermap.cpp.

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 758 of file qgscomposermap.cpp.

void QgsComposerMap::setNewExtent ( const QgsRectangle extent)

Sets new extent for the map.

This method may change the width or height of the map item to ensure that the extent exactly matches the specified extent, with no overlap or margin. This method implicitly alters the map scale.

Parameters
extentnew extent for the map
See Also
zoomToExtent

Definition at line 698 of file qgscomposermap.cpp.

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

Sets new scale and changes only mExtent.

Definition at line 831 of file qgscomposermap.cpp.

void QgsComposerMap::setOffset ( double  xOffset,
double  yOffset 
)

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

Definition at line 871 of file qgscomposermap.cpp.

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

Sets the overview's blending mode.

Deprecated:
use overview()->setBlendMode() or overviews() instead

Definition at line 2113 of file qgscomposermap.cpp.

void QgsComposerMap::setOverviewCentered ( bool  centered)

Set the overview's centering mode.

Deprecated:
use overview()->setCentered() or overviews() instead

Definition at line 2137 of file qgscomposermap.cpp.

void QgsComposerMap::setOverviewFrameMap ( int  mapId)

Sets overview frame map.

-1 disables the overview frame

Deprecated:
use overview()->setFrameMap() or overviews() instead

Definition at line 2059 of file qgscomposermap.cpp.

void QgsComposerMap::setOverviewFrameMapSymbol ( QgsFillSymbolV2 symbol)
Deprecated:
use overview()->setFrameSymbol() or overviews() instead

Definition at line 2095 of file qgscomposermap.cpp.

void QgsComposerMap::setOverviewInverted ( bool  inverted)

Sets the overview's inversion mode.

Deprecated:
use overview()->setInverted() or overviews() instead

Definition at line 2125 of file qgscomposermap.cpp.

void QgsComposerMap::setPreviewMode ( PreviewMode  m)

Definition at line 865 of file qgscomposermap.cpp.

void QgsComposerMap::setRotation ( double  r)
overridevirtual

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 877 of file qgscomposermap.cpp.

void QgsComposerMap::setSceneRect ( const QRectF &  rectangle)
overridevirtual

Sets new scene rectangle bounds and recalculates hight and extent.

Reimplemented from QgsComposerItem.

Definition at line 676 of file qgscomposermap.cpp.

void QgsComposerMap::setShowGridAnnotation ( bool  show)

Sets flag if grid annotation should be shown.

Deprecated:
use grid()->setAnnotationEnabled() or grids() instead

Definition at line 1718 of file qgscomposermap.cpp.

void QgsComposerMap::setUpdatesEnabled ( bool  enabled)
inline

Sets whether updates to the composer map are enabled.

Definition at line 753 of file qgscomposermap.h.

bool QgsComposerMap::showGridAnnotation ( ) const
Deprecated:
use grid()->annotationEnabled() or grids() instead

Definition at line 1724 of file qgscomposermap.cpp.

void QgsComposerMap::sizeChangedByRotation ( double &  width,
double &  height 
)

Calculates width / height of the bounding box of a rotated rectangle.

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

Reimplemented from QgsComposerItem.

Definition at line 2338 of file qgscomposermap.cpp.

void QgsComposerMap::storeCurrentLayerSet ( )

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

Definition at line 1516 of file qgscomposermap.cpp.

void QgsComposerMap::storeCurrentLayerStyles ( )

Stores the current layer styles into style overrides.

Note
added in 2.8

Definition at line 1527 of file qgscomposermap.cpp.

Q_DECL_DEPRECATED void QgsComposerMap::toggleAtlasPreview ( )
inline

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

Deprecated:
no longer required

Definition at line 224 of file qgscomposermap.h.

QPolygonF QgsComposerMap::transformedMapPolygon ( ) const

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

Definition at line 1951 of file qgscomposermap.cpp.

virtual int QgsComposerMap::type ( ) const
inlineoverridevirtual

return correct graphics item type.

Reimplemented from QgsComposerItem.

Definition at line 59 of file qgscomposermap.h.

void QgsComposerMap::updateBoundingRect ( )
slot

Updates the bounding rect of this item.

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

Definition at line 1918 of file qgscomposermap.cpp.

void QgsComposerMap::updateCachedImage ( void  )
slot

Called if map canvas has changed.

Definition at line 489 of file qgscomposermap.cpp.

void QgsComposerMap::updateItem ( )
overridevirtual

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

Reimplemented from QgsComposerItem.

Definition at line 1059 of file qgscomposermap.cpp.

bool QgsComposerMap::updatesEnabled ( ) const
inline

Returns whether updates to the composer map are enabled.

Definition at line 756 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 2013 of file qgscomposermap.cpp.

bool QgsComposerMap::writeXML ( QDomElement &  elem,
QDomDocument &  doc 
) const
overridevirtual

stores state in Dom node

Parameters
elemis Dom element corresponding to 'Composer' tag
docDom document

Reimplemented from QgsComposerObject.

Definition at line 1177 of file qgscomposermap.cpp.

void QgsComposerMap::zoomContent ( int  delta,
double  x,
double  y 
)
overridevirtual

Zoom content of map.

Parameters
deltavalue from wheel event that describes direction (positive /negative number)
xx-position of mouse cursor (in item coordinates)
yy-position of mouse cursor (in item coordinates)
Deprecated:
use zoomContent( double, QPointF, ZoomMode ) instead

Reimplemented from QgsComposerItem.

Definition at line 585 of file qgscomposermap.cpp.

void QgsComposerMap::zoomContent ( const double  factor,
const QPointF  point,
const ZoomMode  mode = QgsComposerItem::Zoom 
)
overridevirtual

Zoom content of item.

Does nothing per default (but implemented in composer map)

Parameters
factorzoom factor, where > 1 results in a zoom in and < 1 results in a zoom out
pointitem point for zoom center
modezoom mode
Note
added in QGIS 2.5

Reimplemented from QgsComposerItem.

Definition at line 603 of file qgscomposermap.cpp.

void QgsComposerMap::zoomToExtent ( const QgsRectangle extent)

Zooms the map so that the specified extent is fully visible within the map item.

This method will not change the width or height of the map, and may result in an overlap or margin from the specified extent. This method implicitly alters the map scale.

Parameters
extentnew extent for the map
See Also
setNewExtent
Note
added in QGIS 2.5

Definition at line 718 of file qgscomposermap.cpp.

Friends And Related Function Documentation

friend class QgsComposerMapOverview
friend

Definition at line 940 of file qgscomposermap.h.


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