QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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]

Classes

class  QgsMapAnnotation

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
}
 Format for displaying grid annotations. More...
enum  AnnotationPosition { InsideMapFrame = 0, OutsideMapFrame, Disabled }
 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 Member Functions

 QgsComposerMapGrid (const QString &name, QgsComposerMap *map)
 Constructor for QgsComposerMapGrid.
virtual ~QgsComposerMapGrid ()
AnnotationDirection annotationDirection (const BorderSide border) const
 Gets the direction for drawing frame annotations.
DisplayMode annotationDisplay (const BorderSide border) const
 Gets the display mode for the grid annotations on a specified side of the map frame.
bool annotationEnabled () const
 Gets whether annotations are shown for the grid.
QFont annotationFont () const
 Gets the font used for drawing grid annotations.
QColor annotationFontColor () const
 Gets the font color used for drawing grid annotations.
AnnotationFormat annotationFormat () const
 Gets the format for drawing grid annotations.
double annotationFrameDistance () const
 Gets the distance between the map frame and annotations.
AnnotationPosition annotationPosition (const BorderSide border) const
 Gets the position for the grid annotations on a specified side of the map frame.
int annotationPrecision () const
 Returns the coordinate precision for grid annotations.
QPainter::CompositionMode blendMode () const
 Retrieves the blending mode used for drawing the grid.
double crossLength () const
 Retrieves the length of the cross segments drawn for the grid.
QgsCoordinateReferenceSystem crs () const
 Retrieves the CRS for the grid.
void draw (QPainter *painter) override
 Draws a grid.
DisplayMode frameDivisions (const BorderSide border) const
 Gets the type of grid divisions which are used for frames on a specified side of the map.
QColor frameFillColor1 () const
 Retrieves the first fill color for the grid frame.
QColor frameFillColor2 () const
 Retrieves the second fill color for the grid frame.
QColor framePenColor () const
 Retrieves the color of the outline drawn in the grid frame.
double framePenSize () const
 Retrieves the width of the outline drawn in the grid frame.
FrameSideFlags frameSideFlags () const
 Returns the flags which control which sides of the map item the grid frame is drawn on.
FrameStyle frameStyle () const
 Gets the grid frame style.
double frameWidth () const
 Gets the grid frame width.
double intervalX () const
 Gets the interval between grid lines in the x-direction.
double intervalY () const
 Gets the interval between grid lines in the y-direction.
const QgsLineSymbolV2lineSymbol () const
 Gets the line symbol used for drawing grid lines.
QgsLineSymbolV2lineSymbol ()
 Gets the line symbol used for drawing grid lines.
const QgsMarkerSymbolV2markerSymbol () const
 Gets the marker symbol used for drawing grid points.
QgsMarkerSymbolV2markerSymbol ()
 Gets the marker symbol used for drawing grid points.
double maxExtension () const
 Calculates the maximum distance the grid extends beyond the QgsComposerMap's item rect.
double offsetX () const
 Gets the offset for grid lines in the x-direction.
double offsetY () const
 Gets the offset for grid lines in the y-direction.
bool readXML (const QDomElement &itemElem, const QDomDocument &doc) override
 Sets grid state from a DOM document.
void setAnnotationDirection (const AnnotationDirection direction, const BorderSide border)
 Sets the direction for drawing frame annotations.
void setAnnotationDirection (const AnnotationDirection direction)
 Sets the direction for drawing all frame annotations.
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.
void setAnnotationEnabled (const bool enabled)
 Sets whether annotations should be shown for the grid.
void setAnnotationFont (const QFont &font)
 Sets the font used for drawing grid annotations.
void setAnnotationFontColor (const QColor &color)
 Sets the font color used for drawing grid annotations.
void setAnnotationFormat (const AnnotationFormat format)
 Sets the format for drawing grid annotations.
void setAnnotationFrameDistance (const double distance)
 Sets the distance between the map frame and annotations.
void setAnnotationPosition (const AnnotationPosition position, const BorderSide border)
 Sets the position for the grid annotations on a specified side of the map frame.
void setAnnotationPrecision (const int precision)
 Sets the coordinate precision for grid annotations.
void setBlendMode (const QPainter::CompositionMode mode)
 Sets the blending mode used for drawing the grid.
void setCrossLength (const double length)
 Sets the length of the cross segments drawn for the grid.
void setCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the CRS for the grid.
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.
void setFrameFillColor1 (const QColor &color)
 Sets the first fill color used for the grid frame.
void setFrameFillColor2 (const QColor &color)
 Sets the second fill color used for the grid frame.
void setFramePenColor (const QColor &color)
 Sets the color of the outline drawn in the grid frame.
void setFramePenSize (const double width)
 Sets the width of the outline drawn in the grid frame.
void setFrameSideFlag (const FrameSideFlag flag, bool on=true)
 Sets whether the grid frame is drawn for a certain side of the map item.
void setFrameSideFlags (const FrameSideFlags flags)
 Sets flags for grid frame sides.
void setFrameStyle (const FrameStyle style)
 Sets the grid frame style.
void setFrameWidth (const double width)
 Sets the grid frame width.
void setGridLineColor (const QColor &color)
 Sets color of grid lines.
void setGridLineWidth (const double width)
 Sets width of grid lines.
void setIntervalX (const double interval)
 Sets the interval between grid lines in the x-direction.
void setIntervalY (const double interval)
 Sets the interval between grid lines in the y-direction.
void setLineSymbol (QgsLineSymbolV2 *symbol)
 Sets the line symbol used for drawing grid lines.
void setMarkerSymbol (QgsMarkerSymbolV2 *symbol)
 Sets the marker symbol used for drawing grid points.
void setOffsetX (const double offset)
 Sets the offset for grid lines in the x-direction.
void setOffsetY (const double offset)
 Sets the offset for grid lines in the y-direction.
void setStyle (const GridStyle style)
 Sets the grid style, which controls how the grid is drawn over the map's contents.
void setUnits (const GridUnit unit)
 Sets the units to use for grid measurements such as the interval and offset for grid lines.
GridStyle style () const
 Gets the grid's style, which controls how the grid is drawn over the map's contents.
bool testFrameSideFlag (const FrameSideFlag flag) const
 Tests whether the grid frame should be drawn on a specified side of the map item.
GridUnit units () const
 Gets the units used for grid measurements such as the interval and offset for grid lines.
bool usesAdvancedEffects () const override
 Returns true if the item is drawn using advanced effects, such as blend modes.
bool writeXML (QDomElement &elem, QDomDocument &doc) const override
 Stores grid state in DOM element.
- Public Member Functions inherited from QgsComposerMapItem
 QgsComposerMapItem (const QString &name, QgsComposerMap *map)
 Constructor for QgsComposerMapItem.
virtual ~QgsComposerMapItem ()
virtual const QgsComposerMapcomposerMap () const
 Get composer map for the item.
virtual bool enabled () const
 Returns whether the item will be drawn.
QString id () const
 Get the unique id for the map item.
virtual QString name () const
 Get friendly display name for the item.
virtual void setComposerMap (QgsComposerMap *map)
 Sets composer map for the item.
virtual void setEnabled (const bool enabled)
 Controls whether the item will be drawn.
virtual void setName (const QString &name)
 Sets the friendly display name for the item.
- 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 TestQgsComposerMapGrid

Additional Inherited Members

- 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 inherited from QgsComposerObject
void itemChanged ()
 Emitted when the item changes.
- Protected Member Functions inherited from QgsComposerObject
bool dataDefinedEvaluate (const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue)
 Evaluate a data defined property and return the calculated value.
- Protected Attributes inherited from QgsComposerMapItem
QgsComposerMapmComposerMap
 Associated composer map.
bool mEnabled
 True if item is to be displayed on map.
QString mName
 Friendly display name.
QString mUuid
 Unique id.

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 151 of file qgscomposermapgrid.h.

Member Enumeration Documentation

Annotation coordinate type.

Enumerator:
Longitude 
Latitude 

Definition at line 256 of file qgscomposermapgrid.h.

Direction of grid annotations.

Enumerator:
Horizontal 
Vertical 
VerticalDescending 
BoundaryDirection 

Definition at line 199 of file qgscomposermapgrid.h.

Format for displaying grid annotations.

Enumerator:
Decimal 
DegreeMinute 
DegreeMinuteSecond 
DecimalWithSuffix 
DegreeMinuteNoSuffix 
DegreeMinutePadded 
DegreeMinuteSecondNoSuffix 
DegreeMinuteSecondPadded 

Definition at line 209 of file qgscomposermapgrid.h.

Position for grid annotations.

Enumerator:
InsideMapFrame 
OutsideMapFrame 
Disabled 

Definition at line 189 of file qgscomposermapgrid.h.

Border sides for annotations.

Enumerator:
Left 
Right 
Bottom 
Top 

Definition at line 223 of file qgscomposermapgrid.h.

Display settings for grid annotations and frames.

Enumerator:
ShowAll 
LatitudeOnly 
LongitudeOnly 
HideAll 

Definition at line 179 of file qgscomposermapgrid.h.

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

Enumerator:
FrameLeft 
FrameRight 
FrameTop 
FrameBottom 

Definition at line 245 of file qgscomposermapgrid.h.

Style for grid frame.

Enumerator:
NoFrame 
Zebra 
InteriorTicks 
ExteriorTicks 
InteriorExteriorTicks 
LineBorder 

Definition at line 233 of file qgscomposermapgrid.h.

Grid drawing style.

Enumerator:
Solid 
Cross 
Markers 
FrameAnnotationsOnly 

Definition at line 169 of file qgscomposermapgrid.h.

Unit for grid values.

Enumerator:
MapUnit 
MM 
CM 

Definition at line 160 of file qgscomposermapgrid.h.

Constructor & Destructor Documentation

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 146 of file qgscomposermapgrid.cpp.

QgsComposerMapGrid::~QgsComposerMapGrid ( )
virtual

Definition at line 213 of file qgscomposermapgrid.cpp.

Member Function Documentation

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 2209 of file qgscomposermapgrid.cpp.

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 1937 of file qgscomposermapgrid.cpp.

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 521 of file qgscomposermapgrid.h.

QFont QgsComposerMapGrid::annotationFont ( ) const
inline

Gets the font used for drawing grid annotations.

Returns
font for annotations
See Also
setAnnotationFont

Definition at line 533 of file qgscomposermapgrid.h.

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 545 of file qgscomposermapgrid.h.

AnnotationFormat QgsComposerMapGrid::annotationFormat ( ) const
inline

Gets the format for drawing grid annotations.

Returns
format for grid annotations
See Also
setAnnotationFormat

Definition at line 636 of file qgscomposermapgrid.h.

double QgsComposerMapGrid::annotationFrameDistance ( ) const
inline

Gets the distance between the map frame and annotations.

Units are in millimetres.

Returns
margin between map frame and annotations
See Also
setAnnotationFrameDistance

Definition at line 604 of file qgscomposermapgrid.h.

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 2189 of file qgscomposermapgrid.cpp.

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 557 of file qgscomposermapgrid.h.

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 311 of file qgscomposermapgrid.h.

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 millimetres
See Also
setCrossLength

Definition at line 433 of file qgscomposermapgrid.h.

QgsCoordinateReferenceSystem QgsComposerMapGrid::crs ( ) const
inline

Retrieves the CRS for the grid.

Returns
coordinate reference system for grid
See Also
setCrs

Definition at line 299 of file qgscomposermapgrid.h.

void QgsComposerMapGrid::draw ( QPainter *  painter)
overridevirtual

Draws a grid.

Parameters
painterdestination QPainter

Implements QgsComposerMapItem.

Definition at line 614 of file qgscomposermapgrid.cpp.

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 2260 of file qgscomposermapgrid.cpp.

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 769 of file qgscomposermapgrid.h.

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 785 of file qgscomposermapgrid.h.

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 753 of file qgscomposermapgrid.h.

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 735 of file qgscomposermapgrid.h.

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 2144 of file qgscomposermapgrid.cpp.

FrameStyle QgsComposerMapGrid::frameStyle ( ) const
inline

Gets the grid frame style.

Returns
style for grid frame
See Also
setFrameStyle

Definition at line 652 of file qgscomposermapgrid.h.

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 millimetres
See Also
setFrameWidth

Definition at line 721 of file qgscomposermapgrid.h.

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 353 of file qgscomposermapgrid.h.

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 369 of file qgscomposermapgrid.h.

const QgsLineSymbolV2* 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

Definition at line 469 of file qgscomposermapgrid.h.

QgsLineSymbolV2* 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 478 of file qgscomposermapgrid.h.

const QgsMarkerSymbolV2* 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

Definition at line 496 of file qgscomposermapgrid.h.

QgsMarkerSymbolV2* 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 505 of file qgscomposermapgrid.h.

double QgsComposerMapGrid::maxExtension ( ) const

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

Returns
maximum extension in millimetres

Definition at line 1957 of file qgscomposermapgrid.cpp.

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 385 of file qgscomposermapgrid.h.

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 401 of file qgscomposermapgrid.h.

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 322 of file qgscomposermapgrid.cpp.

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 2103 of file qgscomposermapgrid.cpp.

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 2154 of file qgscomposermapgrid.cpp.

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 1910 of file qgscomposermapgrid.cpp.

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 515 of file qgscomposermapgrid.h.

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 527 of file qgscomposermapgrid.h.

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 539 of file qgscomposermapgrid.h.

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 630 of file qgscomposermapgrid.h.

void QgsComposerMapGrid::setAnnotationFrameDistance ( const double  distance)
inline

Sets the distance between the map frame and annotations.

Units are in millimetres.

Parameters
distancemargin between map frame and annotations
See Also
annotationFrameDistance

Definition at line 598 of file qgscomposermapgrid.h.

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 2162 of file qgscomposermapgrid.cpp.

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 551 of file qgscomposermapgrid.h.

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 305 of file qgscomposermapgrid.h.

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 millimetres
See Also
crossLength

Definition at line 426 of file qgscomposermapgrid.h.

void QgsComposerMapGrid::setCrs ( const QgsCoordinateReferenceSystem crs)

Sets the CRS for the grid.

Parameters
crscoordinate reference system for grid
See Also
crs

Definition at line 440 of file qgscomposermapgrid.cpp.

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 2234 of file qgscomposermapgrid.cpp.

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 761 of file qgscomposermapgrid.h.

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 777 of file qgscomposermapgrid.h.

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 744 of file qgscomposermapgrid.h.

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 728 of file qgscomposermapgrid.h.

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 2136 of file qgscomposermapgrid.cpp.

void QgsComposerMapGrid::setFrameSideFlags ( const 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 2131 of file qgscomposermapgrid.cpp.

void QgsComposerMapGrid::setFrameStyle ( const FrameStyle  style)
inline

Sets the grid frame style.

Parameters
stylestyle for grid frame
See Also
frameStyle

Definition at line 646 of file qgscomposermapgrid.h.

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 millimetres
See Also
frameWidth

Definition at line 713 of file qgscomposermapgrid.h.

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 247 of file qgscomposermapgrid.cpp.

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 239 of file qgscomposermapgrid.cpp.

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 2053 of file qgscomposermapgrid.cpp.

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 2063 of file qgscomposermapgrid.cpp.

void QgsComposerMapGrid::setLineSymbol ( QgsLineSymbolV2 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 1898 of file qgscomposermapgrid.cpp.

void QgsComposerMapGrid::setMarkerSymbol ( QgsMarkerSymbolV2 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 1904 of file qgscomposermapgrid.cpp.

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 2073 of file qgscomposermapgrid.cpp.

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 2083 of file qgscomposermapgrid.cpp.

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 2093 of file qgscomposermapgrid.cpp.

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 2043 of file qgscomposermapgrid.cpp.

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 419 of file qgscomposermapgrid.h.

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 2149 of file qgscomposermapgrid.cpp.

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 337 of file qgscomposermapgrid.h.

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 446 of file qgscomposermapgrid.cpp.

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 255 of file qgscomposermapgrid.cpp.

Friends And Related Function Documentation

friend class TestQgsComposerMapGrid
friend

Definition at line 964 of file qgscomposermapgrid.h.


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