~ubuntu-branches/ubuntu/utopic/qgis/utopic

« back to all changes in this revision

Viewing changes to src/core/composer/qgscomposerlegend.h

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-04-24 15:12:20 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20120424151220-r88g00af5fpn5fc3
Tags: 1.7.4+1.7.5~20120320-1
The "Sometimes they come back" release.

* Branching from Qgis tree and adapting to current Debian Policy and
  standards. The target tree is currently set to release-1.7.
  (closes: #661491, #606304, #615683, #616182, #600308)
* Policy bumped to 3.9.3.
* Moving to debhelper compatibility level 9.
* Source format is now 3.0 with quilt support.
* Merged with 2bf42287 upstream git snapshot.
* Migrated to dh_python2 instead of python-central.
  (closes: #617048)
* Snapshot in qgis.org release-1.7: c936d031
* Added an automagic creation of a lintian override for sqlite embedding.
  This is required for uploading currently.
* Added missing ${misc:Depends} to make lintian happy.
* Copyright notes updated and debian/copyright moved to format 1.0.
* More licenses notices now reported in debian/copyright. Thanks ftpmasters.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "qgslegendmodel.h"
23
23
 
24
24
class QgsSymbol;
 
25
class QgsSymbolV2;
 
26
class QgsComposerGroupItem;
 
27
class QgsComposerLayerItem;
 
28
class QgsComposerMap;
25
29
 
26
30
/** \ingroup MapComposer
27
31
 * A legend that can be placed onto a map composition
34
38
    QgsComposerLegend( QgsComposition* composition );
35
39
    ~QgsComposerLegend();
36
40
 
 
41
    /** return correct graphics item type. Added in v1.7 */
 
42
    virtual int type() const { return ComposerLegend; }
 
43
 
37
44
    /** \brief Reimplementation of QCanvasItem::paint*/
38
45
    void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
39
46
 
53
60
    QFont titleFont() const;
54
61
    void setTitleFont( const QFont& f );
55
62
 
 
63
    QFont groupFont() const;
 
64
    void setGroupFont( const QFont& f );
 
65
 
56
66
    QFont layerFont() const;
57
67
    void setLayerFont( const QFont& f );
58
68
 
77
87
    double symbolHeight() const {return mSymbolHeight;}
78
88
    void setSymbolHeight( double h ) {mSymbolHeight = h;}
79
89
 
 
90
    void setComposerMap( const QgsComposerMap* map );
 
91
    const QgsComposerMap* composerMap() const { return mComposerMap; }
 
92
 
80
93
    /**Updates the model and all legend entries*/
81
94
    void updateLegend();
82
95
 
83
96
    /** stores state in Dom node
84
97
       * @param elem is Dom element corresponding to 'Composer' tag
85
 
       * @param temp write template file
 
98
       * @param doc Dom document
86
99
       */
87
100
    bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
88
101
 
89
102
    /** sets state from Dom document
90
103
       * @param itemElem is Dom node corresponding to item tag
 
104
       * @param doc is Dom document
91
105
       */
92
106
    bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
93
107
 
94
108
  public slots:
95
109
    /**Data changed*/
96
110
    void synchronizeWithModel();
 
111
    /**Sets mCompositionMap to 0 if the map is deleted*/
 
112
    void invalidateCurrentMap();
97
113
 
98
114
  protected:
99
115
    QString mTitle;
100
116
 
101
117
    //different fonts for entries
102
118
    QFont mTitleFont;
 
119
    QFont mGroupFont;
103
120
    QFont mLayerFont;
104
121
    QFont mItemFont;
105
122
 
118
135
 
119
136
    QgsLegendModel mLegendModel;
120
137
 
 
138
    /**Reference to map (because symbols are sometimes in map units)*/
 
139
    const QgsComposerMap* mComposerMap;
 
140
 
121
141
 
122
142
  private:
123
143
    QgsComposerLegend(); //forbidden
124
144
 
 
145
    /**Draws a group item and all subitems*/
 
146
    void drawGroupItem( QPainter* p, QgsComposerGroupItem* groupItem, double& currentYCoord, double& maxXCoord );
 
147
    /**Draws a layer item and all subitems*/
 
148
    void drawLayerItem( QPainter* p, QgsComposerLayerItem* layerItem, double& currentYCoord, double& maxXCoord );
 
149
 
125
150
    /**Draws child items of a layer item
 
151
       @param p painter
126
152
       @param layerItem parent model item (layer)
127
153
       @param currentYCoord in/out: current y position of legend item
128
154
       @param maxXCoord in/out: maximum x-coordinate of the whole legend
133
159
    /**Draws a symbol at the current y position and returns the new x position. Returns real symbol height, because for points,
134
160
     it is possible that it differs from mSymbolHeight*/
135
161
    void drawSymbol( QPainter* p, QgsSymbol* s, double currentYCoord, double& currentXPosition, double& symbolHeight, int layerOpacity = 255 ) const;
 
162
    void drawSymbolV2( QPainter* p, QgsSymbolV2* s, double currentYCoord, double& currentXPosition, double& symbolHeight, int layerOpacity = 255 ) const;
136
163
    void drawPointSymbol( QPainter*, QgsSymbol* s, double currentYCoord, double& currentXPosition, double& symbolHeight, int opacity = 255 ) const;
137
164
    void drawLineSymbol( QPainter*, QgsSymbol* s, double currentYCoord, double& currentXPosition, int opacity = 255 ) const;
138
165
    void drawPolygonSymbol( QPainter* p, QgsSymbol* s, double currentYCoord, double& currentXPosition, int opacity = 255 ) const;