1
- /** \ingroup core
2
- * Graphics scene for map printing. The class manages the paper item which always
3
- * is the item in the back (z-value 0). It maintains the z-Values of the items and stores
4
- * them in a list in ascending z-Order. This list can be changed to lower/raise items one position
5
- * or to bring them to front/back.
6
- * */
7
1
class QgsComposition : QGraphicsScene, QgsExpressionContextGenerator
8
2
{
9
3
%TypeHeaderCode
@@ -12,15 +6,13 @@ class QgsComposition : QGraphicsScene, QgsExpressionContextGenerator
12
6
13
7
public:
14
8
15
- /** \brief Plot type */
16
9
enum PlotStyle
17
10
{
18
- Preview, // Use cache etc
19
- Print, // Render well
20
- Postscript // Fonts need different scaling!
11
+ Preview,
12
+ Print,
13
+ Postscript
21
14
};
22
15
23
- /** Style to draw the snapping grid*/
24
16
enum GridStyle
25
17
{
26
18
Solid,
@@ -40,153 +32,40 @@ class QgsComposition : QGraphicsScene, QgsExpressionContextGenerator
40
32
Landscape
41
33
};
42
34
43
- explicit QgsComposition( QgsProject* project );
35
+ explicit QgsComposition( QgsProject * project );
44
36
45
- /** Composition atlas modes*/
46
37
enum AtlasMode
47
38
{
48
- AtlasOff, // Composition is not being controlled by an atlas
49
- PreviewAtlas, // An atlas composition is being previewed in the app
50
- ExportAtlas // The composition is being exported as an atlas
39
+ AtlasOff,
40
+ PreviewAtlas,
41
+ ExportAtlas
51
42
};
52
43
53
44
~QgsComposition();
54
45
55
- /**
56
- * The project associated with the composition. Used to get access to layers, map themes,
57
- * relations and various other bits. It is never null.
58
- *
59
- * \note Added in QGIS 3.0
60
- */
61
- QgsProject* project() const;
62
-
63
- /** Changes size of paper item.
64
- * @param width page width in mm
65
- * @param height page height in mm
66
- * @param keepRelativeItemPosition if true, all items and guides will be moved so that they retain
67
- * their same relative position to the top left corner of their current page.
68
- * @see paperHeight
69
- * @see paperWidth
70
- */
46
+ QgsProject *project() const;
47
+ QString name() const;
48
+ void setName( const QString &name );
71
49
void setPaperSize( double width, double height,
72
50
bool keepRelativeItemPosition = true );
73
-
74
- /** Height of paper item
75
- * @returns height in mm
76
- * @see paperWidth
77
- * @see setPaperSize
78
- */
79
51
double paperHeight() const;
80
-
81
- /** Width of paper item
82
- * @returns width in mm
83
- * @see paperHeight
84
- * @see setPaperSize
85
- */
86
52
double paperWidth() const;
87
-
88
- /** Resizes the composition page to fit the current contents of the composition.
89
- * Calling this method resets the number of pages to 1, with the size set to the
90
- * minimum size required to fit all existing composer items. Items will also be
91
- * repositioned so that the new top-left bounds of the composition is at the point
92
- * (marginLeft, marginTop). An optional margin can be specified.
93
- * @param marginTop top margin (millimeters)
94
- * @param marginRight right margin (millimeters)
95
- * @param marginBottom bottom margin (millimeters)
96
- * @param marginLeft left margin (millimeters)
97
- * @note added in QGIS 2.12
98
- * @see setResizeToContentsMargins()
99
- * @see resizeToContentsMargins()
100
- */
101
53
void resizePageToContents( double marginTop = 0.0, double marginRight = 0.0,
102
54
double marginBottom = 0.0, double marginLeft = 0.0 );
103
-
104
- /** Sets the resize to contents margins. These margins are saved in the composition
105
- * so that they can be restored with the composer.
106
- * @param marginTop top margin (millimeters)
107
- * @param marginRight right margin (millimeters)
108
- * @param marginBottom bottom margin (millimeters)
109
- * @param marginLeft left margin (millimeters)
110
- * @note added in QGIS 2.12
111
- * @see resizePageToContents()
112
- * @see resizeToContentsMargins()
113
- */
114
55
void setResizeToContentsMargins( double marginTop, double marginRight,
115
56
double marginBottom, double marginLeft );
116
-
117
- /** Returns the resize to contents margins. These margins are saved in the composition
118
- * so that they can be restored with the composer.
119
- * @param marginTop reference for top margin (millimeters)
120
- * @param marginRight reference for right margin (millimeters)
121
- * @param marginBottom reference for bottom margin (millimeters)
122
- * @param marginLeft reference for left margin (millimeters)
123
- * @note added in QGIS 2.12
124
- * @see resizePageToContents()
125
- * @see setResizeToContentsMargins()
126
- */
127
- void resizeToContentsMargins( double& marginTop /Out/, double& marginRight /Out/,
128
- double& marginBottom /Out/, double& marginLeft /Out/ ) const;
129
-
130
- /** Returns the vertical space between pages in a composer view
131
- * @returns space between pages in mm
132
- */
57
+ void resizeToContentsMargins( double &marginTop /Out/, double &marginRight /Out/,
58
+ double &marginBottom /Out/, double &marginLeft /Out/ ) const;
133
59
double spaceBetweenPages() const;
134
-
135
- /** Sets the number of pages for the composition.
136
- * @param pages number of pages
137
- * @see numPages
138
- */
139
60
void setNumPages( const int pages );
140
-
141
- /** Returns the number of pages in the composition.
142
- * @returns number of pages
143
- * @see setNumPages
144
- */
145
61
int numPages() const;
146
-
147
- /** Returns whether a page is empty, ie, it contains no items except for the background
148
- * paper item.
149
- * @param page page number, starting with 1
150
- * @returns true if page is empty
151
- * @note added in QGIS 2.5
152
- * @see numPages
153
- * @see setNumPages
154
- * @see shouldExportPage
155
- */
156
62
bool pageIsEmpty( const int page ) const;
157
-
158
- /** Returns whether a specified page number should be included in exports of the composition.
159
- * @param page page number, starting with 1
160
- * @returns true if page should be exported
161
- * @note added in QGIS 2.5
162
- * @see numPages
163
- * @see pageIsEmpty
164
- */
165
63
bool shouldExportPage( const int page ) const;
166
-
167
- /** Note: added in version 2.1*/
168
- void setPageStyleSymbol( QgsFillSymbol* symbol );
169
- /** Note: added in version 2.1*/
170
- QgsFillSymbol* pageStyleSymbol();
171
-
172
- /** Returns the position within a page of a point in the composition
173
- @note Added in QGIS 2.1
174
- */
64
+ void setPageStyleSymbol( QgsFillSymbol *symbol );
65
+ QgsFillSymbol *pageStyleSymbol();
175
66
QPointF positionOnPage( QPointF position ) const;
176
-
177
- /** Returns the page number corresponding to a point in the composition
178
- @note Added in QGIS 2.1
179
- */
180
67
int pageNumberForPoint( QPointF position ) const;
181
-
182
- /** Sets the status bar message for the composer window
183
- @note Added in QGIS 2.1
184
- */
185
- void setStatusMessage( const QString & message );
186
-
187
- /** Refreshes the composition when composer related options change
188
- @note added in version 2.1
189
- */
68
+ void setStatusMessage( const QString &message );
190
69
void updateSettings();
191
70
192
71
void setSnapToGridEnabled( const bool b );
@@ -195,7 +74,6 @@ class QgsComposition : QGraphicsScene, QgsExpressionContextGenerator
195
74
void setGridVisible( const bool b );
196
75
bool gridVisible() const;
197
76
198
- /** Hides / shows custom snap lines*/
199
77
void setSnapLinesVisible( const bool visible );
200
78
bool snapLinesVisible() const;
201
79
@@ -777,10 +655,9 @@ class QgsComposition : QGraphicsScene, QgsExpressionContextGenerator
777
655
778
656
779
657
signals:
658
+ void nameChanged( const QString& name );
780
659
void paperSizeChanged();
781
660
void nPagesChanged();
782
-
783
- /** Is emitted when the compositions print resolution changes*/
784
661
void printResolutionChanged();
785
662
786
663
/** Is emitted when selected item changed. If 0, no item is selected*/
0 commit comments