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

An item which is drawn inside a QgsComposerMap, eg a grid or map overview. More...

#include <qgscomposermapitem.h>

Inheritance diagram for QgsComposerMapItem:
Inheritance graph
[legend]

Public Member Functions

 QgsComposerMapItem (const QString &name, QgsComposerMap *map)
 Constructor for QgsComposerMapItem.
virtual ~QgsComposerMapItem ()
virtual const QgsComposerMapcomposerMap () const
 Get composer map for the item.
virtual void draw (QPainter *painter)=0
 Draws the item on to a painter.
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 bool readXML (const QDomElement &itemElem, const QDomDocument &doc) override
 Sets map item state from a DOM document.
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.
virtual bool usesAdvancedEffects () const
 Returns true if the item is drawn using advanced effects, such as blend modes.
virtual bool writeXML (QDomElement &elem, QDomDocument &doc) const override
 Stores map item state in DOM element.
- 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.

Protected Attributes

QgsComposerMapmComposerMap
 Associated composer map.
bool mEnabled
 True if item is to be displayed on map.
QString mName
 Friendly display name.
QString mUuid
 Unique id.
- Protected Attributes inherited from QgsComposerObject
QgsCompositionmComposition
QMap
< QgsComposerObject::DataDefinedProperty,
QString > 
mDataDefinedNames
 Map of data defined properties for the item to string name to use when exporting item to xml.

Additional Inherited Members

- Public Types inherited from QgsComposerObject
enum  DataDefinedProperty {
  NoProperty = 0, AllProperties, TestProperty, PresetPaperSize,
  PaperWidth, PaperHeight, NumPages, PaperOrientation,
  PageNumber, PositionX, PositionY, ItemWidth,
  ItemHeight, ItemRotation, Transparency, BlendMode,
  ExcludeFromExports, MapRotation, MapScale, MapXMin,
  MapYMin, MapXMax, MapYMax, MapAtlasMargin,
  PictureSource, SourceUrl
}
 Data defined properties for different item types. More...
enum  PropertyValueType { EvaluatedValue = 0, OriginalValue }
 Specifies whether the value returned by a function should be the original, user set value, or the current evaluated value for the property. More...
- Public Slots 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.

Detailed Description

An item which is drawn inside a QgsComposerMap, eg a grid or map overview.

Definition at line 29 of file qgscomposermapitem.h.

Constructor & Destructor Documentation

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

Constructor for QgsComposerMapItem.

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

Definition at line 22 of file qgscomposermapitem.cpp.

QgsComposerMapItem::~QgsComposerMapItem ( )
virtual

Definition at line 32 of file qgscomposermapitem.cpp.

Member Function Documentation

virtual const QgsComposerMap* QgsComposerMapItem::composerMap ( ) const
inlinevirtual

Get composer map for the item.

Returns
composer map
See Also
setComposerMap

Definition at line 72 of file qgscomposermapitem.h.

virtual void QgsComposerMapItem::draw ( QPainter *  painter)
pure virtual

Draws the item on to a painter.

Parameters
painterdestination QPainter

Implemented in QgsComposerMapGrid, and QgsComposerMapOverview.

virtual bool QgsComposerMapItem::enabled ( ) const
inlinevirtual

Returns whether the item will be drawn.

Returns
true if item will be drawn on the map
See Also
setEnabled

Definition at line 101 of file qgscomposermapitem.h.

QString QgsComposerMapItem::id ( ) const
inline

Get the unique id for the map item.

Returns
unique id

Definition at line 77 of file qgscomposermapitem.h.

virtual QString QgsComposerMapItem::name ( ) const
inlinevirtual

Get friendly display name for the item.

Returns
display name
See Also
setName

Definition at line 89 of file qgscomposermapitem.h.

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

Sets map item state from a DOM document.

Parameters
itemElemis DOM node corresponding to a 'ComposerMapGrid' tag
docis DOM document
See Also
writeXML

Reimplemented from QgsComposerObject.

Reimplemented in QgsComposerMapGrid, and QgsComposerMapOverview.

Definition at line 46 of file qgscomposermapitem.cpp.

void QgsComposerMapItem::setComposerMap ( QgsComposerMap map)
virtual

Sets composer map for the item.

Parameters
mapcomposer map
See Also
composerMap

Definition at line 55 of file qgscomposermapitem.cpp.

virtual void QgsComposerMapItem::setEnabled ( const bool  enabled)
inlinevirtual

Controls whether the item will be drawn.

Parameters
enabledset to true to enable drawing of the item
See Also
enabled

Definition at line 95 of file qgscomposermapitem.h.

virtual void QgsComposerMapItem::setName ( const QString &  name)
inlinevirtual

Sets the friendly display name for the item.

Parameters
namedisplay name
See Also
name

Definition at line 83 of file qgscomposermapitem.h.

virtual bool QgsComposerMapItem::usesAdvancedEffects ( ) const
inlinevirtual

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

Returns
true if item uses advanced effects

Reimplemented in QgsComposerMapGrid, and QgsComposerMapOverview.

Definition at line 106 of file qgscomposermapitem.h.

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

Stores map item state in DOM element.

Parameters
elemis DOM element corresponding to a 'ComposerMap' tag
docDOM document
See Also
readXML

Reimplemented from QgsComposerObject.

Reimplemented in QgsComposerMapGrid, and QgsComposerMapOverview.

Definition at line 37 of file qgscomposermapitem.cpp.

Member Data Documentation

QgsComposerMap* QgsComposerMapItem::mComposerMap
protected

Associated composer map.

Definition at line 114 of file qgscomposermapitem.h.

bool QgsComposerMapItem::mEnabled
protected

True if item is to be displayed on map.

Definition at line 120 of file qgscomposermapitem.h.

QString QgsComposerMapItem::mName
protected

Friendly display name.

Definition at line 111 of file qgscomposermapitem.h.

QString QgsComposerMapItem::mUuid
protected

Unique id.

Definition at line 117 of file qgscomposermapitem.h.


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