QGIS API Documentation
2.6.0-Brighton
|
Object representing map window. More...
#include <qgscomposermap.h>
Public Slots | |
void | updateCachedImage () |
Called if map canvas has changed. | |
void | renderModeUpdateCachedImage () |
Call updateCachedImage if item is in render mode. | |
void | updateBoundingRect () |
Updates the bounding rect of this item. | |
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. | |
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. | |
Public Slots inherited from QgsComposerObject | |
virtual void | repaint () |
Triggers a redraw for the item. | |
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. |
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 | itemRotationChanged (double newRotation) |
Is emitted on item rotation change. | |
void | sizeChanged () |
Emitted if the rectangle changes. | |
void | frameChanged () |
Emitted if the item's frame style changes. | |
void | lockChanged () |
Emitted if the item's lock status 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 () |
virtual int | type () const |
return correct graphics item type. | |
void | draw (QPainter *painter, const QgsRectangle &extent, const QSizeF &size, double dpi, double *forceWidthScale=0) |
Draw to paint device. | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) |
Reimplementation of QCanvasItem::paint - draw on canvas. | |
void | cache () |
Create cache image. | |
QgsMapSettings | mapSettings (const QgsRectangle &extent, const QSizeF &size, int dpi) const |
Return map settings that would be used for drawing of the map. | |
int | id () const |
Get identification number. | |
bool | isDrawing () const |
True if a draw is already in progress. | |
void | resize (double dx, double dy) |
resizes an item in x- and y direction (canvas coordinates) | |
void | moveContent (double dx, double dy) |
Move content of map. | |
Q_DECL_DEPRECATED void | zoomContent (int delta, double x, double y) |
Zoom content of map. | |
virtual void | zoomContent (const double factor, const QPointF point, const ZoomMode mode=QgsComposerItem::Zoom) |
Zoom content of item. | |
void | setSceneRect (const QRectF &rectangle) |
Sets new scene rectangle bounds and recalculates hight and extent. | |
double | scale () const |
Scale. | |
void | setNewScale (double scaleDenominator, bool forceUpdate=true) |
Sets new scale and changes only mExtent. | |
void | setNewExtent (const QgsRectangle &extent) |
Sets new extent for the map. | |
void | zoomToExtent (const QgsRectangle &extent) |
Zooms the map so that the specified extent is fully visible within the map item. | |
void | setNewAtlasFeatureExtent (const QgsRectangle &extent) |
Sets new Extent for the current atlas preview and changes width, height (and implicitely also scale). | |
Q_DECL_DEPRECATED void | toggleAtlasPreview () |
Called when atlas preview is toggled, to force map item to update its extent and redraw. | |
QgsRectangle * | 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. | |
const QgsRectangle * | currentMapExtent () 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. | |
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. | |
QStringList | layerSet () const |
Getter for stored layer set that is used if mKeepLayerSet is true. | |
void | setLayerSet (const QStringList &layerSet) |
Setter for stored layer set that is used if mKeepLayerSet is true. | |
void | storeCurrentLayerSet () |
Stores the current layer set of the qgis mapcanvas in mLayerSet. | |
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) | |
bool | containsWMSLayer () const |
True if composer map renders a WMS layer. | |
bool | containsAdvancedEffects () const |
True if composer map contains layers with blend modes or flattened layers for vectors. | |
bool | writeXML (QDomElement &elem, QDomDocument &doc) const |
stores state in Dom node | |
bool | readXML (const QDomElement &itemElem, const QDomDocument &doc) |
sets state from Dom document | |
Q_DECL_DEPRECATED void | setGridEnabled (bool enabled) |
Enables a coordinate grid that is shown on top of this composermap. | |
Q_DECL_DEPRECATED bool | gridEnabled () const |
Q_DECL_DEPRECATED void | setGridStyle (GridStyle style) |
Sets coordinate grid style to solid or cross. | |
Q_DECL_DEPRECATED GridStyle | gridStyle () const |
Q_DECL_DEPRECATED void | setGridIntervalX (double interval) |
Sets coordinate interval in x-direction for composergrid. | |
Q_DECL_DEPRECATED double | gridIntervalX () const |
Q_DECL_DEPRECATED void | setGridIntervalY (double interval) |
Sets coordinate interval in y-direction for composergrid. | |
Q_DECL_DEPRECATED double | gridIntervalY () const |
Q_DECL_DEPRECATED void | setGridOffsetX (double offset) |
Sets x-coordinate offset for composer grid. | |
Q_DECL_DEPRECATED double | gridOffsetX () const |
Q_DECL_DEPRECATED void | setGridOffsetY (double offset) |
Sets y-coordinate offset for composer grid. | |
Q_DECL_DEPRECATED double | gridOffsetY () const |
Q_DECL_DEPRECATED void | setGridPen (const QPen &p) |
Sets the pen to draw composer grid. | |
Q_DECL_DEPRECATED QPen | gridPen () const |
Q_DECL_DEPRECATED void | setGridPenWidth (double w) |
Sets width of grid pen. | |
Q_DECL_DEPRECATED void | setGridPenColor (const QColor &c) |
Sets the color of the grid pen. | |
Q_DECL_DEPRECATED void | setGridAnnotationFont (const QFont &f) |
Sets font for grid annotations. | |
Q_DECL_DEPRECATED QFont | gridAnnotationFont () const |
Q_DECL_DEPRECATED void | setAnnotationFontColor (const QColor &c) |
Sets font color for grid annotations. | |
Q_DECL_DEPRECATED QColor | annotationFontColor () const |
Get font color for grid annotations. | |
Q_DECL_DEPRECATED void | setGridAnnotationPrecision (int p) |
Sets coordinate precision for grid annotations. | |
Q_DECL_DEPRECATED int | gridAnnotationPrecision () const |
Q_DECL_DEPRECATED void | setShowGridAnnotation (bool show) |
Sets flag if grid annotation should be shown. | |
Q_DECL_DEPRECATED bool | showGridAnnotation () const |
Q_DECL_DEPRECATED void | setGridAnnotationPosition (GridAnnotationPosition p, QgsComposerMap::Border border) |
Q_DECL_DEPRECATED GridAnnotationPosition | gridAnnotationPosition (QgsComposerMap::Border border) const |
Q_DECL_DEPRECATED void | setAnnotationFrameDistance (double d) |
Sets distance between map frame and annotations. | |
Q_DECL_DEPRECATED double | annotationFrameDistance () const |
Q_DECL_DEPRECATED void | setGridAnnotationDirection (GridAnnotationDirection d, QgsComposerMap::Border border) |
Q_DECL_DEPRECATED GridAnnotationDirection | gridAnnotationDirection (QgsComposerMap::Border border) const |
Q_DECL_DEPRECATED void | setGridAnnotationFormat (GridAnnotationFormat f) |
Q_DECL_DEPRECATED GridAnnotationFormat | gridAnnotationFormat () const |
Q_DECL_DEPRECATED void | setGridFrameStyle (GridFrameStyle style) |
Set grid frame style (NoGridFrame or Zebra) | |
Q_DECL_DEPRECATED GridFrameStyle | gridFrameStyle () const |
Q_DECL_DEPRECATED void | setGridFrameWidth (double w) |
Set grid frame width. | |
Q_DECL_DEPRECATED double | gridFrameWidth () const |
Q_DECL_DEPRECATED void | setGridFramePenSize (double w) |
Set grid frame pen thickness. | |
Q_DECL_DEPRECATED double | gridFramePenSize () const |
Q_DECL_DEPRECATED void | setGridFramePenColor (const QColor &c) |
Sets pen color for grid frame. | |
Q_DECL_DEPRECATED QColor | gridFramePenColor () const |
Get pen color for grid frame. | |
Q_DECL_DEPRECATED void | setGridFrameFillColor1 (const QColor &c) |
Sets first fill color for grid zebra frame. | |
Q_DECL_DEPRECATED QColor | gridFrameFillColor1 () const |
Get 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 QColor | gridFrameFillColor2 () const |
Get second fill color for grid zebra frame. | |
Q_DECL_DEPRECATED void | setCrossLength (double l) |
Sets length of the cross segments (if grid style is cross) | |
Q_DECL_DEPRECATED double | crossLength () |
Q_DECL_DEPRECATED void | setGridLineSymbol (QgsLineSymbolV2 *symbol) |
Q_DECL_DEPRECATED QgsLineSymbolV2 * | gridLineSymbol () |
Q_DECL_DEPRECATED QPainter::CompositionMode | gridBlendMode () const |
Returns the grid's blending mode. | |
Q_DECL_DEPRECATED void | setGridBlendMode (QPainter::CompositionMode blendMode) |
Sets the grid's blending mode. | |
QgsComposerMapGridStack * | grids () |
Returns the map item's grid stack, which is used to control how grids are drawn over the map's contents. | |
QgsComposerMapGrid * | grid () |
Returns the map item's first grid. | |
QgsComposerMapOverviewStack * | overviews () |
Returns the map item's overview stack, which is used to control how overviews are drawn over the map's contents. | |
QgsComposerMapOverview * | overview () |
Returns the map item's first overview. | |
QRectF | boundingRect () const |
In case of annotations, the bounding rectangle can be larger than the map item rectangle. | |
virtual void | setFrameOutlineWidth (const double outlineWidth) |
Sets frame outline width. | |
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. | |
Q_DECL_DEPRECATED double | rotation () const |
Returns the rotation used for drawing the map within the composer item. | |
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. | |
double | mapRotation (QgsComposerObject::PropertyValueType valueType=QgsComposerObject::EvaluatedValue) const |
Returns the rotation used for drawing the map within the composer item. | |
void | updateItem () |
Updates item, with the possibility to do custom update for subclasses. | |
void | setMapCanvas (QGraphicsView *canvas) |
Sets canvas pointer (necessary to query and draw map canvas items) | |
void | setDrawCanvasItems (bool b) |
bool | drawCanvasItems () const |
double | mapUnitsToMM () const |
Returns the conversion factor map units -> mm. | |
Q_DECL_DEPRECATED void | setOverviewFrameMap (int mapId) |
Sets overview frame map. | |
Q_DECL_DEPRECATED int | overviewFrameMapId () const |
Returns id of overview frame (or -1 if no overfiew frame) | |
Q_DECL_DEPRECATED void | setOverviewFrameMapSymbol (QgsFillSymbolV2 *symbol) |
Q_DECL_DEPRECATED QgsFillSymbolV2 * | overviewFrameMapSymbol () |
Q_DECL_DEPRECATED QPainter::CompositionMode | overviewBlendMode () const |
Returns the overview's blending mode. | |
Q_DECL_DEPRECATED void | setOverviewBlendMode (QPainter::CompositionMode blendMode) |
Sets the overview's blending mode. | |
Q_DECL_DEPRECATED bool | overviewInverted () const |
Returns true if the overview frame is inverted. | |
Q_DECL_DEPRECATED void | setOverviewInverted (bool inverted) |
Sets the overview's inversion mode. | |
Q_DECL_DEPRECATED bool | overviewCentered () const |
Returns true if the extent is forced to center on the overview. | |
Q_DECL_DEPRECATED void | setOverviewCentered (bool centered) |
Set the overview's centering mode. | |
void | assignFreeId () |
Sets mId to a number not yet used in the composition. | |
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. | |
Q_DECL_DEPRECATED bool | cornerPointOnRotatedAndScaledRect (double &x, double &y, double width, double height) const |
Calculates corner point after rotation and scaling. | |
Q_DECL_DEPRECATED void | sizeChangedByRotation (double &width, double &height) |
Calculates width / height of the bounding box of a rotated rectangle. | |
bool | atlasDriven () const |
Returns whether the map extent is set to follow the current atlas feature. | |
void | setAtlasDriven (bool enabled) |
Sets whether the map extent will follow the current atlas feature. | |
Q_DECL_DEPRECATED bool | atlasFixedScale () const |
Returns true if the map uses a fixed scale when in atlas mode. | |
Q_DECL_DEPRECATED void | setAtlasFixedScale (bool fixed) |
Set to true if the map should use a fixed scale when in atlas mode. | |
AtlasScalingMode | atlasScalingMode () const |
Returns the current atlas scaling mode. | |
void | setAtlasScalingMode (AtlasScalingMode mode) |
Sets the current atlas scaling mode. | |
double | atlasMargin (const QgsComposerObject::PropertyValueType valueType=QgsComposerObject::EvaluatedValue) |
Returns the margin size (percentage) used when the map is in atlas mode. | |
void | setAtlasMargin (double margin) |
Sets the margin size (percentage) used when the map is in atlas mode. | |
void | setUpdatesEnabled (bool enabled) |
Sets whether updates to the composer map are enabled. | |
bool | updatesEnabled () const |
Returns whether updates to the composer map are enabled. | |
int | numberExportLayers () const |
Get the number of layers that this item requires for exporting as layers. | |
QPolygonF | visibleExtentPolygon () const |
Returns a polygon representing the current visible map extent, considering map extents and rotation. | |
virtual QString | displayName () const |
Get item display name. | |
QPolygonF | transformedMapPolygon () const |
Returns extent that considers rotation and shift with mOffsetX / mOffsetY. | |
QPointF | mapToItemCoords (const QPointF &mapCoords) const |
Transforms map coordinates to item coordinates (considering rotation and move offset) | |
Q_DECL_DEPRECATED void | connectMapOverviewSignals () |
void | requestedExtent (QgsRectangle &extent) const |
Calculates the extent to request and the yShift of the top-left point in case of rotation. | |
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 () |
virtual bool | isRemoved () const |
Returns whether this item has been removed from the composition. | |
void | setIsRemoved (const bool removed) |
Sets whether this item has been removed from the composition. | |
virtual void | setSelected (bool s) |
Set selected, selected item should be highlighted. | |
virtual bool | selected () const |
Is selected. | |
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. | |
void | updatePagePos (double newPageWidth, double newPageHeight) |
Moves the item so that it retains its relative position on the page when the paper size changes. | |
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. | |
ItemPositionMode | lastUsedPositionMode () |
Returns item's last used position mode. | |
bool | _writeXML (QDomElement &itemElem, QDomDocument &doc) const |
Writes parameter that are not subclass specific in document. | |
bool | _readXML (const QDomElement &itemElem, const QDomDocument &doc) |
Reads parameter that are not subclass specific in document. | |
bool | hasFrame () const |
Whether this item has a frame or not. | |
void | setFrameEnabled (const bool drawFrame) |
Set whether this item has a frame drawn around it or not. | |
virtual void | setFrameOutlineColor (const QColor &color) |
Sets frame outline color. | |
QColor | frameOutlineColor () const |
Returns the frame's outline color. | |
double | frameOutlineWidth () const |
Returns the frame's outline width. | |
Qt::PenJoinStyle | frameJoinStyle () const |
Returns the join style used for drawing the item's frame. | |
void | setFrameJoinStyle (const Qt::PenJoinStyle style) |
Sets join style used when drawing the item's frame. | |
virtual double | estimatedFrameBleed () const |
Returns the estimated amount the item's frame bleeds outside the item's actual rectangle. | |
virtual QRectF | rectWithFrame () const |
Returns the item's rectangular bounds, including any bleed caused by the item's frame. | |
bool | hasBackground () const |
Whether this item has a Background or not. | |
void | setBackgroundEnabled (const bool drawBackground) |
Set whether this item has a Background drawn around it or not. | |
QColor | backgroundColor () const |
Gets the background color for this item. | |
void | setBackgroundColor (const QColor &backgroundColor) |
Sets the background color for this item. | |
QPainter::CompositionMode | blendMode () const |
Returns the item's composition blending mode. | |
void | setBlendMode (const QPainter::CompositionMode blendMode) |
Sets the item's composition blending mode. | |
int | transparency () const |
Returns the item's transparency. | |
void | setTransparency (const int transparency) |
Sets the item's transparency. | |
bool | effectsEnabled () const |
Returns whether effects (eg blend modes) are enabled for the item. | |
void | setEffectsEnabled (const bool effectsEnabled) |
Sets whether effects (eg blend modes) are enabled for the item. | |
virtual void | addItem (QgsComposerItem *item) |
Composite operations for item groups do nothing per default. | |
virtual void | removeItems () |
virtual void | beginItemCommand (const QString &text) |
void | beginCommand (const QString &commandText, QgsComposerMergeCommand::Context c=QgsComposerMergeCommand::Unknown) |
Starts new composer undo command. | |
virtual void | endItemCommand () |
void | endCommand () |
Finish current command and push it onto the undo stack. | |
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. | |
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. | |
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 | 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 | fontHeightMillimeters (const QFont &font) const |
Returns the font height in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE. | |
Q_DECL_DEPRECATED double | pixelFontSize (double pointSize) const |
Calculates font size in mm from a font point size. | |
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. | |
void | setPositionLock (const bool lock) |
Locks / unlocks the item position for mouse drags. | |
bool | positionLock () const |
Returns whether position lock for mouse drags is enabled returns true if item is locked for mouse movement and resizing. | |
double | itemRotation (const QgsComposerObject::PropertyValueType valueType=QgsComposerObject::EvaluatedValue) const |
Returns the current rotation for the composer item. | |
virtual void | setId (const QString &id) |
Set item's id (which is not necessarly unique) | |
QString | uuid () const |
Get item identification name. | |
virtual void | setVisibility (const bool visible) |
Sets visibility for item. | |
bool | excludeFromExports (const QgsComposerObject::PropertyValueType valueType=QgsComposerObject::EvaluatedValue) |
Returns whether the item should be excluded from composer exports and prints. | |
virtual void | setExcludeFromExports (const bool exclude) |
Sets whether the item should be excluded from composer exports and prints. | |
bool | isGroupMember () const |
Returns whether this item is part of a group. | |
void | setIsGroupMember (const bool isGroupMember) |
Sets whether this item is part of a group. | |
virtual void | setCurrentExportLayer (const int layerIdx=-1) |
Sets the current layer to draw for exporting. | |
Public Member Functions inherited from QgsComposerObject | |
QgsComposerObject (QgsComposition *composition) | |
Constructor. | |
virtual | ~QgsComposerObject () |
const QgsComposition * | composition () const |
Returns the composition the item is attached to. | |
QgsComposition * | composition () |
QgsDataDefined * | dataDefinedProperty (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 | |
virtual void | drawSelectionBoxes (QPainter *p) |
Draws additional graphics on selected items. | |
virtual void | drawFrame (QPainter *p) |
Draw black frame around item. | |
virtual void | drawBackground (QPainter *p) |
Draw background. | |
Q_DECL_DEPRECATED void | drawArrowHead (QPainter *p, double x, double y, double angle, double arrowHeadWidth) const |
Draws arrowhead. | |
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) | |
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 double | lockSymbolSize () const |
Returns the size of the lock symbol depending on the composer zoom level and the item size. | |
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 bool | cornerPointOnRotatedAndScaledRect (double &x, double &y, double width, double height, double rotation) const |
Calculates corner point after rotation and scaling. | |
Q_DECL_DEPRECATED void | sizeChangedByRotation (double &width, double &height, double rotation) |
Calculates width / height of the bounding box of a rotated rectangle. | |
Q_DECL_DEPRECATED void | rotate (double angle, double &x, double &y) const |
Rotates a point / vector. | |
QGraphicsLineItem * | hAlignSnapItem () |
Return horizontal align snap item. | |
void | deleteHAlignSnapItem () |
QGraphicsLineItem * | vAlignSnapItem () |
Return vertical align snap item. | |
void | deleteVAlignSnapItem () |
void | deleteAlignItems () |
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. | |
bool | shouldDrawItem () const |
Returns whether the item should be drawn in the current context. | |
Protected Attributes inherited from QgsComposerItem | |
bool | mRemovedFromComposition |
True if item has been removed from the composition. | |
QgsComposerItem::MouseMoveAction | mCurrentMouseMoveAction |
QPointF | mMouseMoveStartPos |
Start point of the last mouse move action (in scene coordinates) | |
QPointF | mLastMouseEventPos |
Position of the last mouse move event (in scene coordinates) | |
QGraphicsRectItem * | mBoundingResizeRectangle |
Rectangle used during move and resize actions. | |
QGraphicsLineItem * | mHAlignSnapItem |
QGraphicsLineItem * | mVAlignSnapItem |
bool | mFrame |
True if item fram needs to be painted. | |
bool | mBackground |
True if item background needs to be painted. | |
QColor | mBackgroundColor |
Background color. | |
Qt::PenJoinStyle | mFrameJoinStyle |
Frame join style. | |
bool | mItemPositionLocked |
True if item position and size cannot be changed with mouse move. | |
double | mLastValidViewScaleFactor |
Backup to restore item appearance if no view scale factor is available. | |
double | mItemRotation |
Item rotation in degrees, clockwise. | |
double | mEvaluatedItemRotation |
Temporary evaluated item rotation in degrees, clockwise. | |
QPainter::CompositionMode | mBlendMode |
Composition blend mode for item. | |
bool | mEffectsEnabled |
QgsComposerEffect * | mEffect |
int | mTransparency |
Item transparency. | |
bool | mExcludeFromExports |
Whether item should be excluded in exports. | |
bool | mEvaluatedExcludeFromExports |
Temporary evaluated item exclusion. | |
ItemPositionMode | mLastUsedPositionMode |
The item's position mode. | |
bool | mIsGroupMember |
Whether or not this item is part of a group. | |
int | mCurrentExportLayer |
The layer that needs to be exported. |
Object representing map window.
QgsComposerMap::QgsComposerMap | ( | QgsComposition * | composition, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Constructor.
QgsComposerMap::QgsComposerMap | ( | QgsComposition * | composition | ) |
Constructor.
Settings are read from project.
|
virtual |
QColor QgsComposerMap::annotationFontColor | ( | ) | const |
Get font color for grid annotations.
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
|
inline |
Returns whether the map extent is set to follow the current atlas feature.
bool QgsComposerMap::atlasFixedScale | ( | ) | const |
Returns true if the map uses a fixed scale when in atlas mode.
double QgsComposerMap::atlasMargin | ( | const QgsComposerObject::PropertyValueType | valueType = QgsComposerObject::EvaluatedValue | ) |
Returns the margin size (percentage) used when the map is in atlas mode.
valueType | controls 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). |
|
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.
QRectF QgsComposerMap::boundingRect | ( | ) | const |
In case of annotations, the bounding rectangle can be larger than the map item rectangle.
void QgsComposerMap::cache | ( | void | ) |
Create cache image.
void QgsComposerMap::connectMapOverviewSignals | ( | ) |
bool QgsComposerMap::containsAdvancedEffects | ( | ) | const |
True if composer map contains layers with blend modes or flattened layers for vectors.
bool QgsComposerMap::containsWMSLayer | ( | ) | const |
True if composer map renders a WMS layer.
bool QgsComposerMap::cornerPointOnRotatedAndScaledRect | ( | double & | x, |
double & | y, | ||
double | width, | ||
double | height | ||
) | const |
Calculates corner point after rotation and scaling.
Reimplemented from QgsComposerItem.
double QgsComposerMap::crossLength | ( | ) |
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.
const QgsRectangle * QgsComposerMap::currentMapExtent | ( | ) | const |
|
virtual |
Get item display name.
This is the item's id if set, and if not, a user-friendly string identifying item type.
Reimplemented from QgsComposerItem.
void QgsComposerMap::draw | ( | QPainter * | painter, |
const QgsRectangle & | extent, | ||
const QSizeF & | size, | ||
double | dpi, | ||
double * | forceWidthScale = 0 |
||
) |
Draw to paint device.
painter | painter |
extent | map extent |
size | size in scene coordinates |
dpi | scene dpi |
forceWidthScale | force wysiwyg line widths / marker sizes |
|
inline |
|
inline |
|
signal |
QgsComposerMapGrid * QgsComposerMap::grid | ( | ) |
Returns the map item's first grid.
This is a convenience function.
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.
bool QgsComposerMap::gridEnabled | ( | ) | const |
QColor QgsComposerMap::gridFrameFillColor1 | ( | ) | const |
Get first fill color for grid zebra frame.
QColor QgsComposerMap::gridFrameFillColor2 | ( | ) | const |
Get second fill color for grid zebra frame.
QColor QgsComposerMap::gridFramePenColor | ( | ) | const |
Get pen color for grid frame.
double QgsComposerMap::gridFramePenSize | ( | ) | const |
QgsComposerMap::GridFrameStyle QgsComposerMap::gridFrameStyle | ( | ) | const |
double QgsComposerMap::gridFrameWidth | ( | ) | const |
double QgsComposerMap::gridIntervalX | ( | ) | const |
double QgsComposerMap::gridIntervalY | ( | ) | const |
QgsLineSymbolV2 * QgsComposerMap::gridLineSymbol | ( | ) |
double QgsComposerMap::gridOffsetX | ( | ) | const |
double QgsComposerMap::gridOffsetY | ( | ) | const |
QPen QgsComposerMap::gridPen | ( | ) | const |
|
inline |
Returns the map item's grid stack, which is used to control how grids are drawn over the map's contents.
QgsComposerMap::GridStyle QgsComposerMap::gridStyle | ( | ) | const |
|
inline |
Get identification number.
Reimplemented from QgsComposerItem.
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.
Reimplemented from QgsComposerItem.
|
inline |
True if a draw is already in progress.
|
inline |
Getter for flag that determines if the stored layer set should be used or the current layer set of the qgis mapcanvas.
|
inline |
Getter for stored layer set that is used if mKeepLayerSet is true.
const QgsMapRenderer * QgsComposerMap::mapRenderer | ( | ) | const |
double QgsComposerMap::mapRotation | ( | QgsComposerObject::PropertyValueType | valueType = QgsComposerObject::EvaluatedValue | ) | const |
Returns the rotation used for drawing the map within the composer item.
valueType | controls whether the returned value is the user specified rotation, or the current evaluated rotation (which may be affected by data driven rotation settings). |
|
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.
QPointF QgsComposerMap::mapToItemCoords | ( | const QPointF & | mapCoords | ) | const |
Transforms map coordinates to item coordinates (considering rotation and move offset)
double QgsComposerMap::mapUnitsToMM | ( | ) | const |
Returns the conversion factor map units -> mm.
|
virtual |
Move content of map.
dx | move in x-direction (item and canvas coordinates) |
dy | move in y-direction (item and canvas coordinates) |
Reimplemented from QgsComposerItem.
|
virtual |
Get the number of layers that this item requires for exporting as layers.
Reimplemented from QgsComposerItem.
QgsComposerMapOverview * QgsComposerMap::overview | ( | ) |
Returns the map item's first overview.
This is a convenience function.
QPainter::CompositionMode QgsComposerMap::overviewBlendMode | ( | ) | const |
Returns the overview's blending mode.
bool QgsComposerMap::overviewCentered | ( | ) | const |
Returns true if the extent is forced to center on the overview.
|
inlineslot |
int QgsComposerMap::overviewFrameMapId | ( | ) | const |
Returns id of overview frame (or -1 if no overfiew frame)
QgsFillSymbolV2 * QgsComposerMap::overviewFrameMapSymbol | ( | ) |
bool QgsComposerMap::overviewInverted | ( | ) | const |
Returns true if the overview frame is inverted.
|
inline |
Returns the map item's overview stack, which is used to control how overviews are drawn over the map's contents.
void QgsComposerMap::paint | ( | QPainter * | painter, |
const QStyleOptionGraphicsItem * | itemStyle, | ||
QWidget * | pWidget | ||
) |
Reimplementation of QCanvasItem::paint - draw on canvas.
|
signal |
Is emitted when the map has been prepared for atlas rendering, just before actual rendering.
|
inline |
|
virtual |
sets state from Dom document
itemElem | is Dom node corresponding to 'ComposerMap' tag |
doc | is Dom document |
Reimplemented from QgsComposerObject.
|
virtualslot |
|
slot |
Call updateCachedImage if item is in render mode.
void QgsComposerMap::requestedExtent | ( | QgsRectangle & | extent | ) | const |
Calculates the extent to request and the yShift of the top-left point in case of rotation.
void QgsComposerMap::resize | ( | double | dx, |
double | dy | ||
) |
resizes an item in x- and y direction (canvas coordinates)
|
inline |
Returns the rotation used for drawing the map within the composer item.
Reimplemented from QgsComposerItem.
double QgsComposerMap::scale | ( | ) | const |
Scale.
void QgsComposerMap::setAnnotationFontColor | ( | const QColor & | c | ) |
Sets font color for grid annotations.
void QgsComposerMap::setAnnotationFrameDistance | ( | double | d | ) |
Sets distance between map frame and annotations.
void QgsComposerMap::setAtlasDriven | ( | bool | enabled | ) |
Sets whether the map extent will follow the current atlas feature.
enabled | set to true if the map extents should be set by the current atlas feature. |
void QgsComposerMap::setAtlasFixedScale | ( | bool | fixed | ) |
Set to true if the map should use a fixed scale when in atlas mode.
|
inline |
Sets the margin size (percentage) used when the map is in atlas mode.
margin | size in percentage to leave around the atlas feature's extent |
|
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.
mode | atlas scaling mode to set |
void QgsComposerMap::setCacheUpdated | ( | bool | u = false | ) |
void QgsComposerMap::setCrossLength | ( | double | l | ) |
Sets length of the cross segments (if grid style is cross)
|
inline |
|
virtual |
Sets frame outline width.
outlineWidth | new width for outline frame |
Reimplemented from QgsComposerItem.
void QgsComposerMap::setGridAnnotationDirection | ( | GridAnnotationDirection | d, |
QgsComposerMap::Border | border | ||
) |
void QgsComposerMap::setGridAnnotationFont | ( | const QFont & | f | ) |
Sets font for grid annotations.
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.
void QgsComposerMap::setGridBlendMode | ( | QPainter::CompositionMode | blendMode | ) |
Sets the grid's blending mode.
void QgsComposerMap::setGridEnabled | ( | bool | enabled | ) |
Enables a coordinate grid that is shown on top of this composermap.
void QgsComposerMap::setGridFrameFillColor1 | ( | const QColor & | c | ) |
Sets first fill color for grid zebra frame.
void QgsComposerMap::setGridFrameFillColor2 | ( | const QColor & | c | ) |
Sets second fill color for grid zebra frame.
void QgsComposerMap::setGridFramePenColor | ( | const QColor & | c | ) |
Sets pen color for grid frame.
void QgsComposerMap::setGridFramePenSize | ( | double | w | ) |
Set grid frame pen thickness.
void QgsComposerMap::setGridFrameStyle | ( | GridFrameStyle | style | ) |
Set grid frame style (NoGridFrame or Zebra)
void QgsComposerMap::setGridFrameWidth | ( | double | w | ) |
Set grid frame width.
void QgsComposerMap::setGridIntervalX | ( | double | interval | ) |
Sets coordinate interval in x-direction for composergrid.
void QgsComposerMap::setGridIntervalY | ( | double | interval | ) |
Sets coordinate interval in y-direction for composergrid.
void QgsComposerMap::setGridLineSymbol | ( | QgsLineSymbolV2 * | symbol | ) |
void QgsComposerMap::setGridOffsetX | ( | double | offset | ) |
Sets x-coordinate offset for composer grid.
void QgsComposerMap::setGridOffsetY | ( | double | offset | ) |
Sets y-coordinate offset for composer grid.
void QgsComposerMap::setGridPen | ( | const QPen & | p | ) |
Sets the pen to draw composer grid.
void QgsComposerMap::setGridPenColor | ( | const QColor & | c | ) |
Sets the color of the grid pen.
void QgsComposerMap::setGridPenWidth | ( | double | w | ) |
Sets width of grid pen.
void QgsComposerMap::setGridStyle | ( | GridStyle | style | ) |
Sets coordinate grid style to solid or cross.
|
inline |
Setter for flag that determines if the stored layer set should be used or the current layer set of the qgis mapcanvas.
|
inline |
Setter for stored layer set that is used if mKeepLayerSet is true.
|
inline |
Sets canvas pointer (necessary to query and draw map canvas items)
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.
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
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.
extent | new extent for the map |
void QgsComposerMap::setNewScale | ( | double | scaleDenominator, |
bool | forceUpdate = true |
||
) |
Sets new scale and changes only mExtent.
void QgsComposerMap::setOffset | ( | double | xOffset, |
double | yOffset | ||
) |
Sets offset values to shift image (useful for live updates when moving item content)
void QgsComposerMap::setOverviewBlendMode | ( | QPainter::CompositionMode | blendMode | ) |
Sets the overview's blending mode.
void QgsComposerMap::setOverviewCentered | ( | bool | centered | ) |
Set the overview's centering mode.
void QgsComposerMap::setOverviewFrameMap | ( | int | mapId | ) |
Sets overview frame map.
-1 disables the overview frame
void QgsComposerMap::setOverviewFrameMapSymbol | ( | QgsFillSymbolV2 * | symbol | ) |
void QgsComposerMap::setOverviewInverted | ( | bool | inverted | ) |
Sets the overview's inversion mode.
void QgsComposerMap::setPreviewMode | ( | PreviewMode | m | ) |
|
virtual |
Sets rotation for the map - this does not affect the composer item shape, only the way the map is drawn within the item.
Reimplemented from QgsComposerItem.
|
virtual |
Sets new scene rectangle bounds and recalculates hight and extent.
Reimplemented from QgsComposerItem.
void QgsComposerMap::setShowGridAnnotation | ( | bool | show | ) |
Sets flag if grid annotation should be shown.
|
inline |
Sets whether updates to the composer map are enabled.
bool QgsComposerMap::showGridAnnotation | ( | ) | const |
void QgsComposerMap::sizeChangedByRotation | ( | double & | width, |
double & | height | ||
) |
Calculates width / height of the bounding box of a rotated rectangle.
Reimplemented from QgsComposerItem.
void QgsComposerMap::storeCurrentLayerSet | ( | ) |
Stores the current layer set of the qgis mapcanvas in mLayerSet.
|
inline |
Called when atlas preview is toggled, to force map item to update its extent and redraw.
QPolygonF QgsComposerMap::transformedMapPolygon | ( | ) | const |
Returns extent that considers rotation and shift with mOffsetX / mOffsetY.
|
inlinevirtual |
return correct graphics item type.
Reimplemented from QgsComposerItem.
|
slot |
Updates the bounding rect of this item.
Call this function before doing any changes related to annotation out of the map rectangle
|
slot |
Called if map canvas has changed.
|
virtual |
Updates item, with the possibility to do custom update for subclasses.
Reimplemented from QgsComposerItem.
|
inline |
Returns whether updates to the composer map are enabled.
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
|
virtual |
stores state in Dom node
elem | is Dom element corresponding to 'Composer' tag |
doc | Dom document |
Reimplemented from QgsComposerObject.
|
virtual |
Zoom content of map.
delta | value from wheel event that describes direction (positive /negative number) |
x | x-position of mouse cursor (in item coordinates) |
y | y-position of mouse cursor (in item coordinates) |
Reimplemented from QgsComposerItem.
|
virtual |
Zoom content of item.
Does nothing per default (but implemented in composer map)
factor | zoom factor, where > 1 results in a zoom in and < 1 results in a zoom out |
point | item point for zoom center |
mode | zoom mode |
Reimplemented from QgsComposerItem.
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.
extent | new extent for the map |
|
friend |