QGIS API Documentation  2.99.0-Master (8ec3eaf)
Classes | Public Types | Public Member Functions | Friends | List of all members
QgsComposerMapGrid Class Reference

An individual grid which is drawn above the map content in a QgsComposerMap. More...

#include <qgscomposermapgrid.h>

Inheritance diagram for QgsComposerMapGrid:
Inheritance graph
[legend]

Public Types

enum  AnnotationCoordinate { Longitude = 0, Latitude }
 Annotation coordinate type. More...
 
enum  AnnotationDirection { Horizontal = 0, Vertical, VerticalDescending, BoundaryDirection }
 Direction of grid annotations. More...
 
enum  AnnotationFormat {
  Decimal = 0, DegreeMinute, DegreeMinuteSecond, DecimalWithSuffix,
  DegreeMinuteNoSuffix, DegreeMinutePadded, DegreeMinuteSecondNoSuffix, DegreeMinuteSecondPadded,
  CustomFormat
}
 Format for displaying grid annotations. More...
 
enum  AnnotationPosition { InsideMapFrame = 0, OutsideMapFrame }
 Position for grid annotations. More...
 
enum  BorderSide { Left, Right, Bottom, Top }
 Border sides for annotations. More...
 
enum  DisplayMode { ShowAll = 0, LatitudeOnly, LongitudeOnly, HideAll }
 Display settings for grid annotations and frames. More...
 
enum  FrameSideFlag { FrameLeft = 0x01, FrameRight = 0x02, FrameTop = 0x04, FrameBottom = 0x08 }
 Flags for controlling which side of the map a frame is drawn on. More...
 
enum  FrameStyle {
  NoFrame = 0, Zebra, InteriorTicks, ExteriorTicks,
  InteriorExteriorTicks, LineBorder
}
 Style for grid frame. More...
 
enum  GridStyle { Solid = 0, Cross, Markers, FrameAnnotationsOnly }
 Grid drawing style. More...
 
enum  GridUnit { MapUnit, MM, CM }
 Unit for grid values. 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,
  MapLayers, MapStylePreset, 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 Member Functions

 QgsComposerMapGrid (const QString &name, QgsComposerMap *map)
 Constructor for QgsComposerMapGrid. More...
 
virtual ~QgsComposerMapGrid ()
 
AnnotationDirection annotationDirection (const BorderSide border) const
 Gets the direction for drawing frame annotations. More...
 
DisplayMode annotationDisplay (const BorderSide border) const
 Gets the display mode for the grid annotations on a specified side of the map frame. More...
 
bool annotationEnabled () const
 Gets whether annotations are shown for the grid. More...
 
QString annotationExpression () const
 Returns the expression used for drawing grid annotations. More...
 
QFont annotationFont () const
 Gets the font used for drawing grid annotations. More...
 
QColor annotationFontColor () const
 Gets the font color used for drawing grid annotations. More...
 
AnnotationFormat annotationFormat () const
 Gets the format for drawing grid annotations. More...
 
double annotationFrameDistance () const
 Gets the distance between the map frame and annotations. More...
 
AnnotationPosition annotationPosition (const BorderSide border) const
 Gets the position for the grid annotations on a specified side of the map frame. More...
 
int annotationPrecision () const
 Returns the coordinate precision for grid annotations. More...
 
QPainter::CompositionMode blendMode () const
 Retrieves the blending mode used for drawing the grid. More...
 
void calculateMaxExtension (double &top, double &right, double &bottom, double &left)
 Calculates the maximum distance the grid extends beyond the QgsComposerMap's item rect. More...
 
virtual QgsExpressionContext createExpressionContext () const override
 Creates an expression context relating to the objects' current state. More...
 
double crossLength () const
 Retrieves the length of the cross segments drawn for the grid. More...
 
QgsCoordinateReferenceSystem crs () const
 Retrieves the CRS for the grid. More...
 
void draw (QPainter *painter) override
 Draws a grid. More...
 
DisplayMode frameDivisions (const BorderSide border) const
 Gets the type of grid divisions which are used for frames on a specified side of the map. More...
 
QColor frameFillColor1 () const
 Retrieves the first fill color for the grid frame. More...
 
QColor frameFillColor2 () const
 Retrieves the second fill color for the grid frame. More...
 
QColor framePenColor () const
 Retrieves the color of the outline drawn in the grid frame. More...
 
double framePenSize () const
 Retrieves the width of the outline drawn in the grid frame. More...
 
FrameSideFlags frameSideFlags () const
 Returns the flags which control which sides of the map item the grid frame is drawn on. More...
 
FrameStyle frameStyle () const
 Gets the grid frame style. More...
 
double frameWidth () const
 Gets the grid frame width. More...
 
double intervalX () const
 Gets the interval between grid lines in the x-direction. More...
 
double intervalY () const
 Gets the interval between grid lines in the y-direction. More...
 
const QgsLineSymbollineSymbol () const
 Gets the line symbol used for drawing grid lines. More...
 
QgsLineSymbollineSymbol ()
 Gets the line symbol used for drawing grid lines. More...
 
const QgsMarkerSymbolmarkerSymbol () const
 Gets the marker symbol used for drawing grid points. More...
 
QgsMarkerSymbolmarkerSymbol ()
 Gets the marker symbol used for drawing grid points. More...
 
double maxExtension ()
 Calculates the maximum distance the grid extends beyond the QgsComposerMap's item rect. More...
 
double offsetX () const
 Gets the offset for grid lines in the x-direction. More...
 
double offsetY () const
 Gets the offset for grid lines in the y-direction. More...
 
bool readXml (const QDomElement &itemElem, const QDomDocument &doc) override
 Sets grid state from a DOM document. More...
 
void setAnnotationDirection (const AnnotationDirection direction, const BorderSide border)
 Sets the direction for drawing frame annotations. More...
 
void setAnnotationDirection (const AnnotationDirection direction)
 Sets the direction for drawing all frame annotations. More...
 
void setAnnotationDisplay (const DisplayMode display, const BorderSide border)
 Sets what types of grid annotations should be drawn for a specified side of the map frame, or whether grid annotations should be disabled for the side. More...
 
void setAnnotationEnabled (const bool enabled)
 Sets whether annotations should be shown for the grid. More...
 
void setAnnotationExpression (const QString &expression)
 Sets the expression used for drawing grid annotations. More...
 
void setAnnotationFont (const QFont &font)
 Sets the font used for drawing grid annotations. More...
 
void setAnnotationFontColor (const QColor &color)
 Sets the font color used for drawing grid annotations. More...
 
void setAnnotationFormat (const AnnotationFormat format)
 Sets the format for drawing grid annotations. More...
 
void setAnnotationFrameDistance (const double distance)
 Sets the distance between the map frame and annotations. More...
 
void setAnnotationPosition (const AnnotationPosition position, const BorderSide border)
 Sets the position for the grid annotations on a specified side of the map frame. More...
 
void setAnnotationPrecision (const int precision)
 Sets the coordinate precision for grid annotations. More...
 
void setBlendMode (const QPainter::CompositionMode mode)
 Sets the blending mode used for drawing the grid. More...
 
void setCrossLength (const double length)
 Sets the length of the cross segments drawn for the grid. More...
 
void setCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the CRS for the grid. More...
 
void setFrameDivisions (const DisplayMode divisions, const BorderSide border)
 Sets what type of grid divisions should be used for frames on a specified side of the map. More...
 
void setFrameFillColor1 (const QColor &color)
 Sets the first fill color used for the grid frame. More...
 
void setFrameFillColor2 (const QColor &color)
 Sets the second fill color used for the grid frame. More...
 
void setFramePenColor (const QColor &color)
 Sets the color of the outline drawn in the grid frame. More...
 
void setFramePenSize (const double width)
 Sets the width of the outline drawn in the grid frame. More...
 
void setFrameSideFlag (const FrameSideFlag flag, bool on=true)
 Sets whether the grid frame is drawn for a certain side of the map item. More...
 
void setFrameSideFlags (QgsComposerMapGrid::FrameSideFlags flags)
 Sets flags for grid frame sides. More...
 
void setFrameStyle (const FrameStyle style)
 Sets the grid frame style. More...
 
void setFrameWidth (const double width)
 Sets the grid frame width. More...
 
void setGridLineColor (const QColor &color)
 Sets color of grid lines. More...
 
void setGridLineWidth (const double width)
 Sets width of grid lines. More...
 
void setIntervalX (const double interval)
 Sets the interval between grid lines in the x-direction. More...
 
void setIntervalY (const double interval)
 Sets the interval between grid lines in the y-direction. More...
 
void setLineSymbol (QgsLineSymbol *symbol)
 Sets the line symbol used for drawing grid lines. More...
 
void setMarkerSymbol (QgsMarkerSymbol *symbol)
 Sets the marker symbol used for drawing grid points. More...
 
void setOffsetX (const double offset)
 Sets the offset for grid lines in the x-direction. More...
 
void setOffsetY (const double offset)
 Sets the offset for grid lines in the y-direction. More...
 
void setStyle (const GridStyle style)
 Sets the grid style, which controls how the grid is drawn over the map's contents. More...
 
void setUnits (const GridUnit unit)
 Sets the units to use for grid measurements such as the interval and offset for grid lines. More...
 
GridStyle style () const
 Gets the grid's style, which controls how the grid is drawn over the map's contents. More...
 
bool testFrameSideFlag (const FrameSideFlag flag) const
 Tests whether the grid frame should be drawn on a specified side of the map item. More...
 
GridUnit units () const
 Gets the units used for grid measurements such as the interval and offset for grid lines. More...
 
bool usesAdvancedEffects () const override
 Returns true if the item is drawn using advanced effects, such as blend modes. More...
 
bool writeXml (QDomElement &elem, QDomDocument &doc) const override
 Stores grid state in DOM element. More...
 
- Public Member Functions inherited from QgsComposerMapItem
 QgsComposerMapItem (const QString &name, QgsComposerMap *map)
 Constructor for QgsComposerMapItem. More...
 
virtual ~QgsComposerMapItem ()
 
virtual const QgsComposerMapcomposerMap () const
 Get composer map for the item. More...
 
virtual bool enabled () const
 Returns whether the item will be drawn. More...
 
QString id () const
 Get the unique id for the map item. More...
 
virtual QString name () const
 Get friendly display name for the item. More...
 
virtual void setComposerMap (QgsComposerMap *map)
 Sets composer map for the item. More...
 
virtual void setEnabled (const bool enabled)
 Controls whether the item will be drawn. More...
 
virtual void setName (const QString &name)
 Sets the friendly display name for the item. More...
 
- Public Member Functions inherited from QgsComposerObject
 QgsComposerObject (QgsComposition *composition)
 Constructor. More...
 
virtual ~QgsComposerObject ()
 
const QgsCompositioncomposition () const
 Returns the composition the item is attached to. More...
 
QgsCompositioncomposition ()
 
QStringList customProperties () const
 Return list of keys stored in custom properties for the object. More...
 
QVariant customProperty (const QString &key, const QVariant &defaultValue=QVariant()) const
 Read a custom property from the object. More...
 
QgsDataDefineddataDefinedProperty (const DataDefinedProperty property) const
 Returns a reference to the data defined settings for one of the item's data defined properties. More...
 
void removeCustomProperty (const QString &key)
 Remove a custom property from the object. More...
 
void setCustomProperty (const QString &key, const QVariant &value)
 Set a custom property for the object. More...
 
void setDataDefinedProperty (const DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field)
 Sets parameters for a data defined property for the item. More...
 
- Public Member Functions inherited from QgsExpressionContextGenerator
virtual ~QgsExpressionContextGenerator ()
 

Friends

class TestQgsComposerMapGrid
 

Additional Inherited Members

- Public Slots inherited from QgsComposerObject
virtual void refreshDataDefinedProperty (const DataDefinedProperty property=AllProperties, const QgsExpressionContext *context=nullptr)
 Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value. More...
 
virtual void repaint ()
 Triggers a redraw for the item. More...
 
- Signals inherited from QgsComposerObject
void itemChanged ()
 Emitted when the item changes. More...
 
- Protected Member Functions inherited from QgsComposerObject
bool dataDefinedEvaluate (const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue, const QgsExpressionContext &context=QgsExpressionContext()) const
 Evaluate a data defined property and return the calculated value. More...
 
- Protected Attributes inherited from QgsComposerMapItem
QgsComposerMapmComposerMap
 Associated composer map. More...
 
bool mEnabled
 True if item is to be displayed on map. More...
 
QString mName
 Friendly display name. More...
 
QString mUuid
 Unique id. More...
 
- Protected Attributes inherited from QgsComposerObject
QgsCompositionmComposition
 
QgsObjectCustomProperties mCustomProperties
 Custom properties for object. More...
 
QMap< QgsComposerObject::DataDefinedProperty, QString > mDataDefinedNames
 Map of data defined properties for the item to string name to use when exporting item to xml. More...
 

Detailed Description

An individual grid which is drawn above the map content in a QgsComposerMap.

Note
added in QGIS 2.5
See also
QgsComposerMapGridStack

Definition at line 163 of file qgscomposermapgrid.h.

Member Enumeration Documentation

§ AnnotationCoordinate

Annotation coordinate type.

Enumerator
Longitude 

Coordinate is a longitude value.

Latitude 

Coordinate is a latitude value.

Definition at line 267 of file qgscomposermapgrid.h.

§ AnnotationDirection

Direction of grid annotations.

Enumerator
Horizontal 

Draw annotations horizontally.

Vertical 

Draw annotations vertically, ascending.

VerticalDescending 

Draw annotations vertically, descending.

BoundaryDirection 

Annotations follow the boundary direction.

Definition at line 209 of file qgscomposermapgrid.h.

§ AnnotationFormat

Format for displaying grid annotations.

Enumerator
Decimal 

Decimal degrees, use - for S/W coordinates.

DegreeMinute 

Degree/minutes, use NSEW suffix.

DegreeMinuteSecond 

Degree/minutes/seconds, use NSEW suffix.

DecimalWithSuffix 

Decimal degrees, use NSEW suffix.

DegreeMinuteNoSuffix 

Degree/minutes, use - for S/W coordinates.

DegreeMinutePadded 

Degree/minutes, with minutes using leading zeros where required.

DegreeMinuteSecondNoSuffix 

Degree/minutes/seconds, use - for S/W coordinates.

DegreeMinuteSecondPadded 

Degree/minutes/seconds, with minutes using leading zeros where required.

CustomFormat 

Custom expression-based format.

Definition at line 219 of file qgscomposermapgrid.h.

§ AnnotationPosition

Position for grid annotations.

Enumerator
InsideMapFrame 

Draw annotations inside the map frame.

OutsideMapFrame 

Draw annotations outside the map frame.

Definition at line 201 of file qgscomposermapgrid.h.

§ BorderSide

Border sides for annotations.

Enumerator
Left 
Right 

Right border.

Bottom 

Bottom border.

Top 

Top border.

Definition at line 234 of file qgscomposermapgrid.h.

§ DisplayMode

Display settings for grid annotations and frames.

Enumerator
ShowAll 

Show both latitude and longitude annotations/divisions.

LatitudeOnly 

Show latitude/y annotations/divisions only.

LongitudeOnly 

Show longitude/x annotations/divisions only.

HideAll 

No annotations.

Definition at line 191 of file qgscomposermapgrid.h.

§ FrameSideFlag

Flags for controlling which side of the map a frame is drawn on.

Enumerator
FrameLeft 

Left side of map.

FrameRight 

Right side of map.

FrameTop 

Top side of map.

FrameBottom 

Bottom side of map.

Definition at line 256 of file qgscomposermapgrid.h.

§ FrameStyle

Style for grid frame.

Enumerator
NoFrame 

Disable grid frame.

Zebra 

Black/white pattern.

InteriorTicks 

Tick markers drawn inside map frame.

ExteriorTicks 

Tick markers drawn outside map frame.

InteriorExteriorTicks 

Tick markers drawn both inside and outside the map frame.

LineBorder 

Simple solid line frame.

Definition at line 244 of file qgscomposermapgrid.h.

§ GridStyle

Grid drawing style.

Enumerator
Solid 
Cross 

Draw line crosses at intersections of grid lines.

Markers 

Draw markers at intersections of grid lines.

FrameAnnotationsOnly 

No grid lines over the map, only draw frame and annotations.

Definition at line 181 of file qgscomposermapgrid.h.

§ GridUnit

Unit for grid values.

Enumerator
MapUnit 

Grid units follow map units.

MM 

Grid units in millimeters.

CM 

Grid units in centimeters.

Definition at line 172 of file qgscomposermapgrid.h.

Constructor & Destructor Documentation

§ QgsComposerMapGrid()

QgsComposerMapGrid::QgsComposerMapGrid ( const QString &  name,
QgsComposerMap map 
)

Constructor for QgsComposerMapGrid.

Parameters
namefriendly display name for grid
mapQgsComposerMap the grid is attached to

Definition at line 167 of file qgscomposermapgrid.cpp.

§ ~QgsComposerMapGrid()

QgsComposerMapGrid::~QgsComposerMapGrid ( )
virtual

Definition at line 234 of file qgscomposermapgrid.cpp.

Member Function Documentation

§ annotationDirection()

QgsComposerMapGrid::AnnotationDirection QgsComposerMapGrid::annotationDirection ( const BorderSide  border) const

Gets the direction for drawing frame annotations.

Parameters
borderside of map for annotations
Returns
direction for frame annotations
See also
setAnnotationDirection

Definition at line 2275 of file qgscomposermapgrid.cpp.

§ annotationDisplay()

QgsComposerMapGrid::DisplayMode QgsComposerMapGrid::annotationDisplay ( const BorderSide  border) const

Gets the display mode for the grid annotations on a specified side of the map frame.

This property also specifies whether annotations have been disabled from a side of the map frame.

Parameters
borderside of map for annotations
Returns
display mode for grid annotations
See also
setAnnotationDisplay
Note
added in QGIS 2.7

Definition at line 2030 of file qgscomposermapgrid.cpp.

§ annotationEnabled()

bool QgsComposerMapGrid::annotationEnabled ( ) const
inline

Gets whether annotations are shown for the grid.

Returns
true if annotations are drawn for the grid
See also
setAnnotationEnabled

Definition at line 546 of file qgscomposermapgrid.h.

§ annotationExpression()

QString QgsComposerMapGrid::annotationExpression ( ) const
inline

Returns the expression used for drawing grid annotations.

This is only used when annotationFormat() is QgsComposerMapGrid::CustomFormat.

Returns
expression for evaluating custom grid annotations
See also
setAnnotationExpression
Note
added in QGIS 2.12

Definition at line 677 of file qgscomposermapgrid.h.

§ annotationFont()

QFont QgsComposerMapGrid::annotationFont ( ) const
inline

Gets the font used for drawing grid annotations.

Returns
font for annotations
See also
setAnnotationFont

Definition at line 558 of file qgscomposermapgrid.h.

§ annotationFontColor()

QColor QgsComposerMapGrid::annotationFontColor ( ) const
inline

Gets the font color used for drawing grid annotations.

Returns
font color for annotations
See also
setAnnotationFontColor

Definition at line 570 of file qgscomposermapgrid.h.

§ annotationFormat()

AnnotationFormat QgsComposerMapGrid::annotationFormat ( ) const
inline

Gets the format for drawing grid annotations.

Returns
format for grid annotations
See also
setAnnotationFormat

Definition at line 661 of file qgscomposermapgrid.h.

§ annotationFrameDistance()

double QgsComposerMapGrid::annotationFrameDistance ( ) const
inline

Gets the distance between the map frame and annotations.

Units are in millimeters.

Returns
margin between map frame and annotations
See also
setAnnotationFrameDistance

Definition at line 629 of file qgscomposermapgrid.h.

§ annotationPosition()

QgsComposerMapGrid::AnnotationPosition QgsComposerMapGrid::annotationPosition ( const BorderSide  border) const

Gets the position for the grid annotations on a specified side of the map frame.

Parameters
borderside of map for annotations
Returns
position that grid annotations are drawn in
See also
setAnnotationPosition

Definition at line 2259 of file qgscomposermapgrid.cpp.

§ annotationPrecision()

int QgsComposerMapGrid::annotationPrecision ( ) const
inline

Returns the coordinate precision for grid annotations.

Returns
number of decimal places shown when drawing grid annotations
See also
setAnnotationPrecision

Definition at line 582 of file qgscomposermapgrid.h.

§ blendMode()

QPainter::CompositionMode QgsComposerMapGrid::blendMode ( ) const
inline

Retrieves the blending mode used for drawing the grid.

Returns
blending mode for grid
See also
setBlendMode

Definition at line 322 of file qgscomposermapgrid.h.

§ calculateMaxExtension()

void QgsComposerMapGrid::calculateMaxExtension ( double &  top,
double &  right,
double &  bottom,
double &  left 
)

Calculates the maximum distance the grid extends beyond the QgsComposerMap's item rect.

This method calculates the distance for each side of the map item separately

Parameters
topstorage for top extension
rightstorage for right extension
bottomstorage for bottom extension
leftstorage for left extension
Note
added in QGIS 2.12
See also
maxExtension()

Definition at line 2056 of file qgscomposermapgrid.cpp.

§ createExpressionContext()

QgsExpressionContext QgsComposerMapGrid::createExpressionContext ( ) const
overridevirtual

Creates an expression context relating to the objects' current state.

The context includes scopes for global, project and composition properties.

Note
added in QGIS 2.12

Reimplemented from QgsComposerObject.

Definition at line 2209 of file qgscomposermapgrid.cpp.

§ crossLength()

double QgsComposerMapGrid::crossLength ( ) const
inline

Retrieves the length of the cross segments drawn for the grid.

This is only used for grids with QgsComposerMapGrid::Cross styles

Returns
cross length in millimeters
See also
setCrossLength

Definition at line 456 of file qgscomposermapgrid.h.

§ crs()

QgsCoordinateReferenceSystem QgsComposerMapGrid::crs ( ) const
inline

Retrieves the CRS for the grid.

Returns
coordinate reference system for grid
See also
setCrs

Definition at line 310 of file qgscomposermapgrid.h.

§ draw()

void QgsComposerMapGrid::draw ( QPainter *  painter)
overridevirtual

Draws a grid.

Parameters
painterdestination QPainter

Implements QgsComposerMapItem.

Definition at line 613 of file qgscomposermapgrid.cpp.

§ frameDivisions()

QgsComposerMapGrid::DisplayMode QgsComposerMapGrid::frameDivisions ( const BorderSide  border) const

Gets the type of grid divisions which are used for frames on a specified side of the map.

Parameters
borderside of map for frame
Returns
grid divisions for frame
See also
setFrameDivisions
Note
added in QGIS 2.7

Definition at line 2322 of file qgscomposermapgrid.cpp.

§ frameFillColor1()

QColor QgsComposerMapGrid::frameFillColor1 ( ) const
inline

Retrieves the first fill color for the grid frame.

Returns
first fill color for grid frame
See also
setFrameFillColor1
framePenColor
frameFillColor2

Definition at line 810 of file qgscomposermapgrid.h.

§ frameFillColor2()

QColor QgsComposerMapGrid::frameFillColor2 ( ) const
inline

Retrieves the second fill color for the grid frame.

Returns
second fill color for grid frame
See also
setFrameFillColor2
framePenColor
frameFillColor1

Definition at line 826 of file qgscomposermapgrid.h.

§ framePenColor()

QColor QgsComposerMapGrid::framePenColor ( ) const
inline

Retrieves the color of the outline drawn in the grid frame.

Returns
color of grid frame outline
See also
setFramePenColor
framePenSize
frameFillColor1
frameFillColor2

Definition at line 794 of file qgscomposermapgrid.h.

§ framePenSize()

double QgsComposerMapGrid::framePenSize ( ) const
inline

Retrieves the width of the outline drawn in the grid frame.

Returns
width of grid frame outline
See also
setFramePenSize
framePenColor

Definition at line 776 of file qgscomposermapgrid.h.

§ frameSideFlags()

QgsComposerMapGrid::FrameSideFlags QgsComposerMapGrid::frameSideFlags ( ) const

Returns the flags which control which sides of the map item the grid frame is drawn on.

Returns
flags for side of map grid is drawn on
See also
setFrameSideFlags
setFrameSideFlag
testFrameSideFlag

Definition at line 2204 of file qgscomposermapgrid.cpp.

§ frameStyle()

FrameStyle QgsComposerMapGrid::frameStyle ( ) const
inline

Gets the grid frame style.

Returns
style for grid frame
See also
setFrameStyle

Definition at line 693 of file qgscomposermapgrid.h.

§ frameWidth()

double QgsComposerMapGrid::frameWidth ( ) const
inline

Gets the grid frame width.

This property controls how wide the grid frame is. The size of the line outlines drawn in the frame can be retrieved via the framePenSize method.

Returns
width of grid frame in millimeters
See also
setFrameWidth

Definition at line 762 of file qgscomposermapgrid.h.

§ intervalX()

double QgsComposerMapGrid::intervalX ( ) const
inline

Gets the interval between grid lines in the x-direction.

The units are retrieved through the units() method.

Returns
interval between horizontal grid lines
See also
setIntervalX
intervalY

Definition at line 376 of file qgscomposermapgrid.h.

§ intervalY()

double QgsComposerMapGrid::intervalY ( ) const
inline

Gets the interval between grid lines in the y-direction.

The units are retrieved through the units() method.

Returns
interval between vertical grid lines
See also
setIntervalY
intervalX

Definition at line 392 of file qgscomposermapgrid.h.

§ lineSymbol() [1/2]

const QgsLineSymbol* QgsComposerMapGrid::lineSymbol ( ) const
inline

Gets the line symbol used for drawing grid lines.

This is only used for grids with QgsComposerMapGrid::Solid or QgsComposerMapGrid::Cross styles.

Returns
line symbol for grid lines
See also
setLineSymbol
markerSymbol
style
Note
not available in python bindings

Definition at line 493 of file qgscomposermapgrid.h.

§ lineSymbol() [2/2]

QgsLineSymbol* QgsComposerMapGrid::lineSymbol ( )
inline

Gets the line symbol used for drawing grid lines.

This is only used for grids with QgsComposerMapGrid::Solid or QgsComposerMapGrid::Cross styles.

Returns
line symbol for grid lines
See also
setLineSymbol
markerSymbol
style

Definition at line 502 of file qgscomposermapgrid.h.

§ markerSymbol() [1/2]

const QgsMarkerSymbol* QgsComposerMapGrid::markerSymbol ( ) const
inline

Gets the marker symbol used for drawing grid points.

This is only used for grids with a QgsComposerMapGrid::Markers style.

Returns
marker symbol for grid intersection points
See also
setMarkerSymbol
lineSymbol
style
Note
not available in python bindings

Definition at line 521 of file qgscomposermapgrid.h.

§ markerSymbol() [2/2]

QgsMarkerSymbol* QgsComposerMapGrid::markerSymbol ( )
inline

Gets the marker symbol used for drawing grid points.

This is only used for grids with a QgsComposerMapGrid::Markers style.

Returns
marker symbol for grid intersection points
See also
setMarkerSymbol
lineSymbol
style

Definition at line 530 of file qgscomposermapgrid.h.

§ maxExtension()

double QgsComposerMapGrid::maxExtension ( )

Calculates the maximum distance the grid extends beyond the QgsComposerMap's item rect.

Returns
maximum extension in millimeters

Definition at line 2046 of file qgscomposermapgrid.cpp.

§ offsetX()

double QgsComposerMapGrid::offsetX ( ) const
inline

Gets the offset for grid lines in the x-direction.

The units are retrieved through the units() method.

Returns
offset for horizontal grid lines
See also
setOffsetX
offsetY

Definition at line 408 of file qgscomposermapgrid.h.

§ offsetY()

double QgsComposerMapGrid::offsetY ( ) const
inline

Gets the offset for grid lines in the y-direction.

The units are retrieved through the units() method.

Returns
offset for vertical grid lines
See also
setOffsetY
offsetX

Definition at line 424 of file qgscomposermapgrid.h.

§ readXml()

bool QgsComposerMapGrid::readXml ( const QDomElement &  itemElem,
const QDomDocument &  doc 
)
overridevirtual

Sets grid state from a DOM document.

Parameters
itemElemis DOM node corresponding to a 'ComposerMapGrid' tag
docis DOM document
See also
writeXml

Reimplemented from QgsComposerMapItem.

Definition at line 344 of file qgscomposermapgrid.cpp.

§ setAnnotationDirection() [1/2]

void QgsComposerMapGrid::setAnnotationDirection ( const AnnotationDirection  direction,
const BorderSide  border 
)

Sets the direction for drawing frame annotations.

Parameters
directiondirection for frame annotations
borderside of map for annotations
See also
annotationDirection

Definition at line 2164 of file qgscomposermapgrid.cpp.

§ setAnnotationDirection() [2/2]

void QgsComposerMapGrid::setAnnotationDirection ( const AnnotationDirection  direction)

Sets the direction for drawing all frame annotations.

Parameters
directiondirection for frame annotations
See also
annotationDirection

Definition at line 2224 of file qgscomposermapgrid.cpp.

§ setAnnotationDisplay()

void QgsComposerMapGrid::setAnnotationDisplay ( const DisplayMode  display,
const BorderSide  border 
)

Sets what types of grid annotations should be drawn for a specified side of the map frame, or whether grid annotations should be disabled for the side.

Parameters
displaydisplay mode for annotations
borderside of map for annotations
See also
annotationDisplay
Note
added in QGIS 2.7

Definition at line 2003 of file qgscomposermapgrid.cpp.

§ setAnnotationEnabled()

void QgsComposerMapGrid::setAnnotationEnabled ( const bool  enabled)
inline

Sets whether annotations should be shown for the grid.

Parameters
enabledset to true to draw annotations for the grid
See also
annotationEnabled

Definition at line 540 of file qgscomposermapgrid.h.

§ setAnnotationExpression()

void QgsComposerMapGrid::setAnnotationExpression ( const QString &  expression)
inline

Sets the expression used for drawing grid annotations.

This is only used when annotationFormat() is QgsComposerMapGrid::CustomFormat.

Parameters
expressionexpression for evaluating custom grid annotations
See also
annotationExpression
Note
added in QGIS 2.12

Definition at line 669 of file qgscomposermapgrid.h.

§ setAnnotationFont()

void QgsComposerMapGrid::setAnnotationFont ( const QFont &  font)
inline

Sets the font used for drawing grid annotations.

Parameters
fontfont for annotations
See also
annotationFont

Definition at line 552 of file qgscomposermapgrid.h.

§ setAnnotationFontColor()

void QgsComposerMapGrid::setAnnotationFontColor ( const QColor &  color)
inline

Sets the font color used for drawing grid annotations.

Parameters
colorfont color for annotations
See also
annotationFontColor

Definition at line 564 of file qgscomposermapgrid.h.

§ setAnnotationFormat()

void QgsComposerMapGrid::setAnnotationFormat ( const AnnotationFormat  format)
inline

Sets the format for drawing grid annotations.

Parameters
formatformat for grid annotations
See also
annotationFormat

Definition at line 655 of file qgscomposermapgrid.h.

§ setAnnotationFrameDistance()

void QgsComposerMapGrid::setAnnotationFrameDistance ( const double  distance)
inline

Sets the distance between the map frame and annotations.

Units are in millimeters.

Parameters
distancemargin between map frame and annotations
See also
annotationFrameDistance

Definition at line 623 of file qgscomposermapgrid.h.

§ setAnnotationPosition()

void QgsComposerMapGrid::setAnnotationPosition ( const AnnotationPosition  position,
const BorderSide  border 
)

Sets the position for the grid annotations on a specified side of the map frame.

Parameters
positionposition to draw grid annotations
borderside of map for annotations
See also
annotationPosition

Definition at line 2232 of file qgscomposermapgrid.cpp.

§ setAnnotationPrecision()

void QgsComposerMapGrid::setAnnotationPrecision ( const int  precision)
inline

Sets the coordinate precision for grid annotations.

Parameters
precisionnumber of decimal places to show when drawing grid annotations
See also
annotationPrecision

Definition at line 576 of file qgscomposermapgrid.h.

§ setBlendMode()

void QgsComposerMapGrid::setBlendMode ( const QPainter::CompositionMode  mode)
inline

Sets the blending mode used for drawing the grid.

Parameters
modeblending mode for grid
See also
blendMode

Definition at line 316 of file qgscomposermapgrid.h.

§ setCrossLength()

void QgsComposerMapGrid::setCrossLength ( const double  length)
inline

Sets the length of the cross segments drawn for the grid.

This is only used for grids with QgsComposerMapGrid::Cross styles

Parameters
lengthcross length in millimeters
See also
crossLength

Definition at line 449 of file qgscomposermapgrid.h.

§ setCrs()

void QgsComposerMapGrid::setCrs ( const QgsCoordinateReferenceSystem crs)

Sets the CRS for the grid.

Parameters
crscoordinate reference system for grid
See also
crs

Definition at line 439 of file qgscomposermapgrid.cpp.

§ setFrameDivisions()

void QgsComposerMapGrid::setFrameDivisions ( const DisplayMode  divisions,
const BorderSide  border 
)

Sets what type of grid divisions should be used for frames on a specified side of the map.

Parameters
divisionsgrid divisions for frame
borderside of map for frame
See also
frameDivisions
Note
added in QGIS 2.7

Definition at line 2296 of file qgscomposermapgrid.cpp.

§ setFrameFillColor1()

void QgsComposerMapGrid::setFrameFillColor1 ( const QColor &  color)
inline

Sets the first fill color used for the grid frame.

Parameters
colorfirst fill color for grid frame
See also
frameFillColor1
setFramePenColor
setFrameFillColor2

Definition at line 802 of file qgscomposermapgrid.h.

§ setFrameFillColor2()

void QgsComposerMapGrid::setFrameFillColor2 ( const QColor &  color)
inline

Sets the second fill color used for the grid frame.

Parameters
colorsecond fill color for grid frame
See also
frameFillColor2
setFramePenColor
setFrameFillColor1

Definition at line 818 of file qgscomposermapgrid.h.

§ setFramePenColor()

void QgsComposerMapGrid::setFramePenColor ( const QColor &  color)
inline

Sets the color of the outline drawn in the grid frame.

Parameters
colorcolor of grid frame outline
See also
framePenColor
setFramePenSize
setFrameFillColor1
setFrameFillColor2

Definition at line 785 of file qgscomposermapgrid.h.

§ setFramePenSize()

void QgsComposerMapGrid::setFramePenSize ( const double  width)
inline

Sets the width of the outline drawn in the grid frame.

Parameters
widthwidth of grid frame outline
See also
framePenSize
setFramePenColor

Definition at line 769 of file qgscomposermapgrid.h.

§ setFrameSideFlag()

void QgsComposerMapGrid::setFrameSideFlag ( const FrameSideFlag  flag,
bool  on = true 
)

Sets whether the grid frame is drawn for a certain side of the map item.

Parameters
flagflag for grid frame side
onset to true to draw grid frame on that side of the map
See also
setFrameSideFlags
frameSideFlags
testFrameSideFlag

Definition at line 2196 of file qgscomposermapgrid.cpp.

§ setFrameSideFlags()

void QgsComposerMapGrid::setFrameSideFlags ( QgsComposerMapGrid::FrameSideFlags  flags)

Sets flags for grid frame sides.

Setting these flags controls which sides of the map item the grid frame is drawn on.

Parameters
flagsflags for grid frame sides
See also
setFrameSideFlag
frameSideFlags
testFrameSideFlag

Definition at line 2191 of file qgscomposermapgrid.cpp.

§ setFrameStyle()

void QgsComposerMapGrid::setFrameStyle ( const FrameStyle  style)
inline

Sets the grid frame style.

Parameters
stylestyle for grid frame
See also
frameStyle

Definition at line 687 of file qgscomposermapgrid.h.

§ setFrameWidth()

void QgsComposerMapGrid::setFrameWidth ( const double  width)
inline

Sets the grid frame width.

This property controls how wide the grid frame is. The size of the line outlines drawn in the frame is controlled through the setFramePenSize method.

Parameters
widthwidth of grid frame in millimeters
See also
frameWidth

Definition at line 754 of file qgscomposermapgrid.h.

§ setGridLineColor()

void QgsComposerMapGrid::setGridLineColor ( const QColor &  color)

Sets color of grid lines.

This is only used for grids with QgsComposerMapGrid::Solid or QgsComposerMapGrid::Cross styles. For more control over grid line appearance, use setLineSymbol instead.

Parameters
colorcolor of grid lines
See also
setLineSymbol
setGridLineWidth

Definition at line 268 of file qgscomposermapgrid.cpp.

§ setGridLineWidth()

void QgsComposerMapGrid::setGridLineWidth ( const double  width)

Sets width of grid lines.

This is only used for grids with QgsComposerMapGrid::Solid or QgsComposerMapGrid::Cross styles. For more control over grid line appearance, use setLineSymbol instead.

Parameters
widthgrid line width
See also
setLineSymbol
setGridLineColor

Definition at line 260 of file qgscomposermapgrid.cpp.

§ setIntervalX()

void QgsComposerMapGrid::setIntervalX ( const double  interval)

Sets the interval between grid lines in the x-direction.

The units are controlled through the setUnits method

Parameters
intervalinterval between horizontal grid lines
See also
setIntervalY
intervalX

Definition at line 2114 of file qgscomposermapgrid.cpp.

§ setIntervalY()

void QgsComposerMapGrid::setIntervalY ( const double  interval)

Sets the interval between grid lines in the y-direction.

The units are controlled through the setUnits method

Parameters
intervalinterval between vertical grid lines
See also
setIntervalX
intervalY

Definition at line 2124 of file qgscomposermapgrid.cpp.

§ setLineSymbol()

void QgsComposerMapGrid::setLineSymbol ( QgsLineSymbol symbol)

Sets the line symbol used for drawing grid lines.

This is only used for grids with QgsComposerMapGrid::Solid or QgsComposerMapGrid::Cross styles.

Parameters
symbolline symbol for grid lines
See also
lineSymbol
setMarkerSymbol
setStyle

Definition at line 1991 of file qgscomposermapgrid.cpp.

§ setMarkerSymbol()

void QgsComposerMapGrid::setMarkerSymbol ( QgsMarkerSymbol symbol)

Sets the marker symbol used for drawing grid points.

This is only used for grids with a QgsComposerMapGrid::Markers style.

Parameters
symbolmarker symbol for grid intersection points
See also
markerSymbol
setLineSymbol
setStyle

Definition at line 1997 of file qgscomposermapgrid.cpp.

§ setOffsetX()

void QgsComposerMapGrid::setOffsetX ( const double  offset)

Sets the offset for grid lines in the x-direction.

The units are controlled through the setUnits method

Parameters
offsetoffset for horizontal grid lines
See also
setOffsetY
offsetX

Definition at line 2134 of file qgscomposermapgrid.cpp.

§ setOffsetY()

void QgsComposerMapGrid::setOffsetY ( const double  offset)

Sets the offset for grid lines in the y-direction.

The units are controlled through the setUnits method

Parameters
offsetoffset for vertical grid lines
See also
setOffsetX
offsetY

Definition at line 2144 of file qgscomposermapgrid.cpp.

§ setStyle()

void QgsComposerMapGrid::setStyle ( const GridStyle  style)

Sets the grid style, which controls how the grid is drawn over the map's contents.

Parameters
styledesired grid style
See also
style

Definition at line 2154 of file qgscomposermapgrid.cpp.

§ setUnits()

void QgsComposerMapGrid::setUnits ( const GridUnit  unit)

Sets the units to use for grid measurements such as the interval and offset for grid lines.

Parameters
unitunit for grid measurements
See also
units

Definition at line 2104 of file qgscomposermapgrid.cpp.

§ style()

GridStyle QgsComposerMapGrid::style ( ) const
inline

Gets the grid's style, which controls how the grid is drawn over the map's contents.

Returns
current grid style
See also
setStyle

Definition at line 442 of file qgscomposermapgrid.h.

§ testFrameSideFlag()

bool QgsComposerMapGrid::testFrameSideFlag ( const FrameSideFlag  flag) const

Tests whether the grid frame should be drawn on a specified side of the map item.

Parameters
flagflag for grid frame side
Returns
true if grid frame should be drawn for that side of the map
See also
setFrameSideFlags
setFrameSideFlag
frameSideFlags

Definition at line 2219 of file qgscomposermapgrid.cpp.

§ units()

GridUnit QgsComposerMapGrid::units ( ) const
inline

Gets the units used for grid measurements such as the interval and offset for grid lines.

Returns
for grid measurements
See also
setUnits

Definition at line 360 of file qgscomposermapgrid.h.

§ usesAdvancedEffects()

bool QgsComposerMapGrid::usesAdvancedEffects ( ) const
overridevirtual

Returns true if the item is drawn using advanced effects, such as blend modes.

Returns
true if item uses advanced effects

Reimplemented from QgsComposerMapItem.

Definition at line 445 of file qgscomposermapgrid.cpp.

§ writeXml()

bool QgsComposerMapGrid::writeXml ( QDomElement &  elem,
QDomDocument &  doc 
) const
overridevirtual

Stores grid state in DOM element.

Parameters
elemis DOM element corresponding to a 'ComposerMap' tag
docDOM document
See also
readXml

Reimplemented from QgsComposerMapItem.

Definition at line 276 of file qgscomposermapgrid.cpp.

Friends And Related Function Documentation

§ TestQgsComposerMapGrid

friend class TestQgsComposerMapGrid
friend

Definition at line 1037 of file qgscomposermapgrid.h.


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