/usr/include/qgis/qgscomposermapitem.h is in libqgis-dev 2.8.6+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | /***************************************************************************
qgscomposermapitem.h
-------------------
begin : September 2014
copyright : (C) 2014 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSCOMPOSERMAPITEM_H
#define QGSCOMPOSERMAPITEM_H
#include "qgscomposerobject.h"
class QgsComposerMap;
/** \ingroup MapComposer
* \class QgsComposerMapItem
* \brief An item which is drawn inside a QgsComposerMap, eg a grid or map overview.
*/
class CORE_EXPORT QgsComposerMapItem : public QgsComposerObject
{
Q_OBJECT
public:
/**Constructor for QgsComposerMapItem.
* @param name friendly display name for item
* @param map QgsComposerMap the item is attached to
*/
QgsComposerMapItem( const QString& name, QgsComposerMap* map );
virtual ~QgsComposerMapItem();
/**Draws the item on to a painter
* @param painter destination QPainter
*/
virtual void draw( QPainter* painter ) = 0;
/**Stores map item state in DOM element
* @param elem is DOM element corresponding to a 'ComposerMap' tag
* @param doc DOM document
* @see readXML
*/
virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const override;
/**Sets map item state from a DOM document
* @param itemElem is DOM node corresponding to a 'ComposerMapGrid' tag
* @param doc is DOM document
* @see writeXML
*/
virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) override;
/**Sets composer map for the item
* @param map composer map
* @see composerMap
*/
virtual void setComposerMap( QgsComposerMap* map );
/**Get composer map for the item
* @returns composer map
* @see setComposerMap
*/
virtual const QgsComposerMap* composerMap() const { return mComposerMap; }
/**Get the unique id for the map item
* @returns unique id
*/
QString id() const { return mUuid; }
/**Sets the friendly display name for the item
* @param name display name
* @see name
*/
virtual void setName( const QString& name ) { mName = name; }
/**Get friendly display name for the item
* @returns display name
* @see setName
*/
virtual QString name() const { return mName; }
/**Controls whether the item will be drawn
* @param enabled set to true to enable drawing of the item
* @see enabled
*/
virtual void setEnabled( const bool enabled ) { mEnabled = enabled; }
/**Returns whether the item will be drawn
* @returns true if item will be drawn on the map
* @see setEnabled
*/
virtual bool enabled() const { return mEnabled; }
/**Returns true if the item is drawn using advanced effects, such as blend modes.
* @returns true if item uses advanced effects
*/
virtual bool usesAdvancedEffects() const { return false; }
protected:
/**Friendly display name*/
QString mName;
/**Associated composer map*/
QgsComposerMap* mComposerMap;
/**Unique id*/
QString mUuid;
/**True if item is to be displayed on map*/
bool mEnabled;
};
/**\ingroup MapComposer
* \class QgsComposerMapItemStack
* \brief A collection of map items which are drawn above the map content in a
* QgsComposerMap. The item stack controls which items are drawn and the
* order they are drawn in.
* \note added in QGIS 2.5
* \see QgsComposerMapItem
*/
class CORE_EXPORT QgsComposerMapItemStack
{
public:
/**Constructor for QgsComposerMapItemStack.
* @param map QgsComposerMap the item stack is attached to
*/
QgsComposerMapItemStack( QgsComposerMap* map );
virtual ~QgsComposerMapItemStack();
/**Returns the number of items in the stack
* @returns number of items in the stack
*/
int size() const { return mItems.size(); }
/**Stores the state of the item stack in a DOM node
* @param elem is DOM element corresponding to a 'ComposerMap' tag
* @param doc DOM document
* @returns true if write was successful
* @see readXML
*/
virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
/**Sets the item stack's state from a DOM document
* @param elem is DOM node corresponding to 'a ComposerMap' tag
* @param doc DOM document
* @returns true if read was successful
* @see writeXML
*/
virtual bool readXML( const QDomElement& elem, const QDomDocument& doc ) = 0;
/**Draws the items from the stack on a specified painter
* @param painter destination QPainter
*/
void drawItems( QPainter* painter );
/**Returns whether any items within the stack contain advanced effects,
* such as blending modes
* @returns true if item stack contains advanced effects
*/
bool containsAdvancedEffects() const;
protected:
/**Adds a new map item to the stack and takes ownership of the item.
* The item will be added to the end of the stack, and rendered
* above any existing map items already present in the stack.
* @param item QgsComposerMapItem to add to the stack
* @note after adding an item to the stack update()
* should be called for the QgsComposerMap to prevent rendering artifacts
* @see removeItem
*/
void addItem( QgsComposerMapItem* item );
/**Removes an item from the stack and deletes the corresponding QgsComposerMapItem
* @param itemId id for the QgsComposerMapItem to remove
* @note after removing an item from the stack, update()
* should be called for the QgsComposerMap to prevent rendering artifacts
* @see addItem
*/
void removeItem( const QString& itemId );
/**Moves an item up the stack, causing it to be rendered above other items
* @param itemId id for the QgsComposerMapItem to move up
* @note after moving an item within the stack, update() should be
* called for the QgsComposerMap to redraw the map with the new item stack order
* @see moveItemDown
*/
void moveItemUp( const QString& itemId );
/**Moves an item up the stack, causing it to be rendered above other items
* @param itemId id for the QgsComposerMapItem to move down
* @note after moving an item within the stack, update() should be
* called for the QgsComposerMap to redraw the map with the new item stack order
* @see moveItemUp
*/
void moveItemDown( const QString& itemId );
/**Returns a const reference to an item within the stack
* @param itemId id for the QgsComposerMapItem to find
* @returns const reference to item, if found
* @see item
*/
const QgsComposerMapItem* constItem( const QString& itemId ) const;
/**Returns a reference to an item within the stack
* @param itemId id for the QgsComposerMapItem to find
* @returns reference to item if found
* @see constItem
*/
QgsComposerMapItem* item( const QString& itemId ) const;
/**Returns a reference to an item within the stack
* @param index item position in the stack
* @returns reference to item if found
* @see constItem
*/
QgsComposerMapItem* item( const int index ) const;
/**Returns a reference to an item within the stack
* @param idx item position in the stack
* @returns reference to item if found
* @see constItem
* @see item
* @note not available in python bindings
*/
QgsComposerMapItem &operator[]( int idx );
/**Returns a list of QgsComposerMapItems contained by the stack
* @returns list of items
*/
QList< QgsComposerMapItem* > asList() const;
protected:
QList< QgsComposerMapItem* > mItems;
QgsComposerMap* mComposerMap;
/**Clears the item stack and deletes all QgsComposerMapItems contained
* by the stack
*/
void removeItems();
};
#endif //QGSCOMPOSERMAPITEM_H
|