QGIS API Documentation
2.6.0-Brighton
|
An individual grid which is drawn above the map content in a QgsComposerMap. More...
#include <qgscomposermapgrid.h>
Classes | |
class | QgsMapAnnotation |
Public Member Functions | |
QgsComposerMapGrid (const QString &name, QgsComposerMap *map) | |
Constructor for QgsComposerMapGrid. | |
virtual | ~QgsComposerMapGrid () |
void | draw (QPainter *painter) |
Draws a grid. | |
bool | writeXML (QDomElement &elem, QDomDocument &doc) const |
Stores grid state in DOM element. | |
bool | readXML (const QDomElement &itemElem, const QDomDocument &doc) |
Sets grid state from a DOM document. | |
void | setCrs (const QgsCoordinateReferenceSystem &crs) |
Sets the CRS for the grid. | |
QgsCoordinateReferenceSystem | crs () const |
Retrieves the CRS for the grid. | |
void | setBlendMode (const QPainter::CompositionMode mode) |
Sets the blending mode used for drawing the grid. | |
QPainter::CompositionMode | blendMode () const |
Retrieves the blending mode used for drawing the grid. | |
bool | usesAdvancedEffects () const |
Returns true if the item is drawn using advanced effects, such as blend modes. | |
double | maxExtension () const |
Calculates the maximum distance the grid extends beyond the QgsComposerMap's item rect. | |
void | setUnits (const GridUnit unit) |
Sets the units to use for grid measurements such as the interval and offset for grid lines. | |
GridUnit | units () const |
Gets the units used for grid measurements such as the interval and offset for grid lines. | |
void | setIntervalX (const double interval) |
Sets the interval between grid lines in the x-direction. | |
double | intervalX () const |
Gets the interval between grid lines in the x-direction. | |
void | setIntervalY (const double interval) |
Sets the interval between grid lines in the y-direction. | |
double | intervalY () const |
Gets the interval between grid lines in the y-direction. | |
void | setOffsetX (const double offset) |
Sets the offset for grid lines in the x-direction. | |
double | offsetX () const |
Gets the offset for grid lines in the x-direction. | |
void | setOffsetY (const double offset) |
Sets the offset for grid lines in the y-direction. | |
double | offsetY () const |
Gets 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. | |
GridStyle | style () const |
Gets the grid's style, which controls how the grid is drawn over the map's contents. | |
void | setCrossLength (const double length) |
Sets the length of the cross segments drawn for the grid. | |
double | crossLength () const |
Retrieves the length of the cross segments drawn for the grid. | |
void | setGridLineWidth (const double width) |
Sets width of grid lines. | |
void | setGridLineColor (const QColor &color) |
Sets color of grid lines. | |
void | setLineSymbol (QgsLineSymbolV2 *symbol) |
Sets the line symbol used for drawing grid lines. | |
const QgsLineSymbolV2 * | lineSymbol () const |
Gets the line symbol used for drawing grid lines. | |
QgsLineSymbolV2 * | lineSymbol () |
Gets the line symbol used for drawing grid lines. | |
void | setMarkerSymbol (QgsMarkerSymbolV2 *symbol) |
Sets the marker symbol used for drawing grid points. | |
const QgsMarkerSymbolV2 * | markerSymbol () const |
Gets the marker symbol used for drawing grid points. | |
QgsMarkerSymbolV2 * | markerSymbol () |
Gets the marker symbol used for drawing grid points. | |
void | setAnnotationEnabled (const bool enabled) |
Sets whether annotations should be shown for the grid. | |
bool | annotationEnabled () const |
Gets whether annotations are shown for the grid. | |
void | setAnnotationFont (const QFont &font) |
Sets the font used for drawing grid annotations. | |
QFont | annotationFont () const |
Gets the font used for drawing grid annotations. | |
void | setAnnotationFontColor (const QColor &color) |
Sets the font color used for drawing grid annotations. | |
QColor | annotationFontColor () const |
Gets the font color used for drawing grid annotations. | |
void | setAnnotationPrecision (const int precision) |
Sets the coordinate precision for grid annotations. | |
int | annotationPrecision () const |
Returns the coordinate precision for grid annotations. | |
void | setAnnotationPosition (const AnnotationPosition position, const BorderSide border) |
Sets the position for the grid annotations on a specified side of the map frame. | |
AnnotationPosition | annotationPosition (const BorderSide border) const |
Gets the position for the grid annotations on a specified side of the map frame. | |
void | setAnnotationFrameDistance (const double distance) |
Sets the distance between the map frame and annotations. | |
double | annotationFrameDistance () const |
Gets the distance between the map frame and annotations. | |
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. | |
AnnotationDirection | annotationDirection (const BorderSide border) const |
Gets the direction for drawing frame annotations. | |
void | setAnnotationFormat (const AnnotationFormat format) |
Sets the format for drawing grid annotations. | |
AnnotationFormat | annotationFormat () const |
Gets the format for drawing grid annotations. | |
void | setFrameStyle (const FrameStyle style) |
Sets the grid frame style. | |
FrameStyle | frameStyle () const |
Gets the grid frame style. | |
void | setFrameSideFlags (const FrameSideFlags flags) |
Sets flags for grid frame sides. | |
void | setFrameSideFlag (const FrameSideFlag flag, bool on=true) |
Sets whether the grid frame is drawn for a certain side of the map item. | |
FrameSideFlags | frameSideFlags () const |
Returns the flags which control which sides of the map item the grid frame is drawn on. | |
bool | testFrameSideFlag (const FrameSideFlag flag) const |
Tests whether the grid frame should be drawn on a specified side of the map item. | |
void | setFrameWidth (const double width) |
Sets the grid frame width. | |
double | frameWidth () const |
Gets the grid frame width. | |
void | setFramePenSize (const double width) |
Sets the width of the outline drawn in the grid frame. | |
double | framePenSize () const |
Retrieves the width of the outline drawn in the grid frame. | |
void | setFramePenColor (const QColor &color) |
Sets the color of the outline drawn in the grid frame. | |
QColor | framePenColor () const |
Retrieves the color of the outline drawn in the grid frame. | |
void | setFrameFillColor1 (const QColor &color) |
Sets the first fill color used for the grid frame. | |
QColor | frameFillColor1 () const |
Retrieves the first fill color for the grid frame. | |
void | setFrameFillColor2 (const QColor &color) |
Sets the second fill color used for the grid frame. | |
QColor | frameFillColor2 () const |
Retrieves the second fill color for the grid frame. | |
Public Member Functions inherited from QgsComposerMapItem | |
QgsComposerMapItem (const QString &name, QgsComposerMap *map) | |
Constructor for QgsComposerMapItem. | |
virtual | ~QgsComposerMapItem () |
virtual void | setComposerMap (QgsComposerMap *map) |
Sets composer map for the item. | |
virtual const QgsComposerMap * | composerMap () const |
Get composer map for the item. | |
QString | id () const |
Get the unique id for the map item. | |
virtual void | setName (const QString &name) |
Sets the friendly display name for the item. | |
virtual QString | name () const |
Get friendly display name for the item. | |
virtual void | setEnabled (const bool enabled) |
Controls whether the item will be drawn. | |
virtual bool | enabled () const |
Returns whether the item will be drawn. | |
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 | TestQgsComposerMapGrid |
Additional Inherited Members | |
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 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 | |
QString | mName |
Friendly display name. | |
QgsComposerMap * | mComposerMap |
Associated composer map. | |
QString | mUuid |
Unique id. | |
bool | mEnabled |
True if item is to be displayed on map. |
An individual grid which is drawn above the map content in a QgsComposerMap.
QgsComposerMapGrid::QgsComposerMapGrid | ( | const QString & | name, |
QgsComposerMap * | map | ||
) |
Constructor for QgsComposerMapGrid.
name | friendly display name for grid |
map | QgsComposerMap the grid is attached to |
|
virtual |
QgsComposerMapGrid::AnnotationDirection QgsComposerMapGrid::annotationDirection | ( | const BorderSide | border | ) | const |
Gets the direction for drawing frame annotations.
border | side of map for annotations |
|
inline |
Gets whether annotations are shown for the grid.
|
inline |
Gets the font used for drawing grid annotations.
|
inline |
Gets the font color used for drawing grid annotations.
|
inline |
Gets the format for drawing grid annotations.
|
inline |
Gets the distance between the map frame and annotations.
Units are in millimetres.
QgsComposerMapGrid::AnnotationPosition QgsComposerMapGrid::annotationPosition | ( | const BorderSide | border | ) | const |
Gets the position for the grid annotations on a specified side of the map frame.
border | side of map for annotations |
|
inline |
Returns the coordinate precision for grid annotations.
|
inline |
Retrieves the blending mode used for drawing the grid.
|
inline |
Retrieves the length of the cross segments drawn for the grid.
This is only used for grids with QgsComposerMapGrid::Cross styles
|
inline |
|
virtual |
|
inline |
Retrieves the first fill color for the grid frame.
|
inline |
Retrieves the second fill color for the grid frame.
|
inline |
Retrieves the color of the outline drawn in the grid frame.
|
inline |
Retrieves the width of the outline drawn in the grid frame.
QgsComposerMapGrid::FrameSideFlags QgsComposerMapGrid::frameSideFlags | ( | ) | const |
Returns the flags which control which sides of the map item the grid frame is drawn on.
|
inline |
|
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.
|
inline |
Gets the interval between grid lines in the x-direction.
The units are retrieved through the units() method.
|
inline |
Gets the interval between grid lines in the y-direction.
The units are retrieved through the units() method.
|
inline |
Gets the line symbol used for drawing grid lines.
This is only used for grids with QgsComposerMapGrid::Solid or QgsComposerMapGrid::Cross styles.
|
inline |
Gets the line symbol used for drawing grid lines.
This is only used for grids with QgsComposerMapGrid::Solid or QgsComposerMapGrid::Cross styles.
|
inline |
Gets the marker symbol used for drawing grid points.
This is only used for grids with a QgsComposerMapGrid::Markers style.
|
inline |
Gets the marker symbol used for drawing grid points.
This is only used for grids with a QgsComposerMapGrid::Markers style.
double QgsComposerMapGrid::maxExtension | ( | ) | const |
Calculates the maximum distance the grid extends beyond the QgsComposerMap's item rect.
|
inline |
Gets the offset for grid lines in the x-direction.
The units are retrieved through the units() method.
|
inline |
Gets the offset for grid lines in the y-direction.
The units are retrieved through the units() method.
|
virtual |
Sets grid state from a DOM document.
itemElem | is DOM node corresponding to a 'ComposerMapGrid' tag |
doc | is DOM document |
Reimplemented from QgsComposerMapItem.
void QgsComposerMapGrid::setAnnotationDirection | ( | const AnnotationDirection | direction, |
const BorderSide | border | ||
) |
Sets the direction for drawing frame annotations.
direction | direction for frame annotations |
border | side of map for annotations |
void QgsComposerMapGrid::setAnnotationDirection | ( | const AnnotationDirection | direction | ) |
Sets the direction for drawing all frame annotations.
direction | direction for frame annotations |
|
inline |
Sets whether annotations should be shown for the grid.
enabled | set to true to draw annotations for the grid |
|
inline |
Sets the font used for drawing grid annotations.
font | font for annotations |
|
inline |
Sets the font color used for drawing grid annotations.
color | font color for annotations |
|
inline |
Sets the format for drawing grid annotations.
format | format for grid annotations |
|
inline |
Sets the distance between the map frame and annotations.
Units are in millimetres.
distance | margin between map frame and annotations |
void QgsComposerMapGrid::setAnnotationPosition | ( | const AnnotationPosition | position, |
const BorderSide | border | ||
) |
Sets the position for the grid annotations on a specified side of the map frame.
position | position to draw grid annotations |
border | side of map for annotations |
|
inline |
Sets the coordinate precision for grid annotations.
precision | number of decimal places to show when drawing grid annotations |
|
inline |
Sets the blending mode used for drawing the grid.
mode | blending mode for grid |
|
inline |
Sets the length of the cross segments drawn for the grid.
This is only used for grids with QgsComposerMapGrid::Cross styles
length | cross length in millimetres |
void QgsComposerMapGrid::setCrs | ( | const QgsCoordinateReferenceSystem & | crs | ) |
|
inline |
Sets the first fill color used for the grid frame.
color | first fill color for grid frame |
|
inline |
Sets the second fill color used for the grid frame.
color | second fill color for grid frame |
|
inline |
Sets the color of the outline drawn in the grid frame.
color | color of grid frame outline |
|
inline |
Sets the width of the outline drawn in the grid frame.
width | width of grid frame outline |
void QgsComposerMapGrid::setFrameSideFlag | ( | const FrameSideFlag | flag, |
bool | on = true |
||
) |
Sets whether the grid frame is drawn for a certain side of the map item.
flag | flag for grid frame side |
on | set to true to draw grid frame on that side of the map |
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.
flags | flags for grid frame sides |
|
inline |
|
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.
width | width of grid frame in millimetres |
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.
color | color of grid lines |
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.
width | grid line width |
void QgsComposerMapGrid::setIntervalX | ( | const double | interval | ) |
Sets the interval between grid lines in the x-direction.
The units are controlled through the setUnits method
interval | interval between horizontal grid lines |
void QgsComposerMapGrid::setIntervalY | ( | const double | interval | ) |
Sets the interval between grid lines in the y-direction.
The units are controlled through the setUnits method
interval | interval between vertical grid lines |
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.
symbol | line symbol for grid lines |
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.
symbol | marker symbol for grid intersection points |
void QgsComposerMapGrid::setOffsetX | ( | const double | offset | ) |
Sets the offset for grid lines in the x-direction.
The units are controlled through the setUnits method
offset | offset for horizontal grid lines |
void QgsComposerMapGrid::setOffsetY | ( | const double | offset | ) |
Sets the offset for grid lines in the y-direction.
The units are controlled through the setUnits method
offset | offset for vertical grid lines |
void QgsComposerMapGrid::setStyle | ( | const GridStyle | style | ) |
Sets the grid style, which controls how the grid is drawn over the map's contents.
style | desired grid style |
void QgsComposerMapGrid::setUnits | ( | const GridUnit | unit | ) |
Sets the units to use for grid measurements such as the interval and offset for grid lines.
unit | unit for grid measurements |
|
inline |
Gets the grid's style, which controls how the grid is drawn over the map's contents.
bool QgsComposerMapGrid::testFrameSideFlag | ( | const FrameSideFlag | flag | ) | const |
Tests whether the grid frame should be drawn on a specified side of the map item.
flag | flag for grid frame side |
|
inline |
Gets the units used for grid measurements such as the interval and offset for grid lines.
|
virtual |
Returns true if the item is drawn using advanced effects, such as blend modes.
Reimplemented from QgsComposerMapItem.
|
virtual |
Stores grid state in DOM element.
elem | is DOM element corresponding to a 'ComposerMap' tag |
doc | DOM document |
Reimplemented from QgsComposerMapItem.
|
friend |